import{_ as h}from"./BlockAuthEnter-Dy8-AnaO.js";import{m as k}from"./bootstrap-vue-next-3DpAa4tb.js";import{_ as E}from"./ButtonDefault-CghIUDY0.js";import{_ as P}from"./BasicInput-BYe5b9L8.js";import{r as t,u as x,c as C,a,b as n,n as _,w as U,d as I,o as O,e as S}from"./index-CipWZKo_.js";import{u as y}from"./promoStore-Ce5toj5N.js";import"./_plugin-vue_export-helper-DlAUqK2U.js";import"./component-DWBAga-C.js";const B={class:"sign-in"},A={class:"section"},F={class:"container"},H={class:"form-offset_label"},L={class:"form-offset_label"},G={__name:"Logon",setup(M){const f=y(),s=I(),r=t(null),u=t(null),m=t(!0),i=t(null),d=t(!1),v=t(""),R=x();async function b(){if(r.value===null||r.value?.length<3||u.value===null||u.value<4)i.value="ERROR";else{d.value=!0;const l=await R.signIn({Email:r.value,Password:u.value,IsRemember:m.value===!0?"1":"0",ReOpen:"yes",XMLHttpRequest:"yes"});if(d.value=!1,l.result!=="success")i.value="ERROR",v.value=l.errorMessage;else if(l.data?.User?.InterfaceID==="User")if(s.currentRoute.value.redirectedFrom?.fullPath){const e=s.currentRoute.value.redirectedFrom?.query?.PromoCode;e&&f.setPromoCode(e),s.push({path:s.currentRoute.value.redirectedFrom?.fullPath})}else s.push("/Home");else window.location.replace("/Administrator/Home")}}function g(l){s.push(l)}return(l,e)=>{const c=P,p=E,w=k,V=h;return O(),C("div",B,[a("div",A,[a("div",F,[e[6]||(e[6]=a("div",{class:"section-header"},[a("h1",{class:"section-title"},"Войти в аккаунт")],-1)),n(c,{class:_({"form-field-error":i.value==="ERROR"}),label:"Email",name:"login",modelValue:r.value,"onUpdate:modelValue":e[0]||(e[0]=o=>r.value=o)},null,8,["class","modelValue"]),n(c,{class:_({"form-field-error":i.value==="ERROR"}),label:"Пароль",name:"password",modelValue:u.value,"onUpdate:modelValue":e[1]||(e[1]=o=>u.value=o),"is-password":""},null,8,["class","modelValue"]),a("div",H,[n(p,{class:"button-password-restore",label:"ЗАБЫЛ ПАРОЛЬ",onClick:e[2]||(e[2]=o=>g("/UserPasswordRestore"))})]),a("div",L,[n(p,{onClick:e[3]||(e[3]=o=>b()),"is-loading":d.value,label:"Войти"},null,8,["is-loading"]),n(w,{id:"checkbox-1",modelValue:m.value,"onUpdate:modelValue":e[4]||(e[4]=o=>m.value=o),name:"checkbox-1"},{default:U(()=>e[5]||(e[5]=[S("Запомнить меня",-1)])),_:1,__:[5]},8,["modelValue"])]),n(V,{label:"Войти с помощью",class:"tw-mt-6"})])])])}}};export{G as default};
