129 lines
6.7 KiB
HTML
129 lines
6.7 KiB
HTML
{% extends "base.html" %}
|
||
{% block title %}{{ "Fahrt bearbeiten" if fahrt else "Neue Fahrt" }} – PBT{% endblock %}
|
||
{% block head %}
|
||
{% if show_map %}
|
||
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css"
|
||
integrity="sha256-p4NxAoJBhIIN+hmNHrzRCf9tD/miZyoHS5obTRR9BMY=" crossorigin="">
|
||
{% endif %}
|
||
{% endblock %}
|
||
{% block content %}
|
||
<div class="card">
|
||
<h2>{{ "Fahrt bearbeiten" if fahrt else "Neue Fahrt erfassen" }}</h2>
|
||
<form method="post" action="{{ url_for('fahrt_bearbeiten', fahrt_id=fahrt.id) if fahrt else url_for('neue_fahrt') }}">
|
||
<div class="field">
|
||
<label for="transport_mode">Verkehrsmittel<span class="required">*</span></label>
|
||
<select id="transport_mode" name="transport_mode" required>
|
||
{% for option in verkehrsmittel_optionen %}
|
||
<option value="{{ option }}" {{ "selected" if fahrt and fahrt.transport_mode == option }}>{{ option }}</option>
|
||
{% endfor %}
|
||
</select>
|
||
<p class="field-hint" data-mode-hint></p>
|
||
</div>
|
||
|
||
<div class="field combo">
|
||
<label for="origin">Von<span class="required">*</span></label>
|
||
<input type="text" id="origin" name="origin" required
|
||
placeholder="Haltestelle suchen …"
|
||
value="{{ fahrt.origin if fahrt else '' }}"
|
||
data-stop-input data-stop-target="#origin_stop_id">
|
||
<input type="hidden" id="origin_stop_id" name="origin_stop_id"
|
||
value="{{ fahrt.origin_stop_id if fahrt and fahrt.origin_stop_id else '' }}"
|
||
{% if fahrt and fahrt.origin_stop %}
|
||
data-stop-type="{{ fahrt.origin_stop.stop_type }}"
|
||
data-stop-lat="{{ fahrt.origin_stop.latitude }}"
|
||
data-stop-lon="{{ fahrt.origin_stop.longitude }}"
|
||
{% endif %}>
|
||
<p class="field-hint {{ 'matched' if fahrt and fahrt.origin_stop }}" data-stop-hint>{{
|
||
"✓ " ~ fahrt.origin_stop.name ~ (", " ~ fahrt.origin_stop.municipality if fahrt.origin_stop.municipality else "")
|
||
if fahrt and fahrt.origin_stop else "" }}</p>
|
||
</div>
|
||
|
||
<div class="field combo">
|
||
<label for="destination">Nach<span class="required">*</span></label>
|
||
<input type="text" id="destination" name="destination" required
|
||
placeholder="Haltestelle suchen …"
|
||
value="{{ fahrt.destination if fahrt else '' }}"
|
||
data-stop-input data-stop-target="#destination_stop_id">
|
||
<input type="hidden" id="destination_stop_id" name="destination_stop_id"
|
||
value="{{ fahrt.destination_stop_id if fahrt and fahrt.destination_stop_id else '' }}"
|
||
{% if fahrt and fahrt.destination_stop %}
|
||
data-stop-type="{{ fahrt.destination_stop.stop_type }}"
|
||
data-stop-lat="{{ fahrt.destination_stop.latitude }}"
|
||
data-stop-lon="{{ fahrt.destination_stop.longitude }}"
|
||
{% endif %}>
|
||
<p class="field-hint {{ 'matched' if fahrt and fahrt.destination_stop }}" data-stop-hint>{{
|
||
"✓ " ~ fahrt.destination_stop.name ~ (", " ~ fahrt.destination_stop.municipality if fahrt.destination_stop.municipality else "")
|
||
if fahrt and fahrt.destination_stop else "" }}</p>
|
||
</div>
|
||
|
||
{% if show_map %}
|
||
<div class="field">
|
||
<label>Kartenvorschau</label>
|
||
<p class="field-hint" data-route-map-placeholder>Wähle bekannte Haltestellen bei Von/Nach für eine Kartenvorschau.</p>
|
||
<div id="route-map" class="route-map" hidden></div>
|
||
<p class="field-hint">Luftlinie zwischen den Halten – keine echte Streckenführung.</p>
|
||
</div>
|
||
{% endif %}
|
||
|
||
<div class="field combo">
|
||
<label for="line">Linie</label>
|
||
<input type="text" id="line" name="line" placeholder="z.B. S3, 693"
|
||
value="{{ fahrt.line if fahrt else '' }}"
|
||
data-line-input>
|
||
<p class="field-hint" data-line-hint>Halte oben wählen für Linienvorschläge.</p>
|
||
</div>
|
||
|
||
<div class="field">
|
||
<label for="course">Kurs <span class="field-optional">(Richtung, Abfahrtszeit – optional)</span></label>
|
||
<input type="text" id="course" name="course" placeholder="z. B. Richtung Kleinzell, ab 14:32"
|
||
value="{{ fahrt.course if fahrt else '' }}">
|
||
<div style="display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.5rem;">
|
||
<a class="btn secondary small" data-timetable-link target="_blank" rel="noopener"
|
||
aria-disabled="true">
|
||
🕒 Fahrplan öffnen
|
||
</a>
|
||
<a class="btn secondary small" href="https://verkehrsauskunft.verbundlinie.at/"
|
||
target="_blank" rel="noopener">
|
||
🚋 BusBahnBim (offizielle Quelle)
|
||
</a>
|
||
</div>
|
||
<p class="field-hint">Google Maps ist mit den gewählten Halten vorausgefüllt. BusBahnBim
|
||
liefert die offiziellen österreichischen Fahrplandaten, lässt sich aber nicht vorausfüllen –
|
||
Von/Nach dort selbst eingeben. Den genauen Kurs dann hier eintragen.</p>
|
||
</div>
|
||
|
||
<div class="field">
|
||
<label for="trip_date">Datum<span class="required">*</span></label>
|
||
<input type="date" id="trip_date" name="trip_date" value="{{ heute }}" required>
|
||
</div>
|
||
|
||
<div class="field">
|
||
<label for="rating">Bewertung<span class="required">*</span></label>
|
||
<select id="rating" name="rating" required>
|
||
{% set current_rating = fahrt.rating if fahrt else 3 %}
|
||
<option value="5" {{ "selected" if current_rating == 5 }}>★★★★★ Sehr gut</option>
|
||
<option value="4" {{ "selected" if current_rating == 4 }}>★★★★☆ Gut</option>
|
||
<option value="3" {{ "selected" if current_rating == 3 }}>★★★☆☆ Okay</option>
|
||
<option value="2" {{ "selected" if current_rating == 2 }}>★★☆☆☆ Schlecht</option>
|
||
<option value="1" {{ "selected" if current_rating == 1 }}>★☆☆☆☆ Sehr schlecht</option>
|
||
</select>
|
||
</div>
|
||
|
||
<div class="field">
|
||
<label for="comment">Kommentar</label>
|
||
<textarea id="comment" name="comment" rows="3">{{ fahrt.comment if fahrt else "" }}</textarea>
|
||
</div>
|
||
|
||
<button type="submit">{{ "Änderungen speichern" if fahrt else "Speichern" }}</button>
|
||
</form>
|
||
</div>
|
||
{% endblock %}
|
||
{% block scripts %}
|
||
{% if show_map %}
|
||
<script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js"
|
||
integrity="sha256-20nQCchB9co0qIjJZRGuk2/Z9VM+kNiyxNV1lvTlZBo=" crossorigin="" defer></script>
|
||
<script src="{{ url_for('static', filename='map.js') }}" defer></script>
|
||
{% endif %}
|
||
<script src="{{ url_for('static', filename='stops.js') }}" defer></script>
|
||
{% endblock %}
|