"use strict";(self["webpackChunkgolden_software"]=self["webpackChunkgolden_software"]||[]).push([[141],{5141:function(e,l,u){u.r(l),u.d(l,{default:function(){return b}});var t=u(3396),o=u(2268),s=u(9242),a=u(4870),r=u(7139);const n=(0,t._)("div",{class:"h-[100vh] absolute w-full flex justify-center items-center"},null,-1),d=(0,t._)("div",{class:"flex justify-center font-extrabold text-xl"},"Login as User",-1),p={key:2,class:"flex justify-end"};var i={__name:"LoginUser",setup(e){const l=(0,r.oR)(),u=(0,a.qj)({submit:!1,userId:null,userPassword:null,phoneNumber:null,otp:null}),i=(0,t.Fl)((()=>l.state.Auth)),m=(0,t.Fl)((()=>u.userId?null:"Please enter username")),b=(0,t.Fl)((()=>u.userPassword?null:"Please enter password")),c=(0,t.Fl)((()=>u.otp?null:"Please enter OTP")),f=(0,t.Fl)((()=>{let e=/^[6-9][0-9]{9}$/;return u.phoneNumber?e.test(u.phoneNumber)?null:"Please enter valid phone no!":"Please enter your phone no!"})),h=()=>{if(m.value||b.value)u.submit=!0;else if(i.value.otpStatus){if(i.value.otpStatus){if(c.value)return void(u.submit=!0);u.submit=!1,l.dispatch("Auth/verifyOtp",{phoneNumber:u.phoneNumber,otp:u.otp})}}else u.submit=!1,l.dispatch("Auth/verifyUser",{loginId:u.userId,phoneNumber:u.phoneNumber,password:u.userPassword})};function v(){m.value||b.value?u.submit=!0:(u.submit=!1,l.dispatch("Auth/verifyUser",{loginId:u.userId,phoneNumber:u.phoneNumber,password:u.userPassword}))}function w(e){let l=String.fromCharCode(e.keyCode);if(/^[0-9]+$/.test(l))return!0;e.preventDefault()}function g(e){u.phoneNumber=e.slice(0,10)}return(e,l)=>{const a=(0,t.up)("base-Notification"),r=(0,t.up)("base-divider"),y=(0,t.up)("base-control"),P=(0,t.up)("base-field"),k=(0,t.up)("base-button"),_=(0,t.up)("base-buttons"),N=(0,t.up)("card-component"),W=(0,t.up)("full-screen-section");return(0,t.wg)(),(0,t.iD)(t.HY,null,[n,(0,t.Wm)(W,{bg:"login",class:"h-[100vh] fixed w-full flex justify-evenly bg-[url('../../assets/img/bg4.png')] bg-black bg-cover bg-right-center"},{default:(0,t.w5)((({cardClass:e,cardRounded:n})=>[(0,t.Wm)(N,{class:(0,o.C_)(["z-10 bg-white/[0.5] dark:bg-slate-900/[0.85] backdrop-blur-[10px] dark:backdrop-blur-[3px] border-solid border-white border-opacity-20",e]),rounded:n,form:"",onSubmit:(0,s.iM)(h,["prevent"])},{default:(0,t.w5)((()=>[i.value.msg?((0,t.wg)(),(0,t.j4)(a,{key:0,color:i.value.status?"success":"danger"},{default:(0,t.w5)((()=>[(0,t.Uk)((0,o.zw)(i.value.msg),1)])),_:1},8,["color"])):(0,t.kq)("",!0),d,(0,t.Wm)(r),(0,t.Wm)(P,{label:"Username",help:u.submit?m.value:""},{default:(0,t.w5)((()=>[(0,t.Wm)(y,{modelValue:u.userId,"onUpdate:modelValue":l[0]||(l[0]=e=>u.userId=e),name:"login",placeholder:"Enter Username",autocomplete:"login"},null,8,["modelValue"])])),_:1},8,["help"]),(0,t.Wm)(P,{label:"Phone",help:u.submit?f.value:""},{default:(0,t.w5)((()=>[(0,t.Wm)(y,{modelValue:u.phoneNumber,"onUpdate:modelValue":l[1]||(l[1]=e=>u.phoneNumber=e),name:"phone",onKeypress:l[2]||(l[2]=e=>w(e)),onKeyup:l[3]||(l[3]=e=>g(e.target.value)),placeholder:"Enter Phone Number",autocomplete:"phone"},null,8,["modelValue"])])),_:1},8,["help"]),(0,t.Wm)(P,{label:"Password",help:u.submit?b.value:""},{default:(0,t.w5)((()=>[(0,t.Wm)(y,{modelValue:u.userPassword,"onUpdate:modelValue":l[4]||(l[4]=e=>u.userPassword=e),placeholder:"Enter Password",type:"password",autocomplete:"off"},null,8,["modelValue"])])),_:1},8,["help"]),i.value.otpStatus?((0,t.wg)(),(0,t.j4)(P,{key:1,label:"OTP ",help:u.submit?c.value:""},{default:(0,t.w5)((()=>[(0,t.Wm)(y,{modelValue:u.otp,"onUpdate:modelValue":l[5]||(l[5]=e=>u.otp=e),placeholder:"Enter OTP",type:"text",autocomplete:"off"},null,8,["modelValue"])])),_:1},8,["help"])):(0,t.kq)("",!0),i.value.otpStatus?((0,t.wg)(),(0,t.iD)("div",p,[(0,t._)("span",{class:"select-none cursor-pointer",onClick:v},"Resend OTP")])):(0,t.kq)("",!0),(0,t.Wm)(r),(0,t.Wm)(_,{class:"flex justify-center"},{default:(0,t.w5)((()=>[(0,t.Wm)(k,{type:"submit",color:"info",label:"Login"})])),_:1})])),_:2},1032,["class","rounded","onSubmit"])])),_:1})],64)}}};const m=i;var b=m}}]);
//# sourceMappingURL=141.d0274e12.js.map