GWM : navigation menu
This commit is contained in:
parent
63ce96efec
commit
dac2812848
@ -1,5 +1,3 @@
|
||||
|
||||
|
||||
<?php
|
||||
$datefordropdown = format_date($datefordropdown, 0, 'M-Y');
|
||||
?>
|
||||
@ -159,14 +157,11 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
|
||||
height: 20px;
|
||||
}
|
||||
|
||||
.modal {
|
||||
padding-right: 30% ! important;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#dieselMachineTable th:nth-child(1),
|
||||
#dieselMachineTable td:nth-child(1)
|
||||
{
|
||||
#dieselMachineTable td:nth-child(1) {
|
||||
position: sticky;
|
||||
left: 0;
|
||||
background-color: #00a65a;
|
||||
@ -174,10 +169,60 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
|
||||
border-right: 2px solid #ddd;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="modal fade" id="bs-example-modal-lg" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog modal-lg">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title" id="myLargeModalLabel">Navigation Options</h4>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="row">
|
||||
<!-- Machine Dropdown -->
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label for="machineDropdown">Select Machine</label>
|
||||
<select id="machineDropdown" class="form-control">
|
||||
<option value="">Select Machine</option>
|
||||
<?php foreach ($machineName as $name): ?>
|
||||
<option value="<?= $name; ?>"><?= $name; ?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Date Dropdown -->
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label for="dateDropdown">Select Date</label>
|
||||
<select id="dateDropdown" class="form-control">
|
||||
<option value="01-11-2024">01-11-2024</option>
|
||||
<option value="02-11-2024">02-11-2024</option>
|
||||
<option value="10-11-2024">10-11-2024</option>
|
||||
<option value="15-11-2024">15-11-2024</option>
|
||||
<option value="25-11-2024">25-11-2024</option>
|
||||
<option value="30-11-2024">30-11-2024</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<button class="btn btn-primary float-right" onclick="navigateToMachine()">Navigate</button>
|
||||
</div>
|
||||
</div><!-- /.modal-content -->
|
||||
</div><!-- /.modal-dialog -->
|
||||
</div><!-- /.modal -->
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="content-page">
|
||||
<div class="content">
|
||||
<!-- Start Content-->
|
||||
@ -208,6 +253,8 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
|
||||
|
||||
<div class="card-body">
|
||||
|
||||
|
||||
@ -216,17 +263,42 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
|
||||
|
||||
<div class="col-3">
|
||||
<?php $today = date('M-Y'); ?>
|
||||
<input type="text" name="month" id="month" value="<?php echo $datefordropdown; ?>" class="form-control" data-provide="datepicker" data-date-format="M-yyyy" data-date-min-view-mode="1">
|
||||
<input type="text" name="month" id="month"
|
||||
value="<?php echo $datefordropdown; ?>" class="form-control"
|
||||
data-provide="datepicker" data-date-format="M-yyyy"
|
||||
data-date-min-view-mode="1">
|
||||
|
||||
</div>
|
||||
<div class="col-3">
|
||||
<input type="submit" value="Change Month" class="btn btn-success" style="margin-top:0px;">
|
||||
<input type="submit" value="Change Month" class="btn btn-success"
|
||||
style="margin-top:0px;">
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<div class="dropdown float-right">
|
||||
<a href="#" class="dropdown-toggle arrow-none" data-toggle="dropdown"
|
||||
aria-expanded="false">
|
||||
<i class="mdi mdi-dots-vertical m-0 text-muted h3"></i>
|
||||
</a>
|
||||
<div class="dropdown-menu dropdown-menu-right">
|
||||
<a class="dropdown-item" data-toggle="modal" data-target="#bs-example-modal-lg">Navigation</a>
|
||||
<a class="dropdown-item" href="#">Export</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</form>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- Add table-responsive for horizontal scroll -->
|
||||
<div class="table-responsive">
|
||||
<?php
|
||||
@ -242,14 +314,17 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
|
||||
?>
|
||||
|
||||
|
||||
<table id="dieselMachineTable" class="fht-table table-striped" style="font-size: small;">
|
||||
<table id="dieselMachineTable" class="fht-table table-striped"
|
||||
style="font-size: small;">
|
||||
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="celda_encabezado_general" style="padding: 10px;"></th>
|
||||
<th class="celda_encabezado_general" colspan="4" style="padding: 10px;">Total Diesel</th>
|
||||
<th class="celda_encabezado_general" colspan="4" style="padding: 10px;">
|
||||
Total Diesel</th>
|
||||
<?php foreach ($machineName as $name): ?>
|
||||
<th class="celda_encabezado_general" colspan="6" style="padding: 10px;"><?= $name; ?></th>
|
||||
<th class="celda_encabezado_general" colspan="6" data-id="<?= $name; ?>"
|
||||
style="padding: 10px;"><?= $name; ?></th>
|
||||
<?php endforeach; ?>
|
||||
</tr>
|
||||
</thead>
|
||||
@ -257,7 +332,8 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
|
||||
<thead>
|
||||
<tr>
|
||||
<?php foreach ($columns as $column): ?>
|
||||
<th class="celda_encabezado_general" style="padding: 10px;" id="<?= $column ?>"><?= formatHeader($column) ?></th>
|
||||
<th class="celda_encabezado_general" style="padding: 10px;"
|
||||
id="<?= $column ?>"><?= formatHeader($column) ?></th>
|
||||
<?php endforeach; ?>
|
||||
</tr>
|
||||
</thead>
|
||||
@ -268,25 +344,42 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
|
||||
<?php foreach ($columns as $index => $column): ?>
|
||||
|
||||
<?php if($index == 0) : ?>
|
||||
<td class="celda_normal" style="padding: 5px;" ><?php echo DateTime::createFromFormat('Y-m-d', $row[$column])->format('d-m-Y'); ?></td>
|
||||
<td class="celda_normal" style="padding: 5px;">
|
||||
<?php echo DateTime::createFromFormat('Y-m-d', $row[$column])->format('d-m-Y'); ?>
|
||||
</td>
|
||||
<?php elseif(formatHeader($column) == 'Opening Reading'): ?>
|
||||
<td class="celda_normal" <?= ($key == 0) ? 'contenteditable="true"' : ''; ?> style="padding: 5px;"><?= $row[$column] ?? 'N/A' ?></td>
|
||||
<td class="celda_normal"
|
||||
<?= ($key == 0) ? 'contenteditable="true"' : ''; ?>
|
||||
style="padding: 5px;"><?= $row[$column] ?? 'N/A' ?></td>
|
||||
<?php elseif(formatHeader($column) == 'Closing Reading'): ?>
|
||||
<td class="celda_normal" contenteditable="true" onkeyup="calculateRunningHrs(this.parentNode.id,this.textContent);" style="padding: 5px;"><?= $row[$column] ?? 'N/A' ?></td>
|
||||
<td class="celda_normal" contenteditable="true"
|
||||
onkeyup="calculateRunningHrs(this.parentNode.id,this.textContent);"
|
||||
style="padding: 5px;"><?= $row[$column] ?? 'N/A' ?></td>
|
||||
<?php elseif(formatHeader($column) == 'Filling Diesel'): ?>
|
||||
<td class="celda_normal" contenteditable="true" onkeyup="calculateTotalFillingDiesel(this.parentNode.id,this.textContent);" style="padding: 5px;"><?= $row[$column] ?? 'N/A' ?></td>
|
||||
<td class="celda_normal" contenteditable="true"
|
||||
onkeyup="calculateTotalFillingDiesel(this.parentNode.id,this.textContent);"
|
||||
style="padding: 5px;"><?= $row[$column] ?? 'N/A' ?></td>
|
||||
<?php elseif(formatHeader($column) == 'Consumption'): ?>
|
||||
<td class="celda_normal" contenteditable="true" onkeyup="calculateMileage(this.parentNode.id,this.textContent);" style="padding: 5px;"><?= $row[$column] ?? 'N/A' ?></td>
|
||||
<td class="celda_normal" contenteditable="true"
|
||||
onkeyup="calculateMileage(this.parentNode.id,this.textContent);"
|
||||
style="padding: 5px;"><?= $row[$column] ?? 'N/A' ?></td>
|
||||
<?php elseif(formatHeader($column) == 'Running Hours'): ?>
|
||||
<td class="celda_normal" style="padding: 5px;"><?= $row[$column] ?? 'N/A' ?></td>
|
||||
<td class="celda_normal" style="padding: 5px;">
|
||||
<?= $row[$column] ?? 'N/A' ?></td>
|
||||
<?php elseif(formatHeader($column) == 'Mileage'): ?>
|
||||
<td class="celda_normal" style="padding: 5px;"><?= $row[$column] ?? 'N/A' ?></td>
|
||||
<td class="celda_normal" style="padding: 5px;">
|
||||
<?= $row[$column] ?? 'N/A' ?></td>
|
||||
<?php elseif(formatHeader($column) == 'Opening Stock'): ?>
|
||||
<td class="celda_normal" <?= ($key == 0) ? 'contenteditable="true"' : ''; ?> style="padding: 5px;"><?= $row[$column] ?? 'N/A' ?></td>
|
||||
<td class="celda_normal"
|
||||
<?= ($key == 0) ? 'contenteditable="true"' : ''; ?>
|
||||
style="padding: 5px;"><?= $row[$column] ?? 'N/A' ?></td>
|
||||
<?php elseif(formatHeader($column) == 'Purchase Diesel'): ?>
|
||||
<td class="celda_normal" contenteditable="true" onkeyup="calculateBalanceStock(this.parentNode.id,this.textContent);" style="padding: 5px;"><?= $row[$column] ?? 'N/A' ?></td>
|
||||
<td class="celda_normal" contenteditable="true"
|
||||
onkeyup="calculateBalanceStock(this.parentNode.id,this.textContent);"
|
||||
style="padding: 5px;"><?= $row[$column] ?? 'N/A' ?></td>
|
||||
<?php else : ?>
|
||||
<td class="celda_normal" style="padding: 5px;"><?= $row[$column] ?? 'N/A' ?></td>
|
||||
<td class="celda_normal" style="padding: 5px;">
|
||||
<?= $row[$column] ?? 'N/A' ?></td>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php endforeach; ?>
|
||||
@ -324,10 +417,7 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
|
||||
$(document).ready(function()
|
||||
{
|
||||
$(document).ready(function() {
|
||||
$('#save').click(function() {
|
||||
|
||||
// Get headers from the second <thead> as keys
|
||||
@ -372,12 +462,9 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<script>
|
||||
|
||||
function openingReading(parentId, textContent) {
|
||||
|
||||
|
||||
@ -488,8 +575,74 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
|
||||
}
|
||||
|
||||
|
||||
function navigateToMachine() {
|
||||
$('.close').click();
|
||||
const machineDropdown = document.getElementById('machineDropdown');
|
||||
const dateDropdown = document.getElementById('dateDropdown');
|
||||
const selectedMachine = machineDropdown.value;
|
||||
const selectedDate = dateDropdown.value;
|
||||
|
||||
const table = document.getElementById('dieselMachineTable');
|
||||
const headerCells = table.querySelectorAll('thead tr:nth-child(1) th');
|
||||
const rows = table.querySelectorAll('tbody tr');
|
||||
|
||||
let targetColumnIndex = -1;
|
||||
headerCells.forEach((header, index) => {
|
||||
if (header.getAttribute('data-id') === selectedMachine) {
|
||||
targetColumnIndex = index;
|
||||
}
|
||||
});
|
||||
|
||||
if (targetColumnIndex === -1) {
|
||||
console.log("Machine column not found.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
let targetRow = null;
|
||||
rows.forEach(row => {
|
||||
const dateCell = row.querySelector('td:first-child');
|
||||
if (dateCell && dateCell.textContent.trim() === selectedDate) {
|
||||
targetRow = row;
|
||||
}
|
||||
});
|
||||
|
||||
if (!targetRow) {
|
||||
console.log("Date row not found.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
targetColumnIndex = targetColumnIndex - 2;
|
||||
targetColumnIndex = targetColumnIndex * 6;
|
||||
targetColumnIndex = targetColumnIndex + 5;
|
||||
|
||||
targetRow.cells[targetColumnIndex].scrollIntoView({
|
||||
behavior: 'smooth',
|
||||
inline: 'center',
|
||||
block: 'center'
|
||||
});
|
||||
|
||||
const highlightDuration = 10000;
|
||||
for (let i = targetColumnIndex; i < targetColumnIndex + 6; i++) {
|
||||
const cell = targetRow.cells[i];
|
||||
if (cell) {
|
||||
|
||||
// Scroll the table to ensure the highlighted cell is visible
|
||||
// table.scrollTop = targetRow.offsetTop - table.clientHeight / 2; // Adjust vertical scroll
|
||||
// table.scrollLeft = cell.offsetLeft - table.clientWidth / 2; // Adjust horizontal scroll
|
||||
|
||||
cell.style.transition = "background-color 0.5s";
|
||||
cell.style.backgroundColor = "#df9675";
|
||||
|
||||
setTimeout(() => {
|
||||
cell.style.backgroundColor = "";
|
||||
}, highlightDuration);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user