<?php
if ($dashboard_izin->num_rows() < 1) {
    echo "<h5 class='mt-1'><center>" . $this->lang->line('data_tidak_ditemukan') . "</center></h5>";
} else {
    foreach ($dashboard_izin->result() as $row) {

?>
        <div class="card mt-1">
            <div class="card-header">
                <a href="<?php echo site_url('pengajuan/izin/detail_izin/' . md5($row->id_izin)) ?>">
                    <h4 class="card-title">
                        <i class="fa fa-clock-o"></i>
                        <small class="block">
                            <?= $this->lang->line('pengajuan') ?>
                        </small>
                        <?= $row->hari_pengajuan; ?> <?= $this->fungsi->konversi_date($row->tgl_pengajuan); ?>
                        <?php
                        $jenis_izin = $row->jenis_izin;
                        $jenis_cuti = array('C');
                        if ($jenis_izin == "izin") {
                            $class_btn_izin = "badge-success";
                        } elseif ($jenis_izin == "cuti") {
                            $class_btn_izin = "badge-warning";
                        } else {
                            $class_btn_izin = "badge-danger";
                        }
                        ?>
                        <div class="badge <?= $class_btn_izin; ?>">
                            <?= $row->nama_jenis_izin; ?>
                        </div>
                    </h4>
                </a>
            </div>
            <div class="card-content collapse show">
                <div class="card-body">
                    <p>
                        <?= $row->keterangan; ?>
                        <small class="block">
                            <?= $row->yang_mengajukan; ?>
                        </small>
                    </p>
                    <div class="infotgl">
                        <font color="#11c086"><?= $this->lang->line('mulai') ?></font> <?= $this->fungsi->mysql_date_3_date($row->tanggal_mulai_izin); ?> <font color="#fc5656" class="ml-1"> <?= $this->lang->line('selesai') ?></font> <?= $this->fungsi->mysql_date_3_date($row->tanggal_selesai_izin); ?>
                    </div>
                    <div class="row">
                        <div class="mt-1">
                            <?php

                            if ($row->approval_spv == '1') {
                                $class_btn_approval = "badge-light";
                                $status = $this->lang->line('belum_disetujui') . " " . $this->lang->line('oleh') . " " . $this->lang->line('supervisi');
                            } elseif ($row->approval_spv == '2') {
                                $class_btn_approval = "badge-warning";
                                $status = $this->lang->line('dibatalkan') . " " . $this->lang->line('oleh') . " " . $this->lang->line('supervisi');
                            } elseif ($row->approval_spv == '3') {
                                $class_btn_approval = "badge-danger";
                                $status = $this->lang->line('ditolak') . " " . $this->lang->line('oleh') . " " . $this->lang->line('supervisi');
                            } elseif ($row->approval_spv == '4') {
                                $class_btn_approval = "badge-success";
                                $status = $this->lang->line('disetujui') . " " . $this->lang->line('oleh') . " " . $this->lang->line('supervisi');
                            } elseif ($row->approval_spv == '5') {
                                $class_btn_approval = "badge-light";
                                $status = $this->lang->line('belum_disetujui') . " " . $this->lang->line('oleh') . " " . $this->lang->line('supervisi');
                            } else {
                                $class_btn_approval = "";
                                $status = "";
                            }

                            ?>
                            <div class="badge <?= $class_btn_approval; ?>">
                                <?= $status; ?>
                            </div>
                        </div>

                        <div class="mt-1">
                            <?php

                            if ($row->approval_kedep == '1') {
                                $class_btn_approval = "badge-light";
                                $status = $this->lang->line('belum_disetujui') . " " . $this->lang->line('oleh') . " " . $this->lang->line('kepala_departemen');
                            } elseif ($row->approval_kedep == '2') {
                                $class_btn_approval = "badge-warning";
                                $status = $this->lang->line('dibatalkan') . " " . $this->lang->line('oleh') . " " . $this->lang->line('kepala_departemen');
                            } elseif ($row->approval_kedep == '3') {
                                $class_btn_approval = "badge-danger";
                                $status = $this->lang->line('ditolak') . " " . $this->lang->line('oleh') . " " . $this->lang->line('kepala_departemen');
                            } elseif ($row->approval_kedep == '4') {
                                $class_btn_approval = "badge-success";
                                $status = $this->lang->line('disetujui') . " " . $this->lang->line('oleh') . " " . $this->lang->line('kepala_departemen');
                            } elseif ($row->approval_kedep == '5') {
                                $class_btn_approval = "badge-light";
                                $status = $this->lang->line('belum_disetujui') . " " . $this->lang->line('oleh') . " " . $this->lang->line('kepala_departemen');
                            } else {
                                $class_btn_approval = "";
                                $status = "";
                            }

                            ?>
                            <div class="badge <?= $class_btn_approval; ?>">
                                <?= $status; ?>
                            </div>
                        </div>

                        <div class="mt-1">
                            <?php

                            if ($row->approval_kacab == '1') {
                                $class_btn_approval = "badge-light";
                                $status = $this->lang->line('belum_disetujui') . " " . $this->lang->line('oleh') . " " . $this->lang->line('kepala_cabang');
                            } elseif ($row->approval_kacab == '2') {
                                $class_btn_approval = "badge-warning";
                                $status = $this->lang->line('dibatalkan') . " " . $this->lang->line('oleh') . " " . $this->lang->line('kepala_cabang');
                            } elseif ($row->approval_kacab == '3') {
                                $class_btn_approval = "badge-danger";
                                $status = $this->lang->line('ditolak') . " " . $this->lang->line('oleh') . " " . $this->lang->line('kepala_cabang');
                            } elseif ($row->approval_kacab == '4') {
                                $class_btn_approval = "badge-success";
                                $status = $this->lang->line('disetujui') . " " . $this->lang->line('oleh') . " " . $this->lang->line('kepala_cabang');
                            } elseif ($row->approval_kacab == '5') {
                                $class_btn_approval = "badge-light";
                                $status = $this->lang->line('belum_disetujui') . " " . $this->lang->line('oleh') . " " . $this->lang->line('kepala_cabang');
                            } else {
                                $class_btn_approval = "";
                                $status = "";
                            }

                            ?>
                            <div class="badge <?= $class_btn_approval; ?>">
                                <?= $status; ?>
                            </div>
                        </div>

                        <div class="mt-1">
                            <?php

                            if ($row->approval_hrd == '1') {
                                $class_btn_approval = "badge-light";
                                $status = $this->lang->line('belum_disetujui') . " " . $this->lang->line('oleh') . " Admin";
                            } elseif ($row->approval_hrd == '2') {
                                $class_btn_approval = "badge-warning";
                                $status = $this->lang->line('dibatalkan') . " " . $this->lang->line('oleh') . " Admin";
                            } elseif ($row->approval_hrd == '3') {
                                $class_btn_approval = "badge-danger";
                                $status = $this->lang->line('ditolak') . " " . $this->lang->line('oleh') . " Admin";
                            } elseif ($row->approval_hrd == '4') {
                                $class_btn_approval = "badge-success";
                                $status = $this->lang->line('disetujui') . " " . $this->lang->line('oleh') . " Admin";
                            } elseif ($row->approval_hrd == '5') {
                                $class_btn_approval = "badge-light";
                                $status = $this->lang->line('belum_disetujui') . " " . $this->lang->line('oleh') . " Admin";
                            } else {
                                $class_btn_approval = "";
                                $status = "";
                            }

                            ?>
                            <div class="badge <?= $class_btn_approval; ?>">
                                <?= $status; ?>
                            </div>
                        </div>

                        <div class="mt-1">
                            <?php

                            if ($row->approval_direksi == '1') {
                                $class_btn_approval = "badge-light";
                                $status = $this->lang->line('belum_disetujui') . " " . $this->lang->line('oleh') . " " . $this->lang->line('direksi');
                            } elseif ($row->approval_direksi == '2') {
                                $class_btn_approval = "badge-warning";
                                $status = $this->lang->line('dibatalkan') . " " . $this->lang->line('oleh') . " " . $this->lang->line('direksi');
                            } elseif ($row->approval_direksi == '3') {
                                $class_btn_approval = "badge-danger";
                                $status = $this->lang->line('ditolak') . " " . $this->lang->line('oleh') . " " . $this->lang->line('direksi');
                            } elseif ($row->approval_direksi == '4') {
                                $class_btn_approval = "badge-success";
                                $status = $this->lang->line('disetujui') . " " . $this->lang->line('oleh') . " " . $this->lang->line('direksi');
                            } elseif ($row->approval_direksi == '5') {
                                $class_btn_approval = "badge-light";
                                $status = $this->lang->line('belum_disetujui') . " " . $this->lang->line('oleh') . " " . $this->lang->line('direksi');
                            } else {
                                $class_btn_approval = "";
                                $status = "";
                            }

                            ?>
                            <div class="badge <?= $class_btn_approval; ?>">
                                <?= $status; ?>
                            </div>
                        </div>

                    </div>

                </div>
            </div>
        </div>
<?php }
} ?>
