@acuteinfo/common-screens 1.0.42 → 1.0.43

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