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