import{_ as f,u as y,c,a as t,w,b as p,v as m,d as g,e as x,f as k,g as h,r,h as V,i as B,o as n,j as C}from"./index-bWZW5iIe.js";import{_ as N}from"./logo-CxXS7KxG.js";import{E as S}from"./ErrorMessage-Bb2MEm24.js";import{L}from"./LoadingSpinner-3L2VeslL.js";const E={class:"login-page"},I={class:"login-content"},R={class:"input-group"},M={class:"input-group"},T=["disabled"],q={key:1},U={__name:"LoginView",setup(j){const v=B(),l=y(),i=r(""),d=r(""),o=r(""),a=r(!1),b=async()=>{o.value="",a.value=!0;try{await l.login(i.value,d.value);const s={admin:"/admin",barber:"/barber/agenda",client:"/client/book"},e=l.user.role==="client"?"/client/inicio":s[l.user.role]||"/login";v.push(e)}catch(s){o.value=s.response?.data?.message||"Error al iniciar sesión"}finally{a.value=!1}};return(s,e)=>{const _=V("router-link");return n(),c("div",E,[t("div",I,[e[5]||(e[5]=t("div",{class:"login-brand"},[t("img",{src:N,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",R,[e[2]||(e[2]=t("label",{for:"credential"},"Teléfono o correo",-1)),p(t("input",{"onUpdate:modelValue":e[0]||(e[0]=u=>i.value=u),type:"text",id:"credential",name:"credential",autocomplete:"username",class:"input-control",placeholder:"88881234 o tu@email.com",required:""},null,512),[[m,i.value]])]),t("div",M,[e[3]||(e[3]=t("label",{for:"password"},"Contraseña o PIN",-1)),p(t("input",{"onUpdate:modelValue":e[1]||(e[1]=u=>d.value=u),type:"password",id:"password",class:"input-control",placeholder:"••••••••",required:""},null,512),[[m,d.value]])]),o.value?(n(),g(S,{key:0,message:o.value},null,8,["message"])):x("",!0),t("button",{type:"submit",disabled:a.value,class:"btn btn-gold",style:{"margin-top":"20px"}},[a.value?(n(),g(L,{key:0})):(n(),c("span",q,"Ingresar"))],8,T),k(_,{to:"/register",class:"btn btn-outline",style:{"margin-top":"15px",display:"block","text-align":"center","text-decoration":"none"}},{default:h(()=>[...e[4]||(e[4]=[C(" Crear Cuenta Nueva ",-1)])]),_:1})],32)])])}}},F=f(U,[["__scopeId","data-v-7ebb08dc"]]);export{F as default};
