From 28b9e9d61dddf54056082c6f36f39f0a1423e9d6 Mon Sep 17 00:00:00 2001 From: Eugene Burmakin Date: Wed, 12 Mar 2025 21:57:30 +0100 Subject: [PATCH] Add a button to cancel visit selection --- app/javascript/maps/visits.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/app/javascript/maps/visits.js b/app/javascript/maps/visits.js index 80e4e758..266cde0d 100644 --- a/app/javascript/maps/visits.js +++ b/app/javascript/maps/visits.js @@ -918,9 +918,23 @@ export class VisitsManager { selectionText.className = 'text-sm text-center mt-1 text-gray-500'; selectionText.textContent = `${checkedBoxes.length} visits selected`; + // Add cancel selection button + const cancelButton = document.createElement('button'); + cancelButton.className = 'btn btn-xs btn-neutral w-full mt-2'; + cancelButton.textContent = 'Cancel Selection'; + cancelButton.addEventListener('click', () => { + // Uncheck all checkboxes + checkedBoxes.forEach(checkbox => { + checkbox.checked = false; + }); + // Update UI to remove action buttons + this.updateMergeUI(container); + }); + // Add elements to container actionsContainer.appendChild(buttonGrid); actionsContainer.appendChild(selectionText); + actionsContainer.appendChild(cancelButton); // Insert after the lowest visit item lowestVisitItem.insertAdjacentElement('afterend', actionsContainer);