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

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, {
@@ -451,16 +454,19 @@ const VENDORCard = () => {
451
454
  const {
452
455
  t
453
456
  } = useTranslation();
457
+ const history = useHistory();
454
458
  const [total, setTotal] = useState("-");
455
- if (!Digit.Utils.vendorAccess()) {
459
+ const isCitizen = window.location.pathname.toLowerCase().includes("citizen");
460
+ const hasAccess = Digit.Utils.vendorAccess() || Digit.UserService.hasAccess(["WT_VENDOR", "MT_VENDOR"]);
461
+ if (!hasAccess) {
456
462
  return null;
457
463
  }
458
464
  const links = [{
459
465
  label: t("VENDOR_NEW_REGISTERATION"),
460
- link: `/digit-ui/employee/vendor/registry/new-vendor`
466
+ link: isCitizen ? `/digit-ui/citizen/vendor/registry/new-vendor` : `/digit-ui/employee/vendor/registry/new-vendor`
461
467
  }, {
462
468
  label: t("SEARCH_VENDOR"),
463
- link: `/digit-ui/employee/vendor/search-vendor`
469
+ link: isCitizen ? `/digit-ui/citizen/vendor/search-vendor` : `/digit-ui/employee/vendor/search-vendor`
464
470
  }];
465
471
  const VENDORRole = Digit.UserService.hasAccess(["WT_VENDOR"]);
466
472
  const propsForModuleCard = {
@@ -469,10 +475,18 @@ const VENDORCard = () => {
469
475
  kpis: [{
470
476
  count: total === null || total === void 0 ? void 0 : total.totalCount,
471
477
  label: t("Inbox"),
472
- link: `/digit-ui/employee/asset/assetservice/inbox`
478
+ link: isCitizen ? `/digit-ui/citizen/vendor/search-vendor` : `/digit-ui/employee/vendor/search-vendor`
473
479
  }],
474
- links: links.filter(link => !(link !== null && link !== void 0 && link.role) || VENDORRole)
480
+ links: links.filter(link => !(link !== null && link !== void 0 && link.role) || VENDORRole),
481
+ ...(isCitizen ? {
482
+ onDetailsClick: () => history.push("/digit-ui/citizen/vendor/search-vendor")
483
+ } : {})
475
484
  };
485
+ if (isCitizen) {
486
+ return /*#__PURE__*/React.createElement("div", {
487
+ className: "wt-citizen-card-premium"
488
+ }, /*#__PURE__*/React.createElement(EmployeeModuleCard, propsForModuleCard));
489
+ }
476
490
  return /*#__PURE__*/React.createElement(EmployeeModuleCard, propsForModuleCard);
477
491
  };
478
492
 
@@ -1577,7 +1591,6 @@ const ServiceDoc = ({
1577
1591
  onSelect
1578
1592
  }) => {
1579
1593
  var _Documentsob$ASSET;
1580
- const tenantId = Digit.ULBService.getCurrentTenantId();
1581
1594
  const stateId = Digit.ULBService.getStateId();
1582
1595
  const docType = config !== null && config !== void 0 && config.isMutation ? ["MutationDocuments"] : "Documents";
1583
1596
  const {
@@ -1585,12 +1598,9 @@ const ServiceDoc = ({
1585
1598
  data: Documentsob = {}
1586
1599
  } = Digit.Hooks.asset.useAssetDocumentsMDMS(stateId, "ASSET", docType);
1587
1600
  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(({
1601
+ return /*#__PURE__*/React.createElement("div", {
1602
+ className: "employee-form-content"
1603
+ }, isLoading && /*#__PURE__*/React.createElement(Loader, null), Array.isArray(docs) && docs.map(({
1594
1604
  code,
1595
1605
  dropdownData
1596
1606
  }, index) => /*#__PURE__*/React.createElement(Card, {
@@ -1606,10 +1616,10 @@ const ServiceDoc = ({
1606
1616
  marginBottom: "6px",
1607
1617
  fontSize: "14px"
1608
1618
  }
1609
- }, dropdownIndex + 1, ". ", t(stringReplaceAll(dropdownData === null || dropdownData === void 0 ? void 0 : dropdownData.code, ".", "_")))))), /*#__PURE__*/React.createElement(SubmitBar, {
1619
+ }, dropdownIndex + 1, ". ", t(stringReplaceAll(dropdownData === null || dropdownData === void 0 ? void 0 : dropdownData.code, ".", "_")))))), /*#__PURE__*/React.createElement(ActionBar, null, /*#__PURE__*/React.createElement(SubmitBar, {
1610
1620
  label: t("COMMON_NEXT"),
1611
1621
  onSubmit: onSelect
1612
- }));
1622
+ })));
1613
1623
  };
1614
1624
 
1615
1625
  const VendorSelectAddress = ({
@@ -8180,8 +8190,9 @@ const getFillingPointIdentifiers = fillingPoint => {
8180
8190
  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
8191
  };
8182
8192
  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)]));
8193
+ var _row$dsoDetails, _row$fillingpointmeta, _row$fillingPoint, _row$dsoDetails2;
8194
+ const getIdentifiers = fp => Array.isArray(fp) ? fp.flatMap(getFillingPointIdentifiers) : getFillingPointIdentifiers(fp);
8195
+ 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
8196
  };
8186
8197
  const getSelectedFillingPointOption = (row, fillingPoints = []) => {
8187
8198
  const rowFillingPointIdentifiers = getRowFillingPointIdentifiers(row);
@@ -8189,8 +8200,12 @@ const getSelectedFillingPointOption = (row, fillingPoints = []) => {
8189
8200
  return fillingPoints.find(fillingPoint => getFillingPointIdentifiers(fillingPoint).some(identifier => rowFillingPointIdentifiers.includes(identifier))) || null;
8190
8201
  };
8191
8202
  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";
8203
+ var _row$fillingPoint2, _row$dsoDetails3, _row$dsoDetails3$fill, _row$dsoDetails4, _row$dsoDetails5, _row$dsoDetails6, _row$dsoDetails7, _row$fillingpointmeta2;
8204
+ if (Array.isArray(row === null || row === void 0 ? void 0 : row.fillingPoint)) {
8205
+ 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);
8206
+ if (list.length > 0) return list.join(", ");
8207
+ }
8208
+ 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
8209
  };
8195
8210
  const getSelectedVendorOption = (row = {}, vendors = []) => {
8196
8211
  var _row$vendor, _row$vendorData;
@@ -8199,7 +8214,7 @@ const getSelectedVendorOption = (row = {}, vendors = []) => {
8199
8214
  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
8215
  };
8201
8216
  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);
8217
+ 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
8218
  const uniqueFillingPoints = new Map();
8204
8219
  fillingPointOptions.forEach(fillingPoint => {
8205
8220
  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 +8693,6 @@ const VendorInbox = props => {
8678
8693
  enabled: true
8679
8694
  });
8680
8695
  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
8696
  const columns = React.useMemo(() => {
8713
8697
  switch (props.selectedTab) {
8714
8698
  case "VENDOR":
@@ -8733,28 +8717,6 @@ const VendorInbox = props => {
8733
8717
  var _row$original4, _row$original4$auditD, _row$original5, _row$original5$auditD;
8734
8718
  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
8719
  }
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
8720
  }, {
8759
8721
  Header: t("ES_VENDOR_INBOX_SERVICE_TYPE"),
8760
8722
  id: "serviceType",