Skip to content

RE1-T105 Map fixes#304

Merged
ucswift merged 1 commit intomasterfrom
develop
Mar 19, 2026
Merged

RE1-T105 Map fixes#304
ucswift merged 1 commit intomasterfrom
develop

Conversation

@ucswift
Copy link
Copy Markdown
Member

@ucswift ucswift commented Mar 19, 2026

Summary by CodeRabbit

  • New Features
    • Latitude and longitude input fields now available in dispatch call forms for direct coordinate entry
    • "Set Pin on Map" button allows users to apply entered coordinates directly to the map
    • Route stop markers on maps now display their order number and name in tooltips

@request-info
Copy link
Copy Markdown

request-info bot commented Mar 19, 2026

Thanks for opening this, but we'd appreciate a little more information. Could you update it with more details?

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 19, 2026

📝 Walkthrough

Walkthrough

This PR updates dispatch call creation and editing interfaces to replace hidden coordinate form fields with visible, editable latitude/longitude inputs and a "Set Pin on Map" button. It also updates map navigation behavior to enforce zoom level 16 and adds marker tooltips displaying stop information in the routes editor.

Changes

Cohort / File(s) Summary
Dispatch View Updates
Web/Resgrid.Web/Areas/User/Views/Dispatch/AddArchivedCall.cshtml, NewCall.cshtml, UpdateCall.cshtml
Removed server-rendered hidden form fields for Latitude/Longitude. Added visible input fields bound to Latitude/Longitude via asp-for attribute, a "Set Pin on Map" action link button, and adjusted map container styling with top margin.
Dispatch JavaScript Handlers
Web/Resgrid.Web/wwwroot/js/app/internal/dispatch/resgrid.dispatch.addArchivedCall.js, resgrid.dispatch.editcall.js, resgrid.dispatch.newcall.js
Updated map view behavior to enforce zoom level 16 by replacing map.panTo() with map.setView(..., 16) in geocoding and What3Words flows. Added #setPinButton click handlers that parse and validate latitude/longitude inputs, set map view to provided coordinates at zoom 16, and update marker location.
Routes Editor Enhancement
Web/Resgrid.Web/wwwroot/js/app/internal/routes/resgrid.routes.edit.js
Enhanced route stop markers to display permanent right-oriented tooltips containing ordinal index and HTML-escaped stop name during initial rendering and after marker redraw operations.

Sequence Diagram

sequenceDiagram
    participant User
    participant UI as Set Pin Button
    participant Handler as JavaScript Handler
    participant Validator as Validation Logic
    participant Map as Leaflet Map
    participant Marker as Marker
    
    User->>UI: Click "Set Pin on Map"
    UI->>Handler: Trigger click event
    Handler->>Handler: Read `#Latitude` & `#Longitude` values
    Handler->>Validator: Validate numeric input
    alt Invalid Input
        Validator-->>Handler: Return NaN
        Handler->>User: Show alert (invalid coordinates)
    else Valid Input
        Validator-->>Handler: Return parsed coordinates
        Handler->>Map: setView(coordinates, zoom: 16)
        Map->>Map: Pan and zoom to location
        Handler->>Marker: Update marker position
        Marker->>Map: Display at new location
        Handler->>User: Update complete
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Possibly related PRs

  • RE1-T105 More custom maps work #302: Modifies the same dispatch views and JavaScript files, with overlapping changes to map behavior, coordinate handling, and form field management across the dispatch module.
🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title "RE1-T105 Map fixes" references a ticket identifier but lacks specificity about the actual changes. It describes map-related work generally but does not clearly convey what was fixed or improved. Consider expanding the title to describe the specific fix, such as "Add manual coordinate input and pin placement for dispatch maps" or similar, to make the change intent clear without requiring ticket context.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch develop
📝 Coding Plan
  • Generate coding plan for human review comments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (3)
Web/Resgrid.Web/Areas/User/Views/Dispatch/AddArchivedCall.cshtml (1)

182-195: Hardcoded strings should be localized.

The new coordinate input UI uses hardcoded English strings ("Lat", "Lng", "Set Pin on Map") while the rest of the view uses @localizer[] for internationalization. For consistency, these strings should be added to the localization resources.

♻️ Suggested localization
 <div class="row" style="margin-top: 8px;">
     <div class="col-md-11">
         <div class="input-group input-group-sm">
-            <span class="input-group-addon">Lat</span>
+            <span class="input-group-addon">@localizer["LatitudeLabel"]</span>
             <input type="text" class="form-control" asp-for="Latitude" placeholder="Latitude">
-            <span class="input-group-addon">Lng</span>
+            <span class="input-group-addon">@localizer["LongitudeLabel"]</span>
             <input type="text" class="form-control" asp-for="Longitude" placeholder="Longitude">
             <span class="input-group-btn">
