<?= $this->session->flashdata('pesan'); ?>
<div class="card shadow-sm border-bottom-primary">
    <div class="card-header bg-white py-3">
        <div class="row">
            <div class="col">
                <h4 class="h5 align-middle m-0 font-weight-bold text-primary">
                    Data <?= $title; ?>
                </h4>
            </div>
            <?php if (is_petugas() || is_admin()) : ?>
            <div class="col-auto">
                <a href="<?= base_url('impor/add/'.$id_stts) ?>" class="btn btn-sm btn-primary btn-icon-split">
                    <span class="icon">
                        <i class="fa fa-plus"></i>
                    </span>
                    <span class="text">
                        Tambah <?= $title; ?>
                    </span>
                </a>
            </div>
            <?php endif; ?>
        </div>
    </div>
    <div class="table-responsive">
        <table class="table table-striped" id="dataTable">
            <thead>
                <tr>
                    <th>No. </th>
                    <th>Tanggal</th>
                    <th>Jenis</th>
                    <th>Nama File</th>
                    <?php if (is_admin()) : ?>
                        <th>Aksi</th>
                    <?php endif; ?>
                </tr>
            </thead>
            <tbody>
                <?php
                $no = 1;
                if ($impor) :
                    foreach ($impor as $j) :
                        ?>
                        <tr>
                            <td><?= $no++; ?></td>
                            <td><?= $j['tgl']; ?></td>
                            <td><?= get_stts_impor($j['stts']); ?></td>
                            <td><?= $j['file']; ?></td>
                            <?php if (is_admin()) : ?>
                                <td>
                                    <a href="<?= base_url('impor/detail/') . $j['id_impor']; ?>" class="btn btn-sm btn-success"><i class="fa fa-eye"></i> Detail</a>
                                    <a onclick="return confirm('Yakin ingin hapus?')" href="<?= base_url('impor/delete/') . $j['id_impor']; ?>" class="btn btn-danger btn-sm"><i class="fa fa-trash"> Hapus</i></a>
                                </td>
                            <?php endif; ?>
                        </tr>
                    <?php endforeach; ?>
                <?php else : ?>
                    <tr>
                        <td colspan="5" class="text-center">
                            Data Kosong
                        </td>
                    </tr>
                <?php endif; ?>
            </tbody>
        </table>
    </div>
</div>