Browse Source

changes in requestform

master
yoganandhan 9 months ago
parent
commit
dfa07ee0ca
  1. 18
      src/main/resources/templates/modules/flagpolesregistration/requestform.html

18
src/main/resources/templates/modules/flagpolesregistration/requestform.html

@ -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">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">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">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">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">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">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">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">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 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>
`; `;
// <div class="col-md-6"><label class="form-label">Spacing</label><input id="editSpacing" type="number" class="form-control" value="${s.spacepoles || ''}"></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); $('#editFormContainer').html(formHTML);
@ -2129,12 +2129,24 @@
return; 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 = { const updated = {
...streetsData[editIndex], ...streetsData[editIndex],
streetName: $('#editStreetName').val() || streetsData[editIndex].streetName, streetName: $('#editStreetName').val() || streetsData[editIndex].streetName,
zone: $('#editZone').val() || streetsData[editIndex].zone, zone: $('#editZone').val() || streetsData[editIndex].zone,
ward: $('#editWard').val() || streetsData[editIndex].ward, 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, poleheight: $('#editHeight').val() || streetsData[editIndex].poleheight,
lat: $('#editLat').val() || streetsData[editIndex].lat, lat: $('#editLat').val() || streetsData[editIndex].lat,
long: $('#editLong').val() || streetsData[editIndex].long, long: $('#editLong').val() || streetsData[editIndex].long,

Loading…
Cancel
Save