Approximate-location map on aggregated listings (Divar coords)
We captured Divar's privacy-fuzzed coords on RawListing but discarded them for the listings that need them: unnamed-facility shifts/jobs dropped them (to avoid piling on the shared placeholder) and applicants had no coordinate field at all. - Add Lat/Lng to Shift, JobOpening, TalentListing (migration ListingApproxCoords). - Publish stores the source ad's approx coords on each aggregated listing. - Detail pages render the map from the listing's own coords (fallback: facility), and aggregated coords show as a shaded «محدودهٔ تقریبی» circle (not a precise pin) via _NeshanMap data-approx, with a disclaimer. Applicants get a map card (they had none) + the page now loads the Neshan key. Only Divar provides coords; the map needs NeshanMapKey set in admin settings. Existing rows get coords once reprocessed (RawListing already has them). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -12,10 +12,17 @@
|
||||
if (!el || !window.L) return;
|
||||
var lat = parseFloat(el.dataset.lat), lng = parseFloat(el.dataset.lng);
|
||||
if (isNaN(lat) || isNaN(lng)) return;
|
||||
// Approximate (aggregated) listings show a shaded AREA circle, not a precise pin.
|
||||
var approx = el.dataset.approx === 'true';
|
||||
var map = new L.Map('facmap', {
|
||||
key: '@Model', maptype: 'neshan', poi: true, traffic: false,
|
||||
center: [lat, lng], zoom: 15
|
||||
key: '@Model', maptype: 'neshan', poi: !approx, traffic: false,
|
||||
center: [lat, lng], zoom: approx ? 14 : 15
|
||||
});
|
||||
L.marker([lat, lng]).addTo(map);
|
||||
if (approx) {
|
||||
var radius = parseInt(el.dataset.radius || '700', 10);
|
||||
L.circle([lat, lng], { radius: radius, color: '#e07b39', weight: 1, fillColor: '#e07b39', fillOpacity: 0.18 }).addTo(map);
|
||||
} else {
|
||||
L.marker([lat, lng]).addTo(map);
|
||||
}
|
||||
})();
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user