"use strict";(globalThis.webpackChunkwheelsmart_admin_react||=[]).push([[8649],{11062(e,a,s){s.d(a,{A:()=>l});var n=s(5835),t=s(70579);function l(e){const{value:a,onChange:s,onBlur:l}=e;return(0,t.jsx)(n.A,{...e,onChange:a=>{const{value:n}=a.target;(/^-?\d*(\.\d*)?$/.test(n)||""===n||"-"===n)&&s({key:e.name,value:n})},onBlur:e.onBlur&&(()=>{var s;let n=a;"."!==(null===a||void 0===a?void 0:a.charAt(a.length-1))&&"-"!==a||(n=a.slice(0,-1)),l({key:e.name,value:null===(s=n)||void 0===s?void 0:s.replace(/0*(\d+)/,"$1")})})})}},88649(e,a,s){s.r(a),s.d(a,{default:()=>P});var n=s(65043),t=s(62582),l=s(68493),r=s(47419),i=s(11645),o=s(44394),h=s(89421),m=s(51238),d=s(8738),u=s(91688),c=s(97508),p=s(71494),g=s(96709),x=s(11062),v=s(70579);function j(e){const[a,s]=(0,n.useState)(0),[t,l]=(0,n.useState)(0);return(0,n.useEffect)(()=>{if(e.showTimer){const a=setInterval(()=>{s(s=>(120==s+1&&(clearInterval(a),e.timeStop()),s+1))},1e3);return()=>clearInterval(a)}},[e.showTimer]),(0,n.useEffect)(()=>{l(e=>120-a%120)},[a]),(0,v.jsx)("div",{children:(e=>`${String(Math.floor(e/60)).padStart(2,"0")}:${String(e%60).padStart(2,"0")}`)(t)})}var f=s(32806);const P=(0,c.Ng)(function(e){let{login:a}=e;return{loginError:a.loginError,loginData:a.loginData,OTPSend:a.OTPSend,showResentOTP:a.showResentOTP}},{InputChangeValue:f.O2,cleardata:f.oe,checkLogin:f.wD,getOTPRequest:f.PH,getResendOTP:f.FC,showResend:f.ne})(function(e){var a,s,c,f;const[P,T]=(0,n.useState)(!1),{time:y}=e,b=(0,u.useHistory)(),w=(0,m.A)(),[A]=l.A.useForm();return(0,n.useEffect)(()=>{e.cleardata(),localStorage.getItem("access_token")&&b.push("/")},[]),(0,n.useEffect)(()=>{A.setFieldsValue({password:e.loginData.password,username:e.loginData.username})},[e.loginData]),(0,v.jsxs)(r.A,{gutter:[32,0],className:"hp-authentication-page",children:[(0,v.jsx)(p.A,{}),(0,v.jsx)(i.A,{lg:12,span:24,className:"hp-py-sm-0 hp-py-md-64",children:(0,v.jsx)(r.A,{className:"hp-h-100",align:"middle",justify:"center",children:(0,v.jsxs)(i.A,{children:[(0,v.jsx)("div",{className:"hp-m-0 hp-p-0",children:(0,v.jsx)("img",{src:g.A,style:{height:150,width:500},alt:"Logo"})}),(0,v.jsxs)("div",{xxl:11,xl:15,lg:20,md:20,sm:24,className:"hp-px-sm-8 hp-pt-24 hp-pb-48",children:[(0,v.jsx)("h1",{className:"hp-mb-sm-0",children:"Login"}),(0,v.jsx)("p",{className:"hp-mt-sm-0 hp-mt-8 hp-text-color-black-60",children:"Welcome back, please login to your account."}),(0,v.jsxs)(l.A,{layout:"vertical",name:"loginWithPhone",className:"hp-mt-sm-16 hp-mt-32",form:A,onFinish:()=>{if(e.OTPSend){var a={password:e.loginData.password,username:e.loginData.username,device_uuid:w,device_name:d.C0,device_type:3};e.checkLogin({loginData:a,history:b})}else e.getOTPRequest({username:e.loginData.username})},children:[(0,v.jsx)(l.A.Item,{label:"Enter your mobile number:",name:"username",rules:[{required:!0,message:"Please input your mobile number!"},{min:10,message:"Phone Number Must be 10 number"}],getValueProps:()=>{},hasFeedback:!0,children:(0,v.jsx)(x.A,{id:"username",name:"username",style:{width:"100%"},placeholder:"Mobile Number",maxLength:10,value:null==e.loginData.username?"":null===(a=e.loginData)||void 0===a?void 0:a.username,onChange:e.InputChangeValue})}),e.OTPSend&&(0,v.jsx)(v.Fragment,{children:(0,v.jsx)(l.A.Item,{label:"Enter your OTP:",name:"password",rules:[{required:!0,message:"Please input your OTP!"}],getValueProps:()=>{},hasFeedback:!0,children:(0,v.jsx)(x.A,{id:"password",name:"password",style:{width:"100%"},placeholder:"OTP",maxLength:4,value:null==e.loginData.password?"":null===(s=e.loginData)||void 0===s?void 0:s.password,onChange:e.InputChangeValue})})}),(null===(c=e.loginError)||void 0===c?void 0:c.detail)&&(0,v.jsx)(o.A,{message:null===(f=e.loginError)||void 0===f?void 0:f.detail,type:"error"}),(0,v.jsx)(l.A.Item,{className:"hp-mt-16 hp-mb-8",children:e.OTPSend?(0,v.jsx)(h.A,{block:!0,type:"primary",htmlType:"submit",children:"Submit"}):(0,v.jsx)(h.A,{block:!0,type:"primary",htmlType:"submit",children:"REQUEST OTP"})})]}),(0,v.jsxs)(r.A,{children:[(0,v.jsx)(i.A,{span:24,md:12,children:(0,v.jsx)("div",{className:"hp-form-info",children:(0,v.jsx)(t.N_,{className:"hp-text-color-primary-1 hp-text-color-dark-primary-2 hp-caption",to:"/login",children:"Login with UserName"})})}),e.OTPSend&&(0,v.jsx)(i.A,{span:24,md:12,children:e.showResentOTP?(0,v.jsx)("div",{className:"hp-form-info hp-float-right",onClick:function(){e.getResendOTP({username:e.loginData.username})},children:"Resend OTP"}):(0,v.jsxs)("div",{className:"hp-form-info hp-float-right",children:["Resent OTP In",(0,v.jsx)(j,{time:y,showTimer:!e.showResentOTP,timeStop:()=>{e.showResend(!0)}})]})})]})]})]})})})]})})}}]);
//# sourceMappingURL=8649.7d6264c7.chunk.js.map