@tap-payments/auth-jsconnect 2.4.87-test → 2.4.89-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/app/settings.d.ts +3 -1
- package/build/app/settings.js +6 -2
- 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 +44 -5
- 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/business/screens/Activities/OperationStartDate.js +2 -2
- 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/ExpiryDate.js +2 -2
- package/build/features/entity/screens/EntityName/IssuingDate.js +2 -2
- package/build/features/individual/screens/IndividualPersonalInfo/DOB.js +2 -2
- package/build/features/individual/screens/IndividualPersonalInfo/ExpiryDate.js +2 -2
- package/build/features/shared/Calender/Calender.d.ts +13 -0
- package/build/features/shared/Calender/Calender.js +56 -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
package/build/app/settings.d.ts
CHANGED
|
@@ -33,6 +33,7 @@ export interface SettingsData {
|
|
|
33
33
|
boardMaturity: boolean;
|
|
34
34
|
merchant?: MerchantInfo;
|
|
35
35
|
isMaturityExpress: boolean;
|
|
36
|
+
isHijri: boolean;
|
|
36
37
|
}
|
|
37
38
|
export interface SettingsState extends SharedState<SettingsData> {
|
|
38
39
|
}
|
|
@@ -43,6 +44,7 @@ export declare const settingsSlice: import("@reduxjs/toolkit").Slice<SettingsSta
|
|
|
43
44
|
handleSkin: (state: SettingsState, action: ActionState<ThemeMode>) => void;
|
|
44
45
|
handleLanguage: (state: SettingsState, action: ActionState<LanguageMode>) => void;
|
|
45
46
|
handlePublicKey: (state: SettingsState, action: ActionState<string>) => void;
|
|
47
|
+
handleSwitchCalender: (state: SettingsState, action: ActionState<boolean>) => void;
|
|
46
48
|
handleNextScreenStep: (state: SettingsState, action: ActionState<string | undefined>) => void;
|
|
47
49
|
handleCurrentActiveScreen: (state: SettingsState, action: ActionState<string>) => void;
|
|
48
50
|
handlePrevScreenStep: (state: SettingsState, action: ActionState<string | undefined>) => void;
|
|
@@ -50,7 +52,7 @@ export declare const settingsSlice: import("@reduxjs/toolkit").Slice<SettingsSta
|
|
|
50
52
|
handleSetAppConfig: (state: SettingsState, action: ActionState<LibConfig>) => void;
|
|
51
53
|
handleSetCountryByIso2: (state: SettingsState, action: ActionState<string>) => void;
|
|
52
54
|
}, "settings">;
|
|
53
|
-
export declare const handleSkin: import("@reduxjs/toolkit").ActionCreatorWithPayload<ThemeMode, "settings/handleSkin">, handleLanguage: import("@reduxjs/toolkit").ActionCreatorWithPayload<LanguageMode, "settings/handleLanguage">, handleActiveFlowScreens: import("@reduxjs/toolkit").ActionCreatorWithPayload<ScreenStepNavigation[], "settings/handleActiveFlowScreens">, handleNextScreenStep: import("@reduxjs/toolkit").ActionCreatorWithOptionalPayload<string | undefined, "settings/handleNextScreenStep">, handlePrevScreenStep: import("@reduxjs/toolkit").ActionCreatorWithOptionalPayload<string | undefined, "settings/handlePrevScreenStep">, handleCurrentActiveScreen: import("@reduxjs/toolkit").ActionCreatorWithPayload<string, "settings/handleCurrentActiveScreen">, handleSetAppConfig: import("@reduxjs/toolkit").ActionCreatorWithPayload<LibConfig, "settings/handleSetAppConfig">, handleOpen: import("@reduxjs/toolkit").ActionCreatorWithPayload<boolean, "settings/handleOpen">, handleSetCountryByIso2: import("@reduxjs/toolkit").ActionCreatorWithPayload<string, "settings/handleSetCountryByIso2">, handleIsTapOrigin: import("@reduxjs/toolkit").ActionCreatorWithPayload<boolean, "settings/handleIsTapOrigin">, handelBoardMaturity: import("@reduxjs/toolkit").ActionCreatorWithPayload<boolean, "settings/handelBoardMaturity">, handlePublicKey: import("@reduxjs/toolkit").ActionCreatorWithPayload<string, "settings/handlePublicKey">;
|
|
55
|
+
export declare const handleSkin: import("@reduxjs/toolkit").ActionCreatorWithPayload<ThemeMode, "settings/handleSkin">, handleLanguage: import("@reduxjs/toolkit").ActionCreatorWithPayload<LanguageMode, "settings/handleLanguage">, handleActiveFlowScreens: import("@reduxjs/toolkit").ActionCreatorWithPayload<ScreenStepNavigation[], "settings/handleActiveFlowScreens">, handleNextScreenStep: import("@reduxjs/toolkit").ActionCreatorWithOptionalPayload<string | undefined, "settings/handleNextScreenStep">, handlePrevScreenStep: import("@reduxjs/toolkit").ActionCreatorWithOptionalPayload<string | undefined, "settings/handlePrevScreenStep">, handleCurrentActiveScreen: import("@reduxjs/toolkit").ActionCreatorWithPayload<string, "settings/handleCurrentActiveScreen">, handleSetAppConfig: import("@reduxjs/toolkit").ActionCreatorWithPayload<LibConfig, "settings/handleSetAppConfig">, handleOpen: import("@reduxjs/toolkit").ActionCreatorWithPayload<boolean, "settings/handleOpen">, handleSetCountryByIso2: import("@reduxjs/toolkit").ActionCreatorWithPayload<string, "settings/handleSetCountryByIso2">, handleIsTapOrigin: import("@reduxjs/toolkit").ActionCreatorWithPayload<boolean, "settings/handleIsTapOrigin">, handelBoardMaturity: import("@reduxjs/toolkit").ActionCreatorWithPayload<boolean, "settings/handelBoardMaturity">, handlePublicKey: import("@reduxjs/toolkit").ActionCreatorWithPayload<string, "settings/handlePublicKey">, handleSwitchCalender: import("@reduxjs/toolkit").ActionCreatorWithPayload<boolean, "settings/handleSwitchCalender">;
|
|
54
56
|
declare const _default: import("redux").Reducer<SettingsState, import("redux").AnyAction>;
|
|
55
57
|
export default _default;
|
|
56
58
|
export declare const settingsSelector: (state: RootState) => SettingsState;
|
package/build/app/settings.js
CHANGED
|
@@ -155,7 +155,8 @@ var initialState = {
|
|
|
155
155
|
appConfig: {},
|
|
156
156
|
businessCountry: {},
|
|
157
157
|
countries: [],
|
|
158
|
-
isValidOperator: false
|
|
158
|
+
isValidOperator: false,
|
|
159
|
+
isHijri: false
|
|
159
160
|
}
|
|
160
161
|
};
|
|
161
162
|
export var settingsSlice = createSlice({
|
|
@@ -190,6 +191,9 @@ export var settingsSlice = createSlice({
|
|
|
190
191
|
return;
|
|
191
192
|
state.data.appConfig.publicKey = action.payload;
|
|
192
193
|
},
|
|
194
|
+
handleSwitchCalender: function (state, action) {
|
|
195
|
+
state.data.isHijri = action.payload;
|
|
196
|
+
},
|
|
193
197
|
handleNextScreenStep: function (state, action) {
|
|
194
198
|
var next = state.data.activeScreen.next;
|
|
195
199
|
var appConfig = state.data.appConfig;
|
|
@@ -291,6 +295,6 @@ export var settingsSlice = createSlice({
|
|
|
291
295
|
});
|
|
292
296
|
}
|
|
293
297
|
});
|
|
294
|
-
export var handleSkin = (_a = settingsSlice.actions, _a.handleSkin), handleLanguage = _a.handleLanguage, handleActiveFlowScreens = _a.handleActiveFlowScreens, handleNextScreenStep = _a.handleNextScreenStep, handlePrevScreenStep = _a.handlePrevScreenStep, handleCurrentActiveScreen = _a.handleCurrentActiveScreen, handleSetAppConfig = _a.handleSetAppConfig, handleOpen = _a.handleOpen, handleSetCountryByIso2 = _a.handleSetCountryByIso2, handleIsTapOrigin = _a.handleIsTapOrigin, handelBoardMaturity = _a.handelBoardMaturity, handlePublicKey = _a.handlePublicKey;
|
|
298
|
+
export var handleSkin = (_a = settingsSlice.actions, _a.handleSkin), handleLanguage = _a.handleLanguage, handleActiveFlowScreens = _a.handleActiveFlowScreens, handleNextScreenStep = _a.handleNextScreenStep, handlePrevScreenStep = _a.handlePrevScreenStep, handleCurrentActiveScreen = _a.handleCurrentActiveScreen, handleSetAppConfig = _a.handleSetAppConfig, handleOpen = _a.handleOpen, handleSetCountryByIso2 = _a.handleSetCountryByIso2, handleIsTapOrigin = _a.handleIsTapOrigin, handelBoardMaturity = _a.handelBoardMaturity, handlePublicKey = _a.handlePublicKey, handleSwitchCalender = _a.handleSwitchCalender;
|
|
295
299
|
export default settingsSlice.reducer;
|
|
296
300
|
export var settingsSelector = function (state) { return state.settings; };
|
|
@@ -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,18 +7,57 @@
|
|
|
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%;
|
|
13
16
|
}
|
|
14
|
-
/* .rmdp-day:not(.rmdp-disabled):not(.rmdp-day-hidden) span:hover {
|
|
15
|
-
background: radial-gradient(circle closest-side, #fafafa 0%, #fafafa 98%, rgba(0, 0, 0, 0) 100%);
|
|
16
|
-
color: black !important;
|
|
17
|
-
background-color: unset !important;
|
|
18
|
-
} */
|
|
19
17
|
|
|
20
18
|
.rmdp-day.rmdp-selected span:not(.highlight) {
|
|
21
19
|
/* background: radial-gradient(circle closest-side, #3a4154 0%, #3a4154 98%, rgba(0, 0, 0, 0) 100%) !important; */
|
|
22
20
|
color: #ffffff !important;
|
|
23
21
|
background-color: black !important;
|
|
24
22
|
}
|
|
23
|
+
|
|
24
|
+
.rmdp-week-day {
|
|
25
|
+
color: #abaeb6 !important;
|
|
26
|
+
font-weight: 400 !important;
|
|
27
|
+
font-size: 0.75em !important;
|
|
28
|
+
text-transform: uppercase;
|
|
29
|
+
}
|
|
30
|
+
.rmdp-day:not(.rmdp-disabled):not(.rmdp-day-hidden) span:hover {
|
|
31
|
+
background-color: #fafafa !important;
|
|
32
|
+
/* border-radius: 50%; */
|
|
33
|
+
color: #3a4154 !important;
|
|
34
|
+
/* background: radial-gradient(circle closest-side, #fafafa 0, #fafafa 98%, transparent 100%) !important; */
|
|
35
|
+
}
|
|
36
|
+
.rmdp-day.rmdp-selected span:not(.highlight):hover {
|
|
37
|
+
color: #ffffff !important;
|
|
38
|
+
background-color: black !important;
|
|
39
|
+
}
|
|
40
|
+
.rmdp-arrow-container:hover {
|
|
41
|
+
background-color: unset !important;
|
|
42
|
+
box-shadow: unset !important;
|
|
43
|
+
}
|
|
44
|
+
.rmdp-arrow {
|
|
45
|
+
border: solid #000 !important;
|
|
46
|
+
border-width: 0 1px 1px 0 !important;
|
|
47
|
+
}
|
|
48
|
+
.rmdp-day.rmdp-today span {
|
|
49
|
+
background-color: unset !important;
|
|
50
|
+
color: #000 !important;
|
|
51
|
+
}
|
|
52
|
+
.rmdp-header {
|
|
53
|
+
margin-bottom: 12px;
|
|
54
|
+
margin-top: 10px !important;
|
|
55
|
+
}
|
|
56
|
+
.rmdp-day-picker .rmdp-day {
|
|
57
|
+
height: 36px !important;
|
|
58
|
+
width: 36px !important;
|
|
59
|
+
}
|
|
60
|
+
.rmdp-day-picker .rmdp-day span {
|
|
61
|
+
height: 36px !important;
|
|
62
|
+
width: 36px !important;
|
|
63
|
+
}
|
|
@@ -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',
|
|
@@ -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));
|
|
@@ -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, { 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;
|
|
@@ -18,7 +18,7 @@ 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));
|
|
@@ -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, { isVerified: isVerified, disabled: readOnly, maxDate: getFutureDate(), defaultValue: dateValue ? new Date(dateValue) : undefined, onDateClicked: onDateClicked, onDateChange: handleExpiryDateChange })] })) })));
|
|
43
43
|
};
|
|
44
44
|
export default ExpiryDate;
|
|
@@ -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) {
|
|
@@ -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, { disabled: readOnly, isVerified: isVerified, defaultValue: dateValue ? new Date(dateValue) : undefined, onDateClicked: onDateClicked, onDateChange: handleIssuingDateChange })] })) })));
|
|
42
42
|
};
|
|
43
43
|
export default IssuingDate;
|
|
@@ -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) {
|
|
@@ -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, disabled: readOnly, isVerified: isVerified, defaultValue: dateValue ? new Date(dateValue) : undefined, onDateClicked: onDateClicked, onDateChange: handleBirthDateChange })] }) })));
|
|
45
45
|
};
|
|
46
46
|
export default React.memo(BOD);
|
|
@@ -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) {
|
|
@@ -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, { 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);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { CalendarProps } from 'react-multi-date-picker';
|
|
3
|
+
interface CustomCalenderProps extends CalendarProps {
|
|
4
|
+
defaultValue?: Date | Date[];
|
|
5
|
+
onDateClicked?: (flag: boolean) => void;
|
|
6
|
+
onDateChange?: (date: string) => void;
|
|
7
|
+
isDob?: boolean;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
isVerified?: boolean;
|
|
10
|
+
maxDate?: Date;
|
|
11
|
+
}
|
|
12
|
+
declare const CustomCalender: ({ onDateClicked, onDateChange, defaultValue, isDob, disabled, isVerified, maxDate }: CustomCalenderProps) => JSX.Element;
|
|
13
|
+
export default CustomCalender;
|
|
@@ -0,0 +1,56 @@
|
|
|
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 { useAppDispatch, useAppSelector } from '../../../hooks';
|
|
16
|
+
import Box from '@mui/material/Box';
|
|
17
|
+
import { styled, useTheme } from '@mui/material/styles';
|
|
18
|
+
import { settingsSelector, handleSwitchCalender } from '../../../app/settings';
|
|
19
|
+
import { ICONS_NAMES } from '../../../constants';
|
|
20
|
+
import DatePicker from '../../../components/DatePicker';
|
|
21
|
+
import ArabicDatePicker from '../../../components/ArabicDatePicker';
|
|
22
|
+
import Collapse from '../../../components/Collapse';
|
|
23
|
+
import Icon from '../../../components/Icon';
|
|
24
|
+
import { ScreenContainer } from '../../shared/Containers';
|
|
25
|
+
var SwitchBoxStyled = styled(Box)(function (_a) {
|
|
26
|
+
var theme = _a.theme;
|
|
27
|
+
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': {
|
|
28
|
+
cursor: 'pointer'
|
|
29
|
+
} }));
|
|
30
|
+
});
|
|
31
|
+
var CustomCalender = function (_a) {
|
|
32
|
+
var onDateClicked = _a.onDateClicked, onDateChange = _a.onDateChange, defaultValue = _a.defaultValue, isDob = _a.isDob, disabled = _a.disabled, isVerified = _a.isVerified, maxDate = _a.maxDate;
|
|
33
|
+
var t = useTranslation().t;
|
|
34
|
+
var theme = useTheme();
|
|
35
|
+
var data = useAppSelector(settingsSelector).data;
|
|
36
|
+
var dispatch = useAppDispatch();
|
|
37
|
+
var _b = React.useState(false), open = _b[0], setOpen = _b[1];
|
|
38
|
+
var isHijriCalender = data.isHijri;
|
|
39
|
+
var onSwitchCalender = function () {
|
|
40
|
+
dispatch(handleSwitchCalender(!isHijriCalender));
|
|
41
|
+
};
|
|
42
|
+
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 () {
|
|
43
|
+
onDateClicked === null || onDateClicked === void 0 ? void 0 : onDateClicked(true);
|
|
44
|
+
setOpen(true);
|
|
45
|
+
}, onDatePicked: function () {
|
|
46
|
+
onDateClicked === null || onDateClicked === void 0 ? void 0 : onDateClicked(false);
|
|
47
|
+
setOpen(false);
|
|
48
|
+
} }) })), _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 () {
|
|
49
|
+
onDateClicked === null || onDateClicked === void 0 ? void 0 : onDateClicked(true);
|
|
50
|
+
setOpen(true);
|
|
51
|
+
}, onDatePicked: function () {
|
|
52
|
+
onDateClicked === null || onDateClicked === void 0 ? void 0 : onDateClicked(false);
|
|
53
|
+
setOpen(false);
|
|
54
|
+
}, onDateChange: onDateChange, value: defaultValue }) })), _jsx(Collapse, __assign({ in: open }, { children: _jsx(SwitchBoxStyled, __assign({ onClick: onSwitchCalender }, { 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')] }) })) }))] }));
|
|
55
|
+
};
|
|
56
|
+
export default CustomCalender;
|