import{p as _,f as a,b as s,g as V,B as M,A as i,y as d,n as x,t as m,e as p,v as C,h as c,i as z,z as B,r as y,k as g,m as S,s as j,j as n}from"./index-CeMVzSB6.js";const N={class:"min-h-screen flex items-center justify-center bg-gradient-to-br from-slate-100 to-slate-200 px-4 py-12"},U={class:"w-full max-w-lg"},A={class:"bg-white rounded-2xl shadow-xl p-8"},P=["disabled"],R={key:0,class:"mt-1 text-sm text-red-500"},T=["disabled"],E={key:0,class:"mt-1 text-sm text-red-500"},F=["disabled"],D=["disabled"],O=["disabled"],I={key:0,class:"mt-1 text-sm text-red-500"},J=["disabled"],Z={class:"flex items-start gap-3"},G=["disabled"],H={key:0,class:"p-3 rounded-lg bg-red-50 text-red-600 text-sm"},L={key:1,class:"p-3 rounded-lg bg-green-50 text-green-600 text-sm"},q=["disabled"],K={key:0,class:"flex items-center justify-center gap-2"},Q={key:1},W={class:"text-center text-sm text-slate-500 mt-6"},$={__name:"Register",setup(X){const h=j(),v=_(),t=y({name:"",email:"",phone:"",address:"",password:"",password_confirmation:"",accept_terms:!1}),r=y({}),b=g(""),f=g(""),o=g(!1);async function w(){if(b.value="",f.value="",Object.keys(r).forEach(e=>delete r[e]),t.password!==t.password_confirmation){r.password_confirmation=["Passwörter stimmen nicht überein"];return}o.value=!0;const u=await v.register({name:t.name,email:t.email,phone:t.phone,address:t.address,password:t.password});o.value=!1,u.success?(f.value="Registrierung erfolgreich! Nach der Freigabe durch einen Admin erhalten Sie eine E-Mail.",setTimeout(()=>{h.push("/login")},3e3)):(b.value=u.message,u.errors&&Object.assign(r,u.errors))}return(u,e)=>{const k=S("router-link");return n(),a("div",N,[s("div",U,[e[17]||(e[17]=V('

Fahrschule registrieren

Starten Sie Ihre 14-tägige kostenlose Testphase

',1)),s("div",A,[s("form",{onSubmit:M(w,["prevent"]),class:"space-y-5"},[s("div",null,[e[7]||(e[7]=s("label",{class:"block text-sm font-medium text-slate-700 mb-1.5"},"Name der Fahrschule *",-1)),i(s("input",{"onUpdate:modelValue":e[0]||(e[0]=l=>t.name=l),type:"text",placeholder:"Muster Fahrschule",class:x(["w-full px-4 py-2.5 rounded-lg border border-slate-300 focus:ring-2 focus:ring-primary focus:border-primary outline-none transition-all",{"border-red-400":r.name}]),disabled:o.value},null,10,P),[[d,t.name]]),r.name?(n(),a("p",R,m(r.name[0]),1)):p("",!0)]),s("div",null,[e[8]||(e[8]=s("label",{class:"block text-sm font-medium text-slate-700 mb-1.5"},"E-Mail *",-1)),i(s("input",{"onUpdate:modelValue":e[1]||(e[1]=l=>t.email=l),type:"email",placeholder:"info@fahrschule.de",class:x(["w-full px-4 py-2.5 rounded-lg border border-slate-300 focus:ring-2 focus:ring-primary focus:border-primary outline-none transition-all",{"border-red-400":r.email}]),disabled:o.value},null,10,T),[[d,t.email]]),r.email?(n(),a("p",E,m(r.email[0]),1)):p("",!0)]),s("div",null,[e[9]||(e[9]=s("label",{class:"block text-sm font-medium text-slate-700 mb-1.5"},"Telefon",-1)),i(s("input",{"onUpdate:modelValue":e[2]||(e[2]=l=>t.phone=l),type:"tel",placeholder:"+49 123 456789",class:"w-full px-4 py-2.5 rounded-lg border border-slate-300 focus:ring-2 focus:ring-primary focus:border-primary outline-none transition-all",disabled:o.value},null,8,F),[[d,t.phone]])]),s("div",null,[e[10]||(e[10]=s("label",{class:"block text-sm font-medium text-slate-700 mb-1.5"},"Adresse",-1)),i(s("textarea",{"onUpdate:modelValue":e[3]||(e[3]=l=>t.address=l),rows:"2",placeholder:"Straße, PLZ Ort",class:"w-full px-4 py-2.5 rounded-lg border border-slate-300 focus:ring-2 focus:ring-primary focus:border-primary outline-none transition-all resize-none",disabled:o.value},null,8,D),[[d,t.address]])]),s("div",null,[e[11]||(e[11]=s("label",{class:"block text-sm font-medium text-slate-700 mb-1.5"},"Passwort *",-1)),i(s("input",{"onUpdate:modelValue":e[4]||(e[4]=l=>t.password=l),type:"password",placeholder:"Mindestens 8 Zeichen",class:x(["w-full px-4 py-2.5 rounded-lg border border-slate-300 focus:ring-2 focus:ring-primary focus:border-primary outline-none transition-all",{"border-red-400":r.password}]),disabled:o.value},null,10,O),[[d,t.password]]),r.password?(n(),a("p",I,m(r.password[0]),1)):p("",!0)]),s("div",null,[e[12]||(e[12]=s("label",{class:"block text-sm font-medium text-slate-700 mb-1.5"},"Passwort bestätigen *",-1)),i(s("input",{"onUpdate:modelValue":e[5]||(e[5]=l=>t.password_confirmation=l),type:"password",placeholder:"Passwort wiederholen",class:"w-full px-4 py-2.5 rounded-lg border border-slate-300 focus:ring-2 focus:ring-primary focus:border-primary outline-none transition-all",disabled:o.value},null,8,J),[[d,t.password_confirmation]])]),s("div",Z,[i(s("input",{"onUpdate:modelValue":e[6]||(e[6]=l=>t.accept_terms=l),type:"checkbox",id:"terms",class:"mt-1 rounded border-slate-300 text-primary focus:ring-primary",disabled:o.value},null,8,G),[[C,t.accept_terms]]),e[13]||(e[13]=s("label",{for:"terms",class:"text-sm text-slate-600"},[c(" Ich akzeptiere die "),s("a",{href:"#",class:"text-primary hover:underline"},"AGB"),c(" und "),s("a",{href:"#",class:"text-primary hover:underline"},"Datenschutzerklärung")],-1))]),b.value?(n(),a("div",H,m(b.value),1)):p("",!0),f.value?(n(),a("div",L,m(f.value),1)):p("",!0),s("button",{type:"submit",disabled:o.value||!t.accept_terms,class:"w-full py-3 px-4 bg-primary text-white font-medium rounded-lg hover:bg-primary-600 focus:ring-4 focus:ring-primary-200 transition-all disabled:opacity-50 disabled:cursor-not-allowed"},[o.value?(n(),a("span",K,[...e[14]||(e[14]=[s("svg",{class:"animate-spin h-5 w-5",viewBox:"0 0 24 24"},[s("circle",{class:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor","stroke-width":"4",fill:"none"}),s("path",{class:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})],-1),c(" Registrieren... ",-1)])])):(n(),a("span",Q,"Jetzt kostenlos testen"))],8,q)],32),s("p",W,[e[16]||(e[16]=c(" Bereits registriert? ",-1)),z(k,{to:"/login",class:"text-primary hover:underline"},{default:B(()=>[...e[15]||(e[15]=[c("Jetzt anmelden",-1)])]),_:1})])])])])}}};export{$ as default};