o<?php
date_default_timezone_set("Asia/Jakarta");
?>
<div class="content-wrapper">
    <!-- Content Header (Page header) -->
    <section class="content-header">
        <h1>
            Discard Planning
            <?php
            if ($ttd['ttdDokter'] == NULL || $ttd['ttdPerawat'] == NULL) {
            ?>
                <button class="btn btn-sm btn-primary" disabled>Print</button>
            <?php
            } else {
            ?>
                <a href="<?= base_url('discardPlaning/print/' . $cases['Case ID']); ?>" target="_blank" class="btn btn-sm btn-primary">Print</a>
            <?php
            }
            ?>
        </h1>
        <ol class="breadcrumb">
            <li><a href="#"><i class="fa fa-dashboard"></i> HIS</a></li>
            <li class="active">Discard Planning</li>
        </ol>
    </section>

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


        <div class="card" style="padding: 15px; background-color: white;border-radius: 5px;">
            <div class="card-body">
                <div class="row text-center">
                    <div class="col-md-2"></div>
                    <div class="col-md-2">
                        <img src="<?= base_url('images/logoYayasan.png'); ?>" height="80px">
                    </div>
                    <div class="col-md-6">
                        <h4 style="font-weight: bold;">
                            YAYASAN PELAYANAN KESEHATAN ABDUL RADJAK <br>
                            <?= $unit['NamaPerusahaan']; ?>
                        </h4>
                    </div>
                    <div class="col-md-2"></div>
                </div>
                <div class="row text-center">
                    <div class="col-md-2"></div>
                    <div class="col-md-8">
                        <hr>
                    </div>
                    <div class="col-md-2"></div>
                </div>
                <div class="row text-center">
                    <div class="col-md-2"></div>
                    <div class="col-md-8">
                        <h4 style="font-weight: bolder;">
                            PERENCANAAN PEMULANGAN (DISCHARGE PLANNING)
                        </h4>
                    </div>
                    <div class="col-md-2"></div>
                </div>
                <div class="row">
                    <div class="col-md-2"></div>
                    <div class="col-md-8">
                        <table class="table table-bordered">
                            <tr>
                                <td colspan="2">
                                    <table width="100%">
                                        <tr>
                                            <td>
                                                Nama : <?= $cases['Description']; ?>
                                                (
                                                <?php
                                                if ($cases['Sex'] == 1) {
                                                    echo "Perempuan";
                                                } else if ($cases['Sex'] == 2) {
                                                    echo "Laki-laki";
                                                } else {
                                                    echo "";
                                                }
                                                ?>
                                                )
                                            </td>
                                            <td>Tgl Lahir : <?= date('d F Y', strtotime($cases['DOB'])); ?> </td>
                                            <td>
                                                No.RM : <?= $cases['PatientCode']; ?>
                                            </td>
                                        </tr>
                                    </table>
                                </td>
                            </tr>
                            <tr>
                                <td colspan="2" style="text-align: justify;">
                                    Kriteria pasien yang dilakukan perencanaan pemulangan (discharge planning):
                                    <br>
                                    <?= $ttd['planning']; ?>
                                </td>
                            </tr>
                            <tr>
                                <td colspan="2">
                                    Diagnosa utama : <br>
                                    <?= $ttd['diagnosaUtama']; ?>
                                </td>
                            </tr>
                            <tr>
                                <td colspan="2">
                                    Diagnosa tambahan : <br>
                                    <?= $ttd['diagnosaTambahan']; ?>
                                </td>
                            </tr>
                            <tr align="center">
                                <td width="50%">KEBUTUHAN</td>
                                <td width="50%">PEMENUHAN KEBUTUHAN</td>
                            </tr>
                            <tr style="text-align: justify;">
                                <td>
                                    Diperkiraan akan membutuhkan bantuan dalam
                                    aktifitas sehari-hari selama di rumah
                                </td>
                                <td>
                                    <?= $ttd['bantuan']; ?><br>
                                    <?= $ttd['bantuanlainya']; ?>
                                </td>
                            </tr>
                            <tr style="text-align: justify;">
                                <td>
                                    Membutuhkan edukasi gizi yang kompleks terkait
                                    penyakitnya
                                </td>
                                <td>
                                    <?= $ttd['edukasiGizi']; ?>
                                    <br>
                                    <?= $ttd['edukasigizilainya']; ?>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    Membutuhkan penanganan nyeri kronis
                                </td>
                                <td>
                                    <?= $ttd['penangananKronis']; ?><br>
                                    <?= $ttd['penangananlainya']; ?>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    Diperkirakan akan membutuhkan pengelolaan
                                    penyakit secara berkelanjutan di luar Klinik Pratama
                                    Dr. Abdul Radjak
                                </td>
                                <td>
                                    Tujuan : <br>
                                    <?= $ttd['tujuan']; ?> <br>

                                    penatalaksanaan penyakit: <br>
                                    <?= $ttd['penataLaksana']; ?> <br>

                                    Tindakan, sebutkan <br>
                                    <?= $ttd['tindakan']; ?> <br>

                                    Tempat : <br>
                                    <?= $ttd['tempat']; ?>
                                </td>
                            </tr>
                            <tr>
                                <td>Kebutuhan lainnya</td>
                                <td>
                                    <?= $ttd['kebutuhanLainnya']; ?>
                                    <?php
                                    if ($ttd['kebutuhanLainnya'] == 'Konsultasi ke') {
                                        echo $ttd['konsultasiKe'];
                                    }
                                    ?>
                                </td>
                            </tr>

                            <tr align="center">
                                <td>
                                    <?php
                                    if ($ttd['ttdDokter'] == NULL) {
                                    ?>
                                        <form action="<?= base_url('discardPlaning/simpanTtdDokter/' . $ttd['CaseID']); ?>" method="post">
                                            Dokter
                                            <div class="form-group" style="margin-top: 8px;">
                                                <div id="sig3"></div>
                                                <textarea id="signature64_3" required name="ttdDokter" style="display: none"></textarea>
                                            </div>
                                            <input type="text" required placeholder="nama jelas" name="namaDokter" class="form-control" style="margin-bottom: 5px;width: 80%">
                                            <button style="width: 80%" class="btn btn-danger btn-block" id="clear_3">Reset</button>
                                            <button type="submit" style="width: 80%; margin-top: 5px;" class="btn btn-sm btn-primary">Simpan Tanda Tangan</button>
                                        </form>
                                    <?php
                                    } else {
                                    ?>
                                        Bogor, <?= date('d F Y', strtotime($ttd['tglTtdDokter'])); ?> <br>
                                        Dokter <br>
                                        <img src="<?= base_url('images/uploadsign/DiscardPlanning/' . $ttd['ttdDokter']); ?>.png" height="80px"><br>
                                        <?= $ttd['namaDokter']; ?>
                                    <?php
                                    }
                                    ?>
                                </td>
                                <td>
                                    <?php
                                    if ($ttd['ttdPerawat'] == NULL) {
                                    ?>
                                        <form action="<?= base_url('discardPlaning/simpanTtdPerawat/' . $ttd['CaseID']); ?>" method="post">
                                            Perawat
                                            <div class="form-group" style="margin-top: 8px;">
                                                <div id="sig4"></div>
                                                <textarea id="signature64_4" required name="ttdPerawat" style="display: none"></textarea>
                                            </div>
                                            <input type="text" required placeholder="nama jelas" name="namaPerawat" class="form-control" style="margin-bottom: 5px; width: 80%;">
                                            <button class="btn btn-danger btn-block" id="clear_4" style="width: 80%;">Reset</button>
                                            <button type="submit" style="width: 80%; margin-top: 5px;" class="btn btn-sm btn-primary">Simpan Tanda Tangan</button>
                                        </form>
                                    <?php
                                    } else {
                                    ?>
                                        Bogor, <?= date('d F Y', strtotime($ttd['tglTtdDokter'])); ?> <br>
                                        Perawat <br>
                                        <img src="<?= base_url('images/uploadsign/DiscardPlanning/' . $ttd['ttdPerawat']); ?>.png" height="80px"><br>
                                        <?= $ttd['namaPerawat']; ?>
                                    <?php
                                    }
                                    ?>

                                </td>
                            </tr>

                        </table>
                    </div>
                    <div class="col-md-2"></div>
                </div>


            </div>
        </div>

    </section><!-- /.content -->
</div><!-- /.content-wrapper -->
<script src="<?= base_url('aset/jquery-3.3.1.min.js'); ?>"></script>
<script src="<?= base_url('aset/jquery-migrate-1.4.1.min.js'); ?>"></script>
<script type="text/javascript">
    $(document).ready(function() {
        $('#kebutuhanLainnya').change(function() {
            if ($(this).val() == "Konsultasi ke") {
                $("#konsultasiKe").show();
            } else {
                $("#konsultasiKe").hide();
            }
        });
    });
</script>