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