import{u as b,j as h,r as p,k as C,l as Q,m as o,f as a,n as r,t as q,p as u,Q as x,q as y,s as m,v as V,x as j,A as g,C as S,U as c}from"./index.1437ed02.js";import{u as U,Q as k,a as D,b as L}from"./use-quasar.5bf5c5c3.js";import{Q as O}from"./QPage.42a01162.js";import{u as A}from"./vue-i18n.runtime.esm-bundler.c009a61d.js";const B={class:"column"},P={class:"row"},E={class:"text-h5 text-white q-my-md"},I={class:"row"},W={__name:"LoginPage",setup(N){const d=b(),w=h(),s=A().t,i=U(),t=p({username:null,password:null}),n=p(!1);async function _(){n.value=!0;try{const e=await new g().login(t.value.username,t.value.password);if(e.data.responseCode===0&&e.data.responseObject!==null){const v=await new S(e.data.responseObject.token).getConfig();d.setServerConfig(v.data.responseObject),d.setLoggedUser(e.data.responseObject),d.setConnected(!0),w.push("/")}else n.value=!1,e.data.responseCode===g.WrongCredentials?c.showErrorDialog(i,s,s("wrongUserNameOrPassword")):c.showErrorDialog(i,s)}catch{n.value=!1,c.showErrorDialog(i,s)}}return(f,e)=>(C(),Q(k,{view:"hHh Lpr lff"},{default:o(()=>[a(L,null,{default:o(()=>[a(O,{class:"window-height window-width row justify-center items-center"},{default:o(()=>[r("div",B,[r("div",P,[r("h5",E,q(u(s)("osRobot")),1)]),r("div",I,[a(x,{square:"",bordered:"",class:"q-pa-xl shadow-1"},{default:o(()=>[a(y,null,{default:o(()=>[a(D,{class:"q-gutter-md"},{default:o(()=>[a(m,{square:"",filled:"",clearable:"",type:"text",label:u(s)("username"),modelValue:t.value.username,"onUpdate:modelValue":e[0]||(e[0]=l=>t.value.username=l)},null,8,["label","modelValue"]),a(m,{square:"",filled:"",clearable:"",type:"password",label:u(s)("password"),modelValue:t.value.password,"onUpdate:modelValue":e[1]||(e[1]=l=>t.value.password=l)},null,8,["label","modelValue"])]),_:1})]),_:1}),a(V,{class:"q-px-md"},{default:o(()=>[a(j,{unelevated:"",color:"light-blue-7",size:"lg",class:"full-width",label:u(s)("login"),loading:n.value,onClick:e[2]||(e[2]=l=>_())},null,8,["label","loading"])]),_:1})]),_:1})])])]),_:1})]),_:1})]),_:1}))}};export{W as default};
