<?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/calendarnew.js" type="text/javascript"></script>
<style type="text/css">
    .ts-entry {
        transition: background-color 0.3s, transform 0.3s;
    }
    .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);
    }
    .showcal {
        display: flex; 
        justify-content: space-between; 
        width: 100%;
    }

    /*.apointtbody tr:hover {background-color: coral;}*/

    @media (max-width: 768px) { /* Adjust this value as needed */
        .showcal {
            display: block; /* Change to block for mobile */
            width: auto; /* Adjust width as needed */
            /* Add any other styles you want for mobile here */
        }
    }
</style>
</head>

<body>
    <div class="showcal" style="">
        <table style="width: 20%;">
            <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-6">
                            <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>
                    <div class="row">
                        <div class="col-lg-3  text-right">
                            <label class="label-control marg" style="font-size: 18px;">Year</label>
                        </div>
                        <div class="col-lg-4">
                            <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>



                    </div>
                    <table class="table-bordered" style="width: 50%;height:50%">
                        <tbody class="tbody">
                        </tbody>
                    </table>
                </td>
            </tr>
        </table>

        <div style="overflow-y: auto; width: 75%;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" 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" style="margin-left: 650px !important;" id="myLargeModalLabel"><? echo "&nbsp;&nbsp;"; ?>
                        <?php
//                        $getdet = mysqli_query($conn, "SELECT * FROM consultmain") or die(mysqli_error($conn));
//                        $fetdet = mysqli_fetch_array($getdet);
                        ?>
                    </h4>
                </div>
                <div class="modal-body detailpatient">

                </div>
            </div>
        </div>
    </div>
    <!--        <div class="modal fade treatdetailModal" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel"  style="z-index: 1001;">
            <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 treatdetail">
    
                    </div>
                </div>
            </div>
        </div>-->


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

</html>