<div class="row">
    <!-- begin col-8 -->
    <div class="col-sm-12">
        <!-- begin panel -->
        <div class="panel panel-lime">
            <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>
                    <a href="javascript:;" class="btn btn-xs btn-icon btn-circle btn-grey" data-click="panel-remove"><i class="fa fa-times"></i></a>
                </div>
                <a href="#" onclick="goBack()" class="btn btn-primary m-b-5"><span class="fa fa-arrow-left"></span> Kembali</a>
            </div>
            <div class="panel panel-body table-responsive">
                <table class="table table-bordered table-hover table-striped table-td-valign-middle">
                    <thead>
                        <tr>
                            <th rowspan="2" class="text-center">No.</th>
                            <th rowspan="2" class="text-center">Jenis Sampel</th>
                            <th rowspan="2" class="text-center">Jumlah Sampel</th>
                            <th rowspan="2" class="text-center">Kemasan</th>
                            <th rowspan="2" class="text-center">Bobot (gr)</th>
                            <th rowspan="2" class="text-center">Bentuk/Jenis</th>
                            <th colspan="3" class="text-center">Tekstur</th>
                            <th rowspan="2" class="text-center">Kode Parameter</th>
                            <th colspan="2" class="text-center">Kualitas</th>
                            <th rowspan="2" class="text-center">Keterangan</th>
                        </tr>
                        <tr>
                            <th>Basah</th>
                            <th>Lembab</th>
                            <th>Kering</th>
                            <th>Baik</th>
                            <th>Tidak Baik</th>
                        </tr>
                    </thead>
                    <tbody>
                        <?php $i = 1;
                        foreach ($data as $r) { ?>
                            <tr>
                                <td class="text-center"><?php echo $this->uri->segment(4) + $i++ ?></td>
                                <td><?php echo $r['jenis_sampel']; ?></td>
                                <td><?php echo count(array($r['id_sampel'])); ?></td>
                                <td><?php echo $r['kemasan']; ?></td>
                                <td><?php echo $r['berat_sampel']; ?></td>
                                <td><?php echo $r['bentuk_jenis']; ?></td>
                                <td><?php echo $r['id_jenis_sampel'] === '3' ? '√' : '-'; ?></td>
                                <td><?php echo $r['id_jenis_sampel'] === '2' ? '√' : '-'; ?></td>
                                <td><?php echo $r['id_jenis_sampel'] === '1' ? '√' : '-'; ?></td>
                                <?php
                                $p_uji = explode('|', $r['jenis_pengujian']);
                                $a_uji = $p_uji[0];
                                for ($i = 1; $i < count($p_uji); $i++) {
                                    if (!is_null($p_uji[$i]) && $p_uji[$i] !== '')
                                        $a_uji .= ', ' . $p_uji[$i];
                                }
                                ?>
                                <td><?php echo $a_uji; ?></td>
                                <td><?php echo $r['kualitas'] === 'Baik' ? '√' : '-'; ?></td>
                                <td><?php echo $r['kualitas'] === 'Tidak Baik' ? '√' : '-'; ?></td>
                                <td><?php echo $r['keterangan']; ?></td>
                            </tr>
<?php } ?>
                        <tr>
                            <td class="text-right" colspan="2">Total:</td>
                            <td><?php echo count($data); ?></td>
                            <td></td>
                            <td></td>
                            <td></td>
                            <td></td>
                            <td></td>
                            <td></td>
                            <td></td>
                            <td></td>
                            <td></td>
                            <td></td>
                        </tr>
                    </tbody>
                    <tfoot>
                    </tfoot>
                </table>
                <div style="width: 30%;">
                    <form id="diiya"  method="get">
                        <input type="hidden" name="id_uji" value="<?php echo $id_uji ?>">
                        <input type="hidden" name="status" value="ya">
                        <table class="table table-hover table-striped">
                            <tbody>
                                <tr>
                                    <td><label><b> Pilih Semua</b></label></td>
                                    <td><label> SDM</label></td>
                                    <td><label> Metode</label></td>
                                    <td><label> Peralatan</label></td>
                                </tr>
                                <tr>
                                    <td><input type="checkbox" id="masterCheckbox"></td>
                                    <td><input type="checkbox" class="cbku" name="kaji_ulang[]" value="sdm"></td>
                                    <td><input type="checkbox" class="cbku" name="kaji_ulang[]" value="metode"></td>
                                    <td><input type="checkbox" class="cbku" name="kaji_ulang[]" value="peralatan"></td>
                                </tr>
                            </tbody>
                        </table>
                    </form>
                <div style="margin-bottom: 5px;">
                    <a href="#" onclick="$('#diiya').submit()" class="btn btn-success">Verifikasi</a>
                    <a href="<?php echo site_url('sampel/pendaftaran/verifikasi?id_uji=' . $id_uji . '&status=tidak') ?>" class="btn btn-success">Tolak</a>
                </div>
                </div>
            </div>
        </div>
        <!-- end panel -->
    </div>
</div>
<script>
    $("#masterCheckbox").click(function () {
        $(".cbku").prop("checked", $("#masterCheckbox").is(':checked'));
    });
    $(".cbku").click(function () {
        $("#masterCheckbox").prop("indeterminate", true);
    });
    $("#masterCheckbox").click();
</script>
