|
|
@ -1,7 +1,7 @@ |
|
|
<!DOCTYPE html> |
|
|
<!DOCTYPE html> |
|
|
<html lang="en"> |
|
|
<html lang="en"> |
|
|
<head> |
|
|
<head> |
|
|
<title>Bul Waste Report</title> |
|
|
|
|
|
|
|
|
<title>Bulk Waste Report</title> |
|
|
|
|
|
|
|
|
<!-- Bootstrap 5 CSS --> |
|
|
<!-- Bootstrap 5 CSS --> |
|
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css" rel="stylesheet"> |
|
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css" rel="stylesheet"> |
|
|
@ -180,7 +180,7 @@ |
|
|
|
|
|
|
|
|
<button |
|
|
<button |
|
|
class="btn btn-success w-100" |
|
|
class="btn btn-success w-100" |
|
|
onclick="loadZoneReport()"> |
|
|
|
|
|
|
|
|
onclick="loadZoneReport(true)"> |
|
|
Apply Filter |
|
|
Apply Filter |
|
|
</button> |
|
|
</button> |
|
|
|
|
|
|
|
|
@ -201,8 +201,8 @@ |
|
|
<table id="ZoneOpDatatable" class="table table-striped table-bordered display nowrap w-100"> |
|
|
<table id="ZoneOpDatatable" class="table table-striped table-bordered display nowrap w-100"> |
|
|
<thead> |
|
|
<thead> |
|
|
<tr> |
|
|
<tr> |
|
|
<th class="text-center">Zones</th> |
|
|
|
|
|
<th class="text-center">Total Request</th> |
|
|
|
|
|
|
|
|
<th class="text-center">Zone</th> |
|
|
|
|
|
<th class="text-center">Total Requests Received</th> |
|
|
</tr> |
|
|
</tr> |
|
|
</thead> |
|
|
</thead> |
|
|
<tbody> |
|
|
<tbody> |
|
|
@ -231,9 +231,9 @@ |
|
|
<table id="WardDatatable" class="table table-striped table-bordered display nowrap w-100"> |
|
|
<table id="WardDatatable" class="table table-striped table-bordered display nowrap w-100"> |
|
|
<thead> |
|
|
<thead> |
|
|
<tr> |
|
|
<tr> |
|
|
<th class="text-center">Zones</th> |
|
|
|
|
|
<th class="text-center">Wards</th> |
|
|
|
|
|
<th class="text-center">Total Request</th> |
|
|
|
|
|
|
|
|
<th class="text-center">Zone</th> |
|
|
|
|
|
<th class="text-center">Ward</th> |
|
|
|
|
|
<th class="text-center">Total Requests Received</th> |
|
|
</tr> |
|
|
</tr> |
|
|
</thead> |
|
|
</thead> |
|
|
<tbody> |
|
|
<tbody> |
|
|
@ -273,8 +273,8 @@ |
|
|
<tr> |
|
|
<tr> |
|
|
<th>Zone</th> |
|
|
<th>Zone</th> |
|
|
<th>Ward</th> |
|
|
<th>Ward</th> |
|
|
<th>Category</th> |
|
|
|
|
|
<th>Request Id</th> |
|
|
|
|
|
|
|
|
<th>Establishment Type</th> |
|
|
|
|
|
<th>Total Requests Received</th> |
|
|
</tr> |
|
|
</tr> |
|
|
</thead> |
|
|
</thead> |
|
|
|
|
|
|
|
|
@ -288,11 +288,27 @@ |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
<div class="modal fade" id="pendingModal" tabindex="-1" aria-labelledby="DetailsLabel" aria-hidden="true" data-bs-keyboard="false" data-bs-backdrop="static"> |
|
|
|
|
|
<div class="modal-dialog modal-xl"> |
|
|
|
|
|
<div class="modal-content"> |
|
|
|
|
|
<div class="modal-header"> |
|
|
|
|
|
<h5 id="pendingModalTitle"></h5> |
|
|
|
|
|
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button> |
|
|
|
|
|
</div> |
|
|
|
|
|
<div class="modal-body" id="pendingModalBody"></div> |
|
|
|
|
|
</div> |
|
|
|
|
|
</div> |
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div class="modal fade" id="imagePreviewModal" tabindex="-1"> |
|
|
|
|
|
<div class="modal-dialog modal-dialog-centered modal-lg"> |
|
|
|
|
|
<div class="modal-content"> |
|
|
|
|
|
<div class="modal-body text-center p-2"> |
|
|
|
|
|
<img id="previewImage" src="" class="img-fluid rounded"> |
|
|
|
|
|
</div> |
|
|
|
|
|
</div> |
|
|
|
|
|
</div> |
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
<div id="pageLoader" |
|
|
<div id="pageLoader" |
|
|
style="display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(255, 255, 255, 0.8); z-index: 9999; text-align: center;"> |
|
|
style="display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(255, 255, 255, 0.8); z-index: 9999; text-align: center;"> |
|
|
@ -335,15 +351,38 @@ |
|
|
$('#imagePreviewModal').modal('show'); |
|
|
$('#imagePreviewModal').modal('show'); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function loadZoneReport(){ |
|
|
|
|
|
const startDate = $('#startDate').val(); // yyyy-mm-dd or "" |
|
|
|
|
|
const endDate = $('#endDate').val(); |
|
|
|
|
|
const category = $('#categoryId').val(); |
|
|
|
|
|
|
|
|
function loadZoneReport(isFilter = false){ |
|
|
|
|
|
|
|
|
|
|
|
let startDate = $('#startDate').val(); |
|
|
|
|
|
let endDate = $('#endDate').val(); |
|
|
|
|
|
let category = $('#categoryId').val(); |
|
|
|
|
|
|
|
|
|
|
|
<!-- // ✅ first load → don't filter by date--> |
|
|
|
|
|
<!-- if (!isFilter) {--> |
|
|
|
|
|
<!-- startDate = "";--> |
|
|
|
|
|
<!-- endDate = "";--> |
|
|
|
|
|
<!-- }--> |
|
|
|
|
|
|
|
|
<!-- console.log("category=="+category);--> |
|
|
|
|
|
|
|
|
// ✅ correct validation |
|
|
|
|
|
if (isFilter) { |
|
|
|
|
|
|
|
|
|
|
|
if ((startDate && !endDate) || (!startDate && endDate)) { |
|
|
|
|
|
|
|
|
|
|
|
Swal.fire({ |
|
|
|
|
|
icon: 'warning', |
|
|
|
|
|
title: 'Select both dates', |
|
|
|
|
|
text: 'Please select From Date and To Date' |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// ✅ continue ajax only if both selected |
|
|
|
|
|
|
|
|
$('#pageLoader').show(); |
|
|
$('#pageLoader').show(); |
|
|
|
|
|
|
|
|
$.ajax({ |
|
|
$.ajax({ |
|
|
url: '/commissionerreview/api/bulkwaste/getZoneReport', |
|
|
url: '/commissionerreview/api/bulkwaste/getZoneReport', |
|
|
method: 'GET', |
|
|
method: 'GET', |
|
|
@ -352,6 +391,7 @@ |
|
|
endDate: endDate, |
|
|
endDate: endDate, |
|
|
category: category |
|
|
category: category |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
success: function(response) { |
|
|
success: function(response) { |
|
|
|
|
|
|
|
|
// Safely extract data whether it's an array or an object |
|
|
// Safely extract data whether it's an array or an object |
|
|
@ -370,6 +410,35 @@ |
|
|
autoWidth: true, |
|
|
autoWidth: true, |
|
|
info: true, |
|
|
info: true, |
|
|
data: res.data, // using response directly |
|
|
data: res.data, // using response directly |
|
|
|
|
|
|
|
|
|
|
|
dom: 'Bfrtip', |
|
|
|
|
|
|
|
|
|
|
|
buttons: [ |
|
|
|
|
|
'copy', |
|
|
|
|
|
'excel', |
|
|
|
|
|
{ |
|
|
|
|
|
extend: 'pdf', |
|
|
|
|
|
text: 'PDF', |
|
|
|
|
|
orientation: 'landscape', |
|
|
|
|
|
pageSize: 'A4', |
|
|
|
|
|
customize: function (doc) { |
|
|
|
|
|
|
|
|
|
|
|
var table = doc.content.find(e => e.table); |
|
|
|
|
|
var columnCount = table.table.body[0].length; |
|
|
|
|
|
table.table.widths = Array(columnCount).fill('*'); |
|
|
|
|
|
doc.styles.tableHeader.alignment = 'center'; |
|
|
|
|
|
for (var i = 1; i < table.table.body.length; i++) { |
|
|
|
|
|
for (var j = 0; j < columnCount; j++) { |
|
|
|
|
|
table.table.body[i][j].alignment = 'center'; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
doc.defaultStyle.fontSize = 10; |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
|
|
|
'print' |
|
|
|
|
|
], // ✅ THIS COMMA IS REQUIRED |
|
|
|
|
|
|
|
|
columns: [ |
|
|
columns: [ |
|
|
{ |
|
|
{ |
|
|
data: 'zone_name' |
|
|
data: 'zone_name' |
|
|
@ -391,7 +460,7 @@ |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
], |
|
|
], |
|
|
dom: 'frtip', |
|
|
|
|
|
|
|
|
|
|
|
lengthMenu: [ |
|
|
lengthMenu: [ |
|
|
[50, 100, 200, 500, -1], |
|
|
[50, 100, 200, 500, -1], |
|
|
['50 rows', '100 rows', '200 rows', 'Show all'] |
|
|
['50 rows', '100 rows', '200 rows', 'Show all'] |
|
|
@ -407,15 +476,22 @@ |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
else if(Array.isArray(res.data) && res.data.length === 0) { |
|
|
else if(Array.isArray(res.data) && res.data.length === 0) { |
|
|
$('#pageLoader').hide(); |
|
|
|
|
|
//alert("No data available."); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$('#ZoneOpDatatable').DataTable().clear().draw(); |
|
|
|
|
|
|
|
|
Swal.fire({ |
|
|
Swal.fire({ |
|
|
icon: 'info', |
|
|
icon: 'info', |
|
|
title: 'No Data', |
|
|
title: 'No Data', |
|
|
text: 'No data available.', |
|
|
text: 'No data available.', |
|
|
showConfirmButton: true, |
|
|
|
|
|
timer: 3000 |
|
|
|
|
|
|
|
|
confirmButtonText: 'OK' |
|
|
|
|
|
}).then(() => { |
|
|
|
|
|
|
|
|
|
|
|
$('#categoryId').val(''); |
|
|
|
|
|
|
|
|
|
|
|
// reload default date again |
|
|
|
|
|
loadDefaultDate(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
@ -506,6 +582,35 @@ |
|
|
destroy: true, |
|
|
destroy: true, |
|
|
autoWidth: true, |
|
|
autoWidth: true, |
|
|
info: true, |
|
|
info: true, |
|
|
|
|
|
|
|
|
|
|
|
dom: 'Bfrtip', |
|
|
|
|
|
|
|
|
|
|
|
buttons: [ |
|
|
|
|
|
'copy', |
|
|
|
|
|
'excel', |
|
|
|
|
|
{ |
|
|
|
|
|
extend: 'pdf', |
|
|
|
|
|
text: 'PDF', |
|
|
|
|
|
orientation: 'landscape', |
|
|
|
|
|
pageSize: 'A4', |
|
|
|
|
|
customize: function (doc) { |
|
|
|
|
|
|
|
|
|
|
|
var table = doc.content.find(e => e.table); |
|
|
|
|
|
var columnCount = table.table.body[0].length; |
|
|
|
|
|
table.table.widths = Array(columnCount).fill('*'); |
|
|
|
|
|
doc.styles.tableHeader.alignment = 'center'; |
|
|
|
|
|
for (var i = 1; i < table.table.body.length; i++) { |
|
|
|
|
|
for (var j = 0; j < columnCount; j++) { |
|
|
|
|
|
table.table.body[i][j].alignment = 'center'; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
doc.defaultStyle.fontSize = 10; |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
|
|
|
'print' |
|
|
|
|
|
], // ✅ THIS COMMA IS REQUIRED |
|
|
|
|
|
|
|
|
columns: [ |
|
|
columns: [ |
|
|
{ data: 'zone_name', className: 'text-center' }, |
|
|
{ data: 'zone_name', className: 'text-center' }, |
|
|
{ data: 'ward_name', className: 'text-center' }, |
|
|
{ data: 'ward_name', className: 'text-center' }, |
|
|
@ -530,7 +635,7 @@ |
|
|
scrollX: true, |
|
|
scrollX: true, |
|
|
searching: false, |
|
|
searching: false, |
|
|
ordering: false, |
|
|
ordering: false, |
|
|
paging: true |
|
|
|
|
|
|
|
|
paging: false |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
// ✅ Bootstrap 5 modal open |
|
|
// ✅ Bootstrap 5 modal open |
|
|
@ -607,11 +712,61 @@ function openRequestModal(zoneCode, wardCode) { |
|
|
|
|
|
|
|
|
data: res.data, |
|
|
data: res.data, |
|
|
|
|
|
|
|
|
|
|
|
dom: 'Bfrtip', |
|
|
|
|
|
|
|
|
|
|
|
buttons: [ |
|
|
|
|
|
'copy', |
|
|
|
|
|
'excel', |
|
|
|
|
|
{ |
|
|
|
|
|
extend: 'pdf', |
|
|
|
|
|
text: 'PDF', |
|
|
|
|
|
orientation: 'landscape', |
|
|
|
|
|
pageSize: 'A4', |
|
|
|
|
|
customize: function (doc) { |
|
|
|
|
|
|
|
|
|
|
|
var table = doc.content.find(e => e.table); |
|
|
|
|
|
var columnCount = table.table.body[0].length; |
|
|
|
|
|
table.table.widths = Array(columnCount).fill('*'); |
|
|
|
|
|
doc.styles.tableHeader.alignment = 'center'; |
|
|
|
|
|
for (var i = 1; i < table.table.body.length; i++) { |
|
|
|
|
|
for (var j = 0; j < columnCount; j++) { |
|
|
|
|
|
table.table.body[i][j].alignment = 'center'; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
doc.defaultStyle.fontSize = 10; |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
|
|
|
'print' |
|
|
|
|
|
], // ✅ THIS COMMA IS REQUIRED |
|
|
|
|
|
|
|
|
columns: [ |
|
|
columns: [ |
|
|
{ data: 'zone_name' }, |
|
|
{ data: 'zone_name' }, |
|
|
{ data: 'ward_name' }, |
|
|
{ data: 'ward_name' }, |
|
|
{ data: 'category_name' }, |
|
|
{ data: 'category_name' }, |
|
|
{ data: 'total_requests' } |
|
|
|
|
|
|
|
|
<!-- { data: 'total_requests' }--> |
|
|
|
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
data: 'total_requests', |
|
|
|
|
|
render: function (data, type, row) { |
|
|
|
|
|
|
|
|
|
|
|
if (!data || data == 0) { |
|
|
|
|
|
return data; // not clickable if 0 |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return `<a href="javascript:void(0)" |
|
|
|
|
|
onclick="openBulkRequestModal( |
|
|
|
|
|
'${row.zone_name}', |
|
|
|
|
|
'${row.ward_name}', |
|
|
|
|
|
'${row.category_id}', |
|
|
|
|
|
'${row.category_name}' |
|
|
|
|
|
)"> |
|
|
|
|
|
${data} |
|
|
|
|
|
</a>`; |
|
|
|
|
|
}, |
|
|
|
|
|
className: 'text-center' |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
] |
|
|
] |
|
|
|
|
|
|
|
|
}); |
|
|
}); |
|
|
@ -651,6 +806,252 @@ function openRequestModal(zoneCode, wardCode) { |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function openBulkRequestModal(zone, ward,category_id,category_name) { |
|
|
|
|
|
|
|
|
|
|
|
const startDate = $('#startDate').val(); |
|
|
|
|
|
const endDate = $('#endDate').val(); |
|
|
|
|
|
|
|
|
|
|
|
console.log("startDate =", startDate); |
|
|
|
|
|
console.log("endDate =", endDate); |
|
|
|
|
|
console.log("category id =", category_id); |
|
|
|
|
|
console.log("category name =", category_name); |
|
|
|
|
|
|
|
|
|
|
|
$('#pendingModal').modal('show'); |
|
|
|
|
|
|
|
|
|
|
|
$('#pendingModalTitle').text( |
|
|
|
|
|
`Bulk Waste Requests - Zone ${zone}, Ward ${ward}, Category ${category_name}` |
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
$('#pageLoader').show(); |
|
|
|
|
|
|
|
|
|
|
|
$.ajax({ |
|
|
|
|
|
url: '/commissionerreview/api/bulkwaste/getRequestDetailsByZoneWard', |
|
|
|
|
|
method: 'GET', |
|
|
|
|
|
data: { |
|
|
|
|
|
zone: zone, |
|
|
|
|
|
ward: ward, |
|
|
|
|
|
startDate: startDate, |
|
|
|
|
|
endDate: endDate, |
|
|
|
|
|
category: category_id |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
success: function (res) { |
|
|
|
|
|
$('#pageLoader').hide(); |
|
|
|
|
|
if (res.status === 'Success' && res.data.length > 0) { |
|
|
|
|
|
renderBulkRequestCards(res.data); |
|
|
|
|
|
} else { |
|
|
|
|
|
$('#pendingModalBody').html( |
|
|
|
|
|
`<p class="text-center text-muted">No Requests Found</p>` |
|
|
|
|
|
); |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
error: function () { |
|
|
|
|
|
$('#pageLoader').hide(); |
|
|
|
|
|
Swal.fire( |
|
|
|
|
|
'Error', |
|
|
|
|
|
'Failed to load details', |
|
|
|
|
|
'error' |
|
|
|
|
|
); |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function formatDate(dateStr) { |
|
|
|
|
|
|
|
|
|
|
|
if (!dateStr) return ''; |
|
|
|
|
|
|
|
|
|
|
|
const d = new Date(dateStr); |
|
|
|
|
|
|
|
|
|
|
|
const day = String(d.getDate()).padStart(2, '0'); |
|
|
|
|
|
const month = String(d.getMonth() + 1).padStart(2, '0'); |
|
|
|
|
|
const year = d.getFullYear(); |
|
|
|
|
|
|
|
|
|
|
|
return `${day}-${month}-${year}`; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function renderBulkRequestCards(data) { |
|
|
|
|
|
let html = ''; |
|
|
|
|
|
data.forEach(item => { |
|
|
|
|
|
html += ` |
|
|
|
|
|
<div class="card mb-4 shadow-sm"> |
|
|
|
|
|
<div class="card-header bg-success text-white"> |
|
|
|
|
|
Request ID : ${item.request_id} |
|
|
|
|
|
| |
|
|
|
|
|
${formatDate(item.cdate)} |
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
<div class="card-body"> |
|
|
|
|
|
<!-- BASIC DETAILS --> |
|
|
|
|
|
<div class="bg-dark text-white p-2 mb-2">Basic Details</div> |
|
|
|
|
|
|
|
|
|
|
|
<div class="row"> |
|
|
|
|
|
<div class="col-md-6"> |
|
|
|
|
|
<p><b>Name of Establishment :</b> ${item.name_of_establishment || '-'}</p> |
|
|
|
|
|
<p><b>Category :</b> ${item.category_name || '-'}</p> |
|
|
|
|
|
<p><b>Name :</b> ${item.person_name || '-'}</p> |
|
|
|
|
|
<p><b>Email ID :</b> ${item.email_id || '-'}</p> |
|
|
|
|
|
<p><b>Mobile Number :</b> ${item.mobile_no || '-'}</p> |
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
<div class="col-md-6"> |
|
|
|
|
|
<p><b>Trade License No :</b> ${item.trade_license_No || '-'}</p> |
|
|
|
|
|
<p><b>GST No :</b> ${item.gst_No || '-'}</p> |
|
|
|
|
|
<p><b>Zone :</b> ${item.zone_id || '-'}</p> |
|
|
|
|
|
<p><b>Ward :</b> ${item.ward_id || '-'}</p> |
|
|
|
|
|
<p><b>Address :</b> ${item.address || '-'}</p> |
|
|
|
|
|
</div> |
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
<!-- Establishment --> |
|
|
|
|
|
<div class="bg-dark text-white p-2 mb-2 mt-3"> |
|
|
|
|
|
Establishment Details |
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
<div class="row"> |
|
|
|
|
|
<div class="col-md-6"> |
|
|
|
|
|
<p><b>Total Built-up Area (in sq.m) :</b> ${item.total_builtup_area_sqmt || '-'}</p> |
|
|
|
|
|
<p><b>Total Employees :</b> ${item.totalEmployees || '-'}</p> |
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
<div class="col-md-6"> |
|
|
|
|
|
<p><b>Type :</b> ${item.establishment_type || '-'}</p> |
|
|
|
|
|
${ |
|
|
|
|
|
item.establishment_type === 'Apartment' |
|
|
|
|
|
? `<p><b>Number of Dwelling Units :</b> ${item.dwelling_units || '-'}</p>` |
|
|
|
|
|
: '' |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
${ |
|
|
|
|
|
item.establishment_type === 'Commercial' |
|
|
|
|
|
? `<p><b>Average Daily Footfall :</b> ${item.avg_daily_footfall || '-'}</p>` |
|
|
|
|
|
: '' |
|
|
|
|
|
} |
|
|
|
|
|
</div> |
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
<!-- Waste Generation --> |
|
|
|
|
|
<div class="bg-dark text-white p-2 mb-2 mt-3"> |
|
|
|
|
|
Waste Generation Details |
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
<div class="row"> |
|
|
|
|
|
<div class="col-md-6"> |
|
|
|
|
|
<p><b>Wet Waste (kg/day) :</b> ${item.wet_waste || '-'}</p> |
|
|
|
|
|
<p><b>Dry Waste (kg/day) :</b> ${item.dry_waste || '-'}</p> |
|
|
|
|
|
<p><b>Domestic Hazardous Waste (kg/day) :</b> ${item.domestic_hazardous_waste || '-'}</p> |
|
|
|
|
|
<p><b>Sanitary Waste (kg/day) :</b> ${item.sanitary_waste || '-'}</p> |
|
|
|
|
|
<p><b>C & D Waste (if applicable) :</b> ${item.cd_waste || '-'}</p> |
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
<div class="col-md-6"> |
|
|
|
|
|
${ |
|
|
|
|
|
item.waste_audit_report_file_live |
|
|
|
|
|
? ` |
|
|
|
|
|
<p><b>Waste Audit Report :</b><br> |
|
|
|
|
|
<img src="${item.waste_audit_report_file_live}" |
|
|
|
|
|
class="img-thumbnail" |
|
|
|
|
|
style="max-width:150px;cursor:pointer" |
|
|
|
|
|
onclick="openImagePreview('${item.waste_audit_report_file_live}')"> |
|
|
|
|
|
</p> |
|
|
|
|
|
` |
|
|
|
|
|
: '' |
|
|
|
|
|
} |
|
|
|
|
|
</div> |
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!-- Waste Processing --> |
|
|
|
|
|
<div class="bg-dark text-white p-2 mb-2 mt-3"> |
|
|
|
|
|
Waste Processing Details |
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
<p><b>Is Wet Waste Processed On-site :</b> ${item.wet_waste_processed || 'No'}</p> |
|
|
|
|
|
|
|
|
|
|
|
${ |
|
|
|
|
|
item.wet_waste_processed === 'Yes' |
|
|
|
|
|
? ` |
|
|
|
|
|
<div class="row"> |
|
|
|
|
|
<div class="col-md-6"> |
|
|
|
|
|
<p><b>Technology Used :</b> ${item.technology_used || item.other_technology || '-'}</p> |
|
|
|
|
|
<p><b>Installed Capacity (kg/day) :</b> ${item.installed_capacity_kg || '-'}</p> |
|
|
|
|
|
<p><b>Year of Installation :</b> ${item.installation_year || '-'}</p> |
|
|
|
|
|
<p><b>Vendor Name :</b> ${item.vendor_name || '-'}</p> |
|
|
|
|
|
<p><b>Unit Functional :</b> ${item.unit_functional_status || '-'}</p> |
|
|
|
|
|
<p><b>Latitude :</b> ${item.latitude || '-'}</p> |
|
|
|
|
|
<p><b>Longitude :</b> ${item.longitude || '-'}</p> |
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
<div class="col-md-6"> |
|
|
|
|
|
${ |
|
|
|
|
|
item.installed_unit_photo_file_live |
|
|
|
|
|
? ` |
|
|
|
|
|
<p><b>Installed Unit Photo :</b><br> |
|
|
|
|
|
<img src="${item.installed_unit_photo_file_live}" |
|
|
|
|
|
class="img-thumbnail" |
|
|
|
|
|
style="max-width:150px;cursor:pointer" |
|
|
|
|
|
onclick="openImagePreview('${item.installed_unit_photo_file_live}')"> |
|
|
|
|
|
</p> |
|
|
|
|
|
` |
|
|
|
|
|
: '' |
|
|
|
|
|
} |
|
|
|
|
|
</div> |
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
` |
|
|
|
|
|
: '' |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
<!-- Dry Waste --> |
|
|
|
|
|
<div class="bg-dark text-white p-2 mb-2 mt-3"> |
|
|
|
|
|
Dry Waste Management |
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
<p><b>Dry Waste Given to Authorized Recycler :</b> ${item.dry_waste_recycler || 'No'}</p> |
|
|
|
|
|
|
|
|
|
|
|
${ |
|
|
|
|
|
item.dry_waste_recycler === 'Yes' |
|
|
|
|
|
? ` |
|
|
|
|
|
<div class="row"> |
|
|
|
|
|
<div class="col-md-6"> |
|
|
|
|
|
<p><b>Name of Recycler / MRF :</b> ${item.recycler_name || '-'}</p> |
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
<div class="col-md-6"> |
|
|
|
|
|
<p><b>Authorized No of Recycler :</b> ${item.recycler_authorization_no || '-'}</p> |
|
|
|
|
|
</div> |
|
|
|
|
|
</div> |
|
|
|
|
|
` |
|
|
|
|
|
: '' |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
<!-- Residual --> |
|
|
|
|
|
<div class="bg-dark text-white p-2 mb-2 mt-3"> |
|
|
|
|
|
Residual Waste Disposal |
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
<div class="row"> |
|
|
|
|
|
<div class="col-md-6"> |
|
|
|
|
|
<p><b>Quantity of Residual Waste Handed to GCC (kg/day) Quantity :</b> ${item.residual_waste_quantity || '-'}</p> |
|
|
|
|
|
<p><b>Vehicle Types :</b> ${item.vehicle_type || '-'}</p> |
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
<div class="col-md-6"> |
|
|
|
|
|
<p><b>Collection Frequency :</b> ${item.collection_frequency || '-'}</p> |
|
|
|
|
|
</div> |
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
`; |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
$('#pendingModalBody').html(html); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
function footerSumCallback(row, data) { |
|
|
function footerSumCallback(row, data) { |
|
|
let api = this.api(); |
|
|
let api = this.api(); |
|
|
@ -703,29 +1104,39 @@ function openRequestModal(zoneCode, wardCode) { |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$(document).ready(function () { |
|
|
$(document).ready(function () { |
|
|
|
|
|
|
|
|
loadZoneReport(); |
|
|
|
|
|
|
|
|
// clear table |
|
|
|
|
|
if ($.fn.DataTable.isDataTable('#ZoneOpDatatable')) { |
|
|
|
|
|
$('#ZoneOpDatatable').DataTable().clear().draw(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
loadDefaultDate(); |
|
|
loadCategoryList(); // ✅ must |
|
|
loadCategoryList(); // ✅ must |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Set today's date as max |
|
|
// Set today's date as max |
|
|
const today = new Date().toISOString().split('T')[0]; |
|
|
const today = new Date().toISOString().split('T')[0]; |
|
|
$('#startDate, #endDate').attr('max', today); |
|
|
$('#startDate, #endDate').attr('max', today); |
|
|
|
|
|
|
|
|
// When start date changes → set min for end date |
|
|
// When start date changes → set min for end date |
|
|
$('#startDate').on('change', function () { |
|
|
$('#startDate').on('change', function () { |
|
|
const startDate = $(this).val(); |
|
|
|
|
|
|
|
|
|
|
|
$('#endDate').attr('min', startDate); |
|
|
|
|
|
|
|
|
const minDate = $(this).attr('min'); |
|
|
|
|
|
const val = $(this).val(); |
|
|
|
|
|
|
|
|
// If endDate already selected but invalid → clear it |
|
|
|
|
|
if ($('#endDate').val() && $('#endDate').val() < startDate) { |
|
|
|
|
|
$('#endDate').val(''); |
|
|
|
|
|
|
|
|
if (val < minDate) { |
|
|
|
|
|
|
|
|
|
|
|
Swal.fire({ |
|
|
|
|
|
icon: 'warning', |
|
|
|
|
|
title: 'Invalid Date', |
|
|
|
|
|
text: 'Date cannot be before ' + minDate |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
$(this).val(minDate); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$('#endDate').attr('min', val); |
|
|
|
|
|
|
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
// When end date changes → validate against start date |
|
|
// When end date changes → validate against start date |
|
|
@ -752,58 +1163,137 @@ function openRequestModal(zoneCode, wardCode) { |
|
|
|
|
|
|
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
function loadDefaultDate() { |
|
|
|
|
|
|
|
|
|
|
|
// launch date |
|
|
|
|
|
let start = "2026-03-10"; |
|
|
|
|
|
|
|
|
|
|
|
// today |
|
|
|
|
|
let today = new Date().toISOString().split('T')[0]; |
|
|
|
|
|
|
|
|
|
|
|
// set values |
|
|
|
|
|
$('#startDate').val(start); |
|
|
|
|
|
$('#endDate').val(today); |
|
|
|
|
|
|
|
|
|
|
|
// min date |
|
|
|
|
|
$('#startDate').attr('min', start); |
|
|
|
|
|
$('#endDate').attr('min', start); |
|
|
|
|
|
|
|
|
|
|
|
// max date |
|
|
|
|
|
$('#startDate').attr('max', today); |
|
|
|
|
|
$('#endDate').attr('max', today); |
|
|
|
|
|
|
|
|
|
|
|
// store default |
|
|
|
|
|
$('#startDate').data('defaultDate', start); |
|
|
|
|
|
$('#endDate').data('defaultDate', today); |
|
|
|
|
|
|
|
|
|
|
|
// load table |
|
|
|
|
|
loadZoneReport(false); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
<!-- function loadDefaultDate() {--> |
|
|
|
|
|
|
|
|
|
|
|
<!-- // ✅ fixed launch date--> |
|
|
|
|
|
<!-- let d = "2026-03-10";--> |
|
|
|
|
|
|
|
|
|
|
|
<!-- // today date--> |
|
|
|
|
|
<!-- let today = new Date().toISOString().split('T')[0];--> |
|
|
|
|
|
|
|
|
|
|
|
<!-- // set value--> |
|
|
|
|
|
<!-- $('#startDate').val(d);--> |
|
|
|
|
|
<!-- $('#endDate').val(today);--> |
|
|
|
|
|
|
|
|
|
|
|
<!-- // set min date (cannot select before launch)--> |
|
|
|
|
|
<!-- $('#startDate').attr('min', start);--> |
|
|
|
|
|
<!-- $('#endDate').attr('min', start);--> |
|
|
|
|
|
|
|
|
|
|
|
<!-- // max = today--> |
|
|
|
|
|
<!-- // max date--> |
|
|
|
|
|
<!-- $('#startDate, #endDate').attr('max', today);--> |
|
|
|
|
|
|
|
|
|
|
|
<!-- // trigger validation--> |
|
|
|
|
|
<!-- $('#startDate').trigger('change');--> |
|
|
|
|
|
|
|
|
|
|
|
<!-- // store default--> |
|
|
|
|
|
<!-- $('#startDate').data('defaultDate', start);--> |
|
|
|
|
|
<!-- $('#endDate').data('defaultDate', today);--> |
|
|
|
|
|
|
|
|
|
|
|
<!-- // load table without filter--> |
|
|
|
|
|
<!-- loadZoneReport(false);--> |
|
|
|
|
|
<!--}--> |
|
|
|
|
|
|
|
|
|
|
|
<!-- function loadDefaultDate() {--> |
|
|
|
|
|
|
|
|
|
|
|
<!-- $.ajax({--> |
|
|
|
|
|
<!-- url: '/commissionerreview/api/bulkwaste/getMinDate',--> |
|
|
|
|
|
<!-- method: 'GET',--> |
|
|
|
|
|
|
|
|
|
|
|
<!-- success: function(res){--> |
|
|
|
|
|
<!-- if(res.status === "Success"){--> |
|
|
|
|
|
|
|
|
|
|
|
<!-- let d = res.date;--> |
|
|
|
|
|
|
|
|
|
|
|
<!-- // set value first--> |
|
|
|
|
|
<!-- $('#startDate').val(d);--> |
|
|
|
|
|
|
|
|
|
|
|
<!-- // set min date--> |
|
|
|
|
|
<!-- $('#startDate').attr('min', d);--> |
|
|
|
|
|
<!-- $('#endDate').attr('min', d);--> |
|
|
|
|
|
|
|
|
|
|
|
<!-- // also set max today (safe)--> |
|
|
|
|
|
<!-- const today = new Date().toISOString().split('T')[0];--> |
|
|
|
|
|
<!-- $('#startDate, #endDate').attr('max', today);--> |
|
|
|
|
|
|
|
|
|
|
|
<!-- // force refresh validation--> |
|
|
|
|
|
<!-- $('#startDate').trigger('change');--> |
|
|
|
|
|
|
|
|
|
|
|
<!-- // store default--> |
|
|
|
|
|
<!-- $('#startDate').data('defaultDate', d);--> |
|
|
|
|
|
|
|
|
|
|
|
<!-- // load table without filter--> |
|
|
|
|
|
<!-- loadZoneReport(false);--> |
|
|
|
|
|
|
|
|
|
|
|
<!-- }--> |
|
|
|
|
|
<!-- }--> |
|
|
|
|
|
<!-- });--> |
|
|
|
|
|
|
|
|
|
|
|
<!-- }--> |
|
|
|
|
|
|
|
|
function loadCategoryList() { |
|
|
function loadCategoryList() { |
|
|
|
|
|
|
|
|
$.ajax({ |
|
|
$.ajax({ |
|
|
|
|
|
|
|
|
url: '/commissionerreview/api/bulkwaste/getCategoryList', |
|
|
url: '/commissionerreview/api/bulkwaste/getCategoryList', |
|
|
|
|
|
|
|
|
method: 'GET', |
|
|
method: 'GET', |
|
|
|
|
|
|
|
|
success: function (response) { |
|
|
success: function (response) { |
|
|
|
|
|
|
|
|
console.log("Category API:", response); |
|
|
console.log("Category API:", response); |
|
|
|
|
|
|
|
|
let res = Array.isArray(response) |
|
|
let res = Array.isArray(response) |
|
|
? response[0] |
|
|
? response[0] |
|
|
: response; |
|
|
: response; |
|
|
|
|
|
|
|
|
if (res.status === "Success") { |
|
|
if (res.status === "Success") { |
|
|
|
|
|
|
|
|
let dropdown = $('#categoryId'); |
|
|
let dropdown = $('#categoryId'); |
|
|
|
|
|
|
|
|
dropdown.empty(); |
|
|
dropdown.empty(); |
|
|
|
|
|
|
|
|
dropdown.append( |
|
|
dropdown.append( |
|
|
'<option value="">All Category</option>' |
|
|
'<option value="">All Category</option>' |
|
|
); |
|
|
); |
|
|
|
|
|
|
|
|
res.data.forEach(function (row) { |
|
|
res.data.forEach(function (row) { |
|
|
|
|
|
|
|
|
dropdown.append( |
|
|
dropdown.append( |
|
|
`<option value="${row.category_id}"> |
|
|
`<option value="${row.category_id}"> |
|
|
${row.category_name} |
|
|
${row.category_name} |
|
|
</option>` |
|
|
</option>` |
|
|
); |
|
|
); |
|
|
|
|
|
|
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
error: function () { |
|
|
error: function () { |
|
|
|
|
|
|
|
|
Swal.fire( |
|
|
Swal.fire( |
|
|
"Error", |
|
|
"Error", |
|
|
"Category load failed", |
|
|
"Category load failed", |
|
|
"error" |
|
|
"error" |
|
|
); |
|
|
); |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
$('#requestDetailsModal').on('hidden.bs.modal', function () { |
|
|
$('#requestDetailsModal').on('hidden.bs.modal', function () { |
|
|
|