-                <a id="setPinButton" href="#" class="btn btn-warning">Set Pin on Map</a>
+                <a id="setPinButton" href="#" class="btn btn-warning">@localizer["SetPinOnMap"]</a>
             </span>
         </div>
     </div>
 </div>
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@Web/Resgrid.Web/Areas/User/Views/Dispatch/AddArchivedCall.cshtml` around
lines 182 - 195, Replace the hardcoded UI strings in the coordinate input block
with localized resource lookups: change the span text nodes "Lat" and "Lng" and
the anchor text "Set Pin on Map" (anchor id="setPinButton", inputs using
asp-for="Latitude"/"Longitude") to use the view localizer (e.g.
`@localizer`["Lat"], `@localizer`["Lng"], `@localizer`["SetPinOnMap"]) and add
corresponding keys ("Lat", "Lng", "SetPinOnMap") to the .resx resource files for
the view so translations are available.
Web/Resgrid.Web/Areas/User/Views/Dispatch/UpdateCall.cshtml (1)

176-189: Same localization issue as AddArchivedCall.cshtml.

The hardcoded strings "Lat", "Lng", and "Set Pin on Map" should be localized for consistency with the rest of the view. See the suggestion in AddArchivedCall.cshtml for the recommended pattern.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@Web/Resgrid.Web/Areas/User/Views/Dispatch/UpdateCall.cshtml` around lines 176
- 189, Replace the hardcoded UI strings in the Dispatch view with localized
resource lookups: change the input-group addon texts "Lat" and "Lng" to use the
localization helper (e.g., `@Localizer`["Lat"] and `@Localizer`["Lng"]) and change
the button label "Set Pin on Map" to a localized key (e.g.,
`@Localizer`["SetPinOnMap"]) on the element with id="setPinButton"; ensure the
resource keys ("Lat", "Lng", "SetPinOnMap") are added to the appropriate
resource file so translations are available.
Web/Resgrid.Web/Areas/User/Views/Dispatch/NewCall.cshtml (1)

175-188: Same localization issue as other dispatch views.

The hardcoded strings "Lat", "Lng", and "Set Pin on Map" should be localized. Since this pattern is repeated across NewCall.cshtml, UpdateCall.cshtml, and AddArchivedCall.cshtml, consider adding the localization keys once and applying them consistently to all three views.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@Web/Resgrid.Web/Areas/User/Views/Dispatch/NewCall.cshtml` around lines 175 -
188, Replace the hardcoded UI strings in the NewCall view with localized
resources: change the "Lat" and "Lng" input-group addons and the "Set Pin on
Map" anchor text to use the shared localization keys (apply the same keys across
NewCall.cshtml, UpdateCall.cshtml, and AddArchivedCall.cshtml). Locate the
elements by the asp-for attributes for Latitude and Longitude and the anchor
with id="setPinButton" and replace their literal strings with calls to the app's
localization helper (use the existing resource keys you add, e.g. Dispatch.Lat,
Dispatch.Lng, Dispatch.SetPin) so all three views consume the same keys.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@Web/Resgrid.Web/Areas/User/Views/Dispatch/AddArchivedCall.cshtml`:
- Around line 182-195: Replace the hardcoded UI strings in the coordinate input
block with localized resource lookups: change the span text nodes "Lat" and
"Lng" and the anchor text "Set Pin on Map" (anchor id="setPinButton", inputs
using asp-for="Latitude"/"Longitude") to use the view localizer (e.g.
`@localizer`["Lat"], `@localizer`["Lng"], `@localizer`["SetPinOnMap"]) and add
corresponding keys ("Lat", "Lng", "SetPinOnMap") to the .resx resource files for
the view so translations are available.

In `@Web/Resgrid.Web/Areas/User/Views/Dispatch/NewCall.cshtml`:
- Around line 175-188: Replace the hardcoded UI strings in the NewCall view with
localized resources: change the "Lat" and "Lng" input-group addons and the "Set
Pin on Map" anchor text to use the shared localization keys (apply the same keys
across NewCall.cshtml, UpdateCall.cshtml, and AddArchivedCall.cshtml). Locate
the elements by the asp-for attributes for Latitude and Longitude and the anchor
with id="setPinButton" and replace their literal strings with calls to the app's
localization helper (use the existing resource keys you add, e.g. Dispatch.Lat,
Dispatch.Lng, Dispatch.SetPin) so all three views consume the same keys.

In `@Web/Resgrid.Web/Areas/User/Views/Dispatch/UpdateCall.cshtml`:
- Around line 176-189: Replace the hardcoded UI strings in the Dispatch view
with localized resource lookups: change the input-group addon texts "Lat" and
"Lng" to use the localization helper (e.g., `@Localizer`["Lat"] and
`@Localizer`["Lng"]) and change the button label "Set Pin on Map" to a localized
key (e.g., `@Localizer`["SetPinOnMap"]) on the element with id="setPinButton";
ensure the resource keys ("Lat", "Lng", "SetPinOnMap") are added to the
appropriate resource file so translations are available.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 79a2244d-6ed9-4b20-b189-b5e41c5b91e3

📥 Commits

Reviewing files that changed from the base of the PR and between c306095 and 5e8c9ea.

📒 Files selected for processing (7)
  • Web/Resgrid.Web/Areas/User/Views/Dispatch/AddArchivedCall.cshtml
  • Web/Resgrid.Web/Areas/User/Views/Dispatch/NewCall.cshtml
  • Web/Resgrid.Web/Areas/User/Views/Dispatch/UpdateCall.cshtml
  • Web/Resgrid.Web/wwwroot/js/app/internal/dispatch/resgrid.dispatch.addArchivedCall.js
  • Web/Resgrid.Web/wwwroot/js/app/internal/dispatch/resgrid.dispatch.editcall.js
  • Web/Resgrid.Web/wwwroot/js/app/internal/dispatch/resgrid.dispatch.newcall.js
  • Web/Resgrid.Web/wwwroot/js/app/internal/routes/resgrid.routes.edit.js

@ucswift
Copy link
Copy Markdown
Member Author

ucswift commented Mar 19, 2026

Approve

Copy link
Copy Markdown

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR is approved.

@ucswift ucswift merged commit 6f96fa7 into master Mar 19, 2026
18 of 19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant