<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper">
    <!-- Content Header (Page header) -->
    <section class="content-header">
        <h1>
            Data Pasien
            <small>Edit Data</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>
            </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">
                <h4 style="font-weight: bold;" class="text-primary">IDENTITAS </h4>

                <form action="<?= base_url('pasien/updateIdentitas/' . $pasien['PatientCode']); ?>" method="post">

                    <div class="row">
                        <div class="col-md-6">
                            <table width="100%" class="table">
                                <tr>
                                    <td width="25%">
                                        No KTP / NIK*
                                    </td>
                                    <td>
                                        <input type="text" name="NIK" class="form-control" value="<?= $pasien['NIK']; ?>" required>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        Nama Depan*
                                    </td>
                                    <td>
                                        <input type="text" name="FirstName" value="<?= $pasien['FirstName']; ?>" class="form-control" required>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        Tempat Lahir*
                                    </td>
                                    <td>
                                        <input type="text" name="DOBPlace" value="<?= $pasien['DOBPlace']; ?>" class="form-control" required>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        Kebangsaan*
                                    </td>
                                    <td>
                                        <input type="text" name="Nationality" class="form-control" value="INDONESIA" required>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        Agama*
                                    </td>
                                    <td>
                                        <select name="Religion" class="form-control" required>
                                            <option value=""></option>
                                            <?php
                                            foreach ($religi as $agama) :
                                                if ($pasien['Religion'] == $agama['Religion']) {
                                            ?>
                                                    <option selected value="<?= $agama['Religion']; ?>"><?= $agama['Religion']; ?>
                                                    </option>
                                                <?php

                                                } else {
                                                ?>
                                                    <option value="<?= $agama['Religion']; ?>"><?= $agama['Religion']; ?>
                                                    </option>
                                            <?php
                                                }
                                            endforeach;
                                            ?>
                                        </select>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        Pendidikan*
                                    </td>
                                    <td>
                                        <select name="Education" class="form-control" required>
                                            <option value=""></option>
                                            <?php
                                            foreach ($edu as $pend) :
                                                if ($pasien['Education'] == $pend['ID']) {
                                            ?>
                                                    <option selected value="<?= $pend['ID']; ?>">
                                                        <?= $pend['EducationName']; ?>
                                                    </option>
                                                <?php

                                                } else {
                                                ?>
                                                    <option value="<?= $pend['ID']; ?>">
                                                        <?= $pend['EducationName']; ?>
                                                    </option>
                                            <?php

                                                }
                                            endforeach;
                                            ?>
                                        </select>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        Pasien Tipe*
                                    </td>
                                    <td>
                                        <select name="PatientType" class="form-control" required>
                                            <option value=""></option>
                                            <?php
                                            foreach ($tipe as $tip) :
                                                if ($pasien['PatientType'] == $tip['TypeID']) {
                                            ?>
                                                    <option selected value="<?= $tip['TypeID']; ?>">
                                                        <?= $tip['TypeName']; ?>
                                                    </option>
                                                <?php

                                                } else {
                                                ?>
                                                    <option value="<?= $tip['TypeID']; ?>">
                                                        <?= $tip['TypeName']; ?>
                                                    </option>
                                            <?php

                                                }
                                            endforeach;
                                            ?>
                                        </select>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Bahasa*</td>
                                    <td>
                                        <select name="Bahasa" class="form-control" required>
                                            <option value="">- PILIH BAHASA -</option>
                                            <?php
                                            foreach ($bahasa as $bhs):
                                                if ($pasien['Nationality'] == $bhs['Bahasa']) {
                                            ?>
                                                    <option selected value="<?= $bhs['Bahasa']; ?>"><?= $bhs['Bahasa']; ?></option>
                                                <?php

                                                } else {
                                                ?>
                                                    <option value="<?= $bhs['Bahasa']; ?>"><?= $bhs['Bahasa']; ?></option>
                                            <?php

                                                }
                                            endforeach;
                                            ?>
                                        </select>
                                    </td>
                                </tr>
                            </table>
                        </div>
                        <div class="col-md-6">
                            <table width="100%" class="table">
                                <tr>
                                    <td width="25%">
                                        Jenis Kelamin*
                                    </td>
                                    <td>
                                        <select name="Sex" class="form-control" required>
                                            <option value="" disabled></option>
                                            <?php
                                            if ($pasien['Sex'] == 1) {
                                            ?>
                                                <option value="2">Laki-laki</option>
                                                <option value="1" selected>Perempuan</option>
                                            <?php

                                            } else {
                                            ?>
                                                <option value="2" selected>Laki-laki</option>
                                                <option value="1">Perempuan</option>
                                            <?php

                                            }
                                            ?>
                                        </select>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        Nama Belakang*
                                    </td>
                                    <td>
                                        <input type="text" name="LastName" value="<?= $pasien['LastName']; ?>" class="form-control" required>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        Tanggal Lahir*
                                    </td>
                                    <td>
                                        <input type="date" name="DOB" class="form-control" value="<?= date('Y-m-d', strtotime($pasien['DOB'])); ?>" required>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        Suku Bangsa*
                                    </td>
                                    <td>
                                        <select name="SukuBangsa" class="form-control" required>
                                            <option value=""></option>
                                            <?php
                                            foreach ($suku as $dSuku) :
                                                if ($pasien['SukuBangsa'] == $dSuku['SukuBangsa']) {
                                            ?>
                                                    <option selected value="<?= $dSuku['SukuBangsa']; ?>"><?= $dSuku['SukuBangsa']; ?>
                                                    </option>
                                                <?php

                                                } else {
                                                ?>
                                                    <option value="<?= $dSuku['SukuBangsa']; ?>"><?= $dSuku['SukuBangsa']; ?>
                                                    </option>
                                            <?php

                                                }
                                            endforeach;
                                            ?>
                                        </select>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        Status*
                                    </td>
                                    <td>
                                        <select name="Status" class="form-control" required>
                                            <option value=""></option>
                                            <?php
                                            if ($pasien['Status'] == 'SINGLE') {
                                            ?>
                                                <option value="SINGLE" selected>SINGLE</option>
                                                <option value="MARRIED">MARRIED</option>
                                                <option value="WIDOW">WIDOW</option>
                                            <?php

                                            } else if ($pasien['Status'] == 'MARRIED') {
                                            ?>
                                                <option value="SINGLE">SINGLE</option>
                                                <option value="MARRIED" selected>MARRIED</option>
                                                <option value="WIDOW">WIDOW</option>
                                            <?php

                                            } else {
                                            ?>
                                                <option value="SINGLE">SINGLE</option>
                                                <option value="MARRIED">MARRIED</option>
                                                <option value="WIDOW" selected>WIDOW</option>
                                            <?php

                                            }
                                            ?>
                                        </select>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        Pekerjaan*
                                    </td>
                                    <td>
                                        <select name="Profession" class="form-control" required>
                                            <option value=""></option>
                                            <?php
                                            foreach ($prof as $pek) :
                                                if ($pasien['Profession'] == $pek['Deskripsi']) {
                                            ?>
                                                    <option selected value="<?= $pek['Deskripsi']; ?>">
                                                        <?= $pek['Deskripsi']; ?>
                                                    </option>
                                                <?php

                                                } else {
                                                ?>
                                                    <option value="<?= $pek['Deskripsi']; ?>">
                                                        <?= $pek['Deskripsi']; ?>
                                                    </option>
                                            <?php

                                                }
                                            endforeach;
                                            ?>
                                        </select>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        Kartu BPJS*
                                    </td>
                                    <td>
                                        <input type="text" class="form-control" name="EmployeeID" value="<?= $pasien['EmployeeID']; ?>">
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        Password
                                    </td>
                                    <td>
                                        <input type="text" class="form-control" name="Password" value="<?= $pasien['Password']; ?>">
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        Avtive
                                    </td>
                                    <td>
                                        <input type="radio" name="isOnline" class="minimal" value="1" <?php if ($pasien['isOnline'] == '1') echo 'checked' ?>> Active
                                        <input type="radio" name="isOnline" class="minimal" value="0" <?php if ($pasien['isOnline'] == '0') echo 'checked' ?>> Non Active
                                    </td>
                                </tr>
                                <tr>
                                    <td colspan="2" align="right">
                                        <button type="submit" class="btn btn-sm btn-success"><i
                                                class="fa fa-fw fa-save"></i> UPDATE </button>
                                    </td>
                                </tr>
                            </table>
                        </div>
                    </div>
                </form>

            </div><!-- /.box-body -->
            <div class="box-footer">
                <?= date('d F Y'); ?> <b><small>Tanda * Wajib Di Isi</small></b>
            </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</button>
                </form>

                <div style="margin-top: 5px; text-align:right">
                    <a href="">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" 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> -->
                    </select>
                    <input type="text" style="margin-bottom: 5px;" placeholder="KETIK JENIS..." class="form-control" required name="pencarian">
                    <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>