From f4f38a9701e7f8339ed9e8d3992026eaeb6ec376 Mon Sep 17 00:00:00 2001
From: Jacek Kowalski <Jacek@jacekk.info>
Date: Mon, 24 Jul 2023 20:43:03 +0000
Subject: [PATCH] Update bus & tram types (changes since last update)

---
 templates/vehicles.html |   59 +++++++++++++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 55 insertions(+), 4 deletions(-)

diff --git a/templates/vehicles.html b/templates/vehicles.html
index 7686d05..d44a311 100644
--- a/templates/vehicles.html
+++ b/templates/vehicles.html
@@ -1,11 +1,17 @@
 <!DOCTYPE html>
 <title>Vehicles on lines (TTSS-based)</title>
+<meta charset="utf-8" />
 <meta name="viewport" content="width=device-width, initial-scale=1" />
 
 <style type="text/css">
 table {
 	border-collapse: collapse;
 	border-spacing: 0;
+	margin: 10px 0;
+}
+caption {
+	text-align: left;
+	font-size: 120%;
 }
 th, td {
 	border: 1px solid black;
@@ -13,6 +19,8 @@
 }
 td {
 	vertical-align: top;
+}
+table.center td {
 	text-align: center;
 }
 a {
@@ -32,8 +40,8 @@
 }
 </style>
 
-<table>
-
+<table class="center">
+<caption>Vehicles by line</caption>
 <thead>
 <tr>
 {% for line in lines|keys %}
@@ -41,13 +49,12 @@
 {% endfor %}
 </tr>
 </thead>
-
 <tbody>
 <tr>
 {% for trips in lines %}
 <td>
 {% for trip in trips %}
-<a href="https://mpk.jacekk.net/map.html#!{{ prefix }}{{ trip.trip.id | e }}" class="low{{ trip.vehicle.low | default }}">
+<a href="https://mpk.jacekk.net/map.html#!{{ prefix }}{{ trip.vehicle.trip | e }}" class="low{{ trip.vehicle.low | default }}">
 {{ trip.vehicle.num | default('<?>') | e }}<br />
 </a>
 {% endfor %}
@@ -55,5 +62,49 @@
 {% endfor %}
 </tr>
 </tbody>
+</table>
+
+<table>
+<caption>Vehicles by type</caption>
+{% for type, vhcls in vehicles %}
+<tr>
+<th>{{ type }}</th>
+<td>{{ vhcls | length }}</td>
+<td>
+{% for vehicle in vhcls %}
+<a href="https://mpk.jacekk.net/map.html#!{{ prefix }}{{ vehicle.trip | e }}" class="low{{ vehicle.low | default }}">
+{{ vehicle.num | default('<?>') | e }}
+</a>
+{% endfor %}
+</td>
+</tr>
+{% endfor %}
+</table>
+
+<table>
+<caption>Vehicles in TTSS</caption>
+<thead>
+<tr>
+<th>Vehicle</th> <th>Line</th> <th>Last seen</th>
+</tr>
+</thead>
+{% for map in mapping %}
+<tr>
+<td>
+<a href="https://mpk.jacekk.net/map.html#!{{ map.vehicle.num }}" class="low{{ map.vehicle.low | default }}">
+{{ map.vehicle.num | e }}
+</a>
+</td>
+<td>
+{{ map.line | default('?') | e }}
+</td>
+<td>
+{{ map.date | time_diff | default('now') }}
+</td>
+</tr>
+{% endfor %}
+</table>
+
+Generated at {{ "now" | date("Y-m-d H:i:s P") }}
 
 </table>

--
Gitblit v1.9.1