<?php session_start();




if($_SESSION[invcox] == ""){




header("location:login.php?action=need");




}else{





include("config.php");?>





<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">




<html xmlns="http://www.w3.org/1999/xhtml">





<head>




<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />




<title>Arnim Holidays Accounting Software</title>




<link href="style.css" rel="stylesheet" type="text/css" />




<SCRIPT LANGUAGE="JavaScript">




<!-- Begin



function popUp(URL) {



day = new Date();

id = day.getTime();





eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=1,resizable=yes,width=950,height=650,left = 100,top = 100');");





}





// End -->




</script>



<style type="text/css">



    .dashboard-container {

      background: #eaf1f1;

      padding: 20px;

      border-radius: 12px;

      width: fit-content;

      margin: auto;

      box-shadow: 0 0 8px rgba(0,0,0,0.2);

    }



    h2 {

      text-align: center;

      margin-bottom: 20px;

    }



    table {

      

    }



     th, td {

      width: 30px;

      height: 30px;

      text-align: center;

      vertical-align: middle;

      position: relative;

      border-radius: 6px;

      font-size: 13px;

    }



    th {

      background-color: #f8f8f8;

      font-weight: bold;

		white-space: nowrap;

		padding: 8px 10px;

    }



    .available {

    color: #9c989a;

    }



    .booked {

      background-color: #7daa82;

		color: #000;

    }



    .hold {

      background-color: #b5b7f7;

      color:#000;

    }

	.check-in {

      background-color:#f61106;

      color: #000;

    }

	  .Check-out {

      background-color:#2f302f;

      color: #000;

    }



    /* Weekend colors */

    .friday-row th {

      background-color: #b5e2f5 !important; /* light blue */

    }

	.friday-row td {

      background-color: #b5e2f5 !important; /* light blue */

    }



    .saturday-row th {

      background-color: #ffe2b5 !important; /* light orange */

    }

	.saturday-row td {

      background-color: #ffe2b5 !important; /* light orange */

    }



    /* Highlight today's date row */

    .today-row th {

      background-color: #db4197 !important; /* yellow */

      font-weight: bold;



    }

	.today-row td {

      background-color: #db4197 !important; /* yellow */

      font-weight: bold;



    }



    .legend {

      display: flex;

      justify-content: center;

      gap: 20px;

      margin-top: 15px;

    }



    .legend span {

      display: flex;

      align-items: center;

      gap: 5px;

      font-size: 14px;

    }



    .color-box {

      width: 20px;

      height: 20px;

      border-radius: 4px;

     

    }



    /* Tooltip */

    td:hover::after {

      content: attr(data-info);

      position: absolute;

      top: -25px;

      left: 50%;

      transform: translateX(-50%);

      background-color: #333;

      color: #fff;

      font-size: 12px;

      padding: 3px 6px;

      border-radius: 4px;

      white-space: nowrap;

      z-index: 10;

    }



	.cell {

  height:100%;

  border-radius:6px;

  display:flex;

  align-items:center;

  justify-content:center;

  font-size:12px;

  user-select:none;

  position:relative;

  transition:transform 0.15s ease, background 0.15s ease;

}

.cell:hover {transform:scale(1.08);filter:brightness(1.1)}

.status-avail {

 background:linear-gradient(180deg,#fff,rgba(31,122,31,0.04));

  color:var(--avail);

  border:1px solid #8B8B8B;

}

</style>

<?php include("calendar.php"); ?>

</head>





<body>







<table width="95%" border="0" align="center" cellpadding="0" cellspacing="1" class="box-wrap">







  <tr>







    <td><?php include("top.php")?></td>







  </tr>







  <tr>







    <td>&nbsp;</td>







  </tr>







  <tr>







    <td class="center_page_white"><table width="100%" border="0" cellspacing="1" cellpadding="0">







      <tr>

        

        

        

        <td class="round_box"> <div class="dashboard-container">

    <h2>Hotel Reservation Dashboard — November 2025</h2>

    <table id="hotelTable">

      <thead>

        <tr>

          <th>Room →</th>

        </tr>

      </thead>

      <tbody id="dashboardBody"></tbody>

    </table>

    <div class="legend">

      <span><div class="color-box available"></div> Available</span>

      <span><div class="color-box booked"></div> Booked</span>

      <span><div class="color-box hold"></div> Hold</span>

      <span><div class="color-box" style="background:#b5e2f5"></div> Friday</span>

      <span><div class="color-box" style="background:#ffe2b5"></div> Saturday</span>

      <span><div class="color-box" style="background:#db4197"></div> Today</span>

    </div>

  </div>



  <script>

    const rooms = [<?php 

$result=mysql_query("select * from hotel_room order by room_no asc");

$row=mysql_fetch_array($result);

$sr=0;

do{

$sr=$sr+1;	

	if($sr>1){echo ',';}

	?>

	"<?php    echo $row[room_no]; ?>"

	<?php 

		

}while($row=mysql_fetch_array($result));

	?>

				  ];

    const month = 10; // November (0=Jan)

    const year = 2025;

    const daysInMonth = new Date(year, month + 1, 0).getDate();



    const weekdays = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];

    const today = new Date();

    const isCurrentMonth = today.getMonth() === month && today.getFullYear() === year;

    const todayDate = isCurrentMonth ? today.getDate() : null;



    const bookedCells = {

		

<?php 

$result=mysql_query("SELECT customer.customer_name, bookings.room_no,bookings.bill_id, bookings.check_in, bookings.status

FROM bookings

JOIN customer ON customer.id = bookings.customer_id

WHERE bookings.check_in >= '2025-11-01'

AND bookings.check_in <= '2025-11-30'

ORDER BY bookings.check_in ASC");

$row=mysql_fetch_array($result);

$sr=0;

do{

$sr=$sr+1;	

	if($sr>1){echo ',';}	

	?>

 

	 "<?php    echo $row[room_no]; ?>-<?php $stdate=substr("$row[check_in]",8,2); echo round($stdate); ?>":"<?php    echo $row[status]; ?>"

	<?php 

		

}while($row=mysql_fetch_array($result));

	?>

 

		

		

    };



    const tbody = document.getElementById("dashboardBody");



    for (let day = 1; day <= daysInMonth; day++) {

      const tr = document.createElement("tr");

      const dateCell = document.createElement("th");



      const dateObj = new Date(year, month, day);

      const dayName = weekdays[dateObj.getDay()];

      dateCell.textContent = `${day} - ${dayName}`;



      // Friday or Saturday color

      if (dayName === "Fri") tr.classList.add("friday-row");

      if (dayName === "Sat") tr.classList.add("saturday-row");



      // Highlight today's date

      if (day === todayDate) tr.classList.add("today-row");



      tr.appendChild(dateCell);



      rooms.forEach(room => {

        const td = document.createElement("td");

        const key = `${room}-${day}`;

       

		  if (bookedCells[key] === "Booked") {

          td.className = "booked";

          td.dataset.info = "Booked";

          td.textContent = room;

        } 

		  

		  else if (bookedCells[key] === "Hold") {

          td.className = "hold";

          td.dataset.info = "Hold";

          td.textContent = room;

        } 

		  

		    else if (bookedCells[key] === "Check-in") {

          td.className = "check-in";

          td.dataset.info = "check-in";

          td.textContent = room;

        } 

		  

		    else if (bookedCells[key] === "Check-out") {

          td.className = "Check-out";

          td.dataset.info = "Check-out";

          td.textContent = room;

        } 

		  

		  else {

          td.className = "available";

          td.dataset.info = "Available";

		 

		  td.innerHTML = `<div class="cell status-avail">${room}</div>`;

        }

        tr.appendChild(td);

      });



      tbody.appendChild(tr);

    }



    // Add room headers horizontally

    const headerRow = document.querySelector("thead tr");

    rooms.forEach(room => {

      const th = document.createElement("th");

      th.textContent = room;

      headerRow.appendChild(th);

    });

  </script>

</td>

        
        

      </tr>



    </table></td>



  </tr>



  <tr>



    <td><?php include("bot.php")?></td>




  </tr>




</table>





</body>




</html>




<?php }?>