import{N as e,Q as t,St as n,W as r,c as i,d as a,et as o,h as s,m as c,s as l}from"./runtime-core.esm-bundler-Babufkcf.js";import{t as u}from"./QIcon-cTVL6ikA.js";import{t as d}from"./QBtn-DkiaKEsC.js";import{B as f,G as p,K as m,i as h,n as g}from"./index-uCtpzrM3.js";import{t as _}from"./i18n-jmtZ2Bqk.js";import{t as v}from"./QForm-C4rccd2O.js";import{t as y}from"./use-quasar-VjDPGYn9.js";import{n as b}from"./syncService-CQzggLWC.js";import{t as x}from"./BrandMark-CYwYRd5j.js";var S={class:`login-box`},C={class:`login-brand`},w={class:`login-title`},T={class:`login-sub`},E={class:`login-field-label`},D={class:`row items-center q-mt-xs q-mb-md`},O={class:`login-demo`},k={class:`login-demo__title`},A={class:`row q-gutter-xs q-mt-xs`},j=m({__name:`LoginPage`,setup(m){let j=p(),M=y(),N=f(),P=o(!1),F=o(!1),I=typeof localStorage<`u`&&localStorage.getItem(`remember_email`)||``,L=t({email:I,password:``,remember:!0});l(()=>!b.isOnline);function R(){L.email=`admin@ariaherat.af`,L.password=`password`}async function z(){F.value=!0;try{await N.login(L),L.remember?localStorage.setItem(`remember_email`,L.email):localStorage.removeItem(`remember_email`),j.push({name:`dashboard`}),M.notify({type:`positive`,position:`bottom`,icon:`waving_hand`,message:_.t(`WelcomeBackBang`)})}catch(e){M.notify({type:`negative`,message:e?.response?.data?.message||`Login failed`})}finally{F.value=!1}}return(t,o)=>(e(),a(`div`,S,[i(`div`,C,[s(x,{size:`36`}),o[4]||=i(`div`,null,[i(`div`,{class:`login-brand__name`},`Aria Herat ERP`),i(`div`,{class:`login-brand__ver`},`Construction ERP · v1.0`)],-1)]),i(`div`,w,n(t.$t(`WelcomeBack`)),1),i(`div`,T,n(t.$t(`SignInHint`)),1),s(v,{onSubmit:z,class:`login-form`},{default:r(()=>[i(`div`,E,n(t.$t(`EmailAddress`)),1),s(h,{modelValue:L.email,"onUpdate:modelValue":o[0]||=e=>L.email=e,type:`email`,outlined:``,dense:``,autofocus:``,placeholder:`you@ariaherat.af`,rules:[e=>!!e||`Required`],class:`login-input`},{prepend:r(()=>[s(u,{name:`alternate_email`,size:`18px`,color:`grey-5`})]),_:1},8,[`modelValue`,`rules`]),o[5]||=i(`div`,{class:`login-field-label q-mt-sm`},`Password`,-1),s(h,{modelValue:L.password,"onUpdate:modelValue":o[2]||=e=>L.password=e,type:P.value?`text`:`password`,outlined:``,dense:``,placeholder:`••••••••`,rules:[e=>!!e||`Required`],class:`login-input`},{prepend:r(()=>[s(u,{name:`lock_outline`,size:`18px`,color:`grey-5`})]),append:r(()=>[s(u,{name:P.value?`visibility_off`:`visibility`,size:`18px`,color:`grey-5`,class:`cursor-pointer`,onClick:o[1]||=e=>P.value=!P.value},null,8,[`name`])]),_:1},8,[`modelValue`,`type`,`rules`]),i(`div`,D,[s(g,{modelValue:L.remember,"onUpdate:modelValue":o[3]||=e=>L.remember=e,label:t.$t(`RememberMe`),dense:``,size:`sm`,color:`cyan-7`},null,8,[`modelValue`,`label`])]),s(d,{type:`submit`,unelevated:``,class:`full-width login-btn`,loading:F.value,disable:F.value},{default:r(()=>[i(`span`,null,n(t.$t(`SignIn`)),1),s(u,{name:`arrow_forward`,size:`18px`,class:`q-ml-xs`})]),_:1},8,[`loading`,`disable`])]),_:1}),i(`div`,O,[i(`div`,k,n(t.$t(`QuickDemoLogin`)),1),i(`div`,A,[s(d,{flat:``,dense:``,size:`sm`,outline:``,color:`grey-6`,class:`login-demo__btn`,onClick:R},{default:r(()=>[...o[6]||=[c(` Administrator `,-1)]]),_:1})])])]))}},[[`__scopeId`,`data-v-65bd2882`]]);export{j as default};