<?php
date_default_timezone_set("Asia/Jakarta");
?>
<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper">
    <!-- Content Header (Page header) -->
    <section class="content-header">
        <h1>
            Data Kunjungan Pasien
            <small>Klinik</small>
        </h1>
        <ol class="breadcrumb">
            <li><a href="#"><i class="fa fa-dashboard"></i> Home</a></li>
            <li class="active">Record</li>
        </ol>
    </section>

    <!-- Main content -->
    <section class="content">

        <!-- SELECT2 EXAMPLE -->
        <div class="box box-primary">
            <div class="box-header with-border">
                <h3 class="box-title">Rekam Medis</h3>
                <div class="box-tools pull-right">
                        <a href="" data-toggle="modal" data-target="#pencarian" class="btn btn-sm btn-primary bg-blue-gradient" data-backdrop="static" data-keyboard="false"><i class="fa fa-fw fa-search"></i> Cari</a>
                    </div>
            </div><!-- /.box-header -->
            <div class="box-body">
                    <small>
                    <table id="example1" class="table table-bordered table-hover table-striped">
                        <thead>
                            <tr>
                                <th>No.</th>
                                <th>Case ID</th>
                                <th>Nama</th>
                                <th>Penjamin</th>
                                <th>Status Pasien</th>
                                <th>Status</th>
                                <th>Poli</th>
                                <th>Dokter</th>
                                <th>Status Cppt</th>
                                <th>Opsi</th>
                            </tr>
                        </thead>
                        <tbody>
                            <?php
                            $no = 1;
                            foreach ($record as $data) :
                            ?>
                            <tr>
                                <td><?= $no++; ?></td>
                                <td><?= $data['Case ID']; ?></td>
                                <td><?= $data['Description']; ?></td>
                                <td><?= $data['CompanyName']; ?></td>
                                <td><?= $data['RegStatus']; ?></td>
                                <td><?= $data['Case Status']; ?></td>
                                <td><?= $data['Unit']; ?></td>
                                <td><?= $data['dokter']. ' ' .$data['LastName'] ; ?></td>
                                <?php if($data['StatusResume'] == 'Belum') { ?>
                                <td><span class="label label-danger">Belum</span></td>
                                <?php }elseif($data['StatusResume'] == 'Selesai'){ ?>
                                <td><span class="label label-primary">Selesai</span></td>
                                <?php }else{ ?>
                                <td style="text-align: center;">-</td>
                                <?php } ?>
                                <td>
                                <a href="<?= base_url('Laboratorium/pemeriksaan/'.$data['Case ID']. '/' . $data['PatientCode']); ?>" class="btn btn-sm btn-success"><i class="fa fa-fw fa-pencil"></i>New Request </a>
                                <a href="<?= base_url('Laboratorium/updaterequest/'.$data['Case ID']. '/' . $data['PatientCode']); ?>" class="btn btn-sm btn-success"><i class="fa fa-fw fa-pencil"></i>Update Request </a>
                                </td>
                            </tr>
                            <?php
                            endforeach;
                            ?>
                        </tbody>
                        <tfoot>
                            <tr>
                                <th>No.</th>
                                <th>Case ID</th>
                                <th>Nama</th>
                                <th>Penjamin</th>
                                <th>Status Pasien</th>
                                <th>Status</th>
                                <th>Poli</th>
                                <th>Dokter</th>
                                <th>Opsi</th>
                            </tr>
                        </tfoot>
                    </table>
                </small>
            </div><!-- /.box-body -->
            <div class="box-footer">
                <small>Daftar Pasien <?= date('d F Y'); ?> - @Klinik <?= date('Y'); ?></small>
            </div>
        </div><!-- /.box -->

    </section><!-- /.content -->
</div><!-- /.content-wrapper -->

<!-- Modal -->
<div class="modal fade" id="pencarian" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <h5 class="modal-title" id="exampleModalLabel">FILTER</h5>
                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                    <span aria-hidden="true">&times;</span>
                </button>
            </div>
            <div class="modal-body">

                <div class="nav-tabs-custom">
                    <ul class="nav nav-tabs">
                        <li class="active"><a href="#tab_1" data-toggle="tab"></span> No. Kunjungan</a></li>
                        <li><a href="#tab_2" data-toggle="tab"></span> No.MR</a></li>
                        <li><a href="#tab_3" data-toggle="tab"></span> Tanggal</a></li>
                    </ul>
                    <div class="tab-content">
                        <div class="tab-pane active" id="tab_1">
                            <form action="<?= base_url('Cari/kunjunganlab'); ?>" method="get">
                                <input type="text" class="form-control" required placeholder="no kunjungan" name="src">
                                <button style="margin-top:10px" type="submit" class="btn btn-sm btn-primary"> Cari
                                </button>
                            </form>
                        </div>
                        <div class="tab-pane" id="tab_2">
                            <form action="<?= base_url('Cari/nomrlab'); ?>" method="get">
                                <input type="text" class="form-control" required placeholder="no mr" name="src">
                                <button style="margin-top:10px" type="submit" class="btn btn-sm btn-primary"> Cari
                                </button>
                            </form>
                        </div>
                        <div class="tab-pane" id="tab_3">
                            <form action="<?= base_url('Cari/tglLab'); ?>" method="get">
                                <input type="date" class="form-control" required placeholder="no mr" name="src">
                                <button style="margin-top:10px" type="submit" class="btn btn-sm btn-primary"> Cari
                                </button>
                            </form>
                        </div>
                    </div>
                </div>
            </div>

            <div class="modal-footer">
                <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
            </div>
        </div>
    </div>
</div>