<?php
date_default_timezone_set("Asia/Jakarta");
$mr = $this->uri->segment(3);
$cekid = $this->db->query("select* from Formdaftarttd where PatientCode = '$mr'")->row_array();
?>
<div class="content-wrapper">
    <!-- Content Header (Page header) -->
    <section class="content-header">
        <h1>
            Form Pendaftaran
            <?php
            if ($cekid > 0) {
            ?>
                - <a href="<?= base_url('pendaftaran/cetakformdaftar/' . $this->uri->segment(3)) ?>" target="_blank" class="btn btn-primary"><i class="fa fa-print"></i> Cetak </a><br>
            <?php } else { ?>

            <?php } ?>
        </h1>
        <ol class="breadcrumb">
            <li><a href="#"><i class="fa fa-dashboard"></i> HIS</a></li>
            <li class="active">Pendaftaran</li>
        </ol>
    </section>

    <!-- Main content -->
    <section class="content">
        <div class="card" style="padding: 15px; background-color: white;border-radius: 5px;">
            <div class="card-body">
                <?= $this->session->flashdata('message'); ?>
                <table style="margin-top: -10px; width: 100%;">
                    <tr>
                        <td style="margin-top: -10px; width: 20%;"><img src="<?= base_url('images/logo.png'); ?>" width="70" height="50"></td>
                        <td style="margin-top: -10px; width: 80%; text-align:center;">
                            <b style='font-size:18px;'><?= $abdulradjak['NamaPerusahaan']; ?></b><br>
                            <?= $abdulradjak['AlamatPerusahaan']; ?><br>
                            <small>Telp. <?= $abdulradjak['TeleponPerusahaan']; ?>, Fax : <?= $abdulradjak['FaxPerusahaan']; ?></small>
                        </td>
                    </tr>
                </table>
                <hr>
                <h3 style="text-align: center;"><u>FORMULIR PENDAFTARAN INI HARAP DI ISI DENGAN LENGKAP DAN JELAS</u></h3>
                <br>
                <table style="width:100%; hight:100%;">
                    <tr>
                        <td>NOMOR MR</td>
                        <td>:</td>
                        <td><?= $pasien['PatientCode']; ?></td>
                    </tr>
                    <tr>
                        <td>No. NIK</td>
                        <td>:</td>
                        <td><?= $pasien['NIK']; ?></td>
                    </tr>
                    <tr>
                        <td>NAMA PASIEN</td>
                        <td>:</td>
                        <td><?= $pasien['FirstName']; ?></td>
                    </tr>
                    <tr>
                        <td>TEMPAT & TANGGAL LAHIR</td>
                        <td>:</td>
                        <td><?= $pasien['DOBPlace'] . '/' . date('d-m-Y', strtotime($pasien['DOB'])); ?></td>
                    </tr>
                    <?php
                    if ($pasien['Sex'] == 1) {
                        $Jenis = "Perempuan";
                    } else {
                        $Jenis = "Laki - Laki";
                    }
                    ?>
                    <tr>
                        <td>JENIS KELAMIN</td>
                        <td>:</td>
                        <td><?= $Jenis; ?></td>
                    </tr>
                    <tr>
                        <td>STATUS</td>
                        <td>:</td>
                        <td><?= $pasien['Status']; ?></td>
                    </tr>
                    <tr>
                        <td>AGAMA</td>
                        <td>:</td>
                        <td><?= $pasien['Religion']; ?></td>
                    </tr>
                    <tr>
                        <td>ALAMAT LENGKAP</td>
                        <td>:</td>
                        <td><?= $pasien['HomeAddress1']; ?></td>
                    </tr>
                    <tr>
                        <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- KELURAHAN</td>
                        <td>:</td>
                        <td><?= $pasien['Kelurahan']; ?></td>
                    </tr>
                    <tr>
                        <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- KECAMATAN</td>
                        <td>:</td>
                        <td><?= $pasien['Kecamatan']; ?></td>
                    </tr>
                    <tr>
                        <td>NO. HP</td>
                        <td>:</td>
                        <td><?= $pasien['CellPhone']; ?></td>
                    </tr>
                    <tr>
                        <td>NO. ASURANSI/NO.BPJS</td>
                        <td>:</td>
                        <td><?= $pasien['EmployeeID']; ?></td>
                    </tr>
                    <tr>
                        <td>NAMA PENANGGUNG JAWAB</td>
                        <td>:</td>
                        <td>-</td>
                    </tr>
                    <tr>
                        <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- HUBUNGAN</td>
                        <td>:</td>
                        <td>-</td>
                    </tr>
                    <tr>
                        <td>ASAL PASIEN</td>
                        <td>:</td>
                        <td> - &nbsp;&nbsp; DATANG SENDIRI</td>
                    </tr>
                    <tr>
                        <td></td>
                        <td></td>
                        <td> - &nbsp;&nbsp; DI ANTAR</td>
                    </tr>
                    <tr>
                        <td></td>
                        <td></td>
                        <td> - &nbsp;&nbsp; RUJUKAN</td>
                    </tr>
                </table>
                <br><br><br>
                <form action="<?= base_url('pendaftaran/simpanformpendaftaran/' . $this->uri->segment(3)); ?>" method="post">
                    <table width="100%">
                        <tr>
                            <td align="center"></td>
                            <td align="center">
                                Jakarta, <?= date('d F Y'); ?> <br>
                                Jam <?= date('H:i'); ?>
                                <br><br>
                            </td>
                        </tr>
                        <tr>
                            <td align="center">
                                Yang menjelaskan
                                <div class="form-group" style="margin-left: 30%; margin-right: 30%;">
                                    <div id="sig"></div>
                                    <textarea id="signature64" name="ttd_yang_menjelaskan" required style="display: none"></textarea>
                                </div>
                                <div class="box-footer" style="margin-top: 1rem; margin-left: 30%; margin-right: 30%;">
                                    <button class="btn btn-danger btn-block" id="clear">Reset Tanda Tangan</button>
                                </div>
                                <input type="text" placeholder="nama jelas" name="yang_menjelaskan" required style="width: 50%;" class="form-control">
                            </td>
                            <td align="center">
                                Pasien/Penanggung jawab pasien
                                <div class="form-group" style="margin-left: 30%; margin-right: 30%;">
                                    <div id="sig2"></div>
                                    <textarea id="signature64_2" required name="ttd_pasien" style="display: none"></textarea>
                                </div>
                                <div class="box-footer" style="margin-top: 1rem; margin-left: 30%; margin-right: 30%;">
                                    <button class="btn btn-danger btn-block" id="clear_2">Reset Tanda Tangan</button>
                                </div>
                                <input type="text" required placeholder="nama jelas" name="pasien" style="width: 50%;" class="form-control">
                            </td>
                        </tr>
                    </table>
                    <br><br>
                    <div class="row">
                        <div class="col-md-12">
                            <div class="form-group">
                                <?php
                                if ($cekid > 0) {
                                ?>
                                    <button type="submit" class="btn btn-sm btn-danger" style="width: 100%;" disabled>Data Sudah Di Input</button>
                                <?php } else { ?>
                                    <button type="submit" class="btn btn-sm btn-primary col-md-12">Simpan</button>
                                <?php } ?>
                            </div>
                        </div>
                    </div>


                </form>
            </div>
        </div>
    </section>
</div>