import{_ as f,u as y,c,a as t,w,b as p,v as m,d as g,e as k,f as x,g as h,r,h as V,i as C,o as n,j as B}from"./index-DcK5qV02.js";import{_ as S}from"./logo-CxXS7KxG.js";import{E}from"./ErrorMessage-Tp1tOCV-.js";import{L}from"./LoadingSpinner-Dgnv988R.js";const N={class:"login-page"},R={class:"login-content"},I={class:"input-group"},M={class:"input-group"},q=["disabled"],T={key:1},U={__name:"LoginView",setup(j){const v=C(),l=y(),i=r(""),u=r(""),s=r(""),o=r(!1),b=async()=>{s.value="",o.value=!0;try{await l.login(i.value,u.value);const a={admin:"/admin",barber:"/barber/agenda",client:"/client/book"},e=l.user.role==="client"?"/client/inicio":a[l.user.role]||"/login";v.push(e)}catch(a){s.value=a.response?.data?.message||"Error al iniciar sesión"}finally{o.value=!1}};return(a,e)=>{const _=V("router-link");return n(),c("div",N,[t("div",R,[e[5]||(e[5]=t("div",{class:"login-brand"},[t("img",{src:S,alt:"Barbería San Ramón",class:"login-logo"}),t("h1",{class:"header-title login-title"},"Barbería San Ramón"),t("p",{class:"login-subtitle"},"Iniciá sesión para reservar")],-1)),t("form",{onSubmit:w(b,["prevent"])},[t("div",I,[e[2]||(e[2]=t("label",{for:"email"},"Correo Electrónico",-1)),p(t("input",{"onUpdate:modelValue":e[0]||(e[0]=d=>i.value=d),type:"email",id:"email",class:"input-control",placeholder:"tu@email.com",required:""},null,512),[[m,i.value]])]),t("div",M,[e[3]||(e[3]=t("label",{for:"password"},"Contraseña",-1)),p(t("input",{"onUpdate:modelValue":e[1]||(e[1]=d=>u.value=d),type:"password",id:"password",class:"input-control",placeholder:"••••••••",required:""},null,512),[[m,u.value]])]),s.value?(n(),g(E,{key:0,message:s.value},null,8,["message"])):k("",!0),t("button",{type:"submit",disabled:o.value,class:"btn btn-gold",style:{"margin-top":"20px"}},[o.value?(n(),g(L,{key:0})):(n(),c("span",T,"Ingresar"))],8,q),x(_,{to:"/register",class:"btn btn-outline",style:{"margin-top":"15px",display:"block","text-align":"center","text-decoration":"none"}},{default:h(()=>[...e[4]||(e[4]=[B(" Crear Cuenta Nueva ",-1)])]),_:1})],32)])])}}},G=f(U,[["__scopeId","data-v-3247e243"]]);export{G as default};
