File: /home/bigisxfd/public_html/cowork/dashboard.php
<?php
// Include necessary files
include_once("header.php");
include_once("sidebar.php");
// Get counts for different categories
$activeCommonBookings = getActiveBookingCountByCategory(1); // Common category
$activeDedicatedBookings = getActiveBookingCountByCategory(2); // Dedicated category
$activeBoardBookings = getActiveBookingCountByCategory(3); // Board category
$activeBookings = getActiveBookingsWithDetails(); // Define this function to fetch active bookings with customer names and package details
?>
<style>
body {
font-family: Arial, sans-serif;
}
.column {
display: flex;
flex-direction: column;
align-items: center;
}
.summary-row {
display: flex;
justify-content: space-between;
width: 100%;
}
.summary-box {
border: 1px solid #ccc;
border-radius: 10px;
padding: 20px;
margin: 20px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
background-color: #f7f7f7;
width: 33%; /* Adjust as needed */
}
.category-summary {
margin-top: 10px;
}
.category-summary p {
margin: 5px 0;
}
h2 {
margin-bottom: 10px;
}
h1 {
font-size: 35px;
}
</style>
<section>
<div class="column">
<h2>Dashboard<br> TIME NOW: <?php
// Display the current date and time
echo date('h:i A');
?></h2>
<div class="summary-row">
<div class="summary-box">
<h3>Common Booking</h3>
<div class="category-summary">
<h1><?php echo $activeCommonBookings; ?> / 24</h1>
</div>
</div>
<div class="summary-box">
<h3>Dedicated Bookings</h3>
<div class="category-summary">
<h1><?php echo $activeDedicatedBookings; ?> / 12</h1>
</div>
</div>
<div class="summary-box">
<h3>Board Bookings</h3>
<div class="category-summary">
<h1><?php echo $activeBoardBookings; ?> / 2</h1>
</div>
</div>
</div>
<!-- Add more summary rows or sections as needed -->
</div>
<div class="column">
<div style="display: flex; align-items: center; justify-content: space-between;">
<h2>Active Bookings</h2>
</div>
<table>
<tr>
<th>Booking ID</th>
<th>Customer Name</th>
<th>Package</th>
<th>Start Time</th>
<th>End Time</th>
<th>Time Remaining</th>
</tr>
<?php foreach ($activeBookings as $booking): ?>
<tr <?php if ($booking['time_remaining_minutes'] <= 10) echo 'class="highlight-red"'; ?>>
<td><?php echo $booking['bookingid']; ?></td>
<td><?php echo $booking['firstname'] . ' ' . $booking['lastname']; ?></td>
<td><?php echo $booking['packagename']; ?></td>
<td><?php echo $booking['formatted_startdate']; ?></td>
<td><?php echo $booking['formatted_enddate']; ?></td>
<td>
<span id="countdown-<?php echo $booking['bookingid']; ?>">
<?php echo $booking['time_remaining']; ?>
</span>
</td>
</tr>
<?php endforeach; ?>
</table>
</div>
</section>
<script>
window.setTimeout( function() {
window.location.reload();
}, 30000);
</script>
</body>
</html>