'use client' import React from 'react' import { Card, CardHeader, CardTitle, CardDescription } from '@/components/ui/card' import { Label } from '@/components/ui/label' import { Button } from '@/components/ui/button' import { Input } from '@/components/ui/input' import { Badge } from '@/components/ui/badge' import { CreditCard, Calendar, Check, ChevronLeft, ChevronRight, RefreshCw, ShoppingBag, ShieldCheck, CheckCircle2, Info, } from 'lucide-react' import { motion, AnimatePresence } from 'framer-motion' interface StepBillingProps { selectedBillingInterval: 'one_time' | 'monthly' handleBillingIntervalChange: (val: 'one_time' | 'monthly') => void customerMode: 'select' | 'create' selectedEndCustomerId: string | null lastLicenseDate: string setLastLicenseDate: (date: string) => void prevStep: () => void nextStep: () => void } export function StepBilling({ selectedBillingInterval, handleBillingIntervalChange, customerMode, selectedEndCustomerId, lastLicenseDate, setLastLicenseDate, prevStep, nextStep, }: StepBillingProps) { // Optionale Validierung falls Datum bei Kauf Pflicht wäre, oder prüfen ob Modell gewählt ist const isOneTime = selectedBillingInterval === 'one_time' const isMonthly = selectedBillingInterval === 'monthly' return ( {/* ─── 1. FIXED HEADER (shrink-0) ─── */}
Abrechnungsmodell wählen Wählen Sie zwischen monatlicher Miete (Abonnement) oder einmaligem Softwarekauf.
Schritt 2 von 4
{/* ─── 2. SCROLLABLE MIDDLE CONTENT (flex-1 min-h-0 overflow-y-auto) ─── */}
{/* Abrechnungsmodell Cards */}
{/* Option 1: Miete / Abo */}
handleBillingIntervalChange('monthly')} className={`relative p-6 rounded-2xl border-2 cursor-pointer transition-all duration-300 flex flex-col justify-between min-h-[14rem] select-none ${ isMonthly ? 'border-primary bg-primary/10 shadow-[0_0_20px_rgba(59,130,246,0.2)] ring-1 ring-primary/50' : 'border-white/5 bg-white/5 hover:border-white/20 hover:bg-white/[0.07]' }`} >
{isMonthly && (
)}

Miete / Abo

Empfohlen

Fortlaufende monatliche Abrechnung

Maximale Flexibilität: Inklusive sämtlicher Software-Updates, Cloud-Dienste und technischem Support. Jederzeit kündbar oder anpassbar.

Zahlungsintervall: monatlich
{/* Option 2: Kauf / Einmalkauf */}
handleBillingIntervalChange('one_time')} className={`relative p-6 rounded-2xl border-2 cursor-pointer transition-all duration-300 flex flex-col justify-between min-h-[14rem] select-none ${ isOneTime ? 'border-primary bg-primary/10 shadow-[0_0_20px_rgba(59,130,246,0.2)] ring-1 ring-primary/50' : 'border-white/5 bg-white/5 hover:border-white/20 hover:bg-white/[0.07]' }`} >
{isOneTime && (
)}

Kauf / Einmalkauf

Klassisch

Einmalige Lizenzgebühr

Dauerhafte Lizenzrechte für die gekaufte Version inklusive 12 Monate kostenfreier Updates. Keine laufenden monatlichen Mietgebühren.

Zahlungsintervall: einmalig
{/* Dynamische Stichtagsabfrage bei Kauf */} {isOneTime && (

Datum des letzten Kaufs zur automatischen Berechnung der Update-Staffel (z. B. 15% innerhalb 1 Jahr, 30% bis 2 Jahre, 50% bis 3 Jahre).

setLastLicenseDate(e.target.value)} className="pl-9 bg-slate-950/80 border-white/10 text-white text-xs h-9 focus:border-primary" />
{lastLicenseDate && ( Stichtag gesetzt )}
)}
{/* ─── 3. FIXED BOTTOM ACTION BAR (shrink-0) ─── */}
{/* Back Button */} {/* Selected Model Status Chip */}
Gewähltes Modell: {isMonthly ? 'Monatliches Abo' : 'Einmaliger Kauf'}
{/* Next Button */}
) }