<?= $this->include('themes/_commonPartialsBs/select2bs5') ?>
<?= $this->include('themes/_commonPartialsBs/datatables') ?>
<?= $this->include('themes/_commonPartialsBs/sweetalert') ?>
<?= $this->include('themes/_commonPartialsBs/_confirm2delete') ?>
<?= $this->extend('themes/vuexy/main/defaultlayout') ?>
<?= $this->section('content'); ?>
<!--Content Body-->
<div class="row">
    <div class="col-md-12">
        <div class="card">
            <div class="card-body">
                <div class="table-responsive">

                    <table class="table-maquinista table table-hover text-dark" style="width: 100%;">
                        <thead>
                            <tr>
                                <th><?= lang('ID') ?></th>
                                <th><?= lang('Users.firstName') ?></th>
                                <th><?= lang('Users.lastName') ?></th>
                                <th><?= lang('Users.email') ?></th>
                                <th class="text-nowrap"><?= lang('Basic.global.Action') ?></th>
                            </tr>
                        </thead>
                        <tbody>
                            <?php if (count($maquinistas) > 0): ?>

                                <?php foreach ($maquinistas as $key => $maquinista): ?>
                                    <tr>
                                        <td><?= $maquinista->id ?></td>
                                        <td><?= $maquinista->first_name ?></td>
                                        <td><?= $maquinista->last_name ?></td>
                                        <td><?= $maquinista->getEmail() ?></td>
                                        <td style="color: white;">
                                            <a type="button" href="<?= route_to("maquinistaChangeUserSession", $maquinista->id) ?>" class="btn btn-lg btn-primary h-100 w-100">Mi turno</a>
                                        </td>
                                    </tr>
                                <?php endforeach; ?>
                            <?php else: ?>
                                <tr class="text-center">
                                    <td colspan="5">No hay usuarios para cambiar turno</td>
                                </tr>
                            <?php endif; ?>

                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>
<?= $this->endSection() ?>

<?= $this->section('css') ?>
<link rel="stylesheet" href="<?= site_url('themes/vuexy/vendor/libs/formvalidation/dist/css/formValidation.min.css') ?>" />
<link rel="stylesheet" href="<?= site_url('themes/vuexy/css/maquinista.css') ?>" />

<?= $this->endSection() ?>

<?= $this->section("additionalExternalJs") ?>
<script src="<?= site_url("themes/vuexy/vendor/libs/formvalidation/dist/js/FormValidation.js") ?>"></script>
<script src="<?= site_url("themes/vuexy/vendor/libs/formvalidation/dist/js/plugins/Bootstrap5.min.js") ?>"></script>
<script src="<?= site_url("themes/vuexy/vendor/libs/formvalidation/dist/js/plugins/AutoFocus.min.js") ?>"></script>
<?= $this->endSection() ?>