
<h3 style="text-align: center;">DATA KARYAWAN</h3>
<h4 style="text-align: center;"><?= $title ?></h4>
<h4> </h4>
<table id="list_data" class="table table-striped" style="width:100%">
    <thead>
        <tr>
            <th>NO</th>
            <th>NIK</th>
            <th>KARYAWAN</th>
            <th>JABATAN</th>
            <th>CABANG</th>
            <th>DEPARTEMEN</th>
            <th>SISA CUTI TAHUNAN</th>
            <th>STATUS</th>
            <th>TGL MULAI KONTRAK</th>
            <th>TGL BERAKHIR KONTRAK</th>
            <th>TGL MULAI TETAP</th>
            <th>TGL BERHENTI BEKERJA</th>
            <th>JENIS KELAMIN</th>
            <th>AGAMA</th>
            <th>TEMPAT LAHIR</th>
            <th>TANGGAL LAHIR</th>
            <th>ALAMAT DOMISILI</th>
            <th>NO TELEPHONE</th>
            <th>EMAIL</th>
        </tr>
    </thead>
    <tbody>
        <?php
            $no=0;
            foreach($data as $row){
                $no++;
                $status = $row->status;

                if($status == '1'){
                    $ket_status = 'Kontrak';
                    $tgl_mulai_kontrak = date_format(date_create($row->tgl_aktif_bekerja),"d-m-Y");
                    $tgl_selesai_kontrak = date_format(date_create($row->tgl_berhenti_bekerja),"d-m-Y");
                    $tgl_mulai_aktif = "-";
                    $tgl_berhenti_kerja = "-";
                }else if($status == '2'){
                    $ket_status = 'Tetap';
                    $tgl_mulai_kontrak = "-";
                    $tgl_selesai_kontrak = "-";
                    $tgl_mulai_aktif = date_format(date_create($row->tgl_aktif_bekerja),"d-m-Y");;
                    $tgl_berhenti_kerja = "-";
                }else if($status == '3'){
                    $ket_status = 'Izin Belajar';
                    $tgl_mulai_kontrak = "-";
                    $tgl_selesai_kontrak = "-";
                    $tgl_mulai_aktif = date_format(date_create($row->tgl_aktif_bekerja),"d-m-Y");;
                    $tgl_berhenti_kerja = "-";
                }else if($status == '4'){
                    $ket_status = 'Tugas Belajar';
                    $tgl_mulai_kontrak = "-";
                    $tgl_selesai_kontrak = "-";
                    $tgl_mulai_aktif = date_format(date_create($row->tgl_aktif_bekerja),"d-m-Y");;
                    $tgl_berhenti_kerja = "-";
                }else if($status == '5'){
                    $ket_status = 'Resign';
                    $tgl_mulai_kontrak = "-";
                    $tgl_selesai_kontrak = "-";
                    $tgl_mulai_aktif = "-";
                    $tgl_berhenti_kerja = date_format(date_create($row->tgl_berhenti_bekerja),"d-m-Y");
                }else if($status == '6'){
                    $ket_status = 'Dikeluarkan (PHK)';
                    $tgl_mulai_kontrak = "-";
                    $tgl_selesai_kontrak = "-";
                    $tgl_mulai_aktif = "-";
                    $tgl_berhenti_kerja = date_format(date_create($row->tgl_berhenti_bekerja),"d-m-Y");
                }else if($status == '7'){
                    $ket_status = 'Pensiun';
                    $tgl_mulai_kontrak = "-";
                    $tgl_selesai_kontrak = "-";
                    $tgl_mulai_aktif = "-";
                    $tgl_berhenti_kerja = date_format(date_create($row->tgl_berhenti_bekerja),"d-m-Y");
                }

                $kelamin = $row->jenis_kelamin;

                $agama = $row->agama;
        ?>
                <tr>
                    <td><?= $no ?></td>
                    <td>#<?= $row->nik ?>#</td>
                    <td><?= ucwords(strtolower($row->nama_lengkap)) ?></td>
                    <td><?= ucwords(strtolower($row->nama_jabatan)) ?></td>
                    <td><?= ucwords(strtolower($row->nama_cabang)) ?></td>
                    <td><?= ucwords(strtolower($row->nama_departemen)) ?></td>
                    <td><?= $row->jatah_cuti ?></td>
                    <td><?= $ket_status ?></td>
                    <td><?= $tgl_mulai_kontrak ?></td>
                    <td><?= $tgl_selesai_kontrak ?></td>
                    <td><?= $tgl_mulai_aktif ?></td>
                    <td><?= $tgl_berhenti_kerja ?></td>
                    <td><?= $kelamin ?></td>
                    <td><?= $agama ?></td>
                    <td><?= ucwords(strtolower($row->tempat_lahir)) ?></td>
                    <td><?= date_format(date_create($row->tgl_lahir),"d-m-Y") ?></td>
                    <td><?= ucwords(strtolower($row->alamat_domisili)) ?></td>
                    <td>#<?= $row->telepon ?>#</td>
                    <td><?= $row->email ?></td>
                </tr>
        <?php
            }
        ?>
    </tbody>
</table>