<?= $this->extend('backend/layout/main'); ?>
<?= $this->section('css'); ?>
<link rel="stylesheet" type="text/css" href="<?= base_url() ?>assets/backend/vendor/datatables/css/dataTables.bootstrap4.css">
<link rel="stylesheet" type="text/css" href="<?= base_url() ?>assets/backend/vendor/datatables/css/buttons.bootstrap4.css">
<link rel="stylesheet" type="text/css" href="<?= base_url() ?>assets/common/lightbox/css/lightbox.min.css">
<?= $this->endSection(); ?>
<?= $this->section('title'); ?>Visitors<?= $this->endSection(); ?>
<?= $this->section('content'); ?>

<div class="container-fluid  dashboard-content">
    <div class="row">
        <div class="col-xl-12 col-lg-12 col-md-12 col-sm-12 col-12">
            <div class="page-header">
                <h2 class="pageheader-title">Visitors</h2>
                <div class="page-breadcrumb">
                    <nav aria-label="breadcrumb">
                        <ol class="breadcrumb">
                            <li class="breadcrumb-item"><a href="<?= url_to('admin_home') ?>" class="breadcrumb-link">Dashboard</a></li>
                            <li class="breadcrumb-item active" aria-current="page">Visitors</li>
                        </ol>
                    </nav>
                </div>
            </div>
        </div>
    </div>


    <div class="row">
        <div class="col-xl-12 col-lg-12 col-md-12 col-sm-12 col-12">
            <div class="card">
                <div class="card-header">
                    <h5 class="mb-0">Visitors</h5>
                </div>
                <div class="card-body">
                    <div class="table-responsive">
                        <table id="example" class="table table-striped table-bordered second" style="width:100%">
                            <thead>
                                <tr>
                                    <th>Name</th>
                                    <th>Gender</th>
                                    <th>Phone No</th>
                                    <th>From</th>
                                    <th>To</th>
                                    <th>Purpose</th>
                                    <th>Signature</th>
                                    <th>Date</th>
                                    <th>Status</th>
                                </tr>
                            </thead>
                            <tbody>
                                <?php foreach ($visitors as $visitor): ?>
                                    <tr>
                                        <td><?= join(' ', [$visitor->first_name, $visitor->last_name]) ?></td>
                                        <td><?= $visitor->gender ?></td>
                                        <td><?= $visitor->phone ?></td>
                                        <td><?= $visitor->coming_from ?></td>
                                        <td><?= $visitor->going_to ?></td>
                                        <td><?= $visitor->visit_purpose ?></td>
                                        <td>
                                            <?= view_cell('SignatureCell', ['visitor' => $visitor]) ?>
                                        </td>
                                        <td><?= Carbon\Carbon::parse($visitor->created_at)->diffForHumans(null, null, true) ?> </td>
                                        <td><?= view_cell('StatusCell', ['status' => $visitor->status]) ?> </td>
                                    </tr>
                                <?php endforeach; ?>

                            </tbody>
                            <tfoot>
                                <tr>
                                    <th>Name</th>
                                    <th>Gender</th>
                                    <th>Phone No</th>
                                    <th>From</th>
                                    <th>To</th>
                                    <th>Purpose</th>
                                    <th>Signature</th>
                                    <th>Date</th>
                                    <th>Status</th>
                                </tr>
                            </tfoot>
                        </table>
                    </div>
                </div>
            </div>
        </div>
        <!-- ============================================================== -->
        <!-- end data table  -->
        <!-- ============================================================== -->
    </div>

</div>

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

<?= $this->section('js'); ?>
<script src="<?= base_url() ?>assets/backend/vendor/datatables/js/jquery.dataTables.min.js"></script>
<script src="<?= base_url() ?>assets/backend/vendor/datatables/js/dataTables.bootstrap4.min.js"></script>
<script src="<?= base_url() ?>assets/backend/vendor/datatables/js/dataTables.buttons.min.js"></script>
<script src="<?= base_url() ?>assets/backend/vendor/datatables/js/buttons.bootstrap4.min.js"></script>
<script src="<?= base_url() ?>assets/backend/vendor/datatables/js/data-table.js"></script>
<script src="<?= base_url() ?>assets/backend/vendor/datatables/js/jszip.min.js"></script>
<script src="<?= base_url() ?>assets/backend/vendor/datatables/js/pdfmake.min.js"></script>
<script src="<?= base_url() ?>assets/backend/vendor/datatables/js/vfs_fonts.js"></script>
<script src="<?= base_url() ?>assets/backend/vendor/datatables/js/buttons.html5.min.js"></script>
<script src="<?= base_url() ?>assets/backend/vendor/datatables/js/buttons.print.min.js"></script>
<script src="<?= base_url() ?>assets/backend/vendor/datatables/js/buttons.colVis.min.js"></script>
<script src="<?= base_url() ?>assets/common/lightbox/js/lightbox-plus-jquery.min.js"></script>
<?= $this->endSection(); ?>