@tap-payments/auth-jsconnect 2.1.75-test → 2.1.76-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/@types/app.d.ts +24 -0
- package/build/@types/app.js +13 -0
- package/build/@types/form.d.ts +15 -1
- package/build/@types/index.d.ts +1 -0
- package/build/@types/index.js +1 -0
- package/build/@types/user.d.ts +141 -0
- package/build/@types/user.js +1 -0
- package/build/api/board.d.ts +16 -0
- package/build/api/board.js +10 -1
- package/build/api/country.d.ts +4 -0
- package/build/api/country.js +9 -1
- package/build/api/index.d.ts +8 -3
- package/build/api/individual.d.ts +43 -1
- package/build/api/individual.js +9 -1
- package/build/api/user.d.ts +6 -0
- package/build/api/user.js +9 -1
- package/build/assets/locales/ar.json +22 -2
- package/build/assets/locales/en.json +22 -1
- package/build/components/SimpleList/SimpleList.d.ts +2 -0
- package/build/constants/api.d.ts +1 -0
- package/build/constants/api.js +3 -1
- package/build/constants/app.d.ts +1 -0
- package/build/constants/app.js +20 -7
- package/build/constants/assets.d.ts +4 -0
- package/build/constants/assets.js +4 -0
- package/build/features/app/bank/bankStore.d.ts +1 -0
- package/build/features/app/bank/bankStore.js +2 -1
- package/build/features/app/brand/brandStore.d.ts +2 -0
- package/build/features/app/brand/brandStore.js +3 -1
- package/build/features/app/business/businessStore.js +1 -1
- package/build/features/app/entity/entityStore.d.ts +2 -0
- package/build/features/app/entity/entityStore.js +3 -1
- package/build/features/app/individual/individualStore.d.ts +28 -3
- package/build/features/app/individual/individualStore.js +461 -118
- package/build/features/app/password/passwordStore.js +2 -2
- package/build/features/app/tax/taxStore.js +30 -29
- package/build/features/bank/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +2 -2
- package/build/features/brand/screens/BrandActivities/ActivitiesList.d.ts +3 -3
- package/build/features/brand/screens/BrandActivities/CustomerBase.d.ts +2 -2
- package/build/features/brand/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +2 -2
- package/build/features/business/screens/Activities/ActivitiesList.d.ts +3 -3
- package/build/features/business/screens/BusinessType/LicenseType.d.ts +2 -2
- package/build/features/business/screens/Customers/CustomerLocations.d.ts +2 -2
- package/build/features/business/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +2 -2
- package/build/features/connectExpress/screens/CollectBusinessInfo/LicenseType.d.ts +2 -2
- package/build/features/connectExpress/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +2 -2
- package/build/features/entity/screens/EntityCapital/ActivityList.d.ts +3 -3
- package/build/features/entity/screens/EntityName/EntityTypeList.d.ts +3 -3
- package/build/features/entity/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +2 -2
- package/build/features/featuresScreens.js +10 -0
- package/build/features/individual/screens/AdditionalIndividualInfo/AdditionalIndividualInfo.d.ts +13 -0
- package/build/features/individual/screens/AdditionalIndividualInfo/AdditionalIndividualInfo.js +43 -8
- package/build/features/individual/screens/AdditionalIndividualInfo/EmployerLocation.js +3 -13
- package/build/features/individual/screens/AdditionalIndividualInfo/InfluencerSwitch.js +9 -2
- package/build/features/individual/screens/AdditionalIndividualInfo/MonthlyIncome.js +11 -17
- package/build/features/individual/screens/AdditionalIndividualInfo/Occupation.js +12 -16
- package/build/features/individual/screens/AdditionalIndividualInfo/PEPSwitch.d.ts +2 -2
- package/build/features/individual/screens/AdditionalIndividualInfo/PEPSwitch.js +9 -2
- package/build/features/individual/screens/AdditionalIndividualInfo/ShareCount.d.ts +6 -0
- package/build/features/individual/screens/AdditionalIndividualInfo/ShareCount.js +35 -0
- package/build/features/individual/screens/AdditionalIndividualInfo/ShareValue.d.ts +6 -0
- package/build/features/individual/screens/AdditionalIndividualInfo/ShareValue.js +41 -0
- package/build/features/individual/screens/AdditionalIndividualInfo/SourceOfIncome.js +9 -6
- package/build/features/individual/screens/AdditionalIndividualInfo/validation.d.ts +20 -17
- package/build/features/individual/screens/AdditionalIndividualInfo/validation.js +18 -25
- package/build/features/individual/screens/IndividualList/IndividualList.d.ts +31 -0
- package/build/features/individual/screens/IndividualList/IndividualList.js +59 -0
- package/build/features/individual/screens/IndividualList/UserList.d.ts +5 -0
- package/build/features/individual/screens/IndividualList/UserList.js +138 -0
- package/build/features/individual/screens/IndividualList/index.d.ts +3 -0
- package/build/features/individual/screens/IndividualList/index.js +2 -0
- package/build/features/individual/screens/IndividualPersonalInfo/BirthCity.d.ts +8 -0
- package/build/features/individual/screens/IndividualPersonalInfo/BirthCity.js +90 -0
- package/build/features/individual/screens/IndividualPersonalInfo/BirthCountry.d.ts +10 -0
- package/build/features/individual/screens/IndividualPersonalInfo/BirthCountry.js +82 -0
- package/build/features/individual/screens/IndividualPersonalInfo/DOB.d.ts +7 -0
- package/build/features/individual/screens/IndividualPersonalInfo/DOB.js +46 -0
- package/build/features/individual/screens/IndividualPersonalInfo/Email.d.ts +6 -0
- package/build/features/individual/screens/IndividualPersonalInfo/Email.js +50 -0
- package/build/features/individual/screens/IndividualPersonalInfo/ExpiryDate.d.ts +7 -0
- package/build/features/individual/screens/IndividualPersonalInfo/ExpiryDate.js +49 -0
- package/build/features/individual/screens/IndividualPersonalInfo/Gender.d.ts +34 -0
- package/build/features/individual/screens/IndividualPersonalInfo/Gender.js +81 -0
- package/build/features/individual/screens/IndividualPersonalInfo/ID.d.ts +6 -0
- package/build/features/individual/screens/IndividualPersonalInfo/ID.js +48 -0
- package/build/features/individual/screens/IndividualPersonalInfo/IndividualPersonalInfo.d.ts +21 -0
- package/build/features/individual/screens/IndividualPersonalInfo/IndividualPersonalInfo.js +126 -0
- package/build/features/individual/screens/IndividualPersonalInfo/IssuedCountry.d.ts +10 -0
- package/build/features/individual/screens/IndividualPersonalInfo/IssuedCountry.js +88 -0
- package/build/features/individual/screens/IndividualPersonalInfo/MobileNumber.d.ts +10 -0
- package/build/features/individual/screens/IndividualPersonalInfo/MobileNumber.js +145 -0
- package/build/features/individual/screens/IndividualPersonalInfo/Name.d.ts +6 -0
- package/build/features/individual/screens/IndividualPersonalInfo/Name.js +52 -0
- package/build/features/individual/screens/IndividualPersonalInfo/Nationality.d.ts +10 -0
- package/build/features/individual/screens/IndividualPersonalInfo/Nationality.js +88 -0
- package/build/features/individual/screens/IndividualPersonalInfo/index.d.ts +3 -0
- package/build/features/individual/screens/IndividualPersonalInfo/index.js +2 -0
- package/build/features/individual/screens/IndividualPersonalInfo/validation.d.ts +38 -0
- package/build/features/individual/screens/IndividualPersonalInfo/validation.js +68 -0
- package/build/features/individual/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +2 -2
- package/build/features/password/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +2 -2
- package/build/features/shared/Address/Address.d.ts +6 -1
- package/build/features/shared/Address/Address.js +40 -30
- package/build/features/shared/Address/CountryList.d.ts +1 -1
- package/build/features/shared/Address/InputSelect.d.ts +1 -1
- package/build/features/shared/Address/InputText.d.ts +2 -1
- package/build/features/shared/Address/InputText.js +2 -2
- package/build/features/shared/Button/FlowsButtons.d.ts +1 -0
- package/build/features/shared/Button/FlowsButtons.js +2 -2
- package/build/features/shared/Button/ListButton.d.ts +17 -0
- package/build/features/shared/Button/ListButton.js +107 -0
- package/build/features/shared/Button/index.d.ts +2 -1
- package/build/features/shared/Button/index.js +2 -1
- package/build/features/shared/SuccessFlowButtons/SuccessFlowButtons.d.ts +2 -1
- package/build/features/shared/SuccessFlowButtons/SuccessFlowButtons.js +6 -4
- package/build/features/tax/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +2 -2
- package/build/features/tax/screens/TaxDetails/TaxDetails.js +2 -1
- package/build/features/tax/screens/TaxDetails/VATId.js +8 -3
- package/build/features/tax/screens/TaxDetails/validation.d.ts +4 -4
- package/build/features/tax/screens/TaxDetails/validation.js +10 -5
- package/build/utils/string.d.ts +3 -2
- package/build/utils/string.js +16 -3
- package/package.json +1 -1
- package/build/features/individual/screens/ShowIndividualInfo/ShowOwnerInfo.d.ts +0 -19
- package/build/features/individual/screens/ShowIndividualInfo/ShowOwnerInfo.js +0 -52
- package/build/features/individual/screens/ShowIndividualInfo/index.d.ts +0 -3
- package/build/features/individual/screens/ShowIndividualInfo/index.js +0 -2
- package/build/features/individual/screens/ShowIndividualInfo/info.d.ts +0 -7
- package/build/features/individual/screens/ShowIndividualInfo/info.js +0 -28
|
@@ -0,0 +1,59 @@
|
|
|
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, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import { useTranslation } from 'react-i18next';
|
|
14
|
+
import { styled } from '@mui/material/styles';
|
|
15
|
+
import Box from '@mui/material/Box';
|
|
16
|
+
import { handlePrevScreenStep } from '../../../../app/settings';
|
|
17
|
+
import { useAppDispatch, useLanguage, useAppSelector } from '../../../../hooks';
|
|
18
|
+
import Text from '../../../../components/Text';
|
|
19
|
+
import Button from '../../../../components/Button';
|
|
20
|
+
import Collapse from '../../../../components/Collapse';
|
|
21
|
+
import Warning from '../../../../components/Warning';
|
|
22
|
+
import { ScreenContainer } from '../../../shared/Containers';
|
|
23
|
+
import { individualSelector } from '../../../app/individual/individualStore';
|
|
24
|
+
import UserList from './UserList';
|
|
25
|
+
var BoxStyled = styled(Box)(function (_a) {
|
|
26
|
+
var theme = _a.theme;
|
|
27
|
+
return ({
|
|
28
|
+
minHeight: theme.spacing(26.875)
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
var ContentStyled = styled(Box)(function (_a) {
|
|
32
|
+
var theme = _a.theme;
|
|
33
|
+
return ({
|
|
34
|
+
display: 'flex',
|
|
35
|
+
justifyContent: 'center',
|
|
36
|
+
flexDirection: 'column',
|
|
37
|
+
alignItems: 'center',
|
|
38
|
+
padding: theme.spacing(0, 2.5, 3, 2.5)
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
export var TitleStyled = styled(Text)(function (_a) {
|
|
42
|
+
var theme = _a.theme;
|
|
43
|
+
return (__assign(__assign({ color: theme.palette.text.primary, fontWeight: theme.typography.fontWeightMedium }, theme.typography.body1), { lineHeight: theme.spacing(2.5), paddingBottom: theme.spacing(1.5) }));
|
|
44
|
+
});
|
|
45
|
+
export var SubTitleStyled = styled(Text)(function (_a) {
|
|
46
|
+
var theme = _a.theme;
|
|
47
|
+
return (__assign(__assign({ color: theme.palette.text.primary, fontWeight: theme.typography.fontWeightRegular }, theme.typography.subtitle2), { lineHeight: theme.spacing(2.5) }));
|
|
48
|
+
});
|
|
49
|
+
var IndividualList = function () {
|
|
50
|
+
var dispatch = useAppDispatch();
|
|
51
|
+
var isAr = useLanguage().isAr;
|
|
52
|
+
var t = useTranslation().t;
|
|
53
|
+
var _a = useAppSelector(individualSelector), data = _a.data, loading = _a.loading, error = _a.error;
|
|
54
|
+
var onBack = function () {
|
|
55
|
+
dispatch(handlePrevScreenStep());
|
|
56
|
+
};
|
|
57
|
+
return (_jsxs(ScreenContainer, { children: [_jsxs(BoxStyled, { children: [_jsxs(ContentStyled, { children: [_jsx(TitleStyled, { children: t('company_individuals') }), _jsx(SubTitleStyled, { children: t('company_individuals_add_or_request_details') })] }), _jsx(UserList, {})] }), _jsx(Collapse, __assign({ in: !!error, timeout: 400 }, { children: _jsx(Warning, __assign({ warningType: 'error' }, { children: t(error || '') })) })), _jsx(Button, __assign({ sx: { mb: 1.5, mt: 1.5 }, onClick: function () { return onBack(); }, variant: 'text' }, { children: t('back') }))] }));
|
|
58
|
+
};
|
|
59
|
+
export default IndividualList;
|
|
@@ -0,0 +1,138 @@
|
|
|
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
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
13
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
14
|
+
if (ar || !(i in from)) {
|
|
15
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
16
|
+
ar[i] = from[i];
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
20
|
+
};
|
|
21
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
22
|
+
import * as React from 'react';
|
|
23
|
+
import { useTranslation } from 'react-i18next';
|
|
24
|
+
import { alpha, styled, useTheme } from '@mui/material/styles';
|
|
25
|
+
import Box from '@mui/material/Box';
|
|
26
|
+
import { getUserName } from '../../../../utils';
|
|
27
|
+
import { useLanguage, useAppSelector, useAppDispatch } from '../../../../hooks';
|
|
28
|
+
import { IndividualType } from '../../../../@types';
|
|
29
|
+
import Collapse from '../../../../components/Collapse';
|
|
30
|
+
import ExpandIcon from '../../../../components/ExpandIcon';
|
|
31
|
+
import Text from '../../../../components/Text';
|
|
32
|
+
import CheckIcon from '../../../shared/CheckIcon';
|
|
33
|
+
import { ScreenContainer } from '../../../shared/Containers';
|
|
34
|
+
import { addDetailsAsync, individualSelector, requestDetailsByEmail } from '../../../app/individual/individualStore';
|
|
35
|
+
import ListButton from '../../../shared/Button/ListButton';
|
|
36
|
+
var ScreenContainerStyled = styled(ScreenContainer)(function (_a) {
|
|
37
|
+
var theme = _a.theme;
|
|
38
|
+
return ({
|
|
39
|
+
background: theme.palette.background.default,
|
|
40
|
+
borderTop: "1px solid ".concat(alpha(theme.palette.divider, 0.8)),
|
|
41
|
+
borderBottom: "1px solid ".concat(alpha(theme.palette.divider, 0.8))
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
var TextBoxStyled = styled(Box)(function (_a) {
|
|
45
|
+
var theme = _a.theme;
|
|
46
|
+
return ({
|
|
47
|
+
display: 'flex',
|
|
48
|
+
justifyContent: 'space-between',
|
|
49
|
+
flexDirection: 'row',
|
|
50
|
+
padding: theme.spacing(1.8, 2.5, 1.8, 2.5)
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
var TextStyled = styled(Box)(function (_a) {
|
|
54
|
+
var theme = _a.theme;
|
|
55
|
+
return (__assign(__assign({}, theme.typography.subtitle2), { color: theme.palette.text.primary, fontWeight: theme.typography.fontWeightRegular, background: theme.palette.background.default }));
|
|
56
|
+
});
|
|
57
|
+
var RoleTextStyled = styled(Text)(function (_a) {
|
|
58
|
+
var theme = _a.theme;
|
|
59
|
+
return (__assign(__assign({}, theme.typography.subtitle2), { display: 'inline', paddingInlineStart: theme.spacing(1.5), color: alpha(theme.palette.text.primary, 0.6), fontWeight: theme.typography.fontWeightRegular, background: theme.palette.background.default }));
|
|
60
|
+
});
|
|
61
|
+
var IndividualRequestType;
|
|
62
|
+
(function (IndividualRequestType) {
|
|
63
|
+
IndividualRequestType[IndividualRequestType["ADD"] = 0] = "ADD";
|
|
64
|
+
IndividualRequestType[IndividualRequestType["REQUEST_EMAIL"] = 1] = "REQUEST_EMAIL";
|
|
65
|
+
})(IndividualRequestType || (IndividualRequestType = {}));
|
|
66
|
+
var UserList = function (_a) {
|
|
67
|
+
var _b = React.useState([]), usersMenuList = _b[0], setUsersMenuList = _b[1];
|
|
68
|
+
var _c = React.useState(null), anchorEl = _c[0], setAnchorEl = _c[1];
|
|
69
|
+
var _d = React.useState(), activeUser = _d[0], setActiveUser = _d[1];
|
|
70
|
+
var _e = React.useState(IndividualRequestType.ADD), type = _e[0], setType = _e[1];
|
|
71
|
+
var t = useTranslation().t;
|
|
72
|
+
var isAr = useLanguage().isAr;
|
|
73
|
+
var dispatch = useAppDispatch();
|
|
74
|
+
var theme = useTheme();
|
|
75
|
+
var _f = useAppSelector(individualSelector), data = _f.data, loading = _f.loading;
|
|
76
|
+
var verify = data.verify;
|
|
77
|
+
var userList = (verify.responseBody || {}).userList;
|
|
78
|
+
React.useEffect(function () {
|
|
79
|
+
if ((userList === null || userList === void 0 ? void 0 : userList.length) > 0) {
|
|
80
|
+
var list = __spreadArray([], userList, true);
|
|
81
|
+
setUsersMenuList(list);
|
|
82
|
+
if (!activeUser)
|
|
83
|
+
setActiveUser(list[0]);
|
|
84
|
+
}
|
|
85
|
+
}, [userList]);
|
|
86
|
+
var onOpenUserAction = function (event) {
|
|
87
|
+
setAnchorEl(event.currentTarget);
|
|
88
|
+
};
|
|
89
|
+
var onCloseUserAction = function () {
|
|
90
|
+
setAnchorEl(null);
|
|
91
|
+
};
|
|
92
|
+
var onClickUser = function (user, e) {
|
|
93
|
+
setAnchorEl(null);
|
|
94
|
+
setActiveUser(user);
|
|
95
|
+
onOpenUserAction(e);
|
|
96
|
+
};
|
|
97
|
+
var onAddDetails = function () {
|
|
98
|
+
setType(IndividualRequestType.ADD);
|
|
99
|
+
if (activeUser)
|
|
100
|
+
dispatch(addDetailsAsync({ user: activeUser, userList: usersMenuList }));
|
|
101
|
+
};
|
|
102
|
+
var onRequestEmail = function () {
|
|
103
|
+
setType(IndividualRequestType.REQUEST_EMAIL);
|
|
104
|
+
if (activeUser) {
|
|
105
|
+
dispatch(requestDetailsByEmail(activeUser));
|
|
106
|
+
setActiveUser(__assign({}, activeUser));
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
var getName = function (user) {
|
|
110
|
+
var name = getUserName(user, isAr);
|
|
111
|
+
return name;
|
|
112
|
+
};
|
|
113
|
+
var getUserRole = function (user) {
|
|
114
|
+
var _a, _b, _c, _d, _e;
|
|
115
|
+
if ((((_a = user === null || user === void 0 ? void 0 : user.role) === null || _a === void 0 ? void 0 : _a.length) || 0) > 0)
|
|
116
|
+
return isAr ? (_c = (_b = user.role[0]) === null || _b === void 0 ? void 0 : _b.name) === null || _c === void 0 ? void 0 : _c.ar : (_e = (_d = user.role[0]) === null || _d === void 0 ? void 0 : _d.name) === null || _e === void 0 ? void 0 : _e.en;
|
|
117
|
+
if ((user === null || user === void 0 ? void 0 : user.type) === IndividualType.SHARE_HOLDER)
|
|
118
|
+
return t('type_share_holder');
|
|
119
|
+
if ((user === null || user === void 0 ? void 0 : user.type) === IndividualType.BOARD_MEMBER)
|
|
120
|
+
return t('type_board_member');
|
|
121
|
+
return t('type_user');
|
|
122
|
+
};
|
|
123
|
+
return (_jsx(ScreenContainerStyled, { children: usersMenuList.map(function (user, index) {
|
|
124
|
+
return (_jsxs(Box, __assign({ sx: index !== usersMenuList.length - 1 ? { borderBottom: "1px solid ".concat(alpha(theme.palette.divider, 0.8)) } : {} }, { children: [_jsxs(TextBoxStyled, __assign({ onClick: !!anchorEl && (activeUser === null || activeUser === void 0 ? void 0 : activeUser.id) === user.id ? function () { return onCloseUserAction(); } : function (e) { return onClickUser(user, e); } }, { children: [_jsxs(TextStyled, { children: [getName(user) || '', _jsx(RoleTextStyled, { children: getUserRole(user) || '' })] }), (user === null || user === void 0 ? void 0 : user.isRequestedEmail) ? _jsx(CheckIcon, {}) : _jsx(ExpandIcon, { anchorEl: !!anchorEl && (activeUser === null || activeUser === void 0 ? void 0 : activeUser.id) === user.id })] })), _jsx(Collapse, __assign({ in: !!anchorEl && (activeUser === null || activeUser === void 0 ? void 0 : activeUser.id) === user.id, timeout: 300 }, { children: _jsx(ListButton, { isAr: isAr, addDetails: {
|
|
125
|
+
show: true,
|
|
126
|
+
title: t('add_details'),
|
|
127
|
+
onClick: onAddDetails,
|
|
128
|
+
loading: (activeUser === null || activeUser === void 0 ? void 0 : activeUser.id) === user.id && loading && type === IndividualRequestType.ADD
|
|
129
|
+
}, requestEmail: {
|
|
130
|
+
show: true,
|
|
131
|
+
title: t('request_details_by_email'),
|
|
132
|
+
isRequested: (user === null || user === void 0 ? void 0 : user.isRequestedEmail) || false,
|
|
133
|
+
onClick: function () { return onRequestEmail(); },
|
|
134
|
+
loading: (activeUser === null || activeUser === void 0 ? void 0 : activeUser.id) === user.id && loading && type === IndividualRequestType.REQUEST_EMAIL
|
|
135
|
+
} }) }))] }), index));
|
|
136
|
+
}) }));
|
|
137
|
+
};
|
|
138
|
+
export default UserList;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
interface BirthCityProps {
|
|
3
|
+
show: boolean;
|
|
4
|
+
onListOpen?: () => void;
|
|
5
|
+
onListClose?: () => void;
|
|
6
|
+
}
|
|
7
|
+
declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponent<BirthCityProps & React.RefAttributes<unknown>>>;
|
|
8
|
+
export default _default;
|
|
@@ -0,0 +1,90 @@
|
|
|
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
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
13
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
14
|
+
if (ar || !(i in from)) {
|
|
15
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
16
|
+
ar[i] = from[i];
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
20
|
+
};
|
|
21
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
22
|
+
import * as React from 'react';
|
|
23
|
+
import Box from '@mui/material/Box';
|
|
24
|
+
import { useTranslation } from 'react-i18next';
|
|
25
|
+
import { useController, useFormContext } from 'react-hook-form';
|
|
26
|
+
import { styled } from '@mui/material/styles';
|
|
27
|
+
import CheckIcon from '@mui/icons-material/Check';
|
|
28
|
+
import { useAppSelector } from '../../../../hooks';
|
|
29
|
+
import Collapse from '../../../../components/Collapse';
|
|
30
|
+
import ExpandIcon from '../../../../components/ExpandIcon';
|
|
31
|
+
import Text from '../../../../components/Text';
|
|
32
|
+
import SimpleList from '../../../../components/SimpleList';
|
|
33
|
+
import ScreenContainer from '../../../shared/Containers/ScreenContainer';
|
|
34
|
+
import Input from '../../../shared/Input';
|
|
35
|
+
import { individualSelector } from '../../../app/individual/individualStore';
|
|
36
|
+
var CountryItemContainer = styled(Box)(function () { return ({
|
|
37
|
+
display: 'flex'
|
|
38
|
+
}); });
|
|
39
|
+
var CountryNameText = styled(Text, { shouldForwardProp: function (prop) { return prop !== 'isSelected'; } })(function (_a) {
|
|
40
|
+
var theme = _a.theme, isSelected = _a.isSelected;
|
|
41
|
+
return (__assign(__assign({ color: theme.palette.text.primary }, theme.typography.body2), { fontWeight: isSelected ? theme.typography.fontWeightMedium : theme.typography.fontWeightLight, paddingInlineStart: theme.spacing(1.25) }));
|
|
42
|
+
});
|
|
43
|
+
var CheckIconStyled = styled(CheckIcon)(function (_a) {
|
|
44
|
+
var theme = _a.theme;
|
|
45
|
+
return ({
|
|
46
|
+
color: theme.palette.success.main,
|
|
47
|
+
display: 'flex',
|
|
48
|
+
alignItems: 'flex-end'
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
var BirthCity = React.forwardRef(function (_a, ref) {
|
|
52
|
+
var _b;
|
|
53
|
+
var show = _a.show, onListOpen = _a.onListOpen, onListClose = _a.onListClose;
|
|
54
|
+
var _c = React.useState([]), locationCities = _c[0], setCities = _c[1];
|
|
55
|
+
var _d = React.useState(null), anchorEl = _d[0], setAnchorEl = _d[1];
|
|
56
|
+
var t = useTranslation().t;
|
|
57
|
+
var control = useFormContext().control;
|
|
58
|
+
var data = useAppSelector(individualSelector).data;
|
|
59
|
+
var cityList = (data.verify.responseBody || {}).cityList;
|
|
60
|
+
var placeOfBirthCityControl = useController({ control: control, name: 'placeOfBirthCity' });
|
|
61
|
+
React.useEffect(function () {
|
|
62
|
+
if ((cityList === null || cityList === void 0 ? void 0 : cityList.length) > 0) {
|
|
63
|
+
var list = __spreadArray([], cityList, true);
|
|
64
|
+
setCities(list);
|
|
65
|
+
}
|
|
66
|
+
}, [cityList]);
|
|
67
|
+
var onOpenCitySelect = function (event) {
|
|
68
|
+
setAnchorEl(event.currentTarget);
|
|
69
|
+
onListOpen === null || onListOpen === void 0 ? void 0 : onListOpen();
|
|
70
|
+
};
|
|
71
|
+
var onCloseCitySelect = function () {
|
|
72
|
+
setAnchorEl(null);
|
|
73
|
+
onListClose === null || onListClose === void 0 ? void 0 : onListClose();
|
|
74
|
+
setCities(cityList);
|
|
75
|
+
};
|
|
76
|
+
var onSelectItem = function (city) {
|
|
77
|
+
onCloseCitySelect();
|
|
78
|
+
placeOfBirthCityControl.field.onChange(city);
|
|
79
|
+
};
|
|
80
|
+
var getName = function (city) {
|
|
81
|
+
var _a;
|
|
82
|
+
return (_a = city === null || city === void 0 ? void 0 : city.name) === null || _a === void 0 ? void 0 : _a.en;
|
|
83
|
+
};
|
|
84
|
+
var cityValue = placeOfBirthCityControl.field.value;
|
|
85
|
+
var error = (_b = placeOfBirthCityControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
|
|
86
|
+
return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, __assign({ ref: ref, sx: { pt: 2.5 } }, { children: [_jsx(Input, { label: t('place_birth_city_label'), readOnly: true, placeholder: t('choose_place_birth_city'), value: getName(cityValue) || '', warningMessage: error && t(error), onClick: !!anchorEl ? function () { return onCloseCitySelect(); } : onOpenCitySelect, endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }) }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { searchKeyPath: 'name.en', searchValuePath: ['name.en'], list: locationCities, onSelectItem: onSelectItem, renderItem: function (item) {
|
|
87
|
+
return (_jsxs(_Fragment, { children: [_jsx(CountryItemContainer, { children: _jsx(CountryNameText, __assign({ isSelected: item.id === (cityValue === null || cityValue === void 0 ? void 0 : cityValue.id) }, { children: getName(item) })) }), item.id === (cityValue === null || cityValue === void 0 ? void 0 : cityValue.id) && _jsx(CheckIconStyled, {})] }));
|
|
88
|
+
} }) }))] })) })));
|
|
89
|
+
});
|
|
90
|
+
export default React.memo(BirthCity);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { CountryCode } from '../../../../@types';
|
|
3
|
+
interface BirthCountryProps {
|
|
4
|
+
countries: Array<CountryCode>;
|
|
5
|
+
show: boolean;
|
|
6
|
+
onListOpen?: () => void;
|
|
7
|
+
onListClose?: () => void;
|
|
8
|
+
}
|
|
9
|
+
declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponent<BirthCountryProps & React.RefAttributes<unknown>>>;
|
|
10
|
+
export default _default;
|
|
@@ -0,0 +1,82 @@
|
|
|
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
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
+
var t = {};
|
|
14
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
+
t[p] = s[p];
|
|
16
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
+
t[p[i]] = s[p[i]];
|
|
20
|
+
}
|
|
21
|
+
return t;
|
|
22
|
+
};
|
|
23
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
24
|
+
import * as React from 'react';
|
|
25
|
+
import Box from '@mui/material/Box';
|
|
26
|
+
import { useTranslation } from 'react-i18next';
|
|
27
|
+
import { useController, useFormContext } from 'react-hook-form';
|
|
28
|
+
import { styled } from '@mui/material/styles';
|
|
29
|
+
import CheckIcon from '@mui/icons-material/Check';
|
|
30
|
+
import { useLanguage } from '../../../../hooks';
|
|
31
|
+
import Collapse from '../../../../components/Collapse';
|
|
32
|
+
import ExpandIcon from '../../../../components/ExpandIcon';
|
|
33
|
+
import Text from '../../../../components/Text';
|
|
34
|
+
import SimpleList from '../../../../components/SimpleList';
|
|
35
|
+
import ScreenContainer from '../../../shared/Containers/ScreenContainer';
|
|
36
|
+
import Input from '../../../shared/Input';
|
|
37
|
+
var CountryItemContainer = styled(Box)(function () { return ({
|
|
38
|
+
display: 'flex'
|
|
39
|
+
}); });
|
|
40
|
+
var CountryNameText = styled(Text, { shouldForwardProp: function (prop) { return prop !== 'isSelected'; } })(function (_a) {
|
|
41
|
+
var theme = _a.theme, isSelected = _a.isSelected;
|
|
42
|
+
return (__assign(__assign({ color: theme.palette.text.primary }, theme.typography.body2), { fontWeight: isSelected ? theme.typography.fontWeightMedium : theme.typography.fontWeightLight, paddingInlineStart: theme.spacing(1.25) }));
|
|
43
|
+
});
|
|
44
|
+
var CheckIconStyled = styled(CheckIcon)(function (_a) {
|
|
45
|
+
var theme = _a.theme;
|
|
46
|
+
return ({
|
|
47
|
+
color: theme.palette.success.main,
|
|
48
|
+
display: 'flex',
|
|
49
|
+
alignItems: 'flex-end'
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
var BirthCountry = React.forwardRef(function (_a, ref) {
|
|
53
|
+
var _b, _c, _d;
|
|
54
|
+
var countries = _a.countries, rest = __rest(_a, ["countries"]);
|
|
55
|
+
var _e = React.useState(countries), locationCountries = _e[0], setCountries = _e[1];
|
|
56
|
+
var _f = React.useState(null), anchorEl = _f[0], setAnchorEl = _f[1];
|
|
57
|
+
var t = useTranslation().t;
|
|
58
|
+
var isAr = useLanguage().isAr;
|
|
59
|
+
var control = useFormContext().control;
|
|
60
|
+
var placeOfBirthCountryControl = useController({ control: control, name: 'placeOfBirthCountry' });
|
|
61
|
+
var onOpenCountrySelect = function (event) {
|
|
62
|
+
var _a;
|
|
63
|
+
setAnchorEl(event.currentTarget);
|
|
64
|
+
(_a = rest.onListOpen) === null || _a === void 0 ? void 0 : _a.call(rest);
|
|
65
|
+
};
|
|
66
|
+
var onCloseCountrySelect = function () {
|
|
67
|
+
var _a;
|
|
68
|
+
setAnchorEl(null);
|
|
69
|
+
(_a = rest.onListClose) === null || _a === void 0 ? void 0 : _a.call(rest);
|
|
70
|
+
setCountries(countries);
|
|
71
|
+
};
|
|
72
|
+
var onSelectItem = function (country) {
|
|
73
|
+
onCloseCountrySelect();
|
|
74
|
+
placeOfBirthCountryControl.field.onChange(country);
|
|
75
|
+
};
|
|
76
|
+
var location = placeOfBirthCountryControl.field.value;
|
|
77
|
+
var error = (_b = placeOfBirthCountryControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
|
|
78
|
+
return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, __assign({ ref: ref, sx: { pt: 2.5 } }, { children: [_jsx(Input, { label: t('place_of_birth_country_label'), readOnly: true, onClick: !!anchorEl ? function () { return onCloseCountrySelect(); } : onOpenCountrySelect, endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }), placeholder: t('choose_place_of_birth_country'), value: (isAr ? (_c = location === null || location === void 0 ? void 0 : location.name) === null || _c === void 0 ? void 0 : _c.arabic : (_d = location === null || location === void 0 ? void 0 : location.name) === null || _d === void 0 ? void 0 : _d.english) || '', warningMessage: error && t(error) }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { searchKeyPath: 'name.english', searchValuePath: ['idd_prefix', 'capital', 'name.arabic', 'name.english'], list: locationCountries, onSelectItem: onSelectItem, renderItem: function (item) {
|
|
79
|
+
return (_jsxs(_Fragment, { children: [_jsx(CountryItemContainer, { children: _jsx(CountryNameText, __assign({ isSelected: (item === null || item === void 0 ? void 0 : item.idd_prefix) === (location === null || location === void 0 ? void 0 : location.idd_prefix) }, { children: isAr ? item.name.arabic : item.name.english })) }), item.idd_prefix === (location === null || location === void 0 ? void 0 : location.idd_prefix) && _jsx(CheckIconStyled, {})] }));
|
|
80
|
+
} }) }))] })) })));
|
|
81
|
+
});
|
|
82
|
+
export default React.memo(BirthCountry);
|
|
@@ -0,0 +1,46 @@
|
|
|
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, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import * as React from 'react';
|
|
14
|
+
import { useTranslation } from 'react-i18next';
|
|
15
|
+
import { useController, useFormContext } from 'react-hook-form';
|
|
16
|
+
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
17
|
+
import { styled, alpha } from '@mui/material/styles';
|
|
18
|
+
import Text from '../../../../components/Text';
|
|
19
|
+
import Collapse from '../../../../components/Collapse';
|
|
20
|
+
import DatePicker from '../../../../components/DatePicker';
|
|
21
|
+
import { ScreenContainer } from '../../../shared/Containers';
|
|
22
|
+
import { individualSelector, clearError } from '../../../app/individual/individualStore';
|
|
23
|
+
var InputLabelStyled = styled(Text)(function (_a) {
|
|
24
|
+
var theme = _a.theme;
|
|
25
|
+
return (__assign(__assign({ color: alpha(theme.palette.text.primary, 0.4) }, theme.typography.caption), { cursor: 'pointer' }));
|
|
26
|
+
});
|
|
27
|
+
var BOD = function (_a) {
|
|
28
|
+
var _b;
|
|
29
|
+
var onDateClicked = _a.onDateClicked, show = _a.show;
|
|
30
|
+
var t = useTranslation().t;
|
|
31
|
+
var control = useFormContext().control;
|
|
32
|
+
var dispatch = useAppDispatch();
|
|
33
|
+
var dobControl = useController({ control: control, name: 'dob' });
|
|
34
|
+
var error = useAppSelector(individualSelector).error;
|
|
35
|
+
var handleBirthDateChange = function (data) {
|
|
36
|
+
if (error)
|
|
37
|
+
dispatch(clearError());
|
|
38
|
+
dobControl.field.onChange(data);
|
|
39
|
+
};
|
|
40
|
+
var dateValue = (_b = dobControl === null || dobControl === void 0 ? void 0 : dobControl.field) === null || _b === void 0 ? void 0 : _b.value;
|
|
41
|
+
return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, { children: [_jsx(InputLabelStyled, __assign({ sx: { p: function (_a) {
|
|
42
|
+
var spacing = _a.spacing;
|
|
43
|
+
return spacing(2.5, 2.5, 2.5, 2.5);
|
|
44
|
+
} } }, { children: t('enter_birth_date') })), _jsx(DatePicker, { readOnly: true, defaultValue: dateValue ? new Date(dateValue) : new Date(), dir: 'ltr', locale: 'en', onClick: function () { return onDateClicked === null || onDateClicked === void 0 ? void 0 : onDateClicked(true); }, onDatePicked: function () { return onDateClicked === null || onDateClicked === void 0 ? void 0 : onDateClicked(false); }, onDateChange: handleBirthDateChange })] }) })));
|
|
45
|
+
};
|
|
46
|
+
export default React.memo(BOD);
|
|
@@ -0,0 +1,50 @@
|
|
|
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 } from "react/jsx-runtime";
|
|
13
|
+
import * as React from 'react';
|
|
14
|
+
import { useTranslation } from 'react-i18next';
|
|
15
|
+
import { useController, useFormContext } from 'react-hook-form';
|
|
16
|
+
import { styled } from '@mui/material/styles';
|
|
17
|
+
import { useAppSelector } from '../../../../hooks';
|
|
18
|
+
import { FieldType } from '../../../../@types';
|
|
19
|
+
import Collapse from '../../../../components/Collapse';
|
|
20
|
+
import { ScreenContainer } from '../../../shared/Containers';
|
|
21
|
+
import Input from '../../../shared/Input';
|
|
22
|
+
import ClearIcon from '../../../shared/ClearIcon';
|
|
23
|
+
import CheckIcon from '../../../shared/CheckIcon';
|
|
24
|
+
import { individualSelector } from '../../../app/individual/individualStore';
|
|
25
|
+
var InputStyled = styled(Input)(function () { return ({
|
|
26
|
+
input: {
|
|
27
|
+
textTransform: 'lowercase'
|
|
28
|
+
}
|
|
29
|
+
}); });
|
|
30
|
+
var Email = function (_a) {
|
|
31
|
+
var _b, _c, _d;
|
|
32
|
+
var show = _a.show;
|
|
33
|
+
var t = useTranslation().t;
|
|
34
|
+
var control = useFormContext().control;
|
|
35
|
+
var emailControl = useController({ name: 'email', control: control });
|
|
36
|
+
var data = useAppSelector(individualSelector).data;
|
|
37
|
+
var emailValue = emailControl.field.value;
|
|
38
|
+
var error = (_b = emailControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
|
|
39
|
+
var verify = data.verify;
|
|
40
|
+
var user = (verify.responseBody || {}).user;
|
|
41
|
+
var handleEmailChange = function (event) {
|
|
42
|
+
emailControl.field.onChange(event.target.value);
|
|
43
|
+
};
|
|
44
|
+
var clearNumber = function () {
|
|
45
|
+
emailControl.field.onChange('');
|
|
46
|
+
};
|
|
47
|
+
var disabled = ((_d = (_c = user === null || user === void 0 ? void 0 : user.data_status) === null || _c === void 0 ? void 0 : _c.contact) === null || _d === void 0 ? void 0 : _d.email) === FieldType.NON_EDITABLE;
|
|
48
|
+
return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(ScreenContainer, { children: _jsx(InputStyled, { label: t('signup_email_lable'), value: emailValue, onChange: handleEmailChange, type: 'email', disabled: disabled, placeholder: t('signup_email_placeholder'), warningType: 'alert', warningMessage: error && t(error), endAdornment: !error && emailValue ? _jsx(CheckIcon, {}) : emailValue && _jsx(ClearIcon, { onClick: clearNumber }) }) }) })));
|
|
49
|
+
};
|
|
50
|
+
export default React.memo(Email);
|
|
@@ -0,0 +1,49 @@
|
|
|
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, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import * as React from 'react';
|
|
14
|
+
import { useTranslation } from 'react-i18next';
|
|
15
|
+
import { useController, useFormContext } from 'react-hook-form';
|
|
16
|
+
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
17
|
+
import { FieldType } from '../../../../@types';
|
|
18
|
+
import { styled, alpha } from '@mui/material/styles';
|
|
19
|
+
import Text from '../../../../components/Text';
|
|
20
|
+
import Collapse from '../../../../components/Collapse';
|
|
21
|
+
import DatePicker from '../../../../components/DatePicker';
|
|
22
|
+
import { ScreenContainer } from '../../../shared/Containers';
|
|
23
|
+
import { individualSelector, clearError } from '../../../app/individual/individualStore';
|
|
24
|
+
var InputLabelStyled = styled(Text)(function (_a) {
|
|
25
|
+
var theme = _a.theme;
|
|
26
|
+
return (__assign(__assign({ color: alpha(theme.palette.text.primary, 0.4) }, theme.typography.caption), { cursor: 'pointer' }));
|
|
27
|
+
});
|
|
28
|
+
var ExpiryDate = function (_a) {
|
|
29
|
+
var _b, _c, _d;
|
|
30
|
+
var onDateClicked = _a.onDateClicked, show = _a.show;
|
|
31
|
+
var t = useTranslation().t;
|
|
32
|
+
var control = useFormContext().control;
|
|
33
|
+
var dispatch = useAppDispatch();
|
|
34
|
+
var dobControl = useController({ control: control, name: 'expiryDate' });
|
|
35
|
+
var _e = useAppSelector(individualSelector), error = _e.error, data = _e.data;
|
|
36
|
+
var user = (data.verify.responseBody || {}).user;
|
|
37
|
+
var handleBirthDateChange = function (data) {
|
|
38
|
+
if (error)
|
|
39
|
+
dispatch(clearError());
|
|
40
|
+
dobControl.field.onChange(data);
|
|
41
|
+
};
|
|
42
|
+
var dateValue = (_b = dobControl === null || dobControl === void 0 ? void 0 : dobControl.field) === null || _b === void 0 ? void 0 : _b.value;
|
|
43
|
+
var disabled = ((_d = (_c = user === null || user === void 0 ? void 0 : user.data_status) === null || _c === void 0 ? void 0 : _c.identification) === null || _d === void 0 ? void 0 : _d.expiry) === FieldType.NON_EDITABLE;
|
|
44
|
+
return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, { children: [_jsx(InputLabelStyled, __assign({ sx: { p: function (_a) {
|
|
45
|
+
var spacing = _a.spacing;
|
|
46
|
+
return spacing(2.5, 2.5, 2.5, 2.5);
|
|
47
|
+
} } }, { children: t('enter_expiry_date') })), _jsx(DatePicker, { readOnly: true, disabled: disabled, defaultValue: dateValue ? new Date(dateValue) : new Date(), dir: 'ltr', locale: 'en', onClick: disabled ? undefined : function () { return onDateClicked === null || onDateClicked === void 0 ? void 0 : onDateClicked(true); }, onDatePicked: function () { return onDateClicked === null || onDateClicked === void 0 ? void 0 : onDateClicked(false); }, onDateChange: handleBirthDateChange })] }) })));
|
|
48
|
+
};
|
|
49
|
+
export default React.memo(ExpiryDate);
|