import{r as c,G as N,b as P,s as h,d as T,o as r,c as l,a as e,H as R,l as d,D,e as i,v as A,t as p,w as U,f as H,g as E,F as f}from"./app-91dba96b.js";import{i as g}from"./index-0653e21c.js";import"./appFunction-1b5b1f43.js";const C={class:"text-center mt-4"},M=e("h1",{class:"h2 pt-3"},[e("b",null,"Sign In")],-1),L=e("h1",{class:"h3 pt-3"},"Welcome back please login here !",-1),G={class:"card"},B={class:"card-body"},v={class:"m-sm-5"},k={key:0,class:"mb-3"},w=e("label",{class:"form-label"},[E("Role "),e("span",{class:"text-danger"},"*")],-1),V=e("option",{value:"",selected:""},"Choose one",-1),W=e("option",{value:"admin"},"Admin",-1),y=[V,W],F={class:"mb-3"},x=e("label",{class:"form-label"},[E("Email "),e("span",{class:"text-danger"},"*")],-1),K={key:0,class:"text-danger"},Y={class:"mb-3"},j=e("label",{class:"form-label"},[E("Password "),e("span",{class:"text-danger"},"*")],-1),Z={key:0,class:"text-danger"},X={class:"d-grid gap-2 mt-3"},J=["disabled"],z=e("div",{class:"text-center mb-3"},[e("a",{href:"forget-password"},"Forget password")],-1),_e={__name:"login",setup(Q){const n=c({}),t=c(!1),_=N({role:"",email:"",password:""}),m=c("false"),u=()=>{switch(_.role){case"admin":_.email="admin@demo.com",_.password="123456";break;default:_.email="",_.password=""}};P(u),h(_,(s,o)=>{s.role!==o.role&&m.value&&u()});const O=()=>{t.value=!0,n.value={},g.post("login",_).then(({data:s})=>{s.status&&(window.location.href="dashboard")}).catch(({response:s})=>{s.status===422&&(n.value=s.data.errors)}).finally(()=>t.value=!1)};return(s,o)=>{const I=T("app-logo"),S=T("app-button-loader"),b=T("app-auth-footer");return r(),l(f,null,[e("div",C,[R(I),M,L]),e("div",G,[e("div",B,[e("div",v,[m.value==="true"?(r(),l("div",k,[w,d(e("select",{class:"form-select form-select-lg","onUpdate:modelValue":o[0]||(o[0]=a=>_.role=a),onChange:u},y,544),[[D,_.role]])])):i("",!0),e("div",F,[x,d(e("input",{class:"form-control form-control-lg",type:"email","onUpdate:modelValue":o[1]||(o[1]=a=>_.email=a),placeholder:"Enter your email"},null,512),[[A,_.email]]),n.value.email?(r(),l("small",K,p(n.value.email[0]),1)):i("",!0)]),e("div",Y,[j,d(e("input",{class:"form-control form-control-lg",type:"password","onUpdate:modelValue":o[2]||(o[2]=a=>_.password=a),placeholder:"Enter your password"},null,512),[[A,_.password]]),n.value.password?(r(),l("small",Z,p(n.value.password[0]),1)):i("",!0)]),e("div",X,[e("button",{type:"submit",class:"btn btn-lg btn-primary",onClick:U(O,["prevent"]),disabled:t.value},[t.value?(r(),H(S,{key:0})):i("",!0),E(" Sign in ")],8,J)])])])]),z,R(b)],64)}}};export{_e as default};
