@djb25/digit-ui-module-vendor 1.0.62 → 1.0.63

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 CHANGED
@@ -635,7 +635,7 @@ const DropdownStatus = _ref => {
635
635
  };
636
636
 
637
637
  const RegisteredVendorSearch = _ref => {
638
- 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;
638
+ var _matchedRoles$wt, _matchedRoles$wt2, _matchedRoles$ekyc, _matchedRoles$ekyc2, _matchedRoles$wt3, _matchedRoles$wt4, _matchedRoles$wt5, _matchedRoles$ekyc3, _matchedRoles$ekyc4, _matchedRoles$ekyc5, _matchedRoles$ekyc6, _matchedRoles$ekyc7;
639
639
  let onSearch = _ref.onSearch,
640
640
  type = _ref.type,
641
641
  onClose = _ref.onClose,
@@ -781,7 +781,7 @@ const RegisteredVendorSearch = _ref => {
781
781
  onClick: onClose
782
782
  }, /*#__PURE__*/React__default.createElement(digitUiReactComponents.CloseSvg, null))), /*#__PURE__*/React__default.createElement("div", {
783
783
  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")) || (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", {
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", {
785
785
  className: selectedTab === "VENDOR" ? "search-tab-head-selected" : "search-tab-head",
786
786
  onClick: () => {
787
787
  clearSearch();
@@ -799,13 +799,13 @@ const RegisteredVendorSearch = _ref => {
799
799
  clearSearch();
800
800
  onTabChange("DRIVER");
801
801
  }
802
- }, 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", {
802
+ }, t("ES_FSM_REGISTRY_INBOX_TAB_DRIVER")), ((matchedRoles === null || matchedRoles === void 0 ? void 0 : (_matchedRoles$ekyc3 = matchedRoles.ekyc) === null || _matchedRoles$ekyc3 === void 0 ? void 0 : _matchedRoles$ekyc3.includes("EKYC_VENDOR")) || (matchedRoles === null || matchedRoles === void 0 ? void 0 : (_matchedRoles$ekyc4 = matchedRoles.ekyc) === null || _matchedRoles$ekyc4 === void 0 ? void 0 : _matchedRoles$ekyc4.includes("EMPLOYEE"))) && /*#__PURE__*/React__default.createElement("button", {
803
803
  className: selectedTab === "SUPERVISOR" ? "search-tab-head-selected" : "search-tab-head",
804
804
  onClick: () => {
805
805
  clearSearch();
806
806
  onTabChange("SUPERVISOR");
807
807
  }
808
- }, 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", {
808
+ }, t("ES_FSM_REGISTRY_INBOX_TAB_SUPERVISOR")), ((matchedRoles === null || matchedRoles === void 0 ? void 0 : (_matchedRoles$ekyc5 = matchedRoles.ekyc) === null || _matchedRoles$ekyc5 === void 0 ? void 0 : _matchedRoles$ekyc5.includes("EKYC_SUPERVISOR")) || (matchedRoles === null || matchedRoles === void 0 ? void 0 : (_matchedRoles$ekyc6 = matchedRoles.ekyc) === null || _matchedRoles$ekyc6 === void 0 ? void 0 : _matchedRoles$ekyc6.includes("EKYC_VENDOR")) || (matchedRoles === null || matchedRoles === void 0 ? void 0 : (_matchedRoles$ekyc7 = matchedRoles.ekyc) === null || _matchedRoles$ekyc7 === void 0 ? void 0 : _matchedRoles$ekyc7.includes("EMPLOYEE"))) && /*#__PURE__*/React__default.createElement("button", {
809
809
  className: selectedTab === "SURVEYOR" ? "search-tab-head-selected" : "search-tab-head",
810
810
  onClick: () => {
811
811
  clearSearch();
@@ -1119,8 +1119,10 @@ const VendorInbox = props => {
1119
1119
  mutateVehicle = _Digit$Hooks$fsm$useU.mutate;
1120
1120
  const _Digit$Hooks$fsm$useD3 = Digit.Hooks.fsm.useDriverUpdate(tenantId),
1121
1121
  mutateDriver = _Digit$Hooks$fsm$useD3.mutate;
1122
- const _Digit$Hooks$fsm$useS = Digit.Hooks.fsm.useSurveyorUpdate(tenantId),
1123
- mutateSurveyor = _Digit$Hooks$fsm$useS.mutate;
1122
+ const _Digit$Hooks$fsm$useS = Digit.Hooks.fsm.useSupervisorUpdate(tenantId),
1123
+ mutateSupervisor = _Digit$Hooks$fsm$useS.mutate;
1124
+ const _Digit$Hooks$fsm$useS2 = Digit.Hooks.fsm.useSurveyorUpdate(tenantId),
1125
+ mutateSurveyor = _Digit$Hooks$fsm$useS2.mutate;
1124
1126
  React.useEffect(() => {
1125
1127
  var _props$data;
1126
1128
  setTableData((props === null || props === void 0 ? void 0 : (_props$data = props.data) === null || _props$data === void 0 ? void 0 : _props$data.table) || []);
@@ -1307,6 +1309,78 @@ const VendorInbox = props => {
1307
1309
  }
1308
1310
  });
1309
1311
  };
1312
+ const onSupervisorUpdate = row => {
1313
+ var _formDetails$owner9, _formDetails$owner0, _formDetails$owner1, _formDetails$owner10;
1314
+ let formDetails = row.original;
1315
+ const newStatus = (formDetails === null || formDetails === void 0 ? void 0 : formDetails.status) === "ACTIVE" ? "DISABLED" : "ACTIVE";
1316
+ const newActive = newStatus === "ACTIVE";
1317
+ const formData = {
1318
+ supervisor: _extends({}, formDetails, {
1319
+ status: newStatus,
1320
+ active: newActive,
1321
+ owner: _extends({}, formDetails === null || formDetails === void 0 ? void 0 : formDetails.owner, {
1322
+ active: newActive,
1323
+ gender: (formDetails === null || formDetails === void 0 ? void 0 : (_formDetails$owner9 = formDetails.owner) === null || _formDetails$owner9 === void 0 ? void 0 : _formDetails$owner9.gender) || "OTHERS",
1324
+ 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(),
1325
+ 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",
1326
+ relationship: (formDetails === null || formDetails === void 0 ? void 0 : (_formDetails$owner10 = formDetails.owner) === null || _formDetails$owner10 === void 0 ? void 0 : _formDetails$owner10.relationship) || "OTHER"
1327
+ })
1328
+ })
1329
+ };
1330
+ mutateSupervisor(formData, {
1331
+ onError: (error, variables) => {
1332
+ setShowToast({
1333
+ key: "error",
1334
+ action: (error === null || error === void 0 ? void 0 : error.message) || error
1335
+ });
1336
+ },
1337
+ onSuccess: (data, variables) => {
1338
+ setShowToast({
1339
+ key: "success",
1340
+ action: "SUPERVISOR"
1341
+ });
1342
+ queryClient.invalidateQueries("FSM_SUPERVISOR_SEARCH");
1343
+ queryClient.invalidateQueries("SUPERVISOR_SEARCH");
1344
+ props.refetchData();
1345
+ }
1346
+ });
1347
+ };
1348
+ const onSurveyorUpdate = row => {
1349
+ var _formDetails$owner11, _formDetails$owner12, _formDetails$owner13, _formDetails$owner14;
1350
+ let formDetails = row.original;
1351
+ const newStatus = (formDetails === null || formDetails === void 0 ? void 0 : formDetails.status) === "ACTIVE" ? "DISABLED" : "ACTIVE";
1352
+ const newActive = newStatus === "ACTIVE";
1353
+ const formData = {
1354
+ surveyor: _extends({}, formDetails, {
1355
+ status: newStatus,
1356
+ active: newActive,
1357
+ owner: _extends({}, formDetails === null || formDetails === void 0 ? void 0 : formDetails.owner, {
1358
+ active: newActive,
1359
+ gender: (formDetails === null || formDetails === void 0 ? void 0 : (_formDetails$owner11 = formDetails.owner) === null || _formDetails$owner11 === void 0 ? void 0 : _formDetails$owner11.gender) || "OTHERS",
1360
+ 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(),
1361
+ 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",
1362
+ relationship: (formDetails === null || formDetails === void 0 ? void 0 : (_formDetails$owner14 = formDetails.owner) === null || _formDetails$owner14 === void 0 ? void 0 : _formDetails$owner14.relationship) || "OTHER"
1363
+ })
1364
+ })
1365
+ };
1366
+ mutateSurveyor(formData, {
1367
+ onError: (error, variables) => {
1368
+ setShowToast({
1369
+ key: "error",
1370
+ action: (error === null || error === void 0 ? void 0 : error.message) || error
1371
+ });
1372
+ },
1373
+ onSuccess: (data, variables) => {
1374
+ setShowToast({
1375
+ key: "success",
1376
+ action: "SURVEYOR"
1377
+ });
1378
+ queryClient.invalidateQueries("FSM_SURVEYOR_SEARCH");
1379
+ queryClient.invalidateQueries("SURVEYOR_SEARCH");
1380
+ props.refetchData();
1381
+ }
1382
+ });
1383
+ };
1310
1384
  const onVendorSelect = (row, selectedOption) => {
1311
1385
  let driverData = row.original;
1312
1386
  let existingVendor = driverData === null || driverData === void 0 ? void 0 : driverData.vendor;
@@ -1516,17 +1590,17 @@ const VendorInbox = props => {
1516
1590
  });
1517
1591
  };
1518
1592
  const onSurveyorSupervisorSelect = (row, selectedSupervisor) => {
1519
- var _selectedSupervisor$o, _formDetails$owner9, _formDetails$owner0, _formDetails$owner1, _formDetails$owner10;
1593
+ var _selectedSupervisor$o, _formDetails$owner15, _formDetails$owner16, _formDetails$owner17, _formDetails$owner18;
1520
1594
  let formDetails = row.original;
1521
1595
  const formData = {
1522
1596
  surveyor: _extends({}, formDetails, {
1523
1597
  supervisorId: (selectedSupervisor === null || selectedSupervisor === void 0 ? void 0 : selectedSupervisor.id) || null,
1524
1598
  supervisorName: (selectedSupervisor === null || selectedSupervisor === void 0 ? void 0 : selectedSupervisor.name) || (selectedSupervisor === null || selectedSupervisor === void 0 ? void 0 : (_selectedSupervisor$o = selectedSupervisor.owner) === null || _selectedSupervisor$o === void 0 ? void 0 : _selectedSupervisor$o.name) || null,
1525
1599
  owner: _extends({}, formDetails === null || formDetails === void 0 ? void 0 : formDetails.owner, {
1526
- gender: (formDetails === null || formDetails === void 0 ? void 0 : (_formDetails$owner9 = formDetails.owner) === null || _formDetails$owner9 === void 0 ? void 0 : _formDetails$owner9.gender) || "OTHERS",
1527
- 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(),
1528
- 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",
1529
- relationship: (formDetails === null || formDetails === void 0 ? void 0 : (_formDetails$owner10 = formDetails.owner) === null || _formDetails$owner10 === void 0 ? void 0 : _formDetails$owner10.relationship) || "OTHER"
1600
+ gender: (formDetails === null || formDetails === void 0 ? void 0 : (_formDetails$owner15 = formDetails.owner) === null || _formDetails$owner15 === void 0 ? void 0 : _formDetails$owner15.gender) || "OTHERS",
1601
+ dob: (formDetails === null || formDetails === void 0 ? void 0 : (_formDetails$owner16 = formDetails.owner) === null || _formDetails$owner16 === void 0 ? void 0 : _formDetails$owner16.dob) || new Date("1/1/1970").getTime(),
1602
+ emailId: (formDetails === null || formDetails === void 0 ? void 0 : (_formDetails$owner17 = formDetails.owner) === null || _formDetails$owner17 === void 0 ? void 0 : _formDetails$owner17.emailId) || "abc@egov.com",
1603
+ relationship: (formDetails === null || formDetails === void 0 ? void 0 : (_formDetails$owner18 = formDetails.owner) === null || _formDetails$owner18 === void 0 ? void 0 : _formDetails$owner18.relationship) || "OTHER"
1530
1604
  })
1531
1605
  })
1532
1606
  };
@@ -1601,12 +1675,12 @@ const VendorInbox = props => {
1601
1675
  allFillingPointsData = _Digit$Hooks$wt$useFi.data,
1602
1676
  isAllFillingPointsLoading = _Digit$Hooks$wt$useFi.isLoading;
1603
1677
  const allFillingPoints = (allFillingPointsData === null || allFillingPointsData === void 0 ? void 0 : allFillingPointsData.fillingPoints) || [];
1604
- const _Digit$Hooks$fsm$useS2 = Digit.Hooks.fsm.useSupervisorSearch(tenantId, {
1678
+ const _Digit$Hooks$fsm$useS3 = Digit.Hooks.fsm.useSupervisorSearch(tenantId, {
1605
1679
  status: "ACTIVE"
1606
1680
  }, {
1607
1681
  enabled: props.selectedTab === "SURVEYOR"
1608
1682
  }),
1609
- supervisorSearchResponse = _Digit$Hooks$fsm$useS2.data;
1683
+ supervisorSearchResponse = _Digit$Hooks$fsm$useS3.data;
1610
1684
  const supervisors = React__default.useMemo(() => {
1611
1685
  const list = (supervisorSearchResponse === null || supervisorSearchResponse === void 0 ? void 0 : supervisorSearchResponse.supervisors) || (supervisorSearchResponse === null || supervisorSearchResponse === void 0 ? void 0 : supervisorSearchResponse.supervisor) || [];
1612
1686
  return list.map(s => {
@@ -2037,6 +2111,29 @@ const VendorInbox = props => {
2037
2111
  let row = _ref30.row;
2038
2112
  return GetCell((_row$original19 = row.original) !== null && _row$original19 !== void 0 && (_row$original19$audit = _row$original19.auditDetails) !== null && _row$original19$audit !== void 0 && _row$original19$audit.createdTime ? Digit.DateUtils.ConvertEpochToDate((_row$original20 = row.original) === null || _row$original20 === void 0 ? void 0 : (_row$original20$audit = _row$original20.auditDetails) === null || _row$original20$audit === void 0 ? void 0 : _row$original20$audit.createdTime) : "");
2039
2113
  }
2114
+ }, {
2115
+ Header: t("ES_FSM_REGISTRY_INBOX_ENABLED"),
2116
+ id: "status",
2117
+ accessor: row => row.status || "",
2118
+ Cell: _ref31 => {
2119
+ var _row$original21;
2120
+ let row = _ref31.row;
2121
+ return /*#__PURE__*/React__default.createElement(digitUiReactComponents.ToggleSwitch, {
2122
+ style: {
2123
+ display: "flex",
2124
+ justifyContent: "left"
2125
+ },
2126
+ value: ((_row$original21 = row.original) === null || _row$original21 === void 0 ? void 0 : _row$original21.status) === "DISABLED" ? false : true,
2127
+ onChange: () => {
2128
+ if (props.selectedTab === "SUPERVISOR") {
2129
+ onSupervisorUpdate(row);
2130
+ } else if (props.selectedTab === "SURVEYOR") {
2131
+ onSurveyorUpdate(row);
2132
+ }
2133
+ },
2134
+ name: "switch-" + row.id
2135
+ });
2136
+ }
2040
2137
  }];
2041
2138
  default:
2042
2139
  return [];
@@ -2430,7 +2527,7 @@ const SearchVendor = () => {
2430
2527
  const userInfo = Digit.UserService.getUser();
2431
2528
  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)) || [];
2432
2529
  const location = reactRouterDom.useLocation();
2433
- 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" : "";
2530
+ const initialPage = roles.includes("WT_VENDOR") ? "VENDOR" : roles.includes("EKYC_VENDOR") ? "SUPERVISOR" : roles.includes("EKYC_SUPERVISOR") ? "SURVEYOR" : roles.includes("EKYC_SURVEYOR") ? "SURVEYOR" : roles.includes("EMPLOYEE") ? "SUPERVISOR" : "";
2434
2531
  const _Digit$Hooks$useQuery = Digit.Hooks.useQueryParams(),
2435
2532
  selectedTabs = _Digit$Hooks$useQuery.selectedTabs;
2436
2533
  const _useState = React.useState(selectedTabs || initialPage),