<div class="row">
    <!-- begin col-8 -->
    <div class="col-sm-12">
        <!-- begin panel -->
        <div class="panel panel-grey">
            <div class="panel-heading">
                <div class="panel-heading-btn">
                    <a href="javascript:;" class="btn btn-xs btn-icon btn-circle btn-grey" data-click="panel-expand"><i class="fa fa-expand"></i></a>
                </div>
                <a href="<?php echo site_url('sampel/pendaftaran/create_edit?type=uji'); ?>" class="btn btn-primary">Tambah Data</a>
                <hr>
                <?php $this->load->view('pendaftaran/filter_permintaan_uji');?>
            </div>

            <div class="panel panel-body">
                <div class="table-responsive">
                    <table class="table table-hover table-bordered table-striped">
                        <thead class="grey">
                            <tr>
                                <th class="text-center">No.</th>
                                <th class="text-center">Aksi</th>
                                <th colspan="2" class="text-center">Status</th>
                                <th class="text-center">Nomor Permintaan Uji</th>
                                <th class="text-center">Jenis&nbsp;Layanan</th>
                                <th class="text-center">Registrasi Laboratorium</th>
                                <th class="text-center">Tanggal&nbsp;Pukul Pengambilan</th>
                                <th class="text-center">Tanggal&nbsp;Pukul Registrasi</th>
                                <th class="text-center">Perkiraan&nbsp;Estimasi Selesai LHP</th>
                                <th class="text-center">Tanggal&nbsp;Pukul Mulai Uji</th>
                                <th class="text-center">Tanggal&nbsp;Pukul Terbit LHU</th>
                                <th class="text-center">Tanggal&nbsp;Pukul Terbit LHP</th>
                                <th class="text-center">Tanggal&nbsp;Surat</th>
                                <th class="text-center">Nomor&nbsp;Surat</th>
                                <th class="text-center">Instansi/Perusahaan/Umum</th>
                                <th class="text-center">Alamat</th>
                                <th class="text-center">Keterangan</th>
                            </tr>
                        </thead>
                        <tbody>
                            <?php $i=1; foreach($data as $r) { ?>
                            <?php
                                $bctr='';

                                if(date('Y-m-d H:i:s') >= date('Y-m-d H:i:s', strtotime('-2 days', strtotime($r['perkiraan_estimasi_selesai_lhp'])))){
                                  $bctr = 'warning';
                                }

                                if(date('Y-m-d H:i:s') > date('Y-m-d H:i:s', strtotime($r['perkiraan_estimasi_selesai_lhp'])) || is_null($r['perkiraan_estimasi_selesai_lhp'])) {
                                  $bctr = 'danger';
                                }

                                if((int)$r['id_status'] >= 11) {
                                  $bctr = 'success';
                                }
                             ?>
                            <tr>
                                <td class='text-center'><?php echo $this->uri->segment(3) + $i++ ?></td>
                                <td>
                                    <?php $countSampel = count($this->m_pendaftaran->getSampel($r['id_uji'])); ?>
                                    <?php echo aksi_button('start') ?>
                                        <?php if(!in_array($r['id_status'], array('1','2')) && in_array($idGroup, array('1','2','4'))) { ?>
                                        <li>
                                            <a target="_blank" href="<?php echo site_url('download_dok/download_ttpp?id_uji='.$r['id_uji'].'&status='.$r['id_status']) ?>">
                                                Download TTPP
                                            </a>
                                        </li>
                                        <li>
                                            <a target="_blank" href="<?php echo site_url('download_dok/download_npps?id_uji='.$r['id_uji'].'&status='.$r['id_status']) ?>">
                                                Download NPPS
                                            </a>
                                        </li>
                                        <?php } ?>
                                        <?php if(in_array($r['id_status'], array('1','2')) && in_array($idGroup, array('1','2'))) { ?>
                                        <?php if($countSampel !== 0 && in_array($idGroup, array('1','2'))) { ?>
                                        <li>
                                            <a href="<?php echo site_url('sampel/pendaftaran/verifikasi?id_uji='.$r['id_uji']) ?>">
                                                Verifikasi
                                            </a>
                                        </li>
                                        <?php } ?>
                                        <?php } ?>
                                        <li>
                                            <a href="<?php echo site_url('sampel/pendaftaran/detail_uji_sampel?id_uji='.$r['id_uji'].'&status='.$r['id_status']) ?>">
                                                Daftar Sampel
                                            </a>
                                        </li>
                                        <?php if((int)$r['id_status'] < 3) { ?>
                                          <li>
                                              <a href="<?php echo site_url('sampel/pendaftaran/create_edit?type=uji&id_uji='.$r['id_uji']) ?>">
                                                  Edit Data Uji
                                              </a>
                                          </li>
                                        <?php } ?>
                                    <?php echo aksi_button('end') ?>
                                </td>
                                <td><button class="btn btn-xs <?php echo 'btn-'.$bctr; ?>">O</button></td>
                                <td class='text-center'>
                                    <?php echo str_replace('Status','',$r['status_sampel']).'<br>['. str_replace(' ', '&nbsp;', $r['detail_status']).']'; ?>
                                </td>
                                <td><?php echo nomor_id($r['id_uji']) ?></td>
                                <td><?php echo $r['jenis_layanan'] ?></td>
                                <td><?php echo $r['registrasi_laboratorium'] ?></td>
                                <td><?php echo set_indo_time($r['tgl_pukul_pengambilan']) ?></td>
                                <td><?php echo set_indo_time($r['tgl_pukul_registrasi']) ?></td>
                                <td><?php echo set_indo_time($r['perkiraan_estimasi_selesai_lhp']) ?></td>
                                <td><?php echo set_indo_time($r['tgl_pukul_mulai_uji']) ?></td>
                                <td><?php echo set_indo_time($r['tgl_pukul_terbit_lhu']) ?></td>
                                <td><?php echo set_indo_time($r['tgl_pukul_terbit_lhp']) ?></td>
                                <td><?php echo $r['tgl_surat'] ?></td>
                                <td><?php echo $r['nomor_surat'] ?></td>
                                <td><?php echo $r['instansi_umum'] ?></td>
                                <td><?php echo $r['alamat'] ?></td>
                                <td><?php echo $r['keterangan'] ?></td>
                            </tr>
                            <?php } ?>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>
