@tap-payments/auth-jsconnect 2.4.86-test → 2.4.88-test
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/build/assets/locales/ar.json +3 -1
- package/build/assets/locales/en.json +3 -1
- package/build/components/ArabicDatePicker/ArabicDatePicker.d.ts +5 -2
- package/build/components/ArabicDatePicker/ArabicDatePicker.js +36 -19
- package/build/components/ArabicDatePicker/style.css +32 -0
- package/build/components/DatePicker/DatePicker.d.ts +2 -1
- package/build/components/DatePicker/DatePicker.js +12 -7
- package/build/constants/assets.d.ts +2 -0
- package/build/constants/assets.js +2 -0
- package/build/features/app/connect/connectStore.js +52 -35
- package/build/features/business/screens/Activities/Activities.js +4 -3
- package/build/features/business/screens/Activities/OperationStartDate.d.ts +3 -1
- package/build/features/business/screens/Activities/OperationStartDate.js +3 -3
- package/build/features/business/screens/IDBOD/DOB.js +2 -2
- package/build/features/connect/screens/NID/DOB.js +3 -3
- package/build/features/connectExpress/screens/NID/DOB.js +2 -2
- package/build/features/connectExpress/screens/NIDMissed/DOB.js +2 -2
- package/build/features/entity/screens/EntityName/EntityName.js +10 -8
- package/build/features/entity/screens/EntityName/ExpiryDate.d.ts +3 -1
- package/build/features/entity/screens/EntityName/ExpiryDate.js +3 -3
- package/build/features/entity/screens/EntityName/IssuingDate.d.ts +3 -1
- package/build/features/entity/screens/EntityName/IssuingDate.js +3 -3
- package/build/features/individual/screens/IndividualPersonalInfo/DOB.d.ts +3 -1
- package/build/features/individual/screens/IndividualPersonalInfo/DOB.js +3 -3
- package/build/features/individual/screens/IndividualPersonalInfo/ExpiryDate.d.ts +3 -1
- package/build/features/individual/screens/IndividualPersonalInfo/ExpiryDate.js +3 -3
- package/build/features/individual/screens/IndividualPersonalInfo/IndividualPersonalInfo.js +9 -7
- package/build/features/shared/Calender/Calender.d.ts +15 -0
- package/build/features/shared/Calender/Calender.js +53 -0
- package/build/features/shared/Calender/index.d.ts +2 -0
- package/build/features/shared/Calender/index.js +2 -0
- package/package.json +1 -1
|
@@ -414,5 +414,7 @@
|
|
|
414
414
|
"segment_profit_title": "الربح",
|
|
415
415
|
"alert_choose_segment_location": "يُرجى تحديد الموقع",
|
|
416
416
|
"alert_choose_segment_profit": "يُرجى تحديد الربح",
|
|
417
|
-
"alert_choose_segment_tech": "الرجاء تحديد التقنية"
|
|
417
|
+
"alert_choose_segment_tech": "الرجاء تحديد التقنية",
|
|
418
|
+
"switch_to_islamic_calendar": "التبديل إلى التقويم الهجرى",
|
|
419
|
+
"switch_to_gregorian_calendar": "التبديل إلى التقويم الميلادي"
|
|
418
420
|
}
|
|
@@ -444,5 +444,7 @@
|
|
|
444
444
|
"segment_profit_title": "Segment Profit",
|
|
445
445
|
"alert_choose_segment_location": "Please select segment location",
|
|
446
446
|
"alert_choose_segment_profit": "Please select segment profit",
|
|
447
|
-
"alert_choose_segment_tech": "Please select segment tech"
|
|
447
|
+
"alert_choose_segment_tech": "Please select segment tech",
|
|
448
|
+
"switch_to_islamic_calendar": "Switch to Islamic Calendar",
|
|
449
|
+
"switch_to_gregorian_calendar": "Switch to Gregorian Calendar"
|
|
448
450
|
}
|
|
@@ -2,12 +2,15 @@ import React from 'react';
|
|
|
2
2
|
import { CalendarProps } from 'react-multi-date-picker';
|
|
3
3
|
import './style.css';
|
|
4
4
|
export interface DatePickerProps extends CalendarProps {
|
|
5
|
+
open?: boolean;
|
|
5
6
|
disabled?: boolean;
|
|
6
7
|
readOnly?: boolean;
|
|
7
8
|
dir?: string;
|
|
8
9
|
onDateChange?: (date: string) => void;
|
|
9
|
-
onClick?: (
|
|
10
|
+
onClick?: () => void;
|
|
10
11
|
onDatePicked?: () => void;
|
|
12
|
+
isDob?: boolean;
|
|
13
|
+
isVerified?: boolean;
|
|
11
14
|
}
|
|
12
|
-
declare const _default: React.MemoExoticComponent<({ disabled, dir, readOnly, onDateChange, onClick, onDatePicked, value, ...rest }: DatePickerProps) => JSX.Element>;
|
|
15
|
+
declare const _default: React.MemoExoticComponent<({ open, disabled, dir, readOnly, onDateChange, onClick, onDatePicked, value, isDob, isVerified, ...rest }: DatePickerProps) => JSX.Element>;
|
|
13
16
|
export default _default;
|
|
@@ -25,23 +25,27 @@ import React, { memo } from 'react';
|
|
|
25
25
|
import { Calendar, toDateObject } from 'react-multi-date-picker';
|
|
26
26
|
import arabic from 'react-date-object/calendars/arabic';
|
|
27
27
|
import arabic_ar from 'react-date-object/locales/arabic_ar';
|
|
28
|
+
import arabic_en from 'react-date-object/locales/arabic_en';
|
|
28
29
|
import Box from '@mui/material/Box';
|
|
29
30
|
import { styled } from '@mui/material/styles';
|
|
30
31
|
import Divider from '@mui/material/Divider';
|
|
31
32
|
import Collapse from '../Collapse';
|
|
32
|
-
import
|
|
33
|
-
import
|
|
33
|
+
import Icon from '../Icon';
|
|
34
|
+
import { ICONS_NAMES } from '../../constants';
|
|
35
|
+
import { getEighteenYearsAgo } from '../../utils';
|
|
36
|
+
import { EndAdornmentExpanded } from '../../features/shared/EndAdornment';
|
|
34
37
|
import Input from '../Input';
|
|
35
38
|
import Text from '../Text';
|
|
36
39
|
import './style.css';
|
|
37
|
-
var ContainerIcon = styled(
|
|
38
|
-
var theme = _a.theme;
|
|
39
|
-
return (__assign(__assign({ marginInlineStart: theme.spacing(2.5) }, theme.typography.h6), { cursor: 'pointer', width: theme.spacing(2
|
|
40
|
+
var ContainerIcon = styled(Icon, { shouldForwardProp: function (prop) { return prop !== 'disabled'; } })(function (_a) {
|
|
41
|
+
var theme = _a.theme, disabled = _a.disabled;
|
|
42
|
+
return (__assign(__assign({ marginInlineStart: theme.spacing(2.5) }, theme.typography.h6), { cursor: disabled ? 'auto' : 'pointer', width: theme.spacing(2), height: theme.spacing(2) }));
|
|
40
43
|
});
|
|
41
44
|
var Container = styled(Box, { shouldForwardProp: function (prop) { return prop !== 'disabled'; } })(function (_a) {
|
|
42
45
|
var theme = _a.theme, disabled = _a.disabled;
|
|
43
46
|
return ({
|
|
44
47
|
cursor: disabled ? 'auto' : 'pointer',
|
|
48
|
+
opacity: disabled ? '0.6' : '1',
|
|
45
49
|
fontFamily: theme.typography.fontFamily
|
|
46
50
|
});
|
|
47
51
|
});
|
|
@@ -51,7 +55,8 @@ var InputFieldStyled = styled(Input)(function (_a) {
|
|
|
51
55
|
cursor: disabled ? 'auto' : 'pointer',
|
|
52
56
|
'&::placeholder': __assign(__assign({ opacity: 1, color: theme.palette.text.primary, lineHeight: theme.spacing(2.125) }, theme.typography.body2), { fontWeight: theme.typography.fontWeightLight }),
|
|
53
57
|
'& .MuiInputBase-input': {
|
|
54
|
-
WebkitTextFillColor: 'inherit'
|
|
58
|
+
WebkitTextFillColor: 'inherit',
|
|
59
|
+
cursor: disabled ? 'auto' : 'pointer'
|
|
55
60
|
}
|
|
56
61
|
});
|
|
57
62
|
});
|
|
@@ -59,36 +64,48 @@ var ArrowIcon = styled(Text, { shouldForwardProp: function (prop) { return prop
|
|
|
59
64
|
var theme = _a.theme, disabled = _a.disabled;
|
|
60
65
|
return ({
|
|
61
66
|
cursor: disabled ? 'auto' : 'pointer',
|
|
62
|
-
marginInlineEnd: theme.spacing(2.5)
|
|
67
|
+
marginInlineEnd: theme.spacing(2.5),
|
|
68
|
+
display: 'flex'
|
|
63
69
|
});
|
|
64
70
|
});
|
|
65
71
|
var DatePicker = function (_a) {
|
|
66
|
-
var disabled = _a.disabled, dir = _a.dir, readOnly = _a.readOnly, onDateChange = _a.onDateChange, onClick = _a.onClick, onDatePicked = _a.onDatePicked, value = _a.value, rest = __rest(_a, ["disabled", "dir", "readOnly", "onDateChange", "onClick", "onDatePicked", "value"]);
|
|
67
|
-
var
|
|
68
|
-
var
|
|
72
|
+
var _b = _a.open, open = _b === void 0 ? false : _b, disabled = _a.disabled, dir = _a.dir, readOnly = _a.readOnly, onDateChange = _a.onDateChange, onClick = _a.onClick, onDatePicked = _a.onDatePicked, value = _a.value, isDob = _a.isDob, isVerified = _a.isVerified, rest = __rest(_a, ["open", "disabled", "dir", "readOnly", "onDateChange", "onClick", "onDatePicked", "value", "isDob", "isVerified"]);
|
|
73
|
+
var _c = React.useState(), date = _c[0], setDate = _c[1];
|
|
74
|
+
var _d = React.useState(null), anchor = _d[0], setAnchor = _d[1];
|
|
75
|
+
var _e = React.useState(open), openCalender = _e[0], setOpenCalender = _e[1];
|
|
76
|
+
var calenderIcon = _jsx(ContainerIcon, { disabled: disabled, src: ICONS_NAMES.SWITCH_HIJRI_CALENDER });
|
|
69
77
|
var defaultMax = new Date();
|
|
70
78
|
var defaultMin = new Date('1900-01-01');
|
|
71
79
|
var DATE_FORMAT = 'YYYY-MM-DD';
|
|
80
|
+
React.useEffect(function () {
|
|
81
|
+
if (value)
|
|
82
|
+
setDate(value);
|
|
83
|
+
}, [value]);
|
|
72
84
|
var toggleCalender = function (event) {
|
|
73
|
-
if (
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
setAnchor(null);
|
|
78
|
-
return;
|
|
85
|
+
if (anchor || openCalender) {
|
|
86
|
+
onDatePicked === null || onDatePicked === void 0 ? void 0 : onDatePicked();
|
|
87
|
+
setOpenCalender(false);
|
|
88
|
+
return setAnchor(null);
|
|
79
89
|
}
|
|
80
90
|
setAnchor(event.currentTarget);
|
|
81
|
-
|
|
91
|
+
setOpenCalender(true);
|
|
92
|
+
onClick === null || onClick === void 0 ? void 0 : onClick();
|
|
93
|
+
};
|
|
94
|
+
var getEndAdornment = function () {
|
|
95
|
+
if (disabled && !isVerified)
|
|
96
|
+
return '';
|
|
97
|
+
return _jsx(EndAdornmentExpanded, { isVerified: isVerified, anchorEl: anchor });
|
|
82
98
|
};
|
|
83
99
|
var handleOnDateChange = function (date) {
|
|
84
|
-
onDateChange
|
|
100
|
+
onDateChange === null || onDateChange === void 0 ? void 0 : onDateChange(date.toDate().toLocaleDateString('en-CA'));
|
|
85
101
|
setAnchor(null);
|
|
102
|
+
setOpenCalender(false);
|
|
86
103
|
onDatePicked === null || onDatePicked === void 0 ? void 0 : onDatePicked();
|
|
87
104
|
};
|
|
88
105
|
var formateDate = function (date) {
|
|
89
106
|
var dateObject = toDateObject(date);
|
|
90
107
|
return dateObject.convert(arabic).format(DATE_FORMAT);
|
|
91
108
|
};
|
|
92
|
-
return (_jsxs(Container, __assign({ disabled: disabled, id: 'container-calendar' }, { children: [_jsx(InputFieldStyled, { endAdornment: _jsx(ArrowIcon, __assign({ disabled: disabled }, { children:
|
|
109
|
+
return (_jsxs(Container, __assign({ disabled: disabled, id: 'arabic-container-calendar' }, { children: [_jsx(InputFieldStyled, { endAdornment: _jsx(ArrowIcon, __assign({ disabled: disabled }, { children: getEndAdornment() })), value: date ? formateDate(date) : '', placeholder: DATE_FORMAT, onClick: toggleCalender, startAdornment: calenderIcon, disabled: !disabled, readOnly: readOnly, dir: dir }), _jsxs(Collapse, __assign({ in: openCalender }, { children: [_jsx(Calendar, __assign({ calendar: arabic, locale: dir === 'rtl' ? arabic_ar : arabic_en, maxDate: rest.maxDate || defaultMax, minDate: defaultMin, format: DATE_FORMAT, onChange: handleOnDateChange, value: date || (isDob ? new Date(getEighteenYearsAgo()) : undefined), className: 'custom-container' }, rest)), _jsx(Divider, {})] }))] })));
|
|
93
110
|
};
|
|
94
111
|
export default memo(DatePicker);
|
|
@@ -7,6 +7,9 @@
|
|
|
7
7
|
.rmdp-day-picker > div {
|
|
8
8
|
width: 100%;
|
|
9
9
|
}
|
|
10
|
+
.rmdp-day {
|
|
11
|
+
color: #3a4154 !important;
|
|
12
|
+
}
|
|
10
13
|
|
|
11
14
|
.rmdp-calendar {
|
|
12
15
|
width: 100%;
|
|
@@ -22,3 +25,32 @@
|
|
|
22
25
|
color: #ffffff !important;
|
|
23
26
|
background-color: black !important;
|
|
24
27
|
}
|
|
28
|
+
|
|
29
|
+
.rmdp-week-day {
|
|
30
|
+
color: #abaeb6 !important;
|
|
31
|
+
font-weight: 400 !important;
|
|
32
|
+
font-size: 0.75em !important;
|
|
33
|
+
text-transform: uppercase;
|
|
34
|
+
}
|
|
35
|
+
.rmdp-day:not(.rmdp-disabled):not(.rmdp-day-hidden) span:hover {
|
|
36
|
+
background-color: #fafafa !important;
|
|
37
|
+
/* border-radius: 50%; */
|
|
38
|
+
color: #3a4154 !important;
|
|
39
|
+
/* background: radial-gradient(circle closest-side, #fafafa 0, #fafafa 98%, transparent 100%) !important; */
|
|
40
|
+
}
|
|
41
|
+
.rmdp-arrow-container:hover {
|
|
42
|
+
background-color: unset !important;
|
|
43
|
+
box-shadow: unset !important;
|
|
44
|
+
}
|
|
45
|
+
.rmdp-arrow {
|
|
46
|
+
border: solid #000 !important;
|
|
47
|
+
border-width: 0 1px 1px 0 !important;
|
|
48
|
+
}
|
|
49
|
+
.rmdp-day.rmdp-today span {
|
|
50
|
+
background-color: unset !important;
|
|
51
|
+
color: #000 !important;
|
|
52
|
+
}
|
|
53
|
+
.rmdp-header {
|
|
54
|
+
margin-bottom: 12px;
|
|
55
|
+
margin-top: 10px !important;
|
|
56
|
+
}
|
|
@@ -3,6 +3,7 @@ import { CalendarProps } from 'react-calendar';
|
|
|
3
3
|
import 'react-calendar/dist/Calendar.css';
|
|
4
4
|
import './customStyle.css';
|
|
5
5
|
export interface DatePickerProps extends CalendarProps {
|
|
6
|
+
open?: boolean;
|
|
6
7
|
onDateChange?: (date: string) => void;
|
|
7
8
|
onClick?: () => void;
|
|
8
9
|
onDatePicked?: () => void;
|
|
@@ -12,5 +13,5 @@ export interface DatePickerProps extends CalendarProps {
|
|
|
12
13
|
isDob?: boolean;
|
|
13
14
|
isVerified?: boolean;
|
|
14
15
|
}
|
|
15
|
-
declare const _default: React.MemoExoticComponent<({ onDateChange, disabled, readOnly, onClick, onDatePicked, dir, defaultValue, isDob, isVerified, ...rest }: DatePickerProps) => JSX.Element>;
|
|
16
|
+
declare const _default: React.MemoExoticComponent<({ onDateChange, disabled, readOnly, onClick, onDatePicked, dir, defaultValue, isDob, isVerified, open, ...rest }: DatePickerProps) => JSX.Element>;
|
|
16
17
|
export default _default;
|
|
@@ -28,15 +28,16 @@ import Box from '@mui/material/Box';
|
|
|
28
28
|
import { styled } from '@mui/material/styles';
|
|
29
29
|
import Divider from '@mui/material/Divider';
|
|
30
30
|
import Collapse from '../Collapse';
|
|
31
|
-
import
|
|
31
|
+
import Icon from '../Icon';
|
|
32
|
+
import { ICONS_NAMES } from '../../constants';
|
|
32
33
|
import { convertToEnglishDateFormat, getEighteenYearsAgo, scrollDown, scrollUp } from '../../utils';
|
|
33
34
|
import { EndAdornmentExpanded } from '../../features/shared/EndAdornment';
|
|
34
35
|
import Input from '../Input';
|
|
35
36
|
import Text from '../Text';
|
|
36
37
|
import './customStyle.css';
|
|
37
|
-
var ContainerIcon = styled(
|
|
38
|
+
var ContainerIcon = styled(Icon, { shouldForwardProp: function (prop) { return prop !== 'disabled'; } })(function (_a) {
|
|
38
39
|
var theme = _a.theme, disabled = _a.disabled;
|
|
39
|
-
return (__assign(__assign({ marginInlineStart: theme.spacing(2.5) }, theme.typography.h6), { cursor: disabled ? 'auto' : 'pointer', width: theme.spacing(2.
|
|
40
|
+
return (__assign(__assign({ marginInlineStart: theme.spacing(2.5) }, theme.typography.h6), { cursor: disabled ? 'auto' : 'pointer', width: theme.spacing(2.25), height: theme.spacing(2.25) }));
|
|
40
41
|
});
|
|
41
42
|
var Container = styled(Box, { shouldForwardProp: function (prop) { return prop !== 'disabled'; } })(function (_a) {
|
|
42
43
|
var theme = _a.theme, disabled = _a.disabled;
|
|
@@ -66,24 +67,27 @@ var ArrowIcon = styled(Text, { shouldForwardProp: function (prop) { return prop
|
|
|
66
67
|
});
|
|
67
68
|
});
|
|
68
69
|
var DatePicker = function (_a) {
|
|
69
|
-
var onDateChange = _a.onDateChange, disabled = _a.disabled, readOnly = _a.readOnly, onClick = _a.onClick, onDatePicked = _a.onDatePicked, dir = _a.dir, defaultValue = _a.defaultValue, isDob = _a.isDob, isVerified = _a.isVerified, rest = __rest(_a, ["onDateChange", "disabled", "readOnly", "onClick", "onDatePicked", "dir", "defaultValue", "isDob", "isVerified"]);
|
|
70
|
+
var onDateChange = _a.onDateChange, disabled = _a.disabled, readOnly = _a.readOnly, onClick = _a.onClick, onDatePicked = _a.onDatePicked, dir = _a.dir, defaultValue = _a.defaultValue, isDob = _a.isDob, isVerified = _a.isVerified, open = _a.open, rest = __rest(_a, ["onDateChange", "disabled", "readOnly", "onClick", "onDatePicked", "dir", "defaultValue", "isDob", "isVerified", "open"]);
|
|
70
71
|
var _b = useState(), date = _b[0], setDate = _b[1];
|
|
71
72
|
var _c = React.useState(null), anchor = _c[0], setAnchor = _c[1];
|
|
73
|
+
var _d = React.useState(open), openCalender = _d[0], setOpenCalender = _d[1];
|
|
72
74
|
useEffect(function () {
|
|
73
75
|
if (defaultValue)
|
|
74
76
|
setDate(defaultValue);
|
|
75
77
|
}, [defaultValue]);
|
|
76
|
-
var calenderIcon = _jsx(ContainerIcon, { disabled: disabled });
|
|
78
|
+
var calenderIcon = _jsx(ContainerIcon, { disabled: disabled, src: ICONS_NAMES.SWITCH_CALENDER });
|
|
77
79
|
var defaultMax = new Date();
|
|
78
80
|
var defaultMin = new Date('1900-01-01');
|
|
79
81
|
var toggleCalender = function (event) {
|
|
80
82
|
var elementId = 'animation-flow-template-content';
|
|
81
|
-
if (anchor) {
|
|
83
|
+
if (anchor || openCalender) {
|
|
82
84
|
onDatePicked === null || onDatePicked === void 0 ? void 0 : onDatePicked();
|
|
83
85
|
setTimeout(function () { return scrollDown(elementId); }, 500);
|
|
86
|
+
setOpenCalender(false);
|
|
84
87
|
return setAnchor(null);
|
|
85
88
|
}
|
|
86
89
|
setAnchor(event.currentTarget);
|
|
90
|
+
setOpenCalender(true);
|
|
87
91
|
setTimeout(function () { return scrollUp(elementId); }, 550);
|
|
88
92
|
onClick === null || onClick === void 0 ? void 0 : onClick();
|
|
89
93
|
};
|
|
@@ -91,6 +95,7 @@ var DatePicker = function (_a) {
|
|
|
91
95
|
setDate(date);
|
|
92
96
|
onDateChange === null || onDateChange === void 0 ? void 0 : onDateChange(convertToEnglishDateFormat(date));
|
|
93
97
|
setAnchor(null);
|
|
98
|
+
setOpenCalender(false);
|
|
94
99
|
onDatePicked === null || onDatePicked === void 0 ? void 0 : onDatePicked();
|
|
95
100
|
};
|
|
96
101
|
var getEndAdornment = function () {
|
|
@@ -101,6 +106,6 @@ var DatePicker = function (_a) {
|
|
|
101
106
|
return (_jsxs(Container, __assign({ disabled: disabled, id: 'container-calendar' }, { children: [_jsx(InputFieldStyled, { endAdornment: _jsx(ArrowIcon, __assign({ disabled: disabled }, { children: getEndAdornment() })), value: date ? convertToEnglishDateFormat(date) : '', placeholder: 'YYYY-MM-DD', onClick: function (e) {
|
|
102
107
|
if (!disabled)
|
|
103
108
|
toggleCalender(e);
|
|
104
|
-
}, startAdornment: calenderIcon, disabled: disabled, readOnly: readOnly, dir: dir }), _jsxs(Collapse, __assign({ in:
|
|
109
|
+
}, startAdornment: calenderIcon, disabled: disabled, readOnly: readOnly, dir: dir }), _jsxs(Collapse, __assign({ in: openCalender }, { children: [_jsx(Calendar, __assign({}, rest, { value: date || (isDob ? new Date(getEighteenYearsAgo()) : undefined), calendarType: 'Hebrew', onChange: handleOnDateChange, locale: rest.locale, maxDate: rest.maxDate || defaultMax, minDate: rest.minDate || defaultMin })), _jsx(Divider, {})] }))] })));
|
|
105
110
|
};
|
|
106
111
|
export default memo(DatePicker);
|
|
@@ -72,6 +72,8 @@ export declare const ICONS_NAMES: {
|
|
|
72
72
|
CLOSE_ICON: string;
|
|
73
73
|
PACI_ICON: string;
|
|
74
74
|
SIGNED_UP_SUCCESS: string;
|
|
75
|
+
SWITCH_HIJRI_CALENDER: string;
|
|
76
|
+
SWITCH_CALENDER: string;
|
|
75
77
|
GMAIL_Filled_ICON: string;
|
|
76
78
|
GMAIL_White_ICON: string;
|
|
77
79
|
outlook_Filled_ICON: string;
|
|
@@ -72,6 +72,8 @@ export var ICONS_NAMES = {
|
|
|
72
72
|
CLOSE_ICON: 'https://dash.b-cdn.net/icons/menu/close-btn.svg',
|
|
73
73
|
PACI_ICON: 'https://dash.b-cdn.net/icons/menu/PACI-filled.svg',
|
|
74
74
|
SIGNED_UP_SUCCESS: 'https://dash.b-cdn.net/icons/menu/signed_up_success.svg',
|
|
75
|
+
SWITCH_HIJRI_CALENDER: 'https://dash.b-cdn.net/icons/menu/switch_hijri_calender.svg',
|
|
76
|
+
SWITCH_CALENDER: 'https://dash.b-cdn.net/icons/menu/calender_icon.svg',
|
|
75
77
|
GMAIL_Filled_ICON: 'https://dash.b-cdn.net/icons/menu/Gmail-filled.svg',
|
|
76
78
|
GMAIL_White_ICON: 'https://dash.b-cdn.net/icons/menu/Gmail-white.svg',
|
|
77
79
|
outlook_Filled_ICON: 'https://dash.b-cdn.net/icons/menu/Outlook-filled.svg',
|
|
@@ -228,7 +228,7 @@ export var createNIDAuth = createAsyncThunk('createNIDAuth', function (params, t
|
|
|
228
228
|
});
|
|
229
229
|
}); });
|
|
230
230
|
export var verifyAuth = createAsyncThunk('connect/verifyAuth', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
231
|
-
var _a, connect, settings, startWithNID, _b, mobileData, nidData, responseBody, stepName, payload, data, lead_id, leadResponse, channels,
|
|
231
|
+
var _a, connect, settings, startWithNID, _b, mobileData, nidData, responseBody, stepName, payload, data, lead_id, leadResponse, channels, brand, err_1, brands, err_2, countryCode, phone;
|
|
232
232
|
var _c, _d, _e, _f;
|
|
233
233
|
return __generator(this, function (_g) {
|
|
234
234
|
switch (_g.label) {
|
|
@@ -274,15 +274,25 @@ export var verifyAuth = createAsyncThunk('connect/verifyAuth', function (params,
|
|
|
274
274
|
_g.label = 4;
|
|
275
275
|
case 4:
|
|
276
276
|
_g.trys.push([4, 6, , 7]);
|
|
277
|
-
return [4, API.brandService.
|
|
277
|
+
return [4, API.brandService.retrieveBrand(leadResponse.brand.id)];
|
|
278
278
|
case 5:
|
|
279
|
-
|
|
280
|
-
leadResponse.
|
|
279
|
+
brand = (_g.sent()).brand;
|
|
280
|
+
leadResponse.brand = __assign(__assign({}, leadResponse.brand), brand);
|
|
281
281
|
return [3, 7];
|
|
282
282
|
case 6:
|
|
283
283
|
err_1 = _g.sent();
|
|
284
284
|
return [3, 7];
|
|
285
285
|
case 7:
|
|
286
|
+
_g.trys.push([7, 9, , 10]);
|
|
287
|
+
return [4, API.brandService.getBrandList({ individual_id: leadResponse.individual_id })];
|
|
288
|
+
case 8:
|
|
289
|
+
brands = (_g.sent()).brands;
|
|
290
|
+
leadResponse.brand_list = fixBrandList(brands, channels);
|
|
291
|
+
return [3, 10];
|
|
292
|
+
case 9:
|
|
293
|
+
err_2 = _g.sent();
|
|
294
|
+
return [3, 10];
|
|
295
|
+
case 10:
|
|
286
296
|
countryCode = settings.data.businessCountry;
|
|
287
297
|
phone = (leadResponse.contact || {}).phone;
|
|
288
298
|
if (phone === null || phone === void 0 ? void 0 : phone.country_code)
|
|
@@ -294,7 +304,7 @@ export var verifyAuth = createAsyncThunk('connect/verifyAuth', function (params,
|
|
|
294
304
|
});
|
|
295
305
|
}); });
|
|
296
306
|
export var verifyPACI = createAsyncThunk('connect/verifyPACI', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
297
|
-
var _a, settings, connect, responseBody, expiry, interval, maxCalls, count, authResponse, isSuccess, lead_id, leadResponse, countryCode, channels, brands,
|
|
307
|
+
var _a, settings, connect, responseBody, expiry, interval, maxCalls, count, authResponse, isSuccess, lead_id, leadResponse, countryCode, channels, brand, err_3, brands, err_4, phone;
|
|
298
308
|
var _b, _c, _d, _e, _f;
|
|
299
309
|
return __generator(this, function (_g) {
|
|
300
310
|
switch (_g.label) {
|
|
@@ -307,15 +317,15 @@ export var verifyPACI = createAsyncThunk('connect/verifyPACI', function (params,
|
|
|
307
317
|
count = 1;
|
|
308
318
|
_g.label = 1;
|
|
309
319
|
case 1:
|
|
310
|
-
if (!(count <= maxCalls)) return [3,
|
|
320
|
+
if (!(count <= maxCalls)) return [3, 16];
|
|
311
321
|
if (thunkApi.signal.aborted) {
|
|
312
|
-
return [3,
|
|
322
|
+
return [3, 16];
|
|
313
323
|
}
|
|
314
324
|
return [4, API.authService.getVerifyAuth(responseBody === null || responseBody === void 0 ? void 0 : responseBody.auth_token)];
|
|
315
325
|
case 2:
|
|
316
326
|
authResponse = _g.sent();
|
|
317
327
|
isSuccess = ((_b = authResponse.status) === null || _b === void 0 ? void 0 : _b.toLowerCase()) === 'success';
|
|
318
|
-
if (!isSuccess) return [3,
|
|
328
|
+
if (!isSuccess) return [3, 13];
|
|
319
329
|
lead_id = authResponse.lead_id;
|
|
320
330
|
if (!lead_id)
|
|
321
331
|
throw new Error('Lead id is missing');
|
|
@@ -332,18 +342,28 @@ export var verifyPACI = createAsyncThunk('connect/verifyPACI', function (params,
|
|
|
332
342
|
_g.label = 5;
|
|
333
343
|
case 5:
|
|
334
344
|
_g.trys.push([5, 7, , 8]);
|
|
335
|
-
return [4, API.brandService.
|
|
345
|
+
return [4, API.brandService.retrieveBrand(leadResponse.brand.id)];
|
|
336
346
|
case 6:
|
|
337
|
-
|
|
338
|
-
leadResponse.
|
|
347
|
+
brand = (_g.sent()).brand;
|
|
348
|
+
leadResponse.brand = __assign(__assign({}, leadResponse.brand), brand);
|
|
339
349
|
return [3, 8];
|
|
340
350
|
case 7:
|
|
341
|
-
|
|
351
|
+
err_3 = _g.sent();
|
|
342
352
|
return [3, 8];
|
|
343
353
|
case 8:
|
|
354
|
+
_g.trys.push([8, 10, , 11]);
|
|
355
|
+
return [4, API.brandService.getBrandList({ individual_id: leadResponse.individual_id })];
|
|
356
|
+
case 9:
|
|
357
|
+
brands = (_g.sent()).brands;
|
|
358
|
+
leadResponse.brand_list = fixBrandList(brands, channels);
|
|
359
|
+
return [3, 11];
|
|
360
|
+
case 10:
|
|
361
|
+
err_4 = _g.sent();
|
|
362
|
+
return [3, 11];
|
|
363
|
+
case 11:
|
|
344
364
|
(_d = params.onSuccess) === null || _d === void 0 ? void 0 : _d.call(params);
|
|
345
365
|
return [4, sleep(3000)];
|
|
346
|
-
case
|
|
366
|
+
case 12:
|
|
347
367
|
_g.sent();
|
|
348
368
|
phone = (leadResponse.contact || {}).phone;
|
|
349
369
|
if (phone === null || phone === void 0 ? void 0 : phone.country_code)
|
|
@@ -351,25 +371,26 @@ export var verifyPACI = createAsyncThunk('connect/verifyPACI', function (params,
|
|
|
351
371
|
(_f = (_e = settings.data.appConfig).onStepCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, settings.data.activeScreen.name, {});
|
|
352
372
|
thunkApi.dispatch(handleNextScreenStep());
|
|
353
373
|
return [2, { authResponse: authResponse, leadResponse: leadResponse, countryCode: countryCode }];
|
|
354
|
-
case
|
|
355
|
-
case
|
|
374
|
+
case 13: return [4, sleep(interval * 1000)];
|
|
375
|
+
case 14:
|
|
356
376
|
_g.sent();
|
|
357
|
-
_g.label =
|
|
358
|
-
case
|
|
377
|
+
_g.label = 15;
|
|
378
|
+
case 15:
|
|
359
379
|
count++;
|
|
360
380
|
return [3, 1];
|
|
361
|
-
case
|
|
381
|
+
case 16: throw new Error('paci_verification_failed');
|
|
362
382
|
}
|
|
363
383
|
});
|
|
364
384
|
}); });
|
|
365
385
|
export var updateLeadIndividual = createAsyncThunk('updateLeadIndividual', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
366
|
-
var _a, settings, connect, lead_id, phoneCountry, payload, leadResponse
|
|
386
|
+
var _a, settings, connect, lead_id, brandData, phoneCountry, payload, leadResponse;
|
|
367
387
|
var _b, _c, _d, _e, _f;
|
|
368
388
|
return __generator(this, function (_g) {
|
|
369
389
|
switch (_g.label) {
|
|
370
390
|
case 0:
|
|
371
391
|
_a = thunkApi.getState(), settings = _a.settings, connect = _a.connect;
|
|
372
392
|
lead_id = (connect.data.otpData.responseBody || {}).lead_id;
|
|
393
|
+
brandData = (connect.data.brandData.responseBody || {}).brandData;
|
|
373
394
|
phoneCountry = (_c = (_b = params.countryCode) === null || _b === void 0 ? void 0 : _b.idd_prefix) === null || _c === void 0 ? void 0 : _c.toString();
|
|
374
395
|
payload = {
|
|
375
396
|
id: lead_id || '',
|
|
@@ -382,13 +403,7 @@ export var updateLeadIndividual = createAsyncThunk('updateLeadIndividual', funct
|
|
|
382
403
|
return [4, API.leadService.updateLead(payload)];
|
|
383
404
|
case 1:
|
|
384
405
|
leadResponse = _g.sent();
|
|
385
|
-
|
|
386
|
-
return [4, API.brandService.retrieveBrand(leadResponse.brand.id)];
|
|
387
|
-
case 2:
|
|
388
|
-
brand = (_g.sent()).brand;
|
|
389
|
-
leadResponse.brand = __assign(__assign({}, leadResponse.brand), brand);
|
|
390
|
-
_g.label = 3;
|
|
391
|
-
case 3:
|
|
406
|
+
leadResponse.brand = __assign(__assign({}, leadResponse.brand), brandData);
|
|
392
407
|
(_f = (_e = settings.data.appConfig).onStepCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, settings.data.activeScreen.name, params);
|
|
393
408
|
thunkApi.dispatch(handleNextScreenStep());
|
|
394
409
|
return [2, { leadResponse: leadResponse, formData: params }];
|
|
@@ -440,7 +455,7 @@ export var retrieveSegmentDataList = createAsyncThunk('connectRetrieveSegmentDat
|
|
|
440
455
|
});
|
|
441
456
|
}); });
|
|
442
457
|
export var updateLeadBrand = createAsyncThunk('updateLeadBrand', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
443
|
-
var _a, settings, connect, responseBody, leadBrandId, isNewBrand, brandName, salesChannels, selectedBrandItem, brandLogoId, termAndConditionChecked, getAddress, channel_services, payload_1, brandReqBody_1, brand_1, _b, segmentLocation, segmentProfit, segmentTech,
|
|
458
|
+
var _a, settings, connect, responseBody, leadBrandId, isNewBrand, brandName, salesChannels, selectedBrandItem, brandLogoId, termAndConditionChecked, getAddress, channel_services, payload_1, brandReqBody_1, brand_1, _b, segmentLocation, segmentProfit, segmentTech, err_5, teamSize, err_6, brandNameBody, payload, lead, brandReqBody, brand, _c, segmentLocation, segmentProfit, segmentTech, err_7, teamSize, err_8;
|
|
444
459
|
var _d, _e, _f, _g, _h;
|
|
445
460
|
return __generator(this, function (_j) {
|
|
446
461
|
switch (_j.label) {
|
|
@@ -501,7 +516,7 @@ export var updateLeadBrand = createAsyncThunk('updateLeadBrand', function (param
|
|
|
501
516
|
brand_1.segment_tech_list = segmentTech;
|
|
502
517
|
return [3, 7];
|
|
503
518
|
case 6:
|
|
504
|
-
|
|
519
|
+
err_5 = _j.sent();
|
|
505
520
|
return [3, 7];
|
|
506
521
|
case 7:
|
|
507
522
|
_j.trys.push([7, 9, , 10]);
|
|
@@ -511,7 +526,7 @@ export var updateLeadBrand = createAsyncThunk('updateLeadBrand', function (param
|
|
|
511
526
|
brand_1.team_size_list = teamSize.list;
|
|
512
527
|
return [3, 10];
|
|
513
528
|
case 9:
|
|
514
|
-
|
|
529
|
+
err_6 = _j.sent();
|
|
515
530
|
return [3, 10];
|
|
516
531
|
case 10:
|
|
517
532
|
sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep()); });
|
|
@@ -559,7 +574,7 @@ export var updateLeadBrand = createAsyncThunk('updateLeadBrand', function (param
|
|
|
559
574
|
brand.segment_tech_list = segmentTech;
|
|
560
575
|
return [3, 17];
|
|
561
576
|
case 16:
|
|
562
|
-
|
|
577
|
+
err_7 = _j.sent();
|
|
563
578
|
return [3, 17];
|
|
564
579
|
case 17:
|
|
565
580
|
_j.trys.push([17, 19, , 20]);
|
|
@@ -569,7 +584,7 @@ export var updateLeadBrand = createAsyncThunk('updateLeadBrand', function (param
|
|
|
569
584
|
brand.team_size_list = teamSize.list;
|
|
570
585
|
return [3, 20];
|
|
571
586
|
case 19:
|
|
572
|
-
|
|
587
|
+
err_8 = _j.sent();
|
|
573
588
|
return [3, 20];
|
|
574
589
|
case 20:
|
|
575
590
|
sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep()); });
|
|
@@ -832,13 +847,14 @@ export var connectSlice = createSlice({
|
|
|
832
847
|
var isBrandExist = brand_list.find(function (item) { return item.id === (brand === null || brand === void 0 ? void 0 : brand.id); });
|
|
833
848
|
brandList = __spreadArray([], brand_list, true);
|
|
834
849
|
if (!isBrandExist && brand)
|
|
835
|
-
brandList = __spreadArray(__spreadArray([], brandList, true), [__assign(__assign({}, brand), { channel_services: [] })], false);
|
|
850
|
+
brandList = __spreadArray(__spreadArray([], brandList, true), [__assign(__assign({}, brand), { channel_services: (brand === null || brand === void 0 ? void 0 : brand.channel_services) || [] })], false);
|
|
836
851
|
brandList = __spreadArray(__spreadArray([], brandList, true), [OTHER_BRAND], false);
|
|
837
852
|
state.data.brandData.selectedBrandItem = brandList[0];
|
|
838
853
|
}
|
|
839
854
|
state.data.brandData.responseBody = {
|
|
840
855
|
brand_list: brandList,
|
|
841
|
-
channel_list: channel_list
|
|
856
|
+
channel_list: channel_list,
|
|
857
|
+
brandData: brand
|
|
842
858
|
};
|
|
843
859
|
state.data.otpData.responseBody = __assign(__assign({}, authResponse), { is_new_individual: is_new_individual, lead_id: id, brand_id: brand === null || brand === void 0 ? void 0 : brand.id, name: name, contact: contact });
|
|
844
860
|
})
|
|
@@ -874,13 +890,14 @@ export var connectSlice = createSlice({
|
|
|
874
890
|
var isBrandExist = brand_list.find(function (item) { return item.id === (brand === null || brand === void 0 ? void 0 : brand.id); });
|
|
875
891
|
brandList = __spreadArray([], brand_list, true);
|
|
876
892
|
if (!isBrandExist && brand)
|
|
877
|
-
brandList = __spreadArray(__spreadArray([], brandList, true), [__assign(__assign({}, brand), { channel_services: [] })], false);
|
|
893
|
+
brandList = __spreadArray(__spreadArray([], brandList, true), [__assign(__assign({}, brand), { channel_services: (brand === null || brand === void 0 ? void 0 : brand.channel_services) || [] })], false);
|
|
878
894
|
brandList = __spreadArray(__spreadArray([], brandList, true), [OTHER_BRAND], false);
|
|
879
895
|
state.data.brandData.selectedBrandItem = brandList[0];
|
|
880
896
|
}
|
|
881
897
|
state.data.brandData.responseBody = {
|
|
882
898
|
brand_list: brandList,
|
|
883
|
-
channel_list: channel_list
|
|
899
|
+
channel_list: channel_list,
|
|
900
|
+
brandData: brand
|
|
884
901
|
};
|
|
885
902
|
state.data.otpData.responseBody = __assign(__assign({}, authResponse), { is_new_individual: is_new_individual, lead_id: id, brand_id: brand === null || brand === void 0 ? void 0 : brand.id, name: name, contact: contact });
|
|
886
903
|
})
|
|
@@ -33,11 +33,12 @@ var FormStyled = styled(Form)(function () { return ({
|
|
|
33
33
|
var Activities = function () {
|
|
34
34
|
var _a = React.useState(false), anchorEl = _a[0], setAnchorEl = _a[1];
|
|
35
35
|
var _b = React.useState(false), collapse = _b[0], setCollapse = _b[1];
|
|
36
|
+
var _c = React.useState(false), isHijri = _c[0], setIsHijri = _c[1];
|
|
36
37
|
var dispatch = useAppDispatch();
|
|
37
38
|
var isAr = useLanguage().isAr;
|
|
38
39
|
var t = useTranslation().t;
|
|
39
|
-
var
|
|
40
|
-
var
|
|
40
|
+
var _d = useAppSelector(businessSelector), data = _d.data, loading = _d.loading, error = _d.error;
|
|
41
|
+
var _e = data.activitiesData, activities = _e.activities, operationStartDate = _e.operationStartDate;
|
|
41
42
|
var methods = useForm({
|
|
42
43
|
resolver: yupResolver(ActivitiesValidationSchema),
|
|
43
44
|
defaultValues: {
|
|
@@ -64,6 +65,6 @@ var Activities = function () {
|
|
|
64
65
|
anchorEl ? setAnchorEl(false) : setAnchorEl(true);
|
|
65
66
|
};
|
|
66
67
|
var disabled = !methods.formState.isValid || !!error;
|
|
67
|
-
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(Collapse, __assign({ in: !collapse && !anchorEl }, { children: _jsx(LicenseName, {}) })), _jsx(Collapse, __assign({ in: !collapse }, { children: _jsx(ActivitiesList, { onListOpen: function () { return handleMenuClick(); }, onListClose: function () { return handleMenuClick(); } }) })), _jsx(Collapse, __assign({ in: !anchorEl }, { children: _jsx(OperationStartDate, { onDateClicked: handleCollapseOpenClose }) })), _jsx(Collapse, __assign({ in: !collapse && !anchorEl }, { children: _jsx(Button, __assign({ disableBack: true, onBackClicked: function () { return onBack(); }, isAr: isAr, disabled: disabled, loading: loading, error: t(error || '') }, { children: t('next') })) }))] })) })) }));
|
|
68
|
+
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(Collapse, __assign({ in: !collapse && !anchorEl }, { children: _jsx(LicenseName, {}) })), _jsx(Collapse, __assign({ in: !collapse }, { children: _jsx(ActivitiesList, { onListOpen: function () { return handleMenuClick(); }, onListClose: function () { return handleMenuClick(); } }) })), _jsx(Collapse, __assign({ in: !anchorEl }, { children: _jsx(OperationStartDate, { isHijri: isHijri, onSwitchCalender: function (isHijri) { return setIsHijri(isHijri); }, onDateClicked: handleCollapseOpenClose }) })), _jsx(Collapse, __assign({ in: !collapse && !anchorEl }, { children: _jsx(Button, __assign({ disableBack: true, onBackClicked: function () { return onBack(); }, isAr: isAr, disabled: disabled, loading: loading, error: t(error || '') }, { children: t('next') })) }))] })) })) }));
|
|
68
69
|
};
|
|
69
70
|
export default Activities;
|
|
@@ -15,6 +15,8 @@ export declare const InputLabelStyled: import("@emotion/styled").StyledComponent
|
|
|
15
15
|
export declare const MandatoryStyled: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
|
|
16
16
|
export interface OperationStartDateProps {
|
|
17
17
|
onDateClicked?: (flag: boolean) => void;
|
|
18
|
+
isHijri?: boolean;
|
|
19
|
+
onSwitchCalender?: (isHijri: boolean) => void;
|
|
18
20
|
}
|
|
19
|
-
declare const OperationStartDate: ({ onDateClicked }: OperationStartDateProps) => JSX.Element;
|
|
21
|
+
declare const OperationStartDate: ({ onDateClicked, isHijri, onSwitchCalender }: OperationStartDateProps) => JSX.Element;
|
|
20
22
|
export default OperationStartDate;
|
|
@@ -12,12 +12,12 @@ var __assign = (this && this.__assign) || function () {
|
|
|
12
12
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
13
|
import { useTranslation } from 'react-i18next';
|
|
14
14
|
import { useController, useFormContext } from 'react-hook-form';
|
|
15
|
-
import DatePicker from '../../../../components/DatePicker';
|
|
16
15
|
import Text from '../../../../components/Text';
|
|
17
16
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
18
17
|
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
19
18
|
import { businessSelector, clearError } from '../../../app/business/businessStore';
|
|
20
19
|
import { alpha, styled } from '@mui/material/styles';
|
|
20
|
+
import Calender from '../../../shared/Calender';
|
|
21
21
|
export var InputLabelStyled = styled(Text)(function (_a) {
|
|
22
22
|
var theme = _a.theme;
|
|
23
23
|
return (__assign({ margin: theme.spacing(2.5, 2.5, 1.5, 2.5), color: alpha(theme.palette.text.primary, 0.6) }, theme.typography.caption));
|
|
@@ -28,7 +28,7 @@ export var MandatoryStyled = styled('span')(function (_a) {
|
|
|
28
28
|
});
|
|
29
29
|
var OperationStartDate = function (_a) {
|
|
30
30
|
var _b;
|
|
31
|
-
var onDateClicked = _a.onDateClicked;
|
|
31
|
+
var onDateClicked = _a.onDateClicked, isHijri = _a.isHijri, onSwitchCalender = _a.onSwitchCalender;
|
|
32
32
|
var t = useTranslation().t;
|
|
33
33
|
var dispatch = useAppDispatch();
|
|
34
34
|
var control = useFormContext().control;
|
|
@@ -40,6 +40,6 @@ var OperationStartDate = function (_a) {
|
|
|
40
40
|
oDateControl.field.onChange(data);
|
|
41
41
|
};
|
|
42
42
|
var dateValue = (_b = oDateControl === null || oDateControl === void 0 ? void 0 : oDateControl.field) === null || _b === void 0 ? void 0 : _b.value;
|
|
43
|
-
return (_jsxs(ScreenContainer, { children: [_jsxs(InputLabelStyled, { children: [t('business_start_date'), _jsx(MandatoryStyled, { children: "*" })] }), _jsx(
|
|
43
|
+
return (_jsxs(ScreenContainer, { children: [_jsxs(InputLabelStyled, { children: [t('business_start_date'), _jsx(MandatoryStyled, { children: "*" })] }), _jsx(Calender, { isHijri: isHijri, onSwitchCalender: onSwitchCalender, defaultValue: dateValue ? new Date(dateValue) : undefined, onDateClicked: onDateClicked, onDateChange: handleOperationStartDateChange })] }));
|
|
44
44
|
};
|
|
45
45
|
export default OperationStartDate;
|
|
@@ -16,8 +16,8 @@ import { useController, useFormContext } from 'react-hook-form';
|
|
|
16
16
|
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
17
17
|
import { styled, alpha } from '@mui/material/styles';
|
|
18
18
|
import Text from '../../../../components/Text';
|
|
19
|
-
import DatePicker from '../../../../components/DatePicker';
|
|
20
19
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
20
|
+
import Calender from '../../../shared/Calender';
|
|
21
21
|
import { businessSelector, clearError } from '../../../app/business/businessStore';
|
|
22
22
|
var InputLabelStyled = styled(Text)(function (_a) {
|
|
23
23
|
var theme = _a.theme;
|
|
@@ -40,6 +40,6 @@ var BOD = function (_a) {
|
|
|
40
40
|
return (_jsxs(ScreenContainer, { children: [_jsx(InputLabelStyled, __assign({ sx: { p: function (_a) {
|
|
41
41
|
var spacing = _a.spacing;
|
|
42
42
|
return spacing(2.5, 2.5, 1.5, 2.5);
|
|
43
|
-
} } }, { children: t('enter_birth_date') })), _jsx(
|
|
43
|
+
} } }, { children: t('enter_birth_date') })), _jsx(Calender, { isDob: true, defaultValue: dateValue ? new Date(dateValue) : undefined, onDateClicked: onDateClicked, onDateChange: handleBirthDateChange })] }));
|
|
44
44
|
};
|
|
45
45
|
export default React.memo(BOD);
|
|
@@ -14,10 +14,10 @@ import { useTranslation } from 'react-i18next';
|
|
|
14
14
|
import { useController, useFormContext } from 'react-hook-form';
|
|
15
15
|
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
16
16
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
17
|
-
import DatePicker from '../../../../components/DatePicker';
|
|
18
17
|
import { alpha, styled } from '@mui/material/styles';
|
|
19
|
-
import { clearError, connectSelector } from '../../../app/connect/connectStore';
|
|
20
18
|
import Text from '../../../../components/Text';
|
|
19
|
+
import Calender from '../../../shared/Calender';
|
|
20
|
+
import { clearError, connectSelector } from '../../../app/connect/connectStore';
|
|
21
21
|
var InputLabelStyled = styled(Text)(function (_a) {
|
|
22
22
|
var theme = _a.theme;
|
|
23
23
|
return (__assign(__assign({ color: alpha(theme.palette.text.primary, 0.6), fontWeight: theme.typography.fontWeightMedium }, theme.typography.caption), { lineHeight: theme.spacing(2.5) }));
|
|
@@ -42,6 +42,6 @@ var DOB = function (_a) {
|
|
|
42
42
|
return (_jsxs(ScreenContainer, { children: [_jsx(InputLabelStyled, __assign({ sx: { p: function (_a) {
|
|
43
43
|
var spacing = _a.spacing;
|
|
44
44
|
return spacing(2.5, 2.5, 1.5, 2.5);
|
|
45
|
-
} } }, { children: t('enter_birth_date') })), _jsx(
|
|
45
|
+
} } }, { children: t('enter_birth_date') })), _jsx(Calender, { isDob: true, defaultValue: dateValue ? new Date(dateValue) : undefined, onDateClicked: onDateClicked, onDateChange: handleBirthDateChange })] }));
|
|
46
46
|
};
|
|
47
47
|
export default DOB;
|
|
@@ -14,10 +14,10 @@ import { useTranslation } from 'react-i18next';
|
|
|
14
14
|
import { useController, useFormContext } from 'react-hook-form';
|
|
15
15
|
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
16
16
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
17
|
-
import DatePicker from '../../../../components/DatePicker';
|
|
18
17
|
import { alpha, styled } from '@mui/material/styles';
|
|
19
18
|
import { clearError, connectExpressSelector } from '../../../app/connectExpress/connectExpressStore';
|
|
20
19
|
import Text from '../../../../components/Text';
|
|
20
|
+
import Calender from '../../../shared/Calender';
|
|
21
21
|
var InputLabelStyled = styled(Text)(function (_a) {
|
|
22
22
|
var theme = _a.theme;
|
|
23
23
|
return (__assign(__assign({ color: alpha(theme.palette.text.primary, 0.6), fontWeight: theme.typography.fontWeightMedium }, theme.typography.caption), { lineHeight: theme.spacing(2.5) }));
|
|
@@ -42,6 +42,6 @@ var DOB = function (_a) {
|
|
|
42
42
|
return (_jsxs(ScreenContainer, { children: [_jsx(InputLabelStyled, __assign({ sx: { p: function (_a) {
|
|
43
43
|
var spacing = _a.spacing;
|
|
44
44
|
return spacing(2.5, 2.5, 1.5, 2.5);
|
|
45
|
-
} } }, { children: t('enter_birth_date') })), _jsx(
|
|
45
|
+
} } }, { children: t('enter_birth_date') })), _jsx(Calender, { isDob: true, disabled: readOnly, defaultValue: dateValue ? new Date(dateValue) : undefined, onDateClicked: onDateClicked, onDateChange: handleBirthDateChange })] }));
|
|
46
46
|
};
|
|
47
47
|
export default DOB;
|
|
@@ -14,10 +14,10 @@ import { useTranslation } from 'react-i18next';
|
|
|
14
14
|
import { useController, useFormContext } from 'react-hook-form';
|
|
15
15
|
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
16
16
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
17
|
-
import DatePicker from '../../../../components/DatePicker';
|
|
18
17
|
import { alpha, styled } from '@mui/material/styles';
|
|
19
18
|
import { clearError, connectExpressSelector } from '../../../app/connectExpress/connectExpressStore';
|
|
20
19
|
import Text from '../../../../components/Text';
|
|
20
|
+
import Calender from '../../../shared/Calender';
|
|
21
21
|
var InputLabelStyled = styled(Text)(function (_a) {
|
|
22
22
|
var theme = _a.theme;
|
|
23
23
|
return (__assign(__assign({ color: alpha(theme.palette.text.primary, 0.6), fontWeight: theme.typography.fontWeightMedium }, theme.typography.caption), { lineHeight: theme.spacing(2.5) }));
|
|
@@ -42,6 +42,6 @@ var DOB = function (_a) {
|
|
|
42
42
|
return (_jsxs(ScreenContainer, { children: [_jsx(InputLabelStyled, __assign({ sx: { p: function (_a) {
|
|
43
43
|
var spacing = _a.spacing;
|
|
44
44
|
return spacing(2.5, 2.5, 1.5, 2.5);
|
|
45
|
-
} } }, { children: t('enter_birth_date') })), _jsx(
|
|
45
|
+
} } }, { children: t('enter_birth_date') })), _jsx(Calender, { isDob: true, defaultValue: dateValue ? new Date(dateValue) : undefined, onDateClicked: onDateClicked, onDateChange: handleBirthDateChange })] }));
|
|
46
46
|
};
|
|
47
47
|
export default DOB;
|
|
@@ -39,21 +39,23 @@ var FormStyled = styled(Form)(function () { return ({
|
|
|
39
39
|
}); });
|
|
40
40
|
var EntityName = function (_a) {
|
|
41
41
|
var _b;
|
|
42
|
-
var _c = React.useState(false),
|
|
43
|
-
var _d = React.useState(false),
|
|
44
|
-
var _e = React.useState(false),
|
|
45
|
-
var _f =
|
|
42
|
+
var _c = React.useState(false), isHijriIssuingDate = _c[0], setIsHijriIssuingDate = _c[1];
|
|
43
|
+
var _d = React.useState(false), isHijriExpiryDate = _d[0], setIsHijriExpiryDate = _d[1];
|
|
44
|
+
var _e = React.useState(false), issueAnchorEl = _e[0], setIssueAnchorEl = _e[1];
|
|
45
|
+
var _f = React.useState(false), expiryAnchorEl = _f[0], setExpiryAnchorEl = _f[1];
|
|
46
|
+
var _g = React.useState(false), entityTypeAnchorEl = _g[0], setEntityTypeAnchorEl = _g[1];
|
|
47
|
+
var _h = useAppSelector(entitySelector), data = _h.data, loading = _h.loading, error = _h.error, uploading = _h.uploading, uploadingArticle = _h.uploadingArticle;
|
|
46
48
|
var settingsData = useAppSelector(settingsSelector).data;
|
|
47
49
|
var isAr = useLanguage().isAr;
|
|
48
50
|
var t = useTranslation().t;
|
|
49
51
|
var dispatch = useAppDispatch();
|
|
50
|
-
var
|
|
52
|
+
var _j = data.entityNameData, legalName = _j.legalName, licenseNumber = _j.licenseNumber, licenseType = _j.licenseType, entityType = _j.entityType, issuingDate = _j.issuingDate, expiryDate = _j.expiryDate, unifiedNumber = _j.unifiedNumber, certificateId = _j.certificateId, articleId = _j.articleId;
|
|
51
53
|
var country_code = settingsData.businessCountry.iso2;
|
|
52
54
|
var isSACountry = React.useMemo(function () { return isSA(country_code); }, [country_code]);
|
|
53
55
|
var isKWCountry = React.useMemo(function () { return isKW(country_code); }, [country_code]);
|
|
54
56
|
var isCR = licenseType === BusinessType.CR;
|
|
55
|
-
var
|
|
56
|
-
var
|
|
57
|
+
var _k = data.verify.responseBody || {}, entity = _k.entity, flows = _k.flows;
|
|
58
|
+
var _l = entity || {}, AOA_file = _l.AOA_file, id = _l.id, documents = _l.documents, data_status = _l.data_status, data_verification = _l.data_verification, legal_name = _l.legal_name, type = _l.type, license = _l.license;
|
|
57
59
|
var methods = useForm({
|
|
58
60
|
resolver: yupResolver(isSACountry ? EntityNameValidationSchema() : EntityNameKWValidationSchema()),
|
|
59
61
|
defaultValues: {
|
|
@@ -132,6 +134,6 @@ var EntityName = function (_a) {
|
|
|
132
134
|
var disabled = !methods.formState.isValid || !!error || uploading || uploadingArticle;
|
|
133
135
|
var showLicenseNumber = !isSACountry ? isCR : true;
|
|
134
136
|
var showUnifiedNumber = isSACountry ? isCR : false;
|
|
135
|
-
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(Collapse, __assign({ in: !expiryAnchorEl && !issueAnchorEl && !entityTypeAnchorEl }, { children: _jsx(LegalName, { readOnly: readOnly['legalName'] || (noneEditable['legal_name.en'] && noneEditable['legal_name.ar']), isVerified: isLegalNameVerified }) })), _jsx(Collapse, __assign({ in: !expiryAnchorEl && !issueAnchorEl }, { children: _jsx(EntityTypeList, { readOnly: readOnly['entityType'] || noneEditable['type'], onListOpen: function () { return handleEntityOpenClose(true); }, onListClose: function () { return handleEntityOpenClose(false); }, isVerified: isEntityTypeVerified }) })), _jsxs(Collapse, __assign({ in: !expiryAnchorEl && !issueAnchorEl && !entityTypeAnchorEl }, { children: [_jsx(LicenseNumber, { show: showLicenseNumber, readOnly: readOnly['licenseNumber'] || noneEditable['license.number'], isVerified: isLicenseNumberVerified }), _jsx(UnifiedNumber, { show: showUnifiedNumber, readOnly: readOnly['unifiedNumber'] || noneEditable['license.additional_info'], isVerified: isUnifiedNumberVerified })] })), _jsx(Collapse, __assign({ in: !expiryAnchorEl && !entityTypeAnchorEl }, { children: _jsx(IssuingDate, { onDateClicked: handleIssueDateOpenClose, readOnly: readOnly['issuingDate'] || noneEditable['license.issuing_date'], isVerified: isIssuingDateVerified }) })), _jsx(Collapse, __assign({ in: !issueAnchorEl && !entityTypeAnchorEl }, { children: _jsx(ExpiryDate, { onDateClicked: handleExpiryDateOpenClose, readOnly: readOnly['expiryDate'] || noneEditable['license.expiry_date'], isVerified: isExpiryDateVerified }) })), _jsxs(Collapse, __assign({ in: !expiryAnchorEl && !issueAnchorEl && !entityTypeAnchorEl }, { children: [_jsx(LicenseCertificate, { defaultFiles: defaultCertificateFiles, show: !(isKWCountry && !isCR), readOnly: readOnly['certificateId'] || noneEditable['documents'] }), _jsx(Article, { defaultFile: defaultArticleFile, show: true, readOnly: readOnly['articleId'] || noneEditable['AOA_file_id'], isVerified: isArticleIdVerified })] })), _jsx(Collapse, __assign({ in: !expiryAnchorEl && !issueAnchorEl && !entityTypeAnchorEl }, { children: _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, loading: loading, error: t(error || '') }, { children: t('next') })) }))] })) })) }));
|
|
137
|
+
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(Collapse, __assign({ in: !expiryAnchorEl && !issueAnchorEl && !entityTypeAnchorEl }, { children: _jsx(LegalName, { readOnly: readOnly['legalName'] || (noneEditable['legal_name.en'] && noneEditable['legal_name.ar']), isVerified: isLegalNameVerified }) })), _jsx(Collapse, __assign({ in: !expiryAnchorEl && !issueAnchorEl }, { children: _jsx(EntityTypeList, { readOnly: readOnly['entityType'] || noneEditable['type'], onListOpen: function () { return handleEntityOpenClose(true); }, onListClose: function () { return handleEntityOpenClose(false); }, isVerified: isEntityTypeVerified }) })), _jsxs(Collapse, __assign({ in: !expiryAnchorEl && !issueAnchorEl && !entityTypeAnchorEl }, { children: [_jsx(LicenseNumber, { show: showLicenseNumber, readOnly: readOnly['licenseNumber'] || noneEditable['license.number'], isVerified: isLicenseNumberVerified }), _jsx(UnifiedNumber, { show: showUnifiedNumber, readOnly: readOnly['unifiedNumber'] || noneEditable['license.additional_info'], isVerified: isUnifiedNumberVerified })] })), _jsx(Collapse, __assign({ in: !expiryAnchorEl && !entityTypeAnchorEl }, { children: _jsx(IssuingDate, { isHijri: isHijriIssuingDate, onSwitchCalender: function (isHijri) { return setIsHijriIssuingDate(isHijri); }, onDateClicked: handleIssueDateOpenClose, readOnly: readOnly['issuingDate'] || noneEditable['license.issuing_date'], isVerified: isIssuingDateVerified }) })), _jsx(Collapse, __assign({ in: !issueAnchorEl && !entityTypeAnchorEl }, { children: _jsx(ExpiryDate, { isHijri: isHijriExpiryDate, onSwitchCalender: function (isHijri) { return setIsHijriExpiryDate(isHijri); }, onDateClicked: handleExpiryDateOpenClose, readOnly: readOnly['expiryDate'] || noneEditable['license.expiry_date'], isVerified: isExpiryDateVerified }) })), _jsxs(Collapse, __assign({ in: !expiryAnchorEl && !issueAnchorEl && !entityTypeAnchorEl }, { children: [_jsx(LicenseCertificate, { defaultFiles: defaultCertificateFiles, show: !(isKWCountry && !isCR), readOnly: readOnly['certificateId'] || noneEditable['documents'] }), _jsx(Article, { defaultFile: defaultArticleFile, show: true, readOnly: readOnly['articleId'] || noneEditable['AOA_file_id'], isVerified: isArticleIdVerified })] })), _jsx(Collapse, __assign({ in: !expiryAnchorEl && !issueAnchorEl && !entityTypeAnchorEl }, { children: _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, loading: loading, error: t(error || '') }, { children: t('next') })) }))] })) })) }));
|
|
136
138
|
};
|
|
137
139
|
export default EntityName;
|
|
@@ -16,6 +16,8 @@ export interface ExpiryDateProps {
|
|
|
16
16
|
onDateClicked?: (flag: boolean) => void;
|
|
17
17
|
readOnly?: boolean;
|
|
18
18
|
isVerified?: boolean;
|
|
19
|
+
isHijri?: boolean;
|
|
20
|
+
onSwitchCalender?: (isHijri: boolean) => void;
|
|
19
21
|
}
|
|
20
|
-
declare const ExpiryDate: ({ onDateClicked, readOnly, isVerified }: ExpiryDateProps) => JSX.Element;
|
|
22
|
+
declare const ExpiryDate: ({ onDateClicked, readOnly, isVerified, isHijri, onSwitchCalender }: ExpiryDateProps) => JSX.Element;
|
|
21
23
|
export default ExpiryDate;
|
|
@@ -18,14 +18,14 @@ import { getFutureDate } from '../../../../utils';
|
|
|
18
18
|
import Text from '../../../../components/Text';
|
|
19
19
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
20
20
|
import { entitySelector, clearError } from '../../../app/entity/entityStore';
|
|
21
|
-
import
|
|
21
|
+
import Calender from '../../../shared/Calender';
|
|
22
22
|
export var InputLabelStyled = styled(Text)(function (_a) {
|
|
23
23
|
var theme = _a.theme;
|
|
24
24
|
return (__assign({ margin: theme.spacing(0, 2.5, 1.5, 2.5), color: alpha(theme.palette.text.primary, 0.6) }, theme.typography.caption));
|
|
25
25
|
});
|
|
26
26
|
var ExpiryDate = function (_a) {
|
|
27
27
|
var _b, _c;
|
|
28
|
-
var onDateClicked = _a.onDateClicked, readOnly = _a.readOnly, isVerified = _a.isVerified;
|
|
28
|
+
var onDateClicked = _a.onDateClicked, readOnly = _a.readOnly, isVerified = _a.isVerified, isHijri = _a.isHijri, onSwitchCalender = _a.onSwitchCalender;
|
|
29
29
|
var t = useTranslation().t;
|
|
30
30
|
var dispatch = useAppDispatch();
|
|
31
31
|
var control = useFormContext().control;
|
|
@@ -39,6 +39,6 @@ var ExpiryDate = function (_a) {
|
|
|
39
39
|
dispatch(clearError());
|
|
40
40
|
oDateControl.field.onChange(data);
|
|
41
41
|
};
|
|
42
|
-
return (_jsx(Collapse, __assign({ in: !!expiryDate }, { children: _jsxs(ScreenContainer, __assign({ sx: { mt: 2.5 } }, { children: [_jsx(InputLabelStyled, { children: t('business_expiry_date') }), _jsx(
|
|
42
|
+
return (_jsx(Collapse, __assign({ in: !!expiryDate }, { children: _jsxs(ScreenContainer, __assign({ sx: { mt: 2.5 } }, { children: [_jsx(InputLabelStyled, { children: t('business_expiry_date') }), _jsx(Calender, { isHijri: isHijri, onSwitchCalender: onSwitchCalender, isVerified: isVerified, disabled: readOnly, maxDate: getFutureDate(), defaultValue: dateValue ? new Date(dateValue) : undefined, onDateClicked: onDateClicked, onDateChange: handleExpiryDateChange })] })) })));
|
|
43
43
|
};
|
|
44
44
|
export default ExpiryDate;
|
|
@@ -16,6 +16,8 @@ export interface IssuingDateProps {
|
|
|
16
16
|
onDateClicked?: (flag: boolean) => void;
|
|
17
17
|
readOnly?: boolean;
|
|
18
18
|
isVerified?: boolean;
|
|
19
|
+
isHijri?: boolean;
|
|
20
|
+
onSwitchCalender?: (isHijri: boolean) => void;
|
|
19
21
|
}
|
|
20
|
-
declare const IssuingDate: ({ onDateClicked, readOnly, isVerified }: IssuingDateProps) => JSX.Element;
|
|
22
|
+
declare const IssuingDate: ({ onDateClicked, readOnly, isVerified, isHijri, onSwitchCalender }: IssuingDateProps) => JSX.Element;
|
|
21
23
|
export default IssuingDate;
|
|
@@ -15,7 +15,7 @@ import { useController, useFormContext } from 'react-hook-form';
|
|
|
15
15
|
import { alpha, Collapse, styled } from '@mui/material';
|
|
16
16
|
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
17
17
|
import Text from '../../../../components/Text';
|
|
18
|
-
import
|
|
18
|
+
import Calender from '../../../shared/Calender';
|
|
19
19
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
20
20
|
import { entitySelector, clearError } from '../../../app/entity/entityStore';
|
|
21
21
|
export var InputLabelStyled = styled(Text)(function (_a) {
|
|
@@ -24,7 +24,7 @@ export var InputLabelStyled = styled(Text)(function (_a) {
|
|
|
24
24
|
});
|
|
25
25
|
var IssuingDate = function (_a) {
|
|
26
26
|
var _b, _c;
|
|
27
|
-
var onDateClicked = _a.onDateClicked, readOnly = _a.readOnly, isVerified = _a.isVerified;
|
|
27
|
+
var onDateClicked = _a.onDateClicked, readOnly = _a.readOnly, isVerified = _a.isVerified, isHijri = _a.isHijri, onSwitchCalender = _a.onSwitchCalender;
|
|
28
28
|
var t = useTranslation().t;
|
|
29
29
|
var dispatch = useAppDispatch();
|
|
30
30
|
var control = useFormContext().control;
|
|
@@ -38,6 +38,6 @@ var IssuingDate = function (_a) {
|
|
|
38
38
|
dispatch(clearError());
|
|
39
39
|
oDateControl.field.onChange(data);
|
|
40
40
|
};
|
|
41
|
-
return (_jsx(Collapse, __assign({ in: !!issueDate }, { children: _jsxs(ScreenContainer, __assign({ sx: { mt: 2.5 } }, { children: [_jsx(InputLabelStyled, { children: t('issue_date') }), _jsx(
|
|
41
|
+
return (_jsx(Collapse, __assign({ in: !!issueDate }, { children: _jsxs(ScreenContainer, __assign({ sx: { mt: 2.5 } }, { children: [_jsx(InputLabelStyled, { children: t('issue_date') }), _jsx(Calender, { isHijri: isHijri, onSwitchCalender: onSwitchCalender, disabled: readOnly, isVerified: isVerified, defaultValue: dateValue ? new Date(dateValue) : undefined, onDateClicked: onDateClicked, onDateChange: handleIssuingDateChange })] })) })));
|
|
42
42
|
};
|
|
43
43
|
export default IssuingDate;
|
|
@@ -4,6 +4,8 @@ interface BODProps {
|
|
|
4
4
|
onDateClicked?: (flag: boolean) => void;
|
|
5
5
|
isVerified?: boolean;
|
|
6
6
|
readOnly?: boolean;
|
|
7
|
+
isHijri?: boolean;
|
|
8
|
+
onSwitchCalender?: (isHijri: boolean) => void;
|
|
7
9
|
}
|
|
8
|
-
declare const _default: React.MemoExoticComponent<({ onDateClicked, show, readOnly, isVerified }: BODProps) => JSX.Element>;
|
|
10
|
+
declare const _default: React.MemoExoticComponent<({ onDateClicked, show, readOnly, isVerified, isHijri, onSwitchCalender }: BODProps) => JSX.Element>;
|
|
9
11
|
export default _default;
|
|
@@ -17,7 +17,7 @@ import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
|
17
17
|
import { styled, alpha } from '@mui/material/styles';
|
|
18
18
|
import Text from '../../../../components/Text';
|
|
19
19
|
import Collapse from '../../../../components/Collapse';
|
|
20
|
-
import
|
|
20
|
+
import Calender from '../../../shared/Calender';
|
|
21
21
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
22
22
|
import { individualSelector, clearError } from '../../../app/individual/individualStore';
|
|
23
23
|
var InputLabelStyled = styled(Text)(function (_a) {
|
|
@@ -26,7 +26,7 @@ var InputLabelStyled = styled(Text)(function (_a) {
|
|
|
26
26
|
});
|
|
27
27
|
var BOD = function (_a) {
|
|
28
28
|
var _b;
|
|
29
|
-
var onDateClicked = _a.onDateClicked, show = _a.show, readOnly = _a.readOnly, isVerified = _a.isVerified;
|
|
29
|
+
var onDateClicked = _a.onDateClicked, show = _a.show, readOnly = _a.readOnly, isVerified = _a.isVerified, isHijri = _a.isHijri, onSwitchCalender = _a.onSwitchCalender;
|
|
30
30
|
var t = useTranslation().t;
|
|
31
31
|
var control = useFormContext().control;
|
|
32
32
|
var dispatch = useAppDispatch();
|
|
@@ -41,6 +41,6 @@ var BOD = function (_a) {
|
|
|
41
41
|
return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, { children: [_jsx(InputLabelStyled, __assign({ sx: { p: function (_a) {
|
|
42
42
|
var spacing = _a.spacing;
|
|
43
43
|
return spacing(2.5, 2.5, 2.5, 2.5);
|
|
44
|
-
} } }, { children: t('enter_birth_date') })), _jsx(
|
|
44
|
+
} } }, { children: t('enter_birth_date') })), _jsx(Calender, { isDob: true, isHijri: isHijri, onSwitchCalender: onSwitchCalender, disabled: readOnly, isVerified: isVerified, defaultValue: dateValue ? new Date(dateValue) : undefined, onDateClicked: onDateClicked, onDateChange: handleBirthDateChange })] }) })));
|
|
45
45
|
};
|
|
46
46
|
export default React.memo(BOD);
|
|
@@ -4,6 +4,8 @@ interface ExpiryDateProps {
|
|
|
4
4
|
onDateClicked?: (flag: boolean) => void;
|
|
5
5
|
readOnly?: boolean;
|
|
6
6
|
isVerified?: boolean;
|
|
7
|
+
isHijri?: boolean;
|
|
8
|
+
onSwitchCalender?: (isHijri: boolean) => void;
|
|
7
9
|
}
|
|
8
|
-
declare const _default: React.MemoExoticComponent<({ onDateClicked, show, readOnly, isVerified }: ExpiryDateProps) => JSX.Element>;
|
|
10
|
+
declare const _default: React.MemoExoticComponent<({ onDateClicked, show, readOnly, isVerified, isHijri, onSwitchCalender }: ExpiryDateProps) => JSX.Element>;
|
|
9
11
|
export default _default;
|
|
@@ -18,7 +18,7 @@ import { getFutureDate } from '../../../../utils';
|
|
|
18
18
|
import { styled, alpha } from '@mui/material/styles';
|
|
19
19
|
import Text from '../../../../components/Text';
|
|
20
20
|
import Collapse from '../../../../components/Collapse';
|
|
21
|
-
import
|
|
21
|
+
import Calender from '../../../shared/Calender';
|
|
22
22
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
23
23
|
import { individualSelector, clearError } from '../../../app/individual/individualStore';
|
|
24
24
|
var InputLabelStyled = styled(Text)(function (_a) {
|
|
@@ -27,7 +27,7 @@ var InputLabelStyled = styled(Text)(function (_a) {
|
|
|
27
27
|
});
|
|
28
28
|
var ExpiryDate = function (_a) {
|
|
29
29
|
var _b;
|
|
30
|
-
var onDateClicked = _a.onDateClicked, show = _a.show, readOnly = _a.readOnly, isVerified = _a.isVerified;
|
|
30
|
+
var onDateClicked = _a.onDateClicked, show = _a.show, readOnly = _a.readOnly, isVerified = _a.isVerified, isHijri = _a.isHijri, onSwitchCalender = _a.onSwitchCalender;
|
|
31
31
|
var t = useTranslation().t;
|
|
32
32
|
var control = useFormContext().control;
|
|
33
33
|
var dispatch = useAppDispatch();
|
|
@@ -42,6 +42,6 @@ var ExpiryDate = function (_a) {
|
|
|
42
42
|
return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, { children: [_jsx(InputLabelStyled, __assign({ sx: { p: function (_a) {
|
|
43
43
|
var spacing = _a.spacing;
|
|
44
44
|
return spacing(2.5, 2.5, 2.5, 2.5);
|
|
45
|
-
} } }, { children: t('enter_expiry_date') })), _jsx(
|
|
45
|
+
} } }, { children: t('enter_expiry_date') })), _jsx(Calender, { isHijri: isHijri, onSwitchCalender: onSwitchCalender, disabled: readOnly, isVerified: isVerified, maxDate: getFutureDate(), defaultValue: dateValue ? new Date(dateValue) : undefined, onDateClicked: onDateClicked, onDateChange: handleBirthDateChange })] }) })));
|
|
46
46
|
};
|
|
47
47
|
export default React.memo(ExpiryDate);
|
|
@@ -54,13 +54,15 @@ var IndividualPersonalInfo = function (_a) {
|
|
|
54
54
|
var t = useTranslation().t;
|
|
55
55
|
var isAr = useLanguage().isAr;
|
|
56
56
|
var dispatch = useAppDispatch();
|
|
57
|
-
var _l =
|
|
57
|
+
var _l = React.useState(false), isHijriDobDate = _l[0], setIsHijriDobDate = _l[1];
|
|
58
|
+
var _m = React.useState(false), isHijriExpiryDate = _m[0], setIsHijriExpiryDate = _m[1];
|
|
59
|
+
var _o = useAppSelector(individualSelector), data = _o.data, loading = _o.loading, error = _o.error, cityLoading = _o.cityLoading;
|
|
58
60
|
var settingsData = useAppSelector(settingsSelector).data;
|
|
59
61
|
var countries = settingsData.countries;
|
|
60
62
|
var verify = data.verify, individualPersonalData = data.individualPersonalData;
|
|
61
|
-
var
|
|
63
|
+
var _p = verify.responseBody || {}, user = _p.user, flows = _p.flows;
|
|
62
64
|
var name = individualPersonalData.name, email = individualPersonalData.email, mobile = individualPersonalData.mobile, countryCode = individualPersonalData.countryCode, gender = individualPersonalData.gender, nid = individualPersonalData.nid, issuedCountry = individualPersonalData.issuedCountry, expiryDate = individualPersonalData.expiryDate, dob = individualPersonalData.dob, placeOfBirthCountry = individualPersonalData.placeOfBirthCountry, placeOfBirthCity = individualPersonalData.placeOfBirthCity, nationality = individualPersonalData.nationality;
|
|
63
|
-
var
|
|
65
|
+
var _q = user || {}, data_status = _q.data_status, is_authorized = _q.is_authorized, data_verification = _q.data_verification, contact = _q.contact, genderRes = _q.gender, identification = _q.identification, birth = _q.birth, nationalityRes = _q.nationality;
|
|
64
66
|
var methods = useForm({
|
|
65
67
|
resolver: yupResolver(IndividualInfoValidationSchema),
|
|
66
68
|
defaultValues: {
|
|
@@ -81,9 +83,9 @@ var IndividualPersonalInfo = function (_a) {
|
|
|
81
83
|
});
|
|
82
84
|
var watch = methods.watch;
|
|
83
85
|
useSetFromDefaultValues(methods, data.individualPersonalData);
|
|
84
|
-
var
|
|
85
|
-
var
|
|
86
|
-
var
|
|
86
|
+
var _r = React.useState(), listActive = _r[0], setListActive = _r[1];
|
|
87
|
+
var _s = React.useState(false), dobActive = _s[0], setDobActive = _s[1];
|
|
88
|
+
var _t = React.useState(false), expiryDateActive = _t[0], setExpiryDateActive = _t[1];
|
|
87
89
|
var originalReadOnly = useFormReadOnly(methods);
|
|
88
90
|
var noneEditable = useDataNoneEditable(data_status, [
|
|
89
91
|
'name.en',
|
|
@@ -172,7 +174,7 @@ var IndividualPersonalInfo = function (_a) {
|
|
|
172
174
|
var isBirthCountryListActive = listActive === ListType.BirthCountryList;
|
|
173
175
|
var isBirthCityListActive = listActive === ListType.BirthCityList;
|
|
174
176
|
var isNationalityListActive = listActive === ListType.NationalityList;
|
|
175
|
-
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(Form, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsxs(Box, { children: [_jsx(Name, { show: showField, readOnly: readOnly['name'] || (noneEditable['name.en'] && noneEditable['name.ar']), isVerified: isNameVerified }), _jsx(MobileNumber, { readOnly: readOnly['mobile'] || noneEditable['contact.phone.number'] || noneEditable['contact.phone.country_code'], show: !isDateFieldActive && !isBirthCountryListActive && !isBirthCityListActive && !isNationalityListActive && !isIssuedCountryListActive, countries: countries, onListOpen: function () { return handleMenuClick(ListType.MobileCountryList); }, onListClose: function () { return handleMenuClick(); }, isVerified: isPhoneNumberVerified }), _jsx(Email, { show: showField, readOnly: readOnly['email'] || noneEditable['contact.email'], isVerified: isEmailVerified }), _jsx(Gender, { show: showField, readOnly: readOnly['gender'] || noneEditable['gender'], isVerified: isGenderVerified }), _jsx(ID, { show: showField, readOnly: readOnly['nid'] || noneEditable['identification.id'], isVerified: isIDVerified }), _jsx(IssuedCountry, { readOnly: readOnly['issuedCountry'] || noneEditable['identification.issuer_country'], show: !isMobileCountryListActive && !isDateFieldActive && !isBirthCountryListActive && !isBirthCityListActive && !isNationalityListActive, countries: countries, onListOpen: function () { return handleMenuClick(ListType.IssuedCountryList); }, onListClose: function () { return handleMenuClick(); }, isVerified: isIssuedCountryVerified }), _jsx(ExpiryDate, { show: !listActive && !dobActive, onDateClicked: handleExpiryDateActive, readOnly: readOnly['expiryDate'] || noneEditable['identification.expiry'], isVerified: isExpiryDateVerified }), _jsx(DOB, { show: !listActive && !expiryDateActive, onDateClicked: handleDobActive, readOnly: readOnly['dob'] || noneEditable['birth.date'], isVerified: isDOBVerified }), _jsx(BirthCountry, { readOnly: readOnly['placeOfBirthCountry'] || noneEditable['birth.country'], show: !isMobileCountryListActive && !isDateFieldActive && !isIssuedCountryListActive && !isBirthCityListActive && !isNationalityListActive, countries: countries, onListOpen: function () { return handleMenuClick(ListType.BirthCountryList); }, onListClose: function () { return handleMenuClick(); }, isVerified: isBirthCountryVerified }), _jsx(BirthCity, { readOnly: readOnly['placeOfBirthCity'] || noneEditable['birth.city'], show: !isMobileCountryListActive &&
|
|
177
|
+
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(Form, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsxs(Box, { children: [_jsx(Name, { show: showField, readOnly: readOnly['name'] || (noneEditable['name.en'] && noneEditable['name.ar']), isVerified: isNameVerified }), _jsx(MobileNumber, { readOnly: readOnly['mobile'] || noneEditable['contact.phone.number'] || noneEditable['contact.phone.country_code'], show: !isDateFieldActive && !isBirthCountryListActive && !isBirthCityListActive && !isNationalityListActive && !isIssuedCountryListActive, countries: countries, onListOpen: function () { return handleMenuClick(ListType.MobileCountryList); }, onListClose: function () { return handleMenuClick(); }, isVerified: isPhoneNumberVerified }), _jsx(Email, { show: showField, readOnly: readOnly['email'] || noneEditable['contact.email'], isVerified: isEmailVerified }), _jsx(Gender, { show: showField, readOnly: readOnly['gender'] || noneEditable['gender'], isVerified: isGenderVerified }), _jsx(ID, { show: showField, readOnly: readOnly['nid'] || noneEditable['identification.id'], isVerified: isIDVerified }), _jsx(IssuedCountry, { readOnly: readOnly['issuedCountry'] || noneEditable['identification.issuer_country'], show: !isMobileCountryListActive && !isDateFieldActive && !isBirthCountryListActive && !isBirthCityListActive && !isNationalityListActive, countries: countries, onListOpen: function () { return handleMenuClick(ListType.IssuedCountryList); }, onListClose: function () { return handleMenuClick(); }, isVerified: isIssuedCountryVerified }), _jsx(ExpiryDate, { isHijri: isHijriExpiryDate, onSwitchCalender: function (isHijri) { return setIsHijriExpiryDate(isHijri); }, show: !listActive && !dobActive, onDateClicked: handleExpiryDateActive, readOnly: readOnly['expiryDate'] || noneEditable['identification.expiry'], isVerified: isExpiryDateVerified }), _jsx(DOB, { isHijri: isHijriDobDate, onSwitchCalender: function (isHijri) { return setIsHijriDobDate(isHijri); }, show: !listActive && !expiryDateActive, onDateClicked: handleDobActive, readOnly: readOnly['dob'] || noneEditable['birth.date'], isVerified: isDOBVerified }), _jsx(BirthCountry, { readOnly: readOnly['placeOfBirthCountry'] || noneEditable['birth.country'], show: !isMobileCountryListActive && !isDateFieldActive && !isIssuedCountryListActive && !isBirthCityListActive && !isNationalityListActive, countries: countries, onListOpen: function () { return handleMenuClick(ListType.BirthCountryList); }, onListClose: function () { return handleMenuClick(); }, isVerified: isBirthCountryVerified }), _jsx(BirthCity, { readOnly: readOnly['placeOfBirthCity'] || noneEditable['birth.city'], show: !isMobileCountryListActive &&
|
|
176
178
|
!isDateFieldActive &&
|
|
177
179
|
!isIssuedCountryListActive &&
|
|
178
180
|
!isBirthCountryListActive &&
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { CalendarProps } from 'react-multi-date-picker';
|
|
3
|
+
interface CustomCalenderProps extends CalendarProps {
|
|
4
|
+
isHijri?: boolean;
|
|
5
|
+
defaultValue?: Date | Date[];
|
|
6
|
+
onDateClicked?: (flag: boolean) => void;
|
|
7
|
+
onDateChange?: (date: string) => void;
|
|
8
|
+
isDob?: boolean;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
isVerified?: boolean;
|
|
11
|
+
maxDate?: Date;
|
|
12
|
+
onSwitchCalender?: (isHijri: boolean) => void;
|
|
13
|
+
}
|
|
14
|
+
declare const CustomCalender: ({ isHijri, onDateClicked, onDateChange, defaultValue, isDob, disabled, isVerified, maxDate, onSwitchCalender }: CustomCalenderProps) => JSX.Element;
|
|
15
|
+
export default CustomCalender;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import * as React from 'react';
|
|
14
|
+
import { useTranslation } from 'react-i18next';
|
|
15
|
+
import Box from '@mui/material/Box';
|
|
16
|
+
import { styled, useTheme } from '@mui/material/styles';
|
|
17
|
+
import { ICONS_NAMES } from '../../../constants';
|
|
18
|
+
import DatePicker from '../../../components/DatePicker';
|
|
19
|
+
import ArabicDatePicker from '../../../components/ArabicDatePicker';
|
|
20
|
+
import Collapse from '../../../components/Collapse';
|
|
21
|
+
import Icon from '../../../components/Icon';
|
|
22
|
+
import { ScreenContainer } from '../../shared/Containers';
|
|
23
|
+
var SwitchBoxStyled = styled(Box)(function (_a) {
|
|
24
|
+
var theme = _a.theme;
|
|
25
|
+
return (__assign(__assign({ backgroundColor: 'rgba(117, 122, 135, 0.1)' }, theme.typography.caption), { borderBottomLeftRadius: '12px', borderBottomRightRadius: '12px', display: 'flex', alignItems: 'center', justifyContent: 'center', height: '47px', color: '#757A87', '&:hover': {
|
|
26
|
+
cursor: 'pointer'
|
|
27
|
+
} }));
|
|
28
|
+
});
|
|
29
|
+
var CustomCalender = function (_a) {
|
|
30
|
+
var _b = _a.isHijri, isHijri = _b === void 0 ? false : _b, onDateClicked = _a.onDateClicked, onDateChange = _a.onDateChange, defaultValue = _a.defaultValue, isDob = _a.isDob, disabled = _a.disabled, isVerified = _a.isVerified, maxDate = _a.maxDate, onSwitchCalender = _a.onSwitchCalender;
|
|
31
|
+
var t = useTranslation().t;
|
|
32
|
+
var theme = useTheme();
|
|
33
|
+
var _c = React.useState(false), open = _c[0], setOpen = _c[1];
|
|
34
|
+
var _d = React.useState(isHijri), isHijriCalender = _d[0], setIsHijriCalender = _d[1];
|
|
35
|
+
var handleSwitchCalender = function () {
|
|
36
|
+
setIsHijriCalender(!isHijriCalender);
|
|
37
|
+
onSwitchCalender === null || onSwitchCalender === void 0 ? void 0 : onSwitchCalender(!isHijriCalender);
|
|
38
|
+
};
|
|
39
|
+
return (_jsxs(ScreenContainer, { children: [_jsx(Collapse, __assign({ in: !isHijriCalender }, { children: _jsx(DatePicker, { open: open, defaultValue: defaultValue, readOnly: true, disabled: disabled, isVerified: isVerified, dir: 'ltr', locale: 'en', isDob: isDob, maxDate: maxDate, onDateChange: onDateChange, onClick: function () {
|
|
40
|
+
onDateClicked === null || onDateClicked === void 0 ? void 0 : onDateClicked(true);
|
|
41
|
+
setOpen(true);
|
|
42
|
+
}, onDatePicked: function () {
|
|
43
|
+
onDateClicked === null || onDateClicked === void 0 ? void 0 : onDateClicked(false);
|
|
44
|
+
setOpen(false);
|
|
45
|
+
} }) })), _jsx(Collapse, __assign({ in: isHijriCalender }, { children: _jsx(ArabicDatePicker, { open: open, readOnly: true, disabled: disabled, isVerified: isVerified, dir: theme.direction, isDob: isDob, maxDate: maxDate, onClick: function () {
|
|
46
|
+
onDateClicked === null || onDateClicked === void 0 ? void 0 : onDateClicked(true);
|
|
47
|
+
setOpen(true);
|
|
48
|
+
}, onDatePicked: function () {
|
|
49
|
+
onDateClicked === null || onDateClicked === void 0 ? void 0 : onDateClicked(false);
|
|
50
|
+
setOpen(false);
|
|
51
|
+
}, onDateChange: onDateChange, value: defaultValue }) })), _jsx(Collapse, __assign({ in: open }, { children: _jsx(SwitchBoxStyled, __assign({ onClick: handleSwitchCalender }, { children: _jsxs(_Fragment, { children: [_jsx(Icon, { src: !isHijriCalender ? ICONS_NAMES.SWITCH_HIJRI_CALENDER : ICONS_NAMES.SWITCH_CALENDER }), !isHijriCalender ? t('switch_to_islamic_calendar') : t('switch_to_gregorian_calendar')] }) })) }))] }));
|
|
52
|
+
};
|
|
53
|
+
export default CustomCalender;
|