@djb25/digit-ui-module-vendor 1.0.81 → 1.0.82
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 +138 -13
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +138 -13
- package/dist/index.modern.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -751,7 +751,8 @@ const RegisteredVendorSearch = _ref => {
|
|
|
751
751
|
searchParams = _ref.searchParams,
|
|
752
752
|
isInboxPage = _ref.isInboxPage,
|
|
753
753
|
selectedTab = _ref.selectedTab,
|
|
754
|
-
matchedRoles = _ref.matchedRoles
|
|
754
|
+
matchedRoles = _ref.matchedRoles,
|
|
755
|
+
ekycVendorCount = _ref.ekycVendorCount;
|
|
755
756
|
const storedSearchParams = isInboxPage ? Digit.SessionStorage.get("vendor/inbox/searchParams") : Digit.SessionStorage.get("vendor/search/searchParams");
|
|
756
757
|
const _useTranslation = reactI18next.useTranslation(),
|
|
757
758
|
t = _useTranslation.t;
|
|
@@ -767,6 +768,9 @@ const RegisteredVendorSearch = _ref => {
|
|
|
767
768
|
const _useState = React.useState(false),
|
|
768
769
|
showAddMenu = _useState[0],
|
|
769
770
|
setShowAddMenu = _useState[1];
|
|
771
|
+
const _useState2 = React.useState(null),
|
|
772
|
+
showToast = _useState2[0],
|
|
773
|
+
setShowToast = _useState2[1];
|
|
770
774
|
const mobileView = window.Digit.Utils.browser.isMobile();
|
|
771
775
|
const FSTP = Digit.UserService.hasAccess("FSM_EMP_FSTPO") || false;
|
|
772
776
|
const onSubmitInput = data => {
|
|
@@ -810,7 +814,13 @@ const RegisteredVendorSearch = _ref => {
|
|
|
810
814
|
const userPath = userType === null || userType === void 0 ? void 0 : userType.toLowerCase();
|
|
811
815
|
switch (action) {
|
|
812
816
|
case "VENDOR":
|
|
813
|
-
|
|
817
|
+
if (ekycVendorCount >= 3) {
|
|
818
|
+
setShowToast({
|
|
819
|
+
key: "error",
|
|
820
|
+
action: "You can't create more than 3 eKYC vendors. Please delete an existing vendor before creating a new one."
|
|
821
|
+
});
|
|
822
|
+
return;
|
|
823
|
+
} else return history.push("/digit-ui/" + userPath + "/vendor/registry/new-vendor");
|
|
814
824
|
case "VEHICLE":
|
|
815
825
|
return history.push("/digit-ui/" + userPath + "/vendor/registry/new-vehicle");
|
|
816
826
|
case "DRIVER":
|
|
@@ -821,6 +831,9 @@ const RegisteredVendorSearch = _ref => {
|
|
|
821
831
|
return history.push("/digit-ui/" + userPath + "/vendor/registry/new-surveyor");
|
|
822
832
|
}
|
|
823
833
|
}
|
|
834
|
+
const closeToast = () => {
|
|
835
|
+
setShowToast(null);
|
|
836
|
+
};
|
|
824
837
|
const getFields = input => {
|
|
825
838
|
switch (input.type) {
|
|
826
839
|
case "date":
|
|
@@ -955,7 +968,12 @@ const RegisteredVendorSearch = _ref => {
|
|
|
955
968
|
className: "submit-bar-search",
|
|
956
969
|
label: t("ES_COMMON_SEARCH"),
|
|
957
970
|
submit: true
|
|
958
|
-
}))))))
|
|
971
|
+
})))))), showToast && /*#__PURE__*/React__default.createElement(digitUiReactComponents.Toast, {
|
|
972
|
+
error: (showToast === null || showToast === void 0 ? void 0 : showToast.key) === "error",
|
|
973
|
+
label: t(showToast === null || showToast === void 0 ? void 0 : showToast.action),
|
|
974
|
+
onClose: closeToast,
|
|
975
|
+
duration: 5000
|
|
976
|
+
}));
|
|
959
977
|
};
|
|
960
978
|
|
|
961
979
|
const _excluded$2 = ["id"];
|
|
@@ -1117,6 +1135,8 @@ const VendorInbox = props => {
|
|
|
1117
1135
|
const userInfo = Digit.SessionStorage.get("User");
|
|
1118
1136
|
const userRoles = userInfo.info.roles;
|
|
1119
1137
|
const userType = (_userInfo$info$type = userInfo.info.type) === null || _userInfo$info$type === void 0 ? void 0 : _userInfo$info$type.toLowerCase();
|
|
1138
|
+
const isEmployee = userType === "employee";
|
|
1139
|
+
const isEkycSupervisor = userRoles.some(role => role.code === "EKYC_SUPERVISOR");
|
|
1120
1140
|
const isVendor = Digit.Utils.vendorAccess() || Digit.UserService.hasAccess(["WT_VENDOR", "EKYC_VENDOR", "VENDOR", "FSM_VENDOR", "DSO", "FSM_DSO"]) || (userRoles === null || userRoles === void 0 ? void 0 : userRoles.some(role => ["FSM_VENDOR", "VENDOR", "EKYC_VENDOR", "WT_VENDOR", "DSO", "FSM_DSO"].includes(typeof role === "string" ? role : role === null || role === void 0 ? void 0 : role.code))) || userType === "vendor";
|
|
1121
1141
|
const EKYC_ROLES = ["EKYC_SUPERVISOR", "EKYC_SURVEYOR"];
|
|
1122
1142
|
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));
|
|
@@ -1227,7 +1247,8 @@ const VendorInbox = props => {
|
|
|
1227
1247
|
mutateVehicle = _Digit$Hooks$fsm$useU.mutate;
|
|
1228
1248
|
const _Digit$Hooks$fsm$useD3 = Digit.Hooks.fsm.useDriverUpdate(tenantId),
|
|
1229
1249
|
mutateDriver = _Digit$Hooks$fsm$useD3.mutate;
|
|
1230
|
-
const _Digit$Hooks$fsm$useS = Digit.Hooks.fsm.useSupervisorUpdate(tenantId)
|
|
1250
|
+
const _Digit$Hooks$fsm$useS = Digit.Hooks.fsm.useSupervisorUpdate(tenantId),
|
|
1251
|
+
mutateSupervisor = _Digit$Hooks$fsm$useS.mutate;
|
|
1231
1252
|
const _Digit$Hooks$fsm$useS2 = Digit.Hooks.fsm.useSurveyorUpdate(tenantId),
|
|
1232
1253
|
mutateSurveyor = _Digit$Hooks$fsm$useS2.mutate;
|
|
1233
1254
|
React.useEffect(() => {
|
|
@@ -1416,6 +1437,80 @@ const VendorInbox = props => {
|
|
|
1416
1437
|
}
|
|
1417
1438
|
});
|
|
1418
1439
|
};
|
|
1440
|
+
const onSupervisorUpdate = row => {
|
|
1441
|
+
var _formDetails$owner9, _formDetails$owner0, _formDetails$owner1, _formDetails$owner10;
|
|
1442
|
+
let formDetails = row.original;
|
|
1443
|
+
const newStatus = (formDetails === null || formDetails === void 0 ? void 0 : formDetails.status) === "ACTIVE" ? "DISABLED" : "ACTIVE";
|
|
1444
|
+
const newActive = newStatus === "ACTIVE";
|
|
1445
|
+
const formData = {
|
|
1446
|
+
supervisor: _extends({}, formDetails, {
|
|
1447
|
+
status: newStatus,
|
|
1448
|
+
active: newActive,
|
|
1449
|
+
owner: _extends({}, formDetails === null || formDetails === void 0 ? void 0 : formDetails.owner, {
|
|
1450
|
+
active: newActive,
|
|
1451
|
+
gender: (formDetails === null || formDetails === void 0 ? void 0 : (_formDetails$owner9 = formDetails.owner) === null || _formDetails$owner9 === void 0 ? void 0 : _formDetails$owner9.gender) || "OTHERS",
|
|
1452
|
+
dob: (formDetails === null || formDetails === void 0 ? void 0 : (_formDetails$owner0 = formDetails.owner) === null || _formDetails$owner0 === void 0 ? void 0 : _formDetails$owner0.dob) || new Date("1/1/1970").getTime(),
|
|
1453
|
+
emailId: (formDetails === null || formDetails === void 0 ? void 0 : (_formDetails$owner1 = formDetails.owner) === null || _formDetails$owner1 === void 0 ? void 0 : _formDetails$owner1.emailId) || "abc@egov.com",
|
|
1454
|
+
relationship: (formDetails === null || formDetails === void 0 ? void 0 : (_formDetails$owner10 = formDetails.owner) === null || _formDetails$owner10 === void 0 ? void 0 : _formDetails$owner10.relationship) || "OTHER"
|
|
1455
|
+
})
|
|
1456
|
+
})
|
|
1457
|
+
};
|
|
1458
|
+
mutateSupervisor(formData, {
|
|
1459
|
+
onError: (error, variables) => {
|
|
1460
|
+
setShowToast({
|
|
1461
|
+
key: "error",
|
|
1462
|
+
action: (error === null || error === void 0 ? void 0 : error.message) || error
|
|
1463
|
+
});
|
|
1464
|
+
},
|
|
1465
|
+
onSuccess: (data, variables) => {
|
|
1466
|
+
setShowToast({
|
|
1467
|
+
key: "success",
|
|
1468
|
+
action: "SUPERVISOR",
|
|
1469
|
+
isDisable: newStatus === "DISABLED"
|
|
1470
|
+
});
|
|
1471
|
+
queryClient.invalidateQueries("FSM_SUPERVISOR_SEARCH");
|
|
1472
|
+
queryClient.invalidateQueries("SUPERVISOR_SEARCH");
|
|
1473
|
+
props.refetchData();
|
|
1474
|
+
}
|
|
1475
|
+
});
|
|
1476
|
+
};
|
|
1477
|
+
const onSurveyorUpdate = row => {
|
|
1478
|
+
var _formDetails$owner11, _formDetails$owner12, _formDetails$owner13, _formDetails$owner14;
|
|
1479
|
+
let formDetails = row.original;
|
|
1480
|
+
const newStatus = (formDetails === null || formDetails === void 0 ? void 0 : formDetails.status) === "ACTIVE" ? "DISABLED" : "ACTIVE";
|
|
1481
|
+
const newActive = newStatus === "ACTIVE";
|
|
1482
|
+
const formData = {
|
|
1483
|
+
surveyor: _extends({}, formDetails, {
|
|
1484
|
+
status: newStatus,
|
|
1485
|
+
active: newActive,
|
|
1486
|
+
owner: _extends({}, formDetails === null || formDetails === void 0 ? void 0 : formDetails.owner, {
|
|
1487
|
+
active: newActive,
|
|
1488
|
+
gender: (formDetails === null || formDetails === void 0 ? void 0 : (_formDetails$owner11 = formDetails.owner) === null || _formDetails$owner11 === void 0 ? void 0 : _formDetails$owner11.gender) || "OTHERS",
|
|
1489
|
+
dob: (formDetails === null || formDetails === void 0 ? void 0 : (_formDetails$owner12 = formDetails.owner) === null || _formDetails$owner12 === void 0 ? void 0 : _formDetails$owner12.dob) || new Date("1/1/1970").getTime(),
|
|
1490
|
+
emailId: (formDetails === null || formDetails === void 0 ? void 0 : (_formDetails$owner13 = formDetails.owner) === null || _formDetails$owner13 === void 0 ? void 0 : _formDetails$owner13.emailId) || "abc@egov.com",
|
|
1491
|
+
relationship: (formDetails === null || formDetails === void 0 ? void 0 : (_formDetails$owner14 = formDetails.owner) === null || _formDetails$owner14 === void 0 ? void 0 : _formDetails$owner14.relationship) || "OTHER"
|
|
1492
|
+
})
|
|
1493
|
+
})
|
|
1494
|
+
};
|
|
1495
|
+
mutateSurveyor(formData, {
|
|
1496
|
+
onError: (error, variables) => {
|
|
1497
|
+
setShowToast({
|
|
1498
|
+
key: "error",
|
|
1499
|
+
action: (error === null || error === void 0 ? void 0 : error.message) || error
|
|
1500
|
+
});
|
|
1501
|
+
},
|
|
1502
|
+
onSuccess: (data, variables) => {
|
|
1503
|
+
setShowToast({
|
|
1504
|
+
key: "success",
|
|
1505
|
+
action: "SURVEYOR",
|
|
1506
|
+
isDisable: newStatus === "DISABLED"
|
|
1507
|
+
});
|
|
1508
|
+
queryClient.invalidateQueries("FSM_SURVEYOR_SEARCH");
|
|
1509
|
+
queryClient.invalidateQueries("SURVEYOR_SEARCH");
|
|
1510
|
+
props.refetchData();
|
|
1511
|
+
}
|
|
1512
|
+
});
|
|
1513
|
+
};
|
|
1419
1514
|
const onVendorSelect = (row, selectedOption) => {
|
|
1420
1515
|
let driverData = row.original;
|
|
1421
1516
|
let existingVendor = driverData === null || driverData === void 0 ? void 0 : driverData.vendor;
|
|
@@ -1770,7 +1865,7 @@ const VendorInbox = props => {
|
|
|
1770
1865
|
const serviceType = ((_additionalDetails2 = additionalDetails) === null || _additionalDetails2 === void 0 ? void 0 : _additionalDetails2.serviceType) || "N/A";
|
|
1771
1866
|
return /*#__PURE__*/React__default.createElement("div", null, serviceType);
|
|
1772
1867
|
}
|
|
1773
|
-
}, ...(
|
|
1868
|
+
}, ...(isEmployee ? [{
|
|
1774
1869
|
Header: t("ES_VENDOR_REGISTRY_INBOX_ENABLED"),
|
|
1775
1870
|
id: "status",
|
|
1776
1871
|
accessor: row => {
|
|
@@ -2145,7 +2240,7 @@ const VendorInbox = props => {
|
|
|
2145
2240
|
width: "100%",
|
|
2146
2241
|
minWidth: "250px"
|
|
2147
2242
|
},
|
|
2148
|
-
disable: !supervisors.length
|
|
2243
|
+
disable: !supervisors.length || isEkycSupervisor
|
|
2149
2244
|
});
|
|
2150
2245
|
}
|
|
2151
2246
|
}] : []), {
|
|
@@ -2156,7 +2251,30 @@ const VendorInbox = props => {
|
|
|
2156
2251
|
let row = _ref32.row;
|
|
2157
2252
|
return GetCell((_row$original25 = row.original) !== null && _row$original25 !== void 0 && (_row$original25$audit = _row$original25.auditDetails) !== null && _row$original25$audit !== void 0 && _row$original25$audit.createdTime ? Digit.DateUtils.ConvertEpochToDate((_row$original26 = row.original) === null || _row$original26 === void 0 ? void 0 : (_row$original26$audit = _row$original26.auditDetails) === null || _row$original26$audit === void 0 ? void 0 : _row$original26$audit.createdTime) : "");
|
|
2158
2253
|
}
|
|
2159
|
-
}
|
|
2254
|
+
}, ...(!isEmployee ? [{
|
|
2255
|
+
Header: t("ES_FSM_REGISTRY_INBOX_ENABLED"),
|
|
2256
|
+
id: "status",
|
|
2257
|
+
accessor: row => row.status || "",
|
|
2258
|
+
Cell: _ref33 => {
|
|
2259
|
+
var _row$original27;
|
|
2260
|
+
let row = _ref33.row;
|
|
2261
|
+
return /*#__PURE__*/React__default.createElement(digitUiReactComponents.ToggleSwitch, {
|
|
2262
|
+
style: {
|
|
2263
|
+
display: "flex",
|
|
2264
|
+
justifyContent: "left"
|
|
2265
|
+
},
|
|
2266
|
+
value: ((_row$original27 = row.original) === null || _row$original27 === void 0 ? void 0 : _row$original27.status) === "DISABLED" ? false : true,
|
|
2267
|
+
onChange: () => {
|
|
2268
|
+
if (props.selectedTab === "SUPERVISOR") {
|
|
2269
|
+
onSupervisorUpdate(row);
|
|
2270
|
+
} else if (props.selectedTab === "SURVEYOR") {
|
|
2271
|
+
onSurveyorUpdate(row);
|
|
2272
|
+
}
|
|
2273
|
+
},
|
|
2274
|
+
name: "switch-" + row.id
|
|
2275
|
+
});
|
|
2276
|
+
}
|
|
2277
|
+
}] : [])];
|
|
2160
2278
|
default:
|
|
2161
2279
|
return [];
|
|
2162
2280
|
}
|
|
@@ -2522,7 +2640,8 @@ const VendorInbox = props => {
|
|
|
2522
2640
|
searchParams: props.searchParams,
|
|
2523
2641
|
onTabChange: props.onTabChange,
|
|
2524
2642
|
selectedTab: props.selectedTab,
|
|
2525
|
-
matchedRoles: matchedRoles
|
|
2643
|
+
matchedRoles: matchedRoles,
|
|
2644
|
+
ekycVendorCount: props.ekycVendorCount
|
|
2526
2645
|
}), /*#__PURE__*/React__default.createElement("div", {
|
|
2527
2646
|
className: "result",
|
|
2528
2647
|
style: {
|
|
@@ -2705,6 +2824,11 @@ const SearchVendor = () => {
|
|
|
2705
2824
|
vendorData = _Digit$Hooks$fsm$useD2.data,
|
|
2706
2825
|
isVendorLoading = _Digit$Hooks$fsm$useD2.isLoading,
|
|
2707
2826
|
refetchVendor = _Digit$Hooks$fsm$useD2.refetch;
|
|
2827
|
+
const ekycVendorCount = vendorData === null || vendorData === void 0 ? void 0 : vendorData.filter(ele => {
|
|
2828
|
+
var _ele$dsoDetails, _ele$dsoDetails$addit, _ele$dsoDetails$addit2;
|
|
2829
|
+
return (ele === null || ele === void 0 ? void 0 : (_ele$dsoDetails = ele.dsoDetails) === null || _ele$dsoDetails === void 0 ? void 0 : (_ele$dsoDetails$addit = _ele$dsoDetails.additionalDetails) === null || _ele$dsoDetails$addit === void 0 ? void 0 : (_ele$dsoDetails$addit2 = _ele$dsoDetails$addit.serviceType) === null || _ele$dsoDetails$addit2 === void 0 ? void 0 : _ele$dsoDetails$addit2.toLowerCase()) === "ekyc";
|
|
2830
|
+
}).length;
|
|
2831
|
+
console.log(ekycVendorCount);
|
|
2708
2832
|
const inboxTotalCount = (dsoData === null || dsoData === void 0 ? void 0 : dsoData.totalCount) || 50;
|
|
2709
2833
|
React.useEffect(() => {
|
|
2710
2834
|
var _location$state;
|
|
@@ -2773,8 +2897,8 @@ const SearchVendor = () => {
|
|
|
2773
2897
|
var _dsoData$vehicle;
|
|
2774
2898
|
const vehicles = dsoData === null || dsoData === void 0 ? void 0 : (_dsoData$vehicle = dsoData.vehicle) === null || _dsoData$vehicle === void 0 ? void 0 : _dsoData$vehicle.map(data => {
|
|
2775
2899
|
let vendor = vendorData.find(ele => {
|
|
2776
|
-
var _ele$
|
|
2777
|
-
return (_ele$
|
|
2900
|
+
var _ele$dsoDetails2, _ele$dsoDetails2$vehi;
|
|
2901
|
+
return (_ele$dsoDetails2 = ele.dsoDetails) === null || _ele$dsoDetails2 === void 0 ? void 0 : (_ele$dsoDetails2$vehi = _ele$dsoDetails2.vehicles) === null || _ele$dsoDetails2$vehi === void 0 ? void 0 : _ele$dsoDetails2$vehi.find(vehicle => vehicle.id === data.id);
|
|
2778
2902
|
});
|
|
2779
2903
|
if (vendor) {
|
|
2780
2904
|
var _vendor$dsoDetails, _vendor$dsoDetails$ve;
|
|
@@ -2796,8 +2920,8 @@ const SearchVendor = () => {
|
|
|
2796
2920
|
var _dsoData$driver;
|
|
2797
2921
|
const drivers = dsoData === null || dsoData === void 0 ? void 0 : (_dsoData$driver = dsoData.driver) === null || _dsoData$driver === void 0 ? void 0 : _dsoData$driver.map(data => {
|
|
2798
2922
|
let vendor = vendorData.find(ele => {
|
|
2799
|
-
var _ele$
|
|
2800
|
-
return (_ele$
|
|
2923
|
+
var _ele$dsoDetails3, _ele$dsoDetails3$driv;
|
|
2924
|
+
return (_ele$dsoDetails3 = ele.dsoDetails) === null || _ele$dsoDetails3 === void 0 ? void 0 : (_ele$dsoDetails3$driv = _ele$dsoDetails3.drivers) === null || _ele$dsoDetails3$driv === void 0 ? void 0 : _ele$dsoDetails3$driv.find(driver => driver.id === data.id);
|
|
2801
2925
|
});
|
|
2802
2926
|
if (vendor) {
|
|
2803
2927
|
return _extends({}, data, {
|
|
@@ -2922,7 +3046,8 @@ const SearchVendor = () => {
|
|
|
2922
3046
|
onTabChange: onTabChange,
|
|
2923
3047
|
selectedTab: tab,
|
|
2924
3048
|
refetchData: refetchData,
|
|
2925
|
-
refetchVendor: refetchVendorData
|
|
3049
|
+
refetchVendor: refetchVendorData,
|
|
3050
|
+
ekycVendorCount: ekycVendorCount
|
|
2926
3051
|
}), showToast && /*#__PURE__*/React__default.createElement(digitUiReactComponents.Toast, {
|
|
2927
3052
|
error: showToast.key === "error",
|
|
2928
3053
|
label: t(showToast.action),
|