From 2e46b6631b0908af45a254ba19206055c34c307c Mon Sep 17 00:00:00 2001 From: Edie Lemoine Date: Thu, 5 Dec 2019 15:54:40 +0100 Subject: [PATCH] fix: select the first marker on map view so there can't be orders made with empty pickup location --- src/components/Pickup/Map/Leaflet.vue | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/components/Pickup/Map/Leaflet.vue b/src/components/Pickup/Map/Leaflet.vue index f353b498..111dca47 100644 --- a/src/components/Pickup/Map/Leaflet.vue +++ b/src/components/Pickup/Map/Leaflet.vue @@ -213,6 +213,8 @@ export default { this.fitToMarkers(); this.createCenterMarker(); this.addMapEvents(); + + this.selectFirstMarker(); }); }, @@ -362,6 +364,15 @@ export default { getChoiceByMarkerId(id) { return this.data.choices.find((choice) => choice.name === id); }, + + /** + * Select the first marker in the choices list. + */ + selectFirstMarker() { + const firstChoice = this.markers[0]; + + this.selectedMarker = this.selectMarker(firstChoice); + }, }, };