<head>
    <script src="https://cdn.jsdelivr.net/npm/html2canvas@1.4.1/dist/html2canvas.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/jspdf@2.5.1/dist/jspdf.umd.min.js"></script>
</head>


<div id="layoutSidenav_content">
    <main>
        <div class="container-fluid px-4">
            <h1 class="mt-4" id="judulPasien">Dashboard Pasien IGD</h1>
            <ol class="breadcrumb mb-4">
                <li class="breadcrumb-item"><a href="index.html">Dashboard</a></li>
                <li class="breadcrumb-item active">Tampil Data Pasien IGD</li>
            </ol>
            <!-- Filter Tanggal -->
            <div class="card mb-4">
                <div class="card-body">
                    <form action="<?= base_url('igd/tampildataigd') ?>" method="POST" name="form-input-data">
                        <div class="row">
                            <div class="col-md-4">
                                <div class="form-group">
                                    <label for="tgl_awal">Tanggal Awal</label>
                                    <input type="date" id="tanggal_awal" name="tanggal_awal" class="form-control" value="<?= $tgl_awal ?>" required />
                                </div>
                            </div>
                            <!-- <div class="col-md-4">
                <div class="form-group">
                  <label for="tgl_akhir">Tanggal AKhir</label>
                  <input type="date" id="tanggal_akhir" name="tanggal_akhir" class="form-control" value="<?= $tglakhir ?>" required />
                </div>
              </div> -->
                        </div>
                        <div class="col-12">
                            <button style="margin-top: 20px;" type="submit" class="btn btn-primary btn-block">Filter</button>
                        </div>
                        <!-- <button style="margin-top: 20px;" id="export-btn">Export to JPG</button> -->
                    </form>
                </div>
            </div>

            <!-- TAMPIL TABEL RAWAT JALAN  -->
            <h2 style="margin-top: 30px;">Tampil Dashboard Pasien IGD</h2>
            <div style="margin-top: 10px;" class="row">
                <div class="col-md-6">
                    <div class="card">
                        <div class="card-header">
                            <h3 style="text-align: center;" class="card-title">Pasien IGD Lama-Baru</h3>
                        </div>
                        <div class="card-body">
                            <div class="table-responsive">
                                <table id="example2" class="table table-striped table-bordered table-hover">
                                    <thead>
                                        <tr style="text-align: center;">
                                            <th>Jenis Pasien</th>
                                            <th>Dilayani</th>
                                            <th>Batal</th>
                                            <th>Total</th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <?php
                                        $no = 1;
                                        if (isset($igdlamabaru->response)) {
                                            foreach ($igdlamabaru->response as $a) {
                                        ?>
                                                <tr>
                                                    <td><?= $a->nm_pendaftaran ?></td>
                                                    <td><?= $a->dilayani ?></td>
                                                    <td><?= $a->batal ?></td>
                                                    <td><?= $a->total ?></td>
                                                </tr>
                                            <?php
                                            }
                                        } else {
                                            ?>
                                            <tr>
                                                <td colspan="2" style="text-align: center;">Data tidak ditemukan</td>
                                            <tr>
                                            <?php
                                        }
                                            ?>
                                    </tbody>
                                </table>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="col-md-6">
                    <div class="card">
                        <div class="card-header">
                            <h3 style="text-align: center;" class="card-title">Pasien IGD Total</h3>
                        </div>
                        <div class="card-body">
                            <div class="table-responsive">
                                <table id="example2" class="table table-striped table-bordered table-hover">
                                    <thead>
                                        <tr>
                                            <th>Dilayani</th>
                                            <th>Batal</th>
                                            <th>Total</th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <?php
                                        $no = 1;
                                        if (isset($igdhariinitotal->response)) {
                                            foreach ($igdhariinitotal->response as $a) {
                                        ?>
                                                <tr>
                                                    <td><?= $a->dilayani ?></td>
                                                    <td><?= $a->batal ?></td>
                                                    <td><?= $a->total_igd ?></td>
                                                </tr>
                                            <?php
                                            }
                                        } else {
                                            ?>
                                            <tr>
                                                <td colspan="2" style="text-align: center;">Data tidak ditemukan</td>
                                            <tr>
                                            <?php
                                        }
                                            ?>
                                    </tbody>
                                </table>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <div class="card">
                <div class="card-header">
                    <h3 style="text-align: center;" class="card-title">Data Pasien IGD INAP </h3>
                </div>
                <div class="card-body">
                    <table id="example2" class="table table-bordered table-hover">
                        <thead>
                            <tr>
                                <th>Jenis Pasien</th>
                                <th>Dilayani</th>
                                <th>Batal</th>
                                <th>Total</th>
                            </tr>
                        </thead>
                        <tbody>
                            <?php
                            $no = 1;
                            if (isset($igdtampilhariini->response)) {
                                foreach ($igdtampilhariini->response as $a) {
                            ?>
                                    <tr>
                                        <td><?= $a->nm_jenis_pasien ?></td>
                                        <td><?= $a->dilayani ?></td>
                                        <td><?= $a->batal ?></td>
                                        <td><?= $a->total ?></td>

                                    </tr>
                                <?php
                                }
                            } else {
                                ?>
                                <tr>
                                    <td colspan="2" style="text-align: center;">Data tidak ditemukan</td>
                                <tr>
                                <?php
                            }
                                ?>
                        </tbody>
                    </table>
                </div>
            </div>

            <!--END OF TAMPIL DATA TABEL DEMOGRAFI  -->
        </div>
        </footer>
</div>
</div>

<script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.5.2/dist/js/bootstrap.bundle.min.js"></script>

<!-- Jquery -->
<script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
<!-- DataTables JS -->
<script src="https://cdn.datatables.net/1.13.4/js/jquery.dataTables.min.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.13/css/select2.min.css" rel="stylesheet" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.13/js/select2.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/js/bootstrap.bundle.min.js" crossorigin="anonymous"></script>
<script src="<?php echo base_url('assets_/js/scripts.js'); ?>"></script>
<script src="https://cdn.jsdelivr.net/npm/simple-datatables@7.1.2/dist/umd/simple-datatables.min.js" crossorigin="anonymous"></script>
<script src="<?php echo base_url('assets_/js/datatables-simple-demo.js'); ?>"></script>
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>

</body>

</html>