<!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') ?>">
    <!-- ... (link CSS lainnya tetap sama) ... -->
    <style>
        .table-responsive {
            height: 720px;
            /* Sesuaikan tinggi tabel */
            overflow-y: auto;
            /* Aktifkan autoscroll vertikal */
            -ms-overflow-style: none;
            /* IE and Edge */
            scrollbar-width: none;
            /* Firefox */
        }

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

        .background-image {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background-image: url('<?= base_url('assets_/assets/img/backgroundhd1.jpg') ?>');
            background-size: cover;
            background-position: center;
            opacity: 0.5;
            z-index: -1;
        }

        .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 .d-flex {
            justify-content: center;
            text-align: center;
        }

        .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-bordered {
            width: 100%;
            border-collapse: collapse;
        }

        .table-bordered thead {
            position: sticky;
            top: 0;
            background-color: #007bff;
            /* Warna latar belakang header */
            z-index: 1;
            /* Pastikan header berada di atas konten */
        }

        .table-bordered th,
        .table-bordered td {
            border: 1px solid #dee2e6;
            /* Garis tabel lebih jelas */
            padding: 0.75rem;
            /* Tambah padding */
            vertical-align: middle;
            /* Rata tengah vertikal */
        }

        .table-bordered th {
            background-color: #007bff;
            /* Biru */
            color: white;
            text-align: center;
            font-weight: bold;
            font-size: 30px;
        }

        .table-bordered td {
            background-color: white;
            text-align: center;
            font-size: 1em;
        }

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


        }



        .watermark {
            position: absolute;
            /* Gunakan absolute untuk posisi yang lebih fleksibel */
            bottom: 10px;
            /* Jarak dari bawah */
            left: 50%;
            transform: translateX(-50%);
            /* Pusatkan secara horizontal */
            pointer-events: none;
            z-index: -1;
            opacity: 0.6;
            font-size: 20px;
            /* Sesuaikan ukuran font */
            font-family: sans-serif;
            font-weight: bold;
            color: #000;
            text-align: center;
            /* Ratakan teks ke tengah */
            width: 100%;
            /* Pastikan watermark memenuhi lebar halaman */
        }
    </style>
    <!-- ... (link CSS lainnya tetap sama) ... -->
    <title>Sinaran | Kuota Poliklinik</title>
</head>

<body onload="table();">
    <div class="background-image"></div>
    <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();
        }, 1000); // Ubah interval menjadi 1000ms (1 detik)

        function updateDateTime() {
            const now = new Date();
            const date = zeroFill((now.getMonth() + 1)) + '/' + zeroFill(now.getUTCDate()) + '/' + now.getFullYear();
            const time = zeroFill(now.getHours()) + ':' + zeroFill(now.getMinutes()) + ':' + zeroFill(now.getSeconds());
            document.getElementById('datetime').innerHTML = date + ' ' + time;
        }

        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-24">
                    <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>
                        <!-- /.card-header -->
                        <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="table-container" class="table-responsive">
                                <table class="table table-bordered header-table">
                                    <thead>
                                        <tr>
                                            <th>Nama Dokter</th>
                                            <th>Klinik</th>
                                            <th>
                                                <center>Jam</center>
                                            </th>
                                            <th>
                                                <center>Kapasitas</center>
                                            </th>
                                            <th>
                                                <center>Daftar</center>
                                            </th>
                                            <th>
                                                <center>Sisa</center>
                                            </th>
                                        </tr>
                                    </thead>
                                    <tbody id="tablei"></tbody>
                                </table>
                            </div>
                        </div>
                    </div>
                </div>
                <!-- /.col -->
            </div>
        </div><!-- /.container-fluid -->
    </section>
    <div id="table-container">
        <table>
            <tbody id="tablei">
            </tbody>
        </table>
    </div>
    <div class="watermark">By IT Support RSU ANANDA 2024</div>
    <script>
        document.addEventListener("DOMContentLoaded", function() {
            const container = document.getElementById('table-container');
            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>