@ -2066,17 +2066,17 @@
< div class = "col-md-6" > < label class = "form-label" > Street Name< / label > < input id = "editStreetName" class = "form-control" value = "${(s.streetName || '').replace(/" / g , ' & quot ; ' ) } " readonly > < / div >
< div class = "col-md-6" > < label class = "form-label" > Zone< / label > < input id = "editZone" class = "form-control" value = "${(s.zone || '').replace(/" / g , ' & quot ; ' ) } " readonly > < / div >
< div class = "col-md-6" > < label class = "form-label" > Ward< / label > < input id = "editWard" class = "form-control" value = "${(s.ward || '').replace(/" / g , ' & quot ; ' ) } " readonly > < / div >
< div class = "col-md-6" > < label class = "form-label" > No of Poles< / label > < input id = "editPoles" type = "number" class = "form-control" value = "${s.noofpoles || ''}" > < / div >
< div class = "col-md-6" > < label class = "form-label" > No of Poles< / label > < input id = "editPoles" type = "number" class = "form-control" min = "1" step = "1" value = "${s.noofpoles || ''}" required > < / div >
< div class = "col-md-6" > < label class = "form-label" > Height (m)< / label > < input id = "editHeight" type = "number" step = "0.1" min = "1" max = "3.5" placeholder = "Enter height up to 3.5m" class = "form-control" value = "${s.poleheight || ''}" oninput = "validateHeight(this)" > < / div >
< div class = "col-md-6" > < label class = "form-label" > Latitude< / label > < input id = "editLat" class = "form-control" value = "${s.lat || ''}" readonly > < / div >
< div class = "col-md-6" > < label class = "form-label" > Longitude< / label > < input id = "editLong" class = "form-control" value = "${s.long || ''}" readonly > < / div >
< div class = "col-md-6" > < label class = "form-label" > Duration< / label > < select id = "editNoOfDays" class = "form-control" > < option value = "" > Select days< / option > < / select > < / div >
< div class = "col-md-6" > < label class = "form-label" > Pole Material< / label > < select id = "editPoleMaterial" class = "form-control" > < option value = "${s.polematerial}" > ${s.polematerial}< / option > < / select > < / div >
< div class = "col-md-6" > < label class = "form-label" > Flag Material< / label > < select id = "editFlagMaterial" class = "form-control" > < option value = "${s.flagmaterial}" > ${s.flagmaterial}< / option > < / select > < / div >
< / div >
`;
// < div class = "col-md-6" > < label class = "form-label" > Spacing< / label > < input id = "editSpacing" type = "number" class = "form-control" value = "${s.spacepoles || ''}" > < / div >
$('#editFormContainer').html(formHTML);
@ -2129,12 +2129,24 @@
return;
}
const polesVal = parseInt($('#editPoles').val(), 10);
if (isNaN(polesVal) || polesVal < 1 ) {
Swal.fire({
icon: "warning",
title: "Invalid Input",
text: "Number of poles must be at least 1"
});
$('#editPoles').focus();
return;
}
const updated = {
...streetsData[editIndex],
streetName: $('#editStreetName').val() || streetsData[editIndex].streetName,
zone: $('#editZone').val() || streetsData[editIndex].zone,
ward: $('#editWard').val() || streetsData[editIndex].ward,
noofpoles: $('#editPoles').val() || streetsData[editIndex].noofpoles,
// noofpoles: $('#editPoles').val() || streetsData[editIndex].noofpoles,
noofpoles: polesVal, // ✅ SAFE
poleheight: $('#editHeight').val() || streetsData[editIndex].poleheight,
lat: $('#editLat').val() || streetsData[editIndex].lat,
long: $('#editLong').val() || streetsData[editIndex].long,