import{_ as y,u as k,a as x,m as V,c as m,b as t,d,t as C,w as h,e as a,v as i,f as c,g as S,h as N,i as U,n as q,p as E,r as g,j as R,k as B,o as l,l as M}from"./index-BSoZUQlM.js";import{E as D}from"./ErrorMessage-5CbE-StE.js";import{L}from"./LoadingSpinner-Cc4Dbt2l.js";const T={class:"register-page"},A={class:"register-content"},j={class:"register-brand"},I=["src","alt"],Y={class:"header-title register-title"},z={class:"input-group"},F={class:"input-group"},G={class:"input-group"},H={class:"input-group"},J={class:"input-group"},K=["disabled"],O={key:1},P={__name:"RegisterView",setup(Q){const f=B(),v=q(),_=k(),p=x(),s=E({name:"",email:"",phone:"",password:"",password_confirmation:""}),r=g(""),u=g(!1);V(()=>{const n=v.query.phone;if(typeof n=="string"&&n.trim()!==""){const e=n.replace(/\D/g,"");e.length>=8&&(s.phone=e)}});const b=async()=>{if(r.value="",s.password!==s.password_confirmation){r.value="Las contraseñas no coinciden";return}u.value=!0;try{await _.register(s),f.push("/client/book")}catch(n){r.value=n.response?.data?.message||n.response?.data?.errors?.email?.[0]||"Error al crear cuenta"}finally{u.value=!1}};return(n,e)=>{const w=R("router-link");return l(),m("div",T,[t("div",A,[t("div",j,[(l(),m("img",{key:d(p).logoUrl,src:d(p).logoUrl,alt:d(p).businessName,class:"register-logo"},null,8,I)),t("h1",Y,C(d(p).businessName),1),e[5]||(e[5]=t("p",{class:"register-subtitle"},"Crear cuenta nueva",-1))]),t("form",{onSubmit:h(b,["prevent"])},[t("div",z,[e[6]||(e[6]=t("label",{for:"name"},"Nombre completo",-1)),a(t("input",{"onUpdate:modelValue":e[0]||(e[0]=o=>s.name=o),type:"text",id:"name",class:"input-control",required:""},null,512),[[i,s.name]])]),t("div",F,[e[7]||(e[7]=t("label",{for:"email"},"Correo Electrónico",-1)),a(t("input",{"onUpdate:modelValue":e[1]||(e[1]=o=>s.email=o),type:"email",id:"email",class:"input-control",required:""},null,512),[[i,s.email]])]),t("div",G,[e[8]||(e[8]=t("label",{for:"phone"},"Teléfono (opcional)",-1)),a(t("input",{"onUpdate:modelValue":e[2]||(e[2]=o=>s.phone=o),type:"tel",id:"phone",class:"input-control"},null,512),[[i,s.phone]])]),t("div",H,[e[9]||(e[9]=t("label",{for:"password"},"Contraseña",-1)),a(t("input",{"onUpdate:modelValue":e[3]||(e[3]=o=>s.password=o),type:"password",id:"password",class:"input-control",required:"",minlength:"6"},null,512),[[i,s.password]])]),t("div",J,[e[10]||(e[10]=t("label",{for:"password_confirmation"},"Confirmar Contraseña",-1)),a(t("input",{"onUpdate:modelValue":e[4]||(e[4]=o=>s.password_confirmation=o),type:"password",id:"password_confirmation",class:"input-control",required:""},null,512),[[i,s.password_confirmation]])]),r.value?(l(),c(D,{key:0,message:r.value},null,8,["message"])):S("",!0),t("button",{type:"submit",disabled:u.value,class:"btn btn-gold",style:{"margin-top":"20px"}},[u.value?(l(),c(L,{key:0})):(l(),m("span",O,"Crear Cuenta"))],8,K),N(w,{to:"/login",class:"btn btn-outline",style:{"margin-top":"15px",display:"block","text-align":"center","text-decoration":"none"}},{default:U(()=>[...e[11]||(e[11]=[M(" Ya tengo cuenta ",-1)])]),_:1})],32)])])}}},$=y(P,[["__scopeId","data-v-8a2ea2ee"]]);export{$ as default};
