<?php
    if ($is_excel === false) {
?>
        <style type="text/css">
            body {
                font-family: sans-serif;
            }
            table {
                border-spacing: 0;
                border-collapse: collapse;
                width: 100%;
                max-width: 100%;
                margin-bottom: 20px;
                font-size:11px;
                vertical-align: middle;
                padding: 0;
                padding: 1px;
                vertical-align: top;
                text-align:center;
                font-family: sans-serif;
            }
        </style>
<?php
    }
?>

<?php
if ($data != null) {
    $jml_data = count($data);
    $nomor = 0;
    // print_r();

    foreach ($data as $key => $value) {
        $nomor++;
        $karyawan     = $value['data_karyawan'];
        $data_patroli = $value['data_patroli'];
?>
        <h3 style="text-align: center;"><?= strtoupper(strtolower($title)) ?></h3>
        <h4 style="text-align: center;"><?= strtoupper($this->lang->line('periode')); ?> : <?php echo $tanggal_mulai . ' s/d ' . $tanggal_selesai ?></h4>
        <h4> </h4>
        <table width="100%" border="1">
            <tr>
                <td style="border:1px solid #fff; text-align:left" colspan="2"><?= strtoupper($this->lang->line('nik')); ?></td>
                <td style="border:1px solid #fff; text-align:left">: <?php echo $karyawan['nik']; ?></td>
                <td style="border:1px solid #fff; text-align:left"></td>
                <td style="border:1px solid #fff; text-align:left"></td>
                <td style="border:1px solid #fff; text-align:left"></td>
                <td style="border:1px solid #fff; text-align:left" colspan="2"><?= strtoupper($this->lang->line('cabang')); ?></td>
                <td style="border:1px solid #fff; text-align:left" colspan="2">: <?php echo  $karyawan['kode_cabang']." - ".$karyawan['nama_cabang']; ?></td>
            </tr>
            <tr>
                <td style="border:1px solid #fff; text-align:left" colspan="2"><?= strtoupper($this->lang->line('petugas')); ?></td>
                <td style="border:1px solid #fff; text-align:left">: <?php echo $karyawan['nama_karyawan']; ?></td>
                <td style="border:1px solid #fff; text-align:left"></td>
                <td style="border:1px solid #fff; text-align:left"></td>
                <td style="border:1px solid #fff; text-align:left"></td>
                <td style="border:1px solid #fff; text-align:left" colspan="2"><?= strtoupper($this->lang->line('departemen')); ?></td>
                <td style="border:1px solid #fff; text-align:left" colspan="2">: <?php echo $karyawan['kode_departemen']." - ".$karyawan['nama_departemen']; ?></td>
            </tr>
            <tr>
                <td style="border:1px solid #fff; text-align:left" colspan="2"></td>
                <td style="border:1px solid #fff; text-align:left"></td>
                <td style="border:1px solid #fff; text-align:left"></td>
                <td style="border:1px solid #fff; text-align:left"></td>
                <td style="border:1px solid #fff; text-align:left"></td>
                <td style="border:1px solid #fff; text-align:left" colspan="2"><?= strtoupper($this->lang->line('menu_jabatan')); ?></td>
                <td style="border:1px solid #fff; text-align:left" colspan="2">: <?php echo  $karyawan['kode_jabatan']." - ".$karyawan['nama_jabatan']; ?></td>
            </tr>
            <tr>
                <td style="text-align:center;" width="20" rowspan="2">NO</td>
                <td style="text-align:center;" width="50" rowspan="2"><?= strtoupper($this->lang->line('tgl')); ?></td>
                <td style="text-align:center;" width="50" colspan="3"><?= strtoupper($this->lang->line('jadwal')); ?></td>
                <td style="text-align:center;" width="50" rowspan="2"><?= strtoupper($this->lang->line('patroli')); ?></td>
                <td style="text-align:center;" colspan="3" rowspan="2"><?= strtoupper($this->lang->line('keterangan')); ?></td>
                <td style="text-align:center;" width="100" rowspan="2"><?= strtoupper($this->lang->line('lokasi')); ?></td>
            </tr>
            <tr>
                <td><?= strtoupper($this->lang->line('nama_patroli')); ?></td>
                <td><?= strtoupper($this->lang->line('mulai')); ?></td>
                <td><?= strtoupper($this->lang->line('selesai')); ?></td>
            </tr>
            <?php
                if (count($data_patroli) > 0) {
                    $no = 1;
                    foreach ($data_patroli as $k => $v) {
            ?>
                        <tr>
                            <td><?php echo $no ?></td>
                            <td><?php echo $v['tgl'] ?></td>
                            <td><?php echo $v['patroli'] ?></td>
                            <td><?php echo $v['min_absen'] ?></td>
                            <td><?php echo $v['max_absen'] ?></td>
                            <td><?php echo $v['jam'] ?></td>
                            <td colspan="3"><?php echo $v['keterangan'] ?></td>
                            <td><?php echo $v['qr'] ?> </td>
                        </tr>
            <?php
                        $no++;
                    }
                }
            ?>
        </table>
        <?php
        if ($is_excel === true) {
            echo '<h5>--PAGEBREAK--</h5>';
        } else {
            if ($nomor >= 1 && $nomor != $jml_data) {
                echo '<pagebreak>';
            }
        }
        ?>
<?php
    }
}
?>