@tap-payments/auth-jsconnect 2.4.58-test → 2.4.60-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 +11 -0
- package/build/@types/user.d.ts +18 -1
- package/build/api/data.js +1 -1
- package/build/api/individual.d.ts +3 -1
- package/build/app/settings.js +3 -1
- package/build/features/app/individual/individualStore.d.ts +3 -1
- package/build/features/app/individual/individualStore.js +14 -15
- package/build/features/individual/screens/AdditionalIndividualInfo/Occupation.d.ts +0 -2
- package/build/features/individual/screens/AdditionalIndividualInfo/Occupation.js +89 -34
- package/package.json +1 -1
package/build/@types/app.d.ts
CHANGED
|
@@ -145,10 +145,21 @@ export interface SourceOfIncome {
|
|
|
145
145
|
}
|
|
146
146
|
export interface Occupation {
|
|
147
147
|
id: string;
|
|
148
|
+
code: string;
|
|
148
149
|
name: {
|
|
149
150
|
ar: string;
|
|
150
151
|
en: string;
|
|
151
152
|
};
|
|
153
|
+
section_code?: string;
|
|
154
|
+
sub?: Array<{
|
|
155
|
+
id: string;
|
|
156
|
+
code: string;
|
|
157
|
+
name: {
|
|
158
|
+
ar: string;
|
|
159
|
+
en: string;
|
|
160
|
+
};
|
|
161
|
+
part_code: string;
|
|
162
|
+
}>;
|
|
152
163
|
}
|
|
153
164
|
export interface TeamSize {
|
|
154
165
|
id: string;
|
package/build/@types/user.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ export interface User {
|
|
|
12
12
|
is_authorized: boolean;
|
|
13
13
|
verification: Verification;
|
|
14
14
|
source_income: Role[];
|
|
15
|
-
occupation:
|
|
15
|
+
occupation: UserOccupation;
|
|
16
16
|
entities: Entity[];
|
|
17
17
|
documents: string[];
|
|
18
18
|
monthly_income: Role;
|
|
@@ -34,6 +34,23 @@ export interface User {
|
|
|
34
34
|
objects: Array<string>;
|
|
35
35
|
isRequestedEmail?: boolean;
|
|
36
36
|
}
|
|
37
|
+
interface UserOccupation {
|
|
38
|
+
chapter: OccupationData & {
|
|
39
|
+
section_code: string;
|
|
40
|
+
};
|
|
41
|
+
part: OccupationData & {
|
|
42
|
+
type_code: string;
|
|
43
|
+
};
|
|
44
|
+
section: OccupationData & {
|
|
45
|
+
part_code: string;
|
|
46
|
+
};
|
|
47
|
+
type: OccupationData;
|
|
48
|
+
}
|
|
49
|
+
interface OccupationData {
|
|
50
|
+
code: string;
|
|
51
|
+
id: string;
|
|
52
|
+
name: Name;
|
|
53
|
+
}
|
|
37
54
|
interface DataVerification {
|
|
38
55
|
status: string;
|
|
39
56
|
name: string;
|
package/build/api/data.js
CHANGED
|
@@ -125,7 +125,9 @@ export type UpdateIndividualBody = {
|
|
|
125
125
|
is_influencer?: boolean | null;
|
|
126
126
|
documents?: Array<DocumentInfo | undefined>;
|
|
127
127
|
occupation?: {
|
|
128
|
-
|
|
128
|
+
chapter: {
|
|
129
|
+
id: string;
|
|
130
|
+
};
|
|
129
131
|
};
|
|
130
132
|
step_name?: string;
|
|
131
133
|
encryption_contract?: Array<string>;
|
package/build/app/settings.js
CHANGED
|
@@ -140,9 +140,11 @@ export var fetchAppSettingsSync = createAsyncThunk('fetchAppSettingsSync', funct
|
|
|
140
140
|
isValidOperator = operator === 'valid';
|
|
141
141
|
countries = sortCountries(list);
|
|
142
142
|
countryCode = appConfig.businessCountryCode;
|
|
143
|
+
if (maturity === 'express' && (merchant === null || merchant === void 0 ? void 0 : merchant.country_code))
|
|
144
|
+
countryCode = merchant === null || merchant === void 0 ? void 0 : merchant.country_code;
|
|
143
145
|
isKWOrSA = isKW(countryCode) || isSA(countryCode);
|
|
144
146
|
if (!isKWOrSA)
|
|
145
|
-
countryCode = '
|
|
147
|
+
countryCode = 'KW';
|
|
146
148
|
businessCountry = findCountryByIso2(countries, countryCode);
|
|
147
149
|
if (!businessCountry)
|
|
148
150
|
throw new Error('Business country not found, you have to pass a valid business country code in the lib config');
|
|
@@ -134,7 +134,9 @@ export declare const retrieveIndividualInfo: import("@reduxjs/toolkit").AsyncThu
|
|
|
134
134
|
export declare const retrieveDataList: import("@reduxjs/toolkit").AsyncThunk<{
|
|
135
135
|
sourceIncome: any;
|
|
136
136
|
monthlyIncome: any;
|
|
137
|
-
occupation:
|
|
137
|
+
occupation: {
|
|
138
|
+
list: any;
|
|
139
|
+
};
|
|
138
140
|
}, string, {
|
|
139
141
|
state?: unknown;
|
|
140
142
|
dispatch?: import("redux").Dispatch<import("redux").AnyAction> | undefined;
|
|
@@ -358,7 +358,7 @@ export var retrieveIndividualInfo = createAsyncThunk('individual/retrieveIndivid
|
|
|
358
358
|
});
|
|
359
359
|
}); });
|
|
360
360
|
export var retrieveDataList = createAsyncThunk('individualRetrieveDataList', function (countryCode) { return __awaiter(void 0, void 0, void 0, function () {
|
|
361
|
-
var monthlyIncomeBody, dataBody, _a, sourceIncome, monthlyIncome, occupation;
|
|
361
|
+
var monthlyIncomeBody, dataBody, _a, sourceIncome, monthlyIncome, occupationData, occupation, mappedOccupation;
|
|
362
362
|
return __generator(this, function (_b) {
|
|
363
363
|
switch (_b.label) {
|
|
364
364
|
case 0:
|
|
@@ -375,11 +375,16 @@ export var retrieveDataList = createAsyncThunk('individualRetrieveDataList', fun
|
|
|
375
375
|
API.dataService.getOccupation(dataBody)
|
|
376
376
|
])];
|
|
377
377
|
case 1:
|
|
378
|
-
_a = _b.sent(), sourceIncome = _a[0], monthlyIncome = _a[1],
|
|
378
|
+
_a = _b.sent(), sourceIncome = _a[0], monthlyIncome = _a[1], occupationData = _a[2];
|
|
379
|
+
occupation = (occupationData === null || occupationData === void 0 ? void 0 : occupationData.occupation) || {};
|
|
380
|
+
mappedOccupation = (occupation.section || []).map(function (section) {
|
|
381
|
+
var sub = (occupation.chapter || []).filter(function (chapter) { return chapter.section_code === section.code; });
|
|
382
|
+
return __assign(__assign({}, section), { sub: sub });
|
|
383
|
+
});
|
|
379
384
|
return [2, {
|
|
380
385
|
sourceIncome: sourceIncome,
|
|
381
386
|
monthlyIncome: monthlyIncome,
|
|
382
|
-
occupation:
|
|
387
|
+
occupation: { list: mappedOccupation || [] }
|
|
383
388
|
}];
|
|
384
389
|
}
|
|
385
390
|
});
|
|
@@ -655,7 +660,7 @@ export var updateIndividualInfo = createAsyncThunk('updateIndividualInfo', funct
|
|
|
655
660
|
isSharesAvailable = shareCount || shareValue;
|
|
656
661
|
pepInfo = isPEPNonEditable ? undefined : isPEP;
|
|
657
662
|
influencerInfo = isInfluencerNonEditable ? undefined : isInfluencer;
|
|
658
|
-
occupationInfo = isOccupationNonEditable || !(occupation === null || occupation === void 0 ? void 0 : occupation.id) ? undefined : { id: occupation.id };
|
|
663
|
+
occupationInfo = isOccupationNonEditable || !(occupation === null || occupation === void 0 ? void 0 : occupation.id) ? undefined : { chapter: { id: occupation.id } };
|
|
659
664
|
sourceIncomeInfo = isSourceIncomeNonEditable || !(sourceIncome === null || sourceIncome === void 0 ? void 0 : sourceIncome.id) ? undefined : [{ id: sourceIncome.id }];
|
|
660
665
|
monthlyIncomeInfo = isMonthlyIncomeNonEditable || !(monthlyIncome === null || monthlyIncome === void 0 ? void 0 : monthlyIncome.id) ? undefined : { id: monthlyIncome.id };
|
|
661
666
|
userPayload = {
|
|
@@ -955,7 +960,7 @@ export var individualSlice = createSlice({
|
|
|
955
960
|
state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), { userList: userList });
|
|
956
961
|
state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), { userList: userList, user: __assign(__assign({}, user), { is_authorized: (user === null || user === void 0 ? void 0 : user.is_authorized) !== undefined ? user === null || user === void 0 ? void 0 : user.is_authorized : primaryUser === null || primaryUser === void 0 ? void 0 : primaryUser.is_authorized }) });
|
|
957
962
|
var _f = user || {}, source_income = _f.source_income, monthly_income = _f.monthly_income, occupation = _f.occupation, is_relative_PEP = _f.is_relative_PEP, is_influencer = _f.is_influencer, birth = _f.birth, contact = _f.contact, identification = _f.identification, nationality = _f.nationality, gender = _f.gender, shares = _f.shares;
|
|
958
|
-
var _g = state.data.individualData.responseBody || {}, sourceIncomeList = _g.sourceIncomeList, monthlyIncomeList = _g.monthlyIncomeList
|
|
963
|
+
var _g = state.data.individualData.responseBody || {}, sourceIncomeList = _g.sourceIncomeList, monthlyIncomeList = _g.monthlyIncomeList;
|
|
959
964
|
var cityList = (state.data.verify.responseBody || {}).cityList;
|
|
960
965
|
if (user)
|
|
961
966
|
state.data.individualPersonalData.name = getUserName(user, false);
|
|
@@ -1005,9 +1010,7 @@ export var individualSlice = createSlice({
|
|
|
1005
1010
|
var selectedMonthlyIncome = monthlyIncomeList === null || monthlyIncomeList === void 0 ? void 0 : monthlyIncomeList.find(function (income) {
|
|
1006
1011
|
return income.id === (monthly_income === null || monthly_income === void 0 ? void 0 : monthly_income.id);
|
|
1007
1012
|
});
|
|
1008
|
-
var selectedOccupation =
|
|
1009
|
-
return occup.id === (occupation === null || occupation === void 0 ? void 0 : occupation.id);
|
|
1010
|
-
});
|
|
1013
|
+
var selectedOccupation = (occupation === null || occupation === void 0 ? void 0 : occupation.chapter) || (occupation === null || occupation === void 0 ? void 0 : occupation.section);
|
|
1011
1014
|
state.data.individualData.monthlyIncome = selectedMonthlyIncome;
|
|
1012
1015
|
state.data.individualData.occupation = selectedOccupation;
|
|
1013
1016
|
if (is_relative_PEP !== undefined)
|
|
@@ -1050,7 +1053,7 @@ export var individualSlice = createSlice({
|
|
|
1050
1053
|
var user = (state.data.verify.responseBody || {}).user;
|
|
1051
1054
|
state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), { primaryUser: data, user: __assign(__assign({}, data), { is_authorized: data.is_authorized !== undefined ? data.is_authorized : user === null || user === void 0 ? void 0 : user.is_authorized }) });
|
|
1052
1055
|
var _f = data || {}, source_income = _f.source_income, monthly_income = _f.monthly_income, occupation = _f.occupation, is_relative_PEP = _f.is_relative_PEP, is_influencer = _f.is_influencer, birth = _f.birth, contact = _f.contact, identification = _f.identification, nationality = _f.nationality, gender = _f.gender, shares = _f.shares;
|
|
1053
|
-
var _g = state.data.individualData.responseBody || {}, sourceIncomeList = _g.sourceIncomeList, monthlyIncomeList = _g.monthlyIncomeList
|
|
1056
|
+
var _g = state.data.individualData.responseBody || {}, sourceIncomeList = _g.sourceIncomeList, monthlyIncomeList = _g.monthlyIncomeList;
|
|
1054
1057
|
var cityList = (state.data.verify.responseBody || {}).cityList;
|
|
1055
1058
|
if (data)
|
|
1056
1059
|
state.data.individualPersonalData.name = getUserName(data, false);
|
|
@@ -1100,9 +1103,7 @@ export var individualSlice = createSlice({
|
|
|
1100
1103
|
var selectedMonthlyIncome = monthlyIncomeList === null || monthlyIncomeList === void 0 ? void 0 : monthlyIncomeList.find(function (income) {
|
|
1101
1104
|
return income.id === (monthly_income === null || monthly_income === void 0 ? void 0 : monthly_income.id);
|
|
1102
1105
|
});
|
|
1103
|
-
var selectedOccupation =
|
|
1104
|
-
return occup.id === (occupation === null || occupation === void 0 ? void 0 : occupation.id);
|
|
1105
|
-
});
|
|
1106
|
+
var selectedOccupation = (occupation === null || occupation === void 0 ? void 0 : occupation.chapter) || (occupation === null || occupation === void 0 ? void 0 : occupation.section);
|
|
1106
1107
|
state.data.individualData.monthlyIncome = selectedMonthlyIncome;
|
|
1107
1108
|
state.data.individualData.occupation = selectedOccupation;
|
|
1108
1109
|
state.data.individualData.isPEP = is_relative_PEP;
|
|
@@ -1145,9 +1146,7 @@ export var individualSlice = createSlice({
|
|
|
1145
1146
|
var selectedMonthlyIncome = monthlyIncomeList === null || monthlyIncomeList === void 0 ? void 0 : monthlyIncomeList.find(function (income) {
|
|
1146
1147
|
return income.id === (monthly_income === null || monthly_income === void 0 ? void 0 : monthly_income.id);
|
|
1147
1148
|
});
|
|
1148
|
-
var selectedOccupation =
|
|
1149
|
-
return occup.id === (occupation === null || occupation === void 0 ? void 0 : occupation.id);
|
|
1150
|
-
});
|
|
1149
|
+
var selectedOccupation = (occupation === null || occupation === void 0 ? void 0 : occupation.chapter) || (occupation === null || occupation === void 0 ? void 0 : occupation.section);
|
|
1151
1150
|
state.data.individualData.monthlyIncome = selectedMonthlyIncome;
|
|
1152
1151
|
state.data.individualData.occupation = selectedOccupation;
|
|
1153
1152
|
})
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { Occupation as OccupationType } from '../../../../@types';
|
|
3
2
|
interface OccupationProps {
|
|
4
3
|
show: boolean;
|
|
5
|
-
onSelectOccupation?: (occupation: OccupationType) => void;
|
|
6
4
|
onListOpen?: () => void;
|
|
7
5
|
onListClose?: () => void;
|
|
8
6
|
readOnly?: boolean;
|
|
@@ -9,67 +9,122 @@ var __assign = (this && this.__assign) || function () {
|
|
|
9
9
|
};
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
|
-
import { jsx as _jsx,
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
13
|
import * as React from 'react';
|
|
14
|
-
import { useTranslation } from 'react-i18next';
|
|
15
14
|
import { useController, useFormContext } from 'react-hook-form';
|
|
15
|
+
import { useTranslation } from 'react-i18next';
|
|
16
16
|
import Box from '@mui/material/Box';
|
|
17
17
|
import { styled } from '@mui/material/styles';
|
|
18
|
-
import {
|
|
19
|
-
import
|
|
18
|
+
import { useLanguage, useAppSelector, useAppDispatch } from '../../../../hooks';
|
|
19
|
+
import { isExist } from '../../../../utils';
|
|
20
20
|
import SimpleList from '../../../../components/SimpleList';
|
|
21
|
+
import Text from '../../../../components/Text';
|
|
21
22
|
import Collapse from '../../../../components/Collapse';
|
|
22
|
-
import
|
|
23
|
+
import ExpandIcon from '../../../../components/ExpandIcon';
|
|
24
|
+
import { ScreenContainer } from '../../../shared/Containers';
|
|
25
|
+
import Search from '../../../shared/Search';
|
|
26
|
+
import { individualSelector, clearError } from '../../../app/individual/individualStore';
|
|
23
27
|
import InputSelect from '../../../shared/InputSelect';
|
|
24
|
-
import { EndAdornmentExpanded } from '../../../shared/EndAdornment';
|
|
25
28
|
import CheckIcon from '../../../shared/CheckIcon';
|
|
26
|
-
|
|
27
|
-
var Container = styled(Box)(function () { return ({
|
|
28
|
-
display: 'flex'
|
|
29
|
-
}); });
|
|
30
|
-
var IncomeText = styled(Text, { shouldForwardProp: function (prop) { return prop !== 'isSelected'; } })(function (_a) {
|
|
29
|
+
var NameContainer = styled(Text, { shouldForwardProp: function (prop) { return prop !== 'isSelected'; } })(function (_a) {
|
|
31
30
|
var theme = _a.theme, isSelected = _a.isSelected;
|
|
32
31
|
return (__assign(__assign({ color: theme.palette.text.primary }, theme.typography.body2), { fontWeight: isSelected ? theme.typography.fontWeightMedium : theme.typography.fontWeightLight, paddingInlineStart: theme.spacing(1.25) }));
|
|
33
32
|
});
|
|
33
|
+
var ListItem = styled(Box)(function (_a) {
|
|
34
|
+
var theme = _a.theme;
|
|
35
|
+
return ({
|
|
36
|
+
display: 'flex',
|
|
37
|
+
justifyContent: 'space-between',
|
|
38
|
+
width: '100%',
|
|
39
|
+
paddingInlineStart: theme.spacing(2.5),
|
|
40
|
+
paddingInlineEnd: theme.spacing(2.5),
|
|
41
|
+
paddingTop: theme.spacing(1.5),
|
|
42
|
+
paddingBottom: theme.spacing(1.5)
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
var ListItemContainer = styled(Box)(function () { return ({
|
|
46
|
+
display: 'flex',
|
|
47
|
+
flexDirection: 'column',
|
|
48
|
+
width: '100%'
|
|
49
|
+
}); });
|
|
50
|
+
var SimpleListStyled = styled((SimpleList))(function () { return ({
|
|
51
|
+
height: 'fit-content'
|
|
52
|
+
}); });
|
|
34
53
|
var Occupation = function (props) {
|
|
35
54
|
var _a, _b;
|
|
36
|
-
var _c = React.useState([]),
|
|
55
|
+
var _c = React.useState([]), occupation = _c[0], setOccupation = _c[1];
|
|
37
56
|
var _d = React.useState(null), anchorEl = _d[0], setAnchorEl = _d[1];
|
|
57
|
+
var _e = React.useState(''), subIndex = _e[0], setSubIndex = _e[1];
|
|
38
58
|
var t = useTranslation().t;
|
|
39
59
|
var isAr = useLanguage().isAr;
|
|
40
60
|
var dispatch = useAppDispatch();
|
|
41
|
-
var
|
|
61
|
+
var _f = useAppSelector(individualSelector), data = _f.data, bckError = _f.error;
|
|
42
62
|
var control = useFormContext().control;
|
|
43
|
-
var
|
|
44
|
-
var
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
63
|
+
var occupationControl = useController({ name: 'occupation', control: control });
|
|
64
|
+
var occupationList = (data.individualData.responseBody || {}).occupationList;
|
|
65
|
+
var occupationValue = occupationControl.field.value;
|
|
66
|
+
var handleCloseMainMenu = function () {
|
|
67
|
+
var _a;
|
|
68
|
+
setAnchorEl(null);
|
|
69
|
+
handleSearch('');
|
|
70
|
+
(_a = props.onListClose) === null || _a === void 0 ? void 0 : _a.call(props);
|
|
71
|
+
};
|
|
72
|
+
var handleOpenMainMenu = function (event) {
|
|
51
73
|
var _a;
|
|
52
|
-
if (props.readOnly)
|
|
53
|
-
return;
|
|
54
74
|
setAnchorEl(event.currentTarget);
|
|
55
75
|
(_a = props.onListOpen) === null || _a === void 0 ? void 0 : _a.call(props);
|
|
56
76
|
};
|
|
57
|
-
var
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
77
|
+
var handleOpenSubMenu = function (index) {
|
|
78
|
+
if (subIndex === index)
|
|
79
|
+
setSubIndex('');
|
|
80
|
+
else
|
|
81
|
+
setSubIndex(index);
|
|
82
|
+
};
|
|
83
|
+
var handleCloseSubMenu = function () {
|
|
84
|
+
setSubIndex('');
|
|
85
|
+
handleCloseMainMenu();
|
|
61
86
|
};
|
|
87
|
+
React.useEffect(function () {
|
|
88
|
+
if ((occupationList === null || occupationList === void 0 ? void 0 : occupationList.length) > 0) {
|
|
89
|
+
setOccupation(occupationList);
|
|
90
|
+
}
|
|
91
|
+
}, [occupationList]);
|
|
62
92
|
var onSelectItem = function (occupation) {
|
|
63
93
|
if (bckError)
|
|
64
94
|
dispatch(clearError());
|
|
65
|
-
|
|
95
|
+
handleCloseSubMenu();
|
|
66
96
|
occupationControl.field.onChange(occupation);
|
|
67
97
|
};
|
|
68
|
-
var
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
98
|
+
var handleSearch = function (value) {
|
|
99
|
+
var filteredList = occupationList === null || occupationList === void 0 ? void 0 : occupationList.filter(function (chapter) {
|
|
100
|
+
var _a, _b, _c;
|
|
101
|
+
return chapter.name.en.toLowerCase().includes(value.toLowerCase()) ||
|
|
102
|
+
chapter.name.en.toLowerCase().replace(',', '').includes(value.toLowerCase()) ||
|
|
103
|
+
chapter.name.ar.toLowerCase().includes(value.toLowerCase()) ||
|
|
104
|
+
((_a = chapter.sub) === null || _a === void 0 ? void 0 : _a.find(function (obj) { return obj.name.en.toLowerCase().includes(value.toLowerCase()); })) ||
|
|
105
|
+
((_b = chapter.sub) === null || _b === void 0 ? void 0 : _b.find(function (obj) { return obj.name.en.toLowerCase().replace(',', '').includes(value.toLowerCase()); })) ||
|
|
106
|
+
((_c = chapter.sub) === null || _c === void 0 ? void 0 : _c.find(function (obj) { return obj.name.ar.toLowerCase().includes(value.toLowerCase()); }));
|
|
107
|
+
});
|
|
108
|
+
setOccupation(filteredList);
|
|
109
|
+
};
|
|
110
|
+
React.useEffect(function () {
|
|
111
|
+
var item = isExist(occupationList || [], occupationValue === null || occupationValue === void 0 ? void 0 : occupationValue.code);
|
|
112
|
+
if (item)
|
|
113
|
+
setSubIndex(item.code);
|
|
114
|
+
}, [anchorEl, occupationValue]);
|
|
115
|
+
return (_jsx(Collapse, __assign({ in: props.show }, { children: _jsxs(ScreenContainer, __assign({ sx: { pb: 2.5 } }, { children: [_jsx(InputSelect, { required: true, label: t('occupation_title'), value: (isAr ? (_a = occupationValue === null || occupationValue === void 0 ? void 0 : occupationValue.name) === null || _a === void 0 ? void 0 : _a.ar : (_b = occupationValue === null || occupationValue === void 0 ? void 0 : occupationValue.name) === null || _b === void 0 ? void 0 : _b.en) || '', readOnly: props.readOnly, onClick: !!anchorEl ? handleCloseMainMenu : handleOpenMainMenu, placeholder: t('choose_any_occupation'), endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }) }), _jsxs(Collapse, __assign({ in: !!anchorEl }, { children: [_jsx(Search, { onSearchValue: handleSearch }), _jsx(SimpleListStyled, { sx: { maxHeight: '350px', paddingTop: 0 }, list: occupation, listItemProps: { sx: { padding: 0 } }, onSelectItem: function (item) {
|
|
116
|
+
var isOnlyOneItem = !item.sub || item.sub.length === 1;
|
|
117
|
+
if (isOnlyOneItem)
|
|
118
|
+
onSelectItem(item);
|
|
119
|
+
else
|
|
120
|
+
handleOpenSubMenu(item.code);
|
|
121
|
+
}, renderItem: function (item) {
|
|
122
|
+
var _a;
|
|
123
|
+
var isOnlyOneItem = !item.sub || ((_a = item.sub) === null || _a === void 0 ? void 0 : _a.length) === 1;
|
|
124
|
+
var showCheck = item.code === (occupationValue === null || occupationValue === void 0 ? void 0 : occupationValue.code) && isOnlyOneItem;
|
|
125
|
+
return (_jsxs(ListItemContainer, { children: [_jsxs(ListItem, __assign({ sx: __assign({ bgcolor: 'rgb(196 184 184 / 8%)', borderBottom: '1px solid rgba(227, 232, 238, 0.8)' }, (isOnlyOneItem && { bgcolor: 'inherit', borderBottom: 'none' })) }, { children: [_jsx(NameContainer, __assign({ isSelected: item.code === (occupationValue === null || occupationValue === void 0 ? void 0 : occupationValue.section_code), sx: __assign({}, (isOnlyOneItem && { paddingInlineStart: '5px' })) }, { children: isAr ? item.name.ar : item.name.en })), showCheck ? _jsx(CheckIcon, {}) : !isOnlyOneItem && _jsx(ExpandIcon, { anchorEl: subIndex === item.code })] })), _jsx(Collapse, __assign({ in: item.code === subIndex && !isOnlyOneItem }, { children: _jsx(SimpleListStyled, { sx: { pt: 0, pb: 0 }, list: (!isOnlyOneItem && item.sub) || [], onSelectItem: onSelectItem, listItemProps: { sx: { padding: 0, '&:last-child': { paddingBottom: 0 } } }, renderItem: function (item, idx) {
|
|
126
|
+
return (_jsxs(ListItem, __assign({ sx: { mt: idx === 0 ? 1 : 0 } }, { children: [_jsx(NameContainer, __assign({ isSelected: item.code === (occupationValue === null || occupationValue === void 0 ? void 0 : occupationValue.code) }, { children: isAr ? item.name.ar : item.name.en })), item.code === (occupationValue === null || occupationValue === void 0 ? void 0 : occupationValue.code) && _jsx(CheckIcon, {})] })));
|
|
127
|
+
} }) }))] }));
|
|
128
|
+
} })] }))] })) })));
|
|
74
129
|
};
|
|
75
130
|
export default Occupation;
|