Add edit my rides
Deploy PBT / deploy (push) Successful in 17s

This commit is contained in:
2026-09-11 08:03:19 +02:00
parent 36d97f5e79
commit ca90346f0b
4 changed files with 104 additions and 32 deletions
+25 -15
View File
@@ -1,14 +1,14 @@
{% extends "base.html" %}
{% block title %}Neue Fahrt PBT{% endblock %}
{% block title %}{{ "Fahrt bearbeiten" if fahrt else "Neue Fahrt" }} PBT{% endblock %}
{% block content %}
<div class="card">
<h2>Neue Fahrt erfassen</h2>
<form method="post">
<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 }}">{{ option }}</option>
<option value="{{ option }}" {{ "selected" if fahrt and fahrt.transport_mode == option }}>{{ option }}</option>
{% endfor %}
</select>
</div>
@@ -17,23 +17,32 @@
<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">
<p class="field-hint" data-stop-hint></p>
<input type="hidden" id="origin_stop_id" name="origin_stop_id"
value="{{ fahrt.origin_stop_id if fahrt and fahrt.origin_stop_id else '' }}">
<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">
<p class="field-hint" data-stop-hint></p>
<input type="hidden" id="destination_stop_id" name="destination_stop_id"
value="{{ fahrt.destination_stop_id if fahrt and fahrt.destination_stop_id else '' }}">
<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>
<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>
@@ -46,20 +55,21 @@
<div class="field">
<label for="rating">Bewertung<span class="required">*</span></label>
<select id="rating" name="rating" required>
<option value="5">★★★★★ Sehr gut</option>
<option value="4">★★★★☆ Gut</option>
<option value="3" selected>★★★Okay</option>
<option value="2">★★☆☆ Schlecht</option>
<option value="1">☆☆☆ Sehr schlecht</option>
{% 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"></textarea>
<textarea id="comment" name="comment" rows="3">{{ fahrt.comment if fahrt else "" }}</textarea>
</div>
<button type="submit">Speichern</button>
<button type="submit">{{ "Änderungen speichern" if fahrt else "Speichern" }}</button>
</form>
</div>
{% endblock %}