changes to the booking flow
This commit is contained in:
+15
-19
@@ -1972,7 +1972,7 @@ def preise():
|
||||
@app.route('/preise/book-option', methods=['POST'])
|
||||
@login_required
|
||||
def book_option_package():
|
||||
# Unterstützt "packages" (Warenkorb) und Fallback auf "package" (altes Formular)
|
||||
# Supports comma-separated multi-item selection ("packages") and fallback ("package")
|
||||
packages_raw = _sanitize_text(request.form.get("packages") or request.form.get("package") or "", 200).lower()
|
||||
booking_flow = _sanitize_text(request.form.get("flow") or "payment", 24).lower()
|
||||
|
||||
@@ -1989,7 +1989,7 @@ def book_option_package():
|
||||
@app.route('/booking/payment', methods=['GET', 'POST'])
|
||||
@login_required
|
||||
def booking_payment():
|
||||
# Hole kommagetrennte Liste (z. B. "inventarsystem,terminverwaltung")
|
||||
# Accepts single or comma-separated packages (e.g. "inventarsystem,terminverwaltung,emailversand")
|
||||
packages_str = _sanitize_text(request.values.get("packages") or request.values.get("package") or "", 200).lower()
|
||||
booking_flow = _sanitize_text(request.values.get("flow") or "payment", 24).lower()
|
||||
|
||||
@@ -2002,7 +2002,7 @@ def booking_payment():
|
||||
|
||||
package_list = [p.strip() for p in packages_str.split(',') if p.strip()]
|
||||
|
||||
# Validiere Pakete, sammle Namen und berechne Gesamtpreis
|
||||
# Validate each selected article, accumulate labels and total price
|
||||
selected_package_names = []
|
||||
total_price = 0.0
|
||||
for pkg in package_list:
|
||||
@@ -2014,9 +2014,9 @@ def booking_payment():
|
||||
flash(f"Ungültige Buchungsoption: {pkg}", "error")
|
||||
return redirect(url_for("preise"))
|
||||
|
||||
# Zusammengefasster String für Frontend und Datenbank (z.B. "Inventarsystem, Terminplaner")
|
||||
# Formatted display string (e.g., "Inventarsystem, Terminplaner")
|
||||
selected_package = ", ".join(selected_package_names)
|
||||
package_raw = packages_str # Speichert alle raw-keys für DB
|
||||
package_raw = packages_str # Stores raw keys in DB
|
||||
|
||||
flow_config = BOOKING_FLOW_MAP[booking_flow]
|
||||
|
||||
@@ -2051,7 +2051,7 @@ def booking_payment():
|
||||
if request.method == "GET":
|
||||
return render_template("schnell_buchung.html", **review_data)
|
||||
|
||||
# --- POST Logik & Validierung ---
|
||||
# --- POST Logic & Validation ---
|
||||
required_fields = {
|
||||
"contact_person": "Ansprechpartner",
|
||||
"school_name": "Schule/Einrichtung",
|
||||
@@ -2101,7 +2101,7 @@ def booking_payment():
|
||||
"message": message,
|
||||
"created_at": _utc_now_iso(),
|
||||
"booking_flow": booking_flow,
|
||||
"booking_package": package_raw, # Hier steht nun z.B. "inventarsystem,terminverwaltung"
|
||||
"booking_package": package_raw,
|
||||
"booking_data": form_data,
|
||||
}
|
||||
)
|
||||
@@ -2113,7 +2113,7 @@ def booking_payment():
|
||||
base = _slugify_subdomain(raw_base).lower()[:51]
|
||||
|
||||
try:
|
||||
existing = steering.instace.list() or []
|
||||
existing = steering.instance.list() or []
|
||||
except Exception:
|
||||
existing = []
|
||||
|
||||
@@ -2125,11 +2125,11 @@ def booking_payment():
|
||||
provision_status = "not_started"
|
||||
provision_port = None
|
||||
provision_error = ""
|
||||
provision_config_ok = True # Startet mit True, wird False wenn ein Modul fehlschlägt
|
||||
provision_config_ok = True
|
||||
|
||||
try:
|
||||
try:
|
||||
port = steering.instace.new(subdomain)
|
||||
port = steering.instance.new(subdomain)
|
||||
except Exception as e:
|
||||
port = False
|
||||
provision_error = str(e)
|
||||
@@ -2142,18 +2142,14 @@ def booking_payment():
|
||||
except Exception:
|
||||
provision_port = port
|
||||
|
||||
# Multi-Modul-Konfiguration: Startpaket wird in Inventar + Bücherei aufgeschlüsselt
|
||||
modules_to_provision = set()
|
||||
for pkg in package_list:
|
||||
if pkg == "startpaket":
|
||||
modules_to_provision.update(["inventarsystem", "buecherei"])
|
||||
elif pkg in {"inventarsystem", "buecherei", "terminverwaltung", "emailversand", "starter", "advanced"}:
|
||||
modules_to_provision.add(pkg)
|
||||
# Dynamically collect all valid requested modules for multi-article provisioning
|
||||
valid_modules = {"inventarsystem", "buecherei", "terminverwaltung", "emailversand", "starter", "advanced"}
|
||||
modules_to_provision = {pkg for pkg in package_list if pkg in valid_modules}
|
||||
|
||||
# Einzelne Module in der erstellten Instanz editieren/aktivieren
|
||||
# Provision/enable each selected module on the newly created instance
|
||||
for mod in modules_to_provision:
|
||||
try:
|
||||
edit_ok = steering.instace.edit(subdomain, mod)
|
||||
edit_ok = steering.instance.edit(subdomain, mod)
|
||||
if not edit_ok:
|
||||
provision_config_ok = False
|
||||
provision_error += f" | Edit failed for {mod}"
|
||||
|
||||
@@ -300,7 +300,7 @@
|
||||
</div>
|
||||
|
||||
<!-- Upsell Modal -->
|
||||
<div class="custom-modal" id="upsellModal" aria-hidden="true" role="dialog">
|
||||
<!-- <div class="custom-modal" id="upsellModal" aria-hidden="true" role="dialog">
|
||||
<div class="custom-modal-backdrop" onclick="closeUpsellModal()"></div>
|
||||
<div class="custom-modal-content">
|
||||
<h3>Tipp: Sparen Sie mit dem Startpaket!</h3>
|
||||
@@ -316,7 +316,7 @@
|
||||
<button class="btn" type="button" onclick="acceptUpsell()">Zum Startpaket upgraden</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>-->
|
||||
|
||||
<!-- Cart Modal -->
|
||||
<div class="custom-modal" id="cartModal" aria-hidden="true" role="dialog">
|
||||
|
||||
Reference in New Issue
Block a user