176 lines
6.2 KiB
PHP
176 lines
6.2 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;
|
|
}
|
|
|
|
/* Set the background color of the current date heading */
|
|
table#datatables th.current-date {
|
|
background-color: #A8E7CF;
|
|
}
|
|
/* 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>Employ Leave List</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 . '><h2>' . $dayOfWeek . '</h2><span>(' . $formattedDate . ')</span></th>';
|
|
}
|
|
|
|
// Move to the next day
|
|
$currentDate = date('Y-m-d', strtotime($currentDate . ' +1 day'));
|
|
}
|
|
?>
|
|
</tr>
|
|
<tr>
|
|
<?php
|
|
// Reset the current date to 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));
|
|
|
|
// Skip Sunday
|
|
if ($dayOfWeek !== 'Sunday') {
|
|
echo '<td>';
|
|
|
|
// Check if there are leave records for the current day
|
|
if (array_key_exists($dayOfWeek, $weekData)) {
|
|
foreach ($weekData[$dayOfWeek] as $leaveRecord) {
|
|
if (empty($leaveRecord['from_time']) && empty($leaveRecord['to_time'])) {
|
|
// Display leave records for the day
|
|
echo $leaveRecord['emp_name'] . '<br>' . $leaveRecord['from_time'] . $leaveRecord['to_time'] . '<br>';
|
|
}
|
|
}
|
|
} else {
|
|
// No leave records for the day
|
|
|
|
}
|
|
|
|
echo '</td>';
|
|
}
|
|
|
|
// Move to the next day
|
|
$currentDate = date('Y-m-d', strtotime($currentDate . ' +1 day'));
|
|
}
|
|
?>
|
|
</tr>
|
|
|
|
<tr>
|
|
<?php
|
|
// Reset the current date to 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));
|
|
|
|
// Skip Sunday
|
|
if ($dayOfWeek !== 'Sunday') {
|
|
echo '<td>';
|
|
|
|
// Check if there are leave records for the current day
|
|
if (array_key_exists($dayOfWeek, $weekData)) {
|
|
foreach ($weekData[$dayOfWeek] as $leaveRecord) {
|
|
if (!empty($leaveRecord['from_time']) && !empty($leaveRecord['to_time'])) {
|
|
echo $leaveRecord['emp_name'] . '<br>' . $leaveRecord['from_time'] . $leaveRecord['to_time'] . '<br>';
|
|
}
|
|
}
|
|
} else {
|
|
// No leave records for the day
|
|
// echo 'No Leave';
|
|
}
|
|
|
|
echo '</td>';
|
|
}
|
|
|
|
// Move to the next day
|
|
$currentDate = date('Y-m-d', strtotime($currentDate . ' +1 day'));
|
|
}
|
|
?>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<br />
|
|
|
|
<!-- Large modal -->
|
|
<div class="modal fade bs-example-modal-lg" id="ItemModal" tabindex="-1" role="dialog" aria-hidden="true"></div>
|
|
<div class="modal bs-example-modal-sm" tabindex="-1" role="dialog" aria-hidden="true" id="popup"> </div>
|
|
|
|
<div style="display:none" id="sub-value"></div>
|
|
|
|
</body>
|
|
</html>
|