diff --git a/resources/views/tracker.blade.php b/resources/views/tracker.blade.php index 8cdb23a..ed9757d 100644 --- a/resources/views/tracker.blade.php +++ b/resources/views/tracker.blade.php @@ -12,10 +12,10 @@ - + - +

Where in the World is Ben?

@@ -32,8 +32,8 @@
    @foreach($trip->checkins as $checkin) -
  1. -
    +
  2. +

    {{ $checkin->title ?? "[No title]" }}

    {{ $checkin->date }}
    {{ $checkin->note ?? "[No note]" }}
    @@ -71,8 +71,18 @@ checkinMarkers[{{ $checkin->id }}] = marker; @endforeach - function openCheckin(checkinId) { - checkinMarkers[checkinId].openPopup(); + function toggleCheckin(isOpen, checkinId) { + if (isOpen) { + var checkins = document.querySelectorAll('details'); + + checkinMarkers[checkinId].openPopup(); + + checkins.forEach(checkin => { + if (checkin.id != checkinId && checkin.open) checkin.open = false; + }); + } else { + checkinMarkers[checkinId].closePopup(); + } }