bbone/application/modules/Leave/views/dashboard.php

124 lines
4.0 KiB
PHP

<!DOCTYPE html>
<html lang="en">
<head>
<link rel='stylesheet' href='https://cdn.jsdelivr.net/npm/bootstrap-icons@1.7.2/font/bootstrap-icons.css'>
<style>
.alert-success {
background-color: #dff0d8;
color: #3c763d;
border-color: #d6e9c6;
}
.flash-message {
padding: 10px;
margin-bottom: 10px;
border-radius: 5px;
margin-left: 650px;
}
div.dataTables_wrapper div.dataTables_filter {
margin-top: -30px !important;
}
/* Add a CSS class for highlighting the current date */
table#datatables th {
background-color: #C8E4E7;
text-align: center;
padding: 5px 5px;
}
/* Set the background color of the current date heading */
table#datatables th.current-date {
background-color: #A8E7CF;
}
td {
padding: 5px;
}
/* table#datatables th:not(.current-date):first-child,
table#datatables td:first-child:not(.current-date) {
background-color: #BEEEE6;
} */
</style>
</head>
<body>
<div class="col-md-12 col-sm-12 ">
<div class="x_panel">
<div class="x_title">
<button hidden id="button" class="btn btn-secondary source" onclick="new PNotify({
text: '<html><h2>Submited for Approval.<h2></html>',
type: 'success',
styling: 'bootstrap3'
});">Success</button>
<input type="hidden" id="error" value="<?php echo $this->session->userdata('Success'); ?>">
<?php $this->session->unset_userdata('Success'); ?>
<script>
$(document).ready(function () {
if ($('#error').val() == 1) {
$('#button').click();
}
})
</script>
<ul class="nav navbar-right panel_toolbox"></ul>
<h1>Leave Dashboard</h1>
<div class="clearfix"></div>
</div>
<div class="x_content">
<div class="row">
<div class="col-sm-12">
<table id="datatables" class="table table-striped table-bordered" width="100%">
<tr>
<?php
// Get the start date of the current week
$currentDate = date('Y-m-d', strtotime('monday this week'));
// Iterate over the days of the current week
for ($i = 0; $i < 7; $i++) {
$dayOfWeek = date('l', strtotime($currentDate));
$formattedDate = date('d-m-Y', strtotime($currentDate));
// Add a CSS class for the current date
$class = ($currentDate == date('Y-m-d')) ? ' class="current-date"' : '';
// Display the date and day, but skip Sunday
if ($dayOfWeek !== 'Sunday') {
echo '<th' . $class . '><p style="margin:0;">' . $dayOfWeek . '</p><span>(' . $formattedDate . ')</span></th>';
}
// Move to the next day
$currentDate = date('Y-m-d', strtotime($currentDate . ' +1 day'));
}
?>
</tr>
<?php
// Remove duplicate
foreach ($weekApprovedData as &$dayData) {
$dayData = array_unique($dayData);
}
// Assuming $weekApprovedData contains the array of arrays you provided
echo '<tr>';
echo '<td>' . implode(',<br>', $weekApprovedData['monday']) . '</td>';
echo '<td>' . implode(',<br>', $weekApprovedData['tuesday']) . '</td>';
echo '<td>' . implode(',<br>', $weekApprovedData['wednesday']) . '</td>';
echo '<td>' . implode(',<br>', $weekApprovedData['thursday']) . '</td>';
echo '<td>' . implode(',<br>', $weekApprovedData['friday']) . '</td>';
echo '<td>' . implode(',<br>', $weekApprovedData['saturday']) . '</td>';
echo '</tr>';
?>
</table>
</div>
</div>
</div>
</div>
</div>
</body>
</html>