diff --git a/src/components/booking/BookingDialog.tsx b/src/components/booking/BookingDialog.tsx index bbee39c..effc496 100644 --- a/src/components/booking/BookingDialog.tsx +++ b/src/components/booking/BookingDialog.tsx @@ -60,7 +60,8 @@ export function BookingDialog({ const [step, setStep] = useState(0); const [participant, setParticipant] = useState(EMPTY); - const [chosenPlan, setPlanType] = useState("FULL"); + // Keine Vorauswahl: Preise erscheinen erst unter der gewaehlten Zahlungsweise. + const [chosenPlan, setPlanType] = useState(null); const [voucherInput, setVoucherInput] = useState(""); const [appliedVoucher, setAppliedVoucher] = useState(null); const [voucherMessage, setVoucherMessage] = useState(null); @@ -114,11 +115,11 @@ export function BookingDialog({ }; }, [open, quote]); - // Eine nicht (mehr) verfuegbare Ratenvariante faellt auf Einmalzahlung zurueck. + // Eine nicht (mehr) verfuegbare Variante gilt als nicht gewaehlt. const chosen = quote?.plans.find((p) => p.type === chosenPlan); - const planType: PlanType = chosen && !chosen.available ? "FULL" : chosenPlan; + const planType: PlanType | null = chosen?.available ? chosenPlan : null; - const selectedPlan = quote?.plans.find((p) => p.type === planType) ?? null; + const selectedPlan = chosen?.available ? chosen : null; function updateParticipant(field: keyof Participant, value: string) { setParticipant((prev) => ({ ...prev, [field]: value })); @@ -174,6 +175,7 @@ export function BookingDialog({ async function submit() { setFormError(null); + if (!planType) return; const missing: FieldErrors = {}; if (!consents.adult) missing["consents.adult"] = "Bitte bestätige, dass du volljährig bist."; if (!consents.terms) missing["consents.terms"] = "Bitte akzeptiere die Buchungsbedingungen."; @@ -324,32 +326,29 @@ export function BookingDialog({ Wie möchtest du bezahlen?
{quote?.plans.map((plan) => ( - + + {plan.available && planType === plan.type && quote.price && } +
)) ??

Preise werden geladen …

} @@ -384,8 +383,6 @@ export function BookingDialog({ {voucherMessage}

- - {quote?.price && } )} @@ -462,7 +459,7 @@ export function BookingDialog({ {" "} gelesen. - {planType !== "FULL" && ( + {planType !== null && planType !== "FULL" && ( )} {step < STEPS.length - 1 ? ( - ) : ( @@ -509,6 +506,27 @@ export function BookingDialog({ ); } +/** Preis und Raten unter der gewaehlten Zahlungsweise. */ +function PlanDetails({ plan, quote }: { plan: QuoteData["plans"][number]; quote: QuoteData }) { + return ( +
+ + {plan.installments.length > 1 && ( +
    + {plan.installments.map((i) => ( +
  • + + Rate {i.seq}, {i.dueDate ? `fällig ${isoDate(i.dueDate)}` : "heute"} + + {money(i.amountCents)} +
  • + ))} +
+ )} +
+ ); +} + function PriceBreakdown({ quote }: { quote: QuoteData }) { const p = quote.price!; return (