Refactor appointment system: remove appointments.html, update navigation to link to preise.html, and create new preise.html with pricing details and booking options.

This commit is contained in:
2026-05-10 14:43:26 +02:00
parent a06cc2f6d7
commit f092ac1890
6 changed files with 20 additions and 547 deletions
+6 -179
View File
@@ -1790,48 +1790,12 @@ def register():
return render_template("register.html")
@app.route('/appointments', methods=['GET'])
def appointments():
software_packages = [
{
"slug": "normal",
"name": "Normal",
"headline": "Stabiler Einstieg für den Schulalltag",
"features": [
"Inventarverwaltung mit Rollenrechten",
"Basis-Support und Ticketing",
"Schulweite Übersichten",
],
},
{
"slug": "pro",
"name": "Pro",
"headline": "Für Schulen mit erweitertem Bedarf",
"features": [
"Erweiterte Instanzverwaltung",
"Detailberichte und Admin-Insights",
"Priorisierter Support",
],
},
{
"slug": "buecherei",
"name": "Bücherei",
"headline": "Optimiert für Bibliothek und Medien",
"features": [
"Ausleih- und Rückgabeprozesse",
"Bestandsübersichten für Medien",
"Transparente Historie pro Medium",
],
},
]
return render_template(
"appointments.html",
software_packages=software_packages,
)
@app.route('/preise', methods=['GET'])
def preise():
return render_template("preise.html")
@app.route('/appointments/book-option', methods=['POST'])
@app.route('/preise/book-option', methods=['POST'])
@login_required
def book_option_package():
package_raw = _sanitize_text(request.form.get("package") or "", 40).lower()
@@ -1844,7 +1808,7 @@ def book_option_package():
selected_package = package_map.get(package_raw)
if not selected_package:
flash("Ungültige Buchungsoption ausgewählt.", "error")
return redirect(url_for("appointments"))
return redirect(url_for("preise"))
message = (
f"Ich möchte das Paket {selected_package} buchen. "
@@ -1865,7 +1829,7 @@ def book_option_package():
)
except PyMongoError:
flash("Buchungsanfrage konnte nicht gesendet werden.", "error")
return redirect(url_for("appointments"))
return redirect(url_for("preise"))
finally:
if client:
client.close()
@@ -1874,49 +1838,6 @@ def book_option_package():
return redirect(url_for("user_chat"))
@app.route('/admin/dashboard')
@admin_required
def admin_dashboard():
all_appointments = []
client = None
try:
client, col = _get_collection("appointments")
all_appointments = list(col.find().sort([("date", -1), ("time", -1)]))
for item in all_appointments:
_with_public_id(item)
except PyMongoError:
flash("Buchungsanfragen konnten nicht geladen werden.", "error")
finally:
if client:
client.close()
blocked_days = _get_blocked_days()
status_counts = {
"Angefragt": len([a for a in all_appointments if a.get("status") == "Angefragt"]),
"Bestaetigt": len([a for a in all_appointments if a.get("status") == "Bestaetigt"]),
"Abgelehnt": len([a for a in all_appointments if a.get("status") == "Abgelehnt"]),
}
total_posts = 0
client = None
try:
client, col = _get_collection("posts")
total_posts = col.count_documents({})
except PyMongoError:
total_posts = 0
finally:
if client:
client.close()
return render_template(
"admin_dashboard.html",
appointments=all_appointments,
blocked_days=blocked_days,
status_counts=status_counts,
total_posts=total_posts,
)
@app.route('/admin/instances', methods=['GET', 'POST'])
@admin_required
@@ -2357,100 +2278,6 @@ def admin_import_instance_backup(subdomain):
return redirect(url_for("admin_system_tools"))
@app.route('/admin/appointments/block-day', methods=['POST'])
@admin_required
def admin_block_day():
action = _sanitize_text(request.form.get("action") or "", 30)
block_date = (request.form.get("block_date") or "").strip()
reason = _sanitize_text(request.form.get("reason") or "", 200)
client = None
try:
client, col = _get_collection("blocked_days")
if action == "add":
try:
date.fromisoformat(block_date)
except ValueError:
flash("Bitte ein gültiges Datum zum Sperren wählen.", "error")
return redirect(url_for("admin_dashboard"))
if col.find_one({"date": block_date}):
flash("Der Tag ist bereits gesperrt.", "error")
return redirect(url_for("admin_dashboard"))
col.insert_one(
{
"date": block_date,
"reason": reason,
"blocked_by": session.get("username") or "admin",
"created_at": _utc_now_iso(),
}
)
flash("Tag im Kalender gesperrt.", "success")
elif action == "remove":
result = col.delete_one({"date": block_date})
if not result.deleted_count:
flash("Sperrtag nicht gefunden.", "error")
return redirect(url_for("admin_dashboard"))
flash("Sperrtag entfernt.", "success")
else:
flash("Ungültige Aktion für Kalendersperre.", "error")
return redirect(url_for("admin_dashboard"))
except PyMongoError:
flash("Kalendersperre konnte nicht gespeichert werden.", "error")
finally:
if client:
client.close()
return redirect(url_for("admin_dashboard"))
@app.route('/admin/appointment/<appointment_id>', methods=['POST'])
@admin_required
def update_appointment(appointment_id):
action = request.form.get("action", "").strip()
response_text = _sanitize_text(request.form.get("response") or "", 5000)
if action not in ["confirm", "reject"]:
flash("Ungültige Aktion.", "error")
return redirect(url_for("admin_dashboard"))
query = _appointment_query_from_id(appointment_id)
if not query:
flash("Buchung nicht gefunden.", "error")
return redirect(url_for("admin_dashboard"))
new_status = "Bestaetigt" if action == "confirm" else "Abgelehnt"
client = None
try:
client, col = _get_collection("appointments")
result = col.update_one(
query,
{
"$set": {
"status": new_status,
"response": response_text,
"responded_at": datetime.utcnow().isoformat(timespec="seconds") + "Z",
"responded_by": session.get("username"),
}
},
)
if result.matched_count == 0:
flash("Buchung nicht gefunden.", "error")
return redirect(url_for("admin_dashboard"))
except PyMongoError:
flash("Buchung konnte nicht aktualisiert werden.", "error")
return redirect(url_for("admin_dashboard"))
finally:
if client:
client.close()
flash(f"Buchung wurde {('bestaetigt' if action == 'confirm' else 'abgelehnt')}.", "success")
return redirect(url_for("admin_dashboard"))
@app.route('/admin/blog', methods=['GET', 'POST'])
@admin_required
def admin_blog():
-355
View File
@@ -1,355 +0,0 @@
{% extends "base.html" %}
{% block title %}Admin Dashboard{% endblock %}
{% block head %}
{{ super() }}
<style>
.admin-grid {
display: grid;
grid-template-columns: repeat(3, minmax(0, 1fr));
gap: 1rem;
margin-bottom: 1.2rem;
}
.stat-card {
background: #ffffff;
border: 1px solid #d4e0e9;
border-radius: 14px;
padding: 1.2rem;
box-shadow: 0 10px 28px rgba(20, 40, 55, 0.05);
text-align: center;
}
.stat-value {
font-size: 2.2rem;
font-weight: 700;
color: #0a5c88;
margin-bottom: 0.3rem;
}
.stat-label {
font-size: 0.9rem;
color: #5a7a8f;
font-weight: 600;
}
.appointments-section {
background: #ffffff;
border: 1px solid #d4e0e9;
border-radius: 16px;
padding: 1.4rem;
box-shadow: 0 14px 32px rgba(20, 39, 55, 0.06);
}
.quick-admin-link {
margin-bottom: 1rem;
border: 1px solid #d8e3ec;
border-radius: 12px;
background: #f6fbff;
padding: 0.85rem 0.95rem;
display: flex;
align-items: center;
justify-content: space-between;
gap: 0.8rem;
}
.quick-admin-link a {
border-radius: 999px;
padding: 0.42rem 0.8rem;
border: 1px solid #b8ccda;
background: #ffffff;
color: #0b4d73;
font-weight: 700;
white-space: nowrap;
}
.appointments-section h2 {
font-size: 1.3rem;
color: #0f354d;
margin-bottom: 0.8rem;
}
.block-days-section {
margin-bottom: 1.2rem;
padding: 1rem;
border: 1px solid #d8e3ec;
border-radius: 12px;
background: #f9fbfd;
}
.block-days-section h3 {
margin: 0 0 0.6rem;
color: #143a55;
font-size: 1.05rem;
}
.block-form {
display: grid;
grid-template-columns: 180px 1fr auto;
gap: 0.5rem;
margin-bottom: 0.8rem;
}
.block-form input {
width: 100%;
border: 1px solid #c4d4e0;
border-radius: 8px;
padding: 0.45rem 0.55rem;
font: inherit;
}
.block-btn,
.unblock-btn {
border: none;
border-radius: 8px;
padding: 0.45rem 0.65rem;
font-weight: 700;
cursor: pointer;
}
.block-btn {
color: #ffffff;
background: linear-gradient(120deg, #0b5b89 0%, #0b4262 100%);
}
.blocked-list {
display: grid;
gap: 0.45rem;
}
.blocked-item {
display: flex;
align-items: center;
justify-content: space-between;
gap: 0.6rem;
border: 1px solid #d5dee6;
border-radius: 9px;
padding: 0.5rem 0.65rem;
background: #ffffff;
}
.blocked-item p {
margin: 0;
font-size: 0.88rem;
}
.unblock-btn {
color: #7e2d2d;
background: #fff3f3;
border: 1px solid #e8b8b8;
}
.appointment-card {
border: 1px solid #d8e3ec;
border-radius: 12px;
padding: 1rem;
margin-bottom: 0.8rem;
background: #f9fbfd;
display: flex;
justify-content: space-between;
align-items: flex-start;
gap: 1rem;
}
.appointment-info > strong {
display: block;
color: #113d59;
margin-bottom: 0.25rem;
}
.appointment-info p {
margin: 0.15rem 0;
font-size: 0.9rem;
}
.appointment-status {
display: inline-block;
border-radius: 999px;
padding: 0.25rem 0.6rem;
font-size: 0.8rem;
font-weight: 700;
margin-top: 0.35rem;
}
.status-pending {
border: 1px solid #fba316;
background: #fffbf0;
color: #b8730f;
}
.status-confirmed {
border: 1px solid #0e9f6e;
background: #f0fdf4;
color: #0b5c47;
}
.status-rejected {
border: 1px solid #d3413e;
background: #fdf5f5;
color: #8b2a27;
}
.appointment-actions {
display: flex;
gap: 0.4rem;
}
.action-form {
display: grid;
gap: 0.6rem;
}
.response-input {
width: 100%;
min-height: 60px;
border: 1px solid #c4d4e0;
border-radius: 8px;
padding: 0.5rem;
font-family: inherit;
font-size: 0.85rem;
resize: vertical;
}
.action-btn {
border: none;
border-radius: 6px;
padding: 0.4rem 0.7rem;
font-size: 0.85rem;
font-weight: 700;
cursor: pointer;
color: #ffffff;
}
.confirm-btn {
background: linear-gradient(120deg, #0a7c4e 0%, #065f3f 100%);
}
.reject-btn {
background: linear-gradient(120deg, #a74444 0%, #8a3535 100%);
}
@media (max-width: 980px) {
.admin-grid {
grid-template-columns: 1fr 1fr;
}
.block-form {
grid-template-columns: 1fr;
}
}
@media (max-width: 600px) {
.admin-grid {
grid-template-columns: 1fr;
}
.appointment-card {
flex-direction: column;
}
}
</style>
{% endblock %}
{% block content %}
<h1 style="font-size: 2rem; color: #0f354d; margin-bottom: 1rem;">Admin Dashboard</h1>
<section class="admin-grid">
<article class="stat-card">
<div class="stat-value">{{ status_counts.Angefragt }}</div>
<div class="stat-label">Neue Anfragen</div>
</article>
<article class="stat-card">
<div class="stat-value">{{ status_counts.Bestaetigt }}</div>
<div class="stat-label">Bestätigt</div>
</article>
<article class="stat-card">
<div class="stat-value">{{ total_posts }}</div>
<div class="stat-label">Blog-Beiträge</div>
</article>
</section>
<section class="appointments-section">
<div class="quick-admin-link">
<p><strong>Team verwalten:</strong> Bilder, Rolle und Arbeit der zwei Team-Cards zentral pflegen.</p>
<a href="{{ url_for('admin_team') }}">Team Cards öffnen</a>
</div>
<div class="quick-admin-link">
<p><strong>Schul-Instanzen:</strong> Neue Subdomain-Instanzen für Schulen aus dem Inventarsystem-Repository starten.</p>
<a href="{{ url_for('admin_instances') }}">Instanzen öffnen</a>
</div>
<h2>Buchungsanfragen verwalten</h2>
<div class="block-days-section">
<h3>Kalender-Tage sperren</h3>
<form method="POST" action="{{ url_for('admin_block_day') }}" class="block-form">
<input type="hidden" name="action" value="add">
<input type="date" name="block_date" required>
<input type="text" name="reason" placeholder="Grund (optional)">
<button type="submit" class="block-btn">Tag sperren</button>
</form>
<div class="blocked-list">
{% if blocked_days %}
{% for blocked in blocked_days %}
<div class="blocked-item">
<p>
<strong>{{ blocked.date }}</strong>
{% if blocked.reason %}
- {{ blocked.reason }}
{% endif %}
</p>
<form method="POST" action="{{ url_for('admin_block_day') }}">
<input type="hidden" name="action" value="remove">
<input type="hidden" name="block_date" value="{{ blocked.date }}">
<button type="submit" class="unblock-btn">Entsperren</button>
</form>
</div>
{% endfor %}
{% else %}
<p>Aktuell sind keine Tage gesperrt.</p>
{% endif %}
</div>
</div>
{% if appointments %}
{% for appointment in appointments %}
<article class="appointment-card">
<div class="appointment-info">
<strong>{{ appointment.display_name }} - {{ appointment.subject }}</strong>
<p><strong>Datum:</strong> {{ appointment.date }} um {{ appointment.time }}</p>
<p><strong>Buchungsart:</strong> {{ appointment.meeting_label or ('Vor Ort' if appointment.meeting_type == 'vor_ort' else 'Digital') }}</p>
{% if appointment.location_name %}
<p><strong>Ort:</strong> {{ appointment.location_name }}</p>
{% endif %}
{% if appointment.location_maps_url %}
<p><strong>Maps:</strong> <a href="{{ appointment.location_maps_url }}" target="_blank" rel="noopener noreferrer">Link öffnen</a></p>
{% endif %}
<p><strong>Angefragt:</strong> {{ appointment.created_at[:10] }}</p>
{% if appointment.note %}
<p><strong>Notiz:</strong> {{ appointment.note }}</p>
{% endif %}
{% if appointment.response %}
<p><strong>Antwort:</strong> {{ appointment.response }}</p>
{% endif %}
<span class="appointment-status status-{{ appointment.status|lower|replace('Ä', 'ae')|replace('ö', 'oe')|replace('ü', 'ue') if appointment.status == 'Angefragt' else 'confirmed' if appointment.status == 'Bestaetigt' else 'rejected' }}">{{ appointment.status }}</span>
</div>
{% if appointment.status == 'Angefragt' %}
<div class="appointment-actions">
<form method="POST" action="{{ url_for('update_appointment', appointment_id=appointment.id) }}" class="action-form" style="min-width: 280px;">
<textarea class="response-input" name="response" placeholder="Antwort (optional)"></textarea>
<div style="display: flex; gap: 0.4rem;">
<button type="submit" name="action" value="confirm" class="confirm-btn action-btn">Bestätigen</button>
<button type="submit" name="action" value="reject" class="reject-btn action-btn">Ablehnen</button>
</div>
</form>
</div>
{% endif %}
</article>
{% endfor %}
{% else %}
<p>Keine Buchungsanfragen vorhanden.</p>
{% endif %}
</section>
<section style="margin-top: 1.5rem;">
<a href="{{ url_for('admin_blog') }}" style="color: #ffffff; background: linear-gradient(120deg, #0b5b89 0%, #0b4262 100%); padding: 0.68rem 1.15rem; border-radius: 999px; font-weight: 700; display: inline-block; text-decoration: none;">Blog verwalten</a>
</section>
{% endblock %}
+10 -9
View File
@@ -518,7 +518,7 @@
<div class="nav-links" id="mainNav" aria-label="Main Navigation" aria-hidden="true">
<a href="{{ url_for('default') }}">Start</a>
<a href="{{ url_for('dienstleistungen') }}">Für Schulen</a>
<a href="{{ url_for('appointments') }}">Termin buchen</a>
<a href="{{ url_for('preise') }}">Preise</a>
<a href="{{ url_for('kontakt') }}">Kontakt</a>
{% if 'username' in session %}
<a class="nav-user-link" href="{{ url_for('my_invoices') }}">Meine Rechnungen</a>
@@ -526,18 +526,20 @@
<a class="nav-user-link" href="{{ url_for('user_chat') }}">Chat mit Admin</a>
<a class="nav-user-link" href="{{ url_for('user_tickets') }}">Support Tickets</a>
<a class="nav-user-link" href="{{ url_for('logout') }}">Abmelden</a>
{% if session.get('is_admin') %}
<a class="nav-user-link" href="{{ url_for('admin_dashboard') }}">Admin Dashboard</a>
<a class="nav-user-link" href="{{ url_for('admin_users') }}">Userverwaltung</a>
<a class="nav-user-link" href="{{ url_for('admin_invoices') }}">Rechnungsverwaltung</a>
{% endif %}
{% elif session.get('is_admin') %}
<a class="nav-user-link" href="{{ url_for('admin_invoices') }}">Rechnungsverwaltung</a>
<a class="nav-user-link" href="{{ url_for('admin_blog') }}">Blog verwalten</a>
<a class="nav-user-link" href="{{ url_for('admin_team') }}">Team Cards</a>
<a class="nav-user-link" href="{{ url_for('admin_chats') }}">Admin-Chat</a>
<a class="nav-user-link" href="{{ url_for('admin_tickets') }}">Support-Center</a>
<a class="nav-user-link" href="{{ url_for('admin_system_tools') }}">System-Tools</a>
{% else %}
<a class="nav-mobile-action nav-btn primary" href="{{ url_for('login') }}">Login</a>
<a class="nav-mobile-action nav-btn" href="{{ url_for('register') }}">Registrieren</a>
{% endif %}
</div>
<div class="nav-actions">
<a class="nav-btn primary" href="{{ url_for('appointments') }}">Termin buchen</a>
<a class="nav-btn primary" href="{{ url_for('preise') }}">Preise</a>
{% if 'username' in session %}
<details class="nav-dropdown">
<summary class="nav-btn">Nutzerbereich</summary>
@@ -552,7 +554,6 @@
<details class="nav-dropdown">
<summary class="nav-btn">Admin</summary>
<div class="dropdown-menu">
<a href="{{ url_for('admin_dashboard') }}">Dashboard</a>
<a href="{{ url_for('admin_users') }}">Userverwaltung</a>
<a href="{{ url_for('admin_invoices') }}">Rechnungsverwaltung</a>
<a href="{{ url_for('admin_chats') }}">Admin-Chat</a>
@@ -598,7 +599,7 @@
<li><a href="{{ url_for('dienstleistungen') }}">Leistungsübersicht</a></li>
<li><a href="{{ url_for('team') }}">Team</a></li>
<li><a href="{{ url_for('blog') }}">Neuigkeiten</a></li>
<li><a href="{{ url_for('appointments') }}">Termin buchen</a></li>
<li><a href="{{ url_for('preise') }}">Preise</a></li>
</ul>
</div>
<div class="footer-section">
+1 -1
View File
@@ -27,7 +27,7 @@
<h2>Terminvereinbarung</h2>
<p>In 30 Minuten werden aktuelle Rahmenbedingungen bewertet und sinnvolle erste Schritte priorisiert.</p>
{% if 'username' in session %}
<a class="btn" href="{{ url_for('appointments') }}">In 5 Minuten startklar</a>
<a class="btn" href="{{ url_for('preise') }}">In 5 Minuten startklar</a>
{% else %}
<a class="btn" href="{{ url_for('login') }}">Login für Buchung</a>
{% endif %}
+2 -2
View File
@@ -693,7 +693,7 @@
</p>
<div class="cta-row">
{% if 'username' in session %}
<a class="btn btn-primary" href="{{ url_for('appointments') }}">In 5 Minuten startklar</a>
<a class="btn btn-primary" href="{{ url_for('preise') }}">In 5 Minuten startklar</a>
{% else %}
<a class="btn btn-primary" href="{{ url_for('login') }}">Jetzt kostenlos testen</a>
{% endif %}
@@ -915,7 +915,7 @@
<p>Ein kurzes Gespräch schafft Klarheit über Prioritäten, Sicherheitsanforderungen und realistische Einführungsetappen für den Schulbetrieb.</p>
</div>
{% if 'username' in session %}
<a class="btn btn-secondary" href="{{ url_for('appointments') }}">In 5 Minuten startklar</a>
<a class="btn btn-secondary" href="{{ url_for('preise') }}">In 5 Minuten startklar</a>
{% else %}
<a class="btn btn-secondary" href="{{ url_for('login') }}">Jetzt kostenlos testen</a>
{% endif %}
@@ -1,6 +1,6 @@
{% extends "base.html" %}
{% block title %}Termine{% endblock %}
{% block title %}Preise{% endblock %}
{% block head %}
{{ super() }}