@acuteinfo/common-screens 1.0.61 → 1.0.63
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1 -3237
- package/dist/index.js.map +1 -1
- package/dist/pages/auth/passwordRotation.d.ts +1 -1
- package/package.json +2 -2
- package/rollup.config.mjs +1 -1
package/dist/index.js
CHANGED
|
@@ -1,3238 +1,2 @@
|
|
|
1
|
-
import 'regenerator-runtime/runtime';
|
|
2
|
-
import './assets/index~NFLKLAwc.css';
|
|
3
|
-
import { jsx, jsxs, Fragment as Fragment$1 } from 'react/jsx-runtime';
|
|
4
|
-
import { TextField, GradientButton, utilFunction, usePopupContext, ClearCacheProvider, queryClient, Alert, GridWrapper, SearchBar } from '@acuteinfo/common-base';
|
|
5
|
-
import { useState, useRef, useEffect, Fragment, useMemo, useReducer, useCallback } from 'react';
|
|
6
|
-
import { makeStyles } from '@mui/styles';
|
|
7
|
-
import Visibility from '@mui/icons-material/Visibility';
|
|
8
|
-
import VisibilityOff from '@mui/icons-material/VisibilityOff';
|
|
9
|
-
import { Container, Grid, InputAdornment, IconButton, CircularProgress, FormHelperText, Typography, Tooltip, tooltipClasses, Stack, Box, Avatar, Button, alpha, AppBar, Toolbar, List, ListItemIcon, ListItem, ListItemText, Collapse, Drawer } from '@mui/material';
|
|
10
|
-
import { useTranslation } from 'react-i18next';
|
|
11
|
-
import OTPInput, { ResendOTP } from 'otp-input-react';
|
|
12
|
-
import IconButton$1 from '@mui/material/IconButton';
|
|
13
|
-
import clsx from 'clsx';
|
|
14
|
-
import { useSnackbar } from 'notistack';
|
|
15
|
-
import FingerprintSharpIcon from '@mui/icons-material/FingerprintSharp';
|
|
16
|
-
import './assets/verify~MOgwPpDY.css';
|
|
17
|
-
import CryptoJS from 'crypto-js';
|
|
18
|
-
import './assets/styles~ILuxAzHT.css';
|
|
19
|
-
import { useQuery, useMutation } from 'react-query';
|
|
20
|
-
import bank_logo_default from './assets/BecomePartnerImg~cwVtJhaB.svg';
|
|
21
|
-
import Waving_hand from './assets/waving-hand~JqQoivUD.png';
|
|
22
|
-
import { styled } from '@mui/material/styles';
|
|
23
|
-
import USER_PROFILE_DEFAULT from './assets/profile-default~evuVPsgu.png';
|
|
24
|
-
import LogoutIcon from '@mui/icons-material/Logout';
|
|
25
|
-
import MenuOutlinedIcon from '@mui/icons-material/MenuOutlined';
|
|
26
|
-
import { format } from 'date-fns';
|
|
27
|
-
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
28
|
-
import ScrollBar from 'react-perfect-scrollbar';
|
|
29
|
-
import { ExpandLess, ExpandMore } from '@mui/icons-material';
|
|
30
|
-
import ArrowBackIosNewIcon from '@mui/icons-material/ArrowBackIosNew';
|
|
31
|
-
import { library } from '@fortawesome/fontawesome-svg-core';
|
|
32
|
-
import { faHandsHelping, faUsers, faBars, faBalanceScale, faHandHoldingHeart, faTasks, faCog, faHome, faTh, faUsersCog, faCircle, faUserCircle, faHashtag, faThumbtack, faSquare, faLink, faQuestion, faPlus, faTable, faLocationArrow, faHeadset, faGears, faArrowDown, faArrowUp, faSpinner, faCircleExclamation, faRotateRight, faUserLock, faUserClock, faGripHorizontal, faFileLines, faGear, faHeadphones, faUsersGear, faMessage, faUnlock, faUserPlus, faUserCheck, faKey, faIdCard, faIdBadge, faCheck, faCheckDouble, faCircleCheck, faCircleXmark, faUserTag, faAddressCard, faChartColumn, faUserPen, faHandHolding, faHandHoldingMedical, faObjectGroup, faTowerCell, faTowerObservation, faBuilding, faMailBulk, faLandmarkFlag, faCreditCard, faHospitalSymbol, faPlugCircleBolt, faCodeBranch, faPersonCircleCheck, faBank, faServer, faNotesMedical, faPenToSquare, faBarsProgress, faFileExport, faA, faB, faC, faD, faE, faF, faG, faH, faI, faJ, faK, faL, faM, faN, faO, faP, faQ, faR, faS, faT, faU, faV, faW, faX, faY, faZ } from '@fortawesome/free-solid-svg-icons';
|
|
33
|
-
import 'lodash';
|
|
34
|
-
|
|
35
|
-
const useStyles$3 = makeStyles((theme) => ({
|
|
36
|
-
wrapper: {
|
|
37
|
-
minHeight: "100vh",
|
|
38
|
-
boxShadow: "0 3px 6px rgba(0,0,0,0.03)",
|
|
39
|
-
// background: "#fff",
|
|
40
|
-
background: "var(--white)",
|
|
41
|
-
},
|
|
42
|
-
loginEmp: {
|
|
43
|
-
background: "#fff",
|
|
44
|
-
padding: theme.spacing(2, 4),
|
|
45
|
-
display: "flex",
|
|
46
|
-
maxWidth: "400px",
|
|
47
|
-
margin: "auto",
|
|
48
|
-
boxShadow: "0 0 20px rgba(0,0,0,0.06)",
|
|
49
|
-
borderRadius: "8px",
|
|
50
|
-
[theme.breakpoints.down("sm")]: {
|
|
51
|
-
width: "100%",
|
|
52
|
-
},
|
|
53
|
-
},
|
|
54
|
-
formWrap: {
|
|
55
|
-
marginTop: theme.spacing(2),
|
|
56
|
-
},
|
|
57
|
-
loginBtn: {
|
|
58
|
-
minWidth: "100% !important",
|
|
59
|
-
margin: theme.spacing(2, 0),
|
|
60
|
-
fontSize: "1rem",
|
|
61
|
-
padding: "10px .75rem",
|
|
62
|
-
background: "rgb(128,0,0)",
|
|
63
|
-
border: 0,
|
|
64
|
-
color: "#fff !important",
|
|
65
|
-
fontWeight: 600,
|
|
66
|
-
letterSpacing: "0.02857em",
|
|
67
|
-
boxShadow: "none",
|
|
68
|
-
textTransform: "capitalize",
|
|
69
|
-
alignSelf: "flex-end",
|
|
70
|
-
"&:hover": {
|
|
71
|
-
background: "#fedad8",
|
|
72
|
-
boxShadow: "none",
|
|
73
|
-
},
|
|
74
|
-
},
|
|
75
|
-
OTPTimer: {
|
|
76
|
-
marginTop: "10px",
|
|
77
|
-
color: theme.palette.primary.main,
|
|
78
|
-
fontWeight: 600,
|
|
79
|
-
},
|
|
80
|
-
resendLink: {
|
|
81
|
-
marginTop: "10px",
|
|
82
|
-
cursor: "pointer",
|
|
83
|
-
color: theme.palette.secondary.main,
|
|
84
|
-
fontWeight: 600,
|
|
85
|
-
fontSize: "0.875 rem",
|
|
86
|
-
},
|
|
87
|
-
logo: {
|
|
88
|
-
marginBottom: theme.spacing(1),
|
|
89
|
-
},
|
|
90
|
-
loginLeft: {
|
|
91
|
-
[theme.breakpoints.down("sm")]: {
|
|
92
|
-
display: "none",
|
|
93
|
-
},
|
|
94
|
-
},
|
|
95
|
-
loginRight: {
|
|
96
|
-
background: "#fff",
|
|
97
|
-
padding: theme.spacing(2, 4),
|
|
98
|
-
display: "flex",
|
|
99
|
-
maxWidth: "400px",
|
|
100
|
-
margin: "auto",
|
|
101
|
-
boxShadow: "0 0 20px rgba(0,0,0,0.06)",
|
|
102
|
-
borderRadius: "8px",
|
|
103
|
-
[theme.breakpoints.down("sm")]: {
|
|
104
|
-
width: "100%",
|
|
105
|
-
},
|
|
106
|
-
"& img": {
|
|
107
|
-
alignSelf: "center",
|
|
108
|
-
},
|
|
109
|
-
},
|
|
110
|
-
loginImg: {},
|
|
111
|
-
verifybutton: {
|
|
112
|
-
alignSelf: "center",
|
|
113
|
-
// marginBottom: "10px",
|
|
114
|
-
// marginTop: "10px",
|
|
115
|
-
padding: "5px",
|
|
116
|
-
},
|
|
117
|
-
otpButtons: {
|
|
118
|
-
// padding: "10px",
|
|
119
|
-
},
|
|
120
|
-
divflex: {
|
|
121
|
-
display: "flex",
|
|
122
|
-
},
|
|
123
|
-
otpinputpadding: {
|
|
124
|
-
"& input": {
|
|
125
|
-
marginRight: "25px !important",
|
|
126
|
-
border: "1.42444px solid var(--theme-color3)",
|
|
127
|
-
borderRadius: "10px",
|
|
128
|
-
width: "45px !important",
|
|
129
|
-
height: "45px !important",
|
|
130
|
-
marginBottom: "15px",
|
|
131
|
-
boxShadow: "0px 5.69775px 11.3955px rgba(66, 99, 199, 0.16)",
|
|
132
|
-
},
|
|
133
|
-
},
|
|
134
|
-
ibtnvisible: {
|
|
135
|
-
// padding: "7px !important",
|
|
136
|
-
// alignItems: "baseline",
|
|
137
|
-
marginBottom: "15px",
|
|
138
|
-
},
|
|
139
|
-
btnvisibleoff: {
|
|
140
|
-
display: "none",
|
|
141
|
-
},
|
|
142
|
-
OTPalignName: {
|
|
143
|
-
display: "flex",
|
|
144
|
-
alignItems: "center",
|
|
145
|
-
// justifyContent: "space-between",
|
|
146
|
-
marginBottom: "12px",
|
|
147
|
-
color: "#1C1C1C",
|
|
148
|
-
fonWeight: "400",
|
|
149
|
-
fontSize: "17px",
|
|
150
|
-
lineHeight: "33px",
|
|
151
|
-
},
|
|
152
|
-
resendOTPalign: {
|
|
153
|
-
color: "var(--theme-color3)",
|
|
154
|
-
fonWeight: "400",
|
|
155
|
-
fontSize: "17px",
|
|
156
|
-
lineHeight: "33px",
|
|
157
|
-
margin: "0 auto",
|
|
158
|
-
// marginTop: "15px",
|
|
159
|
-
// display: "block !important",
|
|
160
|
-
},
|
|
161
|
-
resendbtnLink: {
|
|
162
|
-
textDecoration: "underline",
|
|
163
|
-
color: "var(--theme-color3)",
|
|
164
|
-
cursor: "pointer",
|
|
165
|
-
"&:hover": {
|
|
166
|
-
textDecoration: "underline",
|
|
167
|
-
color: "var(--theme-color3)",
|
|
168
|
-
},
|
|
169
|
-
},
|
|
170
|
-
dialogTitleClass: {
|
|
171
|
-
background: "var(--primary-bg)",
|
|
172
|
-
padding: "6px 15px !important",
|
|
173
|
-
margin: "10px",
|
|
174
|
-
color: "var(--white)",
|
|
175
|
-
borderRadius: "4px",
|
|
176
|
-
"& h2": {
|
|
177
|
-
fontWeight: "500 !important",
|
|
178
|
-
},
|
|
179
|
-
},
|
|
180
|
-
lang_svg: {
|
|
181
|
-
marginRight: "10px",
|
|
182
|
-
width: "22px",
|
|
183
|
-
height: "22px",
|
|
184
|
-
},
|
|
185
|
-
dialogContent: {
|
|
186
|
-
padding: "0px 15px",
|
|
187
|
-
"& p": {
|
|
188
|
-
whiteSpace: "pre-wrap",
|
|
189
|
-
color: "black",
|
|
190
|
-
marginTop: "8px",
|
|
191
|
-
marginBottom: "6px",
|
|
192
|
-
},
|
|
193
|
-
},
|
|
194
|
-
button: {
|
|
195
|
-
display: "flex",
|
|
196
|
-
alignItems: "center",
|
|
197
|
-
justifyContent: "center",
|
|
198
|
-
flexDirection: "column",
|
|
199
|
-
margin: "6px",
|
|
200
|
-
background: "var(--theme-color1)",
|
|
201
|
-
"&:hover": {
|
|
202
|
-
background: "var(--theme-color1) !important",
|
|
203
|
-
},
|
|
204
|
-
},
|
|
205
|
-
}));
|
|
206
|
-
|
|
207
|
-
const UsernamePasswordField = ({ classes, loginState, verifyUsernamePassword, forgotPasswordEndpoint, }) => {
|
|
208
|
-
const [input, setInput] = useState({ userName: "", password: "" });
|
|
209
|
-
const [showPasswordTime, setShowPasswordTime] = useState(0);
|
|
210
|
-
const showPassword = Date.now() < showPasswordTime;
|
|
211
|
-
const [, forceUpdate] = useState();
|
|
212
|
-
const timerRef = useRef(null);
|
|
213
|
-
const { t } = useTranslation();
|
|
214
|
-
useEffect(() => {
|
|
215
|
-
return () => clearTimeout(timerRef.current);
|
|
216
|
-
}, []);
|
|
217
|
-
const handleChange = (event) => {
|
|
218
|
-
const name = event.target.name;
|
|
219
|
-
const value = event.target.value;
|
|
220
|
-
if (name === "userName" && value) {
|
|
221
|
-
loginState.isUsernameError = false;
|
|
222
|
-
}
|
|
223
|
-
if (name === "password" && value) {
|
|
224
|
-
loginState.isPasswordError = false;
|
|
225
|
-
}
|
|
226
|
-
setInput((values) => ({ ...values, [name]: value }));
|
|
227
|
-
};
|
|
228
|
-
const inputRef = useRef(null);
|
|
229
|
-
const inputPassRef = useRef(null);
|
|
230
|
-
const inputButtonRef = useRef(null);
|
|
231
|
-
useEffect(() => {
|
|
232
|
-
let timeoutCd;
|
|
233
|
-
if (loginState.isUsernameError) {
|
|
234
|
-
timeoutCd = setTimeout(() => {
|
|
235
|
-
inputRef?.current?.focus?.();
|
|
236
|
-
}, 1000);
|
|
237
|
-
}
|
|
238
|
-
else if (loginState.isPasswordError) {
|
|
239
|
-
timeoutCd = setTimeout(() => {
|
|
240
|
-
inputPassRef?.current?.focus?.();
|
|
241
|
-
}, 1000);
|
|
242
|
-
}
|
|
243
|
-
return () => {
|
|
244
|
-
if (timeoutCd) {
|
|
245
|
-
clearTimeout(timeoutCd);
|
|
246
|
-
}
|
|
247
|
-
};
|
|
248
|
-
}, [loginState.isUsernameError, loginState.isPasswordError]);
|
|
249
|
-
useEffect(() => {
|
|
250
|
-
let timeoutCd;
|
|
251
|
-
if (loginState?.otpmodelClose ?? false) {
|
|
252
|
-
setInput((values) => ({ ...values, password: "" }));
|
|
253
|
-
timeoutCd = setTimeout(() => {
|
|
254
|
-
inputPassRef?.current?.focus?.();
|
|
255
|
-
}, 1500);
|
|
256
|
-
}
|
|
257
|
-
return () => {
|
|
258
|
-
if (timeoutCd) {
|
|
259
|
-
clearTimeout(timeoutCd);
|
|
260
|
-
}
|
|
261
|
-
};
|
|
262
|
-
}, [loginState.otpmodelClose]);
|
|
263
|
-
return (jsx(Fragment, { children: jsx(Container, { maxWidth: "xs", children: jsxs(Grid, { alignItems: "center", style: { paddingTop: "20px" }, children: [jsx("div", { style: {
|
|
264
|
-
color: "#000000 !important",
|
|
265
|
-
fontSize: "30px",
|
|
266
|
-
fontWeight: "600",
|
|
267
|
-
// fontFamily: "Poppins",
|
|
268
|
-
alignItems: "center",
|
|
269
|
-
fontStyle: "normal",
|
|
270
|
-
lineHeight: "150%",
|
|
271
|
-
}, children: jsx("h3", { children: t("SignIn") }) }), jsx("div", { className: "", style: {
|
|
272
|
-
color: "#949597",
|
|
273
|
-
fontSize: "16px",
|
|
274
|
-
fontWeight: "400",
|
|
275
|
-
// fontFamily: "Poppins",
|
|
276
|
-
alignItems: "center",
|
|
277
|
-
fontStyle: "normal",
|
|
278
|
-
width: "360px",
|
|
279
|
-
}, children: t("SignInWithUserIDandPassword") }), jsxs("div", { className: classes.formWrap, children: [jsx(TextField
|
|
280
|
-
// variant="filled"
|
|
281
|
-
// color="secondary"
|
|
282
|
-
, {
|
|
283
|
-
// variant="filled"
|
|
284
|
-
// color="secondary"
|
|
285
|
-
autoFocus: true, label: t("UserID"),
|
|
286
|
-
// placeholder="User ID"
|
|
287
|
-
placeholder: String(t("UserID")), style: {
|
|
288
|
-
marginTop: "10px",
|
|
289
|
-
marginBottom: "17px",
|
|
290
|
-
}, fullWidth: true, type: "text", name: "userName", value: input.userName.trimStart() || "", onChange: handleChange, error: loginState.isUsernameError, helperText: loginState.isUsernameError
|
|
291
|
-
? t(loginState.userMessageforusername)
|
|
292
|
-
: "", InputLabelProps: { shrink: true }, disabled: loginState.loading, autoComplete: "off", ref: inputRef, onKeyDown: (e) => {
|
|
293
|
-
if (e.key === "Enter") {
|
|
294
|
-
inputButtonRef?.current?.click?.();
|
|
295
|
-
}
|
|
296
|
-
}, inputProps: {
|
|
297
|
-
maxLength: "16",
|
|
298
|
-
} }), jsx("div", { style: {
|
|
299
|
-
display: "flex",
|
|
300
|
-
flexDirection: "row-reverse",
|
|
301
|
-
marginTop: "8px",
|
|
302
|
-
}, children: jsx(TextField, { label: t("Password"),
|
|
303
|
-
// variant="filled"
|
|
304
|
-
// color="secondary"
|
|
305
|
-
placeholder: String(t("EnterPassword")), InputLabelProps: {
|
|
306
|
-
shrink: true,
|
|
307
|
-
}, fullWidth: true, type: showPassword ? "text" : "password", name: "password", value: input.password, onChange: handleChange, error: loginState.isPasswordError, helperText: loginState.isPasswordError
|
|
308
|
-
? t(loginState.userMessageforpassword)
|
|
309
|
-
: "", disabled: loginState.loading, ref: inputPassRef, onKeyDown: (e) => {
|
|
310
|
-
if (e.key === "Enter") {
|
|
311
|
-
inputButtonRef?.current?.click?.();
|
|
312
|
-
}
|
|
313
|
-
}, InputProps: {
|
|
314
|
-
endAdornment: (jsx(InputAdornment, { position: "end", children: jsx(IconButton, { "aria-label": "toggle password visibility", onClick: () => {
|
|
315
|
-
if (!showPassword) {
|
|
316
|
-
setShowPasswordTime(Date.now() + 5000);
|
|
317
|
-
timerRef.current = setTimeout(() => forceUpdate(Date.now()), 5000);
|
|
318
|
-
}
|
|
319
|
-
else if (showPassword)
|
|
320
|
-
setShowPasswordTime(0);
|
|
321
|
-
}, onMouseDown: (e) => e.preventDefault(), disabled: loginState.loading, children: showPassword ? jsx(Visibility, {}) : jsx(VisibilityOff, {}) }) })),
|
|
322
|
-
}, inputProps: { maxLength: "16" } }, "employee") }), jsx("div", { style: { marginTop: "20px", display: "flex" }, children: jsx("div", { style: { flex: "auto", textAlign: "end" }, children: jsx("a", { href: forgotPasswordEndpoint ?? "", style: { color: "var(--theme-color3)" }, children: t("ForgotPassword") }) }) }), jsx("div", { style: { marginTop: "20px", display: "flex" }, children: jsx("div", { style: {
|
|
323
|
-
flex: "auto",
|
|
324
|
-
textAlign: "center",
|
|
325
|
-
marginTop: "5px",
|
|
326
|
-
marginBottom: "17px",
|
|
327
|
-
}, children: jsx(GradientButton, { style: {
|
|
328
|
-
borderRadius: loginState.loading ? "50%" : "10px",
|
|
329
|
-
height: loginState.loading ? "40px" : "100%",
|
|
330
|
-
width: loginState.loading ? "0px" : "100%",
|
|
331
|
-
minWidth: loginState.loading ? "40px" : "80px",
|
|
332
|
-
}, fullWidth: true, disabled: loginState.loading, onClick: () => verifyUsernamePassword((input.userName || "").toLowerCase(), input.password), ref: inputButtonRef, endicon: loginState.loading ? undefined : "East", rotateIcon: "scale(1.4) rotateX(360deg)", children: loginState.loading ? (jsx(CircularProgress, { size: 25, thickness: 4.6 })) : (t("Next")) }) }) })] })] }) }) }));
|
|
333
|
-
};
|
|
334
|
-
|
|
335
|
-
const OTPModel = ({ classes, OTPResendRequest, open, handleClose, loginState, VerifyOTP, OTPError, setOTPError, previousStep, setNewRequestID = (id) => { }, otpresendCount = 0, resendFlag, }) => {
|
|
336
|
-
const [OTP, setOTP] = useState("");
|
|
337
|
-
const [showPasswordTime, setShowPasswordTime] = useState(0);
|
|
338
|
-
const showPassword = Date.now() < showPasswordTime;
|
|
339
|
-
const [, forceUpdate] = useState();
|
|
340
|
-
const timerRef = useRef(null);
|
|
341
|
-
useEffect(() => {
|
|
342
|
-
return () => clearTimeout(timerRef.current);
|
|
343
|
-
}, []);
|
|
344
|
-
const [btnshow, setbtnshow] = useState(false);
|
|
345
|
-
const inputButtonRef = useRef(null);
|
|
346
|
-
const [resendotpLoading, setResendotpLoading] = useState(false);
|
|
347
|
-
const { enqueueSnackbar } = useSnackbar();
|
|
348
|
-
const { t } = useTranslation();
|
|
349
|
-
// const renderButton = (buttonProps) => {
|
|
350
|
-
// let { remainingTime, ...other } = buttonProps;
|
|
351
|
-
// return resendotpLoading ? (
|
|
352
|
-
// <a
|
|
353
|
-
// remainingtime={remainingTime}
|
|
354
|
-
// {...other}
|
|
355
|
-
// className={clsx(
|
|
356
|
-
// classes.resendbtnLink,
|
|
357
|
-
// !btnshow && classes.btnvisibleoff
|
|
358
|
-
// )}
|
|
359
|
-
// >
|
|
360
|
-
// {t("otp.ResendOTP")}
|
|
361
|
-
// </a>
|
|
362
|
-
// ) : null;
|
|
363
|
-
// };
|
|
364
|
-
const renderButton = (buttonProps) => {
|
|
365
|
-
let { remainingTime, ...other } = buttonProps;
|
|
366
|
-
return resendotpLoading ? (jsxs("a", { className: clsx(classes.resendbtnLink, !btnshow && classes.btnvisibleoff), style: { cursor: "wait" }, children: [t("otp.GetNewOTP"), " ", jsx(CircularProgress, { size: 20, color: "secondary" })] })) : (jsx("a", { remainingtime: remainingTime, ...other, className: clsx(classes.resendbtnLink, !btnshow && classes.btnvisibleoff), children: t("otp.GetNewOTP") }));
|
|
367
|
-
};
|
|
368
|
-
const ClickEventHandler = () => {
|
|
369
|
-
if (!Boolean(OTP) || OTP.length < 6) {
|
|
370
|
-
setOTPError("otp.EnterOTPDigit");
|
|
371
|
-
}
|
|
372
|
-
else {
|
|
373
|
-
setOTPError("");
|
|
374
|
-
VerifyOTP(OTP);
|
|
375
|
-
}
|
|
376
|
-
};
|
|
377
|
-
const handleResendClick = async () => {
|
|
378
|
-
setResendotpLoading(true);
|
|
379
|
-
const { status, data, message } = await OTPResendRequest(
|
|
380
|
-
// resendFlag === "FORGET_PW" || resendFlag === "FORGT_TOTP"
|
|
381
|
-
// ? loginState?.requestCd
|
|
382
|
-
// : loginState?.transactionID,
|
|
383
|
-
loginState?.comapanyCD, loginState?.branchCD, loginState?.contactUser, resendFlag, loginState?.otpValidFor, loginState?.username);
|
|
384
|
-
setResendotpLoading(false);
|
|
385
|
-
if (status === "0") {
|
|
386
|
-
setNewRequestID(data?.TRAN_CD);
|
|
387
|
-
setbtnshow(false);
|
|
388
|
-
enqueueSnackbar(message, { variant: "success" });
|
|
389
|
-
}
|
|
390
|
-
else {
|
|
391
|
-
enqueueSnackbar(message, { variant: "error" });
|
|
392
|
-
}
|
|
393
|
-
};
|
|
394
|
-
const handleCloseEvent = () => {
|
|
395
|
-
setOTPError("");
|
|
396
|
-
setOTP("");
|
|
397
|
-
handleClose("");
|
|
398
|
-
};
|
|
399
|
-
const renderTime = (remainingtime) => {
|
|
400
|
-
if (parseInt(remainingtime) === 0) {
|
|
401
|
-
setTimeout(() => {
|
|
402
|
-
setbtnshow(true);
|
|
403
|
-
}, 700);
|
|
404
|
-
}
|
|
405
|
-
return (jsxs("span", { className: clsx(btnshow && classes.btnvisibleoff), children: [t("otp.OtpExpired"), " ", remainingtime, " ", t("otp.second")] }));
|
|
406
|
-
};
|
|
407
|
-
useEffect(() => {
|
|
408
|
-
if (loginState?.otpmodelClose ?? false) {
|
|
409
|
-
handleCloseEvent();
|
|
410
|
-
}
|
|
411
|
-
else if (Boolean(OTPError)) {
|
|
412
|
-
setOTP("");
|
|
413
|
-
}
|
|
414
|
-
}, [loginState.otpmodelClose, OTPError]);
|
|
415
|
-
return (jsx(Fragment, { children: jsx(Container, { maxWidth: "sm", children: jsx(Grid, { alignItems: "center", marginTop: "4em", children: jsxs("div", {
|
|
416
|
-
// className={classes.formWrap}
|
|
417
|
-
style: {
|
|
418
|
-
// marginRight: "25px",
|
|
419
|
-
// width: "100%",
|
|
420
|
-
// position: "relative",
|
|
421
|
-
// right: "42px",
|
|
422
|
-
// bottom: "13px",
|
|
423
|
-
}, children: [jsx("div", { style: {
|
|
424
|
-
color: "#000000",
|
|
425
|
-
fontSize: "30px",
|
|
426
|
-
fontWeight: "600",
|
|
427
|
-
// fontFamily: "Poppins",
|
|
428
|
-
alignItems: "center",
|
|
429
|
-
fontStyle: "normal",
|
|
430
|
-
lineHeight: "150%",
|
|
431
|
-
marginBottom: "10px",
|
|
432
|
-
}, children: loginState?.authType === "OTP"
|
|
433
|
-
? t("otp.OTPAuthentication")
|
|
434
|
-
: loginState?.authType === "TOTP"
|
|
435
|
-
? t("otp.TOTPAuthentication")
|
|
436
|
-
: null }), jsx("div", { style: {
|
|
437
|
-
color: "#949597",
|
|
438
|
-
fontSize: "16px",
|
|
439
|
-
fontWeight: "400",
|
|
440
|
-
alignItems: "center",
|
|
441
|
-
fontStyle: "normal",
|
|
442
|
-
lineHeight: "33px",
|
|
443
|
-
}, children: loginState?.authType === "OTP"
|
|
444
|
-
? t("otp.EnterOTPsentToMobile")
|
|
445
|
-
: loginState?.authType === "TOTP"
|
|
446
|
-
? t("otp.PleaseEnterOTP")
|
|
447
|
-
: null }), jsxs("div", { className: classes.OTPalignName, children: [t("otp.Hello"), " ", loginState?.username
|
|
448
|
-
? loginState.username.charAt(0).toUpperCase() +
|
|
449
|
-
loginState.username.slice(1)
|
|
450
|
-
: null, loginState?.authType === "OTP" && (jsx(ResendOTP
|
|
451
|
-
// onResendClick={() => setbtnshow(false)}
|
|
452
|
-
, {
|
|
453
|
-
// onResendClick={() => setbtnshow(false)}
|
|
454
|
-
onResendClick: handleResendClick,
|
|
455
|
-
// onTimerComplete={() => setbtnshow(true)}
|
|
456
|
-
renderButton: renderButton, renderTime: renderTime, maxTime: loginState?.otpValidFor ?? 60, className: classes.resendOTPalign }))] }), jsxs("div", { className: classes.divflex, onKeyDown: (e) => {
|
|
457
|
-
if (e.key === "Enter") {
|
|
458
|
-
inputButtonRef?.current?.click?.();
|
|
459
|
-
}
|
|
460
|
-
}, children: [jsx(OTPInput, { value: OTP, onChange: setOTP, autoFocus: true, OTPLength: 6, otpType: "number", disabled: loginState.otploading || loginState.loading, secure: !showPassword, className: classes.otpinputpadding }), jsx(IconButton$1, { "aria-label": "toggle password visibility", onClick: () => {
|
|
461
|
-
if (!showPassword) {
|
|
462
|
-
setShowPasswordTime(Date.now() + 5000);
|
|
463
|
-
timerRef.current = setTimeout(() => forceUpdate(Date.now()), 5000);
|
|
464
|
-
}
|
|
465
|
-
else if (showPassword)
|
|
466
|
-
setShowPasswordTime(0);
|
|
467
|
-
}, onMouseDown: (e) => e.preventDefault(), disabled: loginState.otploading, className: classes.ibtnvisible, children: showPassword ? jsx(Visibility, {}) : jsx(VisibilityOff, {}) })] }), Boolean(OTPError) ? (jsx(FormHelperText, { style: { color: "red" }, children: OTPError })) : null, loginState?.authType === "TOTP" ? (jsx("div", { style: { flex: "auto" }, children: jsx("a", { href: "forgot-totp", style: { color: "var(--theme-color3)" }, children: "Forgot TOTP" }) })) : (jsx(Fragment$1, {})), jsxs("div", { style: {
|
|
468
|
-
display: "flex",
|
|
469
|
-
gap: "10px",
|
|
470
|
-
margin: "42px 0 0 42px",
|
|
471
|
-
width: "60%",
|
|
472
|
-
}, children: [jsx(GradientButton
|
|
473
|
-
// fullWidth
|
|
474
|
-
, {
|
|
475
|
-
// fullWidth
|
|
476
|
-
disabled: loginState.otploading || loginState.loading, onClick: () => {
|
|
477
|
-
previousStep(false, "");
|
|
478
|
-
}, className: classes.otpButtons, textColor: "var(--theme-color3)", sx: {
|
|
479
|
-
border: "var(--theme-color3) 1px solid",
|
|
480
|
-
minWidth: "50%",
|
|
481
|
-
background: "var(--white)",
|
|
482
|
-
borderRadius: "10px",
|
|
483
|
-
"&:disabled": {
|
|
484
|
-
color: "var(-theme-color3) !important",
|
|
485
|
-
},
|
|
486
|
-
"&:hover": {
|
|
487
|
-
background: "var(--white) !important",
|
|
488
|
-
},
|
|
489
|
-
},
|
|
490
|
-
// customstyle = {{color : "var(--theme-color3) !important"}}
|
|
491
|
-
starticon: "West", rotateIcon: "scale(1.4) rotateX(360deg)", children: t("otp.Back") }), jsx(GradientButton, { style: {
|
|
492
|
-
borderRadius: loginState.loading ? "50%" : "10px",
|
|
493
|
-
height: loginState.loading ? "40px" : "100%",
|
|
494
|
-
width: loginState.loading ? "0px" : "100%",
|
|
495
|
-
minWidth: loginState.loading ? "40px" : "80px",
|
|
496
|
-
}, fullWidth: true, disabled: loginState.loading, onClick: ClickEventHandler, ref: inputButtonRef, className: classes.otpButtons, endicon: loginState.loading ? undefined : "TaskAlt", rotateIcon: "scale(1.4)", children: loginState.loading ? (jsx(CircularProgress, { size: 25, thickness: 4.6 })) : (t("otp.VerifyOTP")) })] })] }) }) }) }));
|
|
497
|
-
};
|
|
498
|
-
const OTPModelForm = ({ classes, OTPResendRequest, handleClose, loginState, VerifyOTP, OTPError, setOTPError, resendFlag, setNewRequestID = (id) => { }, otpresendCount = 0, }) => {
|
|
499
|
-
const [OTP, setOTP] = useState("");
|
|
500
|
-
const [showPasswordTime, setShowPasswordTime] = useState(0);
|
|
501
|
-
const showPassword = Date.now() < showPasswordTime;
|
|
502
|
-
const [, forceUpdate] = useState();
|
|
503
|
-
const timerRef = useRef(null);
|
|
504
|
-
useEffect(() => {
|
|
505
|
-
return () => clearTimeout(timerRef.current);
|
|
506
|
-
}, []);
|
|
507
|
-
const [btnshow, setbtnshow] = useState(false);
|
|
508
|
-
const [resendotpLoading, setResendotpLoading] = useState(false);
|
|
509
|
-
const inputButtonRef = useRef(null);
|
|
510
|
-
const { enqueueSnackbar } = useSnackbar();
|
|
511
|
-
const { t } = useTranslation();
|
|
512
|
-
const renderButton = (buttonProps) => {
|
|
513
|
-
let { remainingTime, ...other } = buttonProps;
|
|
514
|
-
return resendotpLoading ? (jsxs("a", { className: clsx(classes.resendbtnLink, !btnshow && classes.btnvisibleoff), style: { cursor: "wait" }, children: [t("otp.GetNewOTP"), " ", jsx(CircularProgress, { size: 20, color: "secondary" })] })) : (jsx("a", { remainingtime: remainingTime, ...other, className: clsx(classes.resendbtnLink, !btnshow && classes.btnvisibleoff), children: t("otp.GetNewOTP") }));
|
|
515
|
-
};
|
|
516
|
-
const ClickEventHandler = () => {
|
|
517
|
-
if (!Boolean(OTP) || OTP.length < 6) {
|
|
518
|
-
setOTPError("otp.EnterOTPDigit");
|
|
519
|
-
}
|
|
520
|
-
else {
|
|
521
|
-
setOTPError("");
|
|
522
|
-
VerifyOTP(OTP);
|
|
523
|
-
}
|
|
524
|
-
};
|
|
525
|
-
const handleResendClick = async () => {
|
|
526
|
-
setResendotpLoading(true);
|
|
527
|
-
const { status, data, message } = await OTPResendRequest(
|
|
528
|
-
// resendFlag === "FORGET_PW"
|
|
529
|
-
// ? loginState?.requestCd
|
|
530
|
-
// : loginState?.transactionID,
|
|
531
|
-
// resendFlag,
|
|
532
|
-
loginState?.company_ID, loginState?.branch_cd, loginState?.contactUser, resendFlag, loginState?.otpValidFor, loginState?.username);
|
|
533
|
-
setResendotpLoading(false);
|
|
534
|
-
if (status === "0") {
|
|
535
|
-
setNewRequestID(data?.TRAN_CD);
|
|
536
|
-
setbtnshow(false);
|
|
537
|
-
enqueueSnackbar(message, { variant: "success" });
|
|
538
|
-
}
|
|
539
|
-
else {
|
|
540
|
-
enqueueSnackbar(message, { variant: "error" });
|
|
541
|
-
}
|
|
542
|
-
};
|
|
543
|
-
const handleCloseEvent = () => {
|
|
544
|
-
setOTPError("");
|
|
545
|
-
setOTP("");
|
|
546
|
-
handleClose();
|
|
547
|
-
};
|
|
548
|
-
const renderTime = (remainingtime) => {
|
|
549
|
-
if (parseInt(remainingtime) === 0) {
|
|
550
|
-
setTimeout(() => {
|
|
551
|
-
setbtnshow(true);
|
|
552
|
-
}, 700);
|
|
553
|
-
}
|
|
554
|
-
return (jsxs("span", { className: clsx(btnshow && classes.btnvisibleoff), children: [t("otp.OtpExpired"), " ", remainingtime] }));
|
|
555
|
-
};
|
|
556
|
-
useEffect(() => {
|
|
557
|
-
if (loginState?.otpmodelClose ?? false) {
|
|
558
|
-
handleCloseEvent();
|
|
559
|
-
}
|
|
560
|
-
}, [loginState.otpmodelClose]);
|
|
561
|
-
return (jsx(Fragment, { children: jsx(Grid, { alignItems: "center", children: jsxs("div", { children: [jsx("div", { style: {
|
|
562
|
-
color: "#000000",
|
|
563
|
-
fontSize: "30px",
|
|
564
|
-
fontWeight: "600",
|
|
565
|
-
// fontFamily: "Poppins",
|
|
566
|
-
alignItems: "center",
|
|
567
|
-
fontStyle: "normal",
|
|
568
|
-
lineHeight: "150%",
|
|
569
|
-
marginBottom: "10px",
|
|
570
|
-
}, children: t("otp.OTPAuthentication") }), jsxs("div", { className: classes.OTPalignName, children: [t("otp.Hello"), " ", loginState?.username
|
|
571
|
-
? loginState.username.charAt(0).toUpperCase() +
|
|
572
|
-
loginState.username.slice(1)
|
|
573
|
-
: null, loginState.otploading ||
|
|
574
|
-
otpresendCount >= 3 ||
|
|
575
|
-
loginState?.auth_type === "TOTP" ? null : (jsx(ResendOTP, { onResendClick: handleResendClick,
|
|
576
|
-
// onTimerComplete={() => setbtnshow(true)}
|
|
577
|
-
renderButton: renderButton, renderTime: renderTime, maxTime: loginState?.otpValidFor ?? 60, className: classes.resendOTPalign }))] }), jsxs("div", { className: classes.divflex, onKeyDown: (e) => {
|
|
578
|
-
if (e.key === "Enter") {
|
|
579
|
-
inputButtonRef?.current?.click?.();
|
|
580
|
-
}
|
|
581
|
-
}, children: [jsx(OTPInput, { value: OTP, onChange: setOTP, autoFocus: true, OTPLength: 6, otpType: "number", disabled: loginState.otploading || loginState.loading, secure: !showPassword, className: classes.otpinputpadding }), jsx(IconButton$1, { "aria-label": "toggle password visibility", onClick: () => {
|
|
582
|
-
if (!showPassword) {
|
|
583
|
-
setShowPasswordTime(Date.now() + 5000);
|
|
584
|
-
timerRef.current = setTimeout(() => forceUpdate(Date.now()), 5000);
|
|
585
|
-
}
|
|
586
|
-
else if (showPassword)
|
|
587
|
-
setShowPasswordTime(0);
|
|
588
|
-
}, onMouseDown: (e) => e.preventDefault(), disabled: loginState.otploading, className: classes.ibtnvisible, children: showPassword ? jsx(Visibility, {}) : jsx(VisibilityOff, {}) })] }), Boolean(OTPError) ? (jsx(FormHelperText, { style: { color: "red" }, children: OTPError })) : null, jsxs("div", { style: {
|
|
589
|
-
display: "flex",
|
|
590
|
-
gap: "10px",
|
|
591
|
-
margin: "42px 0 0 42px",
|
|
592
|
-
width: "60%",
|
|
593
|
-
}, children: [jsx(GradientButton, { fullWidth: true, disabled: loginState.otploading || loginState.loading, onClick: handleCloseEvent, className: classes.otpButtons, starticon: "West", textColor: "var(--white) !important", sx: {
|
|
594
|
-
"&:disabled": {
|
|
595
|
-
color: "var(-theme-color3) !important",
|
|
596
|
-
},
|
|
597
|
-
}, rotateIcon: "scale(1.4) rotateX(360deg)", style: {
|
|
598
|
-
// border: "var(--theme-color3) 1px solid",
|
|
599
|
-
// color: "var(--white)",
|
|
600
|
-
// background: "var(--white)",
|
|
601
|
-
borderRadius: "10px",
|
|
602
|
-
minWidth: "48%",
|
|
603
|
-
}, children: t("otp.Back") }), jsx(GradientButton, { style: {
|
|
604
|
-
borderRadius: loginState.otploading ? "50%" : "10px",
|
|
605
|
-
height: loginState.otploading ? "40px" : "100%",
|
|
606
|
-
width: loginState.otploading ? "0px" : "100%",
|
|
607
|
-
minWidth: loginState.otploading ? "40px" : "80px",
|
|
608
|
-
},
|
|
609
|
-
// fullWidth
|
|
610
|
-
disabled: loginState.loading, onClick: ClickEventHandler, ref: inputButtonRef, className: classes.otpButtons, children: loginState.otploading ? (jsx(CircularProgress, { size: 25, thickness: 4.6 })) : (t("otp.VerifyOTP")) })] })] }) }) }));
|
|
611
|
-
};
|
|
612
|
-
|
|
613
|
-
const VerifyFinger = ({ classes, loginState, verifyFinger, previousStep, }) => {
|
|
614
|
-
const { t } = useTranslation();
|
|
615
|
-
return (jsx(Fragment, { children: jsx(Container, { maxWidth: "xs", children: jsxs(Grid, { alignItems: "center", children: [jsxs("div", { style: {
|
|
616
|
-
marginRight: "25px",
|
|
617
|
-
width: "102%",
|
|
618
|
-
// marginBottom: "55px",
|
|
619
|
-
}, children: [jsx("br", {}), jsx("div", { style: {
|
|
620
|
-
color: "#000000",
|
|
621
|
-
fontSize: "34px",
|
|
622
|
-
fontWeight: "600",
|
|
623
|
-
// fontFamily: "Poppins",
|
|
624
|
-
alignItems: "center",
|
|
625
|
-
fontStyle: "normal",
|
|
626
|
-
lineHeight: "150%",
|
|
627
|
-
marginBottom: "10px",
|
|
628
|
-
}, children: t("Biometric.BiometrixAuthentication") }), jsx("div", { style: {
|
|
629
|
-
color: "#949597",
|
|
630
|
-
fontSize: "18px",
|
|
631
|
-
fontWeight: "400",
|
|
632
|
-
// fontFamily: "Poppins",
|
|
633
|
-
alignItems: "center",
|
|
634
|
-
fontStyle: "normal",
|
|
635
|
-
lineHeight: "33px",
|
|
636
|
-
// marginBottom: "10px",
|
|
637
|
-
}, children: t("Biometric.Kindlyplaceyoufinger") }), jsx("br", {}), jsxs(Typography, { variant: "h5", style: { color: "#000000" }, children: [t("otp.Hello"), " ", "", ` ${loginState?.username
|
|
638
|
-
? loginState.username.charAt(0).toUpperCase() +
|
|
639
|
-
loginState.username.slice(1)
|
|
640
|
-
: null}`] }), jsx("br", {}), jsx("div", { className: loginState?.isBiometricError
|
|
641
|
-
? classes.eFingerUi
|
|
642
|
-
: classes.fingerUi, children: jsxs("div", { className: "spinner-wrap", children: [jsx(FingerprintSharpIcon, { sx: {
|
|
643
|
-
fontSize: "80px",
|
|
644
|
-
opacity: "0.4",
|
|
645
|
-
borderRadius: "50%",
|
|
646
|
-
display: "flex",
|
|
647
|
-
margin: "0 auto",
|
|
648
|
-
"&:after": {
|
|
649
|
-
borderBottom: "2px solid #26A456",
|
|
650
|
-
},
|
|
651
|
-
}, className: loginState?.isBiometricError ? classes.FingerIcon : null, color: loginState?.isBiometricError ? "error" : "inherit" }), loginState?.isScanning ? (jsxs(Fragment$1, { children: [jsx("div", { className: "spinner-item", style: {
|
|
652
|
-
border: loginState?.isScanning
|
|
653
|
-
? "1px solid #949597"
|
|
654
|
-
: " 1px solid red",
|
|
655
|
-
} }), jsx("div", { className: "spinner-item spinner-item--2", style: {
|
|
656
|
-
border: loginState?.isScanning
|
|
657
|
-
? "1px solid #949597"
|
|
658
|
-
: "1px solid red",
|
|
659
|
-
} }), jsx("div", { className: "spinner-item spinner-item--3", style: {
|
|
660
|
-
border: loginState?.isScanning
|
|
661
|
-
? "1px solid #949597"
|
|
662
|
-
: "1px solid red",
|
|
663
|
-
} })] })) : null] }) }), jsx("div", { className: classes.biometric, children: jsxs("div", { style: { marginTop: "50px" }, children: [jsx("div", { className: loginState.isScanning ? "progress" : "hide", children: jsx("div", { className: "bar", style: { width: loginState.isScanning ? "30%" : "0%" } }) }), jsx("h3", { style: {
|
|
664
|
-
display: "flex",
|
|
665
|
-
marginTop: "20px",
|
|
666
|
-
justifyContent: "space-around",
|
|
667
|
-
color: loginState?.isBiometricError
|
|
668
|
-
? "rgb(255 0 0 / 65%)"
|
|
669
|
-
: "inherit",
|
|
670
|
-
}, children: loginState?.isBiometricError
|
|
671
|
-
? loginState?.userMessage
|
|
672
|
-
: loginState?.loading
|
|
673
|
-
? t("Biometric.Loading")
|
|
674
|
-
: loginState?.isScanning
|
|
675
|
-
? t("Biometric.Scanning")
|
|
676
|
-
: null })] }) })] }), jsxs("div", { style: {
|
|
677
|
-
display: "flex",
|
|
678
|
-
justifyContent: "center",
|
|
679
|
-
margin: "42px 0 0 42px",
|
|
680
|
-
// margin: "38px 0 0 0",
|
|
681
|
-
gap: "10px",
|
|
682
|
-
}, children: [jsx(GradientButton, { fullWidth: true, disabled: loginState.loading, onClick: () => {
|
|
683
|
-
previousStep(false, "");
|
|
684
|
-
}, className: classes.otpButtons, starticon: "West", rotateIcon: "scale(1.4) rotateX(360deg)", textColor: "var(--theme-color3) !important", style: {
|
|
685
|
-
border: "var(--theme-color3)1px solid",
|
|
686
|
-
color: "var(--theme-color3)",
|
|
687
|
-
background: "var(--white)",
|
|
688
|
-
borderRadius: "10px",
|
|
689
|
-
minWidth: "48%",
|
|
690
|
-
}, children: t("otp.Back") }), jsx(GradientButton, { style: {
|
|
691
|
-
borderRadius: loginState.loading ? "50%" : "10px",
|
|
692
|
-
height: loginState.loading ? "40px" : "100%",
|
|
693
|
-
width: loginState.loading ? "0px" : "100%",
|
|
694
|
-
minWidth: loginState.loading ? "40px" : "80px",
|
|
695
|
-
// width: loginState.loading ? "0px" : "90%",
|
|
696
|
-
// minWidth: loginState.loading ? "40px" : "80px",
|
|
697
|
-
}, disabled: loginState.loading, onKeyDown: (e) => e.keyCode === 13 && verifyFinger, onClick: verifyFinger, className: classes.otpButtons, children: loginState.loading ? (jsx(CircularProgress, { size: 25, thickness: 4.6, style: { color: "#fff" } })) : (t("Biometric.Verify")) })] })] }) }) }));
|
|
698
|
-
};
|
|
699
|
-
|
|
700
|
-
const capture = async () => {
|
|
701
|
-
var MFS100Request = {
|
|
702
|
-
Quality: 60,
|
|
703
|
-
TimeOut: 10,
|
|
704
|
-
};
|
|
705
|
-
var jsondata = JSON.stringify(MFS100Request);
|
|
706
|
-
const rawResponse = await fetch("http://localhost:8004/mfs100/capture", {
|
|
707
|
-
method: "POST",
|
|
708
|
-
headers: {
|
|
709
|
-
Accept: "application/json",
|
|
710
|
-
"Content-Type": "application/json",
|
|
711
|
-
},
|
|
712
|
-
body: jsondata,
|
|
713
|
-
});
|
|
714
|
-
const content = await rawResponse.json();
|
|
715
|
-
return content;
|
|
716
|
-
};
|
|
717
|
-
|
|
718
|
-
const decryptString = (encryptString) => {
|
|
719
|
-
var secretKey = "SUPERACUTE@MKS";
|
|
720
|
-
var keyBytes = CryptoJS.PBKDF2(secretKey, "Ivan Medvedev", {
|
|
721
|
-
keySize: 48 / 4,
|
|
722
|
-
iterations: 1000,
|
|
723
|
-
});
|
|
724
|
-
console.log(keyBytes.toString());
|
|
725
|
-
// take first 32 bytes as key (like in C# code)
|
|
726
|
-
var key = new CryptoJS.lib.WordArray.init(keyBytes.words, 32);
|
|
727
|
-
// // skip first 32 bytes and take next 16 bytes as IV
|
|
728
|
-
var iv = new CryptoJS.lib.WordArray.init(keyBytes.words.splice(32 / 4), 16);
|
|
729
|
-
// console.log(key.toString());
|
|
730
|
-
//console.log(encryptString, CryptoJS.enc.Base64.parse(encryptString));
|
|
731
|
-
var dec = CryptoJS.AES.decrypt({
|
|
732
|
-
ciphertext: CryptoJS.enc.Base64.parse(CryptoJS.enc.Base64.parse(encryptString).toString(CryptoJS.enc.Utf8)),
|
|
733
|
-
}, key, {
|
|
734
|
-
iv: iv,
|
|
735
|
-
});
|
|
736
|
-
console.log("CryptoJS.AES.decrypt", dec);
|
|
737
|
-
return dec.toString(CryptoJS.enc.Utf8).split(String.fromCharCode(0)).join("");
|
|
738
|
-
};
|
|
739
|
-
const matchFinger = async (rows, captureFinger) => {
|
|
740
|
-
var promise = new Promise((resolve, reject) => {
|
|
741
|
-
//console.log("matchFinger", rows, typeof rows);
|
|
742
|
-
if (typeof rows === "string") {
|
|
743
|
-
rows = JSON.parse(rows);
|
|
744
|
-
}
|
|
745
|
-
rows.forEach(async (element, i) => {
|
|
746
|
-
try {
|
|
747
|
-
var galleryTemplate = decryptString(element.IMG_DATA);
|
|
748
|
-
var MFS100Request = {
|
|
749
|
-
GalleryTemplate: galleryTemplate,
|
|
750
|
-
ProbTemplate: captureFinger,
|
|
751
|
-
BioType: "Iso",
|
|
752
|
-
};
|
|
753
|
-
var jsondata = JSON.stringify(MFS100Request);
|
|
754
|
-
await fetch("http://localhost:8004/mfs100/verify", {
|
|
755
|
-
method: "POST",
|
|
756
|
-
headers: {
|
|
757
|
-
Accept: "application/json",
|
|
758
|
-
"Content-Type": "application/json",
|
|
759
|
-
},
|
|
760
|
-
body: jsondata,
|
|
761
|
-
})
|
|
762
|
-
.then((response) => response.json())
|
|
763
|
-
.then((response) => {
|
|
764
|
-
if (response?.ErrorCode === "0" && response["Status"]) {
|
|
765
|
-
resolve({
|
|
766
|
-
status: true,
|
|
767
|
-
errorCode: "0",
|
|
768
|
-
errorMessage: "",
|
|
769
|
-
isError: false,
|
|
770
|
-
sr_cd: element.SR_CD,
|
|
771
|
-
});
|
|
772
|
-
return;
|
|
773
|
-
}
|
|
774
|
-
if (rows.length === i + 1) {
|
|
775
|
-
resolve({
|
|
776
|
-
status: false,
|
|
777
|
-
errorCode: response.ErrorCode,
|
|
778
|
-
errorMessage: response.ErrorMessage,
|
|
779
|
-
isError: false,
|
|
780
|
-
});
|
|
781
|
-
return;
|
|
782
|
-
}
|
|
783
|
-
})
|
|
784
|
-
.catch((reason) => {
|
|
785
|
-
resolve({
|
|
786
|
-
status: false,
|
|
787
|
-
errorCode: "999",
|
|
788
|
-
errorMessage: reason,
|
|
789
|
-
isError: true,
|
|
790
|
-
});
|
|
791
|
-
});
|
|
792
|
-
}
|
|
793
|
-
catch (err) {
|
|
794
|
-
console.log(err);
|
|
795
|
-
resolve({
|
|
796
|
-
status: false,
|
|
797
|
-
errorCode: "999",
|
|
798
|
-
errorMessage: "Something went wrong!",
|
|
799
|
-
isError: true,
|
|
800
|
-
});
|
|
801
|
-
}
|
|
802
|
-
});
|
|
803
|
-
});
|
|
804
|
-
return promise;
|
|
805
|
-
};
|
|
806
|
-
|
|
807
|
-
const isBase64 = (str = "") => {
|
|
808
|
-
if (typeof str !== "string") {
|
|
809
|
-
return false;
|
|
810
|
-
}
|
|
811
|
-
const base64Regex = /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/;
|
|
812
|
-
return base64Regex.test(str);
|
|
813
|
-
};
|
|
814
|
-
|
|
815
|
-
const BankDetails = ({ bannerDetails }) => {
|
|
816
|
-
const [loginImageURL, setLoginImageURL] = useState(null);
|
|
817
|
-
const urlObj = useRef(null);
|
|
818
|
-
const classes = useStyles$3();
|
|
819
|
-
const banner = useMemo(() => bannerDetails, []);
|
|
820
|
-
useEffect(() => {
|
|
821
|
-
if (Boolean(banner?.bannerImg)) {
|
|
822
|
-
if (isBase64(banner?.bannerImg)) {
|
|
823
|
-
let blob = utilFunction.base64toBlob(banner?.bannerImg);
|
|
824
|
-
urlObj.current =
|
|
825
|
-
typeof blob === "object" && Boolean(blob)
|
|
826
|
-
? URL.createObjectURL(blob)
|
|
827
|
-
: "";
|
|
828
|
-
setLoginImageURL(urlObj.current);
|
|
829
|
-
}
|
|
830
|
-
else {
|
|
831
|
-
setLoginImageURL(banner?.bannerImg);
|
|
832
|
-
}
|
|
833
|
-
}
|
|
834
|
-
}, [banner]);
|
|
835
|
-
return (jsx(Fragment$1, { children: jsxs(Grid, { item: true, xs: 6, md: 6, lg: 6, className: classes.loginLeft, children: [jsx(Grid, { item: true, xs: 12, md: 12, lg: 12, style: { height: "70vh" }, children: jsx("img", { alt: "", style: {
|
|
836
|
-
width: "100%",
|
|
837
|
-
height: "100%",
|
|
838
|
-
objectFit: "cover",
|
|
839
|
-
objectPosition: "center",
|
|
840
|
-
}, src: Boolean(loginImageURL) ? loginImageURL : "" }) }), jsx(Grid, { item: true, xs: 12, md: 12, lg: 12, style: {
|
|
841
|
-
height: "30vh",
|
|
842
|
-
background: "var(--primary-bg)",
|
|
843
|
-
}, children: jsxs(Container, { maxWidth: "sm", children: [jsxs("div", { className: "text", style: {
|
|
844
|
-
color: "white",
|
|
845
|
-
fontStyle: "normal",
|
|
846
|
-
fontSize: "31px",
|
|
847
|
-
paddingTop: "30px",
|
|
848
|
-
}, children: [banner?.bannerTitle ?? "", jsx("span", { style: { marginLeft: "8px", fontWeight: "900" } })] }), jsx("div", { style: {
|
|
849
|
-
lineHeight: "27px",
|
|
850
|
-
fontSize: "15px",
|
|
851
|
-
fontWeight: "500px",
|
|
852
|
-
letterSpacing: "0.02em",
|
|
853
|
-
color: "#ebedee",
|
|
854
|
-
maxWidth: "464px",
|
|
855
|
-
}, children: banner?.bannerNote ?? "" })] }) })] }) }));
|
|
856
|
-
};
|
|
857
|
-
|
|
858
|
-
const PasswordRotation = ({ classes, ResetPassword, open, username, accessToken, tokenType, handleClose, validatePasswordFn }) => {
|
|
859
|
-
const inputButtonRef = useRef(null);
|
|
860
|
-
const { enqueueSnackbar } = useSnackbar();
|
|
861
|
-
const { t } = useTranslation();
|
|
862
|
-
const [input, setInput] = useState({
|
|
863
|
-
userName: username,
|
|
864
|
-
oldpassword: "",
|
|
865
|
-
password: "",
|
|
866
|
-
confirmpassword: "",
|
|
867
|
-
});
|
|
868
|
-
const [pwdReset, setPasswordReset] = useState({
|
|
869
|
-
isError: false,
|
|
870
|
-
errorMessage: "",
|
|
871
|
-
isLoading: false,
|
|
872
|
-
isoldPwdError: false,
|
|
873
|
-
oldpassworderror: "",
|
|
874
|
-
isnewpwdError: false,
|
|
875
|
-
newpassworderror: "",
|
|
876
|
-
isconfirmnewpwdError: false,
|
|
877
|
-
confirmnewpassworderror: "",
|
|
878
|
-
});
|
|
879
|
-
const handleCloseEvent = () => {
|
|
880
|
-
handleClose("");
|
|
881
|
-
};
|
|
882
|
-
const ClickEventHandler = async () => {
|
|
883
|
-
let isError = false;
|
|
884
|
-
let setPwdData = {
|
|
885
|
-
isError: false,
|
|
886
|
-
errorMessage: "",
|
|
887
|
-
isLoading: false,
|
|
888
|
-
isoldPwdError: false,
|
|
889
|
-
oldpassworderror: "",
|
|
890
|
-
isnewpwdError: false,
|
|
891
|
-
newpassworderror: "",
|
|
892
|
-
isconfirmnewpwdError: false,
|
|
893
|
-
confirmnewpassworderror: "",
|
|
894
|
-
};
|
|
895
|
-
// Local validation
|
|
896
|
-
if (!Boolean(input.oldpassword)) {
|
|
897
|
-
setPwdData.isoldPwdError = true;
|
|
898
|
-
setPwdData.oldpassworderror = "Current Password is required.";
|
|
899
|
-
isError = true;
|
|
900
|
-
}
|
|
901
|
-
let pwdData = utilFunction.ValidatePassword(input.password);
|
|
902
|
-
if (Boolean(pwdData)) {
|
|
903
|
-
setPwdData.isnewpwdError = true;
|
|
904
|
-
setPwdData.newpassworderror = pwdData;
|
|
905
|
-
isError = true;
|
|
906
|
-
}
|
|
907
|
-
if (Boolean(input.oldpassword) &&
|
|
908
|
-
Boolean(input.password) &&
|
|
909
|
-
input.oldpassword === input.password) {
|
|
910
|
-
setPwdData.isnewpwdError = true;
|
|
911
|
-
setPwdData.newpassworderror = "The new password cannot be the same as the old password";
|
|
912
|
-
isError = true;
|
|
913
|
-
}
|
|
914
|
-
if (!Boolean(input.confirmpassword)) {
|
|
915
|
-
setPwdData.isconfirmnewpwdError = true;
|
|
916
|
-
setPwdData.confirmnewpassworderror = "Confirm new password is required.";
|
|
917
|
-
isError = true;
|
|
918
|
-
}
|
|
919
|
-
else if (Boolean(input.password) &&
|
|
920
|
-
input.password !== input.confirmpassword) {
|
|
921
|
-
setPwdData.isconfirmnewpwdError = true;
|
|
922
|
-
setPwdData.confirmnewpassworderror = "New Password and Confirm Password did not match";
|
|
923
|
-
isError = true;
|
|
924
|
-
}
|
|
925
|
-
if (isError) {
|
|
926
|
-
setPasswordReset(setPwdData);
|
|
927
|
-
return;
|
|
928
|
-
}
|
|
929
|
-
// API validation
|
|
930
|
-
setPasswordReset((values) => ({ ...values, isLoading: true }));
|
|
931
|
-
const { validateStatus, validateData } = await validatePasswordFn({
|
|
932
|
-
USER_ID: input.userName,
|
|
933
|
-
PASSWORD: input.password,
|
|
934
|
-
SCREEN_REF: "LOGIN"
|
|
935
|
-
});
|
|
936
|
-
setPasswordReset((values) => ({ ...values, isLoading: false }));
|
|
937
|
-
if (validateStatus === "0") {
|
|
938
|
-
switch (validateData?.O_STATUS) {
|
|
939
|
-
case "999":
|
|
940
|
-
setPwdData.isnewpwdError = true;
|
|
941
|
-
setPwdData.newpassworderror = validateData?.O_MESSAGE;
|
|
942
|
-
setPasswordReset(setPwdData);
|
|
943
|
-
return;
|
|
944
|
-
case "0":
|
|
945
|
-
let response = await ResetPassword(input.userName, input.oldpassword, input.password, accessToken, tokenType);
|
|
946
|
-
setPasswordReset((values) => ({ ...values, isLoading: true }));
|
|
947
|
-
if (response.status === "0") {
|
|
948
|
-
enqueueSnackbar("Password successfully changed.", {
|
|
949
|
-
variant: "success",
|
|
950
|
-
});
|
|
951
|
-
handleClose("0");
|
|
952
|
-
setPasswordReset((values) => ({ ...values, isLoading: false }));
|
|
953
|
-
}
|
|
954
|
-
else {
|
|
955
|
-
setPasswordReset((values) => ({
|
|
956
|
-
...values,
|
|
957
|
-
isError: true,
|
|
958
|
-
errorMessage: response.message,
|
|
959
|
-
}));
|
|
960
|
-
}
|
|
961
|
-
break;
|
|
962
|
-
}
|
|
963
|
-
}
|
|
964
|
-
};
|
|
965
|
-
const handleChange = (event) => {
|
|
966
|
-
const name = event.target.name;
|
|
967
|
-
let value = event.target.value;
|
|
968
|
-
if (name === "oldpassword" && Boolean(value)) {
|
|
969
|
-
setPasswordReset((values) => ({ ...values, isoldPwdError: false }));
|
|
970
|
-
}
|
|
971
|
-
else if (name === "password" && Boolean(value)) {
|
|
972
|
-
setPasswordReset((values) => ({ ...values, isnewpwdError: false }));
|
|
973
|
-
}
|
|
974
|
-
else if (name === "confirmpassword" && Boolean(value)) {
|
|
975
|
-
setPasswordReset((values) => ({
|
|
976
|
-
...values,
|
|
977
|
-
isconfirmnewpwdError: false,
|
|
978
|
-
}));
|
|
979
|
-
}
|
|
980
|
-
setInput((values) => ({ ...values, [name]: value }));
|
|
981
|
-
};
|
|
982
|
-
return (jsx(Fragment, { children: jsx(Container, { maxWidth: "xs", children: jsxs(Grid, { alignItems: "center", children: [jsx("div", { style: {
|
|
983
|
-
color: "#000000 !important",
|
|
984
|
-
fontSize: "30px",
|
|
985
|
-
fontWeight: "600",
|
|
986
|
-
alignItems: "center",
|
|
987
|
-
fontStyle: "normal",
|
|
988
|
-
}, children: jsx("h3", { children: "Password Rotation" }) }), jsx("div", { className: "", style: {
|
|
989
|
-
color: "#949597",
|
|
990
|
-
fontSize: "18px",
|
|
991
|
-
fontWeight: "400",
|
|
992
|
-
alignItems: "center",
|
|
993
|
-
fontStyle: "normal",
|
|
994
|
-
width: "360px",
|
|
995
|
-
}, children: "Please Verify OTP" }), jsxs("div", { className: classes.formWrap, children: [jsx(TextField, { label: "User ID", placeholder: "Enter User ID", fullWidth: true, type: "text", name: "userName", value: input.userName || "", onChange: handleChange, InputLabelProps: { shrink: true }, disabled: true, autoComplete: "off", inputProps: { maxLength: 16 }, style: { paddingBottom: "8px" } }), jsx(TextField, { autoFocus: true, label: "Current Password", placeholder: "Enter Current Password", fullWidth: true, type: "password", name: "oldpassword", value: input.oldpassword || "", onChange: handleChange, error: pwdReset.isoldPwdError, helperText: pwdReset.isoldPwdError ? t(pwdReset.oldpassworderror) : "", InputLabelProps: { shrink: true }, disabled: pwdReset.isLoading, autoComplete: "off", onKeyDown: (e) => {
|
|
996
|
-
if (e.key === "Enter") {
|
|
997
|
-
inputButtonRef?.current?.click?.();
|
|
998
|
-
}
|
|
999
|
-
}, inputProps: { maxLength: 16 }, style: { paddingBottom: "8px" } }), jsx(TextField, { label: "New Password", placeholder: "Enter New Password", fullWidth: true, type: "password", name: "password", value: input.password || "", onChange: handleChange, error: pwdReset.isnewpwdError, helperText: pwdReset.isnewpwdError ? t(pwdReset.newpassworderror) : "", InputLabelProps: { shrink: true }, disabled: pwdReset.isLoading, autoComplete: "off", onKeyDown: (e) => {
|
|
1000
|
-
if (e.key === "Enter") {
|
|
1001
|
-
inputButtonRef?.current?.click?.();
|
|
1002
|
-
}
|
|
1003
|
-
}, inputProps: { maxLength: 16 }, style: { paddingBottom: "8px" } }), jsx(TextField, { label: "Confirm New Password", placeholder: "Enter confirm new password", fullWidth: true, type: "password", name: "confirmpassword", value: input.confirmpassword || "", onChange: handleChange, error: pwdReset.isconfirmnewpwdError, helperText: pwdReset.isconfirmnewpwdError
|
|
1004
|
-
? t(pwdReset.confirmnewpassworderror)
|
|
1005
|
-
: "", InputLabelProps: { shrink: true }, disabled: pwdReset.isLoading, autoComplete: "off", onKeyDown: (e) => {
|
|
1006
|
-
if (e.key === "Enter") {
|
|
1007
|
-
inputButtonRef?.current?.click?.();
|
|
1008
|
-
}
|
|
1009
|
-
}, inputProps: { maxLength: 16 }, style: { paddingBottom: "8px" } }), pwdReset.isError ? (jsx(FormHelperText, { style: { color: "red" }, children: pwdReset.errorMessage })) : null] }), jsxs("div", { style: {
|
|
1010
|
-
display: "flex",
|
|
1011
|
-
gap: "10px",
|
|
1012
|
-
margin: "20px 0 0 10px",
|
|
1013
|
-
width: "94%",
|
|
1014
|
-
}, children: [jsx(GradientButton, { fullWidth: true, disabled: pwdReset.isLoading, onClick: handleCloseEvent, className: classes.otpButtons, style: {
|
|
1015
|
-
border: "var(--theme-color3)1px solid",
|
|
1016
|
-
color: "var(--theme-color3)",
|
|
1017
|
-
// pebbackground: "var(--white)",
|
|
1018
|
-
borderRadius: "10px",
|
|
1019
|
-
}, children: "Back" }), jsx(GradientButton, { style: {
|
|
1020
|
-
borderRadius: pwdReset.isLoading ? "50%" : "10px",
|
|
1021
|
-
height: pwdReset.isLoading ? "40px" : "100%",
|
|
1022
|
-
width: pwdReset.isLoading ? "0px" : "100%",
|
|
1023
|
-
minWidth: pwdReset.isLoading ? "40px" : "80px",
|
|
1024
|
-
}, fullWidth: true, disabled: pwdReset.isLoading, onClick: ClickEventHandler, ref: inputButtonRef, className: classes.otpButtons, children: pwdReset.isLoading ? (jsx(CircularProgress, { size: 25, thickness: 4.6 })) : ("Update") })] })] }) }) }));
|
|
1025
|
-
};
|
|
1026
|
-
|
|
1027
|
-
const inititalState$1 = {
|
|
1028
|
-
username: "",
|
|
1029
|
-
firstName: "",
|
|
1030
|
-
lastName: "",
|
|
1031
|
-
loading: false,
|
|
1032
|
-
otploading: false,
|
|
1033
|
-
isError: false,
|
|
1034
|
-
isUsernameError: false,
|
|
1035
|
-
isPasswordError: false,
|
|
1036
|
-
userMessage: "",
|
|
1037
|
-
OtpuserMessage: "",
|
|
1038
|
-
userMessageforpassword: "",
|
|
1039
|
-
userMessageforusername: "",
|
|
1040
|
-
currentFlow: "username",
|
|
1041
|
-
transactionID: "",
|
|
1042
|
-
comapanyCD: "",
|
|
1043
|
-
branchCD: "",
|
|
1044
|
-
contactUser: "",
|
|
1045
|
-
access_token: "",
|
|
1046
|
-
token_type: "",
|
|
1047
|
-
otpmodelClose: false,
|
|
1048
|
-
authType: "",
|
|
1049
|
-
isScanning: false,
|
|
1050
|
-
auth_type: "O",
|
|
1051
|
-
otpValidFor: 60,
|
|
1052
|
-
};
|
|
1053
|
-
const reducer$1 = (state, action) => {
|
|
1054
|
-
switch (action.type) {
|
|
1055
|
-
case "inititateUserFingerVerification":
|
|
1056
|
-
case "inititateOTPVerification": {
|
|
1057
|
-
return {
|
|
1058
|
-
...state,
|
|
1059
|
-
loading: true,
|
|
1060
|
-
isError: false,
|
|
1061
|
-
isUsernameError: false,
|
|
1062
|
-
isPasswordError: false,
|
|
1063
|
-
isOTPError: false,
|
|
1064
|
-
isBiometricError: false,
|
|
1065
|
-
userMessage: "",
|
|
1066
|
-
};
|
|
1067
|
-
}
|
|
1068
|
-
case "inititateUserFingerScanner": {
|
|
1069
|
-
return { ...state, isScanning: true, isBiometricError: false };
|
|
1070
|
-
}
|
|
1071
|
-
case "usernameandpasswordrequired": {
|
|
1072
|
-
return {
|
|
1073
|
-
...state,
|
|
1074
|
-
loading: false,
|
|
1075
|
-
isError: true,
|
|
1076
|
-
isUsernameError: true,
|
|
1077
|
-
isPasswordError: true,
|
|
1078
|
-
otploading: false,
|
|
1079
|
-
userMessage: action?.payload?.error,
|
|
1080
|
-
userMessageforpassword: action?.payload?.errorPassword,
|
|
1081
|
-
userMessageforusername: action?.payload?.errorUsername,
|
|
1082
|
-
username: "",
|
|
1083
|
-
transactionID: "",
|
|
1084
|
-
comapanyCD: "",
|
|
1085
|
-
branchCD: "",
|
|
1086
|
-
contactUser: ""
|
|
1087
|
-
};
|
|
1088
|
-
}
|
|
1089
|
-
case "passwordVerificationFailure":
|
|
1090
|
-
return {
|
|
1091
|
-
...state,
|
|
1092
|
-
loading: false,
|
|
1093
|
-
isError: true,
|
|
1094
|
-
isUsernameError: false,
|
|
1095
|
-
isPasswordError: true,
|
|
1096
|
-
otploading: false,
|
|
1097
|
-
userMessage: action?.payload?.error,
|
|
1098
|
-
userMessageforpassword: action?.payload?.errorPassword,
|
|
1099
|
-
username: "",
|
|
1100
|
-
transactionID: "",
|
|
1101
|
-
comapanyCD: "",
|
|
1102
|
-
branchCD: ""
|
|
1103
|
-
};
|
|
1104
|
-
case "usernameVerificationFailure": {
|
|
1105
|
-
return {
|
|
1106
|
-
...state,
|
|
1107
|
-
loading: false,
|
|
1108
|
-
isError: true,
|
|
1109
|
-
isUsernameError: true,
|
|
1110
|
-
isPasswordError: false,
|
|
1111
|
-
otploading: false,
|
|
1112
|
-
userMessage: action?.payload?.error,
|
|
1113
|
-
userMessageforusername: action?.payload?.errorUsername,
|
|
1114
|
-
username: "",
|
|
1115
|
-
transactionID: "",
|
|
1116
|
-
comapanyCD: "",
|
|
1117
|
-
branchCD: "",
|
|
1118
|
-
contactUser: ""
|
|
1119
|
-
};
|
|
1120
|
-
}
|
|
1121
|
-
case "inititatePasswordVerification": {
|
|
1122
|
-
return {
|
|
1123
|
-
...state,
|
|
1124
|
-
loading: true,
|
|
1125
|
-
isError: false,
|
|
1126
|
-
isUsernameError: false,
|
|
1127
|
-
isPasswordError: false,
|
|
1128
|
-
otploading: false,
|
|
1129
|
-
userMessage: "",
|
|
1130
|
-
userMessageforusername: "",
|
|
1131
|
-
userMessageforpassword: "",
|
|
1132
|
-
username: "",
|
|
1133
|
-
transactionID: "",
|
|
1134
|
-
access_token: "",
|
|
1135
|
-
comapanyCD: "",
|
|
1136
|
-
branchCD: "",
|
|
1137
|
-
contactUser: ""
|
|
1138
|
-
};
|
|
1139
|
-
}
|
|
1140
|
-
case "passwordRotation": {
|
|
1141
|
-
return {
|
|
1142
|
-
...state,
|
|
1143
|
-
loading: false,
|
|
1144
|
-
username: action?.payload?.username,
|
|
1145
|
-
access_token: action?.payload?.access_token,
|
|
1146
|
-
token_type: action?.payload?.token_type,
|
|
1147
|
-
};
|
|
1148
|
-
}
|
|
1149
|
-
case "passwordRotationsuccess": {
|
|
1150
|
-
return {
|
|
1151
|
-
...state,
|
|
1152
|
-
loading: false,
|
|
1153
|
-
otpmodelClose: Boolean(action?.payload?.otpmodelclose),
|
|
1154
|
-
};
|
|
1155
|
-
}
|
|
1156
|
-
case "passwordVerificationSuccessful": {
|
|
1157
|
-
return {
|
|
1158
|
-
...state,
|
|
1159
|
-
loading: false,
|
|
1160
|
-
otploading: false,
|
|
1161
|
-
transactionID: action?.payload?.transactionID,
|
|
1162
|
-
comapanyCD: action?.payload?.comapanyCD,
|
|
1163
|
-
branchCD: action?.payload?.branchCD,
|
|
1164
|
-
contactUser: action?.payload?.contactUser,
|
|
1165
|
-
username: action?.payload?.username,
|
|
1166
|
-
auth_type: action?.payload?.auth_type,
|
|
1167
|
-
OtpuserMessage: "",
|
|
1168
|
-
access_token: action?.payload?.access_token,
|
|
1169
|
-
token_type: action?.payload?.token_type,
|
|
1170
|
-
otpmodelClose: false,
|
|
1171
|
-
currentFlow: "OTP",
|
|
1172
|
-
authType: action?.payload?.authType,
|
|
1173
|
-
auth_data: action?.payload?.auth_data,
|
|
1174
|
-
otpValidFor: action?.payload?.otpValidFor,
|
|
1175
|
-
};
|
|
1176
|
-
}
|
|
1177
|
-
case "inititatebiometricVerification": {
|
|
1178
|
-
return {
|
|
1179
|
-
...state,
|
|
1180
|
-
loading: true,
|
|
1181
|
-
otploading: true,
|
|
1182
|
-
OtpuserMessage: "",
|
|
1183
|
-
otpmodelClose: false,
|
|
1184
|
-
};
|
|
1185
|
-
}
|
|
1186
|
-
case "biometricVerificationFailure":
|
|
1187
|
-
return {
|
|
1188
|
-
...state,
|
|
1189
|
-
loading: false,
|
|
1190
|
-
isError: true,
|
|
1191
|
-
isBiometricError: true,
|
|
1192
|
-
userMessage: action?.payload?.error,
|
|
1193
|
-
isScanning: false,
|
|
1194
|
-
};
|
|
1195
|
-
case "biometricVerificationSuccessful":
|
|
1196
|
-
return {
|
|
1197
|
-
...state,
|
|
1198
|
-
loading: false,
|
|
1199
|
-
isError: false,
|
|
1200
|
-
isBiometricError: false,
|
|
1201
|
-
state: action.payload,
|
|
1202
|
-
isScanning: false,
|
|
1203
|
-
};
|
|
1204
|
-
case "OTPVerificationComplate": {
|
|
1205
|
-
return {
|
|
1206
|
-
...state,
|
|
1207
|
-
loading: false,
|
|
1208
|
-
otploading: false,
|
|
1209
|
-
OtpuserMessage: "",
|
|
1210
|
-
};
|
|
1211
|
-
}
|
|
1212
|
-
case "OTPVerificationFailed": {
|
|
1213
|
-
return {
|
|
1214
|
-
...state,
|
|
1215
|
-
loading: false,
|
|
1216
|
-
otploading: false,
|
|
1217
|
-
OtpuserMessage: action?.payload?.error,
|
|
1218
|
-
otpmodelClose: Boolean(action?.payload?.otpmodelclose),
|
|
1219
|
-
};
|
|
1220
|
-
}
|
|
1221
|
-
case "OTPResendSuccess": {
|
|
1222
|
-
return {
|
|
1223
|
-
...state,
|
|
1224
|
-
transactionID: action?.payload?.transactionID,
|
|
1225
|
-
};
|
|
1226
|
-
}
|
|
1227
|
-
case "backToUsernameVerification": {
|
|
1228
|
-
return {
|
|
1229
|
-
...inititalState$1,
|
|
1230
|
-
isPasswordError: action?.payload?.isError,
|
|
1231
|
-
userMessageforpassword: action?.payload?.errorMessage,
|
|
1232
|
-
};
|
|
1233
|
-
}
|
|
1234
|
-
default: {
|
|
1235
|
-
return state;
|
|
1236
|
-
}
|
|
1237
|
-
}
|
|
1238
|
-
};
|
|
1239
|
-
const AuthControllerWrapper = ({ bannerDetails, logoUrl, logoTitle, loginFn, veirfyUsernameandPassword, validatePasswordFn, verifyOTP, OTPResendRequest, ResetPassword, LanguageComponent, forgotPasswordEndpoint, }) => {
|
|
1240
|
-
const classes = useStyles$3();
|
|
1241
|
-
const [loginState, dispath] = useReducer(reducer$1, inititalState$1);
|
|
1242
|
-
const [openpwdreset, setOpenPwdReset] = useState(false);
|
|
1243
|
-
const failureCount = useRef(0);
|
|
1244
|
-
const [dashboardLogoURL, setDashboardLogoURL] = useState(null);
|
|
1245
|
-
const urlObj = useRef(null);
|
|
1246
|
-
const { t } = useTranslation();
|
|
1247
|
-
const otpResendRef = useRef(1);
|
|
1248
|
-
const { MessageBox } = usePopupContext();
|
|
1249
|
-
useEffect(() => {
|
|
1250
|
-
if (Boolean(logoUrl)) {
|
|
1251
|
-
if (isBase64(logoUrl)) {
|
|
1252
|
-
let blob = utilFunction.base64toBlob(logoUrl);
|
|
1253
|
-
urlObj.current =
|
|
1254
|
-
typeof blob === "object" && Boolean(blob)
|
|
1255
|
-
? URL.createObjectURL(blob)
|
|
1256
|
-
: "";
|
|
1257
|
-
setDashboardLogoURL(urlObj.current);
|
|
1258
|
-
}
|
|
1259
|
-
else {
|
|
1260
|
-
setDashboardLogoURL(logoUrl);
|
|
1261
|
-
}
|
|
1262
|
-
}
|
|
1263
|
-
}, [logoUrl]);
|
|
1264
|
-
const verifyUsernamePassword = async (username, password) => {
|
|
1265
|
-
if (Boolean(username) && Boolean(password)) {
|
|
1266
|
-
dispath({ type: "inititatePasswordVerification" });
|
|
1267
|
-
try {
|
|
1268
|
-
const { status = "", data = null, message = "", responseType = "", access_token = null, } = await veirfyUsernameandPassword(username, password);
|
|
1269
|
-
if (status === "0" && responseType === "S") {
|
|
1270
|
-
dispath({
|
|
1271
|
-
type: "passwordRotation",
|
|
1272
|
-
payload: {
|
|
1273
|
-
username: username,
|
|
1274
|
-
access_token: access_token?.access_token || "",
|
|
1275
|
-
token_type: access_token?.token_type || "",
|
|
1276
|
-
},
|
|
1277
|
-
});
|
|
1278
|
-
setOpenPwdReset(true);
|
|
1279
|
-
}
|
|
1280
|
-
else if (status === "0") {
|
|
1281
|
-
dispath({
|
|
1282
|
-
type: "passwordVerificationSuccessful",
|
|
1283
|
-
payload: {
|
|
1284
|
-
comapanyCD: data?.BASE_COMP_CD,
|
|
1285
|
-
branchCD: data?.BASE_BRANCH_CD,
|
|
1286
|
-
contactUser: data?.CONTACT2,
|
|
1287
|
-
transactionID: data?.REQUEST_CD,
|
|
1288
|
-
username: username,
|
|
1289
|
-
access_token: access_token?.access_token,
|
|
1290
|
-
token_type: access_token?.token_type,
|
|
1291
|
-
authType: data?.AUTH_TYPE,
|
|
1292
|
-
auth_data: data?.AUTH_DATA,
|
|
1293
|
-
otpValidFor: data?.OTP_VALID,
|
|
1294
|
-
},
|
|
1295
|
-
});
|
|
1296
|
-
if (data?.STATUS === "0") {
|
|
1297
|
-
for (let i = 0; i < data?.ALERT_MSG_LIST.length; i++) {
|
|
1298
|
-
await MessageBox({
|
|
1299
|
-
messageTitle: "Password Alert",
|
|
1300
|
-
message: data?.ALERT_MSG_LIST[i],
|
|
1301
|
-
});
|
|
1302
|
-
}
|
|
1303
|
-
}
|
|
1304
|
-
}
|
|
1305
|
-
else {
|
|
1306
|
-
dispath({
|
|
1307
|
-
type: "passwordVerificationFailure",
|
|
1308
|
-
payload: { error: message, errorPassword: message },
|
|
1309
|
-
});
|
|
1310
|
-
}
|
|
1311
|
-
}
|
|
1312
|
-
catch (err) {
|
|
1313
|
-
throw new Error("Error occurred while verifying username and password: " + err);
|
|
1314
|
-
}
|
|
1315
|
-
}
|
|
1316
|
-
else if (!Boolean(username) && !Boolean(password)) {
|
|
1317
|
-
dispath({
|
|
1318
|
-
type: "usernameandpasswordrequired",
|
|
1319
|
-
payload: {
|
|
1320
|
-
error: "UsernamenandPasswordisRequired",
|
|
1321
|
-
errorUsername: "UsernameisRequired",
|
|
1322
|
-
errorPassword: "PasswordisRequired",
|
|
1323
|
-
},
|
|
1324
|
-
});
|
|
1325
|
-
}
|
|
1326
|
-
else if (!Boolean(username)) {
|
|
1327
|
-
dispath({
|
|
1328
|
-
type: "usernameVerificationFailure",
|
|
1329
|
-
payload: {
|
|
1330
|
-
error: "UsernameisRequired",
|
|
1331
|
-
errorUsername: "UsernameisRequired",
|
|
1332
|
-
},
|
|
1333
|
-
});
|
|
1334
|
-
}
|
|
1335
|
-
else {
|
|
1336
|
-
dispath({
|
|
1337
|
-
type: "passwordVerificationFailure",
|
|
1338
|
-
payload: {
|
|
1339
|
-
error: "PasswordisRequired",
|
|
1340
|
-
errorPassword: "PasswordisRequired",
|
|
1341
|
-
},
|
|
1342
|
-
});
|
|
1343
|
-
}
|
|
1344
|
-
};
|
|
1345
|
-
const VerifyOTP = async (OTPNumber) => {
|
|
1346
|
-
if (Boolean(OTPNumber) && OTPNumber.toString().length === 6) {
|
|
1347
|
-
dispath({ type: "inititateOTPVerification" });
|
|
1348
|
-
const { status, data, message } = await verifyOTP(loginState.transactionID,
|
|
1349
|
-
// loginState.app_transactionId,
|
|
1350
|
-
loginState.username, OTPNumber, loginState.access_token, loginState.token_type, loginState.authType);
|
|
1351
|
-
if (status === "0") {
|
|
1352
|
-
// try {
|
|
1353
|
-
// audio.play();
|
|
1354
|
-
// } catch (error) {
|
|
1355
|
-
// console.log(error);
|
|
1356
|
-
// }
|
|
1357
|
-
dispath({ type: "OTPVerificationComplate" });
|
|
1358
|
-
loginFn(data);
|
|
1359
|
-
}
|
|
1360
|
-
else if (status === "999") {
|
|
1361
|
-
dispath({
|
|
1362
|
-
type: "OTPVerificationFailed",
|
|
1363
|
-
payload: { error: message, otpmodelclose: true },
|
|
1364
|
-
});
|
|
1365
|
-
// enqueueSnackbar(message, { variant: "error" });
|
|
1366
|
-
}
|
|
1367
|
-
else {
|
|
1368
|
-
dispath({
|
|
1369
|
-
type: "OTPVerificationFailed",
|
|
1370
|
-
payload: { error: message, otpmodelclose: false },
|
|
1371
|
-
});
|
|
1372
|
-
}
|
|
1373
|
-
}
|
|
1374
|
-
else {
|
|
1375
|
-
dispath({
|
|
1376
|
-
type: "OTPVerificationFailed",
|
|
1377
|
-
payload: { error: "Please enter a 6 digit OTP number" },
|
|
1378
|
-
});
|
|
1379
|
-
}
|
|
1380
|
-
};
|
|
1381
|
-
const handlePasswordRotationClose = (flag) => {
|
|
1382
|
-
if (flag === "0") {
|
|
1383
|
-
dispath({
|
|
1384
|
-
type: "passwordRotationsuccess",
|
|
1385
|
-
payload: { otpmodelclose: true },
|
|
1386
|
-
});
|
|
1387
|
-
}
|
|
1388
|
-
setOpenPwdReset(false);
|
|
1389
|
-
};
|
|
1390
|
-
const changeUserName = (isError = false, errorMessage = "") => {
|
|
1391
|
-
dispath({
|
|
1392
|
-
type: "backToUsernameVerification",
|
|
1393
|
-
payload: {
|
|
1394
|
-
isError: isError,
|
|
1395
|
-
errorMessage: errorMessage,
|
|
1396
|
-
},
|
|
1397
|
-
});
|
|
1398
|
-
};
|
|
1399
|
-
const verifyFinger = async () => {
|
|
1400
|
-
try {
|
|
1401
|
-
dispath({ type: "inititateUserFingerScanner" });
|
|
1402
|
-
const fingerResponse = await capture();
|
|
1403
|
-
if (fingerResponse?.ErrorCode === "0") {
|
|
1404
|
-
dispath({ type: "inititateUserFingerVerification" });
|
|
1405
|
-
const promise = await matchFinger(loginState.auth_data, fingerResponse.IsoTemplate);
|
|
1406
|
-
if (promise.isError) {
|
|
1407
|
-
dispath({
|
|
1408
|
-
type: "biometricVerificationFailure",
|
|
1409
|
-
payload: {
|
|
1410
|
-
error: promise?.errorMessage ?? "Something went wrong.",
|
|
1411
|
-
},
|
|
1412
|
-
});
|
|
1413
|
-
}
|
|
1414
|
-
else {
|
|
1415
|
-
const { status, data, message } = await verifyOTP(loginState.transactionID, loginState.username, String(promise?.sr_cd ?? "0"), loginState.access_token, loginState.token_type, loginState.authType, promise.status ? "Y" : "N");
|
|
1416
|
-
if (status === "0" && promise.status) {
|
|
1417
|
-
dispath({ type: "biometricVerificationSuccessful" });
|
|
1418
|
-
loginFn(data);
|
|
1419
|
-
}
|
|
1420
|
-
else if (status === "0" && !promise.status) {
|
|
1421
|
-
failureCount.current = failureCount.current + 1;
|
|
1422
|
-
dispath({
|
|
1423
|
-
type: "biometricVerificationFailure",
|
|
1424
|
-
payload: {
|
|
1425
|
-
error: "Finger Not Match.Please Try Again",
|
|
1426
|
-
},
|
|
1427
|
-
});
|
|
1428
|
-
if (failureCount.current >= 3)
|
|
1429
|
-
changeUserName(true, "Finger Not Match.Please Try Again");
|
|
1430
|
-
}
|
|
1431
|
-
else if (status === "99") {
|
|
1432
|
-
dispath({
|
|
1433
|
-
type: "biometricVerificationFailure",
|
|
1434
|
-
payload: {
|
|
1435
|
-
error: message ?? "Finger Not Match.Please Try Again",
|
|
1436
|
-
},
|
|
1437
|
-
});
|
|
1438
|
-
}
|
|
1439
|
-
else if (status === "999") {
|
|
1440
|
-
dispath({
|
|
1441
|
-
type: "biometricVerificationFailure",
|
|
1442
|
-
payload: {
|
|
1443
|
-
error: message ?? "Finger Not Match.Please Try Again",
|
|
1444
|
-
},
|
|
1445
|
-
});
|
|
1446
|
-
changeUserName(true, message ?? "Finger Not Match.Please Try Again");
|
|
1447
|
-
}
|
|
1448
|
-
else {
|
|
1449
|
-
dispath({
|
|
1450
|
-
type: "biometricVerificationFailure",
|
|
1451
|
-
payload: {
|
|
1452
|
-
error: message ?? "Finger Not Match.Please Try Again",
|
|
1453
|
-
},
|
|
1454
|
-
});
|
|
1455
|
-
}
|
|
1456
|
-
}
|
|
1457
|
-
}
|
|
1458
|
-
else {
|
|
1459
|
-
dispath({
|
|
1460
|
-
type: "biometricVerificationFailure",
|
|
1461
|
-
payload: {
|
|
1462
|
-
error: fingerResponse?.ErrorMessage ?? t("Biometric.MFS100NotFound"),
|
|
1463
|
-
},
|
|
1464
|
-
});
|
|
1465
|
-
}
|
|
1466
|
-
}
|
|
1467
|
-
catch (e) {
|
|
1468
|
-
dispath({
|
|
1469
|
-
type: "biometricVerificationFailure",
|
|
1470
|
-
payload: {
|
|
1471
|
-
error: e?.message ?? t("Biometric.Unknownerroroccured"),
|
|
1472
|
-
},
|
|
1473
|
-
});
|
|
1474
|
-
}
|
|
1475
|
-
};
|
|
1476
|
-
return (jsx(Fragment$1, { children: jsxs(Grid, { container: true, style: { height: "100vh", overflow: "hidden" }, children: [jsx(BankDetails, { bannerDetails: bannerDetails }), jsxs(Grid, { item: true, xs: 11, md: 6, lg: 6, sm: 6, children: [logoUrl ? (jsx(Grid, { container: true, direction: "row", justifyContent: "flex-end", alignItems: "center", padding: "25px", maxWidth: "210px", ml: "auto", children: jsx(Tooltip, { describeChild: true, title: logoTitle ?? "", children: jsx("img", { src: Boolean(dashboardLogoURL) ? dashboardLogoURL : "", alt: "Logo", width: "100%" }) }) })) : null, LanguageComponent ? (jsx(Grid, { container: true, direction: "row", justifyContent: "flex-end", alignItems: "center", padding: "0 35px 0 0", maxWidth: "180px", ml: "auto", children: jsx(LanguageComponent, {}) })) : null, openpwdreset ? (jsx(PasswordRotation, { classes: classes, ResetPassword: ResetPassword, open: openpwdreset, username: loginState.username, accessToken: loginState.access_token, tokenType: loginState.token_type, handleClose: handlePasswordRotationClose, validatePasswordFn: validatePasswordFn })) : (jsx(Fragment$1, { children: loginState.currentFlow === "username" ? (jsx(UsernamePasswordField, { classes: classes, loginState: loginState, verifyUsernamePassword: verifyUsernamePassword, forgotPasswordEndpoint: forgotPasswordEndpoint }, "username")) : (jsx(Fragment$1, { children: loginState.authType === "OTP" ? (jsx(OTPModel, { OTPResendRequest: OTPResendRequest, classes: classes, loginState: loginState, VerifyOTP: VerifyOTP, previousStep: changeUserName, OTPError: t(loginState?.OtpuserMessage ?? ""), setOTPError: (error) => {
|
|
1477
|
-
dispath({
|
|
1478
|
-
type: "OTPVerificationFailed",
|
|
1479
|
-
payload: { error: error },
|
|
1480
|
-
});
|
|
1481
|
-
}, open: true, handleClose: changeUserName, resendFlag: "LOGIN", setNewRequestID: (newRequestID) => {
|
|
1482
|
-
dispath({
|
|
1483
|
-
type: "OTPResendSuccess",
|
|
1484
|
-
payload: { transactionID: newRequestID },
|
|
1485
|
-
});
|
|
1486
|
-
otpResendRef.current = otpResendRef.current + 1;
|
|
1487
|
-
}, otpresendCount: otpResendRef.current }, "otp")) : loginState.authType === "TOTP" ? (jsxs(Fragment$1, { children: [" ", jsx(OTPModelForm, { OTPResendRequest: OTPResendRequest, classes: classes,
|
|
1488
|
-
// handleClose={() => {}}
|
|
1489
|
-
handleClose: changeUserName, loginState: loginState, VerifyOTP: VerifyOTP, OTPError: loginState?.OtpuserMessage ?? "", setOTPError: (error) => {
|
|
1490
|
-
dispath({
|
|
1491
|
-
type: "OTPVerificationFailed",
|
|
1492
|
-
payload: { error: error },
|
|
1493
|
-
});
|
|
1494
|
-
}, resendFlag: "LOGIN", setNewRequestID: (newRequestID) => {
|
|
1495
|
-
dispath({
|
|
1496
|
-
type: "OTPResendSuccess",
|
|
1497
|
-
payload: { transactionID: newRequestID },
|
|
1498
|
-
});
|
|
1499
|
-
otpResendRef.current = otpResendRef.current + 1;
|
|
1500
|
-
}, otpresendCount: otpResendRef.current }, "OTPForm")] })) : (jsx(VerifyFinger, { classes: classes, loginState: loginState, verifyFinger: verifyFinger, previousStep: changeUserName }, "biometric")) })) }))] })] }) }));
|
|
1501
|
-
};
|
|
1502
|
-
|
|
1503
|
-
const ForgotPasswordFields = ({ classes, loginState, onSubmit, navigate, loginPageEndpoint, }) => {
|
|
1504
|
-
const [input, setInput] = useState({
|
|
1505
|
-
userName: loginState.workingState === 1 ? loginState?.username : "",
|
|
1506
|
-
mobileno: "",
|
|
1507
|
-
password: "",
|
|
1508
|
-
confirmpassword: "",
|
|
1509
|
-
});
|
|
1510
|
-
const inputRef = useRef(null);
|
|
1511
|
-
const inputPassRef = useRef(null);
|
|
1512
|
-
const inputButtonRef = useRef(null);
|
|
1513
|
-
const [showPasswordTime, setShowPasswordTime] = useState(0);
|
|
1514
|
-
const [showConfirmPasswordTime, setShowConfirmPasswordTime] = useState(0);
|
|
1515
|
-
const showPassword = Date.now() < showPasswordTime;
|
|
1516
|
-
const showConfirmPassword = Date.now() < showConfirmPasswordTime;
|
|
1517
|
-
const [, forceUpdate] = useState();
|
|
1518
|
-
const timerRef = useRef(null);
|
|
1519
|
-
useEffect(() => {
|
|
1520
|
-
return () => clearTimeout(timerRef.current);
|
|
1521
|
-
}, []);
|
|
1522
|
-
// const navigate = useNavigate();
|
|
1523
|
-
const { t } = useTranslation();
|
|
1524
|
-
const handleChange = (event) => {
|
|
1525
|
-
const name = event.target.name;
|
|
1526
|
-
let value = event.target.value;
|
|
1527
|
-
if (name === "userName" && value) {
|
|
1528
|
-
loginState.isUsernameError = false;
|
|
1529
|
-
}
|
|
1530
|
-
if (name === "mobileno" && value) {
|
|
1531
|
-
value = value.replace(/\D/g, "");
|
|
1532
|
-
if (Boolean(value)) {
|
|
1533
|
-
loginState.isMobileError = false;
|
|
1534
|
-
}
|
|
1535
|
-
}
|
|
1536
|
-
setInput((values) => ({ ...values, [name]: value }));
|
|
1537
|
-
};
|
|
1538
|
-
useEffect(() => {
|
|
1539
|
-
if (loginState.workingState === 1) {
|
|
1540
|
-
setTimeout(() => {
|
|
1541
|
-
inputPassRef?.current?.focus?.();
|
|
1542
|
-
}, 2000);
|
|
1543
|
-
}
|
|
1544
|
-
}, [loginState.workingState]);
|
|
1545
|
-
return (jsx(Fragment, { children: jsxs("div", { className: classes.formWrap, children: [jsx(TextField, { autoFocus: true, label: t("UserID"), placeholder: String(t("UserID")), fullWidth: true, type: "text", name: "userName", value: input.userName || "", onChange: handleChange, error: loginState.isUsernameError, helperText: loginState.isUsernameError
|
|
1546
|
-
? t(loginState.userMessageforusername)
|
|
1547
|
-
: "", InputLabelProps: { shrink: true }, disabled: loginState.loading
|
|
1548
|
-
? true
|
|
1549
|
-
: loginState.workingState === 0
|
|
1550
|
-
? false
|
|
1551
|
-
: true, autoComplete: "off", ref: inputRef, inputProps: { maxLength: 16 }, onKeyDown: (e) => {
|
|
1552
|
-
if (e.key === "Enter") {
|
|
1553
|
-
inputButtonRef?.current?.click?.();
|
|
1554
|
-
}
|
|
1555
|
-
}, style: { paddingBottom: "8px" } }), loginState.workingState === 0 ? (jsx(TextField, { label: t("MobileNo"), placeholder: "Enter Mobile No.",
|
|
1556
|
-
// placeholder={String(t("EnterMobileNo"))}
|
|
1557
|
-
fullWidth: true, type: "text", name: "mobileno", value: input.mobileno || "", onChange: handleChange, error: loginState.isMobileError, helperText: loginState.isMobileError
|
|
1558
|
-
? t(loginState.userMessageforMobileno)
|
|
1559
|
-
: "", InputLabelProps: { shrink: true }, disabled: loginState.loading
|
|
1560
|
-
? true
|
|
1561
|
-
: loginState.workingState === 0
|
|
1562
|
-
? false
|
|
1563
|
-
: true, autoComplete: "off", onKeyDown: (e) => {
|
|
1564
|
-
if (e.key === "Enter") {
|
|
1565
|
-
inputButtonRef?.current?.click?.();
|
|
1566
|
-
}
|
|
1567
|
-
}, inputProps: { maxLength: 13 }, style: { paddingBottom: "8px" } })) : null, loginState.workingState === 1 ? (jsxs(Fragment$1, { children: [jsx(TextField, { autoFocus: true, label: t("Password"), placeholder: "Enter Password", fullWidth: true, type: showPassword ? "text" : "password", name: "password", value: input.password || "", onChange: handleChange, error: loginState.isPasswordError, helperText: loginState.isPasswordError
|
|
1568
|
-
? t(loginState.userMessageforPassword)
|
|
1569
|
-
: "", InputLabelProps: { shrink: true }, disabled: loginState.loading, autoComplete: "off", ref: inputPassRef, onKeyDown: (e) => {
|
|
1570
|
-
if (e.key === "Enter") {
|
|
1571
|
-
inputButtonRef?.current?.click?.();
|
|
1572
|
-
}
|
|
1573
|
-
}, InputProps: {
|
|
1574
|
-
endAdornment: (jsx(InputAdornment, { position: "end", children: jsx(IconButton, { "aria-label": "toggle password visibility", onClick: () => {
|
|
1575
|
-
if (!showPassword) {
|
|
1576
|
-
setShowPasswordTime(Date.now() + 5000);
|
|
1577
|
-
timerRef.current = setTimeout(() => forceUpdate(Date.now()), 5000);
|
|
1578
|
-
}
|
|
1579
|
-
else if (showPassword)
|
|
1580
|
-
setShowPasswordTime(0);
|
|
1581
|
-
}, onMouseDown: (e) => e.preventDefault(), disabled: loginState.loading, children: showPassword ? jsx(Visibility, {}) : jsx(VisibilityOff, {}) }) })),
|
|
1582
|
-
}, inputProps: { maxLength: 16 }, style: { paddingBottom: "8px" } }), jsx(TextField, { label: t("ConfirmPassword"), placeholder: String(t("EnterConfirmPassword")), fullWidth: true, type: showConfirmPassword ? "text" : "password", name: "confirmpassword", value: input.confirmpassword || "", onChange: handleChange, error: loginState.isConfirmPasswordError, helperText: loginState.isConfirmPasswordError
|
|
1583
|
-
? t(loginState.userMessageforconfirmPassword)
|
|
1584
|
-
: "", InputLabelProps: { shrink: true }, disabled: loginState.loading, autoComplete: "off", onKeyDown: (e) => {
|
|
1585
|
-
if (e.key === "Enter") {
|
|
1586
|
-
inputButtonRef?.current?.click?.();
|
|
1587
|
-
}
|
|
1588
|
-
}, InputProps: {
|
|
1589
|
-
endAdornment: (jsx(InputAdornment, { position: "end", children: jsx(IconButton, { "aria-label": "toggle password visibility", onClick: () => {
|
|
1590
|
-
if (!showConfirmPassword) {
|
|
1591
|
-
setShowConfirmPasswordTime(Date.now() + 5000);
|
|
1592
|
-
timerRef.current = setTimeout(() => forceUpdate(Date.now()), 5000);
|
|
1593
|
-
}
|
|
1594
|
-
else if (showConfirmPassword)
|
|
1595
|
-
setShowConfirmPasswordTime(0);
|
|
1596
|
-
}, onMouseDown: (e) => e.preventDefault(), disabled: loginState.loading, children: showConfirmPassword ? jsx(Visibility, {}) : jsx(VisibilityOff, {}) }) })),
|
|
1597
|
-
}, inputProps: { maxLength: 16 }, style: { paddingBottom: "8px" } })] })) : null, loginState.isApiError ? (jsx(FormHelperText, { style: { color: "red" }, children: loginState.apierrorMessage })) : null, jsx("div", { style: {
|
|
1598
|
-
marginTop: "20px",
|
|
1599
|
-
display: "flex",
|
|
1600
|
-
flexDirection: "row-reverse",
|
|
1601
|
-
}, children: jsx("div", { style: {
|
|
1602
|
-
flex: "auto",
|
|
1603
|
-
textAlign: "center",
|
|
1604
|
-
marginTop: "5px",
|
|
1605
|
-
marginBottom: "17px",
|
|
1606
|
-
}, children: jsxs("div", { children: [jsx(GradientButton, { style: { borderRadius: "10px", marginRight: "5px" },
|
|
1607
|
-
// fullWidth
|
|
1608
|
-
disabled: loginState.loading, onClick: () => {
|
|
1609
|
-
navigate(loginPageEndpoint);
|
|
1610
|
-
}, starticon: "West", rotateIcon: "scale(1.4) rotateX(360deg)", children: t("backtologin") }), jsx(GradientButton, { style: { borderRadius: "10px" }, disabled: loginState.loading, onClick: () => {
|
|
1611
|
-
onSubmit(input, loginState.workingState);
|
|
1612
|
-
}, ref: inputButtonRef, endicon: loginState.loading ? undefined : "East", rotateIcon: "scale(1.4) rotateX(360deg)", children: loginState.loading ? (jsx(CircularProgress, { size: 25, thickness: 4.6 })) : (t("Next")) })] }) }) })] }) }));
|
|
1613
|
-
};
|
|
1614
|
-
|
|
1615
|
-
const inititalState = {
|
|
1616
|
-
isUsernameError: false,
|
|
1617
|
-
userMessageforusername: "",
|
|
1618
|
-
loading: false,
|
|
1619
|
-
isMobileError: false,
|
|
1620
|
-
userMessageforMobileno: "",
|
|
1621
|
-
isPasswordError: false,
|
|
1622
|
-
userMessageforPassword: "",
|
|
1623
|
-
isConfirmPasswordError: false,
|
|
1624
|
-
userMessageforconfirmPassword: "",
|
|
1625
|
-
workingState: 0,
|
|
1626
|
-
isApiError: false,
|
|
1627
|
-
apierrorMessage: "",
|
|
1628
|
-
otploading: false,
|
|
1629
|
-
OtpuserMessage: "",
|
|
1630
|
-
otpmodelClose: false,
|
|
1631
|
-
requestCd: "",
|
|
1632
|
-
username: "",
|
|
1633
|
-
auth_type: "O",
|
|
1634
|
-
transactionID: "",
|
|
1635
|
-
contactUser: "",
|
|
1636
|
-
};
|
|
1637
|
-
const reducer = (state, action) => {
|
|
1638
|
-
switch (action.type) {
|
|
1639
|
-
case "verifyUserNameandMobileNoFailed": {
|
|
1640
|
-
return {
|
|
1641
|
-
...state,
|
|
1642
|
-
loading: false,
|
|
1643
|
-
isUsernameError: action?.payload?.isUsernameError ?? false,
|
|
1644
|
-
isMobileError: action?.payload?.isMobileError ?? false,
|
|
1645
|
-
userMessageforusername: action?.payload?.userMessageforusername ?? "",
|
|
1646
|
-
userMessageforMobileno: action?.payload?.userMessageforMobileno ?? "",
|
|
1647
|
-
isApiError: action?.payload?.isApiError ?? false,
|
|
1648
|
-
apierrorMessage: action?.payload?.apierrorMessage ?? "",
|
|
1649
|
-
requestCd: "",
|
|
1650
|
-
username: "",
|
|
1651
|
-
contactUser: "",
|
|
1652
|
-
};
|
|
1653
|
-
}
|
|
1654
|
-
case "initverifyUserNameandMobileNo": {
|
|
1655
|
-
return {
|
|
1656
|
-
...state,
|
|
1657
|
-
loading: true,
|
|
1658
|
-
isUsernameError: false,
|
|
1659
|
-
isMobileError: false,
|
|
1660
|
-
requestCd: "",
|
|
1661
|
-
username: "",
|
|
1662
|
-
};
|
|
1663
|
-
}
|
|
1664
|
-
case "verifyUserNameandMobileNoSuccess": {
|
|
1665
|
-
return {
|
|
1666
|
-
...state,
|
|
1667
|
-
loading: false,
|
|
1668
|
-
isUsernameError: false,
|
|
1669
|
-
isMobileError: false,
|
|
1670
|
-
workingState: 0,
|
|
1671
|
-
isApiError: false,
|
|
1672
|
-
apierrorMessage: "",
|
|
1673
|
-
requestCd: action?.payload?.requestCd ?? "",
|
|
1674
|
-
username: action?.payload?.username ?? "",
|
|
1675
|
-
auth_type: action?.payload?.auth_type,
|
|
1676
|
-
company_ID: action?.payload?.company_ID,
|
|
1677
|
-
branch_cd: action?.payload?.branch_cd,
|
|
1678
|
-
otpValidFor: action?.payload?.otpValidFor,
|
|
1679
|
-
contactUser: action?.payload?.contactUser,
|
|
1680
|
-
};
|
|
1681
|
-
}
|
|
1682
|
-
case "inititateOTPVerification": {
|
|
1683
|
-
return {
|
|
1684
|
-
...state,
|
|
1685
|
-
loading: false,
|
|
1686
|
-
otploading: true,
|
|
1687
|
-
OtpuserMessage: "",
|
|
1688
|
-
otpmodelClose: false,
|
|
1689
|
-
};
|
|
1690
|
-
}
|
|
1691
|
-
case "OTPVerificationComplate": {
|
|
1692
|
-
return {
|
|
1693
|
-
...state,
|
|
1694
|
-
loading: false,
|
|
1695
|
-
otploading: false,
|
|
1696
|
-
OtpuserMessage: "",
|
|
1697
|
-
workingState: 1,
|
|
1698
|
-
otpmodelClose: Boolean(action?.payload?.otpmodelclose),
|
|
1699
|
-
};
|
|
1700
|
-
}
|
|
1701
|
-
case "OTPVerificationFailed": {
|
|
1702
|
-
return {
|
|
1703
|
-
...state,
|
|
1704
|
-
otploading: false,
|
|
1705
|
-
OtpuserMessage: action?.payload?.error,
|
|
1706
|
-
otpmodelClose: Boolean(action?.payload?.otpmodelclose),
|
|
1707
|
-
};
|
|
1708
|
-
}
|
|
1709
|
-
case "verifyPasswordFailed": {
|
|
1710
|
-
return {
|
|
1711
|
-
...state,
|
|
1712
|
-
loading: false,
|
|
1713
|
-
isPasswordError: action?.payload?.isPasswordError ?? false,
|
|
1714
|
-
isConfirmPasswordError: action?.payload?.isConfirmPasswordError ?? false,
|
|
1715
|
-
userMessageforPassword: action?.payload?.userMessageforPassword ?? "",
|
|
1716
|
-
userMessageforconfirmPassword: action?.payload?.userMessageforconfirmPassword ?? "",
|
|
1717
|
-
isApiError: false,
|
|
1718
|
-
apierrorMessage: "",
|
|
1719
|
-
};
|
|
1720
|
-
}
|
|
1721
|
-
case "initverifyPasswordSetReq": {
|
|
1722
|
-
return {
|
|
1723
|
-
...state,
|
|
1724
|
-
loading: true,
|
|
1725
|
-
isPasswordError: false,
|
|
1726
|
-
isConfirmPasswordError: false,
|
|
1727
|
-
};
|
|
1728
|
-
}
|
|
1729
|
-
case "passwordRegistaredSuccess": {
|
|
1730
|
-
return {
|
|
1731
|
-
...state,
|
|
1732
|
-
loading: false,
|
|
1733
|
-
isPasswordError: false,
|
|
1734
|
-
isConfirmPasswordError: false,
|
|
1735
|
-
};
|
|
1736
|
-
}
|
|
1737
|
-
case "OTPResendSuccess": {
|
|
1738
|
-
return {
|
|
1739
|
-
...state,
|
|
1740
|
-
requestCd: action?.payload?.requestCd,
|
|
1741
|
-
};
|
|
1742
|
-
}
|
|
1743
|
-
default: {
|
|
1744
|
-
return state;
|
|
1745
|
-
}
|
|
1746
|
-
}
|
|
1747
|
-
};
|
|
1748
|
-
const ForgotPasswordControllerWrapper = ({ screenFlag, updatenewPassword, validatePasswordFn, veirfyUsernameandMobileNo, verifyOTPForPWDReset, logoUrl, logoTitle, LanguageComponent, bannerDetails, navigate, loginPageEndpoint, }) => {
|
|
1749
|
-
const classes = useStyles$3();
|
|
1750
|
-
const [loginState, dispath] = useReducer(reducer, inititalState);
|
|
1751
|
-
const [open, setOpen] = useState(false);
|
|
1752
|
-
const { enqueueSnackbar } = useSnackbar();
|
|
1753
|
-
const otpResendRef = useRef(1);
|
|
1754
|
-
const { t } = useTranslation();
|
|
1755
|
-
const [dashboardLogoURL, setDashboardLogoURL] = useState(null);
|
|
1756
|
-
const urlObj = useRef(null);
|
|
1757
|
-
useEffect(() => {
|
|
1758
|
-
if (Boolean(logoUrl)) {
|
|
1759
|
-
if (isBase64(logoUrl)) {
|
|
1760
|
-
let blob = utilFunction.base64toBlob(logoUrl);
|
|
1761
|
-
urlObj.current =
|
|
1762
|
-
typeof blob === "object" && Boolean(blob)
|
|
1763
|
-
? URL.createObjectURL(blob)
|
|
1764
|
-
: "";
|
|
1765
|
-
setDashboardLogoURL(urlObj.current);
|
|
1766
|
-
}
|
|
1767
|
-
else {
|
|
1768
|
-
setDashboardLogoURL(logoUrl);
|
|
1769
|
-
}
|
|
1770
|
-
}
|
|
1771
|
-
}, [logoUrl]);
|
|
1772
|
-
const onSubmitHandel = async (data, flag) => {
|
|
1773
|
-
if (verifyRequestData(data, flag)) {
|
|
1774
|
-
if (flag === 0) {
|
|
1775
|
-
dispath({ type: "initverifyUserNameandMobileNo" });
|
|
1776
|
-
const { status, data: resdata, message, } = await veirfyUsernameandMobileNo(data?.userName.toLowerCase(), data?.mobileno, screenFlag);
|
|
1777
|
-
if (status === "0") {
|
|
1778
|
-
dispath({
|
|
1779
|
-
type: "verifyUserNameandMobileNoSuccess",
|
|
1780
|
-
payload: {
|
|
1781
|
-
requestCd: String(resdata?.TRAN_CD ?? ""),
|
|
1782
|
-
username: data?.userName,
|
|
1783
|
-
auth_type: resdata?.AUTH_TYPE,
|
|
1784
|
-
company_ID: resdata?.COMP_CD,
|
|
1785
|
-
branch_cd: resdata?.BRANCH_CD,
|
|
1786
|
-
otpValidFor: resdata?.OTP_VALID,
|
|
1787
|
-
contactUser: resdata?.CONTACT2,
|
|
1788
|
-
},
|
|
1789
|
-
});
|
|
1790
|
-
setOpen(true);
|
|
1791
|
-
}
|
|
1792
|
-
else {
|
|
1793
|
-
dispath({
|
|
1794
|
-
type: "verifyUserNameandMobileNoFailed",
|
|
1795
|
-
payload: {
|
|
1796
|
-
isApiError: true,
|
|
1797
|
-
apierrorMessage: message,
|
|
1798
|
-
},
|
|
1799
|
-
});
|
|
1800
|
-
}
|
|
1801
|
-
}
|
|
1802
|
-
else if (flag === 1) {
|
|
1803
|
-
dispath({ type: "initverifyPasswordSetReq" });
|
|
1804
|
-
const { validateStatus, validateData } = await validatePasswordFn({
|
|
1805
|
-
USER_ID: data?.userName,
|
|
1806
|
-
PASSWORD: data?.password,
|
|
1807
|
-
SCREEN_REF: "FORGET_PW"
|
|
1808
|
-
});
|
|
1809
|
-
// console.log("validateData", validateData?.O_MESSAGE, validateStatus)
|
|
1810
|
-
if (validateStatus === "0") {
|
|
1811
|
-
switch (validateData?.O_STATUS) {
|
|
1812
|
-
case "999":
|
|
1813
|
-
dispath({
|
|
1814
|
-
type: "verifyPasswordFailed",
|
|
1815
|
-
payload: {
|
|
1816
|
-
isPasswordError: true,
|
|
1817
|
-
userMessageforPassword: validateData?.O_MESSAGE,
|
|
1818
|
-
apierrorMessage: validateData?.O_MESSAGE,
|
|
1819
|
-
},
|
|
1820
|
-
});
|
|
1821
|
-
break;
|
|
1822
|
-
case "0":
|
|
1823
|
-
const { status, data: resdata, message } = await updatenewPassword(loginState?.requestCd, loginState?.username, data?.password);
|
|
1824
|
-
if (status === "0") {
|
|
1825
|
-
dispath({ type: "passwordRegistaredSuccess" });
|
|
1826
|
-
enqueueSnackbar("Password successfully reset", {
|
|
1827
|
-
variant: "success",
|
|
1828
|
-
});
|
|
1829
|
-
navigate(loginPageEndpoint);
|
|
1830
|
-
}
|
|
1831
|
-
else if (status === "99") {
|
|
1832
|
-
dispath({
|
|
1833
|
-
type: "verifyPasswordFailed",
|
|
1834
|
-
payload: {
|
|
1835
|
-
isApiError: true,
|
|
1836
|
-
apierrorMessage: message,
|
|
1837
|
-
},
|
|
1838
|
-
});
|
|
1839
|
-
}
|
|
1840
|
-
else {
|
|
1841
|
-
enqueueSnackbar(message, {
|
|
1842
|
-
variant: "error",
|
|
1843
|
-
});
|
|
1844
|
-
navigate(loginPageEndpoint);
|
|
1845
|
-
}
|
|
1846
|
-
}
|
|
1847
|
-
}
|
|
1848
|
-
else {
|
|
1849
|
-
dispath({
|
|
1850
|
-
type: "verifyPasswordFailed",
|
|
1851
|
-
payload: {
|
|
1852
|
-
isApiError: true,
|
|
1853
|
-
apierrorMessage: validateData?.O_MESSAGE,
|
|
1854
|
-
},
|
|
1855
|
-
});
|
|
1856
|
-
}
|
|
1857
|
-
}
|
|
1858
|
-
}
|
|
1859
|
-
};
|
|
1860
|
-
const verifyRequestData = (data, flag) => {
|
|
1861
|
-
if (flag === 0) {
|
|
1862
|
-
let validationData = {
|
|
1863
|
-
isUsernameError: false,
|
|
1864
|
-
isMobileError: false,
|
|
1865
|
-
userMessageforusername: "",
|
|
1866
|
-
userMessageforMobileno: "",
|
|
1867
|
-
};
|
|
1868
|
-
if (!Boolean(data.userName)) {
|
|
1869
|
-
validationData.isUsernameError = true;
|
|
1870
|
-
validationData.userMessageforusername = "UsernameisRequired";
|
|
1871
|
-
}
|
|
1872
|
-
if (!Boolean(data.mobileno)) {
|
|
1873
|
-
validationData.isMobileError = true;
|
|
1874
|
-
validationData.userMessageforMobileno = "MobileNoisRequired";
|
|
1875
|
-
}
|
|
1876
|
-
else if (isNaN(data.mobileno) ||
|
|
1877
|
-
(data.mobileno.length !== 10 && data.mobileno.length !== 13)) {
|
|
1878
|
-
validationData.isMobileError = true;
|
|
1879
|
-
validationData.userMessageforMobileno = "Please enter valid Mobile No.";
|
|
1880
|
-
}
|
|
1881
|
-
dispath({
|
|
1882
|
-
type: "verifyUserNameandMobileNoFailed",
|
|
1883
|
-
payload: validationData,
|
|
1884
|
-
});
|
|
1885
|
-
return !(validationData.isMobileError || validationData.isUsernameError);
|
|
1886
|
-
}
|
|
1887
|
-
else if (flag === 1) {
|
|
1888
|
-
let validationData = {
|
|
1889
|
-
isPasswordError: false,
|
|
1890
|
-
userMessageforPassword: "",
|
|
1891
|
-
isConfirmPasswordError: false,
|
|
1892
|
-
userMessageforconfirmPassword: "",
|
|
1893
|
-
};
|
|
1894
|
-
let pwdverify = utilFunction.ValidatePassword(data.password);
|
|
1895
|
-
if (Boolean(pwdverify)) {
|
|
1896
|
-
validationData.isPasswordError = true;
|
|
1897
|
-
validationData.userMessageforPassword = pwdverify;
|
|
1898
|
-
}
|
|
1899
|
-
if (!Boolean(data.confirmpassword)) {
|
|
1900
|
-
validationData.isConfirmPasswordError = true;
|
|
1901
|
-
validationData.userMessageforconfirmPassword =
|
|
1902
|
-
"Confirmpasswordisrequired";
|
|
1903
|
-
}
|
|
1904
|
-
else if (Boolean(data.password) &&
|
|
1905
|
-
data.password !== data.confirmpassword) {
|
|
1906
|
-
validationData.isConfirmPasswordError = true;
|
|
1907
|
-
validationData.userMessageforconfirmPassword =
|
|
1908
|
-
"New Password and Confirm Password did not matched";
|
|
1909
|
-
}
|
|
1910
|
-
dispath({
|
|
1911
|
-
type: "verifyPasswordFailed",
|
|
1912
|
-
payload: validationData,
|
|
1913
|
-
});
|
|
1914
|
-
return !(validationData.isConfirmPasswordError || validationData.isPasswordError);
|
|
1915
|
-
}
|
|
1916
|
-
return true;
|
|
1917
|
-
};
|
|
1918
|
-
const handleClose = () => {
|
|
1919
|
-
setOpen(false);
|
|
1920
|
-
};
|
|
1921
|
-
const VerifyOTP = async (OTPNumber) => {
|
|
1922
|
-
if (Boolean(OTPNumber) && OTPNumber.toString().length === 6) {
|
|
1923
|
-
dispath({ type: "inititateOTPVerification" });
|
|
1924
|
-
const { status, data: resdata, message, } = await verifyOTPForPWDReset(loginState?.requestCd, loginState?.username, OTPNumber, loginState?.auth_type, screenFlag);
|
|
1925
|
-
if (status === "0") {
|
|
1926
|
-
if (screenFlag === "totp") {
|
|
1927
|
-
enqueueSnackbar(message, {
|
|
1928
|
-
variant: "success",
|
|
1929
|
-
});
|
|
1930
|
-
navigate(loginPageEndpoint);
|
|
1931
|
-
}
|
|
1932
|
-
else {
|
|
1933
|
-
dispath({
|
|
1934
|
-
type: "OTPVerificationComplate",
|
|
1935
|
-
payload: { otpmodelclose: true },
|
|
1936
|
-
});
|
|
1937
|
-
}
|
|
1938
|
-
}
|
|
1939
|
-
else if (status === "99") {
|
|
1940
|
-
dispath({
|
|
1941
|
-
type: "OTPVerificationFailed",
|
|
1942
|
-
payload: { error: message },
|
|
1943
|
-
});
|
|
1944
|
-
}
|
|
1945
|
-
else {
|
|
1946
|
-
enqueueSnackbar(message, {
|
|
1947
|
-
variant: "error",
|
|
1948
|
-
});
|
|
1949
|
-
navigate(loginPageEndpoint);
|
|
1950
|
-
}
|
|
1951
|
-
}
|
|
1952
|
-
else {
|
|
1953
|
-
dispath({
|
|
1954
|
-
type: "OTPVerificationFailed",
|
|
1955
|
-
payload: { error: "Please enter a 6 digit OTP number" },
|
|
1956
|
-
});
|
|
1957
|
-
}
|
|
1958
|
-
};
|
|
1959
|
-
return (jsx(Fragment$1, { children: jsxs(Grid, { container: true, style: { height: "100vh", overflow: "hidden" }, children: [jsx(BankDetails, { bannerDetails: bannerDetails }), jsxs(Grid, { item: true, xs: 6, md: 6, lg: 6, sm: 6, children: [logoUrl ? (jsx(Grid, { container: true, direction: "row", justifyContent: "flex-end", alignItems: "center", padding: "31px", maxWidth: "210px", ml: "auto", children: jsx(Tooltip, { describeChild: true, title: logoTitle ?? "", children: jsx("img", { src: Boolean(dashboardLogoURL) ? dashboardLogoURL : "", alt: "Logo", width: "100%" }) }) })) : null, LanguageComponent ? (jsx(Grid, { container: true, direction: "row", justifyContent: "flex-end", alignItems: "center", padding: "0 35px 0 0", maxWidth: "180px", ml: "auto", children: jsx(LanguageComponent, {}) })) : null, jsx(Container, { maxWidth: "xs", children: jsxs(Grid, { alignItems: "center", style: { paddingTop: "20px" }, children: [jsx("h2", { style: { margin: "10px 0" }, children: loginState.workingState === 1
|
|
1960
|
-
? t("Setnewpassword")
|
|
1961
|
-
: screenFlag === "totp"
|
|
1962
|
-
? "Forgot TOTP"
|
|
1963
|
-
: t("ForgotPassword") }), open ? (jsx(OTPModelForm, { classes: classes, handleClose: handleClose, loginState: loginState, VerifyOTP: VerifyOTP, OTPError: t(loginState?.OtpuserMessage ?? ""), setOTPError: (error) => {
|
|
1964
|
-
dispath({
|
|
1965
|
-
type: "OTPVerificationFailed",
|
|
1966
|
-
payload: { error: error },
|
|
1967
|
-
});
|
|
1968
|
-
}, resendFlag: "FORGET_PW", setNewRequestID: (newRequestID) => {
|
|
1969
|
-
dispath({
|
|
1970
|
-
type: "OTPResendSuccess",
|
|
1971
|
-
payload: { requestCd: newRequestID },
|
|
1972
|
-
});
|
|
1973
|
-
otpResendRef.current = otpResendRef.current + 1;
|
|
1974
|
-
}, otpresendCount: otpResendRef.current, OTPResendRequest: undefined })) : (jsx(ForgotPasswordFields, { classes: classes, loginState: loginState, onSubmit: onSubmitHandel, navigate: navigate, loginPageEndpoint: loginPageEndpoint }))] }) })] })] }) }));
|
|
1975
|
-
};
|
|
1976
|
-
|
|
1977
|
-
const BranchSelectionGridMetaData = {
|
|
1978
|
-
gridConfig: {
|
|
1979
|
-
dense: true,
|
|
1980
|
-
gridLabel: "Access Branch List",
|
|
1981
|
-
rowIdColumn: "BRANCH_CD",
|
|
1982
|
-
// searchPlaceholder: "Branches",
|
|
1983
|
-
defaultColumnConfig: {
|
|
1984
|
-
width: 400,
|
|
1985
|
-
maxWidth: 450,
|
|
1986
|
-
minWidth: 300,
|
|
1987
|
-
},
|
|
1988
|
-
allowColumnReordering: false,
|
|
1989
|
-
disableSorting: false,
|
|
1990
|
-
hideHeader: false,
|
|
1991
|
-
disableGroupBy: true,
|
|
1992
|
-
enablePagination: false,
|
|
1993
|
-
containerHeight: {
|
|
1994
|
-
min: "68vh",
|
|
1995
|
-
max: "68vh ",
|
|
1996
|
-
},
|
|
1997
|
-
allowFilter: false,
|
|
1998
|
-
allowColumnHiding: false,
|
|
1999
|
-
allowRowSelection: false,
|
|
2000
|
-
isCusrsorFocused: true,
|
|
2001
|
-
hideFooter: true,
|
|
2002
|
-
},
|
|
2003
|
-
columns: [
|
|
2004
|
-
{
|
|
2005
|
-
accessor: "BRANCH_CD",
|
|
2006
|
-
columnName: "Branch Code",
|
|
2007
|
-
sequence: 1,
|
|
2008
|
-
alignment: "left",
|
|
2009
|
-
componentType: "default",
|
|
2010
|
-
width: 200,
|
|
2011
|
-
minWidth: 140,
|
|
2012
|
-
maxWidth: 220,
|
|
2013
|
-
},
|
|
2014
|
-
{
|
|
2015
|
-
accessor: "BRANCH_NM",
|
|
2016
|
-
columnName: "Branch Name",
|
|
2017
|
-
sequence: 2,
|
|
2018
|
-
alignment: "left",
|
|
2019
|
-
componentType: "default",
|
|
2020
|
-
width: 280,
|
|
2021
|
-
minWidth: 280,
|
|
2022
|
-
maxWidth: 420,
|
|
2023
|
-
},
|
|
2024
|
-
{
|
|
2025
|
-
accessor: "DISP_STATUS",
|
|
2026
|
-
columnName: "Status",
|
|
2027
|
-
sequence: 3,
|
|
2028
|
-
alignment: "left",
|
|
2029
|
-
componentType: "default",
|
|
2030
|
-
width: 200,
|
|
2031
|
-
minWidth: 140,
|
|
2032
|
-
maxWidth: 220,
|
|
2033
|
-
},
|
|
2034
|
-
{
|
|
2035
|
-
accessor: "BEGIN_DATETIME",
|
|
2036
|
-
columnName: "Begin Time",
|
|
2037
|
-
sequence: 4,
|
|
2038
|
-
alignment: "left",
|
|
2039
|
-
componentType: "dateTime",
|
|
2040
|
-
width: 222,
|
|
2041
|
-
minWidth: 140,
|
|
2042
|
-
maxWidth: 240,
|
|
2043
|
-
},
|
|
2044
|
-
{
|
|
2045
|
-
accessor: "END_DATETIME",
|
|
2046
|
-
columnName: "End Time",
|
|
2047
|
-
sequence: 5,
|
|
2048
|
-
alignment: "left",
|
|
2049
|
-
componentType: "dateTime",
|
|
2050
|
-
width: 222,
|
|
2051
|
-
minWidth: 140,
|
|
2052
|
-
maxWidth: 240,
|
|
2053
|
-
},
|
|
2054
|
-
{
|
|
2055
|
-
accessor: "DAYEND_STATUS",
|
|
2056
|
-
columnName: "Dayend Status",
|
|
2057
|
-
sequence: 6,
|
|
2058
|
-
componentType: "default",
|
|
2059
|
-
isVisible: false,
|
|
2060
|
-
},
|
|
2061
|
-
{
|
|
2062
|
-
accessor: "EOD_RUNNING_STATUS",
|
|
2063
|
-
columnName: "EOD Running Status",
|
|
2064
|
-
sequence: 6,
|
|
2065
|
-
componentType: "default",
|
|
2066
|
-
isVisible: false,
|
|
2067
|
-
},
|
|
2068
|
-
{
|
|
2069
|
-
accessor: "BASE_COMP_CD",
|
|
2070
|
-
columnName: "Base Comp Cd",
|
|
2071
|
-
sequence: 6,
|
|
2072
|
-
componentType: "default",
|
|
2073
|
-
isVisible: false,
|
|
2074
|
-
},
|
|
2075
|
-
{
|
|
2076
|
-
accessor: "BASE_BRANCH_CD",
|
|
2077
|
-
columnName: "Base Branch Cd",
|
|
2078
|
-
sequence: 6,
|
|
2079
|
-
componentType: "default",
|
|
2080
|
-
isVisible: false,
|
|
2081
|
-
},
|
|
2082
|
-
{
|
|
2083
|
-
accessor: "COMP_CD",
|
|
2084
|
-
columnName: "Comp Cd",
|
|
2085
|
-
sequence: 6,
|
|
2086
|
-
componentType: "default",
|
|
2087
|
-
isVisible: false,
|
|
2088
|
-
},
|
|
2089
|
-
{
|
|
2090
|
-
accessor: "COMP_NM",
|
|
2091
|
-
columnName: "Comp Name",
|
|
2092
|
-
sequence: 6,
|
|
2093
|
-
componentType: "default",
|
|
2094
|
-
isVisible: false,
|
|
2095
|
-
},
|
|
2096
|
-
],
|
|
2097
|
-
};
|
|
2098
|
-
|
|
2099
|
-
const useStyles$2 = makeStyles((theme) => ({
|
|
2100
|
-
heading_user_img: {
|
|
2101
|
-
width: "40px",
|
|
2102
|
-
height: "40px",
|
|
2103
|
-
// cursor: "pointer",
|
|
2104
|
-
},
|
|
2105
|
-
heading_user_img_border: {
|
|
2106
|
-
border: "2px dashed var(--theme-color3)",
|
|
2107
|
-
borderRadius: "50%",
|
|
2108
|
-
padding: "4px",
|
|
2109
|
-
},
|
|
2110
|
-
logo: {
|
|
2111
|
-
height: "38px",
|
|
2112
|
-
},
|
|
2113
|
-
}));
|
|
2114
|
-
|
|
2115
|
-
const actions = [
|
|
2116
|
-
{
|
|
2117
|
-
actionName: "back",
|
|
2118
|
-
actionLabel: "Back",
|
|
2119
|
-
multiple: false,
|
|
2120
|
-
rowDoubleClick: false,
|
|
2121
|
-
actionTextColor: "var(--theme-color3)",
|
|
2122
|
-
actionBackground: "var(--white)",
|
|
2123
|
-
startsIcon: "West",
|
|
2124
|
-
rotateIcon: "scale(1.4) rotateX(-360deg)",
|
|
2125
|
-
},
|
|
2126
|
-
{
|
|
2127
|
-
actionName: "proceed",
|
|
2128
|
-
actionLabel: "Proceed",
|
|
2129
|
-
multiple: false,
|
|
2130
|
-
rowDoubleClick: true,
|
|
2131
|
-
actionTextColor: "var(--white)",
|
|
2132
|
-
actionBackground: "var(--theme-color3)",
|
|
2133
|
-
onEnterSubmit: true,
|
|
2134
|
-
endsIcon: "East",
|
|
2135
|
-
rotateIcon: "scale(1.4) rotateX(-360deg)",
|
|
2136
|
-
},
|
|
2137
|
-
];
|
|
2138
|
-
const BranchSelectionGrid = ({ selectionMode, authState, isBranchSelectedFn, isLoggedInFn, logoutFn, logos, logo, navigate, BranchSelectionGridDataApiFn, GetMenuDataApiFn, sideImage, branchSelectFn, dashboardUrl, loginUrl, appTranCd, }) => {
|
|
2139
|
-
const classes = useStyles$2();
|
|
2140
|
-
const { enqueueSnackbar } = useSnackbar();
|
|
2141
|
-
const { data, isLoading, isFetching, error, isError } = useQuery(["BranchSelectionGridData"], () => BranchSelectionGridDataApiFn());
|
|
2142
|
-
useEffect(() => {
|
|
2143
|
-
return () => {
|
|
2144
|
-
queryClient.removeQueries(["BranchSelectionGridData", {}]);
|
|
2145
|
-
};
|
|
2146
|
-
}, []);
|
|
2147
|
-
useEffect(() => {
|
|
2148
|
-
if (!isLoggedInFn()) {
|
|
2149
|
-
navigate(loginUrl);
|
|
2150
|
-
}
|
|
2151
|
-
else if (isBranchSelectedFn() && selectionMode !== "C") {
|
|
2152
|
-
navigate(dashboardUrl);
|
|
2153
|
-
}
|
|
2154
|
-
}, [isBranchSelectedFn, isLoggedInFn]);
|
|
2155
|
-
const mutation = useMutation(GetMenuDataApiFn, {
|
|
2156
|
-
onSuccess: (data, extreData) => {
|
|
2157
|
-
branchSelectFn({
|
|
2158
|
-
menulistdata: data,
|
|
2159
|
-
branchCode: extreData?.BRANCH_CD,
|
|
2160
|
-
branch: extreData?.BRANCH_NM,
|
|
2161
|
-
baseBranchCode: extreData?.BASE_BRANCH_CD,
|
|
2162
|
-
});
|
|
2163
|
-
},
|
|
2164
|
-
});
|
|
2165
|
-
const getError = mutation.error;
|
|
2166
|
-
const setCurrentAction = useCallback((data) => {
|
|
2167
|
-
if (data.name === "proceed") {
|
|
2168
|
-
if (data.rows?.length === 0) {
|
|
2169
|
-
enqueueSnackbar("Please Select Branch", {
|
|
2170
|
-
variant: "error",
|
|
2171
|
-
});
|
|
2172
|
-
}
|
|
2173
|
-
else if (data.rows?.[0]?.data?.STATUS === "C") {
|
|
2174
|
-
enqueueSnackbar("Branch is in Day End Status.~rPlease contact system Vendor.", {
|
|
2175
|
-
variant: "error",
|
|
2176
|
-
});
|
|
2177
|
-
}
|
|
2178
|
-
else {
|
|
2179
|
-
mutation.mutate({
|
|
2180
|
-
BASE_COMP_CD: data.rows?.[0]?.data?.BASE_COMP_CD ?? "",
|
|
2181
|
-
BASE_BRANCH_CD: data.rows?.[0]?.data?.BASE_BRANCH_CD ?? "",
|
|
2182
|
-
COMP_CD: data.rows?.[0]?.data?.COMP_CD ?? "",
|
|
2183
|
-
BRANCH_CD: data.rows?.[0]?.data?.BRANCH_CD ?? "",
|
|
2184
|
-
GROUP_NAME: authState?.groupName ?? "",
|
|
2185
|
-
APP_TRAN_CD: appTranCd,
|
|
2186
|
-
COMP_NM: data.rows?.[0]?.data?.COMP_NM ?? "",
|
|
2187
|
-
BRANCH_NM: data.rows?.[0]?.data?.BRANCH_NM ?? "",
|
|
2188
|
-
DAYEND_STATUS: data.rows?.[0]?.data?.DAYEND_STATUS ?? "",
|
|
2189
|
-
EOD_RUNNING_STATUS: data.rows?.[0]?.data?.EOD_RUNNING_STATUS ?? "",
|
|
2190
|
-
IS_UPD_DEF_BRANCH: authState?.user?.isUpdDefBranch ?? "",
|
|
2191
|
-
COMP_BASE_BRANCH_CD: data.rows?.[0]?.data?.COMP_BASE_BRANCH_CD ?? "",
|
|
2192
|
-
selectionMode: selectionMode,
|
|
2193
|
-
});
|
|
2194
|
-
}
|
|
2195
|
-
}
|
|
2196
|
-
else if (data.name === "back") {
|
|
2197
|
-
if (selectionMode === "C") {
|
|
2198
|
-
navigate(dashboardUrl, {
|
|
2199
|
-
replace: true,
|
|
2200
|
-
});
|
|
2201
|
-
}
|
|
2202
|
-
else {
|
|
2203
|
-
logoutFn();
|
|
2204
|
-
}
|
|
2205
|
-
}
|
|
2206
|
-
}, [navigate, data, mutation]);
|
|
2207
|
-
useEffect(() => {
|
|
2208
|
-
var oneBranchOpen = data?.some((branch) => branch.STATUS === "O");
|
|
2209
|
-
if (oneBranchOpen === false) {
|
|
2210
|
-
enqueueSnackbar("Branch is in Day End Status.~rPlease contact system Vendor.", {
|
|
2211
|
-
variant: "error",
|
|
2212
|
-
});
|
|
2213
|
-
logoutFn();
|
|
2214
|
-
}
|
|
2215
|
-
if (data?.length === 1) {
|
|
2216
|
-
if (data?.[0]?.STATUS === "O") {
|
|
2217
|
-
setCurrentAction({ name: "proceed", rows: [{ data: { ...data[0] } }] });
|
|
2218
|
-
}
|
|
2219
|
-
}
|
|
2220
|
-
}, [JSON.stringify(data)]);
|
|
2221
|
-
const Greetings = () => {
|
|
2222
|
-
let hours = new Date().getHours();
|
|
2223
|
-
let greet;
|
|
2224
|
-
if (hours < 12)
|
|
2225
|
-
greet = "morning";
|
|
2226
|
-
else if (hours >= 12 && hours <= 16)
|
|
2227
|
-
greet = "afternoon";
|
|
2228
|
-
else if (hours >= 16 && hours <= 24)
|
|
2229
|
-
greet = "evening";
|
|
2230
|
-
return jsxs("span", { children: ["Good ", greet, ","] });
|
|
2231
|
-
};
|
|
2232
|
-
const LightTooltip = styled(({ className, ...props }) => (jsx(Tooltip, { ...props, classes: { popper: className } })))(({ theme }) => ({
|
|
2233
|
-
[`& .${tooltipClasses.tooltip}`]: {
|
|
2234
|
-
backgroundColor: theme.palette.common.white,
|
|
2235
|
-
color: "rgba(0, 0, 0, 0.87)",
|
|
2236
|
-
boxShadow: theme.shadows[1],
|
|
2237
|
-
fontSize: 13,
|
|
2238
|
-
},
|
|
2239
|
-
}));
|
|
2240
|
-
// const greet = Greetings();
|
|
2241
|
-
return (jsx(Fragment$1, { children: jsxs(Grid, { container: true, style: {
|
|
2242
|
-
margin: "0",
|
|
2243
|
-
padding: "0",
|
|
2244
|
-
height: "100vh",
|
|
2245
|
-
// overflowY: "hidden",
|
|
2246
|
-
}, children: [sideImage ? (jsx(Grid, { item: true, lg: 1, md: 1, xl: 1, xs: 1, sm: 1, children: jsx("img", { className: "sideImage", src: sideImage, alt: "side-Image" }) })) : null, jsx(Grid, { item: true, lg: 11, md: 11, xl: 11, xs: 11, style: {
|
|
2247
|
-
display: "flex",
|
|
2248
|
-
justifyContent: "center",
|
|
2249
|
-
}, children: jsxs(Grid, { container: true, style: {
|
|
2250
|
-
minHeight: "100vh",
|
|
2251
|
-
padding: "10px 0px 0px 0px",
|
|
2252
|
-
}, lg: 11, md: 11, xl: 11, xs: 11, children: [jsxs(Grid, { container: true, style: {
|
|
2253
|
-
margin: "0",
|
|
2254
|
-
padding: "0",
|
|
2255
|
-
// height: "12vh",
|
|
2256
|
-
}, lg: 12, md: 12, xl: 12, xs: 12, children: [jsx(Grid, { xs: 12, sm: 1, md: 1, lg: 1, xl: 1, sx: {
|
|
2257
|
-
display: "flex",
|
|
2258
|
-
alignItems: "center",
|
|
2259
|
-
// justifyContent: "center",
|
|
2260
|
-
}, children: jsx(Stack, { direction: "row", spacing: 4, ml: 1, children: jsx(Box, { className: classes.heading_user_img_border, sx: { cursor: "pointer" }, children: jsx(LightTooltip, { title: jsxs(Fragment$1, { children: [jsxs("div", { children: ["User ID : ", authState?.user?.id ?? ""] }), jsxs("div", { children: ["Role : ", authState?.roleName ?? ""] }), jsx("div", { children: "Last Unsuccessful Login : \"\"" })] }), placement: "bottom-start", children: jsx(Avatar, { className: classes.heading_user_img,
|
|
2261
|
-
// onClick={handleNavigate}
|
|
2262
|
-
alt: "Remy Sharp", src: Boolean(logos?.profile)
|
|
2263
|
-
? logos?.profile
|
|
2264
|
-
: USER_PROFILE_DEFAULT }) }) }) }) }), jsxs(Grid, { xs: 12, sm: 5, md: 5, lg: 5, xl: 5, sx: {
|
|
2265
|
-
justifyContent: "center",
|
|
2266
|
-
display: "flex",
|
|
2267
|
-
flexDirection: "column",
|
|
2268
|
-
}, children: [jsxs("h1", { className: "name-heading", style: { fontSize: "24px", margin: "4px 0px" }, children: ["Welcome ", jsx("span", { children: `${authState?.user?.name ?? ""},` })] }), jsxs("div", { style: { display: "flex", alignItems: "center", gap: 10 }, children: [jsx("h3", { style: { margin: "4px 0px" }, children: Greetings() }), jsx("img", { src: Waving_hand, alt: "", style: { height: "18px" } })] })] }), jsx(Grid, { xs: 12, sm: 1, md: 1, lg: 1, xl: 1, sx: {
|
|
2269
|
-
display: "flex",
|
|
2270
|
-
// flexDirection: "column",
|
|
2271
|
-
justifyContent: "center",
|
|
2272
|
-
alignItems: "center",
|
|
2273
|
-
}, children: jsx(Stack, { direction: "row", justifyContent: "flex-start", spacing: 2, children: jsx(Box, { className: classes.heading_user_img_border, children: jsx(Avatar, { className: classes.heading_user_img, alt: "Remy Sharp", src: Boolean(logos?.bank) ? logos?.bank : bank_logo_default }) }) }) }), jsxs(Grid, { xs: 12, sm: 3, md: 3, lg: 3, xl: 3, sx: {
|
|
2274
|
-
display: "flex",
|
|
2275
|
-
flexDirection: "column",
|
|
2276
|
-
justifyContent: "center",
|
|
2277
|
-
}, children: [jsx("div", { className: "bank-name-container", style: { fontSize: "14px" }, children: jsx("p", { className: "bank-name", children: `Bank Name: ${authState?.companyName ?? ""}` }) }), jsx("p", { className: "emp-id", children: `Emp. Id: ${authState?.user?.employeeID ?? ""}` })] }), jsxs(Grid, { xs: 12, sm: 3, md: 3, lg: 2, xl: 2, sx: {
|
|
2278
|
-
display: "flex",
|
|
2279
|
-
alignItems: "center",
|
|
2280
|
-
justifyContent: "right",
|
|
2281
|
-
}, children: [" ", jsx("div", { children: jsx("img", { src: Boolean(logos?.logo) ? logos?.logo : logo, alt: "bank_logo", className: classes.logo }) })] })] }), isError ? (jsx(Fragment, { children: jsx("div", { style: { width: "100%", paddingTop: "10px" }, children: jsx(Alert, { severity: error?.severity ?? "error", errorMsg: error?.error_msg ?? "Error", errorDetail: error?.error_detail ?? "" }) }) })) : mutation.isError && mutation.error ? (jsx(Fragment, { children: jsx("div", { style: { width: "100%", paddingTop: "10px" }, children: jsx(Alert, { severity: getError.severity ?? "error", errorMsg: getError.error_msg ?? "Error", errorDetail: getError.error_detail ?? "" }) }) })) : null, jsx(GridWrapper, { finalMetaData: BranchSelectionGridMetaData, data: data ?? [], setData: () => null, actions: actions, setAction: setCurrentAction, controlsAtBottom: true, actionContextAtBottom: true, headerToolbarStyle: {
|
|
2282
|
-
background: "#fff !important",
|
|
2283
|
-
padding: "0",
|
|
2284
|
-
"& .MuiTypography-root": {
|
|
2285
|
-
color: "black",
|
|
2286
|
-
},
|
|
2287
|
-
}, disableMultipleRowSelect: true, variant: "outlined", loading: isLoading || isFetching || mutation.isLoading, defaultSelectedRowId: authState?.user?.branchCode ?? null }, `branchSelection`), isError || data?.length === 0 ? (jsx(Button, { sx: {
|
|
2288
|
-
backgroundColor: "var(--theme-color3)",
|
|
2289
|
-
position: "absolute",
|
|
2290
|
-
right: "113px",
|
|
2291
|
-
bottom: "20px",
|
|
2292
|
-
width: "7rem",
|
|
2293
|
-
"&:hover": {
|
|
2294
|
-
backgroundColor: "var(--theme-color3)",
|
|
2295
|
-
},
|
|
2296
|
-
}, onClick: () => {
|
|
2297
|
-
if (selectionMode === "C") {
|
|
2298
|
-
navigate(dashboardUrl, {
|
|
2299
|
-
replace: true,
|
|
2300
|
-
});
|
|
2301
|
-
}
|
|
2302
|
-
else {
|
|
2303
|
-
logoutFn();
|
|
2304
|
-
}
|
|
2305
|
-
}, children: "Back" })) : null] }) })] }) }));
|
|
2306
|
-
};
|
|
2307
|
-
const BranchSelectionGridWrapper = (props) => {
|
|
2308
|
-
return (jsx(ClearCacheProvider, { children: jsx(BranchSelectionGrid, { ...props }) }));
|
|
2309
|
-
};
|
|
2310
|
-
|
|
2311
|
-
const useStyles$1 = makeStyles((theme) => ({
|
|
2312
|
-
appBar: {
|
|
2313
|
-
// zIndex: theme.zIndex.drawer + 1,
|
|
2314
|
-
transition: theme.transitions.create(["width", "margin"], {
|
|
2315
|
-
easing: theme.transitions.easing.sharp,
|
|
2316
|
-
duration: theme.transitions.duration.leavingScreen,
|
|
2317
|
-
}),
|
|
2318
|
-
color: "#0063A3",
|
|
2319
|
-
height: "80px",
|
|
2320
|
-
background: "var(--white)",
|
|
2321
|
-
boxShadow: "0px 1px 0px -0.5px #DEE0E2",
|
|
2322
|
-
},
|
|
2323
|
-
searchBar: {
|
|
2324
|
-
width: 290,
|
|
2325
|
-
border: "none",
|
|
2326
|
-
color: "rgba(0, 0, 0, 0.87) !important",
|
|
2327
|
-
backgroundColor: "rgb(235 237 238 / 26%)!important",
|
|
2328
|
-
"& input": {
|
|
2329
|
-
width: "100% !important",
|
|
2330
|
-
},
|
|
2331
|
-
},
|
|
2332
|
-
searchList: {
|
|
2333
|
-
position: "absolute",
|
|
2334
|
-
background: "#fff",
|
|
2335
|
-
width: "100%",
|
|
2336
|
-
borderRadius: "6px",
|
|
2337
|
-
boxShadow: "0 12px 25px rgba(0,0,0,.3)",
|
|
2338
|
-
top: "120%",
|
|
2339
|
-
height: "auto",
|
|
2340
|
-
maxHeight: "325px",
|
|
2341
|
-
overflowY: "auto",
|
|
2342
|
-
"& .list-links": {
|
|
2343
|
-
background: "none",
|
|
2344
|
-
border: "none",
|
|
2345
|
-
outline: "none",
|
|
2346
|
-
cursor: "pointer",
|
|
2347
|
-
textDecoration: "none",
|
|
2348
|
-
padding: "0.7rem 1rem",
|
|
2349
|
-
fontSize: "0.90rem",
|
|
2350
|
-
textAlign: "left",
|
|
2351
|
-
borderBottom: "1px solid #ddd",
|
|
2352
|
-
color: "#222 !important",
|
|
2353
|
-
fontWeight: 500,
|
|
2354
|
-
"&:hover, &.active": {
|
|
2355
|
-
backgroundColor: "#f4f4f4",
|
|
2356
|
-
},
|
|
2357
|
-
},
|
|
2358
|
-
},
|
|
2359
|
-
appBarShift: {
|
|
2360
|
-
paddingLeft: "0px",
|
|
2361
|
-
// width: `calc(100% - ${drawerWidth}px)`,
|
|
2362
|
-
transition: theme.transitions.create(["width", "margin"], {
|
|
2363
|
-
easing: theme.transitions.easing.sharp,
|
|
2364
|
-
duration: theme.transitions.duration.enteringScreen,
|
|
2365
|
-
background: "rgba(250, 251, 255, 0.9)",
|
|
2366
|
-
}),
|
|
2367
|
-
},
|
|
2368
|
-
heading_user_dtl: {
|
|
2369
|
-
width: "458px",
|
|
2370
|
-
height: "73px",
|
|
2371
|
-
left: "37px",
|
|
2372
|
-
top: "calc(50% - 73px/2)",
|
|
2373
|
-
},
|
|
2374
|
-
heading_user_img: {
|
|
2375
|
-
width: "40px",
|
|
2376
|
-
height: "40px",
|
|
2377
|
-
// cursor: "pointer",
|
|
2378
|
-
},
|
|
2379
|
-
heading_user_img_border: {
|
|
2380
|
-
border: "2px dashed var(--theme-color3)",
|
|
2381
|
-
borderRadius: "50%",
|
|
2382
|
-
padding: "4px",
|
|
2383
|
-
},
|
|
2384
|
-
toolbar: {
|
|
2385
|
-
minHeight: "80px",
|
|
2386
|
-
paddingLeft: "0px",
|
|
2387
|
-
height: "80px",
|
|
2388
|
-
},
|
|
2389
|
-
title: {
|
|
2390
|
-
flexGrow: 1,
|
|
2391
|
-
padding: theme.spacing(0.5, 0),
|
|
2392
|
-
color: "var(--theme-color1)",
|
|
2393
|
-
},
|
|
2394
|
-
searchRoot: {
|
|
2395
|
-
fontFamily: theme.typography.fontFamily,
|
|
2396
|
-
position: "relative",
|
|
2397
|
-
boxShadow: "0px 2px 4px -1px rgba(0,0,0,0.2), 0px 4px 5px 0px rgba(0,0,0,0.14), 0px 1px 10px 0px rgba(0,0,0,0.12)",
|
|
2398
|
-
marginRight: theme.spacing(2),
|
|
2399
|
-
marginLeft: theme.spacing(1),
|
|
2400
|
-
marginBottom: theme.spacing(0.25),
|
|
2401
|
-
marginTop: theme.spacing(0.25),
|
|
2402
|
-
borderRadius: 40,
|
|
2403
|
-
backgroundColor: alpha(theme.palette.common.white, 0.15),
|
|
2404
|
-
"&:hover": {
|
|
2405
|
-
backgroundColor: alpha(theme.palette.common.white, 0.25),
|
|
2406
|
-
},
|
|
2407
|
-
"& $inputInput": {
|
|
2408
|
-
transition: theme.transitions.create("width"),
|
|
2409
|
-
width: 120,
|
|
2410
|
-
"&:focus": {
|
|
2411
|
-
width: 170,
|
|
2412
|
-
},
|
|
2413
|
-
},
|
|
2414
|
-
},
|
|
2415
|
-
search: {
|
|
2416
|
-
width: theme.spacing(6),
|
|
2417
|
-
height: "100%",
|
|
2418
|
-
position: "absolute",
|
|
2419
|
-
pointerEvents: "none",
|
|
2420
|
-
display: "flex",
|
|
2421
|
-
alignItems: "center",
|
|
2422
|
-
justifyContent: "center",
|
|
2423
|
-
},
|
|
2424
|
-
inputRoot: {
|
|
2425
|
-
color: "inherit",
|
|
2426
|
-
marginTop: 0,
|
|
2427
|
-
borderRadius: "40px",
|
|
2428
|
-
},
|
|
2429
|
-
inputInput: {
|
|
2430
|
-
padding: theme.spacing(1, 1, 1, 6),
|
|
2431
|
-
},
|
|
2432
|
-
loggedInUser: {
|
|
2433
|
-
marginLeft: theme.spacing(2),
|
|
2434
|
-
},
|
|
2435
|
-
nameClass: {
|
|
2436
|
-
color: "#0063A3",
|
|
2437
|
-
fontWeight: 600,
|
|
2438
|
-
textTransform: "capitalize",
|
|
2439
|
-
lineHeight: "1.4",
|
|
2440
|
-
textAlign: "left",
|
|
2441
|
-
},
|
|
2442
|
-
dropDown: {
|
|
2443
|
-
fontSize: "2rem",
|
|
2444
|
-
},
|
|
2445
|
-
vTop: {
|
|
2446
|
-
verticalAlign: "top",
|
|
2447
|
-
paddingLeft: "4px",
|
|
2448
|
-
color: "var(--theme-color1)",
|
|
2449
|
-
},
|
|
2450
|
-
userDesignation: {
|
|
2451
|
-
margin: "0px",
|
|
2452
|
-
fontWeight: 500,
|
|
2453
|
-
fontSize: "0.875rem",
|
|
2454
|
-
lineHeight: 1.57,
|
|
2455
|
-
color: "var(--theme-color1)",
|
|
2456
|
-
},
|
|
2457
|
-
userName: {
|
|
2458
|
-
margin: "0px",
|
|
2459
|
-
fontWeight: 500,
|
|
2460
|
-
fontSize: "0.875rem",
|
|
2461
|
-
lineHeight: 1.57,
|
|
2462
|
-
color: "var(--theme-color3)",
|
|
2463
|
-
},
|
|
2464
|
-
userprofilehover: {
|
|
2465
|
-
"&:hover": {
|
|
2466
|
-
backgroundColor: "var(--white)",
|
|
2467
|
-
},
|
|
2468
|
-
},
|
|
2469
|
-
lang_svg: {
|
|
2470
|
-
marginRight: "10px",
|
|
2471
|
-
width: "22px",
|
|
2472
|
-
height: "22px",
|
|
2473
|
-
},
|
|
2474
|
-
logo: {
|
|
2475
|
-
height: "38px",
|
|
2476
|
-
},
|
|
2477
|
-
version01: {
|
|
2478
|
-
margin: "0",
|
|
2479
|
-
textAlign: "center",
|
|
2480
|
-
color: "var(--theme-color3)",
|
|
2481
|
-
fontSize: "9px",
|
|
2482
|
-
},
|
|
2483
|
-
DrawerClose_icon: {
|
|
2484
|
-
color: "var(--theme-color3)",
|
|
2485
|
-
position: "static",
|
|
2486
|
-
background: "transperant",
|
|
2487
|
-
"&:hover": {
|
|
2488
|
-
background: "var(--theme-color4)",
|
|
2489
|
-
},
|
|
2490
|
-
width: "46px",
|
|
2491
|
-
height: "46px",
|
|
2492
|
-
},
|
|
2493
|
-
marquee: {
|
|
2494
|
-
animation: "$marquee 10s linear infinite",
|
|
2495
|
-
animationDelay: "3s",
|
|
2496
|
-
},
|
|
2497
|
-
"@keyframes marquee": {
|
|
2498
|
-
"0%": { transform: "translateX(100%)" },
|
|
2499
|
-
"100%": { transform: "translateX(-100%)" },
|
|
2500
|
-
},
|
|
2501
|
-
popover: {
|
|
2502
|
-
popover: {
|
|
2503
|
-
maxWidth: "100%",
|
|
2504
|
-
width: "fit-content",
|
|
2505
|
-
"& .MuiPopover-paper": {
|
|
2506
|
-
maxWidth: "100%",
|
|
2507
|
-
},
|
|
2508
|
-
},
|
|
2509
|
-
},
|
|
2510
|
-
}));
|
|
2511
|
-
|
|
2512
|
-
const AppbarWrapper = ({ handleDrawerOpen, handleDrawerClose, open, authState, LanguageComponent, SearchComponent, dashboardUrl, logos, bankLogo, profilePic, handleLogout, handleProfile, navigate, hideGreetings, menuIconPosition = "left", }) => {
|
|
2513
|
-
const classes = useStyles$1();
|
|
2514
|
-
const { t } = useTranslation();
|
|
2515
|
-
const LightTooltip = styled(({ className, ...props }) => (jsx(Tooltip, { ...props, classes: { popper: className } })))(({ theme }) => ({
|
|
2516
|
-
[`& .${tooltipClasses.tooltip}`]: {
|
|
2517
|
-
backgroundColor: theme.palette.common.white,
|
|
2518
|
-
color: "rgba(0, 0, 0, 0.87)",
|
|
2519
|
-
boxShadow: theme.shadows[1],
|
|
2520
|
-
fontSize: 13,
|
|
2521
|
-
},
|
|
2522
|
-
}));
|
|
2523
|
-
const Greetings = () => {
|
|
2524
|
-
let hours = new Date().getHours();
|
|
2525
|
-
let greet;
|
|
2526
|
-
if (hours < 12)
|
|
2527
|
-
greet = "morning";
|
|
2528
|
-
else if (hours >= 12 && hours <= 16)
|
|
2529
|
-
greet = "afternoon";
|
|
2530
|
-
else if (hours >= 16 && hours <= 24)
|
|
2531
|
-
greet = "evening";
|
|
2532
|
-
return jsxs("span", { children: ["Good ", greet, ","] });
|
|
2533
|
-
};
|
|
2534
|
-
return (jsx(AppBar, { position: "fixed", elevation: 0, className: clsx(classes.appBar, open && classes.appBarShift), children: jsxs(Toolbar, { className: classes.toolbar, children: [jsxs(Box, { sx: {
|
|
2535
|
-
display: "flex",
|
|
2536
|
-
justifyContent: "space-evenly",
|
|
2537
|
-
alignItems: "center",
|
|
2538
|
-
height: "80px",
|
|
2539
|
-
width: "227px",
|
|
2540
|
-
flexDirection: menuIconPosition === "right" ? "row-reverse" : "row",
|
|
2541
|
-
}, children: [open ? (jsx(IconButton$1, { disableRipple: true, onClick: () => handleDrawerClose(), className: classes.DrawerClose_icon, children: jsx(MenuOutlinedIcon, { fontSize: "large" }) })) : (jsx(IconButton$1, { disableRipple: true, "aria-label": "open drawer", onClick: () => handleDrawerOpen(), className: classes.DrawerClose_icon, children: jsx(MenuOutlinedIcon, { fontSize: "large" }) })), jsxs("div", { children: [jsx("img", { src: Boolean(logos?.logo) ? logos?.logo : bankLogo, alt: "bank_logo", className: classes.logo, onClick: (e) => {
|
|
2542
|
-
e.preventDefault();
|
|
2543
|
-
navigate(dashboardUrl ?? "./dashboard");
|
|
2544
|
-
} }), jsx("p", { className: classes.version01, children: logos?.version })] })] }), jsx(Stack, { direction: "row", spacing: 4, mx: 2, children: jsx(Box, { className: classes.heading_user_img_border, children: jsx(Avatar, { className: classes.heading_user_img, alt: "Remy Sharp", src: Boolean(logos?.bank) ? logos?.bank : bank_logo_default }) }) }), jsxs(Typography, { component: "h1", variant: "h6", color: "inherit", noWrap: true, className: classes.title, children: [jsx(Box, { style: {
|
|
2545
|
-
marginBottom: "8px",
|
|
2546
|
-
fontSize: "17px",
|
|
2547
|
-
color: "var(--theme-color1)",
|
|
2548
|
-
width: "555px",
|
|
2549
|
-
}, className: clsx({
|
|
2550
|
-
[classes.marquee]: authState?.companyName.length > 55,
|
|
2551
|
-
}), children: authState?.companyName || "" }), jsx("div", { style: { display: "flex", gap: "8px" }, children: jsxs("div", { style: { color: "var(--theme-color6)" }, children: [jsxs(Typography, { variant: "caption", display: "block", lineHeight: 0, fontSize: "11px", children: [t("appBar.Branch"), ":", authState?.user?.branchCode ?? "001 ", "-", authState?.user?.branch ?? ""] }), jsxs(Typography, { variant: "caption", display: "inline", fontSize: "11px", children: [t("appBar.WorkingDate"), ":", " ", Boolean(authState?.workingDate)
|
|
2552
|
-
? checkDateAndDisplay(format(new Date(authState?.workingDate), "dd/MM/yyyy"))
|
|
2553
|
-
: "not found"] }), jsxs(Typography, { marginLeft: 1, variant: "caption", display: "inline", fontSize: "11px", children: [t("appBar.LastLoginDate"), " :", " ", checkDateAndDisplay(authState?.user?.lastLogin ?? "Vastrapur")] })] }) })] }), jsxs(Box, { children: [!hideGreetings ? (jsx(Box, { sx: { marginBottom: "3px", paddingRight: "15px" }, children: jsxs(Stack, { direction: "row", spacing: 2, justifyContent: "flex-end", alignItems: "center", children: [jsxs(Typography, { fontSize: "17px", color: "#1C1C1C", children: [Greetings(), " ", authState?.user?.id ?? ""] }), jsx("img", { src: Waving_hand, alt: "", style: { height: "18px" } })] }) })) : null, jsxs(Box, { display: "flex", justifyContent: "space-evenly", alignItems: "center", children: [SearchComponent ? jsx(SearchComponent, {}) : null, LanguageComponent ? jsx(LanguageComponent, {}) : null, jsx(Box, { maxWidth: 170, display: "flex", justifyContent: "end", children: jsx(Tooltip, { title: "Logout", placement: "bottom", arrow: true, children: jsx(IconButton$1, { onClick: () => typeof handleLogout === "function" ? handleLogout() : null, color: "error", sx: {
|
|
2554
|
-
backgroundColor: "rgba(235, 237, 238, 0.45)",
|
|
2555
|
-
borderRadius: "10px",
|
|
2556
|
-
height: "30px",
|
|
2557
|
-
width: "30px",
|
|
2558
|
-
"&:hover": {
|
|
2559
|
-
background: "var(--white)",
|
|
2560
|
-
borderRadius: "10px",
|
|
2561
|
-
transition: "all 0.2s ease 0s",
|
|
2562
|
-
boxShadow: "rgba(0, 0, 0, 0.16) 0px 3px 6px, rgba(0, 0, 0, 0.23) 0px 3px 6px",
|
|
2563
|
-
"& .MuiSvgIcon-root": {
|
|
2564
|
-
height: "32px",
|
|
2565
|
-
width: "32px",
|
|
2566
|
-
transition: "all 0.2s ease 0s",
|
|
2567
|
-
padding: "4px",
|
|
2568
|
-
},
|
|
2569
|
-
},
|
|
2570
|
-
}, "aria-label": "show 4 new mails", children: jsx(LogoutIcon, {}) }) }) })] })] }), jsx(Stack, { direction: "row", spacing: 4, ml: 1, children: jsx(Box, { className: classes.heading_user_img_border, sx: { cursor: "pointer" }, children: jsx(LightTooltip, { title: jsxs(Fragment$1, { children: [jsxs("div", { children: [" ", t("appBar.UserID"), ": ", authState?.user?.id] }), jsxs("div", { children: [t("appBar.Role"), " : ", authState?.roleName] }), jsxs("div", { children: [t("appBar.LastUnsuccessfulLogin"), " : \"\""] })] }), placement: "bottom-start", children: jsx(Avatar, { className: classes.heading_user_img, onClick: () => typeof handleProfile === "function" ? handleProfile() : null, alt: "Remy Sharp", src: profilePic ?? "" }) }) }) })] }) }));
|
|
2571
|
-
};
|
|
2572
|
-
const checkDateAndDisplay = (dateStr) => {
|
|
2573
|
-
// const dt = new Date(dateStr);
|
|
2574
|
-
// //@ts-ignore
|
|
2575
|
-
// if (dt instanceof Date && !isNaN(dt)) {
|
|
2576
|
-
// return dt.toDateString();
|
|
2577
|
-
// }
|
|
2578
|
-
if (Boolean(dateStr)) {
|
|
2579
|
-
return dateStr;
|
|
2580
|
-
}
|
|
2581
|
-
return "N/A";
|
|
2582
|
-
};
|
|
2583
|
-
|
|
2584
|
-
const drawerWidth = 227;
|
|
2585
|
-
const useStyles = makeStyles((theme) => {
|
|
2586
|
-
return {
|
|
2587
|
-
drawerPaper: {
|
|
2588
|
-
position: "relative",
|
|
2589
|
-
whiteSpace: "nowrap",
|
|
2590
|
-
width: drawerWidth,
|
|
2591
|
-
transition: theme.transitions.create("width", {
|
|
2592
|
-
easing: theme.transitions.easing.sharp,
|
|
2593
|
-
duration: theme.transitions.duration.enteringScreen,
|
|
2594
|
-
}),
|
|
2595
|
-
border: "none",
|
|
2596
|
-
overflow: "hidden",
|
|
2597
|
-
zIndex: 120,
|
|
2598
|
-
},
|
|
2599
|
-
drawerPaperClose: {
|
|
2600
|
-
overflowX: "hidden",
|
|
2601
|
-
transition: theme.transitions.create("width", {
|
|
2602
|
-
easing: theme.transitions.easing.sharp,
|
|
2603
|
-
duration: theme.transitions.duration.leavingScreen,
|
|
2604
|
-
}),
|
|
2605
|
-
width: theme.spacing(8),
|
|
2606
|
-
[theme.breakpoints.up("sm")]: {
|
|
2607
|
-
width: theme.spacing(8),
|
|
2608
|
-
},
|
|
2609
|
-
},
|
|
2610
|
-
toolbarIcon: {
|
|
2611
|
-
display: "flex",
|
|
2612
|
-
alignItems: "center",
|
|
2613
|
-
zIndex: 9999,
|
|
2614
|
-
...theme.mixins.toolbar,
|
|
2615
|
-
background: "var(--white)",
|
|
2616
|
-
justifyContent: "center",
|
|
2617
|
-
height: "80px",
|
|
2618
|
-
// borderBottom: "1px dashed #949597",
|
|
2619
|
-
},
|
|
2620
|
-
hrCSS: {
|
|
2621
|
-
zIndex: 9999,
|
|
2622
|
-
},
|
|
2623
|
-
buttonLink: {
|
|
2624
|
-
backgroundColor: "transparent",
|
|
2625
|
-
border: "none",
|
|
2626
|
-
cursor: "pointer",
|
|
2627
|
-
textDecoration: "underline",
|
|
2628
|
-
display: "inline",
|
|
2629
|
-
margin: 0,
|
|
2630
|
-
padding: 0,
|
|
2631
|
-
"&:focus": {
|
|
2632
|
-
textDecoration: "none",
|
|
2633
|
-
},
|
|
2634
|
-
"$:hover": {
|
|
2635
|
-
textDecoration: "none",
|
|
2636
|
-
},
|
|
2637
|
-
},
|
|
2638
|
-
};
|
|
2639
|
-
});
|
|
2640
|
-
/*
|
|
2641
|
-
|
|
2642
|
-
*/
|
|
2643
|
-
|
|
2644
|
-
const reportMetaData = [];
|
|
2645
|
-
|
|
2646
|
-
// import { createTheme } from "@mui/material";
|
|
2647
|
-
// const theme = createTheme();
|
|
2648
|
-
makeStyles((theme) => ({
|
|
2649
|
-
navBarCSS: {
|
|
2650
|
-
padding: "4px 1rem ",
|
|
2651
|
-
backgroundColor: "#fff !important",
|
|
2652
|
-
minHeight: "64px",
|
|
2653
|
-
boxShadow: "0 3px 6px rgba(0,0,0,0.03)",
|
|
2654
|
-
margin: "10px",
|
|
2655
|
-
},
|
|
2656
|
-
headerDropdown: {
|
|
2657
|
-
backgroundColor: "#fff",
|
|
2658
|
-
minWidth: "205px",
|
|
2659
|
-
boxShadow: "0 3px 6px rgba(0,0,0,0.16)",
|
|
2660
|
-
textDecoration: "none",
|
|
2661
|
-
borderBottom: "3px solid #26A456",
|
|
2662
|
-
},
|
|
2663
|
-
navLinkHeader: {
|
|
2664
|
-
color: "#555",
|
|
2665
|
-
fontSize: "14px",
|
|
2666
|
-
lineHeight: "1.2",
|
|
2667
|
-
paddingTop: "4px",
|
|
2668
|
-
paddingBottom: "4px",
|
|
2669
|
-
paddingRight: ".5rem",
|
|
2670
|
-
paddingLeft: ".5rem",
|
|
2671
|
-
fontWeight: 600,
|
|
2672
|
-
textTransform: "capitalize",
|
|
2673
|
-
display: "flex",
|
|
2674
|
-
alignItems: "center",
|
|
2675
|
-
cursor: "pointer",
|
|
2676
|
-
"& hover": {
|
|
2677
|
-
color: "#0b6fb8",
|
|
2678
|
-
},
|
|
2679
|
-
},
|
|
2680
|
-
productLink: {
|
|
2681
|
-
color: "#555",
|
|
2682
|
-
padding: "0 1rem 8px 1rem",
|
|
2683
|
-
display: "inline-block",
|
|
2684
|
-
verticalAlign: "middle",
|
|
2685
|
-
cursor: "pointer",
|
|
2686
|
-
textTransform: "capitalize",
|
|
2687
|
-
},
|
|
2688
|
-
font13: {
|
|
2689
|
-
fontSize: "13px",
|
|
2690
|
-
},
|
|
2691
|
-
loginDropdown: {
|
|
2692
|
-
width: "160px",
|
|
2693
|
-
},
|
|
2694
|
-
}));
|
|
2695
|
-
const useStylesSideBar = makeStyles((theme) => ({
|
|
2696
|
-
root: {
|
|
2697
|
-
justifyContent: "center",
|
|
2698
|
-
},
|
|
2699
|
-
drawer: {
|
|
2700
|
-
margin: "5px",
|
|
2701
|
-
},
|
|
2702
|
-
item: {
|
|
2703
|
-
display: "flex",
|
|
2704
|
-
//borderBottom: "2px solid #93242433",
|
|
2705
|
-
borderRadius: "8px",
|
|
2706
|
-
marginLeft: "7px",
|
|
2707
|
-
marginTop: "6.5px",
|
|
2708
|
-
width: "90%",
|
|
2709
|
-
height: "50px",
|
|
2710
|
-
paddingLeft: theme.spacing(2),
|
|
2711
|
-
paddingRight: theme.spacing(2),
|
|
2712
|
-
background: "var(--white)",
|
|
2713
|
-
boxShadow: "3px 6px 9px rgba(93, 95, 121, 0.26)",
|
|
2714
|
-
"& svg": {
|
|
2715
|
-
// color: theme.palette.primary.main,
|
|
2716
|
-
color: "var(--theme-color1)",
|
|
2717
|
-
},
|
|
2718
|
-
"&:hover": {
|
|
2719
|
-
boxShadow: "6px 6px 1px -1px rgba(0,0,0,0.2), 0px 1px 1px 0px rgba(0,0,0,0.14), 0px 1px 0px 0px rgba(0,0,5,0.12)",
|
|
2720
|
-
background: "var(--theme-color4)",
|
|
2721
|
-
transition: "0.6s ease",
|
|
2722
|
-
},
|
|
2723
|
-
},
|
|
2724
|
-
drawerIconSize: {
|
|
2725
|
-
width: "50px",
|
|
2726
|
-
height: "50px",
|
|
2727
|
-
padding: "18px",
|
|
2728
|
-
justifyItems: "cenetr",
|
|
2729
|
-
},
|
|
2730
|
-
button: {
|
|
2731
|
-
color: "#0063A3",
|
|
2732
|
-
padding: "10px 8px",
|
|
2733
|
-
//justifyContent: "flex-start",
|
|
2734
|
-
textTransform: "none",
|
|
2735
|
-
letterSpacing: 0,
|
|
2736
|
-
width: "100%",
|
|
2737
|
-
textAlign: "left",
|
|
2738
|
-
"&:hover": {
|
|
2739
|
-
backgroundColor: "var(--theme-color1)",
|
|
2740
|
-
// boxShadow: "0px 15px 20px rgb(221 176 176 / 37%)",
|
|
2741
|
-
},
|
|
2742
|
-
},
|
|
2743
|
-
btnRoot: {
|
|
2744
|
-
paddingLeft: "24px",
|
|
2745
|
-
justifyContent: "left ",
|
|
2746
|
-
},
|
|
2747
|
-
navLinks: {
|
|
2748
|
-
// height: "calc(100vh - 78px)",
|
|
2749
|
-
overflowY: "auto",
|
|
2750
|
-
overflowX: "hidden",
|
|
2751
|
-
// height:"100px",
|
|
2752
|
-
backgroundColor: "rgba(250, 251, 255, 0.9);",
|
|
2753
|
-
// height: "calc(100vh - 230px)",
|
|
2754
|
-
//background: "var(--theme-color1)",
|
|
2755
|
-
// marginTop: "25px",
|
|
2756
|
-
// boxShadow: "0 3px 6px rgba(255, 99, 71, 0.3)",
|
|
2757
|
-
borderRadius: "10px",
|
|
2758
|
-
paddingTop: "5px",
|
|
2759
|
-
//margin: "5px",
|
|
2760
|
-
},
|
|
2761
|
-
navLinksforseparateView: {
|
|
2762
|
-
overflowY: "auto",
|
|
2763
|
-
overflowX: "hidden",
|
|
2764
|
-
height: "calc(100vh - 180px)",
|
|
2765
|
-
// height:"auto",
|
|
2766
|
-
paddingTop: "10px",
|
|
2767
|
-
},
|
|
2768
|
-
nestedMenuLevel1: {
|
|
2769
|
-
paddingLeft: "20px",
|
|
2770
|
-
marginTop: "11px",
|
|
2771
|
-
paddingRight: theme.spacing(3),
|
|
2772
|
-
height: "auto",
|
|
2773
|
-
fontSize: "13px",
|
|
2774
|
-
"& div > svg": {
|
|
2775
|
-
fontSize: "14px",
|
|
2776
|
-
},
|
|
2777
|
-
},
|
|
2778
|
-
nestedMenuLevel2: {
|
|
2779
|
-
paddingLeft: "20px",
|
|
2780
|
-
marginTop: "11px",
|
|
2781
|
-
fontSize: "12px",
|
|
2782
|
-
"& div > svg": {
|
|
2783
|
-
fontSize: "9px",
|
|
2784
|
-
},
|
|
2785
|
-
},
|
|
2786
|
-
listIcon: {
|
|
2787
|
-
minWidth: "30px !important",
|
|
2788
|
-
justifyItems: "center",
|
|
2789
|
-
color: "var(--theme-color6)",
|
|
2790
|
-
fontWeight: 700,
|
|
2791
|
-
fontSize: "18px",
|
|
2792
|
-
},
|
|
2793
|
-
link: {
|
|
2794
|
-
fontSize: "1rem ",
|
|
2795
|
-
marginTop: "2px",
|
|
2796
|
-
marginBottom: "2px",
|
|
2797
|
-
textOverflow: "ellipsis",
|
|
2798
|
-
color: "var(--theme-color1)",
|
|
2799
|
-
marginLeft: "15px",
|
|
2800
|
-
whiteSpace: "break-spaces",
|
|
2801
|
-
"& span": {
|
|
2802
|
-
fontWeight: 400,
|
|
2803
|
-
whiteSpace: "break-spaces",
|
|
2804
|
-
},
|
|
2805
|
-
"& p": {
|
|
2806
|
-
color: "var(--theme-color3)",
|
|
2807
|
-
fontweight: 400,
|
|
2808
|
-
},
|
|
2809
|
-
},
|
|
2810
|
-
linktext: {
|
|
2811
|
-
backgroundColor: "var(--white)",
|
|
2812
|
-
"&:hover": {
|
|
2813
|
-
background: "var(--theme-color1)",
|
|
2814
|
-
"& div": {
|
|
2815
|
-
color: "var(--white) !important",
|
|
2816
|
-
},
|
|
2817
|
-
"& div > svg": {
|
|
2818
|
-
color: "var(--white) !important",
|
|
2819
|
-
},
|
|
2820
|
-
},
|
|
2821
|
-
},
|
|
2822
|
-
faSmall: {
|
|
2823
|
-
fontSize: "13px ",
|
|
2824
|
-
},
|
|
2825
|
-
openList: {
|
|
2826
|
-
":not(activeMenuItem)": {
|
|
2827
|
-
"& > div": {
|
|
2828
|
-
backgroundColor: "rgba(0, 0, 0, 0.04)",
|
|
2829
|
-
},
|
|
2830
|
-
"& *": {
|
|
2831
|
-
color: "var(--white)",
|
|
2832
|
-
},
|
|
2833
|
-
},
|
|
2834
|
-
},
|
|
2835
|
-
openCurrent: {
|
|
2836
|
-
backgroundColor: "var(--theme-color1)",
|
|
2837
|
-
"& *": {
|
|
2838
|
-
color: "var(--white)",
|
|
2839
|
-
},
|
|
2840
|
-
"&:hover": {
|
|
2841
|
-
backgroundColor: "var(--theme-color1)",
|
|
2842
|
-
},
|
|
2843
|
-
},
|
|
2844
|
-
slimList: {
|
|
2845
|
-
paddingTop: "15px",
|
|
2846
|
-
paddingBottom: "13px",
|
|
2847
|
-
height: "auto",
|
|
2848
|
-
paddingLeft: "15px",
|
|
2849
|
-
justifyItems: "center",
|
|
2850
|
-
},
|
|
2851
|
-
activeMenuItem: {
|
|
2852
|
-
backgroundColor: "var(--theme-color1)!important ",
|
|
2853
|
-
"& > div": {
|
|
2854
|
-
color: "var(--white)!important",
|
|
2855
|
-
},
|
|
2856
|
-
"& svg": {
|
|
2857
|
-
color: "var(--theme-color4)",
|
|
2858
|
-
},
|
|
2859
|
-
"& hover": {
|
|
2860
|
-
"& > div": {
|
|
2861
|
-
color: "var(--theme-color3)",
|
|
2862
|
-
},
|
|
2863
|
-
},
|
|
2864
|
-
"& p": {
|
|
2865
|
-
color: "var(--theme-color6)",
|
|
2866
|
-
},
|
|
2867
|
-
},
|
|
2868
|
-
}));
|
|
2869
|
-
|
|
2870
|
-
let localdrawerOpen = true;
|
|
2871
|
-
const SideBarNav = ({ metaData, handleDrawerOpen, drawerOpen, setView, slimSize, setNewFilterData, setNewFilterView, isFromSeparetView = false, rootUrl, dashboardUrl, navigate, }) => {
|
|
2872
|
-
const classes = useStylesSideBar();
|
|
2873
|
-
let result = null;
|
|
2874
|
-
localdrawerOpen = drawerOpen;
|
|
2875
|
-
if (Array.isArray(metaData.navItems)) {
|
|
2876
|
-
result = metaData.navItems.map((one) => {
|
|
2877
|
-
if (one?.seperateView === true) {
|
|
2878
|
-
return (jsx(SeperateListView, { item: one, setView: setView, classes: classes, level: 0, slimSize: slimSize, setNewFilterData: setNewFilterData, setNewFilterView: setNewFilterView }, one.label));
|
|
2879
|
-
}
|
|
2880
|
-
else if (Array.isArray(one.children)) {
|
|
2881
|
-
return (jsx(NestedListItem, { item: one, classes: classes, level: 0, handleDrawerOpen: handleDrawerOpen, drawerOpen: drawerOpen, slimSize: slimSize, rootUrl: rootUrl, dashboardUrl: dashboardUrl, navigate: navigate }, one.label));
|
|
2882
|
-
}
|
|
2883
|
-
else {
|
|
2884
|
-
return (jsx(SingleListItem, { item: one, classes: classes, level: 0, slimSize: slimSize, drawerOpen: drawerOpen, rootUrl: rootUrl, dashboardUrl: dashboardUrl, navigate: navigate }, one.label));
|
|
2885
|
-
}
|
|
2886
|
-
});
|
|
2887
|
-
}
|
|
2888
|
-
return (jsx(List, { component: "nav", disablePadding: true, className: isFromSeparetView ? classes.navLinksforseparateView : classes.navLinks, children: jsx(ScrollBar, { children: result }) }));
|
|
2889
|
-
};
|
|
2890
|
-
const SeperateListView = ({ item, setView, level, classes, slimSize, setNewFilterData, setNewFilterView, }) => {
|
|
2891
|
-
let labelStart = (item.label || "").toLowerCase().substring(0, 1) || "circle";
|
|
2892
|
-
// const icon = item.icon ? (
|
|
2893
|
-
// <ListItemIcon className={classes.listIcon}>
|
|
2894
|
-
// <FontAwesomeIcon icon={["fas", labelStart]} />
|
|
2895
|
-
// </ListItemIcon>
|
|
2896
|
-
// ) : null;
|
|
2897
|
-
const icon = item.icon?.toLowerCase() !== "process.gif" && item.icon ? (jsx(ListItemIcon, { className: classes.listIcon, children: jsx(FontAwesomeIcon, { icon: ["fas", item.icon] }) })) : (jsx(ListItemIcon, { className: classes.listIcon, children: jsx(FontAwesomeIcon, { icon: ["fas", labelStart] }) }));
|
|
2898
|
-
const levelClassName = level === 1
|
|
2899
|
-
? classes.nestedMenuLevel1
|
|
2900
|
-
: level === 2
|
|
2901
|
-
? classes.nestedMenuLevel2
|
|
2902
|
-
: "";
|
|
2903
|
-
return (jsxs(ListItem, { button: true, disableGutters: true, className: clsx({
|
|
2904
|
-
[classes.item]: true,
|
|
2905
|
-
[levelClassName]: Boolean(levelClassName),
|
|
2906
|
-
[classes.slimList]: Boolean(slimSize),
|
|
2907
|
-
[classes.drawerIconSize]: !localdrawerOpen,
|
|
2908
|
-
}), onClick: () => {
|
|
2909
|
-
if (item.viewName === "newfilterview" && Array.isArray(item.children)) {
|
|
2910
|
-
setNewFilterView({
|
|
2911
|
-
label: item.label,
|
|
2912
|
-
placeholder: "Search " + item.label + " Screen...",
|
|
2913
|
-
});
|
|
2914
|
-
let newChield = item.children.map((item1) => {
|
|
2915
|
-
return { ...item1, secondaryLabel: item1.user_code };
|
|
2916
|
-
});
|
|
2917
|
-
setNewFilterData(newChield);
|
|
2918
|
-
}
|
|
2919
|
-
setView(item.viewName);
|
|
2920
|
-
}, children: [jsx(Tooltip, { title: item.label, arrow: true, placement: localdrawerOpen ? "bottom-start" : "right", children: jsx("span", { children: icon }) }), (localdrawerOpen && item.label.length > 27) || !Boolean(icon) ? (jsx(Tooltip, { title: item.label, arrow: true, placement: localdrawerOpen ? "bottom-start" : "right", children: jsx(ListItemText, { primary: item.label, className: classes.link, secondary: item.secondaryLabel ?? null }) })) : localdrawerOpen ? (jsx(ListItemText, { primary: item.label, className: classes.link, secondary: item.secondaryLabel ?? null })) : null] }));
|
|
2921
|
-
};
|
|
2922
|
-
const SingleListItem = ({ item, classes, level, slimSize, drawerOpen, rootUrl, dashboardUrl, navigate, }) => {
|
|
2923
|
-
const isActiveMenu = isActiveMenuFromhref(window.location?.pathname ?? "", item?.href ?? "", item?.navigationProps, rootUrl, dashboardUrl);
|
|
2924
|
-
if (isActiveMenu) {
|
|
2925
|
-
// GeneralAPI.setDocumentName(item.label);
|
|
2926
|
-
let titleText = document.title;
|
|
2927
|
-
document.title = titleText.split(" - ")[0] + " - " + item.label;
|
|
2928
|
-
}
|
|
2929
|
-
let labelStart = (item.label || "").toLowerCase().substring(0, 1) || "circle";
|
|
2930
|
-
const icon = item.icon.toLowerCase() === "process.gif" || !Boolean(item.icon) ? (jsx(ListItemIcon, { className: classes.listIcon, children: jsx(FontAwesomeIcon, { icon: ["fas", labelStart] }) })) : (jsx(ListItemIcon, { className: classes.listIcon, children: jsx(FontAwesomeIcon, { icon: ["fas", item.icon] }) }));
|
|
2931
|
-
const levelClassName = level === 1
|
|
2932
|
-
? classes.nestedMenuLevel1
|
|
2933
|
-
: level === 2
|
|
2934
|
-
? classes.nestedMenuLevel2
|
|
2935
|
-
: "";
|
|
2936
|
-
return (jsxs(ListItem, { button: true, disableGutters: true, className: clsx({
|
|
2937
|
-
[classes.item]: true,
|
|
2938
|
-
[levelClassName]: Boolean(levelClassName),
|
|
2939
|
-
[classes.slimList]: Boolean(slimSize),
|
|
2940
|
-
[classes.activeMenuItem]: isActiveMenu,
|
|
2941
|
-
[classes.drawerIconSize]: !localdrawerOpen,
|
|
2942
|
-
}), onClick: (e) => {
|
|
2943
|
-
e.preventDefault();
|
|
2944
|
-
if (item.isRouterLink) {
|
|
2945
|
-
let path = item.href;
|
|
2946
|
-
path =
|
|
2947
|
-
item.href?.substring(0, 1) === "/"
|
|
2948
|
-
? item.href.substring(1)
|
|
2949
|
-
: item.href;
|
|
2950
|
-
if (item.passNavigationPropsAsURLParmas) {
|
|
2951
|
-
let urlParms = new URLSearchParams(item?.navigationProps);
|
|
2952
|
-
navigate(`${path}?${urlParms.toString()}`);
|
|
2953
|
-
}
|
|
2954
|
-
else {
|
|
2955
|
-
navigate(`${path}`, {
|
|
2956
|
-
state: { ...item?.navigationProps },
|
|
2957
|
-
});
|
|
2958
|
-
}
|
|
2959
|
-
}
|
|
2960
|
-
else if (Boolean(item.href)) {
|
|
2961
|
-
window.open(item.href, item.rel ?? "_newtab");
|
|
2962
|
-
}
|
|
2963
|
-
}, children: [jsx(Tooltip, { title: item.label, arrow: true, placement: localdrawerOpen ? "bottom-start" : "right", children: jsx("span", { children: icon }) }), (localdrawerOpen && item.label.length > 27) || !Boolean(icon) ? (jsx(Tooltip, { title: item.label, arrow: true, placement: localdrawerOpen ? "bottom-start" : "right", children: jsx(ListItemText, { primary: item.label, className: classes.link, secondary: item.secondaryLabel ?? null }) })) : localdrawerOpen ? (jsx(ListItemText, { primary: item.label, className: classes.link, secondary: item.secondaryLabel ?? null })) : null] }));
|
|
2964
|
-
};
|
|
2965
|
-
const NestedListItem = ({ item, classes, level, handleDrawerOpen, drawerOpen, slimSize, rootUrl, navigate, }) => {
|
|
2966
|
-
const [open, setOpen] = useState(false);
|
|
2967
|
-
const handleClick = () => {
|
|
2968
|
-
setOpen(!open);
|
|
2969
|
-
};
|
|
2970
|
-
const childrens = item.children?.map((one) => {
|
|
2971
|
-
if (Array.isArray(one.children)) {
|
|
2972
|
-
return (jsx(NestedListItem, { item: one, classes: classes, level: level + 1, handleDrawerOpen: handleDrawerOpen, drawerOpen: drawerOpen, slimSize: slimSize, rootUrl: rootUrl, navigate: navigate }, one.label));
|
|
2973
|
-
}
|
|
2974
|
-
else {
|
|
2975
|
-
return (jsx(SingleListItem, { item: one, classes: classes, level: level + 1, slimSize: slimSize, rootUrl: rootUrl, navigate: navigate }, one.label));
|
|
2976
|
-
}
|
|
2977
|
-
});
|
|
2978
|
-
let labelStart = (item.label || "").toLowerCase().substring(0, 1) || "circle";
|
|
2979
|
-
const icon = item.icon?.toLowerCase() === "process.gif" || !Boolean(item.icon) ? (jsx(ListItemIcon, { className: classes.listIcon, children: jsx(FontAwesomeIcon, { icon: ["fas", labelStart] }) })) : (jsx(ListItemIcon, { className: classes.listIcon, children: jsx(FontAwesomeIcon, { icon: ["fas", item.icon] }) }));
|
|
2980
|
-
const levelClassName = level === 1
|
|
2981
|
-
? classes.nestedMenuLevel1
|
|
2982
|
-
: level === 2
|
|
2983
|
-
? classes.nestedMenuLevel2
|
|
2984
|
-
: "";
|
|
2985
|
-
return (jsxs(Fragment$1, { children: [jsxs(ListItem, { button: true, onClick: handleClick, disableGutters: true, className: open
|
|
2986
|
-
? clsx({
|
|
2987
|
-
[classes.item]: true,
|
|
2988
|
-
[levelClassName]: Boolean(levelClassName),
|
|
2989
|
-
[classes.slimList]: Boolean(slimSize),
|
|
2990
|
-
[classes.openCurrent]: true,
|
|
2991
|
-
[classes.drawerIconSize]: !localdrawerOpen,
|
|
2992
|
-
})
|
|
2993
|
-
: clsx({
|
|
2994
|
-
[classes.item]: true,
|
|
2995
|
-
[levelClassName]: Boolean(levelClassName),
|
|
2996
|
-
[classes.slimList]: Boolean(slimSize),
|
|
2997
|
-
[classes.drawerIconSize]: !localdrawerOpen,
|
|
2998
|
-
}), children: [jsx(Tooltip, { title: item.label, arrow: true, placement: localdrawerOpen ? "bottom-start" : "right", children: jsx("span", { children: icon }) }), drawerOpen || !Boolean(icon) ? (jsxs(Fragment$1, { children: [jsx(ListItemText, { primary: item.label, secondary: item.secondaryLabel ?? null, color: "primary", className: classes.link }), open ? jsx(ExpandLess, {}) : jsx(ExpandMore, {})] })) : null] }), jsx(Collapse, { in: open, timeout: "auto", unmountOnExit: true, children: jsx(List, { component: "div", disablePadding: true, className: open ? classes.openList : "", children: childrens }) })] }));
|
|
2999
|
-
};
|
|
3000
|
-
const isActiveMenuFromhref = (location, menuhref, navigationProps, rootUrl, dashboardUrl) => {
|
|
3001
|
-
if ((location === `/${rootUrl}` || location === `/${rootUrl}/`) &&
|
|
3002
|
-
menuhref === dashboardUrl) {
|
|
3003
|
-
return true;
|
|
3004
|
-
}
|
|
3005
|
-
else if (menuhref === "report") {
|
|
3006
|
-
try {
|
|
3007
|
-
let urlParms = new URLSearchParams(navigationProps);
|
|
3008
|
-
if ("?" + urlParms.toString() === window.location.search) {
|
|
3009
|
-
return true;
|
|
3010
|
-
}
|
|
3011
|
-
}
|
|
3012
|
-
catch (error) {
|
|
3013
|
-
console.log(error);
|
|
3014
|
-
}
|
|
3015
|
-
return false;
|
|
3016
|
-
}
|
|
3017
|
-
else if (location !== `/${rootUrl}` &&
|
|
3018
|
-
location !== "/" &&
|
|
3019
|
-
Boolean(menuhref) &&
|
|
3020
|
-
location.includes(menuhref)) {
|
|
3021
|
-
return true;
|
|
3022
|
-
}
|
|
3023
|
-
return false;
|
|
3024
|
-
};
|
|
3025
|
-
|
|
3026
|
-
const matchByValue = (search, tags, navItem) => {
|
|
3027
|
-
if (!Array.isArray(tags)) {
|
|
3028
|
-
tags = [tags];
|
|
3029
|
-
}
|
|
3030
|
-
return tags.some((one) => navItem[one]
|
|
3031
|
-
?.toLocaleLowerCase?.()
|
|
3032
|
-
?.includes(search?.toLocaleLowerCase?.()));
|
|
3033
|
-
};
|
|
3034
|
-
const filterMetaDataByValue = (searchString, navItems, tagsToSearch) => {
|
|
3035
|
-
let newNavItems = [];
|
|
3036
|
-
for (let i = 0; i < navItems.length; i++) {
|
|
3037
|
-
if (matchByValue(searchString, tagsToSearch, navItems[i])) {
|
|
3038
|
-
let { children, ...newItem } = navItems[i];
|
|
3039
|
-
if (Array.isArray(children) && children.length > 0) {
|
|
3040
|
-
let newChildren = filterMetaDataByValue(searchString, children, tagsToSearch);
|
|
3041
|
-
if (newChildren.length > 0) {
|
|
3042
|
-
newNavItems.push({ ...newItem, children: newChildren });
|
|
3043
|
-
}
|
|
3044
|
-
}
|
|
3045
|
-
else {
|
|
3046
|
-
newNavItems.push({ ...newItem });
|
|
3047
|
-
}
|
|
3048
|
-
}
|
|
3049
|
-
}
|
|
3050
|
-
return newNavItems;
|
|
3051
|
-
};
|
|
3052
|
-
|
|
3053
|
-
const SearchViewNavigation = ({ metaData, handleDrawerOpen, drawerOpen, setView, label, icon, placeholder = "Search Reports...", rootUrl, dashboardUrl, navigate, }) => {
|
|
3054
|
-
const [search, setSearch] = useState("");
|
|
3055
|
-
const filteredMetaData = useMemo(() => {
|
|
3056
|
-
return filterMetaDataByValue(search, metaData.navItems, [
|
|
3057
|
-
"label",
|
|
3058
|
-
"secondaryLabel",
|
|
3059
|
-
]);
|
|
3060
|
-
}, [search, metaData.navItems]);
|
|
3061
|
-
const classes = useStylesSideBar();
|
|
3062
|
-
const myIcon = icon ? (jsx(ListItemIcon, { className: classes.listIcon, children: jsx(ArrowBackIosNewIcon, {}) })) : null;
|
|
3063
|
-
const handleClick = () => {
|
|
3064
|
-
if (!drawerOpen) {
|
|
3065
|
-
handleDrawerOpen();
|
|
3066
|
-
}
|
|
3067
|
-
};
|
|
3068
|
-
return (jsxs("div", { style: { display: "flex", flexDirection: "column" }, children: [jsxs(ListItem, { button: true, className: clsx({
|
|
3069
|
-
[classes.item]: true,
|
|
3070
|
-
[classes.nestedMenuLevel1]: true,
|
|
3071
|
-
[classes.linktext]: true,
|
|
3072
|
-
}), onClick: () => setView("/"), children: [myIcon, jsx(ListItemText, { primary: label, className: classes.link })] }), jsx(SearchBar, { sx: { overflow: "hidden" }, value: search, onChange: (e) => setSearch(e.target.value), onClick: handleClick, placeholder: Boolean(placeholder) ? placeholder : "Search Reports...", autoFocus: drawerOpen }), jsx(SideBarNav, { handleDrawerOpen: handleDrawerOpen, drawerOpen: drawerOpen, setView: setView, metaData: {
|
|
3073
|
-
navItems: filteredMetaData,
|
|
3074
|
-
config: { rel: "", target: "_blank" },
|
|
3075
|
-
}, slimSize: true, isFromSeparetView: true, rootUrl: rootUrl, dashboardUrl: dashboardUrl, navigate: navigate })] }));
|
|
3076
|
-
};
|
|
3077
|
-
|
|
3078
|
-
library.add(faHandsHelping, faUsers, faBars, faBalanceScale, faHandHoldingHeart, faTasks, faCog, faHome, faTh, faUsersCog, faCircle, faUserCircle, faHashtag, faThumbtack, faSquare, faLink, faQuestion, faPlus, faTable, faLocationArrow, faHeadset, faGears, faArrowDown, faArrowUp, faSpinner, faCircleExclamation, faRotateRight, faUserLock, faUserClock, faGripHorizontal, faFileLines, faGear, faHeadphones, faUsersGear, faMessage, faUnlock, faUserPlus, faUserCheck, faKey, faIdCard, faIdBadge, faCheck, faCheckDouble, faCircleCheck, faCircleXmark, faUserTag, faAddressCard, faChartColumn, faUserPen, faHandHolding, faHandHoldingMedical, faObjectGroup, faTowerCell, faTowerObservation, faBuilding, faMailBulk, faLandmarkFlag, faCreditCard, faHospitalSymbol, faPlugCircleBolt, faCodeBranch, faPersonCircleCheck, faBank, faServer, faNotesMedical, faPenToSquare, faBarsProgress, faFileExport, faA, faB, faC, faD, faE, faF, faG, faH, faI, faJ, faK, faL, faM, faN, faO, faP, faQ, faR, faS, faT, faU, faV, faW, faX, faY, faZ);
|
|
3079
|
-
|
|
3080
|
-
const transformMetaDataAsPerRole = (metaData, role, branches, company, access, products) => {
|
|
3081
|
-
let navItems = filterMetaData(metaData.navItems, role, branches, company, access, products);
|
|
3082
|
-
//console.log(navItems);
|
|
3083
|
-
let newnavItem = navItems.map((item) => {
|
|
3084
|
-
let { children, ...newItem } = item;
|
|
3085
|
-
if (Array.isArray(children) && children.length > 5) {
|
|
3086
|
-
if (!Boolean(newItem.seperateView)) {
|
|
3087
|
-
newItem.seperateView = true;
|
|
3088
|
-
newItem.viewName = "newfilterview";
|
|
3089
|
-
//console.log(newItem);
|
|
3090
|
-
}
|
|
3091
|
-
}
|
|
3092
|
-
return { ...newItem, children: children };
|
|
3093
|
-
});
|
|
3094
|
-
return {
|
|
3095
|
-
config: metaData.config,
|
|
3096
|
-
navItems: newnavItem,
|
|
3097
|
-
};
|
|
3098
|
-
};
|
|
3099
|
-
const matchBranches = (userBranches, accessBranches) => {
|
|
3100
|
-
if (!Array.isArray(accessBranches) || !Array.isArray(userBranches)) {
|
|
3101
|
-
return true;
|
|
3102
|
-
}
|
|
3103
|
-
if (accessBranches.length <= 0 || userBranches.length <= 0) {
|
|
3104
|
-
return true;
|
|
3105
|
-
}
|
|
3106
|
-
for (const one of accessBranches) {
|
|
3107
|
-
if (userBranches.indexOf(one) >= 0) {
|
|
3108
|
-
return true;
|
|
3109
|
-
}
|
|
3110
|
-
}
|
|
3111
|
-
return false;
|
|
3112
|
-
};
|
|
3113
|
-
const matchComany = (userCompany, accessCompany) => {
|
|
3114
|
-
if (!Array.isArray(accessCompany) || !Boolean(userCompany)) {
|
|
3115
|
-
return true;
|
|
3116
|
-
}
|
|
3117
|
-
if (accessCompany.length <= 0) {
|
|
3118
|
-
return true;
|
|
3119
|
-
}
|
|
3120
|
-
if (accessCompany.indexOf(userCompany) >= 0) {
|
|
3121
|
-
return true;
|
|
3122
|
-
}
|
|
3123
|
-
return false;
|
|
3124
|
-
};
|
|
3125
|
-
const matchRoles = (userRole, accessRoles) => {
|
|
3126
|
-
if (!Array.isArray(accessRoles) || typeof userRole !== "number") {
|
|
3127
|
-
return true;
|
|
3128
|
-
}
|
|
3129
|
-
if (accessRoles.length <= 0) {
|
|
3130
|
-
return true;
|
|
3131
|
-
}
|
|
3132
|
-
if (accessRoles.indexOf(userRole) >= 0) {
|
|
3133
|
-
return true;
|
|
3134
|
-
}
|
|
3135
|
-
return false;
|
|
3136
|
-
};
|
|
3137
|
-
const matchInvisibleRoles = (userRole, accessRoles) => {
|
|
3138
|
-
if (!Array.isArray(accessRoles) || typeof userRole !== "number") {
|
|
3139
|
-
return true;
|
|
3140
|
-
}
|
|
3141
|
-
if (accessRoles.length <= 0) {
|
|
3142
|
-
return true;
|
|
3143
|
-
}
|
|
3144
|
-
if (accessRoles.indexOf(userRole) >= 0) {
|
|
3145
|
-
return false;
|
|
3146
|
-
}
|
|
3147
|
-
return true;
|
|
3148
|
-
};
|
|
3149
|
-
const matchProducts = (userProducts, accessProducts) => {
|
|
3150
|
-
if (!Array.isArray(accessProducts) || !Array.isArray(userProducts)) {
|
|
3151
|
-
return true;
|
|
3152
|
-
}
|
|
3153
|
-
if (accessProducts.length <= 0 || userProducts.length <= 0) {
|
|
3154
|
-
return true;
|
|
3155
|
-
}
|
|
3156
|
-
for (const one of accessProducts) {
|
|
3157
|
-
if (userProducts.indexOf(one) >= 0) {
|
|
3158
|
-
return true;
|
|
3159
|
-
}
|
|
3160
|
-
}
|
|
3161
|
-
return false;
|
|
3162
|
-
};
|
|
3163
|
-
const ishrefisNotNull = (item) => {
|
|
3164
|
-
if (!(Array.isArray(item.children) && item.children.length > 0) &&
|
|
3165
|
-
!Boolean(item.href)) {
|
|
3166
|
-
//console.log(item);
|
|
3167
|
-
return false;
|
|
3168
|
-
}
|
|
3169
|
-
return true;
|
|
3170
|
-
};
|
|
3171
|
-
const filterMetaData = (navItems, role, branches, company, access, products) => {
|
|
3172
|
-
let newNavItems = [];
|
|
3173
|
-
for (let i = 0; i < navItems.length; i++) {
|
|
3174
|
-
if (matchRoles(Number(role), navItems[i].visibleToRoles) &&
|
|
3175
|
-
matchComany(company, navItems[i].visibleToCompanies) &&
|
|
3176
|
-
matchBranches(branches, navItems[i].visibleToBranches) &&
|
|
3177
|
-
matchInvisibleRoles(Number(role), navItems[i].invisibleToRoles) &&
|
|
3178
|
-
matchProducts(products, navItems[i].visibleToProducts) &&
|
|
3179
|
-
ishrefisNotNull(navItems[i])) {
|
|
3180
|
-
let { children, ...newItem } = navItems[i];
|
|
3181
|
-
if (Array.isArray(children) && children.length > 0) {
|
|
3182
|
-
let newChildren = filterMetaData(children, role, branches, company, access, products);
|
|
3183
|
-
if (newChildren.length > 0) {
|
|
3184
|
-
newNavItems.push({ ...newItem, children: newChildren });
|
|
3185
|
-
}
|
|
3186
|
-
}
|
|
3187
|
-
else {
|
|
3188
|
-
newNavItems.push({ ...newItem, secondaryLabel: newItem.system_code });
|
|
3189
|
-
}
|
|
3190
|
-
}
|
|
3191
|
-
}
|
|
3192
|
-
return newNavItems;
|
|
3193
|
-
};
|
|
3194
|
-
|
|
3195
|
-
/* eslint-disable react-hooks/exhaustive-deps */
|
|
3196
|
-
const SideBar = ({ authState, handleDrawerOpen, open, rootUrl, dashboardUrl = "dashboard", navigate, }) => {
|
|
3197
|
-
const [view, setView] = useState("/");
|
|
3198
|
-
const [NewFilterView, setNewFilterView] = useState({});
|
|
3199
|
-
const [NewFilterData, setNewFilterData] = useState([]);
|
|
3200
|
-
const branches = useMemo(() => {
|
|
3201
|
-
let myBranches = authState?.access?.entities?.Branch ?? [];
|
|
3202
|
-
if (Array.isArray(myBranches) && myBranches.length >= 0) {
|
|
3203
|
-
return myBranches.map((one) => one.branchCode);
|
|
3204
|
-
}
|
|
3205
|
-
else {
|
|
3206
|
-
return [];
|
|
3207
|
-
}
|
|
3208
|
-
}, []);
|
|
3209
|
-
const products = useMemo(() => {
|
|
3210
|
-
let myProducts = authState?.access?.products ?? [];
|
|
3211
|
-
if (Array.isArray(myProducts) && myProducts.length >= 0) {
|
|
3212
|
-
return myProducts.map((one) => one.categoryCode);
|
|
3213
|
-
}
|
|
3214
|
-
else {
|
|
3215
|
-
return [];
|
|
3216
|
-
}
|
|
3217
|
-
}, []);
|
|
3218
|
-
let newMetaData = { navItems: authState.menulistdata };
|
|
3219
|
-
let filteredMetaDataSideBar = transformMetaDataAsPerRole(newMetaData, Number(authState.role), branches, authState.companyID, authState.access, products);
|
|
3220
|
-
let filteredReportsMetaData = transformMetaDataAsPerRole({
|
|
3221
|
-
config: { rel: "", target: "_blank" },
|
|
3222
|
-
navItems: reportMetaData,
|
|
3223
|
-
}, Number(authState.role), branches, authState.companyID, authState.access, products);
|
|
3224
|
-
return view === "report" ? (jsx(SearchViewNavigation, { metaData: filteredReportsMetaData, handleDrawerOpen: handleDrawerOpen, drawerOpen: open, setView: setView, label: "Reports", icon: "table", rootUrl: rootUrl, dashboardUrl: dashboardUrl, navigate: navigate })) : view === "newfilterview" ? (jsx(SearchViewNavigation, { metaData: {
|
|
3225
|
-
config: { rel: "", target: "_blank" },
|
|
3226
|
-
navItems: NewFilterData,
|
|
3227
|
-
}, handleDrawerOpen: handleDrawerOpen, drawerOpen: open, setView: setView, label: NewFilterView?.label ?? "Reports", icon: "table", placeholder: NewFilterView?.placeholder, rootUrl: rootUrl, dashboardUrl: dashboardUrl, navigate: navigate })) : (jsx(Fragment$1, { children: jsx(SideBarNav, { metaData: filteredMetaDataSideBar, handleDrawerOpen: handleDrawerOpen, drawerOpen: open, setView: setView, slimSize: true, setNewFilterData: setNewFilterData, setNewFilterView: setNewFilterView, rootUrl: rootUrl, dashboardUrl: dashboardUrl, navigate: navigate }) }));
|
|
3228
|
-
};
|
|
3229
|
-
|
|
3230
|
-
const SidebarWrapper = (props) => {
|
|
3231
|
-
const classes = useStyles();
|
|
3232
|
-
return (jsxs(Drawer, { variant: "permanent", classes: {
|
|
3233
|
-
paper: clsx(classes.drawerPaper, !props.open && classes.drawerPaperClose),
|
|
3234
|
-
}, open: props.open, children: [jsx("div", { className: classes.toolbarIcon }), jsx(SideBar, { ...props })] }));
|
|
3235
|
-
};
|
|
3236
|
-
|
|
3237
|
-
export { AppbarWrapper, AuthControllerWrapper, BranchSelectionGridWrapper, ForgotPasswordControllerWrapper, SidebarWrapper };
|
|
1
|
+
import"regenerator-runtime/runtime";import"./assets/index~NFLKLAwc.css";import{jsx as e,jsxs as r,Fragment as o}from"react/jsx-runtime";import{TextField as a,GradientButton as t,utilFunction as n,usePopupContext as i,ClearCacheProvider as s,queryClient as l,Alert as d,GridWrapper as c,SearchBar as p}from"@acuteinfo/common-base";import{useState as m,useRef as g,useEffect as u,Fragment as h,useMemo as f,useReducer as w,useCallback as y}from"react";import{makeStyles as x}from"@mui/styles";import b from"@mui/icons-material/Visibility";import v from"@mui/icons-material/VisibilityOff";import{Container as C,Grid as S,InputAdornment as P,IconButton as T,CircularProgress as N,FormHelperText as E,Typography as k,Tooltip as D,tooltipClasses as B,Stack as M,Box as _,Avatar as O,Button as I,alpha as A,AppBar as R,Toolbar as L,List as U,ListItemIcon as F,ListItem as W,ListItemText as V,Collapse as z,Drawer as q}from"@mui/material";import{useTranslation as H}from"react-i18next";import j,{ResendOTP as G}from"otp-input-react";import K from"@mui/material/IconButton";import $ from"clsx";import{useSnackbar as X}from"notistack";import Y from"@mui/icons-material/FingerprintSharp";import"./assets/verify~MOgwPpDY.css";import J from"crypto-js";import"./assets/styles~ILuxAzHT.css";import{useQuery as Q,useMutation as Z}from"react-query";import ee from"./assets/BecomePartnerImg~cwVtJhaB.svg";import re from"./assets/waving-hand~JqQoivUD.png";import{styled as oe}from"@mui/material/styles";import ae from"./assets/profile-default~evuVPsgu.png";import te from"@mui/icons-material/Logout";import ne from"@mui/icons-material/MenuOutlined";import{format as ie}from"date-fns";import{FontAwesomeIcon as se}from"@fortawesome/react-fontawesome";import le from"react-perfect-scrollbar";import{ExpandLess as de,ExpandMore as ce}from"@mui/icons-material";import pe from"@mui/icons-material/ArrowBackIosNew";import{library as me}from"@fortawesome/fontawesome-svg-core";import{faHandsHelping as ge,faUsers as ue,faBars as he,faBalanceScale as fe,faHandHoldingHeart as we,faTasks as ye,faCog as xe,faHome as be,faTh as ve,faUsersCog as Ce,faCircle as Se,faUserCircle as Pe,faHashtag as Te,faThumbtack as Ne,faSquare as Ee,faLink as ke,faQuestion as De,faPlus as Be,faTable as Me,faLocationArrow as _e,faHeadset as Oe,faGears as Ie,faArrowDown as Ae,faArrowUp as Re,faSpinner as Le,faCircleExclamation as Ue,faRotateRight as Fe,faUserLock as We,faUserClock as Ve,faGripHorizontal as ze,faFileLines as qe,faGear as He,faHeadphones as je,faUsersGear as Ge,faMessage as Ke,faUnlock as $e,faUserPlus as Xe,faUserCheck as Ye,faKey as Je,faIdCard as Qe,faIdBadge as Ze,faCheck as er,faCheckDouble as rr,faCircleCheck as or,faCircleXmark as ar,faUserTag as tr,faAddressCard as nr,faChartColumn as ir,faUserPen as sr,faHandHolding as lr,faHandHoldingMedical as dr,faObjectGroup as cr,faTowerCell as pr,faTowerObservation as mr,faBuilding as gr,faMailBulk as ur,faLandmarkFlag as hr,faCreditCard as fr,faHospitalSymbol as wr,faPlugCircleBolt as yr,faCodeBranch as xr,faPersonCircleCheck as br,faBank as vr,faServer as Cr,faNotesMedical as Sr,faPenToSquare as Pr,faBarsProgress as Tr,faFileExport as Nr,faA as Er,faB as kr,faC as Dr,faD as Br,faE as Mr,faF as _r,faG as Or,faH as Ir,faI as Ar,faJ as Rr,faK as Lr,faL as Ur,faM as Fr,faN as Wr,faO as Vr,faP as zr,faQ as qr,faR as Hr,faS as jr,faT as Gr,faU as Kr,faV as $r,faW as Xr,faX as Yr,faY as Jr,faZ as Qr}from"@fortawesome/free-solid-svg-icons";import"lodash";const Zr=x((e=>({wrapper:{minHeight:"100vh",boxShadow:"0 3px 6px rgba(0,0,0,0.03)",background:"var(--white)"},loginEmp:{background:"#fff",padding:e.spacing(2,4),display:"flex",maxWidth:"400px",margin:"auto",boxShadow:"0 0 20px rgba(0,0,0,0.06)",borderRadius:"8px",[e.breakpoints.down("sm")]:{width:"100%"}},formWrap:{marginTop:e.spacing(2)},loginBtn:{minWidth:"100% !important",margin:e.spacing(2,0),fontSize:"1rem",padding:"10px .75rem",background:"rgb(128,0,0)",border:0,color:"#fff !important",fontWeight:600,letterSpacing:"0.02857em",boxShadow:"none",textTransform:"capitalize",alignSelf:"flex-end","&:hover":{background:"#fedad8",boxShadow:"none"}},OTPTimer:{marginTop:"10px",color:e.palette.primary.main,fontWeight:600},resendLink:{marginTop:"10px",cursor:"pointer",color:e.palette.secondary.main,fontWeight:600,fontSize:"0.875 rem"},logo:{marginBottom:e.spacing(1)},loginLeft:{[e.breakpoints.down("sm")]:{display:"none"}},loginRight:{background:"#fff",padding:e.spacing(2,4),display:"flex",maxWidth:"400px",margin:"auto",boxShadow:"0 0 20px rgba(0,0,0,0.06)",borderRadius:"8px",[e.breakpoints.down("sm")]:{width:"100%"},"& img":{alignSelf:"center"}},loginImg:{},verifybutton:{alignSelf:"center",padding:"5px"},otpButtons:{},divflex:{display:"flex"},otpinputpadding:{"& input":{marginRight:"25px !important",border:"1.42444px solid var(--theme-color3)",borderRadius:"10px",width:"45px !important",height:"45px !important",marginBottom:"15px",boxShadow:"0px 5.69775px 11.3955px rgba(66, 99, 199, 0.16)"}},ibtnvisible:{marginBottom:"15px"},btnvisibleoff:{display:"none"},OTPalignName:{display:"flex",alignItems:"center",marginBottom:"12px",color:"#1C1C1C",fonWeight:"400",fontSize:"17px",lineHeight:"33px"},resendOTPalign:{color:"var(--theme-color3)",fonWeight:"400",fontSize:"17px",lineHeight:"33px",margin:"0 auto"},resendbtnLink:{textDecoration:"underline",color:"var(--theme-color3)",cursor:"pointer","&:hover":{textDecoration:"underline",color:"var(--theme-color3)"}},dialogTitleClass:{background:"var(--primary-bg)",padding:"6px 15px !important",margin:"10px",color:"var(--white)",borderRadius:"4px","& h2":{fontWeight:"500 !important"}},lang_svg:{marginRight:"10px",width:"22px",height:"22px"},dialogContent:{padding:"0px 15px","& p":{whiteSpace:"pre-wrap",color:"black",marginTop:"8px",marginBottom:"6px"}},button:{display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"column",margin:"6px",background:"var(--theme-color1)","&:hover":{background:"var(--theme-color1) !important"}}}))),eo=({classes:o,loginState:n,verifyUsernamePassword:i,forgotPasswordEndpoint:s})=>{const[l,d]=m({userName:"",password:""}),[c,p]=m(0),f=Date.now()<c,[,w]=m(),y=g(null),{t:x}=H();u((()=>()=>clearTimeout(y.current)),[]);const E=e=>{const r=e.target.name,o=e.target.value;"userName"===r&&o&&(n.isUsernameError=!1),"password"===r&&o&&(n.isPasswordError=!1),d((e=>({...e,[r]:o})))},k=g(null),D=g(null),B=g(null);return u((()=>{let e;return n.isUsernameError?e=setTimeout((()=>{k?.current?.focus?.()}),1e3):n.isPasswordError&&(e=setTimeout((()=>{D?.current?.focus?.()}),1e3)),()=>{e&&clearTimeout(e)}}),[n.isUsernameError,n.isPasswordError]),u((()=>{let e;return n?.otpmodelClose&&(d((e=>({...e,password:""}))),e=setTimeout((()=>{D?.current?.focus?.()}),1500)),()=>{e&&clearTimeout(e)}}),[n.otpmodelClose]),e(h,{children:e(C,{maxWidth:"xs",children:r(S,{alignItems:"center",style:{paddingTop:"20px"},children:[e("div",{style:{color:"#000000 !important",fontSize:"30px",fontWeight:"600",alignItems:"center",fontStyle:"normal",lineHeight:"150%"},children:e("h3",{children:x("SignIn")})}),e("div",{className:"",style:{color:"#949597",fontSize:"16px",fontWeight:"400",alignItems:"center",fontStyle:"normal",width:"360px"},children:x("SignInWithUserIDandPassword")}),r("div",{className:o.formWrap,children:[e(a,{autoFocus:!0,label:x("UserID"),placeholder:String(x("UserID")),style:{marginTop:"10px",marginBottom:"17px"},fullWidth:!0,type:"text",name:"userName",value:l.userName.trimStart()||"",onChange:E,error:n.isUsernameError,helperText:n.isUsernameError?x(n.userMessageforusername):"",InputLabelProps:{shrink:!0},disabled:n.loading,autoComplete:"off",ref:k,onKeyDown:e=>{"Enter"===e.key&&B?.current?.click?.()},inputProps:{maxLength:"16"}}),e("div",{style:{display:"flex",flexDirection:"row-reverse",marginTop:"8px"},children:e(a,{label:x("Password"),placeholder:String(x("EnterPassword")),InputLabelProps:{shrink:!0},fullWidth:!0,type:f?"text":"password",name:"password",value:l.password,onChange:E,error:n.isPasswordError,helperText:n.isPasswordError?x(n.userMessageforpassword):"",disabled:n.loading,ref:D,onKeyDown:e=>{"Enter"===e.key&&B?.current?.click?.()},InputProps:{endAdornment:e(P,{position:"end",children:e(T,{"aria-label":"toggle password visibility",onClick:()=>{f?f&&p(0):(p(Date.now()+5e3),y.current=setTimeout((()=>w(Date.now())),5e3))},onMouseDown:e=>e.preventDefault(),disabled:n.loading,children:e(f?b:v,{})})})},inputProps:{maxLength:"16"}},"employee")}),e("div",{style:{marginTop:"20px",display:"flex"},children:e("div",{style:{flex:"auto",textAlign:"end"},children:e("a",{href:s??"",style:{color:"var(--theme-color3)"},children:x("ForgotPassword")})})}),e("div",{style:{marginTop:"20px",display:"flex"},children:e("div",{style:{flex:"auto",textAlign:"center",marginTop:"5px",marginBottom:"17px"},children:e(t,{style:{borderRadius:n.loading?"50%":"10px",height:n.loading?"40px":"100%",width:n.loading?"0px":"100%",minWidth:n.loading?"40px":"80px"},fullWidth:!0,disabled:n.loading,onClick:()=>i((l.userName||"").toLowerCase(),l.password),ref:B,endicon:n.loading?void 0:"East",rotateIcon:"scale(1.4) rotateX(360deg)",children:n.loading?e(N,{size:25,thickness:4.6}):x("Next")})})})]})]})})})},ro=({classes:a,OTPResendRequest:n,open:i,handleClose:s,loginState:l,VerifyOTP:d,OTPError:c,setOTPError:p,previousStep:f,setNewRequestID:w=(e=>{}),otpresendCount:y=0,resendFlag:x})=>{const[P,T]=m(""),[k,D]=m(0),B=Date.now()<k,[,M]=m(),_=g(null);u((()=>()=>clearTimeout(_.current)),[]);const[O,I]=m(!1),A=g(null),[R,L]=m(!1),{enqueueSnackbar:U}=X(),{t:F}=H();return u((()=>{l?.otpmodelClose?(p(""),T(""),s("")):Boolean(c)&&T("")}),[l.otpmodelClose,c]),e(h,{children:e(C,{maxWidth:"sm",children:e(S,{alignItems:"center",marginTop:"4em",children:r("div",{style:{},children:[e("div",{style:{color:"#000000",fontSize:"30px",fontWeight:"600",alignItems:"center",fontStyle:"normal",lineHeight:"150%",marginBottom:"10px"},children:"OTP"===l?.authType?F("otp.OTPAuthentication"):"TOTP"===l?.authType?F("otp.TOTPAuthentication"):null}),e("div",{style:{color:"#949597",fontSize:"16px",fontWeight:"400",alignItems:"center",fontStyle:"normal",lineHeight:"33px"},children:"OTP"===l?.authType?F("otp.EnterOTPsentToMobile"):"TOTP"===l?.authType?F("otp.PleaseEnterOTP"):null}),r("div",{className:a.OTPalignName,children:[F("otp.Hello")," ",l?.username?l.username.charAt(0).toUpperCase()+l.username.slice(1):null,"OTP"===l?.authType&&e(G,{onResendClick:async()=>{L(!0);const{status:e,data:r,message:o}=await n(l?.comapanyCD,l?.branchCD,l?.contactUser,x,l?.otpValidFor,l?.username);L(!1),"0"===e?(w(r?.TRAN_CD),I(!1),U(o,{variant:"success"})):U(o,{variant:"error"})},renderButton:o=>{let{remainingTime:t,...n}=o;return R?r("a",{className:$(a.resendbtnLink,!O&&a.btnvisibleoff),style:{cursor:"wait"},children:[F("otp.GetNewOTP")," ",e(N,{size:20,color:"secondary"})]}):e("a",{remainingtime:t,...n,className:$(a.resendbtnLink,!O&&a.btnvisibleoff),children:F("otp.GetNewOTP")})},renderTime:e=>(0===parseInt(e)&&setTimeout((()=>{I(!0)}),700),r("span",{className:$(O&&a.btnvisibleoff),children:[F("otp.OtpExpired")," ",e," ",F("otp.second")]})),maxTime:l?.otpValidFor??60,className:a.resendOTPalign})]}),r("div",{className:a.divflex,onKeyDown:e=>{"Enter"===e.key&&A?.current?.click?.()},children:[e(j,{value:P,onChange:T,autoFocus:!0,OTPLength:6,otpType:"number",disabled:l.otploading||l.loading,secure:!B,className:a.otpinputpadding}),e(K,{"aria-label":"toggle password visibility",onClick:()=>{B?B&&D(0):(D(Date.now()+5e3),_.current=setTimeout((()=>M(Date.now())),5e3))},onMouseDown:e=>e.preventDefault(),disabled:l.otploading,className:a.ibtnvisible,children:e(B?b:v,{})})]}),Boolean(c)?e(E,{style:{color:"red"},children:c}):null,"TOTP"===l?.authType?e("div",{style:{flex:"auto"},children:e("a",{href:"forgot-totp",style:{color:"var(--theme-color3)"},children:"Forgot TOTP"})}):e(o,{}),r("div",{style:{display:"flex",gap:"10px",margin:"42px 0 0 42px",width:"60%"},children:[e(t,{disabled:l.otploading||l.loading,onClick:()=>{f(!1,"")},className:a.otpButtons,textColor:"var(--theme-color3)",sx:{border:"var(--theme-color3) 1px solid",minWidth:"50%",background:"var(--white)",borderRadius:"10px","&:disabled":{color:"var(--theme-color3) !important",opacity:.7},"&:hover":{background:"var(--white) !important","& .MuiSvgIcon-root":{transform:"scale(1.4) rotateX(360deg)",transition:"transform 2s ease-in-out"}}},starticon:"West",children:F("otp.Back")}),e(t,{style:{borderRadius:l.loading?"50%":"10px",height:l.loading?"40px":"100%",width:l.loading?"0px":"100%",minWidth:l.loading?"40px":"80px"},fullWidth:!0,disabled:l.loading,onClick:()=>{!Boolean(P)||P.length<6?p("otp.EnterOTPDigit"):(p(""),d(P))},ref:A,className:a.otpButtons,endicon:l.loading?void 0:"TaskAlt",rotateIcon:"scale(1.4)",children:l.loading?e(N,{size:25,thickness:4.6}):F("otp.VerifyOTP")})]})]})})})})},oo=({classes:o,OTPResendRequest:a,handleClose:n,loginState:i,VerifyOTP:s,OTPError:l,setOTPError:d,resendFlag:c,setNewRequestID:p=(e=>{}),otpresendCount:f=0})=>{const[w,y]=m(""),[x,C]=m(0),P=Date.now()<x,[,T]=m(),k=g(null);u((()=>()=>clearTimeout(k.current)),[]);const[D,B]=m(!1),[M,_]=m(!1),O=g(null),{enqueueSnackbar:I}=X(),{t:A}=H(),R=()=>{d(""),y(""),n()};return u((()=>{i?.otpmodelClose&&R()}),[i.otpmodelClose]),e(h,{children:e(S,{alignItems:"center",children:r("div",{children:[e("div",{style:{color:"#000000",fontSize:"30px",fontWeight:"600",alignItems:"center",fontStyle:"normal",lineHeight:"150%",marginBottom:"10px"},children:A("otp.OTPAuthentication")}),r("div",{className:o.OTPalignName,children:[A("otp.Hello")," ",i?.username?i.username.charAt(0).toUpperCase()+i.username.slice(1):null,i.otploading||f>=3||"TOTP"===i?.auth_type?null:e(G,{onResendClick:async()=>{_(!0);const{status:e,data:r,message:o}=await a(i?.company_ID,i?.branch_cd,i?.contactUser,c,i?.otpValidFor,i?.username);_(!1),"0"===e?(p(r?.TRAN_CD),B(!1),I(o,{variant:"success"})):I(o,{variant:"error"})},renderButton:a=>{let{remainingTime:t,...n}=a;return M?r("a",{className:$(o.resendbtnLink,!D&&o.btnvisibleoff),style:{cursor:"wait"},children:[A("otp.GetNewOTP")," ",e(N,{size:20,color:"secondary"})]}):e("a",{remainingtime:t,...n,className:$(o.resendbtnLink,!D&&o.btnvisibleoff),children:A("otp.GetNewOTP")})},renderTime:e=>(0===parseInt(e)&&setTimeout((()=>{B(!0)}),700),r("span",{className:$(D&&o.btnvisibleoff),children:[A("otp.OtpExpired")," ",e]})),maxTime:i?.otpValidFor??60,className:o.resendOTPalign})]}),r("div",{className:o.divflex,onKeyDown:e=>{"Enter"===e.key&&O?.current?.click?.()},children:[e(j,{value:w,onChange:y,autoFocus:!0,OTPLength:6,otpType:"number",disabled:i.otploading||i.loading,secure:!P,className:o.otpinputpadding}),e(K,{"aria-label":"toggle password visibility",onClick:()=>{P?P&&C(0):(C(Date.now()+5e3),k.current=setTimeout((()=>T(Date.now())),5e3))},onMouseDown:e=>e.preventDefault(),disabled:i.otploading,className:o.ibtnvisible,children:e(P?b:v,{})})]}),Boolean(l)?e(E,{style:{color:"red"},children:l}):null,r("div",{style:{display:"flex",gap:"10px",margin:"42px 0 0 42px",width:"60%"},children:[e(t,{fullWidth:!0,disabled:i.otploading||i.loading,onClick:R,className:o.otpButtons,starticon:"West",textColor:"var(--white) !important",sx:{"&:disabled":{color:"var(-theme-color3) !important"}},rotateIcon:"scale(1.4) rotateX(360deg)",style:{borderRadius:"10px",minWidth:"48%"},children:A("otp.Back")}),e(t,{style:{borderRadius:i.otploading?"50%":"10px",height:i.otploading?"40px":"100%",width:i.otploading?"0px":"100%",minWidth:i.otploading?"40px":"80px"},disabled:i.loading,onClick:()=>{!Boolean(w)||w.length<6?d("otp.EnterOTPDigit"):(d(""),s(w))},ref:O,className:o.otpButtons,children:i.otploading?e(N,{size:25,thickness:4.6}):A("otp.VerifyOTP")})]})]})})})},ao=({classes:a,loginState:n,verifyFinger:i,previousStep:s})=>{const{t:l}=H();return e(h,{children:e(C,{maxWidth:"xs",children:r(S,{alignItems:"center",children:[r("div",{style:{marginRight:"25px",width:"102%"},children:[e("br",{}),e("div",{style:{color:"#000000",fontSize:"34px",fontWeight:"600",alignItems:"center",fontStyle:"normal",lineHeight:"150%",marginBottom:"10px"},children:l("Biometric.BiometrixAuthentication")}),e("div",{style:{color:"#949597",fontSize:"18px",fontWeight:"400",alignItems:"center",fontStyle:"normal",lineHeight:"33px"},children:l("Biometric.Kindlyplaceyoufinger")}),e("br",{}),r(k,{variant:"h5",style:{color:"#000000"},children:[l("otp.Hello")," ","",` ${n?.username?n.username.charAt(0).toUpperCase()+n.username.slice(1):null}`]}),e("br",{}),e("div",{className:n?.isBiometricError?a.eFingerUi:a.fingerUi,children:r("div",{className:"spinner-wrap",children:[e(Y,{sx:{fontSize:"80px",opacity:"0.4",borderRadius:"50%",display:"flex",margin:"0 auto","&:after":{borderBottom:"2px solid #26A456"}},className:n?.isBiometricError?a.FingerIcon:null,color:n?.isBiometricError?"error":"inherit"}),n?.isScanning?r(o,{children:[e("div",{className:"spinner-item",style:{border:n?.isScanning?"1px solid #949597":" 1px solid red"}}),e("div",{className:"spinner-item spinner-item--2",style:{border:n?.isScanning?"1px solid #949597":"1px solid red"}}),e("div",{className:"spinner-item spinner-item--3",style:{border:n?.isScanning?"1px solid #949597":"1px solid red"}})]}):null]})}),e("div",{className:a.biometric,children:r("div",{style:{marginTop:"50px"},children:[e("div",{className:n.isScanning?"progress":"hide",children:e("div",{className:"bar",style:{width:n.isScanning?"30%":"0%"}})}),e("h3",{style:{display:"flex",marginTop:"20px",justifyContent:"space-around",color:n?.isBiometricError?"rgb(255 0 0 / 65%)":"inherit"},children:n?.isBiometricError?n?.userMessage:n?.loading?l("Biometric.Loading"):n?.isScanning?l("Biometric.Scanning"):null})]})})]}),r("div",{style:{display:"flex",justifyContent:"center",margin:"42px 0 0 42px",gap:"10px"},children:[e(t,{fullWidth:!0,disabled:n.loading,onClick:()=>{s(!1,"")},className:a.otpButtons,starticon:"West",rotateIcon:"scale(1.4) rotateX(360deg)",textColor:"var(--theme-color3) !important",style:{border:"var(--theme-color3)1px solid",color:"var(--theme-color3)",background:"var(--white)",borderRadius:"10px",minWidth:"48%"},children:l("otp.Back")}),e(t,{style:{borderRadius:n.loading?"50%":"10px",height:n.loading?"40px":"100%",width:n.loading?"0px":"100%",minWidth:n.loading?"40px":"80px"},disabled:n.loading,onKeyDown:e=>13===e.keyCode&&i,onClick:i,className:a.otpButtons,children:n.loading?e(N,{size:25,thickness:4.6,style:{color:"#fff"}}):l("Biometric.Verify")})]})]})})})},to=async(e,r)=>new Promise(((o,a)=>{"string"==typeof e&&(e=JSON.parse(e)),e.forEach((async(a,t)=>{try{var n={GalleryTemplate:(e=>{var r=J.PBKDF2("SUPERACUTE@MKS","Ivan Medvedev",{keySize:12,iterations:1e3});console.log(r.toString());var o=new J.lib.WordArray.init(r.words,32),a=new J.lib.WordArray.init(r.words.splice(8),16),t=J.AES.decrypt({ciphertext:J.enc.Base64.parse(J.enc.Base64.parse(e).toString(J.enc.Utf8))},o,{iv:a});return console.log("CryptoJS.AES.decrypt",t),t.toString(J.enc.Utf8).split(String.fromCharCode(0)).join("")})(a.IMG_DATA),ProbTemplate:r,BioType:"Iso"},i=JSON.stringify(n);await fetch("http://localhost:8004/mfs100/verify",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:i}).then((e=>e.json())).then((r=>{"0"===r?.ErrorCode&&r.Status?o({status:!0,errorCode:"0",errorMessage:"",isError:!1,sr_cd:a.SR_CD}):e.length!==t+1||o({status:!1,errorCode:r.ErrorCode,errorMessage:r.ErrorMessage,isError:!1})})).catch((e=>{o({status:!1,errorCode:"999",errorMessage:e,isError:!0})}))}catch(e){console.log(e),o({status:!1,errorCode:"999",errorMessage:"Something went wrong!",isError:!0})}}))})),no=(e="")=>{if("string"!=typeof e)return!1;return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)},io=({bannerDetails:a})=>{const[t,i]=m(null),s=g(null),l=Zr(),d=f((()=>a),[]);return u((()=>{if(Boolean(d?.bannerImg))if(no(d?.bannerImg)){let e=n.base64toBlob(d?.bannerImg);s.current="object"==typeof e&&Boolean(e)?URL.createObjectURL(e):"",i(s.current)}else i(d?.bannerImg)}),[d]),e(o,{children:r(S,{item:!0,xs:6,md:6,lg:6,className:l.loginLeft,children:[e(S,{item:!0,xs:12,md:12,lg:12,style:{height:"70vh"},children:e("img",{alt:"",style:{width:"100%",height:"100%",objectFit:"cover",objectPosition:"center"},src:Boolean(t)?t:""})}),e(S,{item:!0,xs:12,md:12,lg:12,style:{height:"30vh",background:"var(--primary-bg)"},children:r(C,{maxWidth:"sm",children:[r("div",{className:"text",style:{color:"white",fontStyle:"normal",fontSize:"31px",paddingTop:"30px"},children:[d?.bannerTitle??"",e("span",{style:{marginLeft:"8px",fontWeight:"900"}})]}),e("div",{style:{lineHeight:"27px",fontSize:"15px",fontWeight:"500px",letterSpacing:"0.02em",color:"#ebedee",maxWidth:"464px"},children:d?.bannerNote??""})]})})]})})},so=({classes:o,ResetPassword:i,open:s,username:l,accessToken:d,tokenType:c,handleClose:p,validatePasswordFn:u})=>{const f=g(null),{enqueueSnackbar:w}=X(),{t:y}=H(),[x,b]=m({userName:l,oldpassword:"",password:"",confirmpassword:""}),[v,P]=m({isError:!1,errorMessage:"",isLoading:!1,isoldPwdError:!1,oldpassworderror:"",isnewpwdError:!1,newpassworderror:"",isconfirmnewpwdError:!1,confirmnewpassworderror:""}),T=e=>{const r=e.target.name;let o=e.target.value;"oldpassword"===r&&Boolean(o)?P((e=>({...e,isoldPwdError:!1}))):"password"===r&&Boolean(o)?P((e=>({...e,isnewpwdError:!1}))):"confirmpassword"===r&&Boolean(o)&&P((e=>({...e,isconfirmnewpwdError:!1}))),b((e=>({...e,[r]:o})))};return e(h,{children:e(C,{maxWidth:"xs",children:r(S,{alignItems:"center",children:[e("div",{style:{color:"#000000 !important",fontSize:"30px",fontWeight:"600",alignItems:"center",fontStyle:"normal"},children:e("h3",{children:"Password Rotation"})}),e("div",{className:"",style:{color:"#949597",fontSize:"18px",fontWeight:"400",alignItems:"center",fontStyle:"normal",width:"360px"},children:"Please Verify OTP"}),r("div",{className:o.formWrap,children:[e(a,{label:"User ID",placeholder:"Enter User ID",fullWidth:!0,type:"text",name:"userName",value:x.userName||"",onChange:T,InputLabelProps:{shrink:!0},disabled:!0,autoComplete:"off",inputProps:{maxLength:16},style:{paddingBottom:"8px"}}),e(a,{autoFocus:!0,label:"Current Password",placeholder:"Enter Current Password",fullWidth:!0,type:"password",name:"oldpassword",value:x.oldpassword||"",onChange:T,error:v.isoldPwdError,helperText:v.isoldPwdError?y(v.oldpassworderror):"",InputLabelProps:{shrink:!0},disabled:v.isLoading,autoComplete:"off",onKeyDown:e=>{"Enter"===e.key&&f?.current?.click?.()},inputProps:{maxLength:16},style:{paddingBottom:"8px"}}),e(a,{label:"New Password",placeholder:"Enter New Password",fullWidth:!0,type:"password",name:"password",value:x.password||"",onChange:T,error:v.isnewpwdError,helperText:v.isnewpwdError?y(v.newpassworderror):"",InputLabelProps:{shrink:!0},disabled:v.isLoading,autoComplete:"off",onKeyDown:e=>{"Enter"===e.key&&f?.current?.click?.()},inputProps:{maxLength:16},style:{paddingBottom:"8px"}}),e(a,{label:"Confirm New Password",placeholder:"Enter confirm new password",fullWidth:!0,type:"password",name:"confirmpassword",value:x.confirmpassword||"",onChange:T,error:v.isconfirmnewpwdError,helperText:v.isconfirmnewpwdError?y(v.confirmnewpassworderror):"",InputLabelProps:{shrink:!0},disabled:v.isLoading,autoComplete:"off",onKeyDown:e=>{"Enter"===e.key&&f?.current?.click?.()},inputProps:{maxLength:16},style:{paddingBottom:"8px"}}),v.isError?e(E,{style:{color:"red"},children:v.errorMessage}):null]}),r("div",{style:{display:"flex",gap:"10px",margin:"20px 0 0 10px",width:"94%"},children:[e(t,{fullWidth:!0,disabled:v.isLoading,onClick:()=>{p("")},className:o.otpButtons,style:{border:"var(--theme-color3)1px solid",color:"var(--theme-color3)",borderRadius:"10px"},children:"Back"}),e(t,{style:{borderRadius:v.isLoading?"50%":"10px",height:v.isLoading?"40px":"100%",width:v.isLoading?"0px":"100%",minWidth:v.isLoading?"40px":"80px"},fullWidth:!0,disabled:v.isLoading,onClick:async()=>{let e=!1,r={isError:!1,errorMessage:"",isLoading:!1,isoldPwdError:!1,oldpassworderror:"",isnewpwdError:!1,newpassworderror:"",isconfirmnewpwdError:!1,confirmnewpassworderror:""};Boolean(x.oldpassword)||(r.isoldPwdError=!0,r.oldpassworderror="Current Password is required.",e=!0);let o=n.ValidatePassword(x.password);if(Boolean(o)&&(r.isnewpwdError=!0,r.newpassworderror=o,e=!0),Boolean(x.oldpassword)&&Boolean(x.password)&&x.oldpassword===x.password&&(r.isnewpwdError=!0,r.newpassworderror="The new password cannot be the same as the old password",e=!0),Boolean(x.confirmpassword)?Boolean(x.password)&&x.password!==x.confirmpassword&&(r.isconfirmnewpwdError=!0,r.confirmnewpassworderror="New Password and Confirm Password did not match",e=!0):(r.isconfirmnewpwdError=!0,r.confirmnewpassworderror="Confirm new password is required.",e=!0),e)return void P(r);P((e=>({...e,isLoading:!0})));const{validateStatus:a,validateData:t}=await u({USER_ID:x.userName,PASSWORD:x.password,SCREEN_REF:"LOGIN"});if(P((e=>({...e,isLoading:!1}))),"0"===a)switch(t?.O_STATUS){case"999":return r.isnewpwdError=!0,r.newpassworderror=t?.O_MESSAGE,void P(r);case"0":let e=await i(x.userName,x.oldpassword,x.password,d,c);P((e=>({...e,isLoading:!0}))),"0"===e.status?(w("Password successfully changed.",{variant:"success"}),p("0"),P((e=>({...e,isLoading:!1})))):P((r=>({...r,isError:!0,errorMessage:e.message})))}},ref:f,className:o.otpButtons,children:v.isLoading?e(N,{size:25,thickness:4.6}):"Update"})]})]})})})},lo={username:"",firstName:"",lastName:"",loading:!1,otploading:!1,isError:!1,isUsernameError:!1,isPasswordError:!1,userMessage:"",OtpuserMessage:"",userMessageforpassword:"",userMessageforusername:"",currentFlow:"username",transactionID:"",comapanyCD:"",branchCD:"",contactUser:"",access_token:"",token_type:"",otpmodelClose:!1,authType:"",isScanning:!1,auth_type:"O",otpValidFor:60},co=(e,r)=>{switch(r.type){case"inititateUserFingerVerification":case"inititateOTPVerification":return{...e,loading:!0,isError:!1,isUsernameError:!1,isPasswordError:!1,isOTPError:!1,isBiometricError:!1,userMessage:""};case"inititateUserFingerScanner":return{...e,isScanning:!0,isBiometricError:!1};case"usernameandpasswordrequired":return{...e,loading:!1,isError:!0,isUsernameError:!0,isPasswordError:!0,otploading:!1,userMessage:r?.payload?.error,userMessageforpassword:r?.payload?.errorPassword,userMessageforusername:r?.payload?.errorUsername,username:"",transactionID:"",comapanyCD:"",branchCD:"",contactUser:""};case"passwordVerificationFailure":return{...e,loading:!1,isError:!0,isUsernameError:!1,isPasswordError:!0,otploading:!1,userMessage:r?.payload?.error,userMessageforpassword:r?.payload?.errorPassword,username:"",transactionID:"",comapanyCD:"",branchCD:""};case"usernameVerificationFailure":return{...e,loading:!1,isError:!0,isUsernameError:!0,isPasswordError:!1,otploading:!1,userMessage:r?.payload?.error,userMessageforusername:r?.payload?.errorUsername,username:"",transactionID:"",comapanyCD:"",branchCD:"",contactUser:""};case"inititatePasswordVerification":return{...e,loading:!0,isError:!1,isUsernameError:!1,isPasswordError:!1,otploading:!1,userMessage:"",userMessageforusername:"",userMessageforpassword:"",username:"",transactionID:"",access_token:"",comapanyCD:"",branchCD:"",contactUser:""};case"passwordRotation":return{...e,loading:!1,username:r?.payload?.username,access_token:r?.payload?.access_token,token_type:r?.payload?.token_type};case"passwordRotationsuccess":return{...e,loading:!1,otpmodelClose:Boolean(r?.payload?.otpmodelclose)};case"passwordVerificationSuccessful":return{...e,loading:!1,otploading:!1,transactionID:r?.payload?.transactionID,comapanyCD:r?.payload?.comapanyCD,branchCD:r?.payload?.branchCD,contactUser:r?.payload?.contactUser,username:r?.payload?.username,auth_type:r?.payload?.auth_type,OtpuserMessage:"",access_token:r?.payload?.access_token,token_type:r?.payload?.token_type,otpmodelClose:!1,currentFlow:"OTP",authType:r?.payload?.authType,auth_data:r?.payload?.auth_data,otpValidFor:r?.payload?.otpValidFor};case"inititatebiometricVerification":return{...e,loading:!0,otploading:!0,OtpuserMessage:"",otpmodelClose:!1};case"biometricVerificationFailure":return{...e,loading:!1,isError:!0,isBiometricError:!0,userMessage:r?.payload?.error,isScanning:!1};case"biometricVerificationSuccessful":return{...e,loading:!1,isError:!1,isBiometricError:!1,state:r.payload,isScanning:!1};case"OTPVerificationComplate":return{...e,loading:!1,otploading:!1,OtpuserMessage:""};case"OTPVerificationFailed":return{...e,loading:!1,otploading:!1,OtpuserMessage:r?.payload?.error,otpmodelClose:Boolean(r?.payload?.otpmodelclose)};case"OTPResendSuccess":return{...e,transactionID:r?.payload?.transactionID};case"backToUsernameVerification":return{...lo,isPasswordError:r?.payload?.isError,userMessageforpassword:r?.payload?.errorMessage};default:return e}},po=({bannerDetails:a,logoUrl:t,logoTitle:s,loginFn:l,veirfyUsernameandPassword:d,validatePasswordFn:c,verifyOTP:p,OTPResendRequest:h,ResetPassword:f,LanguageComponent:y,forgotPasswordEndpoint:x})=>{const b=Zr(),[v,C]=w(co,lo),[P,T]=m(!1),N=g(0),[E,k]=m(null),B=g(null),{t:M}=H(),_=g(1),{MessageBox:O}=i();u((()=>{if(Boolean(t))if(no(t)){let e=n.base64toBlob(t);B.current="object"==typeof e&&Boolean(e)?URL.createObjectURL(e):"",k(B.current)}else k(t)}),[t]);const I=async e=>{if(Boolean(e)&&6===e.toString().length){C({type:"inititateOTPVerification"});const{status:r,data:o,message:a}=await p(v.transactionID,v.username,e,v.access_token,v.token_type,v.authType);"0"===r?(C({type:"OTPVerificationComplate"}),l(o)):C("999"===r?{type:"OTPVerificationFailed",payload:{error:a,otpmodelclose:!0}}:{type:"OTPVerificationFailed",payload:{error:a,otpmodelclose:!1}})}else C({type:"OTPVerificationFailed",payload:{error:"Please enter a 6 digit OTP number"}})},A=(e=!1,r="")=>{C({type:"backToUsernameVerification",payload:{isError:e,errorMessage:r}})};return e(o,{children:r(S,{container:!0,style:{height:"100vh",overflow:"hidden"},children:[e(io,{bannerDetails:a}),r(S,{item:!0,xs:11,md:6,lg:6,sm:6,children:[t?e(S,{container:!0,direction:"row",justifyContent:"flex-end",alignItems:"center",padding:"25px",maxWidth:"210px",ml:"auto",children:e(D,{describeChild:!0,title:s??"",children:e("img",{src:Boolean(E)?E:"",alt:"Logo",width:"100%"})})}):null,y?e(S,{container:!0,direction:"row",justifyContent:"flex-end",alignItems:"center",padding:"0 35px 0 0",maxWidth:"180px",ml:"auto",children:e(y,{})}):null,P?e(so,{classes:b,ResetPassword:f,open:P,username:v.username,accessToken:v.access_token,tokenType:v.token_type,handleClose:e=>{"0"===e&&C({type:"passwordRotationsuccess",payload:{otpmodelclose:!0}}),T(!1)},validatePasswordFn:c}):e(o,{children:"username"===v.currentFlow?e(eo,{classes:b,loginState:v,verifyUsernamePassword:async(e,r)=>{if(Boolean(e)&&Boolean(r)){C({type:"inititatePasswordVerification"});try{const{status:o="",data:a=null,message:t="",responseType:n="",access_token:i=null}=await d(e,r);if("0"===o&&"S"===n)C({type:"passwordRotation",payload:{username:e,access_token:i?.access_token||"",token_type:i?.token_type||""}}),T(!0);else if("0"===o){if(C({type:"passwordVerificationSuccessful",payload:{comapanyCD:a?.BASE_COMP_CD,branchCD:a?.BASE_BRANCH_CD,contactUser:a?.CONTACT2,transactionID:a?.REQUEST_CD,username:e,access_token:i?.access_token,token_type:i?.token_type,authType:a?.AUTH_TYPE,auth_data:a?.AUTH_DATA,otpValidFor:a?.OTP_VALID}}),"0"===a?.STATUS)for(let e=0;e<a?.ALERT_MSG_LIST.length;e++)await O({messageTitle:"Password Alert",message:a?.ALERT_MSG_LIST[e]})}else C({type:"passwordVerificationFailure",payload:{error:t,errorPassword:t}})}catch(e){throw new Error("Error occurred while verifying username and password: "+e)}}else Boolean(e)||Boolean(r)?Boolean(e)?C({type:"passwordVerificationFailure",payload:{error:"PasswordisRequired",errorPassword:"PasswordisRequired"}}):C({type:"usernameVerificationFailure",payload:{error:"UsernameisRequired",errorUsername:"UsernameisRequired"}}):C({type:"usernameandpasswordrequired",payload:{error:"UsernamenandPasswordisRequired",errorUsername:"UsernameisRequired",errorPassword:"PasswordisRequired"}})},forgotPasswordEndpoint:x},"username"):e(o,{children:"OTP"===v.authType?e(ro,{OTPResendRequest:h,classes:b,loginState:v,VerifyOTP:I,previousStep:A,OTPError:M(v?.OtpuserMessage??""),setOTPError:e=>{C({type:"OTPVerificationFailed",payload:{error:e}})},open:!0,handleClose:A,resendFlag:"LOGIN",setNewRequestID:e=>{C({type:"OTPResendSuccess",payload:{transactionID:e}}),_.current=_.current+1},otpresendCount:_.current},"otp"):"TOTP"===v.authType?r(o,{children:[" ",e(oo,{OTPResendRequest:h,classes:b,handleClose:A,loginState:v,VerifyOTP:I,OTPError:v?.OtpuserMessage??"",setOTPError:e=>{C({type:"OTPVerificationFailed",payload:{error:e}})},resendFlag:"LOGIN",setNewRequestID:e=>{C({type:"OTPResendSuccess",payload:{transactionID:e}}),_.current=_.current+1},otpresendCount:_.current},"OTPForm")]}):e(ao,{classes:b,loginState:v,verifyFinger:async()=>{try{C({type:"inititateUserFingerScanner"});const e=await(async()=>{var e=JSON.stringify({Quality:60,TimeOut:10});const r=await fetch("http://localhost:8004/mfs100/capture",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:e});return await r.json()})();if("0"===e?.ErrorCode){C({type:"inititateUserFingerVerification"});const r=await to(v.auth_data,e.IsoTemplate);if(r.isError)C({type:"biometricVerificationFailure",payload:{error:r?.errorMessage??"Something went wrong."}});else{const{status:e,data:o,message:a}=await p(v.transactionID,v.username,String(r?.sr_cd??"0"),v.access_token,v.token_type,v.authType,r.status?"Y":"N");"0"===e&&r.status?(C({type:"biometricVerificationSuccessful"}),l(o)):"0"!==e||r.status?"99"===e?C({type:"biometricVerificationFailure",payload:{error:a??"Finger Not Match.Please Try Again"}}):"999"===e?(C({type:"biometricVerificationFailure",payload:{error:a??"Finger Not Match.Please Try Again"}}),A(!0,a??"Finger Not Match.Please Try Again")):C({type:"biometricVerificationFailure",payload:{error:a??"Finger Not Match.Please Try Again"}}):(N.current=N.current+1,C({type:"biometricVerificationFailure",payload:{error:"Finger Not Match.Please Try Again"}}),N.current>=3&&A(!0,"Finger Not Match.Please Try Again"))}}else C({type:"biometricVerificationFailure",payload:{error:e?.ErrorMessage??M("Biometric.MFS100NotFound")}})}catch(e){C({type:"biometricVerificationFailure",payload:{error:e?.message??M("Biometric.Unknownerroroccured")}})}},previousStep:A},"biometric")})})]})]})})},mo=({classes:n,loginState:i,onSubmit:s,navigate:l,loginPageEndpoint:d})=>{const[c,p]=m({userName:1===i.workingState?i?.username:"",mobileno:"",password:"",confirmpassword:""}),f=g(null),w=g(null),y=g(null),[x,C]=m(0),[S,k]=m(0),D=Date.now()<x,B=Date.now()<S,[,M]=m(),_=g(null);u((()=>()=>clearTimeout(_.current)),[]);const{t:O}=H(),I=e=>{const r=e.target.name;let o=e.target.value;"userName"===r&&o&&(i.isUsernameError=!1),"mobileno"===r&&o&&(o=o.replace(/\D/g,""),Boolean(o)&&(i.isMobileError=!1)),p((e=>({...e,[r]:o})))};return u((()=>{1===i.workingState&&setTimeout((()=>{w?.current?.focus?.()}),2e3)}),[i.workingState]),e(h,{children:r("div",{className:n.formWrap,children:[e(a,{autoFocus:!0,label:O("UserID"),placeholder:String(O("UserID")),fullWidth:!0,type:"text",name:"userName",value:c.userName||"",onChange:I,error:i.isUsernameError,helperText:i.isUsernameError?O(i.userMessageforusername):"",InputLabelProps:{shrink:!0},disabled:!!i.loading||0!==i.workingState,autoComplete:"off",ref:f,inputProps:{maxLength:16},onKeyDown:e=>{"Enter"===e.key&&y?.current?.click?.()},style:{paddingBottom:"8px"}}),0===i.workingState?e(a,{label:O("MobileNo"),placeholder:"Enter Mobile No.",fullWidth:!0,type:"text",name:"mobileno",value:c.mobileno||"",onChange:I,error:i.isMobileError,helperText:i.isMobileError?O(i.userMessageforMobileno):"",InputLabelProps:{shrink:!0},disabled:!!i.loading||0!==i.workingState,autoComplete:"off",onKeyDown:e=>{"Enter"===e.key&&y?.current?.click?.()},inputProps:{maxLength:13},style:{paddingBottom:"8px"}}):null,1===i.workingState?r(o,{children:[e(a,{autoFocus:!0,label:O("Password"),placeholder:"Enter Password",fullWidth:!0,type:D?"text":"password",name:"password",value:c.password||"",onChange:I,error:i.isPasswordError,helperText:i.isPasswordError?O(i.userMessageforPassword):"",InputLabelProps:{shrink:!0},disabled:i.loading,autoComplete:"off",ref:w,onKeyDown:e=>{"Enter"===e.key&&y?.current?.click?.()},InputProps:{endAdornment:e(P,{position:"end",children:e(T,{"aria-label":"toggle password visibility",onClick:()=>{D?D&&C(0):(C(Date.now()+5e3),_.current=setTimeout((()=>M(Date.now())),5e3))},onMouseDown:e=>e.preventDefault(),disabled:i.loading,children:e(D?b:v,{})})})},inputProps:{maxLength:16},style:{paddingBottom:"8px"}}),e(a,{label:O("ConfirmPassword"),placeholder:String(O("EnterConfirmPassword")),fullWidth:!0,type:B?"text":"password",name:"confirmpassword",value:c.confirmpassword||"",onChange:I,error:i.isConfirmPasswordError,helperText:i.isConfirmPasswordError?O(i.userMessageforconfirmPassword):"",InputLabelProps:{shrink:!0},disabled:i.loading,autoComplete:"off",onKeyDown:e=>{"Enter"===e.key&&y?.current?.click?.()},InputProps:{endAdornment:e(P,{position:"end",children:e(T,{"aria-label":"toggle password visibility",onClick:()=>{B?B&&k(0):(k(Date.now()+5e3),_.current=setTimeout((()=>M(Date.now())),5e3))},onMouseDown:e=>e.preventDefault(),disabled:i.loading,children:e(B?b:v,{})})})},inputProps:{maxLength:16},style:{paddingBottom:"8px"}})]}):null,i.isApiError?e(E,{style:{color:"red"},children:i.apierrorMessage}):null,e("div",{style:{marginTop:"20px",display:"flex",flexDirection:"row-reverse"},children:e("div",{style:{flex:"auto",textAlign:"center",marginTop:"5px",marginBottom:"17px"},children:r("div",{children:[e(t,{style:{borderRadius:"10px",marginRight:"5px"},disabled:i.loading,onClick:()=>{l(d)},starticon:"West",rotateIcon:"scale(1.4) rotateX(360deg)",children:O("backtologin")}),e(t,{style:{borderRadius:"10px"},disabled:i.loading,onClick:()=>{s(c,i.workingState)},ref:y,endicon:i.loading?void 0:"East",rotateIcon:"scale(1.4) rotateX(360deg)",children:i.loading?e(N,{size:25,thickness:4.6}):O("Next")})]})})})]})})},go={isUsernameError:!1,userMessageforusername:"",loading:!1,isMobileError:!1,userMessageforMobileno:"",isPasswordError:!1,userMessageforPassword:"",isConfirmPasswordError:!1,userMessageforconfirmPassword:"",workingState:0,isApiError:!1,apierrorMessage:"",otploading:!1,OtpuserMessage:"",otpmodelClose:!1,requestCd:"",username:"",auth_type:"O",transactionID:"",contactUser:""},uo=(e,r)=>{switch(r.type){case"verifyUserNameandMobileNoFailed":return{...e,loading:!1,isUsernameError:r?.payload?.isUsernameError??!1,isMobileError:r?.payload?.isMobileError??!1,userMessageforusername:r?.payload?.userMessageforusername??"",userMessageforMobileno:r?.payload?.userMessageforMobileno??"",isApiError:r?.payload?.isApiError??!1,apierrorMessage:r?.payload?.apierrorMessage??"",requestCd:"",username:"",contactUser:""};case"initverifyUserNameandMobileNo":return{...e,loading:!0,isUsernameError:!1,isMobileError:!1,requestCd:"",username:""};case"verifyUserNameandMobileNoSuccess":return{...e,loading:!1,isUsernameError:!1,isMobileError:!1,workingState:0,isApiError:!1,apierrorMessage:"",requestCd:r?.payload?.requestCd??"",username:r?.payload?.username??"",auth_type:r?.payload?.auth_type,company_ID:r?.payload?.company_ID,branch_cd:r?.payload?.branch_cd,otpValidFor:r?.payload?.otpValidFor,contactUser:r?.payload?.contactUser};case"inititateOTPVerification":return{...e,loading:!1,otploading:!0,OtpuserMessage:"",otpmodelClose:!1};case"OTPVerificationComplate":return{...e,loading:!1,otploading:!1,OtpuserMessage:"",workingState:1,otpmodelClose:Boolean(r?.payload?.otpmodelclose)};case"OTPVerificationFailed":return{...e,otploading:!1,OtpuserMessage:r?.payload?.error,otpmodelClose:Boolean(r?.payload?.otpmodelclose)};case"verifyPasswordFailed":return{...e,loading:!1,isPasswordError:r?.payload?.isPasswordError??!1,isConfirmPasswordError:r?.payload?.isConfirmPasswordError??!1,userMessageforPassword:r?.payload?.userMessageforPassword??"",userMessageforconfirmPassword:r?.payload?.userMessageforconfirmPassword??"",isApiError:!1,apierrorMessage:""};case"initverifyPasswordSetReq":return{...e,loading:!0,isPasswordError:!1,isConfirmPasswordError:!1};case"passwordRegistaredSuccess":return{...e,loading:!1,isPasswordError:!1,isConfirmPasswordError:!1};case"OTPResendSuccess":return{...e,requestCd:r?.payload?.requestCd};default:return e}},ho=({screenFlag:a,updatenewPassword:t,validatePasswordFn:i,veirfyUsernameandMobileNo:s,verifyOTPForPWDReset:l,logoUrl:d,logoTitle:c,LanguageComponent:p,bannerDetails:h,navigate:f,loginPageEndpoint:y})=>{const x=Zr(),[b,v]=w(uo,go),[P,T]=m(!1),{enqueueSnackbar:N}=X(),E=g(1),{t:k}=H(),[B,M]=m(null),_=g(null);u((()=>{if(Boolean(d))if(no(d)){let e=n.base64toBlob(d);_.current="object"==typeof e&&Boolean(e)?URL.createObjectURL(e):"",M(_.current)}else M(d)}),[d]);const O=(e,r)=>{if(0===r){let r={isUsernameError:!1,isMobileError:!1,userMessageforusername:"",userMessageforMobileno:""};return Boolean(e.userName)||(r.isUsernameError=!0,r.userMessageforusername="UsernameisRequired"),Boolean(e.mobileno)?(isNaN(e.mobileno)||10!==e.mobileno.length&&13!==e.mobileno.length)&&(r.isMobileError=!0,r.userMessageforMobileno="Please enter valid Mobile No."):(r.isMobileError=!0,r.userMessageforMobileno="MobileNoisRequired"),v({type:"verifyUserNameandMobileNoFailed",payload:r}),!(r.isMobileError||r.isUsernameError)}if(1===r){let r={isPasswordError:!1,userMessageforPassword:"",isConfirmPasswordError:!1,userMessageforconfirmPassword:""},o=n.ValidatePassword(e.password);return Boolean(o)&&(r.isPasswordError=!0,r.userMessageforPassword=o),Boolean(e.confirmpassword)?Boolean(e.password)&&e.password!==e.confirmpassword&&(r.isConfirmPasswordError=!0,r.userMessageforconfirmPassword="New Password and Confirm Password did not matched"):(r.isConfirmPasswordError=!0,r.userMessageforconfirmPassword="Confirmpasswordisrequired"),v({type:"verifyPasswordFailed",payload:r}),!(r.isConfirmPasswordError||r.isPasswordError)}return!0};return e(o,{children:r(S,{container:!0,style:{height:"100vh",overflow:"hidden"},children:[e(io,{bannerDetails:h}),r(S,{item:!0,xs:6,md:6,lg:6,sm:6,children:[d?e(S,{container:!0,direction:"row",justifyContent:"flex-end",alignItems:"center",padding:"31px",maxWidth:"210px",ml:"auto",children:e(D,{describeChild:!0,title:c??"",children:e("img",{src:Boolean(B)?B:"",alt:"Logo",width:"100%"})})}):null,p?e(S,{container:!0,direction:"row",justifyContent:"flex-end",alignItems:"center",padding:"0 35px 0 0",maxWidth:"180px",ml:"auto",children:e(p,{})}):null,e(C,{maxWidth:"xs",children:r(S,{alignItems:"center",style:{paddingTop:"20px"},children:[e("h2",{style:{margin:"10px 0"},children:1===b.workingState?k("Setnewpassword"):"totp"===a?"Forgot TOTP":k("ForgotPassword")}),P?e(oo,{classes:x,handleClose:()=>{T(!1)},loginState:b,VerifyOTP:async e=>{if(Boolean(e)&&6===e.toString().length){v({type:"inititateOTPVerification"});const{status:r,data:o,message:t}=await l(b?.requestCd,b?.username,e,b?.auth_type,a);"0"===r?"totp"===a?(N(t,{variant:"success"}),f(y)):v({type:"OTPVerificationComplate",payload:{otpmodelclose:!0}}):"99"===r?v({type:"OTPVerificationFailed",payload:{error:t}}):(N(t,{variant:"error"}),f(y))}else v({type:"OTPVerificationFailed",payload:{error:"Please enter a 6 digit OTP number"}})},OTPError:k(b?.OtpuserMessage??""),setOTPError:e=>{v({type:"OTPVerificationFailed",payload:{error:e}})},resendFlag:"FORGET_PW",setNewRequestID:e=>{v({type:"OTPResendSuccess",payload:{requestCd:e}}),E.current=E.current+1},otpresendCount:E.current,OTPResendRequest:void 0}):e(mo,{classes:x,loginState:b,onSubmit:async(e,r)=>{if(O(e,r))if(0===r){v({type:"initverifyUserNameandMobileNo"});const{status:r,data:o,message:t}=await s(e?.userName.toLowerCase(),e?.mobileno,a);"0"===r?(v({type:"verifyUserNameandMobileNoSuccess",payload:{requestCd:String(o?.TRAN_CD??""),username:e?.userName,auth_type:o?.AUTH_TYPE,company_ID:o?.COMP_CD,branch_cd:o?.BRANCH_CD,otpValidFor:o?.OTP_VALID,contactUser:o?.CONTACT2}}),T(!0)):v({type:"verifyUserNameandMobileNoFailed",payload:{isApiError:!0,apierrorMessage:t}})}else if(1===r){v({type:"initverifyPasswordSetReq"});const{validateStatus:r,validateData:o}=await i({USER_ID:e?.userName,PASSWORD:e?.password,SCREEN_REF:"FORGET_PW"});if("0"===r)switch(o?.O_STATUS){case"999":v({type:"verifyPasswordFailed",payload:{isPasswordError:!0,userMessageforPassword:o?.O_MESSAGE,apierrorMessage:o?.O_MESSAGE}});break;case"0":const{status:r,data:a,message:n}=await t(b?.requestCd,b?.username,e?.password);"0"===r?(v({type:"passwordRegistaredSuccess"}),N("Password successfully reset",{variant:"success"}),f(y)):"99"===r?v({type:"verifyPasswordFailed",payload:{isApiError:!0,apierrorMessage:n}}):(N(n,{variant:"error"}),f(y))}else v({type:"verifyPasswordFailed",payload:{isApiError:!0,apierrorMessage:o?.O_MESSAGE}})}},navigate:f,loginPageEndpoint:y})]})})]})]})})},fo={gridConfig:{dense:!0,gridLabel:"Access Branch List",rowIdColumn:"BRANCH_CD",defaultColumnConfig:{width:400,maxWidth:450,minWidth:300},allowColumnReordering:!1,disableSorting:!1,hideHeader:!1,disableGroupBy:!0,enablePagination:!1,containerHeight:{min:"68vh",max:"68vh "},allowFilter:!1,allowColumnHiding:!1,allowRowSelection:!1,isCusrsorFocused:!0,hideFooter:!0},columns:[{accessor:"BRANCH_CD",columnName:"Branch Code",sequence:1,alignment:"left",componentType:"default",width:200,minWidth:140,maxWidth:220},{accessor:"BRANCH_NM",columnName:"Branch Name",sequence:2,alignment:"left",componentType:"default",width:280,minWidth:280,maxWidth:420},{accessor:"DISP_STATUS",columnName:"Status",sequence:3,alignment:"left",componentType:"default",width:200,minWidth:140,maxWidth:220},{accessor:"BEGIN_DATETIME",columnName:"Begin Time",sequence:4,alignment:"left",componentType:"dateTime",width:222,minWidth:140,maxWidth:240},{accessor:"END_DATETIME",columnName:"End Time",sequence:5,alignment:"left",componentType:"dateTime",width:222,minWidth:140,maxWidth:240},{accessor:"DAYEND_STATUS",columnName:"Dayend Status",sequence:6,componentType:"default",isVisible:!1},{accessor:"EOD_RUNNING_STATUS",columnName:"EOD Running Status",sequence:6,componentType:"default",isVisible:!1},{accessor:"BASE_COMP_CD",columnName:"Base Comp Cd",sequence:6,componentType:"default",isVisible:!1},{accessor:"BASE_BRANCH_CD",columnName:"Base Branch Cd",sequence:6,componentType:"default",isVisible:!1},{accessor:"COMP_CD",columnName:"Comp Cd",sequence:6,componentType:"default",isVisible:!1},{accessor:"COMP_NM",columnName:"Comp Name",sequence:6,componentType:"default",isVisible:!1}]},wo=x((e=>({heading_user_img:{width:"40px",height:"40px"},heading_user_img_border:{border:"2px dashed var(--theme-color3)",borderRadius:"50%",padding:"4px"},logo:{height:"38px"}}))),yo=[{actionName:"back",actionLabel:"Back",multiple:!1,rowDoubleClick:!1,actionTextColor:"var(--theme-color3)",actionBackground:"var(--white)",startsIcon:"West",rotateIcon:"scale(1.4) rotateX(-360deg)"},{actionName:"proceed",actionLabel:"Proceed",multiple:!1,rowDoubleClick:!0,actionTextColor:"var(--white)",actionBackground:"var(--theme-color3)",onEnterSubmit:!0,endsIcon:"East",rotateIcon:"scale(1.4) rotateX(-360deg)"}],xo=({selectionMode:a,authState:t,isBranchSelectedFn:n,isLoggedInFn:i,logoutFn:s,logos:p,logo:m,navigate:g,BranchSelectionGridDataApiFn:f,GetMenuDataApiFn:w,sideImage:x,branchSelectFn:b,dashboardUrl:v,loginUrl:C,appTranCd:P})=>{const T=wo(),{enqueueSnackbar:N}=X(),{data:E,isLoading:k,isFetching:A,error:R,isError:L}=Q(["BranchSelectionGridData"],(()=>f()));u((()=>()=>{l.removeQueries(["BranchSelectionGridData",{}])}),[]),u((()=>{i()?n()&&"C"!==a&&g(v):g(C)}),[n,i]);const U=Z(w,{onSuccess:(e,r)=>{b({menulistdata:e,branchCode:r?.BRANCH_CD,branch:r?.BRANCH_NM,baseBranchCode:r?.BASE_BRANCH_CD})}}),F=U.error,W=y((e=>{"proceed"===e.name?0===e.rows?.length?N("Please Select Branch",{variant:"error"}):"C"===e.rows?.[0]?.data?.STATUS?N("Branch is in Day End Status.~rPlease contact system Vendor.",{variant:"error"}):U.mutate({BASE_COMP_CD:e.rows?.[0]?.data?.BASE_COMP_CD??"",BASE_BRANCH_CD:e.rows?.[0]?.data?.BASE_BRANCH_CD??"",COMP_CD:e.rows?.[0]?.data?.COMP_CD??"",BRANCH_CD:e.rows?.[0]?.data?.BRANCH_CD??"",GROUP_NAME:t?.groupName??"",APP_TRAN_CD:P,COMP_NM:e.rows?.[0]?.data?.COMP_NM??"",BRANCH_NM:e.rows?.[0]?.data?.BRANCH_NM??"",DAYEND_STATUS:e.rows?.[0]?.data?.DAYEND_STATUS??"",EOD_RUNNING_STATUS:e.rows?.[0]?.data?.EOD_RUNNING_STATUS??"",IS_UPD_DEF_BRANCH:t?.user?.isUpdDefBranch??"",COMP_BASE_BRANCH_CD:e.rows?.[0]?.data?.COMP_BASE_BRANCH_CD??"",selectionMode:a}):"back"===e.name&&("C"===a?g(v,{replace:!0}):s())}),[g,E,U]);u((()=>{var e=E?.some((e=>"O"===e.STATUS));!1===e&&(N("Branch is in Day End Status.~rPlease contact system Vendor.",{variant:"error"}),s()),1===E?.length&&"O"===E?.[0]?.STATUS&&W({name:"proceed",rows:[{data:{...E[0]}}]})}),[JSON.stringify(E)]);const V=oe((({className:r,...o})=>e(D,{...o,classes:{popper:r}})))((({theme:e})=>({[`& .${B.tooltip}`]:{backgroundColor:e.palette.common.white,color:"rgba(0, 0, 0, 0.87)",boxShadow:e.shadows[1],fontSize:13}})));return e(o,{children:r(S,{container:!0,style:{margin:"0",padding:"0",height:"100vh"},children:[x?e(S,{item:!0,lg:1,md:1,xl:1,xs:1,sm:1,children:e("img",{className:"sideImage",src:x,alt:"side-Image"})}):null,e(S,{item:!0,lg:11,md:11,xl:11,xs:11,style:{display:"flex",justifyContent:"center"},children:r(S,{container:!0,style:{minHeight:"100vh",padding:"10px 0px 0px 0px"},lg:11,md:11,xl:11,xs:11,children:[r(S,{container:!0,style:{margin:"0",padding:"0"},lg:12,md:12,xl:12,xs:12,children:[e(S,{xs:12,sm:1,md:1,lg:1,xl:1,sx:{display:"flex",alignItems:"center"},children:e(M,{direction:"row",spacing:4,ml:1,children:e(_,{className:T.heading_user_img_border,sx:{cursor:"pointer"},children:e(V,{title:r(o,{children:[r("div",{children:["User ID : ",t?.user?.id??""]}),r("div",{children:["Role : ",t?.roleName??""]}),e("div",{children:'Last Unsuccessful Login : ""'})]}),placement:"bottom-start",children:e(O,{className:T.heading_user_img,alt:"Remy Sharp",src:Boolean(p?.profile)?p?.profile:ae})})})})}),r(S,{xs:12,sm:5,md:5,lg:5,xl:5,sx:{justifyContent:"center",display:"flex",flexDirection:"column"},children:[r("h1",{className:"name-heading",style:{fontSize:"24px",margin:"4px 0px"},children:["Welcome ",e("span",{children:`${t?.user?.name??""},`})]}),r("div",{style:{display:"flex",alignItems:"center",gap:10},children:[e("h3",{style:{margin:"4px 0px"},children:(()=>{let e,o=(new Date).getHours();return o<12?e="morning":o>=12&&o<=16?e="afternoon":o>=16&&o<=24&&(e="evening"),r("span",{children:["Good ",e,","]})})()}),e("img",{src:re,alt:"",style:{height:"18px"}})]})]}),e(S,{xs:12,sm:1,md:1,lg:1,xl:1,sx:{display:"flex",justifyContent:"center",alignItems:"center"},children:e(M,{direction:"row",justifyContent:"flex-start",spacing:2,children:e(_,{className:T.heading_user_img_border,children:e(O,{className:T.heading_user_img,alt:"Remy Sharp",src:Boolean(p?.bank)?p?.bank:ee})})})}),r(S,{xs:12,sm:3,md:3,lg:3,xl:3,sx:{display:"flex",flexDirection:"column",justifyContent:"center"},children:[e("div",{className:"bank-name-container",style:{fontSize:"14px"},children:e("p",{className:"bank-name",children:`Bank Name: ${t?.companyName??""}`})}),e("p",{className:"emp-id",children:`Emp. Id: ${t?.user?.employeeID??""}`})]}),r(S,{xs:12,sm:3,md:3,lg:2,xl:2,sx:{display:"flex",alignItems:"center",justifyContent:"right"},children:[" ",e("div",{children:e("img",{src:Boolean(p?.logo)?p?.logo:m,alt:"bank_logo",className:T.logo})})]})]}),L?e(h,{children:e("div",{style:{width:"100%",paddingTop:"10px"},children:e(d,{severity:R?.severity??"error",errorMsg:R?.error_msg??"Error",errorDetail:R?.error_detail??""})})}):U.isError&&U.error?e(h,{children:e("div",{style:{width:"100%",paddingTop:"10px"},children:e(d,{severity:F.severity??"error",errorMsg:F.error_msg??"Error",errorDetail:F.error_detail??""})})}):null,e(c,{finalMetaData:fo,data:E??[],setData:()=>null,actions:yo,setAction:W,controlsAtBottom:!0,actionContextAtBottom:!0,headerToolbarStyle:{background:"#fff !important",padding:"0","& .MuiTypography-root":{color:"black"}},disableMultipleRowSelect:!0,variant:"outlined",loading:k||A||U.isLoading,defaultSelectedRowId:t?.user?.branchCode??null},"branchSelection"),L||0===E?.length?e(I,{sx:{backgroundColor:"var(--theme-color3)",position:"absolute",right:"113px",bottom:"20px",width:"7rem","&:hover":{backgroundColor:"var(--theme-color3)"}},onClick:()=>{"C"===a?g(v,{replace:!0}):s()},children:"Back"}):null]})})]})})},bo=r=>e(s,{children:e(xo,{...r})}),vo=x((e=>({appBar:{transition:e.transitions.create(["width","margin"],{easing:e.transitions.easing.sharp,duration:e.transitions.duration.leavingScreen}),color:"#0063A3",height:"80px",background:"var(--white)",boxShadow:"0px 1px 0px -0.5px #DEE0E2"},searchBar:{width:290,border:"none",color:"rgba(0, 0, 0, 0.87) !important",backgroundColor:"rgb(235 237 238 / 26%)!important","& input":{width:"100% !important"}},searchList:{position:"absolute",background:"#fff",width:"100%",borderRadius:"6px",boxShadow:"0 12px 25px rgba(0,0,0,.3)",top:"120%",height:"auto",maxHeight:"325px",overflowY:"auto","& .list-links":{background:"none",border:"none",outline:"none",cursor:"pointer",textDecoration:"none",padding:"0.7rem 1rem",fontSize:"0.90rem",textAlign:"left",borderBottom:"1px solid #ddd",color:"#222 !important",fontWeight:500,"&:hover, &.active":{backgroundColor:"#f4f4f4"}}},appBarShift:{paddingLeft:"0px",transition:e.transitions.create(["width","margin"],{easing:e.transitions.easing.sharp,duration:e.transitions.duration.enteringScreen,background:"rgba(250, 251, 255, 0.9)"})},heading_user_dtl:{width:"458px",height:"73px",left:"37px",top:"calc(50% - 73px/2)"},heading_user_img:{width:"40px",height:"40px"},heading_user_img_border:{border:"2px dashed var(--theme-color3)",borderRadius:"50%",padding:"4px"},toolbar:{minHeight:"80px",paddingLeft:"0px",height:"80px"},title:{flexGrow:1,padding:e.spacing(.5,0),color:"var(--theme-color1)"},searchRoot:{fontFamily:e.typography.fontFamily,position:"relative",boxShadow:"0px 2px 4px -1px rgba(0,0,0,0.2), 0px 4px 5px 0px rgba(0,0,0,0.14), 0px 1px 10px 0px rgba(0,0,0,0.12)",marginRight:e.spacing(2),marginLeft:e.spacing(1),marginBottom:e.spacing(.25),marginTop:e.spacing(.25),borderRadius:40,backgroundColor:A(e.palette.common.white,.15),"&:hover":{backgroundColor:A(e.palette.common.white,.25)},"& $inputInput":{transition:e.transitions.create("width"),width:120,"&:focus":{width:170}}},search:{width:e.spacing(6),height:"100%",position:"absolute",pointerEvents:"none",display:"flex",alignItems:"center",justifyContent:"center"},inputRoot:{color:"inherit",marginTop:0,borderRadius:"40px"},inputInput:{padding:e.spacing(1,1,1,6)},loggedInUser:{marginLeft:e.spacing(2)},nameClass:{color:"#0063A3",fontWeight:600,textTransform:"capitalize",lineHeight:"1.4",textAlign:"left"},dropDown:{fontSize:"2rem"},vTop:{verticalAlign:"top",paddingLeft:"4px",color:"var(--theme-color1)"},userDesignation:{margin:"0px",fontWeight:500,fontSize:"0.875rem",lineHeight:1.57,color:"var(--theme-color1)"},userName:{margin:"0px",fontWeight:500,fontSize:"0.875rem",lineHeight:1.57,color:"var(--theme-color3)"},userprofilehover:{"&:hover":{backgroundColor:"var(--white)"}},lang_svg:{marginRight:"10px",width:"22px",height:"22px"},logo:{height:"38px"},version01:{margin:"0",textAlign:"center",color:"var(--theme-color3)",fontSize:"9px"},DrawerClose_icon:{color:"var(--theme-color3)",position:"static",background:"transperant","&:hover":{background:"var(--theme-color4)"},width:"46px",height:"46px"},marquee:{animation:"$marquee 10s linear infinite",animationDelay:"3s"},"@keyframes marquee":{"0%":{transform:"translateX(100%)"},"100%":{transform:"translateX(-100%)"}},popover:{popover:{maxWidth:"100%",width:"fit-content","& .MuiPopover-paper":{maxWidth:"100%"}}}}))),Co=({handleDrawerOpen:a,handleDrawerClose:t,open:n,authState:i,LanguageComponent:s,SearchComponent:l,dashboardUrl:d,logos:c,bankLogo:p,profilePic:m,handleLogout:g,handleProfile:u,navigate:h,hideGreetings:f,menuIconPosition:w="left"})=>{const y=vo(),{t:x}=H(),b=oe((({className:r,...o})=>e(D,{...o,classes:{popper:r}})))((({theme:e})=>({[`& .${B.tooltip}`]:{backgroundColor:e.palette.common.white,color:"rgba(0, 0, 0, 0.87)",boxShadow:e.shadows[1],fontSize:13}})));return e(R,{position:"fixed",elevation:0,className:$(y.appBar,n&&y.appBarShift),children:r(L,{className:y.toolbar,children:[r(_,{sx:{display:"flex",justifyContent:"space-evenly",alignItems:"center",height:"80px",width:"227px",flexDirection:"right"===w?"row-reverse":"row"},children:[e(K,n?{disableRipple:!0,onClick:()=>t(),className:y.DrawerClose_icon,children:e(ne,{fontSize:"large"})}:{disableRipple:!0,"aria-label":"open drawer",onClick:()=>a(),className:y.DrawerClose_icon,children:e(ne,{fontSize:"large"})}),r("div",{children:[e("img",{src:Boolean(c?.logo)?c?.logo:p,alt:"bank_logo",className:y.logo,onClick:e=>{e.preventDefault(),h(d??"./dashboard")}}),e("p",{className:y.version01,children:c?.version})]})]}),e(M,{direction:"row",spacing:4,mx:2,children:e(_,{className:y.heading_user_img_border,children:e(O,{className:y.heading_user_img,alt:"Remy Sharp",src:Boolean(c?.bank)?c?.bank:ee})})}),r(k,{component:"h1",variant:"h6",color:"inherit",noWrap:!0,className:y.title,children:[e(_,{style:{marginBottom:"8px",fontSize:"17px",color:"var(--theme-color1)",width:"555px"},className:$({[y.marquee]:i?.companyName.length>55}),children:i?.companyName||""}),e("div",{style:{display:"flex",gap:"8px"},children:r("div",{style:{color:"var(--theme-color6)"},children:[r(k,{variant:"caption",display:"block",lineHeight:0,fontSize:"11px",children:[x("appBar.Branch"),":",i?.user?.branchCode??"001 ","-",i?.user?.branch??""]}),r(k,{variant:"caption",display:"inline",fontSize:"11px",children:[x("appBar.WorkingDate"),":"," ",Boolean(i?.workingDate)?So(ie(new Date(i?.workingDate),"dd/MM/yyyy")):"not found"]}),r(k,{marginLeft:1,variant:"caption",display:"inline",fontSize:"11px",children:[x("appBar.LastLoginDate")," :"," ",So(i?.user?.lastLogin??"Vastrapur")]})]})})]}),r(_,{children:[f?null:e(_,{sx:{marginBottom:"3px",paddingRight:"15px"},children:r(M,{direction:"row",spacing:2,justifyContent:"flex-end",alignItems:"center",children:[r(k,{fontSize:"17px",color:"#1C1C1C",children:[(()=>{let e,o=(new Date).getHours();return o<12?e="morning":o>=12&&o<=16?e="afternoon":o>=16&&o<=24&&(e="evening"),r("span",{children:["Good ",e,","]})})()," ",i?.user?.id??""]}),e("img",{src:re,alt:"",style:{height:"18px"}})]})}),r(_,{display:"flex",justifyContent:"space-evenly",alignItems:"center",children:[l?e(l,{}):null,s?e(s,{}):null,e(_,{maxWidth:170,display:"flex",justifyContent:"end",children:e(D,{title:"Logout",placement:"bottom",arrow:!0,children:e(K,{onClick:()=>"function"==typeof g?g():null,color:"error",sx:{backgroundColor:"rgba(235, 237, 238, 0.45)",borderRadius:"10px",height:"30px",width:"30px","&:hover":{background:"var(--white)",borderRadius:"10px",transition:"all 0.2s ease 0s",boxShadow:"rgba(0, 0, 0, 0.16) 0px 3px 6px, rgba(0, 0, 0, 0.23) 0px 3px 6px","& .MuiSvgIcon-root":{height:"32px",width:"32px",transition:"all 0.2s ease 0s",padding:"4px"}}},"aria-label":"show 4 new mails",children:e(te,{})})})})]})]}),e(M,{direction:"row",spacing:4,ml:1,children:e(_,{className:y.heading_user_img_border,sx:{cursor:"pointer"},children:e(b,{title:r(o,{children:[r("div",{children:[" ",x("appBar.UserID"),": ",i?.user?.id]}),r("div",{children:[x("appBar.Role")," : ",i?.roleName]}),r("div",{children:[x("appBar.LastUnsuccessfulLogin"),' : ""']})]}),placement:"bottom-start",children:e(O,{className:y.heading_user_img,onClick:()=>"function"==typeof u?u():null,alt:"Remy Sharp",src:m??""})})})})]})})},So=e=>Boolean(e)?e:"N/A",Po=x((e=>({drawerPaper:{position:"relative",whiteSpace:"nowrap",width:227,transition:e.transitions.create("width",{easing:e.transitions.easing.sharp,duration:e.transitions.duration.enteringScreen}),border:"none",overflow:"hidden",zIndex:120},drawerPaperClose:{overflowX:"hidden",transition:e.transitions.create("width",{easing:e.transitions.easing.sharp,duration:e.transitions.duration.leavingScreen}),width:e.spacing(8),[e.breakpoints.up("sm")]:{width:e.spacing(8)}},toolbarIcon:{display:"flex",alignItems:"center",zIndex:9999,...e.mixins.toolbar,background:"var(--white)",justifyContent:"center",height:"80px"},hrCSS:{zIndex:9999},buttonLink:{backgroundColor:"transparent",border:"none",cursor:"pointer",textDecoration:"underline",display:"inline",margin:0,padding:0,"&:focus":{textDecoration:"none"},"$:hover":{textDecoration:"none"}}}))),To=[];x((e=>({navBarCSS:{padding:"4px 1rem ",backgroundColor:"#fff !important",minHeight:"64px",boxShadow:"0 3px 6px rgba(0,0,0,0.03)",margin:"10px"},headerDropdown:{backgroundColor:"#fff",minWidth:"205px",boxShadow:"0 3px 6px rgba(0,0,0,0.16)",textDecoration:"none",borderBottom:"3px solid #26A456"},navLinkHeader:{color:"#555",fontSize:"14px",lineHeight:"1.2",paddingTop:"4px",paddingBottom:"4px",paddingRight:".5rem",paddingLeft:".5rem",fontWeight:600,textTransform:"capitalize",display:"flex",alignItems:"center",cursor:"pointer","& hover":{color:"#0b6fb8"}},productLink:{color:"#555",padding:"0 1rem 8px 1rem",display:"inline-block",verticalAlign:"middle",cursor:"pointer",textTransform:"capitalize"},font13:{fontSize:"13px"},loginDropdown:{width:"160px"}})));const No=x((e=>({root:{justifyContent:"center"},drawer:{margin:"5px"},item:{display:"flex",borderRadius:"8px",marginLeft:"7px",marginTop:"6.5px",width:"90%",height:"50px",paddingLeft:e.spacing(2),paddingRight:e.spacing(2),background:"var(--white)",boxShadow:"3px 6px 9px rgba(93, 95, 121, 0.26)","& svg":{color:"var(--theme-color1)"},"&:hover":{boxShadow:"6px 6px 1px -1px rgba(0,0,0,0.2), 0px 1px 1px 0px rgba(0,0,0,0.14), 0px 1px 0px 0px rgba(0,0,5,0.12)",background:"var(--theme-color4)",transition:"0.6s ease"}},drawerIconSize:{width:"50px",height:"50px",padding:"18px",justifyItems:"cenetr"},button:{color:"#0063A3",padding:"10px 8px",textTransform:"none",letterSpacing:0,width:"100%",textAlign:"left","&:hover":{backgroundColor:"var(--theme-color1)"}},btnRoot:{paddingLeft:"24px",justifyContent:"left "},navLinks:{overflowY:"auto",overflowX:"hidden",backgroundColor:"rgba(250, 251, 255, 0.9);",borderRadius:"10px",paddingTop:"5px"},navLinksforseparateView:{overflowY:"auto",overflowX:"hidden",height:"calc(100vh - 180px)",paddingTop:"10px"},nestedMenuLevel1:{paddingLeft:"20px",marginTop:"11px",paddingRight:e.spacing(3),height:"auto",fontSize:"13px","& div > svg":{fontSize:"14px"}},nestedMenuLevel2:{paddingLeft:"20px",marginTop:"11px",fontSize:"12px","& div > svg":{fontSize:"9px"}},listIcon:{minWidth:"30px !important",justifyItems:"center",color:"var(--theme-color6)",fontWeight:700,fontSize:"18px"},link:{fontSize:"1rem ",marginTop:"2px",marginBottom:"2px",textOverflow:"ellipsis",color:"var(--theme-color1)",marginLeft:"15px",whiteSpace:"break-spaces","& span":{fontWeight:400,whiteSpace:"break-spaces"},"& p":{color:"var(--theme-color3)",fontweight:400}},linktext:{backgroundColor:"var(--white)","&:hover":{background:"var(--theme-color1)","& div":{color:"var(--white) !important"},"& div > svg":{color:"var(--white) !important"}}},faSmall:{fontSize:"13px "},openList:{":not(activeMenuItem)":{"& > div":{backgroundColor:"rgba(0, 0, 0, 0.04)"},"& *":{color:"var(--white)"}}},openCurrent:{backgroundColor:"var(--theme-color1)","& *":{color:"var(--white)"},"&:hover":{backgroundColor:"var(--theme-color1)"}},slimList:{paddingTop:"15px",paddingBottom:"13px",height:"auto",paddingLeft:"15px",justifyItems:"center"},activeMenuItem:{backgroundColor:"var(--theme-color1)!important ","& > div":{color:"var(--white)!important"},"& svg":{color:"var(--theme-color4)"},"& hover":{"& > div":{color:"var(--theme-color3)"}},"& p":{color:"var(--theme-color6)"}}})));let Eo=!0;const ko=({metaData:r,handleDrawerOpen:o,drawerOpen:a,setView:t,slimSize:n,setNewFilterData:i,setNewFilterView:s,isFromSeparetView:l=!1,rootUrl:d,dashboardUrl:c,navigate:p})=>{const m=No();let g=null;return Eo=a,Array.isArray(r.navItems)&&(g=r.navItems.map((r=>!0===r?.seperateView?e(Do,{item:r,setView:t,classes:m,level:0,slimSize:n,setNewFilterData:i,setNewFilterView:s},r.label):Array.isArray(r.children)?e(Mo,{item:r,classes:m,level:0,handleDrawerOpen:o,drawerOpen:a,slimSize:n,rootUrl:d,dashboardUrl:c,navigate:p},r.label):e(Bo,{item:r,classes:m,level:0,slimSize:n,drawerOpen:a,rootUrl:d,dashboardUrl:c,navigate:p},r.label)))),e(U,{component:"nav",disablePadding:!0,className:l?m.navLinksforseparateView:m.navLinks,children:e(le,{children:g})})},Do=({item:o,setView:a,level:t,classes:n,slimSize:i,setNewFilterData:s,setNewFilterView:l})=>{let d=(o.label||"").toLowerCase().substring(0,1)||"circle";const c="process.gif"!==o.icon?.toLowerCase()&&o.icon?e(F,{className:n.listIcon,children:e(se,{icon:["fas",o.icon]})}):e(F,{className:n.listIcon,children:e(se,{icon:["fas",d]})}),p=1===t?n.nestedMenuLevel1:2===t?n.nestedMenuLevel2:"";return r(W,{button:!0,disableGutters:!0,className:$({[n.item]:!0,[p]:Boolean(p),[n.slimList]:Boolean(i),[n.drawerIconSize]:!Eo}),onClick:()=>{if("newfilterview"===o.viewName&&Array.isArray(o.children)){l({label:o.label,placeholder:"Search "+o.label+" Screen..."});let e=o.children.map((e=>({...e,secondaryLabel:e.user_code})));s(e)}a(o.viewName)},children:[e(D,{title:o.label,arrow:!0,placement:Eo?"bottom-start":"right",children:e("span",{children:c})}),Eo&&o.label.length>27||!Boolean(c)?e(D,{title:o.label,arrow:!0,placement:Eo?"bottom-start":"right",children:e(V,{primary:o.label,className:n.link,secondary:o.secondaryLabel??null})}):Eo?e(V,{primary:o.label,className:n.link,secondary:o.secondaryLabel??null}):null]})},Bo=({item:o,classes:a,level:t,slimSize:n,drawerOpen:i,rootUrl:s,dashboardUrl:l,navigate:d})=>{const c=_o(window.location?.pathname??"",o?.href??"",o?.navigationProps,s,l);if(c){let e=document.title;document.title=e.split(" - ")[0]+" - "+o.label}let p=(o.label||"").toLowerCase().substring(0,1)||"circle";const m="process.gif"!==o.icon.toLowerCase()&&Boolean(o.icon)?e(F,{className:a.listIcon,children:e(se,{icon:["fas",o.icon]})}):e(F,{className:a.listIcon,children:e(se,{icon:["fas",p]})}),g=1===t?a.nestedMenuLevel1:2===t?a.nestedMenuLevel2:"";return r(W,{button:!0,disableGutters:!0,className:$({[a.item]:!0,[g]:Boolean(g),[a.slimList]:Boolean(n),[a.activeMenuItem]:c,[a.drawerIconSize]:!Eo}),onClick:e=>{if(e.preventDefault(),o.isRouterLink){let e=o.href;if(e="/"===o.href?.substring(0,1)?o.href.substring(1):o.href,o.passNavigationPropsAsURLParmas){let r=new URLSearchParams(o?.navigationProps);d(`${e}?${r.toString()}`)}else d(`${e}`,{state:{...o?.navigationProps}})}else Boolean(o.href)&&window.open(o.href,o.rel??"_newtab")},children:[e(D,{title:o.label,arrow:!0,placement:Eo?"bottom-start":"right",children:e("span",{children:m})}),Eo&&o.label.length>27||!Boolean(m)?e(D,{title:o.label,arrow:!0,placement:Eo?"bottom-start":"right",children:e(V,{primary:o.label,className:a.link,secondary:o.secondaryLabel??null})}):Eo?e(V,{primary:o.label,className:a.link,secondary:o.secondaryLabel??null}):null]})},Mo=({item:a,classes:t,level:n,handleDrawerOpen:i,drawerOpen:s,slimSize:l,rootUrl:d,navigate:c})=>{const[p,g]=m(!1),u=a.children?.map((r=>Array.isArray(r.children)?e(Mo,{item:r,classes:t,level:n+1,handleDrawerOpen:i,drawerOpen:s,slimSize:l,rootUrl:d,navigate:c},r.label):e(Bo,{item:r,classes:t,level:n+1,slimSize:l,rootUrl:d,navigate:c},r.label)));let h=(a.label||"").toLowerCase().substring(0,1)||"circle";const f="process.gif"!==a.icon?.toLowerCase()&&Boolean(a.icon)?e(F,{className:t.listIcon,children:e(se,{icon:["fas",a.icon]})}):e(F,{className:t.listIcon,children:e(se,{icon:["fas",h]})}),w=1===n?t.nestedMenuLevel1:2===n?t.nestedMenuLevel2:"";return r(o,{children:[r(W,{button:!0,onClick:()=>{g(!p)},disableGutters:!0,className:$(p?{[t.item]:!0,[w]:Boolean(w),[t.slimList]:Boolean(l),[t.openCurrent]:!0,[t.drawerIconSize]:!Eo}:{[t.item]:!0,[w]:Boolean(w),[t.slimList]:Boolean(l),[t.drawerIconSize]:!Eo}),children:[e(D,{title:a.label,arrow:!0,placement:Eo?"bottom-start":"right",children:e("span",{children:f})}),s||!Boolean(f)?r(o,{children:[e(V,{primary:a.label,secondary:a.secondaryLabel??null,color:"primary",className:t.link}),e(p?de:ce,{})]}):null]}),e(z,{in:p,timeout:"auto",unmountOnExit:!0,children:e(U,{component:"div",disablePadding:!0,className:p?t.openList:"",children:u})})]})},_o=(e,r,o,a,t)=>{if((e===`/${a}`||e===`/${a}/`)&&r===t)return!0;if("report"===r){try{if("?"+new URLSearchParams(o).toString()===window.location.search)return!0}catch(e){console.log(e)}return!1}return!(e===`/${a}`||"/"===e||!Boolean(r)||!e.includes(r))},Oo=(e,r,o)=>(Array.isArray(r)||(r=[r]),r.some((r=>o[r]?.toLocaleLowerCase?.()?.includes(e?.toLocaleLowerCase?.())))),Io=(e,r,o)=>{let a=[];for(let t=0;t<r.length;t++)if(Oo(e,o,r[t])){let{children:n,...i}=r[t];if(Array.isArray(n)&&n.length>0){let r=Io(e,n,o);r.length>0&&a.push({...i,children:r})}else a.push({...i})}return a},Ao=({metaData:o,handleDrawerOpen:a,drawerOpen:t,setView:n,label:i,icon:s,placeholder:l="Search Reports...",rootUrl:d,dashboardUrl:c,navigate:g})=>{const[u,h]=m(""),w=f((()=>Io(u,o.navItems,["label","secondaryLabel"])),[u,o.navItems]),y=No(),x=s?e(F,{className:y.listIcon,children:e(pe,{})}):null;return r("div",{style:{display:"flex",flexDirection:"column"},children:[r(W,{button:!0,className:$({[y.item]:!0,[y.nestedMenuLevel1]:!0,[y.linktext]:!0}),onClick:()=>n("/"),children:[x,e(V,{primary:i,className:y.link})]}),e(p,{sx:{overflow:"hidden"},value:u,onChange:e=>h(e.target.value),onClick:()=>{t||a()},placeholder:Boolean(l)?l:"Search Reports...",autoFocus:t}),e(ko,{handleDrawerOpen:a,drawerOpen:t,setView:n,metaData:{navItems:w,config:{rel:"",target:"_blank"}},slimSize:!0,isFromSeparetView:!0,rootUrl:d,dashboardUrl:c,navigate:g})]})};me.add(ge,ue,he,fe,we,ye,xe,be,ve,Ce,Se,Pe,Te,Ne,Ee,ke,De,Be,Me,_e,Oe,Ie,Ae,Re,Le,Ue,Fe,We,Ve,ze,qe,He,je,Ge,Ke,$e,Xe,Ye,Je,Qe,Ze,er,rr,or,ar,tr,nr,ir,sr,lr,dr,cr,pr,mr,gr,ur,hr,fr,wr,yr,xr,br,vr,Cr,Sr,Pr,Tr,Nr,Er,kr,Dr,Br,Mr,_r,Or,Ir,Ar,Rr,Lr,Ur,Fr,Wr,Vr,zr,qr,Hr,jr,Gr,Kr,$r,Xr,Yr,Jr,Qr);const Ro=(e,r,o,a,t,n)=>{let i=Wo(e.navItems,r,o,a,t,n).map((e=>{let{children:r,...o}=e;return Array.isArray(r)&&r.length>5&&(Boolean(o.seperateView)||(o.seperateView=!0,o.viewName="newfilterview")),{...o,children:r}}));return{config:e.config,navItems:i}},Lo=(e,r)=>{if(!Array.isArray(r)||!Array.isArray(e))return!0;if(r.length<=0||e.length<=0)return!0;for(const o of r)if(e.indexOf(o)>=0)return!0;return!1},Uo=(e,r)=>!Array.isArray(r)||"number"!=typeof e||(r.length<=0||!(r.indexOf(e)>=0)),Fo=(e,r)=>{if(!Array.isArray(r)||!Array.isArray(e))return!0;if(r.length<=0||e.length<=0)return!0;for(const o of r)if(e.indexOf(o)>=0)return!0;return!1},Wo=(e,r,o,a,t,n)=>{let i=[];for(let m=0;m<e.length;m++)if(c=Number(r),p=e[m].visibleToRoles,(!Array.isArray(p)||"number"!=typeof c||p.length<=0||p.indexOf(c)>=0)&&(l=a,d=e[m].visibleToCompanies,!Array.isArray(d)||!Boolean(l)||d.length<=0||d.indexOf(l)>=0)&&Lo(o,e[m].visibleToBranches)&&Uo(Number(r),e[m].invisibleToRoles)&&Fo(n,e[m].visibleToProducts)&&(s=e[m],Array.isArray(s.children)&&s.children.length>0||Boolean(s.href))){let{children:s,...l}=e[m];if(Array.isArray(s)&&s.length>0){let e=Wo(s,r,o,a,t,n);e.length>0&&i.push({...l,children:e})}else i.push({...l,secondaryLabel:l.system_code})}var s,l,d,c,p;return i},Vo=({authState:r,handleDrawerOpen:a,open:t,rootUrl:n,dashboardUrl:i="dashboard",navigate:s})=>{const[l,d]=m("/"),[c,p]=m({}),[g,u]=m([]),h=f((()=>{let e=r?.access?.entities?.Branch??[];return Array.isArray(e)&&e.length>=0?e.map((e=>e.branchCode)):[]}),[]),w=f((()=>{let e=r?.access?.products??[];return Array.isArray(e)&&e.length>=0?e.map((e=>e.categoryCode)):[]}),[]);let y={navItems:r.menulistdata},x=Ro(y,Number(r.role),h,r.companyID,r.access,w),b=Ro({config:{rel:"",target:"_blank"},navItems:To},Number(r.role),h,r.companyID,r.access,w);return"report"===l?e(Ao,{metaData:b,handleDrawerOpen:a,drawerOpen:t,setView:d,label:"Reports",icon:"table",rootUrl:n,dashboardUrl:i,navigate:s}):"newfilterview"===l?e(Ao,{metaData:{config:{rel:"",target:"_blank"},navItems:g},handleDrawerOpen:a,drawerOpen:t,setView:d,label:c?.label??"Reports",icon:"table",placeholder:c?.placeholder,rootUrl:n,dashboardUrl:i,navigate:s}):e(o,{children:e(ko,{metaData:x,handleDrawerOpen:a,drawerOpen:t,setView:d,slimSize:!0,setNewFilterData:u,setNewFilterView:p,rootUrl:n,dashboardUrl:i,navigate:s})})},zo=o=>{const a=Po();return r(q,{variant:"permanent",classes:{paper:$(a.drawerPaper,!o.open&&a.drawerPaperClose)},open:o.open,children:[e("div",{className:a.toolbarIcon}),e(Vo,{...o})]})};export{Co as AppbarWrapper,po as AuthControllerWrapper,bo as BranchSelectionGridWrapper,ho as ForgotPasswordControllerWrapper,zo as SidebarWrapper};
|
|
3238
2
|
//# sourceMappingURL=index.js.map
|