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

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.
@@ -1,7 +1,7 @@
1
1
  import React, { useEffect, useMemo, useCallback, useState } from 'react';
2
2
  import { useTranslation } from 'react-i18next';
3
3
  import { useParams, useLocation, Switch, useHistory, Link, useRouteMatch, Route, Redirect } from 'react-router-dom';
4
- import { Header, SearchForm, SearchField, Dropdown as Dropdown$2, MobileNumber, CardLabelError, DatePicker as DatePicker$3, SubmitBar, Card, Table, Loader, Toast, AppContainer, ModuleHeader, ArrowLeft, PrivateRoute, LayoutWrapper, HomeIcon, PropertyHouse, EmployeeModuleCard, VerticalTimeline, FormComposer, FormStep, LabelFieldPair, CardLabel, Tooltip, TextInput, UploadFile, CardSubHeader, CardText, RadioOrSelect, ShippingTruck, CheckBox, RadioButtons, CloseSvg, Localities, RemoveableTag, ActionBar, ApplyFilterBar, AddIcon, Menu, LinkLabel, ToggleSwitch, CardSectionHeader, Row, EditIcon, DeleteIcon, Modal, InfoIcon, CardHeader, StatusTable, LinkButton, Banner } from '@djb25/digit-ui-react-components';
4
+ import { Header, SearchForm, SearchField, Dropdown as Dropdown$2, MobileNumber, CardLabelError, DatePicker as DatePicker$3, SubmitBar, Card, Table, Loader, Toast, AppContainer, ModuleHeader, ArrowLeft, PrivateRoute, LayoutWrapper, HomeIcon, PropertyHouse, EmployeeModuleCard, VerticalTimeline, FormComposer, FormStep, LabelFieldPair, CardLabel, Tooltip, TextInput, UploadFile, ActionBar, RadioOrSelect, ShippingTruck, CheckBox, RadioButtons, CloseSvg, Localities, RemoveableTag, ApplyFilterBar, AddIcon, Menu, LinkLabel, ToggleSwitch, CardSectionHeader, Row, EditIcon, DeleteIcon, Modal, CardText, InfoIcon, CardHeader, CardSubHeader, StatusTable, LinkButton, Banner } from '@djb25/digit-ui-react-components';
5
5
  import { useForm, Controller } from 'react-hook-form';
6
6
  import { useQueryClient } from 'react-query';
7
7
 
@@ -404,11 +404,14 @@ const EmployeeApp = ({
404
404
  })))
