- placeMaxTick() clamps the label so it stays within the scrubber instead of overlapping the time/speed readouts when max speed is near an edge - give the scrubber row more bottom margin (mb-3) so the tick label clears the readout row below - move the trip location readout directly under the timestamp (left side), removing the separate bottom line
105 lines
5.9 KiB
HTML
105 lines
5.9 KiB
HTML
{% extends "base.html" %}
|
||
{% from "components.html" import data_table %}
|
||
|
||
{% block title %}Trip history – Yaris OBD Remote{% endblock %}
|
||
|
||
{% block styles %}
|
||
<link rel="stylesheet" href="{{ url_for('static', filename='vendor/leaflet/leaflet.css') }}">
|
||
{% endblock %}
|
||
|
||
{% block content %}
|
||
<h3 class="text-dark mb-3 fw-bold">Trip history</h3>
|
||
|
||
<div class="row g-3">
|
||
{# ── Trip list ──────────────────────────────────────────────────── #}
|
||
<div class="col-12 col-xl-5">
|
||
<div class="card shadow-sm">
|
||
<div class="card-header py-2 d-flex justify-content-between align-items-center">
|
||
<h6 class="text-primary fw-bold m-0">Recorded trips</h6>
|
||
<button id="delete-selected-btn" class="btn btn-sm btn-outline-danger" type="button" hidden title="Delete selected trips">
|
||
<i class="fas fa-trash fa-fw"></i> Delete selected
|
||
</button>
|
||
</div>
|
||
<div class="card-body p-0">
|
||
<div id="trip-loading" class="text-center text-muted py-4">
|
||
<span class="spinner-border spinner-border-sm me-2" aria-hidden="true"></span>
|
||
Loading…
|
||
</div>
|
||
<div id="trip-error" class="alert alert-danger m-3" role="alert" hidden></div>
|
||
{{ data_table(
|
||
"trip-list",
|
||
[
|
||
{"key": "", "label": "", "sortable": false, "class": "text-center"},
|
||
{"key": "id", "label": "ID", "sortable": false},
|
||
{"key": "started", "label": "Started", "sortable": true},
|
||
{"key": "distance", "label": "km", "sortable": true},
|
||
{"key": "duration", "label": "Time", "sortable": true},
|
||
{"key": "maxSpeed", "label": "Max", "sortable": true},
|
||
{"key": "odometer", "label": "Odometer", "sortable": false},
|
||
{"key": "action", "label": "", "sortable": false, "class": "d-none d-sm-table-cell"}
|
||
],
|
||
"No trips detected",
|
||
"Trips appear once the Pi has uploaded tracking data.",
|
||
true
|
||
) }}
|
||
<script>document.getElementById('trip-list').dataset.deleteUrl = '/api/v1/portal/trip/';</script>
|
||
<script>document.getElementById('trip-list').dataset.batchDeleteUrl = '/api/v1/portal/trips/delete';</script>
|
||
<script>document.getElementById('trip-list').dataset.showId = '1';</script>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
{# ── Route replay map ───────────────────────────────────────────── #}
|
||
<div class="col-12 col-xl-7">
|
||
<div class="card shadow-sm">
|
||
<div class="card-header py-2 d-flex justify-content-between align-items-center">
|
||
<h6 class="text-primary fw-bold m-0">Route replay</h6>
|
||
<div class="d-flex align-items-center gap-2">
|
||
<button id="btn-recenter-history" class="btn btn-outline-secondary btn-sm" type="button" title="Recenter map" hidden>
|
||
<i class="fas fa-crosshairs" aria-hidden="true"></i>
|
||
</button>
|
||
<span id="trip-summary" class="small text-muted">Select a trip</span>
|
||
</div>
|
||
</div>
|
||
<div class="card-body p-0">
|
||
<div id="history-map" aria-label="Selected trip route map"
|
||
data-tile-url="https://{s}.basemaps.cartocdn.com/rastertiles/voyager/{z}/{x}/{y}.png"
|
||
data-tile-attrib="© <a href='https://www.openstreetmap.org/copyright'>OpenStreetMap</a> contributors © <a href='https://carto.com/attributions'>CARTO</a>"
|
||
data-min-zoom="3" data-max-zoom="19"></div>
|
||
<div id="trip-timeline" class="border-top p-3" hidden>
|
||
<div class="d-flex align-items-center gap-3 mb-3">
|
||
<button id="trip-play" class="btn btn-primary btn-sm" type="button" aria-label="Play">
|
||
<i class="fas fa-play" aria-hidden="true"></i>
|
||
</button>
|
||
<div class="position-relative flex-grow-1">
|
||
<input id="trip-scrubber" class="form-range w-100" type="range"
|
||
min="0" max="0" value="0" aria-label="Trip replay timeline">
|
||
<div id="trip-max-tick" class="trip-max-tick" title="Max speed" hidden>
|
||
<span class="trip-max-tick-arrow" aria-hidden="true"></span>
|
||
<span class="trip-max-tick-label">Max speed</span>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="d-flex flex-wrap justify-content-between gap-2 small mt-2">
|
||
<div class="min-w-0">
|
||
<strong id="trip-replay-time" class="d-block"></strong>
|
||
<span id="trip-replay-location" class="text-muted" style="font-size:0.75rem;"></span>
|
||
</div>
|
||
<div class="text-end">
|
||
<span id="trip-replay-speed" class="text-muted d-block"></span>
|
||
<span id="trip-replay-odometer" class="text-muted d-block" style="font-size:0.75rem;"></span>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
{% endblock %}
|
||
|
||
{% block scripts %}
|
||
<script src="{{ url_for('static', filename='vendor/leaflet/leaflet.js') }}"></script>
|
||
<script src="{{ url_for('static', filename='js/data-list.js') }}"></script>
|
||
<script src="{{ url_for('static', filename='js/history.js') }}"></script>
|
||
{% endblock %}
|