<?php
ob_start();
require("includes/check_auth_user.php");
require("includes/dbconnect.php");
include('includes/function.php');

$formname = "Schedule";
$file = "";
$zroot = $_SESSION["zdbroot"];

$admin = $_SESSION["admin_" . $dbname];
$zdb = $_SESSION["zdbyear_" . $dbname];
$myyear = $_SESSION[$myyear];
mysqli_select_db($conn, $zdb);

include("includes/linkshead.php");
?>
<script src="MyScript/calendarnew2.js" type="text/javascript"></script>
<style type="text/css">
    .ts-entry {
        transition: background-color 0.3s, transform 0.3s;
    }

    /*    .ts-entry:hover {
            background-color: #0275d8;  A lighter blue on hover 
            transform: scale(1.02);  Slightly enlarge on hover 
        }*/

    .ts-entry td {
        padding: 5px 5px; /* Increased padding for better spacing */
    }

    .ts-entry td.font-weight-bolder {
        font-weight: bold; /* Ensure bold styling */
    }

    /* Optional: Add a subtle box shadow */
    .ts-entry {
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    }

</style>
</head>
<body>
    <div style="display: flex; justify-content: space-between; width: 100%;">
        <table style="width: 30%;">
            <tr>
                <td style="padding-left: 2%;">
                    <div class="row">
                        <div class="col-lg-3 text-right">
                            <label class="label-control marg" style="font-size: 18px;">Month</label>
                        </div>
                        <div class="col-lg-4">
                            <select class="form-control monthno" name="month">
                                <?php
                                $date = date("Y-m-d");
                                $getmnt1 = mysqli_query($conn, "SELECT * FROM $zroot.month WHERE moncode = MONTH('$date')");
                                $fetmnth1 = mysqli_fetch_array($getmnt1);
                                echo "<option value='$fetmnth1[moncode]'>$fetmnth1[moncode] - $fetmnth1[monname]</option>";
                                $getmnt = mysqli_query($conn, "SELECT * FROM $zroot.month ORDER BY moncode");
                                while ($fetmnth = mysqli_fetch_array($getmnt)) {
                                    echo "<option value='$fetmnth[moncode]'>$fetmnth[moncode] - $fetmnth[monname]</option>";
                                }
                                ?>
                            </select>
                        </div>
                        <div class="col-lg-1">
                            <label class="label-control marg" style="font-size: 18px;">Year</label>
                        </div>
                        <div class="col-lg-2">
                            <select class="form-control yearno" name="yearno">
                                <?php
                                $getyr1 = mysqli_query($conn, "SELECT * FROM $zroot.yeartab WHERE yearname = YEAR('$date')");
                                $fetyr1 = mysqli_fetch_array($getyr1);
                                echo "<option value='$fetyr1[yearname]'>$fetyr1[yearname]</option>";
                                $getyear = mysqli_query($conn, "SELECT * FROM $zroot.yeartab ORDER BY yearname");
                                while ($fetyear = mysqli_fetch_array($getyear)) {
                                    echo "<option value='$fetyear[yearname]'>$fetyear[yearname]</option>";
                                }
                                ?>
                            </select>
                        </div>

                        <table class="table-bordered" style="width: 100%;">
                            <tbody class="tbody">
                            </tbody>
                        </table>

                    </div>
                </td>
            </tr>
        </table>

        <div style="max-height: 300px; overflow-y: auto; width: 68%;padding-top: 5%">
            <table class="table-bordered" style="width: 100%;">
                <tbody class="apointtbody">
                    <!-- Records will be dynamically populated here -->
                </tbody>
            </table>
        </div>
    </div>

    <div class="modal fade detailModal" data-bs-backdrop="static" 
          aria-hidden="true"  tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel">
        <div class="modal-dialog modal-lg">
            <div class="modal-content">
                <div class="modal-header">
                    <button class="close" data-dismiss="modal"><span>&times;</span></button>
                    <h4 class="modal-title" id="myLargeModalLabel"><? echo "&nbsp;&nbsp;"; ?></h4>
                </div>
                <div class="modal-body detailpatient">

                </div>
            </div>
        </div>
    </div>


    <?php include("includes/linksfoot.php"); ?>
</body>
</html>