<!DOCTYPE html>
<html>

<head>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="shortcut icon" type="image/png" href="<?= base_url('assets_/assets/img/logo-mini.png') ?>">
    <!-- Google Font: Source Sans Pro -->
    <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700&display=fallback">
    <!-- Font Awesome Icons -->
    <link rel="stylesheet" href="<?php echo base_url(); ?>plugins/fontawesome-free/css/all.min.css">
    <!-- Tempusdominus Bootstrap 4 -->
    <link rel="stylesheet" href="<?php echo base_url(); ?>plugins/tempusdominus-bootstrap-4/css/tempusdominus-bootstrap-4.min.css">
    <!-- iCheck -->
    <link rel="stylesheet" href="<?php echo base_url(); ?>plugins/icheck-bootstrap/icheck-bootstrap.min.css">
    <!-- JQVMap -->
    <link rel="stylesheet" href="<?php echo base_url(); ?>plugins/jqvmap/jqvmap.min.css">
    <!-- overlayScrollbars -->
    <link rel="stylesheet" href="<?php echo base_url(); ?>plugins/overlayScrollbars/css/OverlayScrollbars.min.css">
    <!-- Daterange picker -->
    <link rel="stylesheet" href="<?php echo base_url(); ?>plugins/daterangepicker/daterangepicker.css">
    <!-- summernote -->
    <link rel="stylesheet" href="<?php echo base_url(); ?>plugins/summernote/summernote-bs4.min.css">
    <!-- Bootstrap Color Picker -->
    <link rel="stylesheet" href="<?php echo base_url(); ?>plugins/bootstrap-colorpicker/css/bootstrap-colorpicker.min.css">
    <!-- DataTables -->
    <link rel="stylesheet" href="<?php echo base_url(); ?>plugins/datatables-bs4/css/dataTables.bootstrap4.min.css">
    <link rel="stylesheet" href="<?php echo base_url(); ?>plugins/datatables-responsive/css/responsive.bootstrap4.min.css">
    <link rel="stylesheet" href="<?php echo base_url(); ?>plugins/datatables-buttons/css/buttons.bootstrap4.min.css">
    <!-- Select2 -->
    <link rel="stylesheet" href="<?php echo base_url(); ?>plugins/select2/css/select2.min.css">
    <link rel="stylesheet" href="<?php echo base_url(); ?>plugins/select2-bootstrap4-theme/select2-bootstrap4.min.css">
    <!-- Bootstrap4 Duallistbox -->
    <link rel="stylesheet" href="<?php echo base_url(); ?>plugins/bootstrap4-duallistbox/bootstrap-duallistbox.min.css">
    <!-- BS Stepper -->
    <link rel="stylesheet" href="<?php echo base_url(); ?>plugins/bs-stepper/css/bs-stepper.min.css">
    <!-- dropzonejs -->
    <link rel="stylesheet" href="<?php echo base_url(); ?>plugins/dropzone/min/dropzone.min.css">
    <!-- Theme style -->
    <link rel="stylesheet" href="<?php echo base_url(); ?>dist/css/adminlte.min.css">

    <style>
        body,
        html {
            margin: 0;
            padding: 0;
            height: 100vh;
            font-family: 'Source Sans Pro', sans-serif;
            background-image: url('<?php echo base_url(); ?>assets_/assets/img/backgroundhd1.jpg');
            background-size: cover;
            background-position: center;
            background-repeat: no-repeat;
            position: relative;
        }

        body::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: rgba(255, 255, 255, 0.8);
            /* Overlay putih dengan opacity 80% */
            z-index: -1;
        }

        .container-fluid {
            padding: 20px;
        }

        .card {
            border-radius: 10px;
            box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
            overflow: hidden;
            background-color: rgba(255, 255, 255, 0.8);
            height: 90vh;
            /* tambahkan kode ini untuk menambahkan tinggi */
            /* Latar belakang card semi-transparan */
        }

        .card-header {
            background-color: rgb(240, 240, 240);
            color: white;
            padding: 20px;
            border-bottom: none;
            position: relative;

        }

        .card-header h1 {
            margin: 0;
            font-size: 2rem;
        }

        .card-header h2 {
            margin: 0;
            font-size: 1.5rem;
        }

        .card-header .datetime {
            position: absolute;
            right: 20px;
            bottom: 10px;
            font-size: 1rem;
            color: white;
        }

        .table-responsive {
            max-height: 90vh;
            overflow-y: auto;
        }

        .table {
            width: 100%;
            margin-bottom: 0;
        }

        .card-header .d-flex {
            justify-content: center;
            text-align: center;
        }

        .table thead {
            position: -webkit-sticky;
            position: sticky;
            top: 0;
            background-color: #007bff;
            color: white;
            border-bottom: none;
        }

        .table-responsive::-webkit-scrollbar {
            display: none;
            /* Chrome, Safari, and Opera */
        }

        .table-fixed {
            width: 100%;
            background-color: #007bff;
            color: white;
            border-bottom: none;
            position: sticky;
            top: 0;
        }

        .table thead th {
            background-color: #007bff;
            color: white;
            border-bottom: none;
            font-size: 28px;
        }

        .table tbody tr:hover {
            background-color: #f1f1f1;
            transition: background-color 0.3s ease;
        }

        .table tbody td {
            vertical-align: middle;
        }

        .table tbody td,
        .table tbody th {
            padding: 12px;
            font-size: 18px;
            /* Ukuran font */
        }

        .table tbody tr:nth-child(even) {
            background-color: #f8f9fa;
        }

        .table tbody tr:nth-child(odd) {
            background-color: white;
        }

        .justify-content-end {
            text-align: right;
            font-size: 1.2rem;
            color: #007bff;
        }

        .img-logo {
            height: 70px;
            width: 230px;
            /* margin-right: 20px; */
            text-align: center;


        }

        .content {
            padding: 20px;
        }

        .table-responsive {
            max-height: 90vh;
            overflow-y: auto;
        }
    </style>

    <title>Sinaran | Kuota Pendaftaran</title>
