@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.js
CHANGED
|
@@ -126,6 +126,22 @@ const SurveyorConfig = function (t, agencies, reportingManagers, disabled) {
|
|
|
126
126
|
},
|
|
127
127
|
className: "payment-form-text-input-correction"
|
|
128
128
|
}
|
|
129
|
+
}, {
|
|
130
|
+
label: t("ES_VENDOR_ZONE"),
|
|
131
|
+
isMandatory: true,
|
|
132
|
+
type: "component",
|
|
133
|
+
key: "zoneIds",
|
|
134
|
+
populators: {
|
|
135
|
+
name: "zoneIds",
|
|
136
|
+
validation: {
|
|
137
|
+
required: true
|
|
138
|
+
},
|
|
139
|
+
className: "mb-16"
|
|
140
|
+
},
|
|
141
|
+
props: {
|
|
142
|
+
isMultiSelect: false
|
|
143
|
+
},
|
|
144
|
+
component: "SelectEkycZones"
|
|
129
145
|
}, {
|
|
130
146
|
label: t("ES_VENDOR_SURVEYOR_DESCRIPTION"),
|
|
131
147
|
isMandatory: false,
|
|
@@ -139,7 +155,7 @@ const SurveyorConfig = function (t, agencies, reportingManagers, disabled) {
|
|
|
139
155
|
};
|
|
140
156
|
|
|
141
157
|
const AddSurveyor = _ref => {
|
|
142
|
-
var _Digit$UserService$ge;
|
|
158
|
+
var _Digit$UserService$ge, _userInfo$roles;
|
|
143
159
|
const _useTranslation = reactI18next.useTranslation(),
|
|
144
160
|
t = _useTranslation.t;
|
|
145
161
|
const history = reactRouterDom.useHistory();
|
|
@@ -156,14 +172,63 @@ const AddSurveyor = _ref => {
|
|
|
156
172
|
setCanSubmit = _useState2[1];
|
|
157
173
|
const _Digit$Hooks$fsm$useS = Digit.Hooks.fsm.useSurveyorCreate(tenantId),
|
|
158
174
|
mutateAsync = _Digit$Hooks$fsm$useS.mutateAsync;
|
|
159
|
-
const
|
|
160
|
-
const
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
175
|
+
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");
|
|
176
|
+
const _Digit$Hooks$fsm$useS2 = Digit.Hooks.fsm.useSupervisorSearch(tenantId, {
|
|
177
|
+
status: "ACTIVE"
|
|
178
|
+
}, {
|
|
179
|
+
enabled: isSupervisor,
|
|
180
|
+
staleTime: Infinity
|
|
181
|
+
}),
|
|
182
|
+
supervisorSearchResponse = _Digit$Hooks$fsm$useS2.data,
|
|
183
|
+
isSupervisorSearchLoading = _Digit$Hooks$fsm$useS2.isLoading;
|
|
184
|
+
const matchedSupervisor = React.useMemo(() => {
|
|
185
|
+
if (!(supervisorSearchResponse !== null && supervisorSearchResponse !== void 0 && supervisorSearchResponse.supervisors)) return null;
|
|
186
|
+
return supervisorSearchResponse.supervisors.find(s => {
|
|
187
|
+
var _s$id, _userInfo$uuid, _s$owner, _s$owner$uuid, _userInfo$uuid2, _s$owner2;
|
|
188
|
+
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);
|
|
189
|
+
});
|
|
190
|
+
}, [supervisorSearchResponse, userInfo]);
|
|
191
|
+
const _useState3 = React.useState(null),
|
|
192
|
+
defaultValues = _useState3[0],
|
|
193
|
+
setDefaultValues = _useState3[1];
|
|
194
|
+
React.useEffect(() => {
|
|
195
|
+
if (!isSupervisor) {
|
|
196
|
+
setDefaultValues({
|
|
197
|
+
role: {
|
|
198
|
+
code: "SURVEYOR",
|
|
199
|
+
name: "Surveyor"
|
|
200
|
+
},
|
|
201
|
+
mobileNumber: ""
|
|
202
|
+
});
|
|
203
|
+
} else if (supervisorSearchResponse && !isSupervisorSearchLoading) {
|
|
204
|
+
setDefaultValues({
|
|
205
|
+
role: {
|
|
206
|
+
code: "SURVEYOR",
|
|
207
|
+
name: "Surveyor"
|
|
208
|
+
},
|
|
209
|
+
mobileNumber: "",
|
|
210
|
+
zoneIds: (matchedSupervisor === null || matchedSupervisor === void 0 ? void 0 : matchedSupervisor.assignedZoneId) || ""
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
}, [isSupervisor, supervisorSearchResponse, isSupervisorSearchLoading, matchedSupervisor]);
|
|
214
|
+
const Config = React.useMemo(() => {
|
|
215
|
+
const baseConfig = SurveyorConfig(t);
|
|
216
|
+
if (isSupervisor) {
|
|
217
|
+
return baseConfig.map(section => _extends({}, section, {
|
|
218
|
+
body: section.body.map(field => {
|
|
219
|
+
if (field.key === "zoneIds") {
|
|
220
|
+
return _extends({}, field, {
|
|
221
|
+
props: _extends({}, field.props, {
|
|
222
|
+
disable: true
|
|
223
|
+
})
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
return field;
|
|
227
|
+
})
|
|
228
|
+
}));
|
|
229
|
+
}
|
|
230
|
+
return baseConfig;
|
|
231
|
+
}, [t, isSupervisor]);
|
|
167
232
|
const isValidAge = dateStr => {
|
|
168
233
|
if (!dateStr) return false;
|
|
169
234
|
const today = new Date();
|
|
@@ -188,8 +253,8 @@ const AddSurveyor = _ref => {
|
|
|
188
253
|
};
|
|
189
254
|
const onSubmit = function (data) {
|
|
190
255
|
try {
|
|
191
|
-
var
|
|
192
|
-
const
|
|
256
|
+
var _data$zoneIds, _Digit$UserService$ge2, _data$gender;
|
|
257
|
+
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) || "";
|
|
193
258
|
const formData = {
|
|
194
259
|
RequestInfo: _extends({
|
|
195
260
|
apiId: "Rainmaker",
|
|
@@ -211,6 +276,9 @@ const AddSurveyor = _ref => {
|
|
|
211
276
|
}),
|
|
212
277
|
surveyor: {
|
|
213
278
|
tenantId: tenantId,
|
|
279
|
+
vendorId: isSupervisor ? matchedSupervisor === null || matchedSupervisor === void 0 ? void 0 : matchedSupervisor.vendorId : undefined,
|
|
280
|
+
supervisorId: isSupervisor ? matchedSupervisor === null || matchedSupervisor === void 0 ? void 0 : matchedSupervisor.id : undefined,
|
|
281
|
+
assignedZoneId: assignedZone,
|
|
214
282
|
description: (data === null || data === void 0 ? void 0 : data.description) || "",
|
|
215
283
|
correspondenceAddress: data === null || data === void 0 ? void 0 : data.correspondenceAddress,
|
|
216
284
|
additionalDetails: {
|
|
@@ -253,6 +321,9 @@ const AddSurveyor = _ref => {
|
|
|
253
321
|
return Promise.reject(e);
|
|
254
322
|
}
|
|
255
323
|
};
|
|
324
|
+
if (isSupervisor && (isSupervisorSearchLoading || !defaultValues)) {
|
|
325
|
+
return /*#__PURE__*/React__default.createElement(digitUiReactComponents.Loader, null);
|
|
326
|
+
}
|
|
256
327
|
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(digitUiReactComponents.VerticalTimeline, {
|
|
257
328
|
config: [{
|
|
258
329
|
route: "surveyor-details",
|
|
@@ -1020,7 +1091,7 @@ const VendorInbox = props => {
|
|
|
1020
1091
|
const userInfo = Digit.SessionStorage.get("User");
|
|
1021
1092
|
const userRoles = userInfo.info.roles;
|
|
1022
1093
|
const userType = (_userInfo$info$type = userInfo.info.type) === null || _userInfo$info$type === void 0 ? void 0 : _userInfo$info$type.toLowerCase();
|
|
1023
|
-
const EKYC_ROLES = ["
|
|
1094
|
+
const EKYC_ROLES = ["EKYC_SUPERVISOR", "EKYC_SURVEYOR"];
|
|
1024
1095
|
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));
|
|
1025
1096
|
const openWorkOrderModal = vendorDetails => {
|
|
1026
1097
|
setSelectedVendorForWorkOrder(vendorDetails);
|
|
@@ -1345,9 +1416,11 @@ const VendorInbox = props => {
|
|
|
1345
1416
|
});
|
|
1346
1417
|
},
|
|
1347
1418
|
onSuccess: (data, variables) => {
|
|
1419
|
+
console.log("newStatus:", newStatus, "isDisable:", newStatus === "DISABLED");
|
|
1348
1420
|
setShowToast({
|
|
1349
1421
|
key: "success",
|
|
1350
|
-
action: "SUPERVISOR"
|
|
1422
|
+
action: "SUPERVISOR",
|
|
1423
|
+
isDisable: newStatus === "DISABLED"
|
|
1351
1424
|
});
|
|
1352
1425
|
queryClient.invalidateQueries("FSM_SUPERVISOR_SEARCH");
|
|
1353
1426
|
queryClient.invalidateQueries("SUPERVISOR_SEARCH");
|
|
@@ -1381,9 +1454,11 @@ const VendorInbox = props => {
|
|
|
1381
1454
|
});
|
|
1382
1455
|
},
|
|
1383
1456
|
onSuccess: (data, variables) => {
|
|
1457
|
+
console.log("newStatus:", newStatus, "isDisable:", newStatus === "DISABLED");
|
|
1384
1458
|
setShowToast({
|
|
1385
1459
|
key: "success",
|
|
1386
|
-
action: "SURVEYOR"
|
|
1460
|
+
action: "SURVEYOR",
|
|
1461
|
+
isDisable: newStatus === "DISABLED"
|
|
1387
1462
|
});
|
|
1388
1463
|
queryClient.invalidateQueries("FSM_SURVEYOR_SEARCH");
|
|
1389
1464
|
queryClient.invalidateQueries("SURVEYOR_SEARCH");
|
|
@@ -4642,7 +4717,8 @@ const VendorConfig = function (t, module, genderMenu, update) {
|
|
|
4642
4717
|
isMandatory: true,
|
|
4643
4718
|
type: "component",
|
|
4644
4719
|
key: "zoneIds",
|
|
4645
|
-
component: "SelectEkycZones"
|
|
4720
|
+
component: "SelectEkycZones",
|
|
4721
|
+
disable: update
|
|
4646
4722
|
}, {
|
|
4647
4723
|
label: "ES_FSM_REGISTRY_NEW_OWNER_NAME",
|
|
4648
4724
|
isMandatory: true,
|
|
@@ -4675,13 +4751,26 @@ const VendorConfig = function (t, module, genderMenu, update) {
|
|
|
4675
4751
|
populators: {
|
|
4676
4752
|
name: "dob",
|
|
4677
4753
|
validation: {
|
|
4678
|
-
required: true
|
|
4754
|
+
required: true,
|
|
4755
|
+
validate: value => {
|
|
4756
|
+
if (!value) return true;
|
|
4757
|
+
const dob = new Date(value);
|
|
4758
|
+
const today = new Date();
|
|
4759
|
+
let age = today.getFullYear() - dob.getFullYear();
|
|
4760
|
+
const m = today.getMonth() - dob.getMonth();
|
|
4761
|
+
if (m < 0 || m === 0 && today.getDate() < dob.getDate()) {
|
|
4762
|
+
age--;
|
|
4763
|
+
}
|
|
4764
|
+
return age >= 18 || t("ES_VENDOR_DOB_MIN_AGE_ERROR") || "Vendor must be 18 years or older";
|
|
4765
|
+
}
|
|
4679
4766
|
},
|
|
4680
4767
|
component: (props, customProps) => /*#__PURE__*/React__default.createElement(digitUiReactComponents.DatePicker, _extends({
|
|
4681
4768
|
onChange: props.onChange,
|
|
4682
4769
|
date: props.value
|
|
4683
4770
|
}, customProps, {
|
|
4684
|
-
|
|
4771
|
+
isDOB: true,
|
|
4772
|
+
minAge: 18,
|
|
4773
|
+
max: convertEpochToDate(new Date().setFullYear(new Date().getFullYear() - 18))
|
|
4685
4774
|
}))
|
|
4686
4775
|
}
|
|
4687
4776
|
}] : [])]
|
|
@@ -5688,12 +5777,19 @@ const VENDORCreate = _ref => {
|
|
|
5688
5777
|
React__default.useEffect(() => {
|
|
5689
5778
|
const searchParams = new URLSearchParams(search || window.location.search);
|
|
5690
5779
|
const vendorId = searchParams.get("vendorId");
|
|
5691
|
-
if (vendorId
|
|
5692
|
-
|
|
5693
|
-
|
|
5694
|
-
|
|
5780
|
+
if (vendorId) {
|
|
5781
|
+
if (params.vendor_id !== vendorId) {
|
|
5782
|
+
setParams(_extends({}, params, {
|
|
5783
|
+
vendor_id: vendorId
|
|
5784
|
+
}));
|
|
5785
|
+
}
|
|
5786
|
+
} else {
|
|
5787
|
+
if (params && Object.keys(params).length > 0 && window.location.href.includes("/info") && sessionStorage.getItem("docReqScreenByBack") !== "true") {
|
|
5788
|
+
clearParams();
|
|
5789
|
+
queryClient.invalidateQueries("VENDOR_CREATE");
|
|
5790
|
+
}
|
|
5695
5791
|
}
|
|
5696
|
-
}, [search,
|
|
5792
|
+
}, [search, pathname, params, setParams, clearParams, queryClient]);
|
|
5697
5793
|
const goNext = (skipStep, index, isAddMultiple, key) => {
|
|
5698
5794
|
let currentPath = pathname.split("/").pop(),
|
|
5699
5795
|
lastchar = currentPath.charAt(currentPath.length - 1),
|
|
@@ -5735,10 +5831,6 @@ const VENDORCreate = _ref => {
|
|
|
5735
5831
|
}
|
|
5736
5832
|
redirectWithHistory(nextPage);
|
|
5737
5833
|
};
|
|
5738
|
-
if (params && Object.keys(params).length > 0 && window.location.href.includes("/info") && sessionStorage.getItem("docReqScreenByBack") !== "true") {
|
|
5739
|
-
clearParams();
|
|
5740
|
-
queryClient.invalidateQueries("VENDOR_CREATE");
|
|
5741
|
-
}
|
|
5742
5834
|
const vendorcreate = function () {
|
|
5743
5835
|
try {
|
|
5744
5836
|
history.push(match.path + "/acknowledgement");
|
|
@@ -9463,13 +9555,15 @@ const VehicleDetails = props => {
|
|
|
9463
9555
|
};
|
|
9464
9556
|
|
|
9465
9557
|
const SelectEkycZones = _ref => {
|
|
9466
|
-
var _Digit$SessionStorage, _loggedInUser$roles;
|
|
9558
|
+
var _Digit$SessionStorage, _loggedInUser$roles, _config$props;
|
|
9467
9559
|
let config = _ref.config,
|
|
9468
9560
|
onSelect = _ref.onSelect,
|
|
9469
9561
|
t = _ref.t,
|
|
9470
9562
|
formData = _ref.formData,
|
|
9471
9563
|
_ref$isMultiSelect = _ref.isMultiSelect,
|
|
9472
|
-
isMultiSelect = _ref$isMultiSelect === void 0 ? true : _ref$isMultiSelect
|
|
9564
|
+
isMultiSelect = _ref$isMultiSelect === void 0 ? true : _ref$isMultiSelect,
|
|
9565
|
+
_ref$disable = _ref.disable,
|
|
9566
|
+
disable = _ref$disable === void 0 ? false : _ref$disable;
|
|
9473
9567
|
const tenantId = Digit.ULBService.getCurrentTenantId();
|
|
9474
9568
|
const _useState = React.useState([]),
|
|
9475
9569
|
zones = _useState[0],
|
|
@@ -9478,16 +9572,25 @@ const SelectEkycZones = _ref => {
|
|
|
9478
9572
|
selectedZones = _useState2[0],
|
|
9479
9573
|
setSelectedZones = _useState2[1];
|
|
9480
9574
|
const initialized = React.useRef(false);
|
|
9575
|
+
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");
|
|
9481
9576
|
const loggedInUser = (_Digit$SessionStorage = Digit.SessionStorage.get("User")) === null || _Digit$SessionStorage === void 0 ? void 0 : _Digit$SessionStorage.info;
|
|
9482
9577
|
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)) || [];
|
|
9483
9578
|
const isEkycVendor = roles.includes("EKYC_VENDOR");
|
|
9579
|
+
const isEkycSupervisor = roles.includes("EKYC_SUPERVISOR");
|
|
9484
9580
|
const _Digit$Hooks$fsm$useD = Digit.Hooks.fsm.useDsoSearch(tenantId, {
|
|
9485
9581
|
status: "ACTIVE"
|
|
9486
9582
|
}, {
|
|
9487
|
-
enabled: isEkycVendor
|
|
9583
|
+
enabled: isEkycVendor && !isVendorPage
|
|
9488
9584
|
}),
|
|
9489
9585
|
vendorSearchResponse = _Digit$Hooks$fsm$useD.data,
|
|
9490
9586
|
isVendorSearchLoading = _Digit$Hooks$fsm$useD.isLoading;
|
|
9587
|
+
const _Digit$Hooks$fsm$useS = Digit.Hooks.fsm.useSupervisorSearch(tenantId, {
|
|
9588
|
+
status: "ACTIVE"
|
|
9589
|
+
}, {
|
|
9590
|
+
enabled: isEkycSupervisor
|
|
9591
|
+
}),
|
|
9592
|
+
supervisorSearchResponse = _Digit$Hooks$fsm$useS.data,
|
|
9593
|
+
isSupervisorSearchLoading = _Digit$Hooks$fsm$useS.isLoading;
|
|
9491
9594
|
const matchedVendor = React__default.useMemo(() => {
|
|
9492
9595
|
var _vendorSearchResponse, _vendorSearchResponse2;
|
|
9493
9596
|
if (!vendorSearchResponse) return null;
|
|
@@ -9501,6 +9604,13 @@ const SelectEkycZones = _ref => {
|
|
|
9501
9604
|
return userUuid && ownerUuid === userUuid || userMobile && ownerMobile === userMobile;
|
|
9502
9605
|
})) === null || _vendorSearchResponse === void 0 ? void 0 : _vendorSearchResponse.dsoDetails) || ((_vendorSearchResponse2 = vendorSearchResponse[0]) === null || _vendorSearchResponse2 === void 0 ? void 0 : _vendorSearchResponse2.dsoDetails) || vendorSearchResponse[0];
|
|
9503
9606
|
}, [vendorSearchResponse, loggedInUser]);
|
|
9607
|
+
const matchedSupervisor = React__default.useMemo(() => {
|
|
9608
|
+
if (!(supervisorSearchResponse !== null && supervisorSearchResponse !== void 0 && supervisorSearchResponse.supervisors)) return null;
|
|
9609
|
+
return supervisorSearchResponse.supervisors.find(s => {
|
|
9610
|
+
var _s$id, _loggedInUser$uuid, _s$owner, _s$owner$uuid, _loggedInUser$uuid2, _s$owner2;
|
|
9611
|
+
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);
|
|
9612
|
+
});
|
|
9613
|
+
}, [supervisorSearchResponse, loggedInUser]);
|
|
9504
9614
|
const _Digit$Hooks$useCommo = Digit.Hooks.useCommonMDMS(tenantId, "egov-location", ["TenantBoundary"]),
|
|
9505
9615
|
boundaryData = _Digit$Hooks$useCommo.data,
|
|
9506
9616
|
isLoading = _Digit$Hooks$useCommo.isLoading;
|
|
@@ -9514,22 +9624,18 @@ const SelectEkycZones = _ref => {
|
|
|
9514
9624
|
name: zone.name
|
|
9515
9625
|
})));
|
|
9516
9626
|
let zonesList = [...new Map(allZones.map(z => [z.code, z])).values()];
|
|
9517
|
-
if (isEkycVendor && matchedVendor !== null && matchedVendor !== void 0 && matchedVendor.zoneIds) {
|
|
9518
|
-
const assignedZoneCodes = matchedVendor.zoneIds.map(z => String(z).toUpperCase());
|
|
9519
|
-
zonesList = zonesList.filter(z => assignedZoneCodes.includes(String(z.code).toUpperCase()) || assignedZoneCodes.includes(String(z.name).toUpperCase()));
|
|
9520
|
-
}
|
|
9521
9627
|
setZones(zonesList);
|
|
9522
9628
|
}
|
|
9523
|
-
}, [boundaryData, isEkycVendor, matchedVendor]);
|
|
9629
|
+
}, [boundaryData, isEkycVendor, matchedVendor, isEkycSupervisor, matchedSupervisor, isVendorPage]);
|
|
9524
9630
|
React.useEffect(() => {
|
|
9525
9631
|
if (!zones.length || !(formData !== null && formData !== void 0 && formData.zoneIds)) return;
|
|
9526
9632
|
if (isMultiSelect) {
|
|
9527
9633
|
if (!Array.isArray(formData.zoneIds)) return;
|
|
9528
|
-
if (formData.zoneIds.length && typeof formData.zoneIds[0] === "object") {
|
|
9529
|
-
setSelectedZones(formData.zoneIds);
|
|
9634
|
+
if (formData.zoneIds.length && typeof formData.zoneIds[0] === "object" && formData.zoneIds[0] !== null) {
|
|
9635
|
+
setSelectedZones(formData.zoneIds.filter(Boolean));
|
|
9530
9636
|
return;
|
|
9531
9637
|
}
|
|
9532
|
-
const selected = zones.filter(zone => formData.zoneIds.includes(zone.name) || formData.zoneIds.includes(zone.code));
|
|
9638
|
+
const selected = zones.filter(zone => zone && (formData.zoneIds.includes(zone.name) || formData.zoneIds.includes(zone.code)));
|
|
9533
9639
|
setSelectedZones(selected);
|
|
9534
9640
|
if (!initialized.current) {
|
|
9535
9641
|
initialized.current = true;
|
|
@@ -9541,10 +9647,10 @@ const SelectEkycZones = _ref => {
|
|
|
9541
9647
|
var _selectedVal$, _selectedVal$2;
|
|
9542
9648
|
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] || "";
|
|
9543
9649
|
}
|
|
9544
|
-
if (typeof selectedVal === "object") {
|
|
9650
|
+
if (selectedVal && typeof selectedVal === "object") {
|
|
9545
9651
|
selectedVal = selectedVal.name || selectedVal.code || "";
|
|
9546
9652
|
}
|
|
9547
|
-
const selected = zones.find(zone => zone.name === selectedVal || zone.code === selectedVal);
|
|
9653
|
+
const selected = zones.find(zone => zone && (zone.name === selectedVal || zone.code === selectedVal));
|
|
9548
9654
|
setSelectedZones(selected ? [selected] : []);
|
|
9549
9655
|
if (!initialized.current && selected) {
|
|
9550
9656
|
initialized.current = true;
|
|
@@ -9552,6 +9658,13 @@ const SelectEkycZones = _ref => {
|
|
|
9552
9658
|
}
|
|
9553
9659
|
}
|
|
9554
9660
|
}, [zones, formData === null || formData === void 0 ? void 0 : formData.zoneIds, config.key, onSelect, isMultiSelect]);
|
|
9661
|
+
React.useEffect(() => {
|
|
9662
|
+
if (isEkycSupervisor && zones.length > 0 && !(formData !== null && formData !== void 0 && formData.zoneIds) && !initialized.current) {
|
|
9663
|
+
initialized.current = true;
|
|
9664
|
+
setSelectedZones([zones[0]]);
|
|
9665
|
+
onSelect(config.key, zones[0].name || "");
|
|
9666
|
+
}
|
|
9667
|
+
}, [isEkycSupervisor, zones, formData === null || formData === void 0 ? void 0 : formData.zoneIds, config.key, onSelect]);
|
|
9555
9668
|
const handleSelect = value => {
|
|
9556
9669
|
if (isMultiSelect) {
|
|
9557
9670
|
const selected = Array.isArray(value) ? value.map(v => Array.isArray(v) ? v[1] : v).filter(Boolean) : [];
|
|
@@ -9563,7 +9676,7 @@ const SelectEkycZones = _ref => {
|
|
|
9563
9676
|
onSelect(config.key, (selectedZone === null || selectedZone === void 0 ? void 0 : selectedZone.name) || "");
|
|
9564
9677
|
}
|
|
9565
9678
|
};
|
|
9566
|
-
if (isLoading || isEkycVendor && isVendorSearchLoading) return /*#__PURE__*/React__default.createElement(digitUiReactComponents.Loader, null);
|
|
9679
|
+
if (isLoading || isEkycVendor && !isVendorPage && isVendorSearchLoading || isEkycSupervisor && isSupervisorSearchLoading) return /*#__PURE__*/React__default.createElement(digitUiReactComponents.Loader, null);
|
|
9567
9680
|
return /*#__PURE__*/React__default.createElement(digitUiReactComponents.LabelFieldPair, null, /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardLabel, null, t(config.label), config.isMandatory ? /*#__PURE__*/React__default.createElement("span", {
|
|
9568
9681
|
className: "check-page-link-button"
|
|
9569
9682
|
}, " * ") : ""), /*#__PURE__*/React__default.createElement("div", {
|
|
@@ -9584,10 +9697,11 @@ const SelectEkycZones = _ref => {
|
|
|
9584
9697
|
ServerStyle: {
|
|
9585
9698
|
backgroundColor: "#fff"
|
|
9586
9699
|
},
|
|
9587
|
-
defaultLabel: isMultiSelect ? selectedZones.length + " Selected" : ""
|
|
9700
|
+
defaultLabel: isMultiSelect ? selectedZones.length + " Selected" : "",
|
|
9701
|
+
disable: disable || isEkycSupervisor || ((_config$props = config.props) === null || _config$props === void 0 ? void 0 : _config$props.disable) || config.disable
|
|
9588
9702
|
})), isMultiSelect && selectedZones.length > 0 && /*#__PURE__*/React__default.createElement("div", {
|
|
9589
9703
|
className: "selected-zones"
|
|
9590
|
-
}, selectedZones.map(zone => /*#__PURE__*/React__default.createElement("span", {
|
|
9704
|
+
}, selectedZones.filter(zone => zone && zone.code).map(zone => /*#__PURE__*/React__default.createElement("span", {
|
|
9591
9705
|
key: zone.code,
|
|
9592
9706
|
className: "selected-zone-chip"
|
|
9593
9707
|
}, zone.name))));
|