From 5e8c9ea38e39dcfc0ef6a97df091beabd201d0c0 Mon Sep 17 00:00:00 2001 From: Shawn Jackson Date: Wed, 18 Mar 2026 18:21:01 -0700 Subject: [PATCH] RE1-T105 Map fixes --- .../User/Views/Dispatch/AddArchivedCall.cshtml | 17 ++++++++++++++--- .../Areas/User/Views/Dispatch/NewCall.cshtml | 17 ++++++++++++++--- .../Areas/User/Views/Dispatch/UpdateCall.cshtml | 17 ++++++++++++++--- .../resgrid.dispatch.addArchivedCall.js | 15 +++++++++++++-- .../dispatch/resgrid.dispatch.editcall.js | 16 ++++++++++++++-- .../dispatch/resgrid.dispatch.newcall.js | 15 +++++++++++++-- .../app/internal/routes/resgrid.routes.edit.js | 6 ++++-- 7 files changed, 86 insertions(+), 17 deletions(-) diff --git a/Web/Resgrid.Web/Areas/User/Views/Dispatch/AddArchivedCall.cshtml b/Web/Resgrid.Web/Areas/User/Views/Dispatch/AddArchivedCall.cshtml index 900da571..11529c95 100644 --- a/Web/Resgrid.Web/Areas/User/Views/Dispatch/AddArchivedCall.cshtml +++ b/Web/Resgrid.Web/Areas/User/Views/Dispatch/AddArchivedCall.cshtml @@ -66,8 +66,6 @@
@Html.AntiForgeryToken() - @Html.HiddenFor(m => m.Latitude) - @Html.HiddenFor(m => m.Longitude) @Html.HiddenFor(m => m.Call.ReportingUserId) @Html.HiddenFor(m => m.Call.CallFormData)
@@ -181,7 +179,20 @@ @localizer["W3wHelp"] @localizer["LearnMore"]
-
+
+
+
+ Lat + + Lng + + + Set Pin on Map + +
+
+
+
diff --git a/Web/Resgrid.Web/Areas/User/Views/Dispatch/NewCall.cshtml b/Web/Resgrid.Web/Areas/User/Views/Dispatch/NewCall.cshtml index e9034654..89d4e4e7 100644 --- a/Web/Resgrid.Web/Areas/User/Views/Dispatch/NewCall.cshtml +++ b/Web/Resgrid.Web/Areas/User/Views/Dispatch/NewCall.cshtml @@ -63,8 +63,6 @@
@Html.AntiForgeryToken() - @Html.HiddenFor(m => m.Latitude) - @Html.HiddenFor(m => m.Longitude) @Html.HiddenFor(m => m.Call.ReportingUserId) @Html.HiddenFor(m => m.Call.CallFormData)
@@ -174,7 +172,20 @@ @localizer["W3wHelp"] @localizer["LearnMore"]
-
+
+
+
+ Lat + + Lng + + + Set Pin on Map + +
+
+
+
diff --git a/Web/Resgrid.Web/Areas/User/Views/Dispatch/UpdateCall.cshtml b/Web/Resgrid.Web/Areas/User/Views/Dispatch/UpdateCall.cshtml index 5a8c9880..83b3165f 100644 --- a/Web/Resgrid.Web/Areas/User/Views/Dispatch/UpdateCall.cshtml +++ b/Web/Resgrid.Web/Areas/User/Views/Dispatch/UpdateCall.cshtml @@ -63,8 +63,6 @@
@Html.AntiForgeryToken() - @Html.HiddenFor(m => m.Latitude) - @Html.HiddenFor(m => m.Longitude) @Html.HiddenFor(m => m.Call.CallId) @Html.HiddenFor(m => m.Call.ReportingUserId) @Html.HiddenFor(m => m.Call.CallFormData) @@ -175,7 +173,20 @@ @localizer["W3wHelp"] @localizer["LearnMore"]
-
+
+
+
+ Lat + + Lng + + + Set Pin on Map + +
+
+
+
diff --git a/Web/Resgrid.Web/wwwroot/js/app/internal/dispatch/resgrid.dispatch.addArchivedCall.js b/Web/Resgrid.Web/wwwroot/js/app/internal/dispatch/resgrid.dispatch.addArchivedCall.js index 6fbcc3b5..c282f7aa 100644 --- a/Web/Resgrid.Web/wwwroot/js/app/internal/dispatch/resgrid.dispatch.addArchivedCall.js +++ b/Web/Resgrid.Web/wwwroot/js/app/internal/dispatch/resgrid.dispatch.addArchivedCall.js @@ -115,7 +115,7 @@ var resgrid; if (result && result.Data && result.Data.Latitude && result.Data.Longitude) { var lat = result.Data.Latitude; var lng = result.Data.Longitude; - map.panTo(new L.LatLng(lat, lng)); + map.setView(new L.LatLng(lat, lng), 16); $("#Latitude").val(lat.toString()); $("#Longitude").val(lng.toString()); resgrid.dispatch.addArchivedCall.setMarkerLocation(lat, lng); @@ -126,6 +126,17 @@ var resgrid; .catch(function(err) { console.error("Geocode error:", err); }); evt.preventDefault(); }); + $("#setPinButton").click(function (evt) { + var lat = parseFloat($("#Latitude").val()); + var lng = parseFloat($("#Longitude").val()); + if (isNaN(lat) || isNaN(lng)) { + alert("Please enter valid numeric latitude and longitude values."); + return false; + } + map.setView(new L.LatLng(lat, lng), 16); + resgrid.dispatch.addArchivedCall.setMarkerLocation(lat, lng); + evt.preventDefault(); + }); $("#findw3wButton").click(function (evt) { var word = jQuery.trim($("#What3Word").val()); if (word.length < 1) @@ -136,7 +147,7 @@ var resgrid; type: 'GET' }).done(function (data) { if (data && data.Latitude && data.Longitude) { - map.panTo(new L.LatLng(data.Latitude, data.Longitude)); + map.setView(new L.LatLng(data.Latitude, data.Longitude), 16); $("#Latitude").val(data.Latitude); $("#Longitude").val(data.Longitude); diff --git a/Web/Resgrid.Web/wwwroot/js/app/internal/dispatch/resgrid.dispatch.editcall.js b/Web/Resgrid.Web/wwwroot/js/app/internal/dispatch/resgrid.dispatch.editcall.js index e7fdd9cc..8caa0436 100644 --- a/Web/Resgrid.Web/wwwroot/js/app/internal/dispatch/resgrid.dispatch.editcall.js +++ b/Web/Resgrid.Web/wwwroot/js/app/internal/dispatch/resgrid.dispatch.editcall.js @@ -124,7 +124,7 @@ var resgrid; if (result && result.Data && result.Data.Latitude != null && result.Data.Longitude != null) { var lat = result.Data.Latitude; var lng = result.Data.Longitude; - map.panTo(new L.LatLng(lat, lng)); + map.setView(new L.LatLng(lat, lng), 16); $("#Latitude").val(lat.toString()); $("#Longitude").val(lng.toString()); resgrid.dispatch.editcall.setMarkerLocation(lat.toString(), lng.toString()); @@ -146,7 +146,7 @@ var resgrid; type: 'GET' }).done(function (data) { if (data && data.Latitude && data.Longitude) { - map.panTo(new L.LatLng(data.Latitude, data.Longitude)); + map.setView(new L.LatLng(data.Latitude, data.Longitude), 16); $("#Latitude").val(data.Latitude); $("#Longitude").val(data.Longitude); @@ -162,6 +162,18 @@ var resgrid; evt.preventDefault(); }); + $("#setPinButton").click(function (evt) { + var lat = parseFloat($("#Latitude").val()); + var lng = parseFloat($("#Longitude").val()); + if (isNaN(lat) || isNaN(lng)) { + alert("Please enter valid numeric latitude and longitude values."); + return false; + } + map.setView(new L.LatLng(lat, lng), 16); + resgrid.dispatch.editcall.setMarkerLocation(lat.toString(), lng.toString()); + evt.preventDefault(); + }); + $('#protocolQuestionWindow').on('show.bs.modal', function (event) { var protocolId = $(event.relatedTarget).data('protocolid'); diff --git a/Web/Resgrid.Web/wwwroot/js/app/internal/dispatch/resgrid.dispatch.newcall.js b/Web/Resgrid.Web/wwwroot/js/app/internal/dispatch/resgrid.dispatch.newcall.js index a73c6491..5affd67b 100644 --- a/Web/Resgrid.Web/wwwroot/js/app/internal/dispatch/resgrid.dispatch.newcall.js +++ b/Web/Resgrid.Web/wwwroot/js/app/internal/dispatch/resgrid.dispatch.newcall.js @@ -120,7 +120,7 @@ var resgrid; if (result && result.Data && result.Data.Latitude != null && result.Data.Longitude != null) { var lat = result.Data.Latitude; var lng = result.Data.Longitude; - map.panTo(new L.LatLng(lat, lng)); + map.setView(new L.LatLng(lat, lng), 16); $("#Latitude").val(lat.toString()); $("#Longitude").val(lng.toString()); resgrid.dispatch.newcall.setMarkerLocation(lat, lng); @@ -141,7 +141,7 @@ var resgrid; type: 'GET' }).done(function (data) { if (data && data.Latitude != null && data.Longitude != null) { - map.panTo(new L.LatLng(data.Latitude, data.Longitude)); + map.setView(new L.LatLng(data.Latitude, data.Longitude), 16); $("#Latitude").val(data.Latitude); $("#Longitude").val(data.Longitude); @@ -156,6 +156,17 @@ var resgrid; }); evt.preventDefault(); }); + $("#setPinButton").click(function (evt) { + var lat = parseFloat($("#Latitude").val()); + var lng = parseFloat($("#Longitude").val()); + if (isNaN(lat) || isNaN(lng)) { + alert("Please enter valid numeric latitude and longitude values."); + return false; + } + map.setView(new L.LatLng(lat, lng), 16); + resgrid.dispatch.newcall.setMarkerLocation(lat, lng); + evt.preventDefault(); + }); var personnelTable = $("#personnelGrid").DataTable({ ajax: { url: resgrid.absoluteBaseUrl + '/User/Personnel/GetPersonnelForCallGrid?callLat=' + $("#Latitude").val() + '&callLong=' + $("#Longitude").val(), dataSrc: '' }, paging: false, diff --git a/Web/Resgrid.Web/wwwroot/js/app/internal/routes/resgrid.routes.edit.js b/Web/Resgrid.Web/wwwroot/js/app/internal/routes/resgrid.routes.edit.js index 8511290d..e263549a 100644 --- a/Web/Resgrid.Web/wwwroot/js/app/internal/routes/resgrid.routes.edit.js +++ b/Web/Resgrid.Web/wwwroot/js/app/internal/routes/resgrid.routes.edit.js @@ -37,6 +37,7 @@ $(document).ready(function () { editStops.forEach(function (stop, index) { if (stop.lat != null && stop.lng != null && Number.isFinite(Number(stop.lat)) && Number.isFinite(Number(stop.lng))) { var m = L.marker([stop.lat, stop.lng]).addTo(map); + m.bindTooltip((index + 1) + '. ' + escapeHtml(stop.Name), { permanent: true, direction: 'right' }); m.bindPopup('' + (index + 1) + '. ' + escapeHtml(stop.Name) + ''); group.push(m); } @@ -288,8 +289,9 @@ $(document).ready(function () { editStops = editStops.filter(function (s) { return s.id !== stopId; }); editStops.forEach(function (stop, index) { if (stop.lat != null && stop.lng != null && Number.isFinite(Number(stop.lat)) && Number.isFinite(Number(stop.lng))) { - L.marker([stop.lat, stop.lng]).addTo(map) - .bindPopup('' + (index + 1) + '. ' + escapeHtml(stop.Name) + ''); + var m = L.marker([stop.lat, stop.lng]).addTo(map); + m.bindTooltip((index + 1) + '. ' + escapeHtml(stop.Name), { permanent: true, direction: 'right' }); + m.bindPopup('' + (index + 1) + '. ' + escapeHtml(stop.Name) + ''); } }); }