</head>

<body onload="table(); updateDateTime();">
    <script>
        function table() {
            const xhttp = new XMLHttpRequest();
            xhttp.onload = function() {
                document.getElementById("tablei").innerHTML = this.responseText;
            }
            xhttp.open("GET", "<?= base_url("Poli/antreandis") ?>");
            xhttp.send();
        }

        setInterval(function() {
            table();
        }, 5000); // Perbarui setiap 5 detik


        function updateDateTime() {
            const now = new Date();
            const hari = ["Minggu", "Senin", "Selasa", "Rabu", "Kamis", "Jumat", "Sabtu"];
            const bulan = ["Januari", "Februari", "Maret", "April", "Mei", "Juni", "Juli", "Agustus", "September", "Oktober", "November", "Desember"];
            const tanggal = hari[now.getDay()] + ", " + now.getDate() + " " + bulan[now.getMonth()] + " " + now.getFullYear();
            const jam = zeroFill(now.getHours()) + ':' + zeroFill(now.getMinutes()) + ':' + zeroFill(now.getSeconds());
            document.getElementById('datetime').innerHTML = tanggal + ' ' + jam;
        }


        function zeroFill(num) {
            return num < 10 ? '0' + num : num;
        }

        setInterval(updateDateTime, 1000); // Perbarui waktu setiap detik
    </script>

    <section class="content">
        <div class="container-fluid">
            <div class="row">
                <div class="col-md-12">
                    <div class="card">
                        <div class="card-header">
                            <div class="d-flex align-items-center">
                                <img src="<?php echo base_url(); ?>assets_/assets/img/and.png" class="img-logo">
                                <div>
                                    <h1 style="text-align: center; font-size:50px; color:black;"><strong>INFORMASI KUOTA POLIKLINIK</strong></h1>
                                    <h2 style="text-align: center; font-size:30px; color:black;"><strong>RUMAH SAKIT UMUM ANANDA PURWOKERTO</strong></h2>
                                </div>
                            </div>
                            <div style="font-size: 20px; color:black;" class="datetime" id="datetime"></div> <!-- Waktu dan tanggal -->
                        </div>
                        <div class="card-body">
                            <div class="d-flex justify-content-between mb-3">
                                <h1 id="p1" class="justify-content-end"></h1>
                                <h1 id="p2" class="justify-content-end"></h1>
                            </div>
                            <div id="example1" class="table-responsive">
                                <table class="table table-bordered">
                                    <thead>
                                        <tr>
                                            <th><strong>Nama Dokter</strong></th>
                                            <th><strong>Klinik</strong></th>
                                            <th>
                                                <center><strong>Jam</strong></center>
                                            </th>
                                            <th>
                                                <center><strong>Kapasitas</strong></center>
                                            </th>
                                            <th>
                                                <center><strong>Daftar</strong></center>
                                            </th>
                                            <th>
                                                <center><strong>Sisa</strong></center>
                                            </th>
                                        </tr>
                                    </thead>
                                    <tbody id="tablei"></tbody>
                                </table>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </section>
    <div id="example1">
        <table>
            <tbody id="tablei">
            </tbody>
        </table>
    </div>

    <center>
        <h6 style="margin-bottom:50px; font-size:20px;"><strong>by IT RSU ANANDA PURWOKERTO</strong></h6>
    </center>

    <script src="<?php echo base_url(); ?>plugins/bootstrap/js/bootstrap.bundle.min.js"></script>
    <!-- overlayScrollbars -->
    <script src="<?php echo base_url(); ?>plugins/overlayScrollbars/js/jquery.overlayScrollbars.min.js"></script>
    <!-- AdminLTE App -->
    <script src="<?php echo base_url(); ?>dist/js/adminlte.js"></script>
    <!-- Select2 -->
    <script src="<?php echo base_url() ?>plugins/select2/js/select2.full.min.js"></script>
    <!-- daterangepicker -->
    <script src="<?php echo base_url() ?>plugins/moment/moment.min.js"></script>
    <script src="<?php echo base_url() ?>plugins/daterangepicker/daterangepicker.js"></script>
    <!-- Tempusdominus Bootstrap 4 -->
    <script src="<?php echo base_url() ?>plugins/tempusdominus-bootstrap-4/js/tempusdominus-bootstrap-4.min.js"></script>
    <!-- Summernote -->
    <script src="<?php echo base_url() ?>plugins/summernote/summernote-bs4.min.js"></script>
    <!-- jQuery Mapael -->
    <script src="<?php echo base_url(); ?>plugins/jquery-mousewheel/jquery.mousewheel.js"></script>
    <script src="<?php echo base_url(); ?>plugins/raphael/raphael.min.js"></script>
    <script src="<?php echo base_url(); ?>plugins/jquery-mapael/jquery.mapael.min.js"></script>
    <script src="<?php echo base_url(); ?>plugins/jquery-mapael/maps/usa_states.min.js"></script>
    <!-- ChartJS -->
    <script src="<?php echo base_url(); ?>plugins/chart.js/Chart.min.js"></script>
    <!-- AdminLTE dashboard demo (This is only for demo purposes) -->
    <script src="<?php echo base_url(); ?>dist/js/pages/dashboard2.js"></script>
    <!-- DataTables  & Plugins -->
    <script src="<?php echo base_url() ?>plugins/datatables/jquery.dataTables.min.js"></script>
    <script src="<?php echo base_url() ?>plugins/datatables-bs4/js/dataTables.bootstrap4.min.js"></script>
    <script src="<?php echo base_url() ?>plugins/datatables-responsive/js/dataTables.responsive.min.js"></script>
    <script src="<?php echo base_url() ?>plugins/datatables-responsive/js/responsive.bootstrap4.min.js"></script>
    <script src="<?php echo base_url() ?>plugins/datatables-buttons/js/dataTables.buttons.min.js"></script>
    <script src="<?php echo base_url() ?>plugins/datatables-buttons/js/buttons.bootstrap4.min.js"></script>
    <script src="<?php echo base_url() ?>plugins/jszip/jszip.min.js"></script>
    <script src="<?php echo base_url() ?>plugins/pdfmake/pdfmake.min.js"></script>
    <script src="<?php echo base_url() ?>plugins/pdfmake/vfs_fonts.js"></script>
    <script src="<?php echo base_url() ?>plugins/datatables-buttons/js/buttons.html5.min.js"></script>
    <script src="<?php echo base_url() ?>plugins/datatables-buttons/js/buttons.print.min.js"></script>
    <script src="<?php echo base_url() ?>plugins/datatables-buttons/js/buttons.colVis.min.js"></script>
    <script src="<?php echo base_url() ?>assets_/js/antibiotik_rajal.js"></script>

    <script>
        $(function() {
            $("#example1").DataTable({
                "responsive": true,
                "lengthChange": false,
                "autoWidth": false,
                "scrollX": true,
                "scrollY": "60vh",
                "paging": true,
            });
        });
    </script>

    <script>
        document.addEventListener("DOMContentLoaded", function() {
            const container = document.getElementById('example1');
            let scrollAmount = 0;
            const scrollStep = 1;
            const scrollInterval = 100;

            function autoScroll() {
                scrollAmount += scrollStep;
                if (scrollAmount >= container.scrollHeight - container.clientHeight) {
                    scrollAmount = 0;
                }
                container.scrollTop = scrollAmount;
            }

            setInterval(autoScroll, scrollInterval);
        });
    </script>
</body>

</html>