@djb25/digit-ui-module-vendor 1.0.22 → 1.0.23

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.
@@ -8180,8 +8180,8 @@ const getFillingPointIdentifiers = fillingPoint => {
8180
8180
  return [fillingPoint === null || fillingPoint === void 0 ? void 0 : fillingPoint.id, fillingPoint === null || fillingPoint === void 0 ? void 0 : fillingPoint.fillingStationId, fillingPoint === null || fillingPoint === void 0 ? void 0 : fillingPoint.bookingId, fillingPoint === null || fillingPoint === void 0 ? void 0 : fillingPoint.fillingPointId, fillingPoint === null || fillingPoint === void 0 ? void 0 : fillingPoint.uuid, fillingPoint === null || fillingPoint === void 0 ? void 0 : (_fillingPoint$filling = fillingPoint.fillingpointmetadata) === null || _fillingPoint$filling === void 0 ? void 0 : _fillingPoint$filling.fillingPointId].filter(value => value !== undefined && value !== null && value !== "").map(String);
8181
8181
  };
8182
8182
  const getRowFillingPointIdentifiers = (row = {}) => {
8183
- var _row$dsoDetails, _row$fillingpointmeta, _row$dsoDetails2;
8184
- return Array.from(new Set([...[row === null || row === void 0 ? void 0 : row.fillingPointId, row === null || row === void 0 ? void 0 : (_row$dsoDetails = row.dsoDetails) === null || _row$dsoDetails === void 0 ? void 0 : _row$dsoDetails.fillingPointId, row === null || row === void 0 ? void 0 : (_row$fillingpointmeta = row.fillingpointmetadata) === null || _row$fillingpointmeta === void 0 ? void 0 : _row$fillingpointmeta.fillingPointId, row === null || row === void 0 ? void 0 : row.fillingPtName, row === null || row === void 0 ? void 0 : row.filling_pt_name].filter(value => value !== undefined && value !== null && value !== "").map(String), ...getFillingPointIdentifiers(row === null || row === void 0 ? void 0 : row.fillingPoint), ...getFillingPointIdentifiers(row === null || row === void 0 ? void 0 : (_row$dsoDetails2 = row.dsoDetails) === null || _row$dsoDetails2 === void 0 ? void 0 : _row$dsoDetails2.fillingPoint), ...getFillingPointIdentifiers(row === null || row === void 0 ? void 0 : row.fillingPointDetail)]));
8183
+ var _row$dsoDetails, _row$fillingpointmeta, _row$fillingPoint, _row$fillingPoint2, _row$dsoDetails2;
8184
+ return Array.from(new Set([...[row === null || row === void 0 ? void 0 : row.fillingPointId, row === null || row === void 0 ? void 0 : (_row$dsoDetails = row.dsoDetails) === null || _row$dsoDetails === void 0 ? void 0 : _row$dsoDetails.fillingPointId, row === null || row === void 0 ? void 0 : (_row$fillingpointmeta = row.fillingpointmetadata) === null || _row$fillingpointmeta === void 0 ? void 0 : _row$fillingpointmeta.fillingPointId, row === null || row === void 0 ? void 0 : row.fillingPtName, row === null || row === void 0 ? void 0 : row.filling_pt_name, row === null || row === void 0 ? void 0 : (_row$fillingPoint = row.fillingPoint) === null || _row$fillingPoint === void 0 ? void 0 : _row$fillingPoint.fillingPointId].filter(value => value !== undefined && value !== null && value !== "").map(String), ...getFillingPointIdentifiers(row === null || row === void 0 ? void 0 : row.fillingPoint), ...getFillingPointIdentifiers(row !== null && row !== void 0 && (_row$fillingPoint2 = row.fillingPoint) !== null && _row$fillingPoint2 !== void 0 && _row$fillingPoint2.length ? row.fillingPoint[0] : row.fillingPoint), ...getFillingPointIdentifiers(row === null || row === void 0 ? void 0 : (_row$dsoDetails2 = row.dsoDetails) === null || _row$dsoDetails2 === void 0 ? void 0 : _row$dsoDetails2.fillingPoint), ...getFillingPointIdentifiers(row === null || row === void 0 ? void 0 : row.fillingPointDetail)]));
8185
8185
  };