405
405
  }), /*#__PURE__*/React.createElement(PrivateRoute, {
406
406
  path: `${path}/registry/additionaldetails`,
407
- component: props => /*#__PURE__*/React.createElement(LayoutWrapper, {
408
- layoutClass: "normal"
409
- }, /*#__PURE__*/React.createElement(VendorCreate, Object.assign({}, props, {
410
- parentRoute: path
411
- })))
407
+ component: props => {
408
+ const isInfoPage = props.location.pathname.includes("/info");
409
+ return /*#__PURE__*/React.createElement(LayoutWrapper, {
410
+ layoutClass: isInfoPage ? "action" : "normal"
411
+ }, /*#__PURE__*/React.createElement(VendorCreate, Object.assign({}, props, {
412
+ parentRoute: path
413
+ })));
414
+ }
412
415
  }), /*#__PURE__*/React.createElement(PrivateRoute, {
413
416
  path: `${path}/registry/driver-details/:id`,
414
417
  component: props => /*#__PURE__*/React.createElement(LayoutWrapper, {
@@ -1577,7 +1580,6 @@ const ServiceDoc = ({
1577
1580
  onSelect
1578
1581
  }) => {
1579
1582
  var _Documentsob$ASSET;
1580
- const tenantId = Digit.ULBService.getCurrentTenantId();
1581
1583
  const stateId = Digit.ULBService.getStateId();
1582
1584
  const docType = config !== null && config !== void 0 && config.isMutation ? ["MutationDocuments"] : "Documents";
1583
1585
  const {
@@ -1585,12 +1587,9 @@ const ServiceDoc = ({
1585
1587
  data: Documentsob = {}
1586
1588
  } = Digit.Hooks.asset.useAssetDocumentsMDMS(stateId, "ASSET", docType);
1587
1589
  let docs = Documentsob === null || Documentsob === void 0 ? void 0 : (_Documentsob$ASSET = Documentsob.ASSET) === null || _Documentsob$ASSET === void 0 ? void 0 : _Documentsob$ASSET.Documents;
1588
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Card, null, /*#__PURE__*/React.createElement(CardSubHeader, null, t("AST_REQ_SCREEN_LABEL")), /*#__PURE__*/React.createElement(CardText, {
1589
- style: {
1590
- color: "red",
1591
- marginBottom: "20px"
1592
- }
1593
- }, t("AST_DOCUMENT_ACCEPTED_PDF_JPG_PNG"))), isLoading && /*#__PURE__*/React.createElement(Loader, null), Array.isArray(docs) && docs.map(({
1590
+ return /*#__PURE__*/React.createElement("div", {
1591
+ className: "employee-form-content"
1592
+ }, isLoading && /*#__PURE__*/React.createElement(Loader, null), Array.isArray(docs) && docs.map(({
1594
1593
  code,
1595
1594
  dropdownData
1596
1595
  }, index) => /*#__PURE__*/React.createElement(Card, {
@@ -1606,10 +1605,10 @@ const ServiceDoc = ({
1606
1605
  marginBottom: "6px",
1607
1606
  fontSize: "14px"
1608
1607
  }
1609
- }, dropdownIndex + 1, ". ", t(stringReplaceAll(dropdownData === null || dropdownData === void 0 ? void 0 : dropdownData.code, ".", "_")))))), /*#__PURE__*/React.createElement(SubmitBar, {
1608
+ }, dropdownIndex + 1, ". ", t(stringReplaceAll(dropdownData === null || dropdownData === void 0 ? void 0 : dropdownData.code, ".", "_")))))), /*#__PURE__*/React.createElement(ActionBar, null, /*#__PURE__*/React.createElement(SubmitBar, {
1610
1609
  label: t("COMMON_NEXT"),
1611
1610
  onSubmit: onSelect
1612
- }));
1611
+ })));
1613
1612
  };
1614
1613
 
1615
1614
  const VendorSelectAddress = ({
@@ -8180,8 +8179,9 @@ const getFillingPointIdentifiers = fillingPoint => {
8180
8179
  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
8180
  };
8182
8181
  const getRowFillingPointIdentifiers = (row = {}) => {
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)]));
8182
+ var _row$dsoDetails, _row$fillingpointmeta, _row$fillingPoint, _row$dsoDetails2;
8183
+ const getIdentifiers = fp => Array.isArray(fp) ? fp.flatMap(getFillingPointIdentifiers) : getFillingPointIdentifiers(fp);
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), ...getIdentifiers(row === null || row === void 0 ? void 0 : row.fillingPoint), ...getIdentifiers(row === null || row === void 0 ? void 0 : (_row$dsoDetails2 = row.dsoDetails) === null || _row$dsoDetails2 === void 0 ? void 0 : _row$dsoDetails2.fillingPoint), ...getIdentifiers(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,12 @@ 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$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";
8192
+ var _row$fillingPoint2, _row$dsoDetails3, _row$dsoDetails3$fill, _row$dsoDetails4, _row$dsoDetails5, _row$dsoDetails6, _row$dsoDetails7, _row$fillingpointmeta2;
8193
+ if (Array.isArray(row === null || row === void 0 ? void 0 : row.fillingPoint)) {
8194
+ const list = row.fillingPoint.map(fp => (fp === null || fp === void 0 ? void 0 : fp.fillingPointName) || (fp === null || fp === void 0 ? void 0 : fp.fillingPointId)).filter(Boolean);
8195
+ if (list.length > 0) return list.join(", ");
8196
+ }
8197
+ return (row === null || row === void 0 ? void 0 : (_row$fillingPoint2 = row.fillingPoint) === null || _row$fillingPoint2 === void 0 ? void 0 : _row$fillingPoint2.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
8198
  };
8195
8199
  const getSelectedVendorOption = (row = {}, vendors = []) => {
8196
8200
  var _row$vendor, _row$vendorData;
@@ -8199,7 +8203,7 @@ const getSelectedVendorOption = (row = {}, vendors = []) => {
8199
8203
  return vendors.find(vendor => (vendor === null || vendor === void 0 ? void 0 : vendor.id) === selectedVendorId) || (row === null || row === void 0 ? void 0 : row.vendor) || (row === null || row === void 0 ? void 0 : row.vendorData) || null;
8200
8204
  };
8201
8205
  const getVendorFillingPoints = (vendor = {}) => {
8202
- const fillingPointOptions = [vendor === null || vendor === void 0 ? void 0 : vendor.fillingPoint, ...(Array.isArray(vendor === null || vendor === void 0 ? void 0 : vendor.fillingPoints) ? vendor.fillingPoints : [])].filter(Boolean);
8206
+ const fillingPointOptions = [...(Array.isArray(vendor === null || vendor === void 0 ? void 0 : vendor.fillingPoint) ? vendor.fillingPoint : [vendor === null || vendor === void 0 ? void 0 : vendor.fillingPoint]), ...(Array.isArray(vendor === null || vendor === void 0 ? void 0 : vendor.fillingPoints) ? vendor.fillingPoints : [vendor === null || vendor === void 0 ? void 0 : vendor.fillingPoints])].filter(Boolean);
8203
8207
  const uniqueFillingPoints = new Map();
8204
8208
  fillingPointOptions.forEach(fillingPoint => {
8205
8209
  const identifier = getFillingPointIdentifiers(fillingPoint)[0] || (fillingPoint === null || fillingPoint === void 0 ? void 0 : fillingPoint.fillingPointName) || (fillingPoint === null || fillingPoint === void 0 ? void 0 : fillingPoint.id);
@@ -8678,37 +8682,6 @@ const VendorInbox = props => {
8678
8682
  enabled: true
8679
8683
  });
8680
8684
  const allFillingPoints = (allFillingPointsData === null || allFillingPointsData === void 0 ? void 0 : allFillingPointsData.fillingPoints) || [];
8681
- const {
8682
- mutate: mapFixedFilling
8683
- } = Digit.Hooks.wt.useVendorFillingMap(tenantId);
8684
- const onFillingPointSelect = (row, value) => {
8685
- const payload = {
8686
- mappings: [{
8687
- tenantId: tenantId,
8688
- fillingPointId: (value === null || value === void 0 ? void 0 : value.id) || (value === null || value === void 0 ? void 0 : value.bookingId) || (value === null || value === void 0 ? void 0 : value.fillingPointId),
8689
- vendorId: row.original.id
8690
- }]
8691
- };
8692
- mapFixedFilling(payload, {
8693
- onSuccess: () => {
8694
- setShowToast({
8695
- key: "success",
8696
- label: "WT_FIXED_FILLING_MAPPING_SUCCESS"
8697
- });
8698
- props.refetchData();
8699
- props.refetchVendor && props.refetchVendor();
8700
- setTimeout(closeToast, 5000);
8701
- },
8702
- onError: err => {
8703
- var _err$response, _err$response$data, _err$response$data$Er, _err$response$data$Er2;
8704
- setShowToast({
8705
- key: "error",
8706
- label: (err === null || err === void 0 ? void 0 : (_err$response = err.response) === null || _err$response === void 0 ? void 0 : (_err$response$data = _err$response.data) === null || _err$response$data === void 0 ? void 0 : (_err$response$data$Er = _err$response$data.Errors) === null || _err$response$data$Er === void 0 ? void 0 : (_err$response$data$Er2 = _err$response$data$Er[0]) === null || _err$response$data$Er2 === void 0 ? void 0 : _err$response$data$Er2.message) || "WT_FIXED_FILLING_MAPPING_FAIL"
8707
- });
8708
- setTimeout(closeToast, 5000);
8709
- }
8710
- });
8711
- };
8712
8685
  const columns = React.useMemo(() => {
8713
8686
  switch (props.selectedTab) {
8714
8687
  case "VENDOR":
@@ -8733,28 +8706,6 @@ const VendorInbox = props => {
8733
8706
  var _row$original4, _row$original4$auditD, _row$original5, _row$original5$auditD;
8734
8707
  return GetCell((_row$original4 = row.original) !== null && _row$original4 !== void 0 && (_row$original4$auditD = _row$original4.auditDetails) !== null && _row$original4$auditD !== void 0 && _row$original4$auditD.createdTime ? Digit.DateUtils.ConvertEpochToDate((_row$original5 = row.original) === null || _row$original5 === void 0 ? void 0 : (_row$original5$auditD = _row$original5.auditDetails) === null || _row$original5$auditD === void 0 ? void 0 : _row$original5$auditD.createdTime) : "");
8735
8708
  }
8736
- }, {
8737
- Header: t("WT_FILLING_POINT"),
8738
- accessor: row => getFillingPointDisplayValue(row),
8739
- id: "fillingPoint",
8740
- minWidth: 250,
8741
- Cell: ({
8742
- row
8743
- }) => {
8744
- return /*#__PURE__*/React.createElement(Dropdown$2, {
8745
- className: "fsm-registry-dropdown",
8746
- selected: getSelectedFillingPointOption(row.original, allFillingPoints),
8747
- option: allFillingPoints,
8748
- select: value => onFillingPointSelect(row, value),
8749
- style: {
8750
- textAlign: "left",
8751
- width: "100%",
8752
- minWidth: "250px"
8753
- },
8754
- optionKey: "fillingPointName",
8755
- t: t
8756
- });
8757
- }
8758
8709
  }, {
8759
8710
  Header: t("ES_VENDOR_INBOX_SERVICE_TYPE"),
8760
8711
  id: "serviceType",