<style type="text/css">
  .width-td{width: 100px;}

  .table > thead > tr > th {
     vertical-align: middle;
     text-align: center;
  }
  .table > tbody > tr > td {
     vertical-align: middle;
     text-align: center;
  }
</style>
<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>

                <?php if(in_array($jenis_uji, ['fosfor', 'ur', 'af', 'ca'])) { ?>              
                    <div class="btn-group">
                        <a href="<?= site_url('batch_list/'.$jenis_uji); ?>" class="btn btn-primary btn-md">Kembali</a>
                        <a href="<?= site_url('kontrol_sampel_list/'.$jenis_uji.'/'.$nomor_batch); ?>" class="btn btn-warning btn-md active">Kontrol Sampel</a>
                        <a href="<?= site_url('deret_uji_grafik/'.$jenis_uji.'/'.$nomor_batch.'/1'); ?>" class="btn btn-warning btn-md">Deret Standar <?= ucwords($jenis_uji); ?></a>
                    </div>
                <?php } else{ ?>
                    <a href="<?= site_url('batch_list/'.$jenis_uji); ?>" class="btn btn-primary btn-md">Kembali</a>
                <?php } ?>
                <hr>

            </div>

            <div class="panel panel-body table-responsive">
                <table class="table table-bordered">
                    <thead>
                        <tr>
                            <th>No.</th>
                            <th>Kontrol Sampel</th>
                            <th>Aksi</th>
                        </tr>
                    </thead>
                    <tbody>
                    <?php $i=1; foreach($data as $r){ ?>
                        <tr>
                            <td><?= $this->uri->segment(5) + $i++; ?></td>
                            <?php 
                                $k_sampel = str_replace('_|_', '+', $r['kontrol_sampel']); 
                                $k_sampel = str_replace('_&_', ' ', $k_sampel);

                                $kode_krusibel = '';
                                if(strpos('1'.$nomor_batch, 'CAAS') != false){
                                    $kode_krusibel = ' ('.$r['kode_krusibel_porselen'].')';
                                }
                            ?>
                            <td><?= val_ks($r['kontrol_sampel']).$kode_krusibel; ?></td>
                            <td>
                                <a href="<?= site_url('batch_sampel_list/'.$jenis_uji.'/'.$r['nomor_batch'].'/'.$r['kontrol_sampel']); ?>" class="btn btn-primary btn-sm">Lihat Sampel</a>
                                <a href="<?= site_url('sampel/analis/form_uji/'.$jenis_uji.'?nomor_batch='.$r['nomor_batch'].'&method=kontrol_sampel&kontrol_sampel='.$k_sampel); ?>" class="btn btn-primary btn-sm">Tambah Sampel</a>
                            </td>
                        </tr>
                    <?php } ?>
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</div>
