[Map] Render real Neshan map on shift/job detail pages
The detail pages showed a 'map coming later' placeholder. Add a read-only Neshan web map (Leaflet SDK) showing the facility marker when NeshanMapKey is set, plus a 'مسیریابی در نشان' directions link; falls back to coordinates when no key. New _NeshanMap shared partial loads the SDK and inits #facmap. Shift/Job Details models now expose MapKey via SettingsService. Coordinates are emitted with InvariantCulture so the decimal point/digits don't break JS. The facility registration picker already used Neshan; this reuses the same key. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
@model string
|
||||
@*
|
||||
Read-only Neshan map. Render once per page AFTER an element <div id="facmap"
|
||||
data-lat="…" data-lng="…"> exists. Pass the Neshan web key as the model.
|
||||
The SDK is a synchronous script, so the init below runs once L is defined.
|
||||
*@
|
||||
<link rel="stylesheet" href="https://static.neshan.org/sdk/leaflet/1.4.0/neshan-sdk/v1.0.8/index.css" />
|
||||
<script src="https://static.neshan.org/sdk/leaflet/1.4.0/neshan-sdk/v1.0.8/index.js"></script>
|
||||
<script>
|
||||
(function () {
|
||||
var el = document.getElementById('facmap');
|
||||
if (!el || !window.L) return;
|
||||
var lat = parseFloat(el.dataset.lat), lng = parseFloat(el.dataset.lng);
|
||||
if (isNaN(lat) || isNaN(lng)) return;
|
||||
var map = new L.Map('facmap', {
|
||||
key: '@Model', maptype: 'neshan', poi: true, traffic: false,
|
||||
center: [lat, lng], zoom: 15
|
||||
});
|
||||
L.marker([lat, lng]).addTo(map);
|
||||
})();
|
||||
</script>
|
||||
Reference in New Issue
Block a user