diff --git a/Website/main.py b/Website/main.py index ae40c35..750e746 100644 --- a/Website/main.py +++ b/Website/main.py @@ -2517,27 +2517,33 @@ def booking_payment(): app_obj = current_app._get_current_object() user_id = session.get("user_id") - username = session.get("username") # Hole Username für Übergabe + username = session.get("username") user_email = session.get("email") or form_data.get("contact_email") # Startet den asynchronen Provisioning-Thread thread = threading.Thread( target=background_booking_provisioning, - args=(app_obj, prov_id, subdomain, package_list, user_id, form_data["school_name"], user_email, username) # Username am Ende hinzugefügt + args=(app_obj, prov_id, subdomain, package_list, user_id, form_data["school_name"], user_email, username) ) thread.start() print(f"[INFO] Background Provisioning Trigger gestartet für Subdomain: {subdomain}") - # Antworte AJAX-Aufrufen direkt mit JSON + # ANPASSUNG FÜR BESSERE WARTEZEIT: + # Wir geben Metadaten mit, wie lange das Setup ca. dauern wird. if is_json_request: return jsonify({ "success": True, "slug": subdomain, - "message": "Provisioning gestartet." + "message": "Instanz wird eingerichtet...", + "estimated_seconds": 45, # Erwartete Dauer in Sekunden (anpassbar) + "status_poll_interval_ms": 3000 # Wie oft soll das Frontend fragen? (3 Sek) }), 200 - flash(f"Buchung für {selected_package} wurde erfasst. Die Instanz wird jetzt eingerichtet.", "success") - return redirect(url_for("my_instance_management")) + # Falls es KEIN AJAX-Request war: + # Wir hängen den Parameter "wait_for_slug" an, damit die "my_instance_management"-Seite weiß, + # dass sie sofort ein Lade-Overlay für diesen spezifischen Tenant öffnen muss. + flash(f"Buchung für {selected_package} wurde erfasst. Deine Instanz wird jetzt automatisch eingerichtet.", "success") + return redirect(url_for("my_instance_management", wait_for_slug=subdomain)) except Exception as e: print(f"[FATAL ERROR] In booking_payment Route:") diff --git a/Website/templates/schnell_buchung.html b/Website/templates/schnell_buchung.html index c11d188..78353eb 100644 --- a/Website/templates/schnell_buchung.html +++ b/Website/templates/schnell_buchung.html @@ -163,7 +163,7 @@ margin-top: 1.5rem; } - /* Loading State UI */ + /* NEU: Loading State & Fortschrittsbalken UI */ #setup-loading-state, #setup-success-state { display: none; @@ -171,23 +171,44 @@ padding: 3rem 1rem; } - .spinner { - width: 60px; - height: 60px; - border: 5px solid #e8f4f4; - border-top-color: #166271; - border-radius: 50%; - animation: spin 1s linear infinite; - margin: 0 auto 2rem; + .progress-wrapper { + width: 100%; + max-width: 480px; + margin: 2.5rem auto 1rem; } - @keyframes spin { 100% { transform: rotate(360deg); } } + .progress-bar-container { + width: 100%; + height: 16px; + background: #e8f4f4; + border-radius: 999px; + overflow: hidden; + box-shadow: inset 0 2px 4px rgba(0,0,0,0.05); + } + + .progress-bar-fill { + height: 100%; + width: 0%; + background: linear-gradient(90deg, #166271, #1b8a3e); + border-radius: 999px; + transition: width 0.5s ease-out, background-color 0.3s; + } + + .progress-percent { + font-size: 1.5rem; + font-weight: 800; + color: #173a42; + margin-top: 0.8rem; + font-variant-numeric: tabular-nums; /* Sorgt dafür, dass die Zahlen beim Hochzählen nicht wackeln */ + } .status-messages { font-size: 1.1rem; - color: #49626b; + color: #5e757d; font-weight: 600; height: 2rem; + margin-top: 1.5rem; + transition: color 0.3s; } /* Success State UI */ @@ -274,7 +295,6 @@ Paket
{{ package }}
-
Zahlungsart
Kauf auf Rechnung
@@ -308,7 +328,6 @@
-
2. Rechnungsadresse (Schulträger)
@@ -353,7 +372,6 @@
-
@@ -367,10 +385,18 @@

Instanz wird bereitgestellt

-

Ihre Bestellung wird verarbeitet. Die Rechnung wird zeitgleich generiert.

-
+

Ihre Umgebung wird isoliert aufgesetzt und Zertifikate werden generiert.

+ + +
+
+
+
+
0%
+
+
Validierung der Daten...
-

Bitte schließen Sie dieses Fenster nicht. Dies dauert in der Regel 15-30 Sekunden.

+

Bitte schließen Sie dieses Fenster nicht. Dies dauert etwa 30 bis 45 Sekunden.

@@ -391,7 +417,6 @@

Initial-Passwort: -

-
Seite neu laden'); + function handleError(message) { + clearInterval(msgInterval); + clearInterval(progressInterval); + statusText.textContent = message; + statusText.style.color = '#b02a37'; + progressBar.style.background = '#b02a37'; // Balken wird rot + + if (!document.getElementById('retry-btn')) { + statusText.insertAdjacentHTML('afterend', '
'); + } + } + + // Starte den ersten Status-Check nach 3 Sekunden + setTimeout(checkStatus, 3000); } // ========================================== @@ -593,7 +647,6 @@ document.getElementById('success-pass').textContent = pass; document.getElementById('btn-go-to-tenant').href = url; - // Rechnungs-Button einblenden, falls URL vorhanden const invoiceBtn = document.getElementById('btn-download-invoice'); if (invoiceUrl) { invoiceBtn.href = invoiceUrl;