<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper">
    <!-- Content Header (Page header) -->
    <section class="content-header">
        <h1>
            Data Pasien
            <small>Klinik Dr. Abdul Radjak Angke</small>
        </h1>
        <ol class="breadcrumb">
            <li><a href="#"><i class="fa fa-dashboard"></i> Vclaim</a></li>
            <li class="active">Dashboard</li>
        </ol>
    </section>

    <!-- Main content -->
    <section class="content">
        <!-- Default box -->
        <div class="box">
            <div class="box-body">
                <a href="" data-toggle="modal" data-target="#baru" class="btn btn-sm btn-primary"><i class="fa fa-fw fa-plus"></i> Pasien Baru</a>
                <a href="" data-toggle="modal" data-target="#caripasien" class="btn btn-sm btn-success"><i class="fa fa-fw fa-search"></i> Cari</a>
                <a href="" data-toggle="modal" data-target="#caripasien" class="btn btn-sm btn-success"><i class="fa fa-fw fa-eye"></i> View No Mr</a>
            </div><!-- /.box-body -->
        </div><!-- /.box -->

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

    <!-- Main content -->
    <section class="content" style="margin-top: -180px;">
        <!-- Default box -->
        <div class="box">
            <div class="box-body">

                <table id="example2" class="table table-bordered table-striped">
                    <thead>
                        <tr>
                            <th><small>No.</small></th>
                            <th><small>No. Kunjungan</small></th>
                            <th><small>Nama</small></th>
                            <th><small>Tgl</small></th>
                            <th><small>Umur</small></th>
                            <th><small>Jenis Kelamin</small></th>
                            <th><small>Penjamin</small></th>
                        </tr>
                    </thead>
                    <?php $no = 1;
                    foreach ($datapasien as $d) :
                    ?>
                        <tbody>
                            <tr>
                                <td><?= $no ?></td>
                                <td><?= $d['Case ID'] ?></td>
                                <td><?= $d['Description'] ?></td>
                                <td><?= $d['Intake Date'] ?></td>
                                <td><?= $d['Age'] ?></td>
                                <td><?= $d['Sex'] ?></td>
                                <td><?= $d['CompanyName'] ?></td>
                            </tr>
                        </tbody>
                    <?php
                        $no++;
                    endforeach;
                    ?>
                </table>

            </div><!-- /.box-body -->
            <div class="box-footer">
                <?= date('d F Y'); ?>
            </div><!-- /.box-footer-->
        </div><!-- /.box -->

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

<!-- Modal -->
<div class="modal fade" id="baru" 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"><i class="fa fa-fw fa-pencil"></i> PASIEN BARU</h5>
                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                    <span aria-hidden="true">&times;</span>
                </button>
            </div>
            <div class="modal-body">

                <form action="<?= base_url('pasien/formNik'); ?>" method="get">
                    <input type="text" placeholder="NIK..." class="form-control" required name="nik">
                    <button style="width: 100%; border-radius: 0px;" type="submit" class="btn btn-sm btn-success">Daftar By NIK Bridging</button>
                </form>

                <div style="margin-top: 5px; text-align:right">
                    <a href="<?= base_url('pasien/form'); ?>">Daftar Biasa</a>
                </div>


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

<div class="modal fade" id="caripasien" 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"><i class="fa fa-fw fa-search"></i> CARI PASIEN</h5>
                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                    <span aria-hidden="true">&times;</span>
                </button>
            </div>
            <div class="modal-body">

                <form action="<?= base_url('pasien/cari'); ?>" method="get">
                    <select name="jenis" style="margin-bottom: 5px;" class="form-control" onchange="DisableMenu()" id="status" required>
                        <option value=""></option>
                        <option value="1">No MR</option>
                        <option value="2">Nama Depan</option>
                        <option value="3">Nama Belakang</option>
                        <option value="4">Tanggal Lahir</option>
                        <!-- <option value="4">Tanggal Lahir</option> -->
                    </select>
                    <input type="text" style="margin-bottom: 5px;" placeholder="KETIK JENIS..." class="form-control" id="progres" name="pencarian">

                    <label>Tanggal Lahir</label>
                    <input type="date" style="margin-bottom: 5px;" placeholder="PILIH TANGGAL" class="form-control" id="progress" required name="pencarian" disabled>
                    <button style="width: 100%; border-radius: 0px;" type="submit" class="btn btn-sm btn-success">Cari</button>
                </form>

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


<script>
    function DisableMenu() {

        if (document.getElementById("status").value == "4" || document.getElementById("status").value == "4") {
            document.getElementById("progress").disabled = false;
            document.getElementById("progres").disabled = true;
        } else {
            document.getElementById("progress").disabled = true;
            document.getElementById("progres").disabled = false;
        }

    }
</script>