|
|
@@ -3,6 +3,10 @@ let exportIds = [];
|
|
|
let markerMap = {};
|
|
|
|
|
|
// noinspection JSUnusedGlobalSymbols
|
|
|
+function getMarkerKey(locationId) {
|
|
|
+ return `marker-${locationId}`;
|
|
|
+}
|
|
|
+
|
|
|
function initialiseLocations() {
|
|
|
|
|
|
if(!infoWindow) {
|
|
|
@@ -46,7 +50,7 @@ function initialiseLocations() {
|
|
|
|
|
|
bounds.extend(position);
|
|
|
|
|
|
- let key = "marker-" + location.id;
|
|
|
+ let key = getMarkerKey(location.id);
|
|
|
|
|
|
let marker = new google.maps.Marker(options);
|
|
|
marker.location = location;
|
|
|
@@ -67,7 +71,7 @@ function initialiseLocations() {
|
|
|
|
|
|
let locationId = parseInt($(event.currentTarget).attr("data-export-location-id"));
|
|
|
let index = exportIds.indexOf(locationId);
|
|
|
- let key = "marker-" + locationId;
|
|
|
+ let key = getMarkerKey(locationId);
|
|
|
let marker = markerMap[key];
|
|
|
|
|
|
if(index === -1) {
|
|
|
@@ -124,6 +128,20 @@ function initialiseLocations() {
|
|
|
|
|
|
new AddLocationsToProjectModal();
|
|
|
|
|
|
+ $(".btn-map").on("click", event => {
|
|
|
+ const locationId = $(event.currentTarget).data("location-id");
|
|
|
+ const key = getMarkerKey(locationId);
|
|
|
+ const marker = markerMap[key];
|
|
|
+
|
|
|
+ const map = maps.map;
|
|
|
+
|
|
|
+ const center = marker.getPosition();
|
|
|
+ map.setCenter(center);
|
|
|
+ map.setZoom(14);
|
|
|
+
|
|
|
+ displayInfoWindow(markerMap[key]);
|
|
|
+ });
|
|
|
+
|
|
|
}
|
|
|
|
|
|
function displayInfoWindow(marker) {
|