Bug Fix From Ria

This commit is contained in:
vadivelJ96 2025-05-07 12:02:48 +05:30
parent df17649e97
commit 4df671bc3f

View File

@ -1,4 +1,6 @@
<?php <?php
use Faker\Core\DateTime;
$datefordropdown = format_date($datefordropdown, 0, 'M-Y'); $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
//echo $datefordropdown; //echo $datefordropdown;
$attendance = array_merge($attendance, $emppay); // initial step there is no attendance entry so emppay data is merged $attendance = array_merge($attendance, $emppay); // initial step there is no attendance entry so emppay data is merged
@ -14,8 +16,6 @@ $currentday = date('d');
text-align: right; text-align: right;
} }
.fht-table, .fht-table,
.fht-table thead, .fht-table thead,
.fht-table tfoot, .fht-table tfoot,
@ -310,6 +310,7 @@ $currentday = date('d');
for ($col = 1; $col <= $monthdays; $col++) { for ($col = 1; $col <= $monthdays; $col++) {
$flag = 0; $flag = 0;
$flag2 = 0; $flag2 = 0;
$todayflag = 0; $todayflag = 0;
@ -338,6 +339,10 @@ $currentday = date('d');
} }
} }
if($col > $currentday && $datefordropdown == date('M-Y')){
continue;
}
?> ?>
@ -414,6 +419,8 @@ $currentday = date('d');
if ($col == $currentday) { if ($col == $currentday) {
$todayflag = 1; $todayflag = 1;
} }
foreach ($sundayarray as $in) { foreach ($sundayarray as $in) {
if ($in == $col) { if ($in == $col) {
$flag = 1; $flag = 1;
@ -434,6 +441,7 @@ $currentday = date('d');
//echo $title; //echo $title;
} }
} }
$WH = 'WH' . $col; $WH = 'WH' . $col;
$OT = 'OT' . $col; $OT = 'OT' . $col;
@ -451,9 +459,16 @@ $currentday = date('d');
} }
if($col > $currentday && $datefordropdown == date('M-Y')){
continue;
}
// echo "<pre>"."empid = $a->EmpID, date = $col, absent = $absent"."</pre>"; // echo "<pre>"."empid = $a->EmpID, date = $col, absent = $absent"."</pre>";
// echo "<pre>"."2) all Flags : flag2 = $flag2, flag = $flag2, absent = $absent"."</pre>"; // echo "<pre>"."2) all Flags : flag2 = $flag2, flag = $flag2, absent = $absent"."</pre>";
?>
?>
<td <?php if ($flag2 == 1) { ?> title=" <?php echo $title; ?> " <td <?php if ($flag2 == 1) { ?> title=" <?php echo $title; ?> "
<?php } else if ($flag == 1) { ?> title="sunday" <?php } ?> <?php } else if ($flag == 1) { ?> title="sunday" <?php } ?>
<?php if ($absent == 1) { ?> title="absent" <?php } ?> <?php if ($absent == 1) { ?> title="absent" <?php } ?>
@ -462,7 +477,7 @@ $currentday = date('d');
id="<?php echo $row . 'row' . $col . 'W'; ?>" id="<?php echo $row . 'row' . $col . 'W'; ?>"
<?php if ($flag == 1 or $flag2 == 1) { <?php if ($flag == 1 or $flag2 == 1) {
echo "style='background: #f5a6a7 ;'"; echo "style='background: #f5a6a7 ;'";
} else if ($todayflag == 1) { } else if ($todayflag == 1 && $datefordropdown == date('M-Y')) {
echo "style='background: #cef0ad ;'"; echo "style='background: #cef0ad ;'";
} ?> } ?>
<?php if ($absent == 1) { <?php if ($absent == 1) {
@ -484,7 +499,7 @@ $currentday = date('d');
id="<?php echo $row . 'row' . $col . 'OT'; ?>" id="<?php echo $row . 'row' . $col . 'OT'; ?>"
<?php if ($flag == 1 or $flag2 == 1) { <?php if ($flag == 1 or $flag2 == 1) {
echo "style='background: #f5a6a7 ;'"; echo "style='background: #f5a6a7 ;'";
} else if ($todayflag == 1) { } else if ($todayflag == 1 && $datefordropdown == date('M-Y')) {
echo "style='background: #cef0ad ;'"; echo "style='background: #cef0ad ;'";
} ?> } ?>
<?php if ($absent == 1) { <?php if ($absent == 1) {
@ -1093,3 +1108,42 @@ $("#searchInput").on("keyup", function () {
}); });
</script> </script>
<!-- on enter key press allowing user to go next line instead of submitting any form here -->
<script>
document.addEventListener("keydown", function(event) {
if (event.key === "Enter") {
let activeElement = document.activeElement;
// Check if the focused element is inside a table
let cell = activeElement.closest("td, th");
let table = activeElement.closest("table");
if (table && cell) {
event.preventDefault(); // Prevent form submission
let columnIndex = cell.cellIndex; // Get the current column index
let currentRow = cell.parentElement; // Get the current row
let nextRow = currentRow.nextElementSibling; // Get the next row
// Move to the same column in the next row if available
if (nextRow) {
let nextCell = nextRow.cells[columnIndex];
if (nextCell) {
nextCell.focus();
}
}
}
}
});
</script>