8186
8186
  const getSelectedFillingPointOption = (row, fillingPoints = []) => {
8187
8187
  const rowFillingPointIdentifiers = getRowFillingPointIdentifiers(row);
@@ -8189,8 +8189,8 @@ const getSelectedFillingPointOption = (row, fillingPoints = []) => {
8189
8189
  return fillingPoints.find(fillingPoint => getFillingPointIdentifiers(fillingPoint).some(identifier => rowFillingPointIdentifiers.includes(identifier))) || null;
8190
8190
  };
8191
8191
  const getFillingPointDisplayValue = (row = {}) => {
8192
- var _row$fillingPoint, _row$dsoDetails3, _row$dsoDetails3$fill, _row$dsoDetails4, _row$dsoDetails5, _row$dsoDetails6, _row$dsoDetails7, _row$fillingpointmeta2;
8193
- return (row === null || row === void 0 ? void 0 : (_row$fillingPoint = row.fillingPoint) === null || _row$fillingPoint === void 0 ? void 0 : _row$fillingPoint.fillingPointName) || (row === null || row === void 0 ? void 0 : (_row$dsoDetails3 = row.dsoDetails) === null || _row$dsoDetails3 === void 0 ? void 0 : (_row$dsoDetails3$fill = _row$dsoDetails3.fillingPoint) === null || _row$dsoDetails3$fill === void 0 ? void 0 : _row$dsoDetails3$fill.fillingPointName) || (row === null || row === void 0 ? void 0 : row.fillingPointName) || (row === null || row === void 0 ? void 0 : (_row$dsoDetails4 = row.dsoDetails) === null || _row$dsoDetails4 === void 0 ? void 0 : _row$dsoDetails4.fillingPointName) || (row === null || row === void 0 ? void 0 : row.fillingPointId) || (row === null || row === void 0 ? void 0 : (_row$dsoDetails5 = row.dsoDetails) === null || _row$dsoDetails5 === void 0 ? void 0 : _row$dsoDetails5.fillingPointId) || (typeof (row === null || row === void 0 ? void 0 : row.fillingPoint) === "string" ? row === null || row === void 0 ? void 0 : row.fillingPoint : null) || (typeof (row === null || row === void 0 ? void 0 : (_row$dsoDetails6 = row.dsoDetails) === null || _row$dsoDetails6 === void 0 ? void 0 : _row$dsoDetails6.fillingPoint) === "string" ? row === null || row === void 0 ? void 0 : (_row$dsoDetails7 = row.dsoDetails) === null || _row$dsoDetails7 === void 0 ? void 0 : _row$dsoDetails7.fillingPoint : null) || (row === null || row === void 0 ? void 0 : (_row$fillingpointmeta2 = row.fillingpointmetadata) === null || _row$fillingpointmeta2 === void 0 ? void 0 : _row$fillingpointmeta2.fillingPointId) || (row === null || row === void 0 ? void 0 : row.filling_pt_name) || (row === null || row === void 0 ? void 0 : row.fillingPtName) || "NA";
8192
+ var _row$fillingPoint3, _row$dsoDetails3, _row$dsoDetails3$fill, _row$dsoDetails4, _row$dsoDetails5, _row$dsoDetails6, _row$dsoDetails7, _row$fillingpointmeta2;
8193
+ return (row === null || row === void 0 ? void 0 : (_row$fillingPoint3 = row.fillingPoint) === null || _row$fillingPoint3 === void 0 ? void 0 : _row$fillingPoint3.fillingPointName) || (row === null || row === void 0 ? void 0 : (_row$dsoDetails3 = row.dsoDetails) === null || _row$dsoDetails3 === void 0 ? void 0 : (_row$dsoDetails3$fill = _row$dsoDetails3.fillingPoint) === null || _row$dsoDetails3$fill === void 0 ? void 0 : _row$dsoDetails3$fill.fillingPointName) || (row === null || row === void 0 ? void 0 : row.fillingPointName) || (row === null || row === void 0 ? void 0 : (_row$dsoDetails4 = row.dsoDetails) === null || _row$dsoDetails4 === void 0 ? void 0 : _row$dsoDetails4.fillingPointName) || (row === null || row === void 0 ? void 0 : row.fillingPointId) || (row === null || row === void 0 ? void 0 : (_row$dsoDetails5 = row.dsoDetails) === null || _row$dsoDetails5 === void 0 ? void 0 : _row$dsoDetails5.fillingPointId) || (typeof (row === null || row === void 0 ? void 0 : row.fillingPoint) === "string" ? row === null || row === void 0 ? void 0 : row.fillingPoint : null) || (typeof (row === null || row === void 0 ? void 0 : (_row$dsoDetails6 = row.dsoDetails) === null || _row$dsoDetails6 === void 0 ? void 0 : _row$dsoDetails6.fillingPoint) === "string" ? row === null || row === void 0 ? void 0 : (_row$dsoDetails7 = row.dsoDetails) === null || _row$dsoDetails7 === void 0 ? void 0 : _row$dsoDetails7.fillingPoint : null) || (row === null || row === void 0 ? void 0 : (_row$fillingpointmeta2 = row.fillingpointmetadata) === null || _row$fillingpointmeta2 === void 0 ? void 0 : _row$fillingpointmeta2.fillingPointId) || (row === null || row === void 0 ? void 0 : row.filling_pt_name) || (row === null || row === void 0 ? void 0 : row.fillingPtName) || "NA";
8194
8194
  };
8195
8195
  const getSelectedVendorOption = (row = {}, vendors = []) => {
8196
8196
  var _row$vendor, _row$vendorData;
@@ -8246,7 +8246,6 @@ const VendorInbox = props => {
8246
8246
  t
8247
8247
  } = useTranslation();
8248
8248
  const history = useHistory();
8249
- const DSO = Digit.UserService.hasAccess(["FSM_DSO"]) || false;
8250
8249
  const GetCell = value => /*#__PURE__*/React.createElement("span", {
8251
8250
  className: "cell-text"
8252
8251
  }, value);
@@ -8814,15 +8813,12 @@ const VendorInbox = props => {
8814
8813
  Cell: ({
8815
8814
  row
8816
8815
  }) => {
8817
- var _row$original7, _additionalVendorData;
8816
+ var _row$original7, _row$original8;
8818
8817
  const vendorId = (_row$original7 = row.original) === null || _row$original7 === void 0 ? void 0 : _row$original7.id;
8819
8818
  if (!additionalVendorData) {
8820
8819
  return /*#__PURE__*/React.createElement("span", null, "Loading...");
8821
8820
  }
8822
- const hasDetails = additionalVendorData === null || additionalVendorData === void 0 ? void 0 : (_additionalVendorData = additionalVendorData.VendorDetails) === null || _additionalVendorData === void 0 ? void 0 : _additionalVendorData.some(item => {
8823
- var _item$vendorAdditiona;
8824
- return (item === null || item === void 0 ? void 0 : (_item$vendorAdditiona = item.vendorAdditionalDetails) === null || _item$vendorAdditiona === void 0 ? void 0 : _item$vendorAdditiona.vendorId) === vendorId;
8825
- });
8821
+ const hasDetails = ((_row$original8 = row.original) === null || _row$original8 === void 0 ? void 0 : _row$original8.vendorAdditionalDetails) !== null;
8826
8822
  return /*#__PURE__*/React.createElement(Link, {
8827
8823
  to: hasDetails ? "/digit-ui/employee/vendor/registry/additionaldetails/info?vendorId=" + vendorId : "/digit-ui/employee/vendor/registry/additionaldetails/vendor-details?vendorId=" + vendorId
8828
8824
  }, /*#__PURE__*/React.createElement("button", {
@@ -8853,8 +8849,8 @@ const VendorInbox = props => {
8853
8849
  Cell: ({
8854
8850
  row
8855
8851
  }) => {
8856
- var _row$original8, _row$original8$auditD, _row$original9, _row$original9$auditD;
8857
- return GetCell((_row$original8 = row.original) !== null && _row$original8 !== void 0 && (_row$original8$auditD = _row$original8.auditDetails) !== null && _row$original8$auditD !== void 0 && _row$original8$auditD.createdTime ? Digit.DateUtils.ConvertEpochToDate((_row$original9 = row.original) === null || _row$original9 === void 0 ? void 0 : (_row$original9$auditD = _row$original9.auditDetails) === null || _row$original9$auditD === void 0 ? void 0 : _row$original9$auditD.createdTime) : "");
8852
+ var _row$original9, _row$original9$auditD, _row$original0, _row$original0$auditD;
8853
+ return GetCell((_row$original9 = row.original) !== null && _row$original9 !== void 0 && (_row$original9$auditD = _row$original9.auditDetails) !== null && _row$original9$auditD !== void 0 && _row$original9$auditD.createdTime ? Digit.DateUtils.ConvertEpochToDate((_row$original0 = row.original) === null || _row$original0 === void 0 ? void 0 : (_row$original0$auditD = _row$original0.auditDetails) === null || _row$original0$auditD === void 0 ? void 0 : _row$original0$auditD.createdTime) : "");
8858
8854
  }
8859
8855
  }, {
8860
8856
  Header: "Map Vendor",
@@ -8970,13 +8966,13 @@ const VendorInbox = props => {
8970
8966
  Cell: ({
8971
8967
  row
8972
8968
  }) => {
8973
- var _row$original0;
8969
+ var _row$original1;
8974
8970
  return /*#__PURE__*/React.createElement(ToggleSwitch, {
8975
8971
  style: {
8976
8972
  display: "flex",
8977
8973
  justifyContent: "left"
8978
8974
  },
8979
- value: ((_row$original0 = row.original) === null || _row$original0 === void 0 ? void 0 : _row$original0.status) === "DISABLED" ? false : true,
8975
+ value: ((_row$original1 = row.original) === null || _row$original1 === void 0 ? void 0 : _row$original1.status) === "DISABLED" ? false : true,
8980
8976
  onChange: () => onVehicleUpdate(row),
8981
8977
  name: `switch-${row.id}`
8982
8978
  });
@@ -9018,8 +9014,8 @@ const VendorInbox = props => {
9018
9014
  Cell: ({
9019
9015
  row
9020
9016
  }) => {
9021
- var _row$original1, _row$original1$auditD, _row$original10, _row$original10$audit;
9022
- return GetCell((_row$original1 = row.original) !== null && _row$original1 !== void 0 && (_row$original1$auditD = _row$original1.auditDetails) !== null && _row$original1$auditD !== void 0 && _row$original1$auditD.createdTime ? Digit.DateUtils.ConvertEpochToDate((_row$original10 = row.original) === null || _row$original10 === void 0 ? void 0 : (_row$original10$audit = _row$original10.auditDetails) === null || _row$original10$audit === void 0 ? void 0 : _row$original10$audit.createdTime) : "");
9017
+ var _row$original10, _row$original10$audit, _row$original11, _row$original11$audit;
9018
+ return GetCell((_row$original10 = row.original) !== null && _row$original10 !== void 0 && (_row$original10$audit = _row$original10.auditDetails) !== null && _row$original10$audit !== void 0 && _row$original10$audit.createdTime ? Digit.DateUtils.ConvertEpochToDate((_row$original11 = row.original) === null || _row$original11 === void 0 ? void 0 : (_row$original11$audit = _row$original11.auditDetails) === null || _row$original11$audit === void 0 ? void 0 : _row$original11$audit.createdTime) : "");
9023
9019
  }
9024
9020
  }, {
9025
9021
  Header: t("ES_FSM_REGISTRY_INBOX_VENDOR_NAME"),
@@ -9056,13 +9052,13 @@ const VendorInbox = props => {
9056
9052
  Cell: ({
9057
9053
  row
9058
9054
  }) => {
9059
- var _row$original11;
9055
+ var _row$original12;
9060
9056
  return /*#__PURE__*/React.createElement(ToggleSwitch, {
9061
9057
  style: {
9062
9058
  display: "flex",
9063
9059
  justifyContent: "left"
9064
9060
  },
9065
- value: ((_row$original11 = row.original) === null || _row$original11 === void 0 ? void 0 : _row$original11.status) === "DISABLED" ? false : true,
9061
+ value: ((_row$original12 = row.original) === null || _row$original12 === void 0 ? void 0 : _row$original12.status) === "DISABLED" ? false : true,
9066
9062
  onChange: () => onDriverUpdate(row),
9067
9063
  name: `switch-${row.id}`
9068
9064
  });
@@ -9171,7 +9167,21 @@ const VendorInbox = props => {
9171
9167
  const getCSVExportData = React.useCallback(async () => tableData, [tableData]);
9172
9168
  let result;
9173
9169
  if (props.isLoading || isAllFillingPointsLoading) {
9174
- result = /*#__PURE__*/React.createElement(Loader, null);
9170
+ result = /*#__PURE__*/React.createElement("div", {
9171
+ style: {
9172
+ zIndex: 10,
9173
+ position: "relative",
9174
+ padding: "10px",
9175
+ backgroundColor: "#fff",
9176
+ width: "75px",
9177
+ height: "75px",
9178
+ borderRadius: "12px",
9179
+ display: "flex",
9180
+ justifyContent: "center",
9181
+ alignItems: "center",
9182
+ margin: "auto"
9183
+ }
9184
+ }, /*#__PURE__*/React.createElement(Loader, null));
9175
9185
  } else if (tableData.length === 0) {
9176
9186
  let emptyCardText = "";
9177
9187
  let emptyButtonText = "";
@@ -9299,7 +9309,6 @@ const SearchVendor = () => {
9299
9309
  const [vehicleIds, setVehicleIds] = useState("");
9300
9310
  const [driverIds, setDriverIds] = useState("");
9301
9311
  const [tableData, setTableData] = useState([]);
9302
- const userInfo = Digit.UserService.getUser();
9303
9312
  let paginationParms = {
9304
9313
  limit: pageSize,
9305
9314
  offset: pageOffset,
@@ -9308,9 +9317,9 @@ const SearchVendor = () => {
9308
9317
  };
9309
9318
  const {
9310
9319
  data: dsoData,
9311
- isLoading: isLoading,
9312
- isSuccess: isDsoSuccess,
9313
- error: dsoError,
9320
+ isLoading,
9321
+ isSuccess,
9322
+ error,
9314
9323
  refetch
9315
9324
  } = tab === "VEHICLE" ? Digit.Hooks.fsm.useVehiclesSearch({
9316
9325
  tenantId,
@@ -9370,6 +9379,7 @@ const SearchVendor = () => {
9370
9379
  const inboxTotalCount = (dsoData === null || dsoData === void 0 ? void 0 : dsoData.totalCount) || 50;
9371
9380
  useEffect(() => {
9372
9381
  refetch();
9382
+ refetchVendor();
9373
9383
  }, []);
9374
9384
  useEffect(() => {
9375
9385
  refetch();
@@ -9377,17 +9387,13 @@ const SearchVendor = () => {
9377
9387
  useEffect(() => {
9378
9388
  if (dsoData !== null && dsoData !== void 0 && dsoData.vehicle && tab === "VEHICLE") {
9379
9389
  let vehicleIds = "";
9380
- dsoData.vehicle.map(data => {
9381
- vehicleIds += `${data.id},`;
9382
- });
9390
+ dsoData.vehicle.map(data => vehicleIds += `${data.id},`);
9383
9391
  setVehicleIds(vehicleIds);
9384
9392
  setTableData(dsoData.vehicle);
9385
9393
  }
9386
9394
  if (dsoData !== null && dsoData !== void 0 && dsoData.driver && tab === "DRIVER") {
9387
9395
  let driverIds = "";
9388
- dsoData.driver.map(data => {
9389
- driverIds += `${data.id},`;
9390
- });
9396
+ dsoData.driver.map(data => driverIds += `${data.id},`);
9391
9397
  setDriverIds(driverIds);
9392
9398
  setTableData(dsoData === null || dsoData === void 0 ? void 0 : dsoData.driver);
9393
9399
  }
@@ -9403,6 +9409,8 @@ const SearchVendor = () => {
9403
9409
  activeDrivers: (_dso$drivers = dso.drivers) === null || _dso$drivers === void 0 ? void 0 : _dso$drivers.filter(driver => driver.status === "ACTIVE"),
9404
9410
  allVehicles: dso.vehicles,
9405
9411
  dsoDetails: dso,
9412
+ vendorAdditionalDetails: dso.vendorAdditionalDetails,
9413
+ fillingPoint: dso.fillingPoint,
9406
9414
  vehicles: (_dso$vehicles = dso.vehicles) === null || _dso$vehicles === void 0 ? void 0 : (_dso$vehicles$filter = _dso$vehicles.filter(vehicle => vehicle.status === "ACTIVE")) === null || _dso$vehicles$filter === void 0 ? void 0 : _dso$vehicles$filter.map(vehicle => ({
9407
9415
  id: vehicle.id,
9408
9416
  registrationNumber: vehicle === null || vehicle === void 0 ? void 0 : vehicle.registrationNumber,
@@ -9497,10 +9505,6 @@ const SearchVendor = () => {
9497
9505
  const refetchVendorData = () => {
9498
9506
  refetchVendor();
9499
9507
  };
9500
- useEffect(() => {
9501
- refetch();
9502
- refetchVendor();
9503
- }, []);
9504
9508
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
9505
9509
  className: "employee-form-content"
9506
9510
  }, /*#__PURE__*/React.createElement(VendorInbox, {