|
|
@ -20,7 +20,8 @@ |
|
|
border: 1px solid #000; |
|
|
border: 1px solid #000; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
table.dataTable th { |
|
|
|
|
|
|
|
|
table.dataTable th, |
|
|
|
|
|
.table-dark th { |
|
|
background-color: #003366 !important; |
|
|
background-color: #003366 !important; |
|
|
color: white; |
|
|
color: white; |
|
|
text-align: center !important; |
|
|
text-align: center !important; |
|
|
@ -53,7 +54,7 @@ |
|
|
<input type="date" id="toDate" class="form-control"> |
|
|
<input type="date" id="toDate" class="form-control"> |
|
|
</div> |
|
|
</div> |
|
|
<div class="col-auto"> |
|
|
<div class="col-auto"> |
|
|
<button class="btn btn-primary" id="searchBtn">Search</button> |
|
|
|
|
|
|
|
|
<button type="button" class="btn btn-primary" id="searchBtn">Search</button> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
|
|
|
|
|
|
@ -120,6 +121,7 @@ |
|
|
</div> |
|
|
</div> |
|
|
<p>Loading details...</p> |
|
|
<p>Loading details...</p> |
|
|
</div> |
|
|
</div> |
|
|
|
|
|
<div class="table-responsive"> |
|
|
<table id="detailsTable" class="table table-bordered table-striped" style="width:100%"> |
|
|
<table id="detailsTable" class="table table-bordered table-striped" style="width:100%"> |
|
|
<thead class="table-dark"> |
|
|
<thead class="table-dark"> |
|
|
<tr> |
|
|
<tr> |
|
|
@ -127,9 +129,9 @@ |
|
|
<th>Ref ID</th> |
|
|
<th>Ref ID</th> |
|
|
<th>Applicant Name</th> |
|
|
<th>Applicant Name</th> |
|
|
<th>Mobile</th> |
|
|
<th>Mobile</th> |
|
|
<th>App Type</th> |
|
|
|
|
|
<th>App Option</th> |
|
|
|
|
|
<th>Install Type</th> |
|
|
|
|
|
|
|
|
<th>Application Type</th> |
|
|
|
|
|
<!-- <th>Application Option</th> |
|
|
|
|
|
<th>Installation Type</th> --> |
|
|
<th>Event Desc</th> |
|
|
<th>Event Desc</th> |
|
|
<th>Event Date</th> |
|
|
<th>Event Date</th> |
|
|
<th>Status</th> |
|
|
<th>Status</th> |
|
|
@ -141,6 +143,7 @@ |
|
|
</tbody> |
|
|
</tbody> |
|
|
</table> |
|
|
</table> |
|
|
</div> |
|
|
</div> |
|
|
|
|
|
</div> |
|
|
<div class="modal-footer"> |
|
|
<div class="modal-footer"> |
|
|
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button> |
|
|
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button> |
|
|
</div> |
|
|
</div> |
|
|
@ -265,7 +268,7 @@ |
|
|
const fromDate = document.getElementById("fromDate").value; |
|
|
const fromDate = document.getElementById("fromDate").value; |
|
|
const toDate = document.getElementById("toDate").value; |
|
|
const toDate = document.getElementById("toDate").value; |
|
|
|
|
|
|
|
|
$('#detailsModalLabel').text(`${status} Requests for ${zone}`); |
|
|
|
|
|
|
|
|
$('#detailsModalLabel').text(`${status} Requests for zone: ${zone}`); |
|
|
$('#detailsPageLoader').show(); |
|
|
$('#detailsPageLoader').show(); |
|
|
// Clear previous table data |
|
|
// Clear previous table data |
|
|
if ($.fn.DataTable.isDataTable('#detailsTable')) { |
|
|
if ($.fn.DataTable.isDataTable('#detailsTable')) { |
|
|
@ -275,7 +278,12 @@ |
|
|
|
|
|
|
|
|
new bootstrap.Modal(document.getElementById('detailsModal')).show(); |
|
|
new bootstrap.Modal(document.getElementById('detailsModal')).show(); |
|
|
|
|
|
|
|
|
fetch(`/commissionerreview/api/flagpoles/details?zone=${zone}&status=${status}&fromDate=${fromDate}&toDate=${toDate}`) |
|
|
|
|
|
|
|
|
let url = `/commissionerreview/api/flagpoles/details?zone=${zone}&status=${status}&fromDate=${fromDate}&toDate=${toDate}`; |
|
|
|
|
|
if (currentType && currentType !== 'OVERALL') { |
|
|
|
|
|
url += `&applicationType=${currentType}`; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
fetch(url) |
|
|
.then(res => res.json()) |
|
|
.then(res => res.json()) |
|
|
.then(json => { |
|
|
.then(json => { |
|
|
$('#detailsPageLoader').hide(); |
|
|
$('#detailsPageLoader').hide(); |
|
|
@ -302,7 +310,8 @@ |
|
|
function populateDetailsTable(data) { |
|
|
function populateDetailsTable(data) { |
|
|
const tbody = $('#detailsTableBody'); |
|
|
const tbody = $('#detailsTableBody'); |
|
|
tbody.empty(); |
|
|
tbody.empty(); |
|
|
|
|
|
|
|
|
|
|
|
// <td>${formatValue(row.application_option)}</td> |
|
|
|
|
|
// <td>${formatValue(row.installation_type)}</td> |
|
|
data.forEach((row, index) => { |
|
|
data.forEach((row, index) => { |
|
|
tbody.append(` |
|
|
tbody.append(` |
|
|
<tr> |
|
|
<tr> |
|
|
@ -311,13 +320,12 @@ |
|
|
<td>${formatValue(row.applicant_name)}</td> |
|
|
<td>${formatValue(row.applicant_name)}</td> |
|
|
<td>${formatValue(row.mobile_number)}</td> |
|
|
<td>${formatValue(row.mobile_number)}</td> |
|
|
<td>${formatValue(row.application_type)}</td> |
|
|
<td>${formatValue(row.application_type)}</td> |
|
|
<td>${formatValue(row.application_option)}</td> |
|
|
|
|
|
<td>${formatValue(row.installation_type)}</td> |
|
|
|
|
|
|
|
|
|
|
|
<td>${formatValue(row.event_desc)}</td> |
|
|
<td>${formatValue(row.event_desc)}</td> |
|
|
<td>${formatValue(row.event_date)}</td> |
|
|
<td>${formatValue(row.event_date)}</td> |
|
|
<td>${formatValue(row.final_status)}</td> |
|
|
<td>${formatValue(row.final_status)}</td> |
|
|
<td> |
|
|
<td> |
|
|
<button class="btn btn-info btn-sm" onclick="viewStreetDetails(${row.id})"> |
|
|
|
|
|
|
|
|
<button class="btn btn-info btn-sm" onclick="viewStreetDetails(${row.id}, '${row.refid}')"> |
|
|
View Streets |
|
|
View Streets |
|
|
</button> |
|
|
</button> |
|
|
</td> |
|
|
</td> |
|
|
@ -325,29 +333,46 @@ |
|
|
`); |
|
|
`); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
$('#detailsTable').DataTable({ |
|
|
|
|
|
|
|
|
var table = $('#detailsTable').DataTable({ |
|
|
dom: 'Bfrtip', |
|
|
dom: 'Bfrtip', |
|
|
|
|
|
scrollX: true, |
|
|
buttons: [ |
|
|
buttons: [ |
|
|
'excelHtml5', |
|
|
'excelHtml5', |
|
|
'pdfHtml5' |
|
|
'pdfHtml5' |
|
|
] |
|
|
] |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
// Adjust columns after small delay to ensure modal transition ends |
|
|
|
|
|
setTimeout(function () { |
|
|
|
|
|
table.columns.adjust().draw(); |
|
|
|
|
|
}, 200); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function viewStreetDetails(requestId) { |
|
|
|
|
|
$('#streetModalLabel').text(`Street Details for Request ID`); |
|
|
|
|
|
$('#streetTableBody').html('<tr><td colspan="5" class="text-center">Loading...</td></tr>'); |
|
|
|
|
|
new bootstrap.Modal(document.getElementById('streetModal')).show(); |
|
|
|
|
|
|
|
|
function viewStreetDetails(requestId, refId) { |
|
|
|
|
|
$('#streetModalLabel').text(`Street Details for Request: ${refId}`); |
|
|
|
|
|
|
|
|
|
|
|
// Show modal |
|
|
|
|
|
const modal = new bootstrap.Modal(document.getElementById('streetModal')); |
|
|
|
|
|
modal.show(); |
|
|
|
|
|
|
|
|
|
|
|
// Destroy existing DataTable if it exists |
|
|
|
|
|
if ($.fn.DataTable.isDataTable('#streetTable')) { |
|
|
|
|
|
$('#streetTable').DataTable().destroy(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const tbody = $('#streetTableBody'); |
|
|
|
|
|
tbody.empty(); |
|
|
|
|
|
tbody.html('<tr><td colspan="6" class="text-center">Loading...</td></tr>'); |
|
|
|
|
|
|
|
|
fetch(`/commissionerreview/api/flagpoles/street-details?requestId=${requestId}`) |
|
|
fetch(`/commissionerreview/api/flagpoles/street-details?requestId=${requestId}`) |
|
|
.then(res => res.json()) |
|
|
.then(res => res.json()) |
|
|
.then(json => { |
|
|
.then(json => { |
|
|
const tbody = $('#streetTableBody'); |
|
|
|
|
|
tbody.empty(); |
|
|
tbody.empty(); |
|
|
if (json.status === "success" && json.data.length > 0) { |
|
|
if (json.status === "success" && json.data.length > 0) { |
|
|
json.data.forEach(row => { |
|
|
|
|
|
|
|
|
json.data.forEach((row, index) => { |
|
|
tbody.append(` |
|
|
tbody.append(` |
|
|
<tr> |
|
|
<tr> |
|
|
|
|
|
<td>${index + 1}</td> |
|
|
<td>${formatValue(row.zone)}</td> |
|
|
<td>${formatValue(row.zone)}</td> |
|
|
<td>${formatValue(row.ward)}</td> |
|
|
<td>${formatValue(row.ward)}</td> |
|
|
<td>${formatValue(row.street_name)}</td> |
|
|
<td>${formatValue(row.street_name)}</td> |
|
|
@ -356,13 +381,28 @@ |
|
|
</tr> |
|
|
</tr> |
|
|
`); |
|
|
`); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
// Initialize DataTable |
|
|
|
|
|
var table = $('#streetTable').DataTable({ |
|
|
|
|
|
dom: 'Bfrtip', |
|
|
|
|
|
scrollX: true, |
|
|
|
|
|
buttons: [ |
|
|
|
|
|
'excelHtml5', |
|
|
|
|
|
'pdfHtml5' |
|
|
|
|
|
] |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
// Adjust columns |
|
|
|
|
|
setTimeout(function () { |
|
|
|
|
|
table.columns.adjust().draw(); |
|
|
|
|
|
}, 200); |
|
|
} else { |
|
|
} else { |
|
|
tbody.html('<tr><td colspan="5" class="text-center">No street details found</td></tr>'); |
|
|
|
|
|
|
|
|
tbody.html('<tr><td colspan="6" class="text-center">No street details found</td></tr>'); |
|
|
} |
|
|
} |
|
|
}) |
|
|
}) |
|
|
.catch(err => { |
|
|
.catch(err => { |
|
|
console.error("Fetch Error:", err); |
|
|
console.error("Fetch Error:", err); |
|
|
$('#streetTableBody').html('<tr><td colspan="5" class="text-center text-danger">Failed to load data</td></tr>'); |
|
|
|
|
|
|
|
|
tbody.html('<tr><td colspan="6" class="text-center text-danger">Failed to load data</td></tr>'); |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -371,12 +411,18 @@ |
|
|
initDataTable(); |
|
|
initDataTable(); |
|
|
|
|
|
|
|
|
// Bind search button click |
|
|
// Bind search button click |
|
|
$('#searchBtn').click(function () { |
|
|
|
|
|
|
|
|
$('#searchBtn').click(function (e) { |
|
|
|
|
|
e.preventDefault(); |
|
|
loadReport(); |
|
|
loadReport(); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
// Initial load |
|
|
// Initial load |
|
|
loadReport(); |
|
|
loadReport(); |
|
|
|
|
|
|
|
|
|
|
|
// Fix DataTable alignment in modals |
|
|
|
|
|
$('#detailsModal, #streetModal').on('shown.bs.modal', function () { |
|
|
|
|
|
$.fn.dataTable.tables({ visible: true, api: true }).columns.adjust(); |
|
|
|
|
|
}); |
|
|
}); |
|
|
}); |
|
|
</script> |
|
|
</script> |
|
|
|
|
|
|
|
|
@ -389,9 +435,11 @@ |
|
|
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button> |
|
|
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button> |
|
|
</div> |
|
|
</div> |
|
|
<div class="modal-body"> |
|
|
<div class="modal-body"> |
|
|
<table class="table table-bordered table-striped" width="100%"> |
|
|
|
|
|
|
|
|
<div class="table-responsive"> |
|
|
|
|
|
<table id="streetTable" class="table table-bordered table-striped" width="100%"> |
|
|
<thead class="table-dark"> |
|
|
<thead class="table-dark"> |
|
|
<tr> |
|
|
<tr> |
|
|
|
|
|
<th>S.No</th> |
|
|
<th>Zone</th> |
|
|
<th>Zone</th> |
|
|
<th>Ward</th> |
|
|
<th>Ward</th> |
|
|
<th>Street Name</th> |
|
|
<th>Street Name</th> |
|
|
@ -404,6 +452,7 @@ |
|
|
</tbody> |
|
|
</tbody> |
|
|
</table> |
|
|
</table> |
|
|
</div> |
|
|
</div> |
|
|
|
|
|
</div> |
|
|
<div class="modal-footer"> |
|
|
<div class="modal-footer"> |
|
|
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button> |
|
|
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button> |
|
|
</div> |
|
|
</div> |
|
|
|