Amend date formats, map zoom

This commit is contained in:
Ben Goldsworthy 2022-08-29 21:34:48 +00:00
parent 7e5e99e0b1
commit e58b650eb1

View file

@ -20,10 +20,10 @@
<header> <header>
<h1>Where in the World is Ben?</h1> <h1>Where in the World is Ben?</h1>
<p> <p>
<span> Tracking started: {{ $trip->date_start }}</span> | <span> Tracking started: {{ date('j M Y (G:H)', strtotime($trip->date_start)) }}</span> |
<span class="{{ ($trip->is_active) ? "positive" : "negative" }}">{{ ($trip->is_active) ? "Active" : "Ended" }}</span> | <span class="{{ ($trip->is_active) ? "positive" : "negative" }}">{{ ($trip->is_active) ? "Active" : "Ended" }}</span> |
<span class="{{ ($trip->is_tracking) ? "positive" : "negative" }}">{{ ($trip->is_tracking) ? "Currently tracking" : "Not currently tracking" }}</span> <span class="{{ ($trip->is_tracking) ? "positive" : "negative" }}">{{ ($trip->is_tracking) ? "Currently tracking" : "Not currently tracking" }}</span>
<span class="small">(Last update: {{ $trip->updated_at }})</span> <span class="small">(Last update: {{ date('j M Y (G:H)', strtotime($trip->updated_at)) }})</span>
</p> </p>
</header> </header>
@ -34,7 +34,7 @@
@foreach($trip->checkins as $checkin) @foreach($trip->checkins as $checkin)
<li> <li>
<details id="{{ $checkin->id }}" ontoggle="toggleCheckin(this.open, this.id)"> <details id="{{ $checkin->id }}" ontoggle="toggleCheckin(this.open, this.id)">
<summary><h2>{{ $checkin->title ?? "[No title]" }}</h2> <span>{{ $checkin->date }}</span></summary> <summary><h2>{{ $checkin->title ?? "[No title]" }}</h2> <span>{{ date('j M Y (G:H)', strtotime($checkin->date)) }}</span></summary>
{{ $checkin->note ?? "[No note]" }} {{ $checkin->note ?? "[No note]" }}
</details> </details>
</li> </li>
@ -45,7 +45,7 @@
<footer> <footer>
<script> <script>
var map = L.map('map').setView([{{ end($trip->locations)->latitude }}, {{ end($trip->locations)->longitude }}], 10); var map = L.map('map').setView([{{ end($trip->locations)->latitude }}, {{ end($trip->locations)->longitude }}], 7);
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
maxZoom: 19, maxZoom: 19,
attribution: 'OpenStreetMap' attribution: 'OpenStreetMap'
@ -70,6 +70,11 @@
checkinMarkers[{{ $checkin->id }}] = marker; checkinMarkers[{{ $checkin->id }}] = marker;
@endforeach @endforeach
var currLocation = L.marker(
[{{ end($trip->locations)->latitude }}, {{ end($trip->locations)->longitude }}],
).addTo(map).setZIndexOffset(1000);
currLocation.bindPopup('<p>Current location</p>').openPopup();
function toggleCheckin(isOpen, checkinId) { function toggleCheckin(isOpen, checkinId) {
if (isOpen) { if (isOpen) {