@djb25/digit-ui-module-vendor 1.0.63 → 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 +215 -51
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +217 -53
- package/dist/index.modern.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -53,10 +53,20 @@ const SurveyorConfig = function (t, agencies, reportingManagers, disabled) {
|
|
|
53
53
|
populators: {
|
|
54
54
|
name: "fullName",
|
|
55
55
|
validation: {
|
|
56
|
-
required:
|
|
57
|
-
|
|
56
|
+
required: {
|
|
57
|
+
value: true,
|
|
58
|
+
message: t("ES_VENDOR_INVALID_NAME")
|
|
59
|
+
},
|
|
60
|
+
maxLength: {
|
|
61
|
+
value: 49,
|
|
62
|
+
message: t("ES_VENDOR_NAME_MAX_50_CHARACTERS")
|
|
63
|
+
},
|
|
64
|
+
pattern: {
|
|
65
|
+
value: /^[A-Za-z\s]+$/,
|
|
66
|
+
message: t("ES_VENDOR_INVALID_NAME")
|
|
67
|
+
}
|
|
58
68
|
},
|
|
59
|
-
|
|
69
|
+
maxlength: 50
|
|
60
70
|
}
|
|
61
71
|
}, {
|
|
62
72
|
label: "ES_VENDOR_SURVEYOR_MOBILE_NUMBER",
|
|
@@ -116,6 +126,22 @@ const SurveyorConfig = function (t, agencies, reportingManagers, disabled) {
|
|
|
116
126
|
},
|
|
117
127
|
className: "payment-form-text-input-correction"
|
|
118
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"
|
|
119
145
|
}, {
|
|
120
146
|
label: t("ES_VENDOR_SURVEYOR_DESCRIPTION"),
|
|
121
147
|
isMandatory: false,
|
|
@@ -129,7 +155,7 @@ const SurveyorConfig = function (t, agencies, reportingManagers, disabled) {
|
|
|
129
155
|
};
|
|
130
156
|
|
|
131
157
|
const AddSurveyor = _ref => {
|
|
132
|
-
var _Digit$UserService$ge;
|
|
158
|
+
var _Digit$UserService$ge, _userInfo$roles;
|
|
133
159
|
const _useTranslation = reactI18next.useTranslation(),
|
|
134
160
|
t = _useTranslation.t;
|
|
135
161
|
const history = reactRouterDom.useHistory();
|
|
@@ -146,14 +172,63 @@ const AddSurveyor = _ref => {
|
|
|
146
172
|
setCanSubmit = _useState2[1];
|
|
147
173
|
const _Digit$Hooks$fsm$useS = Digit.Hooks.fsm.useSurveyorCreate(tenantId),
|
|
148
174
|
mutateAsync = _Digit$Hooks$fsm$useS.mutateAsync;
|
|
149
|
-
const
|
|
150
|
-
const
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
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]);
|
|
157
232
|
const isValidAge = dateStr => {
|
|
158
233
|
if (!dateStr) return false;
|
|
159
234
|
const today = new Date();
|
|
@@ -178,8 +253,8 @@ const AddSurveyor = _ref => {
|
|
|
178
253
|
};
|
|
179
254
|
const onSubmit = function (data) {
|
|
180
255
|
try {
|
|
181
|
-
var
|
|
182
|
-
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) || "";
|
|
183
258
|
const formData = {
|
|
184
259
|
RequestInfo: _extends({
|
|
185
260
|
apiId: "Rainmaker",
|
|
@@ -201,6 +276,9 @@ const AddSurveyor = _ref => {
|
|
|
201
276
|
}),
|
|
202
277
|
surveyor: {
|
|
203
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,
|
|
204
282
|
description: (data === null || data === void 0 ? void 0 : data.description) || "",
|
|
205
283
|
correspondenceAddress: data === null || data === void 0 ? void 0 : data.correspondenceAddress,
|
|
206
284
|
additionalDetails: {
|
|
@@ -243,6 +321,9 @@ const AddSurveyor = _ref => {
|
|
|
243
321
|
return Promise.reject(e);
|
|
244
322
|
}
|
|
245
323
|
};
|
|
324
|
+
if (isSupervisor && (isSupervisorSearchLoading || !defaultValues)) {
|
|
325
|
+
return /*#__PURE__*/React__default.createElement(digitUiReactComponents.Loader, null);
|
|
326
|
+
}
|
|
246
327
|
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(digitUiReactComponents.VerticalTimeline, {
|
|
247
328
|
config: [{
|
|
248
329
|
route: "surveyor-details",
|
|
@@ -635,7 +716,7 @@ const DropdownStatus = _ref => {
|
|
|
635
716
|
};
|
|
636
717
|
|
|
637
718
|
const RegisteredVendorSearch = _ref => {
|
|
638
|
-
var _matchedRoles$wt, _matchedRoles$wt2, _matchedRoles$ekyc, _matchedRoles$ekyc2, _matchedRoles$wt3, _matchedRoles$
|
|
719
|
+
var _matchedRoles$wt, _matchedRoles$wt2, _matchedRoles$ekyc, _matchedRoles$ekyc2, _matchedRoles$wt3, _matchedRoles$ekyc3, _matchedRoles$wt4, _matchedRoles$wt5, _matchedRoles$ekyc4, _matchedRoles$ekyc5, _matchedRoles$ekyc6, _matchedRoles$ekyc7, _matchedRoles$ekyc8;
|
|
639
720
|
let onSearch = _ref.onSearch,
|
|
640
721
|
type = _ref.type,
|
|
641
722
|
onClose = _ref.onClose,
|
|
@@ -781,7 +862,7 @@ const RegisteredVendorSearch = _ref => {
|
|
|
781
862
|
onClick: onClose
|
|
782
863
|
}, /*#__PURE__*/React__default.createElement(digitUiReactComponents.CloseSvg, null))), /*#__PURE__*/React__default.createElement("div", {
|
|
783
864
|
className: "search-tabs-container"
|
|
784
|
-
}, /*#__PURE__*/React__default.createElement("div", null, (matchedRoles === null || matchedRoles === void 0 ? void 0 : (_matchedRoles$wt3 = matchedRoles.wt) === null || _matchedRoles$wt3 === void 0 ? void 0 : _matchedRoles$wt3.includes("WT_VENDOR")) && /*#__PURE__*/React__default.createElement("button", {
|
|
865
|
+
}, /*#__PURE__*/React__default.createElement("div", null, ((matchedRoles === null || matchedRoles === void 0 ? void 0 : (_matchedRoles$wt3 = matchedRoles.wt) === null || _matchedRoles$wt3 === void 0 ? void 0 : _matchedRoles$wt3.includes("WT_VENDOR")) || (matchedRoles === null || matchedRoles === void 0 ? void 0 : (_matchedRoles$ekyc3 = matchedRoles.ekyc) === null || _matchedRoles$ekyc3 === void 0 ? void 0 : _matchedRoles$ekyc3.includes("EKYC_VENDOR"))) && /*#__PURE__*/React__default.createElement("button", {
|
|
785
866
|
className: selectedTab === "VENDOR" ? "search-tab-head-selected" : "search-tab-head",
|
|
786
867
|
onClick: () => {
|
|
787
868
|
clearSearch();
|
|
@@ -799,13 +880,13 @@ const RegisteredVendorSearch = _ref => {
|
|
|
799
880
|
clearSearch();
|
|
800
881
|
onTabChange("DRIVER");
|
|
801
882
|
}
|
|
802
|
-
}, t("ES_FSM_REGISTRY_INBOX_TAB_DRIVER")), ((matchedRoles === null || matchedRoles === void 0 ? void 0 : (_matchedRoles$
|
|
883
|
+
}, t("ES_FSM_REGISTRY_INBOX_TAB_DRIVER")), ((matchedRoles === null || matchedRoles === void 0 ? void 0 : (_matchedRoles$ekyc4 = matchedRoles.ekyc) === null || _matchedRoles$ekyc4 === void 0 ? void 0 : _matchedRoles$ekyc4.includes("EKYC_VENDOR")) || (matchedRoles === null || matchedRoles === void 0 ? void 0 : (_matchedRoles$ekyc5 = matchedRoles.ekyc) === null || _matchedRoles$ekyc5 === void 0 ? void 0 : _matchedRoles$ekyc5.includes("EMPLOYEE"))) && /*#__PURE__*/React__default.createElement("button", {
|
|
803
884
|
className: selectedTab === "SUPERVISOR" ? "search-tab-head-selected" : "search-tab-head",
|
|
804
885
|
onClick: () => {
|
|
805
886
|
clearSearch();
|
|
806
887
|
onTabChange("SUPERVISOR");
|
|
807
888
|
}
|
|
808
|
-
}, t("ES_FSM_REGISTRY_INBOX_TAB_SUPERVISOR")), ((matchedRoles === null || matchedRoles === void 0 ? void 0 : (_matchedRoles$
|
|
889
|
+
}, t("ES_FSM_REGISTRY_INBOX_TAB_SUPERVISOR")), ((matchedRoles === null || matchedRoles === void 0 ? void 0 : (_matchedRoles$ekyc6 = matchedRoles.ekyc) === null || _matchedRoles$ekyc6 === void 0 ? void 0 : _matchedRoles$ekyc6.includes("EKYC_SUPERVISOR")) || (matchedRoles === null || matchedRoles === void 0 ? void 0 : (_matchedRoles$ekyc7 = matchedRoles.ekyc) === null || _matchedRoles$ekyc7 === void 0 ? void 0 : _matchedRoles$ekyc7.includes("EKYC_VENDOR")) || (matchedRoles === null || matchedRoles === void 0 ? void 0 : (_matchedRoles$ekyc8 = matchedRoles.ekyc) === null || _matchedRoles$ekyc8 === void 0 ? void 0 : _matchedRoles$ekyc8.includes("EMPLOYEE"))) && /*#__PURE__*/React__default.createElement("button", {
|
|
809
890
|
className: selectedTab === "SURVEYOR" ? "search-tab-head-selected" : "search-tab-head",
|
|
810
891
|
onClick: () => {
|
|
811
892
|
clearSearch();
|
|
@@ -1010,7 +1091,7 @@ const VendorInbox = props => {
|
|
|
1010
1091
|
const userInfo = Digit.SessionStorage.get("User");
|
|
1011
1092
|
const userRoles = userInfo.info.roles;
|
|
1012
1093
|
const userType = (_userInfo$info$type = userInfo.info.type) === null || _userInfo$info$type === void 0 ? void 0 : _userInfo$info$type.toLowerCase();
|
|
1013
|
-
const EKYC_ROLES = ["
|
|
1094
|
+
const EKYC_ROLES = ["EKYC_SUPERVISOR", "EKYC_SURVEYOR"];
|
|
1014
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));
|
|
1015
1096
|
const openWorkOrderModal = vendorDetails => {
|
|
1016
1097
|
setSelectedVendorForWorkOrder(vendorDetails);
|
|
@@ -1335,9 +1416,11 @@ const VendorInbox = props => {
|
|
|
1335
1416
|
});
|
|
1336
1417
|
},
|
|
1337
1418
|
onSuccess: (data, variables) => {
|
|
1419
|
+
console.log("newStatus:", newStatus, "isDisable:", newStatus === "DISABLED");
|
|
1338
1420
|
setShowToast({
|
|
1339
1421
|
key: "success",
|
|
1340
|
-
action: "SUPERVISOR"
|
|
1422
|
+
action: "SUPERVISOR",
|
|
1423
|
+
isDisable: newStatus === "DISABLED"
|
|
1341
1424
|
});
|
|
1342
1425
|
queryClient.invalidateQueries("FSM_SUPERVISOR_SEARCH");
|
|
1343
1426
|
queryClient.invalidateQueries("SUPERVISOR_SEARCH");
|
|
@@ -1371,9 +1454,11 @@ const VendorInbox = props => {
|
|
|
1371
1454
|
});
|
|
1372
1455
|
},
|
|
1373
1456
|
onSuccess: (data, variables) => {
|
|
1457
|
+
console.log("newStatus:", newStatus, "isDisable:", newStatus === "DISABLED");
|
|
1374
1458
|
setShowToast({
|
|
1375
1459
|
key: "success",
|
|
1376
|
-
action: "SURVEYOR"
|
|
1460
|
+
action: "SURVEYOR",
|
|
1461
|
+
isDisable: newStatus === "DISABLED"
|
|
1377
1462
|
});
|
|
1378
1463
|
queryClient.invalidateQueries("FSM_SURVEYOR_SEARCH");
|
|
1379
1464
|
queryClient.invalidateQueries("SURVEYOR_SEARCH");
|
|
@@ -2527,7 +2612,7 @@ const SearchVendor = () => {
|
|
|
2527
2612
|
const userInfo = Digit.UserService.getUser();
|
|
2528
2613
|
const roles = ((_Digit$UserService$ge = Digit.UserService.getUser()) === null || _Digit$UserService$ge === void 0 ? void 0 : (_Digit$UserService$ge2 = _Digit$UserService$ge.info) === null || _Digit$UserService$ge2 === void 0 ? void 0 : (_Digit$UserService$ge3 = _Digit$UserService$ge2.roles) === null || _Digit$UserService$ge3 === void 0 ? void 0 : _Digit$UserService$ge3.map(r => r.code)) || [];
|
|
2529
2614
|
const location = reactRouterDom.useLocation();
|
|
2530
|
-
const initialPage = roles.includes("
|
|
2615
|
+
const initialPage = roles.includes("EKYC_VENDOR") || roles.includes("WT_VENDOR") ? "VENDOR" : roles.includes("EKYC_SUPERVISOR") ? "SURVEYOR" : roles.includes("EKYC_SURVEYOR") ? "SURVEYOR" : roles.includes("EMPLOYEE") ? "SUPERVISOR" : "";
|
|
2531
2616
|
const _Digit$Hooks$useQuery = Digit.Hooks.useQueryParams(),
|
|
2532
2617
|
selectedTabs = _Digit$Hooks$useQuery.selectedTabs;
|
|
2533
2618
|
const _useState = React.useState(selectedTabs || initialPage),
|
|
@@ -3356,15 +3441,22 @@ const SupervisorConfig = function (t, agencies, reportingManagers, disabled) {
|
|
|
3356
3441
|
populators: {
|
|
3357
3442
|
name: "fullName",
|
|
3358
3443
|
validation: {
|
|
3359
|
-
required:
|
|
3444
|
+
required: {
|
|
3445
|
+
value: true,
|
|
3446
|
+
message: t("ES_VENDOR_INVALID_NAME")
|
|
3447
|
+
},
|
|
3448
|
+
maxLength: {
|
|
3449
|
+
value: 49,
|
|
3450
|
+
message: t("ES_VENDOR_NAME_MAX_50_CHARACTERS")
|
|
3451
|
+
},
|
|
3360
3452
|
pattern: {
|
|
3361
3453
|
value: /^[A-Za-z\s]+$/,
|
|
3362
3454
|
message: t("ES_VENDOR_INVALID_NAME")
|
|
3363
3455
|
}
|
|
3364
3456
|
},
|
|
3365
|
-
error: t("ES_VENDOR_INVALID_NAME"),
|
|
3366
3457
|
defaultValue: "",
|
|
3367
|
-
className: "payment-form-text-input-correction"
|
|
3458
|
+
className: "payment-form-text-input-correction",
|
|
3459
|
+
maxlength: 50
|
|
3368
3460
|
}
|
|
3369
3461
|
}, {
|
|
3370
3462
|
label: t("ES_VENDOR_SUPERVISOR_MOBILE_NUMBER"),
|
|
@@ -3897,7 +3989,7 @@ const formatLabel = key => {
|
|
|
3897
3989
|
return result.charAt(0).toUpperCase() + result.slice(1);
|
|
3898
3990
|
};
|
|
3899
3991
|
const VendorDetails = () => {
|
|
3900
|
-
var _dsoData$, _dsoData$$dsoDetails, _vendorAdditionalData, _vendorAdditionalData2, _vendorAdditionalData3, _parsedAdditionalDeta, _userInfo$info$type, _dsoData$5, _dsoData$5$employeeRe, _supervisorData$super, _surveyorData$surveyo;
|
|
3992
|
+
var _dsoData$, _dsoData$$dsoDetails, _vendorAdditionalData, _vendorAdditionalData2, _vendorAdditionalData3, _parsedAdditionalDeta, _userInfo$info$type, _userInfo$info, _userInfo$info$roles, _dsoData$5, _dsoData$5$employeeRe, _supervisorData$super, _surveyorData$surveyo;
|
|
3901
3993
|
const tenantId = Digit.ULBService.getCurrentTenantId();
|
|
3902
3994
|
const _useTranslation = reactI18next.useTranslation(),
|
|
3903
3995
|
t = _useTranslation.t;
|
|
@@ -4003,6 +4095,8 @@ const VendorDetails = () => {
|
|
|
4003
4095
|
}
|
|
4004
4096
|
const userInfo = Digit.SessionStorage.get("User");
|
|
4005
4097
|
const userType = (_userInfo$info$type = userInfo.info.type) === null || _userInfo$info$type === void 0 ? void 0 : _userInfo$info$type.toLowerCase();
|
|
4098
|
+
const userRoles = (userInfo === null || userInfo === void 0 ? void 0 : (_userInfo$info = userInfo.info) === null || _userInfo$info === void 0 ? void 0 : (_userInfo$info$roles = _userInfo$info.roles) === null || _userInfo$info$roles === void 0 ? void 0 : _userInfo$info$roles.map(r => r.code)) || [];
|
|
4099
|
+
const isEkycVendor = userRoles.includes("EKYC_VENDOR");
|
|
4006
4100
|
React.useEffect(() => {
|
|
4007
4101
|
switch (selectedAction) {
|
|
4008
4102
|
case "DELETE":
|
|
@@ -4378,7 +4472,7 @@ const VendorDetails = () => {
|
|
|
4378
4472
|
manualPagination: false,
|
|
4379
4473
|
pageSizeLimit: 10,
|
|
4380
4474
|
t: t
|
|
4381
|
-
}), /*#__PURE__*/React__default.createElement("div", {
|
|
4475
|
+
}), isEkycVendor && /*#__PURE__*/React__default.createElement("div", {
|
|
4382
4476
|
className: "add-details-link hover-button",
|
|
4383
4477
|
onClick: () => history.push("/digit-ui/" + userType + "/vendor/registry/new-supervisor?vendorId=" + (dsoId || vendorId))
|
|
4384
4478
|
}, t("ES_VENDOR_ADD_SUPERVISOR"))), /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardSectionHeader, {
|
|
@@ -4394,7 +4488,10 @@ const VendorDetails = () => {
|
|
|
4394
4488
|
manualPagination: false,
|
|
4395
4489
|
pageSizeLimit: 10,
|
|
4396
4490
|
t: t
|
|
4397
|
-
})
|
|
4491
|
+
}), isEkycVendor && /*#__PURE__*/React__default.createElement("div", {
|
|
4492
|
+
className: "add-details-link hover-button",
|
|
4493
|
+
onClick: () => history.push("/digit-ui/" + userType + "/vendor/registry/new-surveyor?vendorId=" + (dsoId || vendorId))
|
|
4494
|
+
}, t("ES_VENDOR_ADD_SURVEYOR"))))), showModal && /*#__PURE__*/React__default.createElement(digitUiReactComponents.Modal, {
|
|
4398
4495
|
headerBarMain: /*#__PURE__*/React__default.createElement("h1", {
|
|
4399
4496
|
className: "heading-m"
|
|
4400
4497
|
}, t(selectedAction === "DELETE" ? "ES_FSM_REGISTRY_DELETE_POPUP_HEADER" : selectedAction === "ADD_VEHICLE" ? "ES_FSM_REGISTRY_ADD_VEHICLE_POPUP_HEADER" : "ES_FSM_REGISTRY_ADD_DRIVER_POPUP_HEADER")),
|
|
@@ -4620,7 +4717,8 @@ const VendorConfig = function (t, module, genderMenu, update) {
|
|
|
4620
4717
|
isMandatory: true,
|
|
4621
4718
|
type: "component",
|
|
4622
4719
|
key: "zoneIds",
|
|
4623
|
-
component: "SelectEkycZones"
|
|
4720
|
+
component: "SelectEkycZones",
|
|
4721
|
+
disable: update
|
|
4624
4722
|
}, {
|
|
4625
4723
|
label: "ES_FSM_REGISTRY_NEW_OWNER_NAME",
|
|
4626
4724
|
isMandatory: true,
|
|
@@ -4653,13 +4751,26 @@ const VendorConfig = function (t, module, genderMenu, update) {
|
|
|
4653
4751
|
populators: {
|
|
4654
4752
|
name: "dob",
|
|
4655
4753
|
validation: {
|
|
4656
|
-
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
|
+
}
|
|
4657
4766
|
},
|
|
4658
4767
|
component: (props, customProps) => /*#__PURE__*/React__default.createElement(digitUiReactComponents.DatePicker, _extends({
|
|
4659
4768
|
onChange: props.onChange,
|
|
4660
4769
|
date: props.value
|
|
4661
4770
|
}, customProps, {
|
|
4662
|
-
|
|
4771
|
+
isDOB: true,
|
|
4772
|
+
minAge: 18,
|
|
4773
|
+
max: convertEpochToDate(new Date().setFullYear(new Date().getFullYear() - 18))
|
|
4663
4774
|
}))
|
|
4664
4775
|
}
|
|
4665
4776
|
}] : [])]
|
|
@@ -5666,12 +5777,19 @@ const VENDORCreate = _ref => {
|
|
|
5666
5777
|
React__default.useEffect(() => {
|
|
5667
5778
|
const searchParams = new URLSearchParams(search || window.location.search);
|
|
5668
5779
|
const vendorId = searchParams.get("vendorId");
|
|
5669
|
-
if (vendorId
|
|
5670
|
-
|
|
5671
|
-
|
|
5672
|
-
|
|
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
|
+
}
|
|
5673
5791
|
}
|
|
5674
|
-
}, [search,
|
|
5792
|
+
}, [search, pathname, params, setParams, clearParams, queryClient]);
|
|
5675
5793
|
const goNext = (skipStep, index, isAddMultiple, key) => {
|
|
5676
5794
|
let currentPath = pathname.split("/").pop(),
|
|
5677
5795
|
lastchar = currentPath.charAt(currentPath.length - 1),
|
|
@@ -5713,10 +5831,6 @@ const VENDORCreate = _ref => {
|
|
|
5713
5831
|
}
|
|
5714
5832
|
redirectWithHistory(nextPage);
|
|
5715
5833
|
};
|
|
5716
|
-
if (params && Object.keys(params).length > 0 && window.location.href.includes("/info") && sessionStorage.getItem("docReqScreenByBack") !== "true") {
|
|
5717
|
-
clearParams();
|
|
5718
|
-
queryClient.invalidateQueries("VENDOR_CREATE");
|
|
5719
|
-
}
|
|
5720
5834
|
const vendorcreate = function () {
|
|
5721
5835
|
try {
|
|
5722
5836
|
history.push(match.path + "/acknowledgement");
|
|
@@ -9441,12 +9555,15 @@ const VehicleDetails = props => {
|
|
|
9441
9555
|
};
|
|
9442
9556
|
|
|
9443
9557
|
const SelectEkycZones = _ref => {
|
|
9558
|
+
var _Digit$SessionStorage, _loggedInUser$roles, _config$props;
|
|
9444
9559
|
let config = _ref.config,
|
|
9445
9560
|
onSelect = _ref.onSelect,
|
|
9446
9561
|
t = _ref.t,
|
|
9447
9562
|
formData = _ref.formData,
|
|
9448
9563
|
_ref$isMultiSelect = _ref.isMultiSelect,
|
|
9449
|
-
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;
|
|
9450
9567
|
const tenantId = Digit.ULBService.getCurrentTenantId();
|
|
9451
9568
|
const _useState = React.useState([]),
|
|
9452
9569
|
zones = _useState[0],
|
|
@@ -9455,6 +9572,45 @@ const SelectEkycZones = _ref => {
|
|
|
9455
9572
|
selectedZones = _useState2[0],
|
|
9456
9573
|
setSelectedZones = _useState2[1];
|
|
9457
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");
|
|
9576
|
+
const loggedInUser = (_Digit$SessionStorage = Digit.SessionStorage.get("User")) === null || _Digit$SessionStorage === void 0 ? void 0 : _Digit$SessionStorage.info;
|
|
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)) || [];
|
|
9578
|
+
const isEkycVendor = roles.includes("EKYC_VENDOR");
|
|
9579
|
+
const isEkycSupervisor = roles.includes("EKYC_SUPERVISOR");
|
|
9580
|
+
const _Digit$Hooks$fsm$useD = Digit.Hooks.fsm.useDsoSearch(tenantId, {
|
|
9581
|
+
status: "ACTIVE"
|
|
9582
|
+
}, {
|
|
9583
|
+
enabled: isEkycVendor && !isVendorPage
|
|
9584
|
+
}),
|
|
9585
|
+
vendorSearchResponse = _Digit$Hooks$fsm$useD.data,
|
|
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;
|
|
9594
|
+
const matchedVendor = React__default.useMemo(() => {
|
|
9595
|
+
var _vendorSearchResponse, _vendorSearchResponse2;
|
|
9596
|
+
if (!vendorSearchResponse) return null;
|
|
9597
|
+
const userUuid = loggedInUser === null || loggedInUser === void 0 ? void 0 : loggedInUser.uuid;
|
|
9598
|
+
const userMobile = loggedInUser === null || loggedInUser === void 0 ? void 0 : loggedInUser.mobileNumber;
|
|
9599
|
+
return ((_vendorSearchResponse = vendorSearchResponse.find(v => {
|
|
9600
|
+
var _actualVendor$owner, _actualVendor$owner2, _actualVendor$owner3;
|
|
9601
|
+
const actualVendor = v.dsoDetails || v;
|
|
9602
|
+
const ownerUuid = ((_actualVendor$owner = actualVendor.owner) === null || _actualVendor$owner === void 0 ? void 0 : _actualVendor$owner.uuid) || ((_actualVendor$owner2 = actualVendor.owner) === null || _actualVendor$owner2 === void 0 ? void 0 : _actualVendor$owner2.id);
|
|
9603
|
+
const ownerMobile = ((_actualVendor$owner3 = actualVendor.owner) === null || _actualVendor$owner3 === void 0 ? void 0 : _actualVendor$owner3.mobileNumber) || actualVendor.mobileNumber;
|
|
9604
|
+
return userUuid && ownerUuid === userUuid || userMobile && ownerMobile === userMobile;
|
|
9605
|
+
})) === null || _vendorSearchResponse === void 0 ? void 0 : _vendorSearchResponse.dsoDetails) || ((_vendorSearchResponse2 = vendorSearchResponse[0]) === null || _vendorSearchResponse2 === void 0 ? void 0 : _vendorSearchResponse2.dsoDetails) || vendorSearchResponse[0];
|
|
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]);
|
|
9458
9614
|
const _Digit$Hooks$useCommo = Digit.Hooks.useCommonMDMS(tenantId, "egov-location", ["TenantBoundary"]),
|
|
9459
9615
|
boundaryData = _Digit$Hooks$useCommo.data,
|
|
9460
9616
|
isLoading = _Digit$Hooks$useCommo.isLoading;
|
|
@@ -9467,19 +9623,19 @@ const SelectEkycZones = _ref => {
|
|
|
9467
9623
|
code: zone.code,
|
|
9468
9624
|
name: zone.name
|
|
9469
9625
|
})));
|
|
9470
|
-
|
|
9626
|
+
let zonesList = [...new Map(allZones.map(z => [z.code, z])).values()];
|
|
9471
9627
|
setZones(zonesList);
|
|
9472
9628
|
}
|
|
9473
|
-
}, [boundaryData]);
|
|
9629
|
+
}, [boundaryData, isEkycVendor, matchedVendor, isEkycSupervisor, matchedSupervisor, isVendorPage]);
|
|
9474
9630
|
React.useEffect(() => {
|
|
9475
9631
|
if (!zones.length || !(formData !== null && formData !== void 0 && formData.zoneIds)) return;
|
|
9476
9632
|
if (isMultiSelect) {
|
|
9477
9633
|
if (!Array.isArray(formData.zoneIds)) return;
|
|
9478
|
-
if (formData.zoneIds.length && typeof formData.zoneIds[0] === "object") {
|
|
9479
|
-
setSelectedZones(formData.zoneIds);
|
|
9634
|
+
if (formData.zoneIds.length && typeof formData.zoneIds[0] === "object" && formData.zoneIds[0] !== null) {
|
|
9635
|
+
setSelectedZones(formData.zoneIds.filter(Boolean));
|
|
9480
9636
|
return;
|
|
9481
9637
|
}
|
|
9482
|
-
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)));
|
|
9483
9639
|
setSelectedZones(selected);
|
|
9484
9640
|
if (!initialized.current) {
|
|
9485
9641
|
initialized.current = true;
|
|
@@ -9491,10 +9647,10 @@ const SelectEkycZones = _ref => {
|
|
|
9491
9647
|
var _selectedVal$, _selectedVal$2;
|
|
9492
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] || "";
|
|
9493
9649
|
}
|
|
9494
|
-
if (typeof selectedVal === "object") {
|
|
9650
|
+
if (selectedVal && typeof selectedVal === "object") {
|
|
9495
9651
|
selectedVal = selectedVal.name || selectedVal.code || "";
|
|
9496
9652
|
}
|
|
9497
|
-
const selected = zones.find(zone => zone.name === selectedVal || zone.code === selectedVal);
|
|
9653
|
+
const selected = zones.find(zone => zone && (zone.name === selectedVal || zone.code === selectedVal));
|
|
9498
9654
|
setSelectedZones(selected ? [selected] : []);
|
|
9499
9655
|
if (!initialized.current && selected) {
|
|
9500
9656
|
initialized.current = true;
|
|
@@ -9502,6 +9658,13 @@ const SelectEkycZones = _ref => {
|
|
|
9502
9658
|
}
|
|
9503
9659
|
}
|
|
9504
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]);
|
|
9505
9668
|
const handleSelect = value => {
|
|
9506
9669
|
if (isMultiSelect) {
|
|
9507
9670
|
const selected = Array.isArray(value) ? value.map(v => Array.isArray(v) ? v[1] : v).filter(Boolean) : [];
|
|
@@ -9513,7 +9676,7 @@ const SelectEkycZones = _ref => {
|
|
|
9513
9676
|
onSelect(config.key, (selectedZone === null || selectedZone === void 0 ? void 0 : selectedZone.name) || "");
|
|
9514
9677
|
}
|
|
9515
9678
|
};
|
|
9516
|
-
if (isLoading) return /*#__PURE__*/React__default.createElement(digitUiReactComponents.Loader, null);
|
|
9679
|
+
if (isLoading || isEkycVendor && !isVendorPage && isVendorSearchLoading || isEkycSupervisor && isSupervisorSearchLoading) return /*#__PURE__*/React__default.createElement(digitUiReactComponents.Loader, null);
|
|
9517
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", {
|
|
9518
9681
|
className: "check-page-link-button"
|
|
9519
9682
|
}, " * ") : ""), /*#__PURE__*/React__default.createElement("div", {
|
|
@@ -9534,10 +9697,11 @@ const SelectEkycZones = _ref => {
|
|
|
9534
9697
|
ServerStyle: {
|
|
9535
9698
|
backgroundColor: "#fff"
|
|
9536
9699
|
},
|
|
9537
|
-
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
|
|
9538
9702
|
})), isMultiSelect && selectedZones.length > 0 && /*#__PURE__*/React__default.createElement("div", {
|
|
9539
9703
|
className: "selected-zones"
|
|
9540
|
-
}, selectedZones.map(zone => /*#__PURE__*/React__default.createElement("span", {
|
|
9704
|
+
}, selectedZones.filter(zone => zone && zone.code).map(zone => /*#__PURE__*/React__default.createElement("span", {
|
|
9541
9705
|
key: zone.code,
|
|
9542
9706
|
className: "selected-zone-chip"
|
|
9543
9707
|
}, zone.name))));
|