From 6e773b6b519b11ba6bf5839c0789769dee97f106 Mon Sep 17 00:00:00 2001 From: Eugene Burmakin Date: Thu, 21 Aug 2025 19:52:51 +0200 Subject: [PATCH] Add current location to a visit popup as a fallback --- app/javascript/maps/visits.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/app/javascript/maps/visits.js b/app/javascript/maps/visits.js index b55b52d2..3a60c0e0 100644 --- a/app/javascript/maps/visits.js +++ b/app/javascript/maps/visits.js @@ -1358,11 +1358,15 @@ export class VisitsManager { Location
@@ -1431,6 +1435,12 @@ export class VisitsManager { const newName = event.target.querySelector('input').value; const selectedPlaceId = event.target.querySelector('select[name="place"]').value; + // Validate that we have a valid place_id + if (!selectedPlaceId || selectedPlaceId === '') { + showFlashMessage('error', 'Please select a valid location'); + return; + } + // Get the selected place name from the dropdown const selectedOption = event.target.querySelector(`select[name="place"] option[value="${selectedPlaceId}"]`); const selectedPlaceName = selectedOption ? selectedOption.textContent.trim() : '';