@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.
@@ -632,7 +632,7 @@ const DropdownStatus = _ref => {
632
632
  };
633
633
 
634
634
  const RegisteredVendorSearch = _ref => {
635
- 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;
635
+ 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;
636
636
  let onSearch = _ref.onSearch,
637
637
  type = _ref.type,
638
638
  onClose = _ref.onClose,
@@ -778,7 +778,7 @@ const RegisteredVendorSearch = _ref => {
778
778
  onClick: onClose
779
779
  }, /*#__PURE__*/React.createElement(CloseSvg, null))), /*#__PURE__*/React.createElement("div", {
780
780
  className: "search-tabs-container"
781
- }, /*#__PURE__*/React.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.createElement("button", {
781
+ }, /*#__PURE__*/React.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.createElement("button", {
782
782
  className: selectedTab === "VENDOR" ? "search-tab-head-selected" : "search-tab-head",
783
783
  onClick: () => {
784
784
  clearSearch();
@@ -796,13 +796,13 @@ const RegisteredVendorSearch = _ref => {
796
796
  clearSearch();
797
797
  onTabChange("DRIVER");
798
798
  }
799
- }, 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.createElement("button", {
799
+ }, 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.createElement("button", {
800
800
  className: selectedTab === "SUPERVISOR" ? "search-tab-head-selected" : "search-tab-head",
801
801
  onClick: () => {
802
802
  clearSearch();
803
803
  onTabChange("SUPERVISOR");
804
804
  }
805
- }, 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.createElement("button", {
805
+ }, 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.createElement("button", {
806
806
  className: selectedTab === "SURVEYOR" ? "search-tab-head-selected" : "search-tab-head",
807
807
  onClick: () => {
808
808
  clearSearch();
@@ -1116,8 +1116,10 @@ const VendorInbox = props => {
1116
1116
  mutateVehicle = _Digit$Hooks$fsm$useU.mutate;
1117
1117
  const _Digit$Hooks$fsm$useD3 = Digit.Hooks.fsm.useDriverUpdate(tenantId),
1118
1118
  mutateDriver = _Digit$Hooks$fsm$useD3.mutate;
1119
- const _Digit$Hooks$fsm$useS = Digit.Hooks.fsm.useSurveyorUpdate(tenantId),
1120
- mutateSurveyor = _Digit$Hooks$fsm$useS.mutate;
1119
+ const _Digit$Hooks$fsm$useS = Digit.Hooks.fsm.useSupervisorUpdate(tenantId),
1120
+ mutateSupervisor = _Digit$Hooks$fsm$useS.mutate;
1121
+ const _Digit$Hooks$fsm$useS2 = Digit.Hooks.fsm.useSurveyorUpdate(tenantId),
1122
+ mutateSurveyor = _Digit$Hooks$fsm$useS2.mutate;
1121
1123
  useEffect(() => {
1122
1124
  var _props$data;
1123
1125
  setTableData((props === null || props === void 0 ? void 0 : (_props$data = props.data) === null || _props$data === void 0 ? void 0 : _props$data.table) || []);
@@ -1304,6 +1306,78 @@ const VendorInbox = props => {
1304
1306
  }
1305
1307
  });
1306
1308
  };
1309
+ const onSupervisorUpdate = row => {
1310
+ var _formDetails$owner9, _formDetails$owner0, _formDetails$owner1, _formDetails$owner10;
1311
+ let formDetails = row.original;
1312
+ const newStatus = (formDetails === null || formDetails === void 0 ? void 0 : formDetails.status) === "ACTIVE" ? "DISABLED" : "ACTIVE";
1313
+ const newActive = newStatus === "ACTIVE";
1314
+ const formData = {
1315
+ supervisor: _extends({}, formDetails, {
1316
+ status: newStatus,
1317
+ active: newActive,
1318
+ owner: _extends({}, formDetails === null || formDetails === void 0 ? void 0 : formDetails.owner, {
1319
+ active: newActive,
1320
+ gender: (formDetails === null || formDetails === void 0 ? void 0 : (_formDetails$owner9 = formDetails.owner) === null || _formDetails$owner9 === void 0 ? void 0 : _formDetails$owner9.gender) || "OTHERS",
1321
+ 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(),
1322
+ 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",
1323
+ relationship: (formDetails === null || formDetails === void 0 ? void 0 : (_formDetails$owner10 = formDetails.owner) === null || _formDetails$owner10 === void 0 ? void 0 : _formDetails$owner10.relationship) || "OTHER"
1324
+ })
1325
+ })
1326
+ };
1327
+ mutateSupervisor(formData, {
1328
+ onError: (error, variables) => {
1329
+ setShowToast({
1330
+ key: "error",
1331
+ action: (error === null || error === void 0 ? void 0 : error.message) || error
1332
+ });
1333
+ },
1334
+ onSuccess: (data, variables) => {
1335
+ setShowToast({
1336
+ key: "success",
1337
+ action: "SUPERVISOR"
1338
+ });
1339
+ queryClient.invalidateQueries("FSM_SUPERVISOR_SEARCH");
1340
+ queryClient.invalidateQueries("SUPERVISOR_SEARCH");
1341
+ props.refetchData();
1342
+ }
1343
+ });
1344
+ };
1345
+ const onSurveyorUpdate = row => {
1346
+ var _formDetails$owner11, _formDetails$owner12, _formDetails$owner13, _formDetails$owner14;
1347
+ let formDetails = row.original;
1348
+ const newStatus = (formDetails === null || formDetails === void 0 ? void 0 : formDetails.status) === "ACTIVE" ? "DISABLED" : "ACTIVE";
1349
+ const newActive = newStatus === "ACTIVE";
1350
+ const formData = {
1351
+ surveyor: _extends({}, formDetails, {
1352
+ status: newStatus,
1353
+ active: newActive,
1354
+ owner: _extends({}, formDetails === null || formDetails === void 0 ? void 0 : formDetails.owner, {
1355
+ active: newActive,
1356
+ gender: (formDetails === null || formDetails === void 0 ? void 0 : (_formDetails$owner11 = formDetails.owner) === null || _formDetails$owner11 === void 0 ? void 0 : _formDetails$owner11.gender) || "OTHERS",
1357
+ 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(),
1358
+ 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",
1359
+ relationship: (formDetails === null || formDetails === void 0 ? void 0 : (_formDetails$owner14 = formDetails.owner) === null || _formDetails$owner14 === void 0 ? void 0 : _formDetails$owner14.relationship) || "OTHER"
1360
+ })
1361
+ })
1362
+ };
1363
+ mutateSurveyor(formData, {
1364
+ onError: (error, variables) => {
1365
+ setShowToast({
1366
+ key: "error",
1367
+ action: (error === null || error === void 0 ? void 0 : error.message) || error
1368
+ });
1369
+ },
1370
+ onSuccess: (data, variables) => {
1371
+ setShowToast({
1372
+ key: "success",
1373
+ action: "SURVEYOR"
1374
+ });
1375
+ queryClient.invalidateQueries("FSM_SURVEYOR_SEARCH");
1376
+ queryClient.invalidateQueries("SURVEYOR_SEARCH");
1377
+ props.refetchData();
1378
+ }
1379
+ });
1380
+ };
1307
1381
  const onVendorSelect = (row, selectedOption) => {
1308
1382
  let driverData = row.original;
1309
1383
  let existingVendor = driverData === null || driverData === void 0 ? void 0 : driverData.vendor;
@@ -1513,17 +1587,17 @@ const VendorInbox = props => {
1513
1587
  });
1514
1588
  };
1515
1589
  const onSurveyorSupervisorSelect = (row, selectedSupervisor) => {
1516
- var _selectedSupervisor$o, _formDetails$owner9, _formDetails$owner0, _formDetails$owner1, _formDetails$owner10;
1590
+ var _selectedSupervisor$o, _formDetails$owner15, _formDetails$owner16, _formDetails$owner17, _formDetails$owner18;
1517
1591
  let formDetails = row.original;
1518
1592
  const formData = {
1519
1593
  surveyor: _extends({}, formDetails, {
1520
1594
  supervisorId: (selectedSupervisor === null || selectedSupervisor === void 0 ? void 0 : selectedSupervisor.id) || null,
1521
1595
  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,
1522
1596
  owner: _extends({}, formDetails === null || formDetails === void 0 ? void 0 : formDetails.owner, {
1523
- gender: (formDetails === null || formDetails === void 0 ? void 0 : (_formDetails$owner9 = formDetails.owner) === null || _formDetails$owner9 === void 0 ? void 0 : _formDetails$owner9.gender) || "OTHERS",
1524
- 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(),
1525
- 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",
1526
- relationship: (formDetails === null || formDetails === void 0 ? void 0 : (_formDetails$owner10 = formDetails.owner) === null || _formDetails$owner10 === void 0 ? void 0 : _formDetails$owner10.relationship) || "OTHER"
1597
+ gender: (formDetails === null || formDetails === void 0 ? void 0 : (_formDetails$owner15 = formDetails.owner) === null || _formDetails$owner15 === void 0 ? void 0 : _formDetails$owner15.gender) || "OTHERS",
1598
+ 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(),
1599
+ 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",
1600
+ relationship: (formDetails === null || formDetails === void 0 ? void 0 : (_formDetails$owner18 = formDetails.owner) === null || _formDetails$owner18 === void 0 ? void 0 : _formDetails$owner18.relationship) || "OTHER"
1527
1601
  })
1528
1602
  })
1529
1603
  };
@@ -1598,12 +1672,12 @@ const VendorInbox = props => {
1598
1672
  allFillingPointsData = _Digit$Hooks$wt$useFi.data,
1599
1673
  isAllFillingPointsLoading = _Digit$Hooks$wt$useFi.isLoading;
1600
1674
  const allFillingPoints = (allFillingPointsData === null || allFillingPointsData === void 0 ? void 0 : allFillingPointsData.fillingPoints) || [];
1601
- const _Digit$Hooks$fsm$useS2 = Digit.Hooks.fsm.useSupervisorSearch(tenantId, {
1675
+ const _Digit$Hooks$fsm$useS3 = Digit.Hooks.fsm.useSupervisorSearch(tenantId, {
1602
1676
  status: "ACTIVE"
1603
1677
  }, {
1604
1678
  enabled: props.selectedTab === "SURVEYOR"
1605
1679
  }),
1606
- supervisorSearchResponse = _Digit$Hooks$fsm$useS2.data;
1680
+ supervisorSearchResponse = _Digit$Hooks$fsm$useS3.data;
1607
1681
  const supervisors = React.useMemo(() => {
1608
1682
  const list = (supervisorSearchResponse === null || supervisorSearchResponse === void 0 ? void 0 : supervisorSearchResponse.supervisors) || (supervisorSearchResponse === null || supervisorSearchResponse === void 0 ? void 0 : supervisorSearchResponse.supervisor) || [];
1609
1683
  return list.map(s => {
@@ -2034,6 +2108,29 @@ const VendorInbox = props => {
2034
2108
  let row = _ref30.row;
2035
2109
  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) : "");
2036
2110
  }
2111
+ }, {
2112
+ Header: t("ES_FSM_REGISTRY_INBOX_ENABLED"),
2113
+ id: "status",
2114
+ accessor: row => row.status || "",
2115
+ Cell: _ref31 => {
2116
+ var _row$original21;
2117
+ let row = _ref31.row;
2118
+ return /*#__PURE__*/React.createElement(ToggleSwitch, {
2119
+ style: {
2120
+ display: "flex",
2121
+ justifyContent: "left"
2122
+ },
2123
+ value: ((_row$original21 = row.original) === null || _row$original21 === void 0 ? void 0 : _row$original21.status) === "DISABLED" ? false : true,
2124
+ onChange: () => {
2125
+ if (props.selectedTab === "SUPERVISOR") {
2126
+ onSupervisorUpdate(row);
2127
+ } else if (props.selectedTab === "SURVEYOR") {
2128
+ onSurveyorUpdate(row);
2129
+ }
2130
+ },
2131
+ name: "switch-" + row.id
2132
+ });
2133
+ }
2037
2134
  }];
2038
2135
  default:
2039
2136
  return [];
@@ -2427,7 +2524,7 @@ const SearchVendor = () => {
2427
2524
  const userInfo = Digit.UserService.getUser();
2428
2525
  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)) || [];
2429
2526
  const location = useLocation();
2430
- 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" : "";
2527
+ 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" : "";
2431
2528
  const _Digit$Hooks$useQuery = Digit.Hooks.useQueryParams(),
2432
2529
  selectedTabs = _Digit$Hooks$useQuery.selectedTabs;
2433
2530
  const _useState = useState(selectedTabs || initialPage),