ria/app/Views/stock/drierMachineDetails.php
2025-05-07 09:46:02 +05:30

1751 lines
79 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
$datefordropdown = format_date($datefordropdown, 0, 'M-Y');
?>
<style type="text/css">
.num {
text-align: right;
}
.batch-card-table th,
.batch-card-table td {
text-align: center;
vertical-align: middle;
border: 1px solid black;
}
.batch-card-table-cell-space {
padding: 5px;
}
input[type="date"]::-webkit-calendar-picker-indicator {
transform: scale(2.0);
cursor: pointer;
}
input[type="date"] {
cursor: pointer;
}
.fht-table,
.fht-table thead,
.fht-table tfoot,
.fht-table tbody,
.fht-table tr,
.fht-table th,
.fht-table td {
margin: 0;
}
.fht-table td {
text-align: center;
}
.fht-table td:hover {
background-color: rgb(170, 222, 167);
color: rgb(2, 2, 2);
transform: scale(1.25);
/* Increases size by 25% */
transition: transform 0.5s ease-in-out;
/* Smooth scaling effect */
}
.fht-table tr:hover {
background-color: rgb(170, 222, 167);
color: rgb(2, 2, 2);
}
.fht-table {
border: 0 none;
height: auto;
width: auto;
border-collapse: collapse;
border-spacing: 0;
/*table-layout: fixed; Algoritmo de distribucion fijo */
white-space: nowrap;
}
.fht-table th,
.fht-table td {
overflow: hidden;
}
.fht-table-wrapper,
.fht-table-wrapper .fht-thead,
.fht-table-wrapper .fht-tfoot,
.fht-table-wrapper .fht-fixed-column .fht-tbody,
.fht-table-wrapper .fht-fixed-body .fht-tbody,
.fht-table-wrapper .fht-tbody {
overflow: hidden;
position: relative;
}
.fht-table-wrapper .fht-fixed-body .fht-tbody,
.fht-table-wrapper .fht-tbody {
overflow: auto;
}
.fht-table-wrapper .fht-table .fht-cell {
overflow: hidden;
height: 1px;
}
.fht-table-wrapper .fht-fixed-column,
.fht-table-wrapper .fht-fixed-body {
top: 0;
left: 0;
position: absolute;
}
.fht-table-wrapper .fht-fixed-column {
z-index: 1;
}
.fht-fixed-body .fht-thead table {
margin-right: 20px;
border: 0 none;
}
/*For Examples*/
.ContenedorTabla {
height: 500px;
margin: 0 auto;
overflow: auto;
width: auto;
position: relative;
}
.header,
.main {
display: inline-block;
height: auto;
width: 100%;
}
.titulosHeader {
border-bottom: 1px solid #e8bb25;
height: auto;
margin-bottom: 10px;
padding-bottom: 8px;
padding-top: 8px;
width: 100%;
}
.celda_encabezado_general {
background-color: rgb(80, 187, 217);
/* blue background */
border: 1px solid #ccc;
color: #ffffff;
font-weight: bold;
padding: 2px 4px;
text-align: center;
min-width: 120px;
max-width: 120px;
white-space: normal;
/* Allows text to wrap */
word-wrap: break-word;
/* Breaks long words if needed */
text-align: center;
/* Centers text for better alignment */
max-width: 150px;
/* Set a max width to control wrapping */
}
.celda_encabezado_total {
background-color: #ffffff;
border: 1px solid white;
color: #ffffff;
font-weight: bold;
padding: 6px 10px;
text-align: center;
min-width: 120px;
max-width: 120px;
}
._Separador {
background-color: #fff;
height: 12px;
border-left: 1px solid #ccc;
border-right: 1px solid #ccc;
width: 7px;
}
._Separador div {
width: 4px;
}
.celda_normal {
/*background-color: #fff;*/
/* <!-- ad9271 into ffffff brown-light to green-light --> */
border: 1px solid #ccc;
padding: 5px 6px;
min-width: 120px;
max-width: 120px;
}
/*style excel*/
.excel_cell {
border: 1px solid #CCC;
color: #222;
text-align: center;
font-size: 13px;
font-weight: normal;
padding: 4px;
white-space: pre-line;
empty-cells: show;
}
._cell_header {
background-color: #EEE;
}
._cell_Default {
background-color: #FFF;
text-align: left;
}
.excel_cell div {
width: 30px;
height: 20px;
}
.fht-table th:nth-child(1),
.fht-table th:nth-child(1) {
position: sticky;
left: 0;
top: 0;
background-color: rgb(80, 187, 217);
/* blue background */
z-index: 7 !important;
border-right: 2px solid #ddd;
color: #ffffff;
}
.fht-table td:nth-child(1) {
position: sticky;
left: 0;
background-color: rgb(80, 187, 217);
/* blue background */
z-index: 2;
border-right: 2px solid #ddd;
color: #ffffff;
}
.table-responsive {
overflow-x: auto;
overflow-y: auto;
max-height: 500px;
max-width: 100%;
position: relative;
}
.fht-table thead th {
position: sticky;
top: 0;
z-index: 5 !important;
}
tfoot tr {
background-color: rgb(235, 236, 203);
}
body[data-layout-mode=horizontal] .container-fluid {
max-width: 100%;
}
.card-body {
padding-top: 10px;
padding-bottom: 0;
}
.card {
margin-bottom: 5px;
}
</style>
<div class="content-page">
<div class="content">
<!-- Start Content-->
<div class="container-fluid">
<!-- start page title -->
<div>
<div class="row">
<div class="col-12">
<div class="page-title-box page-title-box-alt">
<div class="page-title-right">
<ol class="breadcrumb m-0">
<li class="breadcrumb-item"><a href="javascript: void(0);">Stocks</a></li>
<li class="breadcrumb-item active">
<h4 class="page-title">10 Ton Drier Details </h4>
</li>
</ol>
</div>
</div>
</div>
</div>
<?php if (session()->getFlashdata('error')): ?>
<div class="alert alert-danger">
<?= session()->getFlashdata('error'); ?>
</div>
<?php endif; ?>
<?php if (session()->getFlashdata('success')): ?>
<div class="alert alert-success">
<?= session()->getFlashdata('success'); ?>
</div>
<?php endif; ?>
<div class="row">
<div class="col-12">
<div class="card" id="fullscreenDiv">
<div class="card-body">
<form id="changeMonthForm" action="<?= base_url('drierMachineDetails'); ?>" method="post">
<div class="row">
<?php $today = date('M-Y'); ?>
<div class="col-2">
<input type="text" name="month" id="month" value="<?php echo "$datefordropdown" ?>"
class="form-control "
readonly>
</div>
<div class="col-10 text-right d-flex" style="justify-content: end;">
<input type="text" id="searchInput" placeholder="Search..."
class="mt-2"
style="padding: 8px;margin-bottom: 10px;width: 250px;border: 2px solid rgb(123, 11, 214);
border-radius: 5px;margin-right:15px; ">
<i class="fa fa-table btn-lg mt-2"
title="Date Range Filter"
style="font-size: x-large; cursor:pointer; color:rgb(95, 102, 105)"
data-toggle="modal"
data-target="#filterModalId">
</i>
<i class="fa fa-download btn-lg mt-2"
title="Excel Download"
style="font-size: x-large; cursor:pointer; color: #0b7cba"
id="drierMachineDetailsExport">
</i>
<i class="fe-maximize noti-icon btn-lg mt-2"
title="Full Screen"
style="font-size: x-large; cursor:pointer; color:rgb(241, 9, 136)"
onclick="toggleDivFullscreen()">
</i>
<i class="fa fa-plus-circle btn-lg mt-2 auditor-restricted-btn"
title="Add Entry"
data-target="#additionalEntriesModalId"
data-toggle="modal"
style="font-size: x-large; cursor:pointer; color:rgb(31, 132, 3)">
</i>
</div>
</div>
</form>
<!-- modal section -->
<!-- filter modal -->
<div class="modal fade" id="filterModalId" tabindex="-1" role="dialog" aria-labelledby="filterModalLabelId" aria-hidden="true">
<div class="modal-dialog modal-md">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="filterModalLabelId">Filter Options</h4>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
<div class="modal-body">
<div class="row">
<?php
$currentDateInDmY = date('d-m-Y');
?>
<?php
$startDate = DateTime::createFromFormat('M-Y', $datefordropdown);
if ($startDate) {
$startDate->modify('first day of this month');
$daysInMonth = $startDate->format('t');
$dateArray = [];
for ($i = 0; $i < $daysInMonth; $i++) {
$dateArray[] = $startDate->format('d-m-Y');
$startDate->modify('+1 day');
}
} else {
echo "Invalid date format.";
}
?>
<!-- From Date Filter -->
<div class="col-md-6">
<div class="form-group">
<label for="fromDateFilter">Select From Date</label>
<select id="fromDateFilter" name="fromDateFilter" class="form-control select2">
<?php if (!empty($dateArray)) : ?>
<?php foreach ($dateArray as $index => $date) : ?>
<option value="<?= $date ?>"><?= $date ?></option>
<?php endforeach; ?>
<?php endif; ?>
</select>
</div>
</div>
<!-- To Date Filter -->
<div class="col-md-6">
<div class="form-group">
<label for="toDateFilter">Select To Date</label>
<select id="toDateFilter" name="toDateFilter" class="form-control select2">
<?php if (!empty($dateArray)) : ?>
<?php foreach ($dateArray as $date) : ?>
<option value="<?= $date ?>" <?= ($date == $currentDateInDmY) || ($date == $dateArray[9]) ? "selected" : " " ?>><?= $date ?></option>
<?php endforeach; ?>
<?php endif; ?>
</select>
</div>
</div>
</div>
<button type="button" class="btn btn-primary float-right" onclick="customFilterDate()">Filter</button>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div>
<!-- additional entries modal -->
<div class="modal fade" id="additionalEntriesModalId" tabindex="-1" role="dialog" aria-labelledby="additionalEntriesIdModalLabelId" aria-hidden="true">
<div class="modal-dialog modal-xl" style="width:1000px;">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="additionalEntriesIdModalLabelId">Add Entry</h4>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
<div class="modal-body">
<form id="additionalEntriesForm" action="<?php echo base_url("/addOrEditdrierMachineDetails") ?>" method="POST">
<!--first row -->
<?php $calendarStartDate = DateTime::createFromFormat('M-Y', $datefordropdown)->modify('first day of this month')->format('Y-m-d'); ?>
<?php $calendarEndDate = DateTime::createFromFormat('M-Y', $datefordropdown)->modify('last day of this month')->format('Y-m-d'); ?>
<?php $calendarCurrentDate = DateTime::createFromFormat('M-Y', $datefordropdown)->format('Y-m-d'); ?>
<div class="row">
<div class="col-md-3">
<label class="form" for="additionalEntryDateId">Date</label>
<span class="text-danger">*</span>
<input type="date" class="form-control" id="additionalEntryDateId" name="date" value="<?= $calendarCurrentDate ?>"
min="<?= $calendarStartDate ?>" max="<?= $calendarEndDate ?>" required>
</div>
<div class="col-md-3">
<label class="form" for="additionalEntryDrierOnTimeId">Drier On Time</label>
<span class="text-danger">*</span>
<select onchange="calculateMachineRunningHrs()" required
class="timeDropdown select2" style="width: 100px;"
id="additionalEntryDrierOnTimeId" name="drier_on_time">
<option value="">Select</option>
<?php foreach ($timeDropdown as $key => $time) { ?>
<option value="<?= $time; ?>"> <?= $time; ?></option>
<?php } ?>
</select>
</div>
<div class="col-md-3">
<label class="form" for="additionalEntryDrierOffTimeId">Drier Off Time</label>
<span class="text-danger">*</span>
<select onchange="calculateMachineRunningHrs()" required
class="timeDropdown select2" style="width: 100px;"
id="additionalEntryDrierOffTimeId" name="drier_off_time">
<option value="">Select</option>
<?php foreach ($timeDropdown as $key => $time) { ?>
<option value="<?= $time; ?>"> <?= $time; ?></option>
<?php } ?>
</select>
</div>
<div class="col-md-3">
<label class="form" for="additionalEntryRunningHrsId">Running hrs</label>
<input type="text" class="form-control" id="additionalEntryRunningHrsId" name="drier_running_hours" value=""
readonly>
</div>
</div>
<!-- second row -->
<div class="row mt-2">
<!-- supplier name -->
<div class="col-md-3">
<label class="form" for="additionalEntrySupplierNameId">Supplier Name</label>
<span class="text-danger">*</span>
<select class="timeDropdown supplier_name select2" style="width: 300px;" required
id="additionalEntrySupplierNameId" name="supplier_name">
<option value="">Select</option>
<?php foreach ($supplierData as $key => $value) { ?>
<option value="<?= $value->SupplierID; ?>"> <?= $value->SupplierName; ?> </option>
<?php } ?>
</select>
</div>
<!-- input sand qty -->
<div class="col-md-3">
<label class="form" for="additionalEntryInputSandQtyId">Input Sand Qty(Metric Ton)</label>
<span class="text-danger">*</span>
<input onchange="additionalEntryGasPerTon(); additionalEntryMoistureLossQty(); additionalEntryQtyPerHrs(); "
type="text" class="form-control" id="additionalEntryInputSandQtyId" name="input_sand_qty" value="" required>
</div>
<!-- input sand moisture -->
<div class="col-md-3">
<label class="form" for="additionalEntryInputSandMoistureId">Input Sand Moisture (%)</label>
<span class="text-danger">*</span>
<input type="text" class="form-control" id="additionalEntryInputSandMoistureId" name="input_sand_moisture" value=""
onchange="additionalEntryInputSandMoisture();"
required>
</div>
<!-- sand dried qty -->
<div class="col-md-3">
<label class="form" for="additionalEntrySandDriedQtyId">Sand Dried Qty (Metric Ton)</label>
<span class="text-danger">*</span>
<input onchange="additionalEntryGasPerTon(); additionalEntryMoistureLossQty(); additionalEntryQtyPerHrs(); "
type="text" class="form-control" id="additionalEntrySandDriedQtyId" name="sand_dried_qty" value="" required>
</div>
</div>
<!-- third row -->
<div class="row mt-2">
<!-- total gas consumption -->
<div class="col-md-3">
<label class="form" for="additionalEntryTotalGasConsumptionId">Total Gas Consumption</label>
<span class="text-danger">*</span>
<input onchange="additionalEntryGasPerTon(); additionalEntryMoistureLossQty(); additionalEntryQtyPerHrs(); "
type="text" class="form-control" id="additionalEntryTotalGasConsumptionId" name="total_gas_consumption" value="" required>
</div>
<!-- gas per ton -->
<div class="col-md-3">
<label class="form" for="additionalEntryGasPerTonId">Gas / Ton</label>
<input type="text" class="form-control" id="additionalEntryGasPerTonId" name="gas_per_ton" value="" required
readonly>
</div>
<!-- qty per hours -->
<div class="col-md-3">
<label class="form" for="additionalEntryQtyPerHoursId">Qty / Hours</label>
<input type="text" class="form-control" id="additionalEntryQtyPerHoursId" name="qty_per_hours" value="" required
readonly>
</div>
<!-- moisture loss qty -->
<div class="col-md-3">
<label class="form" for="additionalEntryMoistureLossQtyId">Moisture Loss Qty (Metric Ton)</label>
<input type="text" class="form-control" id="additionalEntryMoistureLossQtyId" name="moisture_loss_qty" value="" required
readonly>
</div>
</div>
<!-- fourth row -->
<div class="row mt-2">
<!-- dust qty -->
<div class="col-md-3">
<label class="form" for="additionalEntryDustQtyId">Dust Qty (Kgs)</label>
<span class="text-danger">*</span>
<input type="text" class="form-control" id="additionalEntryDustQtyId" name="dust_qty" value=""
onchange="additionalEntryDustQty();"
required>
</div>
<!-- customer name -->
<div class="col-md-3">
<label class="form" for="additionalEntryCustomerNameId">Customer Name</label>
<span class="text-danger">*</span>
<input type="text" class="form-control" id="additionalEntryCustomerNameId" name="customer_name" value="" required>
</div>
</div>
<button type="submit" class="btn btn-primary float-right submit-btn">Add</button>
<!-- hidden fields -->
</form>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div>
<!-- edit drier entry modal -->
<div class="modal fade" id="editEntriesModalId" tabindex="-1" role="dialog" aria-labelledby="editEntriesIdModalLabelId" aria-hidden="true">
<div class="modal-dialog modal-xl" style="width:1000px;">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="editEntriesIdModalLabelId">Edit Drier Entry</h4>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
<div class="modal-body">
<form id="editEntriesForm" action="<?php echo base_url("/addOrEditdrierMachineDetails") ?>" method="POST">
<!--first row -->
<?php $calendarStartDate = DateTime::createFromFormat('M-Y', $datefordropdown)->modify('first day of this month')->format('Y-m-d'); ?>
<?php $calendarEndDate = DateTime::createFromFormat('M-Y', $datefordropdown)->modify('last day of this month')->format('Y-m-d'); ?>
<div class="row">
<div class="col-md-3">
<label class="form" for="editEntryDateId">Date</label>
<span class="text-danger">*</span>
<input type="date" class="form-control" id="editEntryDateId" name="date" value=""
required readonly>
</div>
<div class="col-md-3">
<label class="form" for="editEntryDrierOnTimeId">Drier On Time</label>
<span class="text-danger">*</span>
<select onchange="editEntryCalculateMachineRunningHrs()" required
class="timeDropdown select2" style="width: 100px;"
id="editEntryDrierOnTimeId" name="drier_on_time">
<option value="">Select</option>
<?php foreach ($timeDropdown as $key => $time) { ?>
<option value="<?= $time; ?>"> <?= $time; ?></option>
<?php } ?>
</select>
</div>
<div class="col-md-3">
<label class="form" for="editEntryDrierOffTimeId">Drier Off Time</label>
<span class="text-danger">*</span>
<select onchange="editEntryCalculateMachineRunningHrs()" required
class="timeDropdown select2" style="width: 100px;"
id="editEntryDrierOffTimeId" name="drier_off_time">
<option value="">Select</option>
<?php foreach ($timeDropdown as $key => $time) { ?>
<option value="<?= $time; ?>"> <?= $time; ?></option>
<?php } ?>
</select>
</div>
<div class="col-md-3">
<label class="form" for="editEntryRunningHrsId">Running hrs</label>
<input type="text" class="form-control" id="editEntryRunningHrsId" name="drier_running_hours" value=""
readonly>
</div>
</div>
<!-- second row -->
<div class="row mt-2">
<!-- supplier name -->
<div class="col-md-3">
<label class="form" for="editEntrySupplierNameId">Supplier Name</label>
<span class="text-danger">*</span>
<select class="timeDropdown supplier_name select2" style="width: 300px;" required
id="editEntrySupplierNameId" name="supplier_name" value="">
<option value="">Select</option>
<?php foreach ($supplierData as $key => $value) { ?>
<option value="<?= $value->SupplierID; ?>"> <?= $value->SupplierName; ?> </option>
<?php } ?>
</select>
</div>
<!-- input sand qty -->
<div class="col-md-3">
<label class="form" for="editEntryInputSandQtyId">Input Sand Qty(Metric Ton)</label>
<span class="text-danger">*</span>
<input onchange="editEntryGasPerTon(); editEntryMoistureLossQty(); editEntryQtyPerHrs(); "
type="text" class="form-control" id="editEntryInputSandQtyId" name="input_sand_qty" value="" required>
</div>
<!-- input sand moisture -->
<div class="col-md-3">
<label class="form" for="editEntryInputSandMoistureId">Input Sand Moisture (%)</label>
<span class="text-danger">*</span>
<input type="text" class="form-control" id="editEntryInputSandMoistureId" name="input_sand_moisture" value=""
onchange="editEntryInputSandMoisture();"
required>
</div>
<!-- sand dried qty -->
<div class="col-md-3">
<label class="form" for="editEntrySandDriedQtyId">Sand Dried Qty (Metric Ton)</label>
<span class="text-danger">*</span>
<input onchange="editEntryGasPerTon(); editEntryMoistureLossQty(); editEntryQtyPerHrs(); "
type="text" class="form-control" id="editEntrySandDriedQtyId" name="sand_dried_qty" value="" required>
</div>
</div>
<!-- third row -->
<div class="row mt-2">
<!-- total gas consumption -->
<div class="col-md-3">
<label class="form" for="editEntryTotalGasConsumptionId">Total Gas Consumption</label>
<span class="text-danger">*</span>
<input onchange="editEntryGasPerTon(); editEntryMoistureLossQty(); editEntryQtyPerHrs(); "
type="text" class="form-control" id="editEntryTotalGasConsumptionId" name="total_gas_consumption" value="" required>
</div>
<!-- gas per ton -->
<div class="col-md-3">
<label class="form" for="editEntryGasPerTonId">Gas / Ton</label>
<input type="text" class="form-control" id="editEntryGasPerTonId" name="gas_per_ton" value=""
readonly>
</div>
<!-- qty per hours -->
<div class="col-md-3">
<label class="form" for="editEntryQtyPerHoursId">Qty / Hours</label>
<input type="text" class="form-control" id="editEntryQtyPerHoursId" name="qty_per_hours" value=""
readonly>
</div>
<!-- moisture loss qty -->
<div class="col-md-3">
<label class="form" for="editEntryMoistureLossQtyId">Moisture Loss Qty (Metric Ton)</label>
<input type="text" class="form-control" id="editEntryMoistureLossQtyId" name="moisture_loss_qty" value=""
readonly>
</div>
</div>
<!-- fourth row -->
<div class="row mt-2">
<!-- dust qty -->
<div class="col-md-3">
<label class="form" for="editEntryDustQtyId">Dust Qty (Kgs)</label>
<span class="text-danger">*</span>
<input type="text" class="form-control" id="editEntryDustQtyId" name="dust_qty" value=""
onchange="editEntryDustQty();"
required>
</div>
<!-- customer name -->
<div class="col-md-3">
<label class="form" for="editEntryCustomerNameId">Customer Name</label>
<span class="text-danger">*</span>
<input type="text" class="form-control" id="editEntryCustomerNameId" name="customer_name" value="" required>
</div>
</div>
<button type="submit" class="btn btn-primary float-right submit-btn auditor-restricted-btn">Update</button>
<!-- hidden fields -->
<input type="hidden" class="form-control" id="editEntryId" name="id" value="">
</form>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div>
<!-- /.modal -->
<!-- Add table-responsive for horizontal scroll -->
<div class="table-responsive" id="table-responsive">
<table id="drierTable" class="fht-table " style="background-color:#fff;">
<thead>
<tr>
<th class="celda_encabezado_general">Date</th>
<th class="celda_encabezado_general">Drier On Time</th>
<th class="celda_encabezado_general">Drier Off Time</th>
<th class="celda_encabezado_general">Running Hrs</th>
<th class="celda_encabezado_general">Supplier Name</th>
<th class="celda_encabezado_general">Input Sand Qty (Metric Ton)</th>
<th class="celda_encabezado_general">Input Sand Moisture(%)</th>
<th class="celda_encabezado_general">Sand Dried Qty (Metric Ton)</th>
<th class="celda_encabezado_general">Total Gas Consumption</th>
<th class="celda_encabezado_general">Gas Per Ton</th>
<th class="celda_encabezado_general">Qty Per Hrs (Metric Ton)</th>
<th class="celda_encabezado_general">Moisture Loss Qty (Metric Ton)</th>
<th class="celda_encabezado_general">Dust Qty (Kgs)</th>
<th class="celda_encabezado_general" align="left">Customer Name</th>
<th class="celda_encabezado_general" style="display:none;">id</th>
<th class="celda_encabezado_general"> Action</th>
</tr>
</thead>
<?php if (!empty($drierDetails)) { ?>
<tbody style="background-color: #fff;">
<?php
$row = 0;
foreach ($drierDetails as $a) {
$row++; ?>
<tr id="<?php echo $row; ?>"
<?php
//current date highlighter
$date = DateTime::createFromFormat('Y-m-d', $a['date'])->format('Y-m-d');
$currentDate = date('Y-m-d');
if ($date === $currentDate) {
echo 'style="background: #cef0ad;"';
}
?>
<?php
// formatting date from ymd to customer picked dmy format
$formattedDate = DateTime::createFromFormat('Y-m-d', $a['date'])->format('d-m-Y');
?>>
<!-- tr opening tag finished -->
<!-- td:eq(0) date -->
<td class="celda_normal">
<?php echo $formattedDate; ?>
</td>
<!-- td:eq(1) drier on time -->
<td class="celda_normal">
<?= $a['drier_on_time'] ?>
</td>
<!-- td:eq(2) drier off time -->
<td class="celda_normal">
<?= $a['drier_off_time'] ?>
</td>
<!-- td:eq(3) drier_running_hours-->
<td class="celda_normal">
<?php echo $a['drier_running_hours']; ?>
</td>
<!-- td:eq(4) supplier_name -->
<td class="celda_normal">
<?php foreach ($supplierData as $key => $value) {
if ($a['supplier_name'] == $value->SupplierID) {
echo $value->SupplierName;
}
} ?>
</td>
<!-- td:eq(5) input_sand_qty -->
<td class="celda_normal">
<?php echo (int)$a['input_sand_qty']; ?>
</td>
<!-- td:eq(6) input_sand_moisture -->
<td class="celda_normal">
<?php echo $a['input_sand_moisture']; ?>
</td>
<!-- td:eq(7) sand_dried_qty -->
<td class="celda_normal">
<?php echo round($a['sand_dried_qty']); ?>
</td>
<!-- td:eq(8) total_gas_consumption -->
<td class="celda_normal">
<?php echo round($a['total_gas_consumption']); ?>
</td>
<!-- td:eq(9) gas_per_ton -->
<td class="celda_normal">
<?php echo $a['gas_per_ton']; ?>
</td>
<!-- td:eq(10) qty_per_hours -->
<td class="celda_normal">
<?php echo $a['qty_per_hours']; ?>
</td>
<!-- td:eq(11) moisture_loss_qty -->
<td class="celda_normal">
<?php echo (int)$a['moisture_loss_qty']; ?>
</td>
<!-- td:eq(12) dust_qty -->
<td class="celda_normal">
<?php echo (int)$a['dust_qty']; ?>
</td>
<!-- td:eq(13) customer_name -->
<td class="celda_normal" style="text-align: left !important;">
<?php echo $a['customer_name']; ?>
</td>
<!-- td:eq(14) id -->
<td class="celda_normal" style="display:none;">
<?php echo $a['id'] ?? ''; ?>
</td>
<!-- td:eq(15) edit -->
<td class="celda_normal">
<a type="button" class="edit-btn">
<i class="fa fa-edit"></i>
</a>
</td>
<!-- td:eq(16) supplier id -->
<td class="celda_normal" style="display:none;">
<?php echo $a['supplier_name'] ?? ''; ?>
</td>
</tr>
<?php
//before closing inner loop
if (!isset($summary['drier_running_hours'])) {
$summary['drier_running_hours'] = 0;
$summary['total_gas_consumption'] = 0;
$summary['input_sand_qty'] = 0;
$summary['moisture_loss_qty'] = 0;
$summary['sand_dried_qty'] = 0;
$summary['dust_qty'] = 0;
}
$summary['drier_running_hours'] += $a['drier_running_hours'] == "-" ? 0 : (float) $a['drier_running_hours'];
$summary['total_gas_consumption'] += $a['total_gas_consumption'] == "-" ? 0 : (float) $a['total_gas_consumption'];
$summary['input_sand_qty'] += $a['input_sand_qty'] == "-" ? 0 : (float) $a['input_sand_qty'];
$summary['moisture_loss_qty'] += $a['moisture_loss_qty'] == "-" ? 0 : (float) $a['moisture_loss_qty'];
$summary['sand_dried_qty'] += $a['sand_dried_qty'] == "-" ? 0 : (float) $a['sand_dried_qty'];
$summary['gas_per_ton'] = number_format(($summary['total_gas_consumption'] / $summary['sand_dried_qty']), 2);
$summary['qty_per_hrs'] = number_format(($summary['sand_dried_qty'] / $summary['drier_running_hours']), 2);
$summary['dust_qty'] += $a['dust_qty'] == "-" ? 0 : (float) $a['dust_qty'];
} ?>
</tbody>
<tfoot>
<tr>
<td style="background-color:rgb(189, 9, 6); color:#ffff;">
<b> Total </b>
</td>
<td class="celda_normal ">-</td>
<td class="celda_normal ">-</td>
<td class="celda_normal "><?= $summary['drier_running_hours'] ?></td>
<td class="celda_normal ">-</td>
<td class="celda_normal "><?= $summary['input_sand_qty'] ?></td>
<td class="celda_normal ">-</td>
<td class="celda_normal "><?= $summary['sand_dried_qty'] ?></td>
<td class="celda_normal "><?= $summary['total_gas_consumption'] ?></td>
<td class="celda_normal "><?= $summary['gas_per_ton']?>(A)</td>
<td class="celda_normal "><?= $summary['qty_per_hrs']?>(A)</td>
<td class="celda_normal "><?= $summary['moisture_loss_qty'] ?></td>
<td class="celda_normal "><?= $summary['dust_qty'] ?></td>
</tr>
</tfoot>
<?php } ?>
</table>
<?php if (empty($drierDetails)) { ?>
<br><br>
<div align="center">
<p>
<h4 style="color:grey;">No Drier machine details present for this month..!!</h4>
</p>
</div>
<?php }else{?>
<br>
<p align="center">Note :- (A) -> Average</p>
<?php } ?>
</div><!-- End table-responsive -->
</div>
</div> <!-- End card-body -->
</div> <!-- End card -->
</div> <!-- End col -->
</div> <!-- End row -->
</div>
</div> <!-- End container-fluid -->
</div>
</div>
<!-- script section starts -->
<!-- totally removing -->
<script type="text/javascript">
$(document).ready(function() {
$('.timeDropdown').select2({
placeholder: "Select",
});
});
</script>
<script>
$('#drierTable tbody').on('click', '.edit-btn', function() {
let row = $(this).closest('tr');
// Get values from the row
let dateText = row.find('td:eq(0)').text().trim();
let dateParts = dateText.split('-');
let date = (dateParts.length === 3) ? `${dateParts[2]}-${dateParts[1]}-${dateParts[0]}` : '';
let drierOnTime = row.find('td:eq(1)').text().trim();
let drierOffTime = row.find('td:eq(2)').text().trim();
let drierRunningHrs = row.find('td:eq(3)').text().trim();
let supplierName = row.find('td:eq(16)').text().trim();
let inputSandQty = row.find('td:eq(5)').text().trim();
let inputSandMoisture = row.find('td:eq(6)').text().trim();
let sandDriedQty = row.find('td:eq(7)').text().trim();
let totalGasConsumption = row.find('td:eq(8)').text().trim();
let gasPerTon = row.find('td:eq(9)').text().trim();
let qtyPerHour = row.find('td:eq(10)').text().trim();
let moistureLossQty = row.find('td:eq(11)').text().trim();
let dustQty = row.find('td:eq(12)').text().trim();
let customerName = row.find('td:eq(13)').text().trim();
let id = row.find('td:eq(14)').text().trim();
// Debugging - Check if values are retrieved correctly
console.log({
date,
drierOnTime,
drierOffTime,
drierRunningHrs,
supplierName,
inputSandQty,
inputSandMoisture,
sandDriedQty,
totalGasConsumption,
gasPerTon,
qtyPerHour,
moistureLossQty,
dustQty,
customerName
});
// Set values in modal fields
$('#editEntryDateId').val(date);
$('#editEntryDrierOnTimeId').val(drierOnTime).change();
$('#editEntryDrierOffTimeId').val(drierOffTime).change();
$('#editEntryRunningHrsId').val(drierRunningHrs);
$('#editEntrySupplierNameId').val(supplierName).change();
$('#editEntryInputSandQtyId').val(inputSandQty);
$('#editEntryInputSandMoistureId').val(inputSandMoisture);
$('#editEntrySandDriedQtyId').val(sandDriedQty);
$('#editEntryTotalGasConsumptionId').val(totalGasConsumption);
$('#editEntryGasPerTonId').val(gasPerTon);
$('#editEntryQtyPerHoursId').val(qtyPerHour);
$('#editEntryMoistureLossQtyId').val(moistureLossQty);
$('#editEntryDustQtyId').val(dustQty);
$('#editEntryCustomerNameId').val(customerName);
$('#editEntryId').val(id);
// Show modal
$('#editEntriesModalId').modal('show');
});
</script>
<!-- partially removing -->
<script>
function convertTo24Hour(time) {
const [timePart, modifier] = time.split(" ");
let [hours, minutes] = timePart.split(":");
// Convert hours to a number
hours = parseInt(hours, 10);
// Adjust hours based on AM/PM
if (modifier === "PM" && hours < 12) {
hours += 12;
} else if (modifier === "AM" && hours === 12) {
hours = 0;
}
return `${String(hours).padStart(2, '0')}:${minutes}`;
}
// time diff finding script end
function calculateMachineRunningHrs() {
let dreierMachineOnTime = $('#additionalEntryDrierOnTimeId').val();
let dreierMachineOffTime = $('#additionalEntryDrierOffTimeId').val();
if (dreierMachineOnTime == dreierMachineOffTime) {
$('#additionalEntryRunningHrsId').val(24.00);
additionalEntryGasPerTon();
additionalEntryMoistureLossQty();
additionalEntryQtyPerHrs();
return;
}
if (dreierMachineOnTime != '' && dreierMachineOffTime != '') {
const startDate = new Date(`1970-01-01T${convertTo24Hour(dreierMachineOnTime)}`);
const endDate = new Date(`1970-01-01T${convertTo24Hour(dreierMachineOffTime)}`);
// Handle the case where end time is on the next day
if (endDate < startDate) {
endDate.setDate(endDate.getDate() + 1);
}
// Calculate the difference in milliseconds
const diffInMs = endDate - startDate;
// Convert milliseconds to hours and minutes
const hours = Math.floor(diffInMs / (1000 * 60 * 60));
const minutes = Math.floor((diffInMs % (1000 * 60 * 60)) / (1000 * 60));
const totalHours = hours + (minutes / 60);
console.log('working here', 'totalHours', totalHours);
if (totalHours != NaN && totalHours != Infinity) {
$('#additionalEntryRunningHrsId').val(totalHours);
additionalEntryGasPerTon();
additionalEntryMoistureLossQty();
additionalEntryQtyPerHrs();
}
}
}
function additionalEntryGasPerTon() {
let totalGasConsumption = $('#additionalEntryTotalGasConsumptionId').val();
let sandDriedQty = $('#additionalEntrySandDriedQtyId').val();
let basicCheck = checkIsNumber(totalGasConsumption);
let basicCheck2 = checkIsNumber(sandDriedQty);
if (basicCheck == 0) {
alert("Kindly Enter Numbers only..!!");
}
if (basicCheck2 == 0) {
alert("Kindly Enter Numbers only..!!");
}
if (totalGasConsumption != '' && sandDriedQty != '') {
let gasPerTon = (parseFloat(totalGasConsumption) / parseFloat(sandDriedQty)).toFixed(2);
if (gasPerTon && gasPerTon != NaN && gasPerTon != Infinity)
$('#additionalEntryGasPerTonId').val(gasPerTon);
}
}
function additionalEntryMoistureLossQty(value) {
let inputSandQty = $('#additionalEntryInputSandQtyId').val();
let sandDriedQty = $('#additionalEntrySandDriedQtyId').val();
let basicCheck = checkIsNumber(inputSandQty);
let basicCheck2 = checkIsNumber(sandDriedQty);
if (basicCheck == 0) {
alert("Kindly Enter Numbers only..!!");
}
if (basicCheck2 == 0) {
alert("Kindly Enter Numbers only..!!");
}
if (inputSandQty != '' && sandDriedQty != '') {
let moistureLossQty = parseFloat(inputSandQty) - parseFloat(sandDriedQty);
if (moistureLossQty != NaN && moistureLossQty != Infinity)
$('#additionalEntryMoistureLossQtyId').val(moistureLossQty);
}
}
function additionalEntryQtyPerHrs(value) {
let drierRunninhHrs = $('#additionalEntryRunningHrsId').val();
let sandDriedQty = $('#additionalEntrySandDriedQtyId').val();
let basicCheck = checkIsNumber(drierRunninhHrs);
let basicCheck2 = checkIsNumber(sandDriedQty);
if (basicCheck == 0) {
alert("Kindly Enter Numbers only..!!");
}
if (basicCheck2 == 0) {
alert("Kindly Enter Numbers only..!!");
}
if (drierRunninhHrs != '' && sandDriedQty != '') {
let qtyPerHrs = parseFloat(sandDriedQty) / parseFloat(drierRunninhHrs);
if (qtyPerHrs && qtyPerHrs != NaN && qtyPerHrs != Infinity)
$('#additionalEntryQtyPerHoursId').val((qtyPerHrs.toFixed(2)));
}
}
function additionalEntryInputSandMoisture(value) {
let sandMoisture = $('#additionalEntryInputSandMoistureId').val();
let basicCheck = checkIsNumber(sandMoisture);
if (basicCheck == 0) {
alert("Kindly Enter Numbers only..!!");
}
}
function additionalEntryDustQty(value) {
let dustQty = $('#additionalEntryDustQtyId').val();
let basicCheck = checkIsNumber(dustQty);
if (basicCheck == 0) {
alert("Kindly Enter Numbers only..!!");
}
}
// this for edit entry in ten ton f=drier
function editEntryCalculateMachineRunningHrs() {
let dreierMachineOnTime = $('#editEntryDrierOnTimeId').val();
let dreierMachineOffTime = $('#editEntryDrierOffTimeId').val();
if (dreierMachineOnTime == dreierMachineOffTime) {
$('#editEntryRunningHrsId').val(24.00);
editEntryGasPerTon();
editEntryMoistureLossQty();
editEntryQtyPerHrs();
return;
}
if (dreierMachineOnTime != '' && dreierMachineOffTime != '') {
const startDate = new Date(`1970-01-01T${convertTo24Hour(dreierMachineOnTime)}`);
const endDate = new Date(`1970-01-01T${convertTo24Hour(dreierMachineOffTime)}`);
// Handle the case where end time is on the next day
if (endDate < startDate) {
endDate.setDate(endDate.getDate() + 1);
}
// Calculate the difference in milliseconds
const diffInMs = endDate - startDate;
// Convert milliseconds to hours and minutes
const hours = Math.floor(diffInMs / (1000 * 60 * 60));
const minutes = Math.floor((diffInMs % (1000 * 60 * 60)) / (1000 * 60));
const totalHours = hours + (minutes / 60);
console.log('working here', 'totalHours', totalHours);
if (totalHours != NaN && totalHours != Infinity) {
$('#editEntryRunningHrsId').val(totalHours);
editEntryGasPerTon();
editEntryMoistureLossQty();
editEntryQtyPerHrs();
}
}
}
function editEntryGasPerTon() {
let totalGasConsumption = $('#editEntryTotalGasConsumptionId').val();
let sandDriedQty = $('#editEntrySandDriedQtyId').val();
let basicCheck = checkIsNumber(totalGasConsumption);
let basicCheck2 = checkIsNumber(sandDriedQty);
if (basicCheck == 0) {
alert("Kindly Enter Numbers only..!!");
}
if (basicCheck2 == 0) {
alert("Kindly Enter Numbers only..!!");
}
if (totalGasConsumption != '' && sandDriedQty != '') {
let gasPerTon = (parseFloat(totalGasConsumption) / parseFloat(sandDriedQty)).toFixed(2);
if (gasPerTon && gasPerTon != NaN && gasPerTon != Infinity)
$('#editEntryGasPerTonId').val(gasPerTon);
}
}
function editEntryMoistureLossQty(value) {
let inputSandQty = $('#editEntryInputSandQtyId').val();
let sandDriedQty = $('#editEntrySandDriedQtyId').val();
let basicCheck = checkIsNumber(inputSandQty);
let basicCheck2 = checkIsNumber(sandDriedQty);
if (basicCheck == 0) {
alert("Kindly Enter Numbers only..!!");
}
if (basicCheck2 == 0) {
alert("Kindly Enter Numbers only..!!");
}
if (inputSandQty != '' && sandDriedQty != '') {
let moistureLossQty = parseFloat(inputSandQty) - parseFloat(sandDriedQty);
if (moistureLossQty != NaN && moistureLossQty != Infinity)
$('#editEntryMoistureLossQtyId').val(moistureLossQty);
}
}
function editEntryQtyPerHrs(value) {
let drierRunninhHrs = $('#editEntryRunningHrsId').val();
let sandDriedQty = $('#editEntrySandDriedQtyId').val();
let basicCheck = checkIsNumber(drierRunninhHrs);
let basicCheck2 = checkIsNumber(sandDriedQty);
if (basicCheck == 0) {
alert("Kindly Enter Numbers only..!!");
}
if (basicCheck2 == 0) {
alert("Kindly Enter Numbers only..!!");
}
if (drierRunninhHrs != '' && sandDriedQty != '') {
let qtyPerHrs = parseFloat(sandDriedQty) / parseFloat(drierRunninhHrs);
if (qtyPerHrs && qtyPerHrs != NaN && qtyPerHrs != Infinity)
$('#editEntryQtyPerHoursId').val((qtyPerHrs.toFixed(2)));
}
}
function editEntryInputSandMoisture(value) {
let sandMoisture = $('#editEntryInputSandMoistureId').val();
let basicCheck = checkIsNumber(sandMoisture);
if (basicCheck == 0) {
alert("Kindly Enter Numbers only..!!");
}
}
function editEntryDustQty(value) {
let dustQty = $('#editEntryDustQtyId').val();
let basicCheck = checkIsNumber(dustQty);
if (basicCheck == 0) {
alert("Kindly Enter Numbers only..!!");
}
}
function checkIsNumber(input) {
const isValid = /^-?\d*\.?\d*$/.test(input);
if (!isValid) {
return 0;
}
}
</script>
<!-- date filter optiond -->
<script>
function customFilterDate() {
let fromDate = $('#fromDateFilter').val(); //01-12-2024
let toDate = $('#toDateFilter').val(); //05-12-2024
$('#drierTable').find('tbody tr').each(function() {
const rowCells = $(this).find('td');
let tableDate = rowCells.eq(0).text();
let result = checkDateRange(fromDate, toDate, tableDate);
if (result) {
$(this).show();
} else {
$(this).hide();
}
});
$('#filterModalId').modal('hide');
}
function checkDateRange(fromDate, toDate, tableDate) {
// Convert the dates to a comparable format (YYYY-MM-DD)
let from = convertToDate(fromDate);
let to = convertToDate(toDate);
let table = convertToDate(tableDate);
// Return true if the table date is within the range
return table >= from && table <= to;
}
function convertToDate(dateString) {
// Convert from DD-MM-YYYY to YYYY-MM-DD for comparison
let parts = dateString.split('-');
return new Date(parts[2], parts[1] - 1, parts[0]); // Year, Month (0-based), Day
}
</script>
<script>
$(document).ready(function() {
$('#fromDateFilter ').select2();
$('#toDateFilter ').select2();
});
</script>
<!-- excel export -->
<script>
$(document).ready(function() {
function exportTableToExcel(tableID, filename = '') {
let table = document.getElementById(tableID);
let rows = [];
// Extract table data row-by-row
$(table).find('tr').each(function() {
let rowData = [];
$(this).find('th, td').each(function() {
// Skip hidden columns
if ($(this).css('display') === 'none') return;
let cellText = $(this).text().trim();
rowData.push(cellText);
});
// Add the cleaned row only if it has data
if (rowData.length > 0) {
rows.push(rowData);
}
});
// Create a worksheet from array (no DOM needed!)
let ws = XLSX.utils.aoa_to_sheet(rows);
// Calculate max column count from the collected rows
let colCount = 0;
rows.forEach(row => {
if (row.length > colCount) colCount = row.length;
});
// Set custom column widths (10 for each column)
const wscols = [];
for (let i = 0; i < colCount; i++) {
wscols.push({ wch: 10 });
}
ws['!cols'] = wscols;
// Create workbook and export
let wb = XLSX.utils.book_new();
XLSX.utils.book_append_sheet(wb, ws, 'Sheet1');
XLSX.writeFile(wb, filename || 'export.xlsx');
}
let tableId = 'drierTable';
document.getElementById('drierMachineDetailsExport').addEventListener('click', function() {
exportTableToExcel(tableId, 'drierMachineDetails_<?= $datefordropdown ?>.xlsx');
});
});
</script>
<!-- script section ends -->
<!-- onchange of month submit will happen -->
<script>
$(document).on('change', '#month', function() {
$('#changeMonthForm').submit();
});
$('#month').datepicker({
format: 'M-yyyy',
viewMode: 'months',
minViewMode: 'months',
autoclose: true,
orientation: 'bottom',
startDate: new Date(2025, 0), // Jan is month 0
endDate: new Date() // current date as max
});
</script>
<script>
document.addEventListener("fullscreenchange", function() {
if (document.fullscreenElement) {
localStorage.setItem("isFullscreen", "true");
} else {
localStorage.removeItem("isFullscreen");
}
});
document.addEventListener("DOMContentLoaded", function() {
if (localStorage.getItem("isFullscreen") === "true") {
toggleFullscreen(); // Re-enter fullscreen if it was active before refresh
}
});
function toggleFullscreen() {
if (!document.fullscreenElement) {
document.documentElement.requestFullscreen().catch(err => {
console.error(`Error attempting to enable full-screen mode: ${err.message}`);
});
} else {
document.exitFullscreen();
}
}
</script>
<script>
function toggleDivFullscreen() {
let div = document.getElementById("fullscreenDiv");
let tableResponsive = document.getElementById("table-responsive"); // Select the table container inside div
if (!document.fullscreenElement) {
div.requestFullscreen().then(() => {
div.style.width = "100vw"; // Full viewport width
div.style.height = "100vh"; // Full viewport height
// If .table-responsive exists, set its height to 90vh
if (tableResponsive) {
tableResponsive.style.maxHeight = "90vh";
tableResponsive.style.overflowY = "auto"; // Allow scrolling if needed
}
}).catch(err => console.log("Error enabling fullscreen:", err));
} else {
document.exitFullscreen().then(() => {
div.style.width = "100%";
div.style.height = "100%";
// Reset .table-responsive height when exiting fullscreen
// If .table-responsive exists, set its height to 90vh
if (tableResponsive) {
tableResponsive.style.maxHeight = "450px";
tableResponsive.style.overflowY = "auto"; // Allow scrolling if needed
}
}).catch(err => console.log("Error exiting fullscreen:", err));
}
}
$("#searchInput").on("keyup", function() {
let value = $(this).val().toLowerCase(); // Convert input to lowercase for case-insensitive search
$(".table-responsive tbody tr").filter(function() {
$(this).toggle($(this).text().toLowerCase().indexOf(value) > -1);
});
});
</script>
<script>
$(document).ready(function() {
$('.select2').select2({
dropdownParent: $('#fullscreenDiv')
});
// Initialize Select2 when the modal is shown inside full screen
$('#filterModalId,').on('shown.bs.modal', function () {
$('.select2').select2({
dropdownParent: $(this) // This ensures Select2 works in the modal
});
});
$('#additionalEntriesModalId').on('shown.bs.modal', function () {
$('.select2').select2({
dropdownParent: $(this) // This ensures Select2 works in the modal
});
});
$('#editEntriesModalId').on('shown.bs.modal', function () {
$('.select2').select2({
dropdownParent: $(this) // This ensures Select2 works in the modal
});
});
});
</script>
<script>
//getting modal backdrop inside full screen
$(document).ready(function() {
function moveModalBackdropToFullscreen() {
setTimeout(() => {
$('.modal-backdrop').appendTo('#fullscreenDiv'); // Move backdrop inside fullscreen
}, 10); // Small delay ensures backdrop is created first
}
// Move the modal backdrop when a modal opens
$('#filterModalId, #additionalEntriesModalId, #editEntriesModalId').on('show.bs.modal', function () {
moveModalBackdropToFullscreen();
});
// Ensure modals work properly in fullscreen mode
document.addEventListener("fullscreenchange", function() {
setTimeout(() => {
$('.modal-backdrop').remove(); // Remove any existing backdrops
moveModalBackdropToFullscreen();
}, 200);
});
});
</script>
<script>
document.getElementById('additionalEntriesForm').addEventListener('submit', function() {
event.preventDefault(); // Prevent default form submission
const submitButtons = document.getElementsByClassName('submit-btn');
for (let i = 0; i < submitButtons.length; i++) {
submitButtons[i].disabled = true;
submitButtons[i].innerText = 'Submitting...';
}
this.submit(); // Submit the form programmatically
});
document.getElementById('editEntriesForm').addEventListener('submit', function() {
event.preventDefault(); // Prevent default form submission
const submitButtons = document.getElementsByClassName('submit-btn');
for (let i = 0; i < submitButtons.length; i++) {
submitButtons[i].disabled = true;
submitButtons[i].innerText = 'Submitting...';
}
this.submit(); // Submit the form programmatically
});
</script>