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