@djb25/digit-ui-module-vendor 1.0.64 → 1.0.65
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +156 -42
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +158 -44
- package/dist/index.modern.js.map +1 -1
- package/package.json +1 -1
package/dist/index.modern.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import React, { useState, useEffect, useCallback, useReducer,
|
|
1
|
+
import React, { useState, useMemo, useEffect, useCallback, useReducer, useRef } from 'react';
|
|
2
2
|
import { useHistory, Link, useLocation, useParams, useRouteMatch, Switch, Route, Redirect } from 'react-router-dom';
|
|
3
3
|
import { useTranslation } from 'react-i18next';
|
|
4
|
-
import { VerticalTimeline, FormComposer, Toast, Card, ShippingTruck, Table, CheckBox,
|
|
4
|
+
import { Loader, VerticalTimeline, FormComposer, Toast, Card, ShippingTruck, Table, CheckBox, RadioButtons, CloseSvg, Localities, RemoveableTag, ActionBar, ApplyFilterBar, Dropdown, AddIcon, Menu, LinkLabel, SubmitBar, TextInput, DatePicker as DatePicker$4, ViewsIcon, ToggleSwitch, Modal, MdClose, CardSectionHeader, CardText, Row, EditIcon, DeleteIcon, Header, SearchForm, SearchField, MobileNumber, CardLabelError, AppContainer, ModuleHeader, ArrowLeft, PrivateRoute, LayoutWrapper, HomeIcon, PropertyHouse, EmployeeModuleCard, FormStep, LabelFieldPair, CardLabel, UploadFile, RadioOrSelect, MultiSelectDropdown, CitizenHomeCard, CardHeader, CardSubHeader, StatusTable, LinkButton, Banner, InfoIcon, CustomTooltip } from '@djb25/digit-ui-react-components';
|
|
5
5
|
import { useQueryClient } from 'react-query';
|
|
6
6
|
import { useForm, Controller } from 'react-hook-form';
|
|
7
7
|
|
|
@@ -123,6 +123,22 @@ const SurveyorConfig = function (t, agencies, reportingManagers, disabled) {
|
|
|
123
123
|
},
|
|
124
124
|
className: "payment-form-text-input-correction"
|
|
125
125
|
}
|
|
126
|
+
}, {
|
|
127
|
+
label: t("ES_VENDOR_ZONE"),
|
|
128
|
+
isMandatory: true,
|
|
129
|
+
type: "component",
|
|
130
|
+
key: "zoneIds",
|
|
131
|
+
populators: {
|
|
132
|
+
name: "zoneIds",
|
|
133
|
+
validation: {
|
|
134
|
+
required: true
|
|
135
|
+
},
|
|
136
|
+
className: "mb-16"
|
|
137
|
+
},
|
|
138
|
+
props: {
|
|
139
|
+
isMultiSelect: false
|
|
140
|
+
},
|
|
141
|
+
component: "SelectEkycZones"
|
|
126
142
|
}, {
|
|
127
143
|
label: t("ES_VENDOR_SURVEYOR_DESCRIPTION"),
|
|
128
144
|
isMandatory: false,
|
|
@@ -136,7 +152,7 @@ const SurveyorConfig = function (t, agencies, reportingManagers, disabled) {
|
|
|
136
152
|
};
|
|
137
153
|
|
|
138
154
|
const AddSurveyor = _ref => {
|
|
139
|
-
var _Digit$UserService$ge;
|
|
155
|
+
var _Digit$UserService$ge, _userInfo$roles;
|
|
140
156
|
const _useTranslation = useTranslation(),
|
|
141
157
|
t = _useTranslation.t;
|
|
142
158
|
const history = useHistory();
|
|
@@ -153,14 +169,63 @@ const AddSurveyor = _ref => {
|
|
|
153
169
|
setCanSubmit = _useState2[1];
|
|
154
170
|
const _Digit$Hooks$fsm$useS = Digit.Hooks.fsm.useSurveyorCreate(tenantId),
|
|
155
171
|
mutateAsync = _Digit$Hooks$fsm$useS.mutateAsync;
|
|
156
|
-
const
|
|
157
|
-
const
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
172
|
+
const isSupervisor = userInfo === null || userInfo === void 0 ? void 0 : (_userInfo$roles = userInfo.roles) === null || _userInfo$roles === void 0 ? void 0 : _userInfo$roles.some(role => role.code === "EKYC_SUPERVISOR");
|
|
173
|
+
const _Digit$Hooks$fsm$useS2 = Digit.Hooks.fsm.useSupervisorSearch(tenantId, {
|
|
174
|
+
status: "ACTIVE"
|
|
175
|
+
}, {
|
|
176
|
+
enabled: isSupervisor,
|
|
177
|
+
staleTime: Infinity
|
|
178
|
+
}),
|
|
179
|
+
supervisorSearchResponse = _Digit$Hooks$fsm$useS2.data,
|
|
180
|
+
isSupervisorSearchLoading = _Digit$Hooks$fsm$useS2.isLoading;
|
|
181
|
+
const matchedSupervisor = useMemo(() => {
|
|
182
|
+
if (!(supervisorSearchResponse !== null && supervisorSearchResponse !== void 0 && supervisorSearchResponse.supervisors)) return null;
|
|
183
|
+
return supervisorSearchResponse.supervisors.find(s => {
|
|
184
|
+
var _s$id, _userInfo$uuid, _s$owner, _s$owner$uuid, _userInfo$uuid2, _s$owner2;
|
|
185
|
+
return ((_s$id = s.id) === null || _s$id === void 0 ? void 0 : _s$id.toLowerCase()) === (userInfo === null || userInfo === void 0 ? void 0 : (_userInfo$uuid = userInfo.uuid) === null || _userInfo$uuid === void 0 ? void 0 : _userInfo$uuid.toLowerCase()) || ((_s$owner = s.owner) === null || _s$owner === void 0 ? void 0 : (_s$owner$uuid = _s$owner.uuid) === null || _s$owner$uuid === void 0 ? void 0 : _s$owner$uuid.toLowerCase()) === (userInfo === null || userInfo === void 0 ? void 0 : (_userInfo$uuid2 = userInfo.uuid) === null || _userInfo$uuid2 === void 0 ? void 0 : _userInfo$uuid2.toLowerCase()) || ((_s$owner2 = s.owner) === null || _s$owner2 === void 0 ? void 0 : _s$owner2.mobileNumber) === (userInfo === null || userInfo === void 0 ? void 0 : userInfo.mobileNumber) || s.mobileNo === (userInfo === null || userInfo === void 0 ? void 0 : userInfo.mobileNumber);
|
|
186
|
+
});
|
|
187
|
+
}, [supervisorSearchResponse, userInfo]);
|
|
188
|
+
const _useState3 = useState(null),
|
|
189
|
+
defaultValues = _useState3[0],
|
|
190
|
+
setDefaultValues = _useState3[1];
|
|
191
|
+
useEffect(() => {
|
|
192
|
+
if (!isSupervisor) {
|
|
193
|
+
setDefaultValues({
|
|
194
|
+
role: {
|
|
195
|
+
code: "SURVEYOR",
|
|
196
|
+
name: "Surveyor"
|
|
197
|
+
},
|
|
198
|
+
mobileNumber: ""
|
|
199
|
+
});
|
|
200
|
+
} else if (supervisorSearchResponse && !isSupervisorSearchLoading) {
|
|
201
|
+
setDefaultValues({
|
|
202
|
+
role: {
|
|
203
|
+
code: "SURVEYOR",
|
|
204
|
+
name: "Surveyor"
|
|
205
|
+
},
|
|
206
|
+
mobileNumber: "",
|
|
207
|
+
zoneIds: (matchedSupervisor === null || matchedSupervisor === void 0 ? void 0 : matchedSupervisor.assignedZoneId) || ""
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
}, [isSupervisor, supervisorSearchResponse, isSupervisorSearchLoading, matchedSupervisor]);
|
|
211
|
+
const Config = useMemo(() => {
|
|
212
|
+
const baseConfig = SurveyorConfig(t);
|
|
213
|
+
if (isSupervisor) {
|
|
214
|
+
return baseConfig.map(section => _extends({}, section, {
|
|
215
|
+
body: section.body.map(field => {
|
|
216
|
+
if (field.key === "zoneIds") {
|
|
217
|
+
return _extends({}, field, {
|
|
218
|
+
props: _extends({}, field.props, {
|
|
219
|
+
disable: true
|
|
220
|
+
})
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
return field;
|
|
224
|
+
})
|
|
225
|
+
}));
|
|
226
|
+
}
|
|
227
|
+
return baseConfig;
|
|
228
|
+
}, [t, isSupervisor]);
|
|
164
229
|
const isValidAge = dateStr => {
|
|
165
230
|
if (!dateStr) return false;
|
|
166
231
|
const today = new Date();
|
|
@@ -185,8 +250,8 @@ const AddSurveyor = _ref => {
|
|
|
185
250
|
};
|
|
186
251
|
const onSubmit = function (data) {
|
|
187
252
|
try {
|
|
188
|
-
var
|
|
189
|
-
const
|
|
253
|
+
var _data$zoneIds, _Digit$UserService$ge2, _data$gender;
|
|
254
|
+
const assignedZone = Array.isArray(data === null || data === void 0 ? void 0 : data.zoneIds) ? (data === null || data === void 0 ? void 0 : (_data$zoneIds = data.zoneIds) === null || _data$zoneIds === void 0 ? void 0 : _data$zoneIds.map(ele => ele.code).join(",")) || "" : (data === null || data === void 0 ? void 0 : data.zoneIds) || "";
|
|
190
255
|
const formData = {
|
|
191
256
|
RequestInfo: _extends({
|
|
192
257
|
apiId: "Rainmaker",
|
|
@@ -208,6 +273,9 @@ const AddSurveyor = _ref => {
|
|
|
208
273
|
}),
|
|
209
274
|
surveyor: {
|
|
210
275
|
tenantId: tenantId,
|
|
276
|
+
vendorId: isSupervisor ? matchedSupervisor === null || matchedSupervisor === void 0 ? void 0 : matchedSupervisor.vendorId : undefined,
|
|
277
|
+
supervisorId: isSupervisor ? matchedSupervisor === null || matchedSupervisor === void 0 ? void 0 : matchedSupervisor.id : undefined,
|
|
278
|
+
assignedZoneId: assignedZone,
|
|
211
279
|
description: (data === null || data === void 0 ? void 0 : data.description) || "",
|
|
212
280
|
correspondenceAddress: data === null || data === void 0 ? void 0 : data.correspondenceAddress,
|
|
213
281
|
additionalDetails: {
|
|
@@ -250,6 +318,9 @@ const AddSurveyor = _ref => {
|
|
|
250
318
|
return Promise.reject(e);
|
|
251
319
|
}
|
|
252
320
|
};
|
|
321
|
+
if (isSupervisor && (isSupervisorSearchLoading || !defaultValues)) {
|
|
322
|
+
return /*#__PURE__*/React.createElement(Loader, null);
|
|
323
|
+
}
|
|
253
324
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(VerticalTimeline, {
|
|
254
325
|
config: [{
|
|
255
326
|
route: "surveyor-details",
|
|
@@ -1017,7 +1088,7 @@ const VendorInbox = props => {
|
|
|
1017
1088
|
const userInfo = Digit.SessionStorage.get("User");
|
|
1018
1089
|
const userRoles = userInfo.info.roles;
|
|
1019
1090
|
const userType = (_userInfo$info$type = userInfo.info.type) === null || _userInfo$info$type === void 0 ? void 0 : _userInfo$info$type.toLowerCase();
|
|
1020
|
-
const EKYC_ROLES = ["
|
|
1091
|
+
const EKYC_ROLES = ["EKYC_SUPERVISOR", "EKYC_SURVEYOR"];
|
|
1021
1092
|
const isEkycRole = userRoles === null || userRoles === void 0 ? void 0 : userRoles.some(role => EKYC_ROLES.includes((role === null || role === void 0 ? void 0 : role.code) || role));
|
|
1022
1093
|
const openWorkOrderModal = vendorDetails => {
|
|
1023
1094
|
setSelectedVendorForWorkOrder(vendorDetails);
|
|
@@ -1342,9 +1413,11 @@ const VendorInbox = props => {
|
|
|
1342
1413
|
});
|
|
1343
1414
|
},
|
|
1344
1415
|
onSuccess: (data, variables) => {
|
|
1416
|
+
console.log("newStatus:", newStatus, "isDisable:", newStatus === "DISABLED");
|
|
1345
1417
|
setShowToast({
|
|
1346
1418
|
key: "success",
|
|
1347
|
-
action: "SUPERVISOR"
|
|
1419
|
+
action: "SUPERVISOR",
|
|
1420
|
+
isDisable: newStatus === "DISABLED"
|
|
1348
1421
|
});
|
|
1349
1422
|
queryClient.invalidateQueries("FSM_SUPERVISOR_SEARCH");
|
|
1350
1423
|
queryClient.invalidateQueries("SUPERVISOR_SEARCH");
|
|
@@ -1378,9 +1451,11 @@ const VendorInbox = props => {
|
|
|
1378
1451
|
});
|
|
1379
1452
|
},
|
|
1380
1453
|
onSuccess: (data, variables) => {
|
|
1454
|
+
console.log("newStatus:", newStatus, "isDisable:", newStatus === "DISABLED");
|
|
1381
1455
|
setShowToast({
|
|
1382
1456
|
key: "success",
|
|
1383
|
-
action: "SURVEYOR"
|
|
1457
|
+
action: "SURVEYOR",
|
|
1458
|
+
isDisable: newStatus === "DISABLED"
|
|
1384
1459
|
});
|
|
1385
1460
|
queryClient.invalidateQueries("FSM_SURVEYOR_SEARCH");
|
|
1386
1461
|
queryClient.invalidateQueries("SURVEYOR_SEARCH");
|
|
@@ -4639,7 +4714,8 @@ const VendorConfig = function (t, module, genderMenu, update) {
|
|
|
4639
4714
|
isMandatory: true,
|
|
4640
4715
|
type: "component",
|
|
4641
4716
|
key: "zoneIds",
|
|
4642
|
-
component: "SelectEkycZones"
|
|
4717
|
+
component: "SelectEkycZones",
|
|
4718
|
+
disable: update
|
|
4643
4719
|
}, {
|
|
4644
4720
|
label: "ES_FSM_REGISTRY_NEW_OWNER_NAME",
|
|
4645
4721
|
isMandatory: true,
|
|
@@ -4672,13 +4748,26 @@ const VendorConfig = function (t, module, genderMenu, update) {
|
|
|
4672
4748
|
populators: {
|
|
4673
4749
|
name: "dob",
|
|
4674
4750
|
validation: {
|
|
4675
|
-
required: true
|
|
4751
|
+
required: true,
|
|
4752
|
+
validate: value => {
|
|
4753
|
+
if (!value) return true;
|
|
4754
|
+
const dob = new Date(value);
|
|
4755
|
+
const today = new Date();
|
|
4756
|
+
let age = today.getFullYear() - dob.getFullYear();
|
|
4757
|
+
const m = today.getMonth() - dob.getMonth();
|
|
4758
|
+
if (m < 0 || m === 0 && today.getDate() < dob.getDate()) {
|
|
4759
|
+
age--;
|
|
4760
|
+
}
|
|
4761
|
+
return age >= 18 || t("ES_VENDOR_DOB_MIN_AGE_ERROR") || "Vendor must be 18 years or older";
|
|
4762
|
+
}
|
|
4676
4763
|
},
|
|
4677
4764
|
component: (props, customProps) => /*#__PURE__*/React.createElement(DatePicker$4, _extends({
|
|
4678
4765
|
onChange: props.onChange,
|
|
4679
4766
|
date: props.value
|
|
4680
4767
|
}, customProps, {
|
|
4681
|
-
|
|
4768
|
+
isDOB: true,
|
|
4769
|
+
minAge: 18,
|
|
4770
|
+
max: convertEpochToDate(new Date().setFullYear(new Date().getFullYear() - 18))
|
|
4682
4771
|
}))
|
|
4683
4772
|
}
|
|
4684
4773
|
}] : [])]
|
|
@@ -5685,12 +5774,19 @@ const VENDORCreate = _ref => {
|
|
|
5685
5774
|
React.useEffect(() => {
|
|
5686
5775
|
const searchParams = new URLSearchParams(search || window.location.search);
|
|
5687
5776
|
const vendorId = searchParams.get("vendorId");
|
|
5688
|
-
if (vendorId
|
|
5689
|
-
|
|
5690
|
-
|
|
5691
|
-
|
|
5777
|
+
if (vendorId) {
|
|
5778
|
+
if (params.vendor_id !== vendorId) {
|
|
5779
|
+
setParams(_extends({}, params, {
|
|
5780
|
+
vendor_id: vendorId
|
|
5781
|
+
}));
|
|
5782
|
+
}
|
|
5783
|
+
} else {
|
|
5784
|
+
if (params && Object.keys(params).length > 0 && window.location.href.includes("/info") && sessionStorage.getItem("docReqScreenByBack") !== "true") {
|
|
5785
|
+
clearParams();
|
|
5786
|
+
queryClient.invalidateQueries("VENDOR_CREATE");
|
|
5787
|
+
}
|
|
5692
5788
|
}
|
|
5693
|
-
}, [search,
|
|
5789
|
+
}, [search, pathname, params, setParams, clearParams, queryClient]);
|
|
5694
5790
|
const goNext = (skipStep, index, isAddMultiple, key) => {
|
|
5695
5791
|
let currentPath = pathname.split("/").pop(),
|
|
5696
5792
|
lastchar = currentPath.charAt(currentPath.length - 1),
|
|
@@ -5732,10 +5828,6 @@ const VENDORCreate = _ref => {
|
|
|
5732
5828
|
}
|
|
5733
5829
|
redirectWithHistory(nextPage);
|
|
5734
5830
|
};
|
|
5735
|
-
if (params && Object.keys(params).length > 0 && window.location.href.includes("/info") && sessionStorage.getItem("docReqScreenByBack") !== "true") {
|
|
5736
|
-
clearParams();
|
|
5737
|
-
queryClient.invalidateQueries("VENDOR_CREATE");
|
|
5738
|
-
}
|
|
5739
5831
|
const vendorcreate = function () {
|
|
5740
5832
|
try {
|
|
5741
5833
|
history.push(match.path + "/acknowledgement");
|
|
@@ -9460,13 +9552,15 @@ const VehicleDetails = props => {
|
|
|
9460
9552
|
};
|
|
9461
9553
|
|
|
9462
9554
|
const SelectEkycZones = _ref => {
|
|
9463
|
-
var _Digit$SessionStorage, _loggedInUser$roles;
|
|
9555
|
+
var _Digit$SessionStorage, _loggedInUser$roles, _config$props;
|
|
9464
9556
|
let config = _ref.config,
|
|
9465
9557
|
onSelect = _ref.onSelect,
|
|
9466
9558
|
t = _ref.t,
|
|
9467
9559
|
formData = _ref.formData,
|
|
9468
9560
|
_ref$isMultiSelect = _ref.isMultiSelect,
|
|
9469
|
-
isMultiSelect = _ref$isMultiSelect === void 0 ? true : _ref$isMultiSelect
|
|
9561
|
+
isMultiSelect = _ref$isMultiSelect === void 0 ? true : _ref$isMultiSelect,
|
|
9562
|
+
_ref$disable = _ref.disable,
|
|
9563
|
+
disable = _ref$disable === void 0 ? false : _ref$disable;
|
|
9470
9564
|
const tenantId = Digit.ULBService.getCurrentTenantId();
|
|
9471
9565
|
const _useState = useState([]),
|
|
9472
9566
|
zones = _useState[0],
|
|
@@ -9475,16 +9569,25 @@ const SelectEkycZones = _ref => {
|
|
|
9475
9569
|
selectedZones = _useState2[0],
|
|
9476
9570
|
setSelectedZones = _useState2[1];
|
|
9477
9571
|
const initialized = useRef(false);
|
|
9572
|
+
const isVendorPage = window.location.pathname.includes("/new-vendor") || window.location.pathname.includes("/modify-vendor") || window.location.href.includes("/new-vendor") || window.location.href.includes("/modify-vendor");
|
|
9478
9573
|
const loggedInUser = (_Digit$SessionStorage = Digit.SessionStorage.get("User")) === null || _Digit$SessionStorage === void 0 ? void 0 : _Digit$SessionStorage.info;
|
|
9479
9574
|
const roles = (loggedInUser === null || loggedInUser === void 0 ? void 0 : (_loggedInUser$roles = loggedInUser.roles) === null || _loggedInUser$roles === void 0 ? void 0 : _loggedInUser$roles.map(r => r.code)) || [];
|
|
9480
9575
|
const isEkycVendor = roles.includes("EKYC_VENDOR");
|
|
9576
|
+
const isEkycSupervisor = roles.includes("EKYC_SUPERVISOR");
|
|
9481
9577
|
const _Digit$Hooks$fsm$useD = Digit.Hooks.fsm.useDsoSearch(tenantId, {
|
|
9482
9578
|
status: "ACTIVE"
|
|
9483
9579
|
}, {
|
|
9484
|
-
enabled: isEkycVendor
|
|
9580
|
+
enabled: isEkycVendor && !isVendorPage
|
|
9485
9581
|
}),
|
|
9486
9582
|
vendorSearchResponse = _Digit$Hooks$fsm$useD.data,
|
|
9487
9583
|
isVendorSearchLoading = _Digit$Hooks$fsm$useD.isLoading;
|
|
9584
|
+
const _Digit$Hooks$fsm$useS = Digit.Hooks.fsm.useSupervisorSearch(tenantId, {
|
|
9585
|
+
status: "ACTIVE"
|
|
9586
|
+
}, {
|
|
9587
|
+
enabled: isEkycSupervisor
|
|
9588
|
+
}),
|
|
9589
|
+
supervisorSearchResponse = _Digit$Hooks$fsm$useS.data,
|
|
9590
|
+
isSupervisorSearchLoading = _Digit$Hooks$fsm$useS.isLoading;
|
|
9488
9591
|
const matchedVendor = React.useMemo(() => {
|
|
9489
9592
|
var _vendorSearchResponse, _vendorSearchResponse2;
|
|
9490
9593
|
if (!vendorSearchResponse) return null;
|
|
@@ -9498,6 +9601,13 @@ const SelectEkycZones = _ref => {
|
|
|
9498
9601
|
return userUuid && ownerUuid === userUuid || userMobile && ownerMobile === userMobile;
|
|
9499
9602
|
})) === null || _vendorSearchResponse === void 0 ? void 0 : _vendorSearchResponse.dsoDetails) || ((_vendorSearchResponse2 = vendorSearchResponse[0]) === null || _vendorSearchResponse2 === void 0 ? void 0 : _vendorSearchResponse2.dsoDetails) || vendorSearchResponse[0];
|
|
9500
9603
|
}, [vendorSearchResponse, loggedInUser]);
|
|
9604
|
+
const matchedSupervisor = React.useMemo(() => {
|
|
9605
|
+
if (!(supervisorSearchResponse !== null && supervisorSearchResponse !== void 0 && supervisorSearchResponse.supervisors)) return null;
|
|
9606
|
+
return supervisorSearchResponse.supervisors.find(s => {
|
|
9607
|
+
var _s$id, _loggedInUser$uuid, _s$owner, _s$owner$uuid, _loggedInUser$uuid2, _s$owner2;
|
|
9608
|
+
return ((_s$id = s.id) === null || _s$id === void 0 ? void 0 : _s$id.toLowerCase()) === (loggedInUser === null || loggedInUser === void 0 ? void 0 : (_loggedInUser$uuid = loggedInUser.uuid) === null || _loggedInUser$uuid === void 0 ? void 0 : _loggedInUser$uuid.toLowerCase()) || ((_s$owner = s.owner) === null || _s$owner === void 0 ? void 0 : (_s$owner$uuid = _s$owner.uuid) === null || _s$owner$uuid === void 0 ? void 0 : _s$owner$uuid.toLowerCase()) === (loggedInUser === null || loggedInUser === void 0 ? void 0 : (_loggedInUser$uuid2 = loggedInUser.uuid) === null || _loggedInUser$uuid2 === void 0 ? void 0 : _loggedInUser$uuid2.toLowerCase()) || ((_s$owner2 = s.owner) === null || _s$owner2 === void 0 ? void 0 : _s$owner2.mobileNumber) === (loggedInUser === null || loggedInUser === void 0 ? void 0 : loggedInUser.mobileNumber) || s.mobileNo === (loggedInUser === null || loggedInUser === void 0 ? void 0 : loggedInUser.mobileNumber);
|
|
9609
|
+
});
|
|
9610
|
+
}, [supervisorSearchResponse, loggedInUser]);
|
|
9501
9611
|
const _Digit$Hooks$useCommo = Digit.Hooks.useCommonMDMS(tenantId, "egov-location", ["TenantBoundary"]),
|
|
9502
9612
|
boundaryData = _Digit$Hooks$useCommo.data,
|
|
9503
9613
|
isLoading = _Digit$Hooks$useCommo.isLoading;
|
|
@@ -9511,22 +9621,18 @@ const SelectEkycZones = _ref => {
|
|
|
9511
9621
|
name: zone.name
|
|
9512
9622
|
})));
|
|
9513
9623
|
let zonesList = [...new Map(allZones.map(z => [z.code, z])).values()];
|
|
9514
|
-
if (isEkycVendor && matchedVendor !== null && matchedVendor !== void 0 && matchedVendor.zoneIds) {
|
|
9515
|
-
const assignedZoneCodes = matchedVendor.zoneIds.map(z => String(z).toUpperCase());
|
|
9516
|
-
zonesList = zonesList.filter(z => assignedZoneCodes.includes(String(z.code).toUpperCase()) || assignedZoneCodes.includes(String(z.name).toUpperCase()));
|
|
9517
|
-
}
|
|
9518
9624
|
setZones(zonesList);
|
|
9519
9625
|
}
|
|
9520
|
-
}, [boundaryData, isEkycVendor, matchedVendor]);
|
|
9626
|
+
}, [boundaryData, isEkycVendor, matchedVendor, isEkycSupervisor, matchedSupervisor, isVendorPage]);
|
|
9521
9627
|
useEffect(() => {
|
|
9522
9628
|
if (!zones.length || !(formData !== null && formData !== void 0 && formData.zoneIds)) return;
|
|
9523
9629
|
if (isMultiSelect) {
|
|
9524
9630
|
if (!Array.isArray(formData.zoneIds)) return;
|
|
9525
|
-
if (formData.zoneIds.length && typeof formData.zoneIds[0] === "object") {
|
|
9526
|
-
setSelectedZones(formData.zoneIds);
|
|
9631
|
+
if (formData.zoneIds.length && typeof formData.zoneIds[0] === "object" && formData.zoneIds[0] !== null) {
|
|
9632
|
+
setSelectedZones(formData.zoneIds.filter(Boolean));
|
|
9527
9633
|
return;
|
|
9528
9634
|
}
|
|
9529
|
-
const selected = zones.filter(zone => formData.zoneIds.includes(zone.name) || formData.zoneIds.includes(zone.code));
|
|
9635
|
+
const selected = zones.filter(zone => zone && (formData.zoneIds.includes(zone.name) || formData.zoneIds.includes(zone.code)));
|
|
9530
9636
|
setSelectedZones(selected);
|
|
9531
9637
|
if (!initialized.current) {
|
|
9532
9638
|
initialized.current = true;
|
|
@@ -9538,10 +9644,10 @@ const SelectEkycZones = _ref => {
|
|
|
9538
9644
|
var _selectedVal$, _selectedVal$2;
|
|
9539
9645
|
selectedVal = ((_selectedVal$ = selectedVal[0]) === null || _selectedVal$ === void 0 ? void 0 : _selectedVal$.name) || ((_selectedVal$2 = selectedVal[0]) === null || _selectedVal$2 === void 0 ? void 0 : _selectedVal$2.code) || selectedVal[0] || "";
|
|
9540
9646
|
}
|
|
9541
|
-
if (typeof selectedVal === "object") {
|
|
9647
|
+
if (selectedVal && typeof selectedVal === "object") {
|
|
9542
9648
|
selectedVal = selectedVal.name || selectedVal.code || "";
|
|
9543
9649
|
}
|
|
9544
|
-
const selected = zones.find(zone => zone.name === selectedVal || zone.code === selectedVal);
|
|
9650
|
+
const selected = zones.find(zone => zone && (zone.name === selectedVal || zone.code === selectedVal));
|
|
9545
9651
|
setSelectedZones(selected ? [selected] : []);
|
|
9546
9652
|
if (!initialized.current && selected) {
|
|
9547
9653
|
initialized.current = true;
|
|
@@ -9549,6 +9655,13 @@ const SelectEkycZones = _ref => {
|
|
|
9549
9655
|
}
|
|
9550
9656
|
}
|
|
9551
9657
|
}, [zones, formData === null || formData === void 0 ? void 0 : formData.zoneIds, config.key, onSelect, isMultiSelect]);
|
|
9658
|
+
useEffect(() => {
|
|
9659
|
+
if (isEkycSupervisor && zones.length > 0 && !(formData !== null && formData !== void 0 && formData.zoneIds) && !initialized.current) {
|
|
9660
|
+
initialized.current = true;
|
|
9661
|
+
setSelectedZones([zones[0]]);
|
|
9662
|
+
onSelect(config.key, zones[0].name || "");
|
|
9663
|
+
}
|
|
9664
|
+
}, [isEkycSupervisor, zones, formData === null || formData === void 0 ? void 0 : formData.zoneIds, config.key, onSelect]);
|
|
9552
9665
|
const handleSelect = value => {
|
|
9553
9666
|
if (isMultiSelect) {
|
|
9554
9667
|
const selected = Array.isArray(value) ? value.map(v => Array.isArray(v) ? v[1] : v).filter(Boolean) : [];
|
|
@@ -9560,7 +9673,7 @@ const SelectEkycZones = _ref => {
|
|
|
9560
9673
|
onSelect(config.key, (selectedZone === null || selectedZone === void 0 ? void 0 : selectedZone.name) || "");
|
|
9561
9674
|
}
|
|
9562
9675
|
};
|
|
9563
|
-
if (isLoading || isEkycVendor && isVendorSearchLoading) return /*#__PURE__*/React.createElement(Loader, null);
|
|
9676
|
+
if (isLoading || isEkycVendor && !isVendorPage && isVendorSearchLoading || isEkycSupervisor && isSupervisorSearchLoading) return /*#__PURE__*/React.createElement(Loader, null);
|
|
9564
9677
|
return /*#__PURE__*/React.createElement(LabelFieldPair, null, /*#__PURE__*/React.createElement(CardLabel, null, t(config.label), config.isMandatory ? /*#__PURE__*/React.createElement("span", {
|
|
9565
9678
|
className: "check-page-link-button"
|
|
9566
9679
|
}, " * ") : ""), /*#__PURE__*/React.createElement("div", {
|
|
@@ -9581,10 +9694,11 @@ const SelectEkycZones = _ref => {
|
|
|
9581
9694
|
ServerStyle: {
|
|
9582
9695
|
backgroundColor: "#fff"
|
|
9583
9696
|
},
|
|
9584
|
-
defaultLabel: isMultiSelect ? selectedZones.length + " Selected" : ""
|
|
9697
|
+
defaultLabel: isMultiSelect ? selectedZones.length + " Selected" : "",
|
|
9698
|
+
disable: disable || isEkycSupervisor || ((_config$props = config.props) === null || _config$props === void 0 ? void 0 : _config$props.disable) || config.disable
|
|
9585
9699
|
})), isMultiSelect && selectedZones.length > 0 && /*#__PURE__*/React.createElement("div", {
|
|
9586
9700
|
className: "selected-zones"
|
|
9587
|
-
}, selectedZones.map(zone => /*#__PURE__*/React.createElement("span", {
|
|
9701
|
+
}, selectedZones.filter(zone => zone && zone.code).map(zone => /*#__PURE__*/React.createElement("span", {
|
|
9588
9702
|
key: zone.code,
|
|
9589
9703
|
className: "selected-zone-chip"
|
|
9590
9704
|
}, zone.name))));
|