@djb25/digit-ui-module-vendor 1.0.15 → 1.0.17

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
- import React, { useEffect, useMemo, useCallback, useState, Fragment as Fragment$1 } from 'react';
1
+ import React, { useEffect, useMemo, useCallback, useState, Fragment } from 'react';
2
2
  import { useTranslation } from 'react-i18next';
3
3
  import { useParams, useLocation, Switch, Link, useHistory, 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, HomeIcon, PropertyHouse, EmployeeModuleCard, VerticalTimeline, FormComposer, FormStep, CardLabel, TextInput, LabelFieldPair, UploadFile, CardSubHeader, CardText, RadioOrSelect, ShippingTruck, CheckBox, RadioButtons, CloseSvg, Localities, RemoveableTag, ActionBar, ApplyFilterBar, AddIcon, Menu, Label, 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, CardLabel, Tooltip, TextInput, LabelFieldPair, UploadFile, CardSubHeader, CardText, RadioOrSelect, ShippingTruck, CheckBox, RadioButtons, CloseSvg, Localities, RemoveableTag, ActionBar, ApplyFilterBar, AddIcon, Menu, Label, LinkLabel, ToggleSwitch, CardSectionHeader, Row, EditIcon, DeleteIcon, Modal, InfoIcon, CardHeader, 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
 
@@ -383,58 +383,69 @@ const EmployeeApp = ({
383
383
  breadcrumbs: getDynamicBreadcrumbs()
384
384
  }), /*#__PURE__*/React.createElement(PrivateRoute, {
385
385
  path: `${path}/search-vendor`,
386
- component: renderWithLayout(props => /*#__PURE__*/React.createElement(SearchVendor, Object.assign({}, props, {
386
+ component: props => /*#__PURE__*/React.createElement(LayoutWrapper, {
387
+ layoutClass: "normal"
388
+ }, /*#__PURE__*/React.createElement(SearchVendor, Object.assign({}, props, {
387
389
  parentRoute: path
388
- })), layouts.normal)
390
+ })))
389
391
  }), /*#__PURE__*/React.createElement(PrivateRoute, {
390
392
  path: `${path}/registry/new-driver`,
391
- component: renderWithLayout(props => /*#__PURE__*/React.createElement(AddDriver, Object.assign({}, props, {
393
+ component: props => /*#__PURE__*/React.createElement(LayoutWrapper, {
394
+ layoutClass: "action"
395
+ }, /*#__PURE__*/React.createElement(AddDriver, Object.assign({}, props, {
392
396
  parentRoute: path
393
- })), layouts.action)
397
+ })))
394
398
  }), /*#__PURE__*/React.createElement(PrivateRoute, {
395
399
  path: `${path}/registry/new-vehicle`,
396
- component: renderWithLayout(props => /*#__PURE__*/React.createElement(AddVehicle, Object.assign({}, props, {
400
+ component: props => /*#__PURE__*/React.createElement(LayoutWrapper, {
401
+ layoutClass: "action"
402
+ }, /*#__PURE__*/React.createElement(AddVehicle, Object.assign({}, props, {
397
403
  parentRoute: path
398
- })), layouts.action)
404
+ })))
399
405
  }), /*#__PURE__*/React.createElement(PrivateRoute, {
400
406
  path: `${path}/registry/additionaldetails`,
401
- component: renderWithLayout(props => /*#__PURE__*/React.createElement(VendorCreate, Object.assign({}, props, {
407
+ component: props => /*#__PURE__*/React.createElement(LayoutWrapper, {
408
+ layoutClass: "normal"
409
+ }, /*#__PURE__*/React.createElement(VendorCreate, Object.assign({}, props, {
402
410
  parentRoute: path
403
- })), layouts.normal)
411
+ })))
404
412
  }), /*#__PURE__*/React.createElement(PrivateRoute, {
405
413
  path: `${path}/registry/driver-details/:id`,
406
- component: renderWithLayout(props => /*#__PURE__*/React.createElement(DriverDetails, Object.assign({}, props, {
414
+ component: props => /*#__PURE__*/React.createElement(LayoutWrapper, {
415
+ layoutClass: "action"
416
+ }, /*#__PURE__*/React.createElement(DriverDetails, Object.assign({}, props, {
407
417
  parentRoute: path
408
- })), layouts.action)
418
+ })))
409
419
  }), /*#__PURE__*/React.createElement(PrivateRoute, {
410
420
  path: `${path}/common-search/:id`,
411
- component: renderWithLayout(props => /*#__PURE__*/React.createElement(SearchApp, Object.assign({}, props, {
421
+ component: props => /*#__PURE__*/React.createElement(LayoutWrapper, {
422
+ layoutClass: "normal"
423
+ }, /*#__PURE__*/React.createElement(SearchApp, Object.assign({}, props, {
412
424
  parentRoute: path
413
- })), layouts.normal)
425
+ })))
414
426
  }), /*#__PURE__*/React.createElement(PrivateRoute, {
415
427
  path: `${path}/registry/new-vendor`,
416
- component: renderWithLayout(props => /*#__PURE__*/React.createElement(AddVendor, Object.assign({}, props, {
428
+ component: props => /*#__PURE__*/React.createElement(LayoutWrapper, {
429
+ layoutClass: "action"
430
+ }, /*#__PURE__*/React.createElement(AddVendor, Object.assign({}, props, {
417
431
  parentRoute: path
418
- })), layouts.action)
432
+ })))
419
433
  }), /*#__PURE__*/React.createElement(PrivateRoute, {
420
434
  path: `${path}/registry/vendor-details/:id`,
421
- component: renderWithLayout(props => /*#__PURE__*/React.createElement(EditVendorDetails, Object.assign({}, props, {
435
+ component: props => /*#__PURE__*/React.createElement(LayoutWrapper, {
436
+ layoutClass: "action"
437
+ }, /*#__PURE__*/React.createElement(EditVendorDetails, Object.assign({}, props, {
422
438
  parentRoute: path
423
- })), layouts.action)
439
+ })))
424
440
  }), /*#__PURE__*/React.createElement(PrivateRoute, {
425
441
  path: `${path}/registry/vehicle-details/:id`,
426
- component: renderWithLayout(props => /*#__PURE__*/React.createElement(VehicleDetails, Object.assign({}, props, {
442
+ component: props => /*#__PURE__*/React.createElement(LayoutWrapper, {
443
+ layoutClass: "action"
444
+ }, /*#__PURE__*/React.createElement(VehicleDetails, Object.assign({}, props, {
427
445
  parentRoute: path
428
- })), layouts.action)
446
+ })))
429
447
  })))));
430
448
  };
431
- const renderWithLayout = (Component, layoutClass) => routeProps => /*#__PURE__*/React.createElement("div", {
432
- className: layoutClass
433
- }, /*#__PURE__*/React.createElement(Component, routeProps));
434
- const layouts = {
435
- normal: "employee-form",
436
- action: "employee-form employee-form-content-with-action-bar"
437
- };
438
449
 
439
450
  const VENDORCard = () => {
440
451
  const {
@@ -471,19 +482,6 @@ const checkForNotNull = (value = "") => {
471
482
  const checkForNA = (value = "") => {
472
483
  return checkForNotNull(value) ? value : "NA";
473
484
  };
474
- const convertEpochToDate = (dateEpoch, businessService) => {
475
- const dateFromApi = new Date(dateEpoch);
476
- if (dateEpoch) {
477
- let month = dateFromApi.getMonth() + 1;
478
- let day = dateFromApi.getDate();
479
- let year = dateFromApi.getFullYear();
480
- month = (month > 9 ? "" : "0") + month;
481
- day = (day > 9 ? "" : "0") + day;
482
- if (businessService == "asset-create") return `${day}-${month}-${year}`;else return `${day}/${month}/${year}`;
483
- } else {
484
- return null;
485
- }
486
- };
487
485
  const VendorData = data => {
488
486
  var _data$vendordet, _data$vendordet2, _data$vendordet3, _data$vendordet4, _data$vendordet5, _data$vendordet6, _data$vendordet7, _data$vendordet8, _data$vendordet9, _data$vendordet0, _data$vendordet1, _data$vendordet10, _data$vendordet11, _data$vendordet12, _data$vendordet13, _data$vendordet13$Sta, _data$vendordet14, _data$vendordet14$Ven, _data$vendordet15, _data$vendordet16, _data$vendordet17, _data$vendordet17$Ven, _data$documents, _data$vendordet18, _data$vendordet19;
489
487
  const formdata = {
@@ -544,7 +542,7 @@ const VendorConfig = (t, disabled = false) => {
544
542
  name: "vendorName",
545
543
  validation: {
546
544
  required: true,
547
- pattern: /^[A-Za-z]/
545
+ pattern: /^[A-Za-z\s]+$/
548
546
  },
549
547
  error: t("FSM_REGISTRY_INVALID_NAME"),
550
548
  defaultValue: "",
@@ -860,6 +858,7 @@ const AddVendor = ({
860
858
  overflowY: "auto"
861
859
  }
862
860
  }, currentStep === 1 && /*#__PURE__*/React.createElement(FormComposer, {
861
+ key: "step1",
863
862
  isDisabled: !canSubmit,
864
863
  label: t("CS_COMMON_NEXT"),
865
864
  config: vendorStepConfig.filter(i => !i.hideInEmployee).map(config => ({
@@ -874,13 +873,16 @@ const AddVendor = ({
874
873
  onFormValueChange: onFormValueChange,
875
874
  noBreakLine: true
876
875
  }), currentStep === 2 && /*#__PURE__*/React.createElement(FormComposer, {
876
+ key: "step2",
877
877
  label: t("ES_COMMON_APPLICATION_SUBMIT"),
878
878
  config: addressStepConfig.filter(i => !i.hideInEmployee).map(config => ({
879
879
  ...config,
880
880
  body: config.body.filter(a => !a.hideInEmployee)
881
881
  })),
882
882
  onSubmit: onSubmit,
883
- defaultValues: defaultValues,
883
+ defaultValues: {
884
+ ...defaultValues
885
+ },
884
886
  onFormValueChange: (setValue, formData) => {},
885
887
  noBreakLine: true
886
888
  }), showToast && /*#__PURE__*/React.createElement(Toast, {
@@ -992,9 +994,6 @@ const VendorDetails = ({
992
994
  function setesino(e) {
993
995
  setEsiNo(e.target.value);
994
996
  }
995
- function setphoneno(e) {
996
- setPhoneNo(e.target.value);
997
- }
998
997
  function setcontactperson(e) {
999
998
  setContactPerson(e.target.value);
1000
999
  }
@@ -1097,7 +1096,13 @@ const VendorDetails = ({
1097
1096
  config: config,
1098
1097
  onSelect: goNext,
1099
1098
  t: t
1100
- }, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, null, `${t("IFSC_CODE")}`), /*#__PURE__*/React.createElement(TextInput, Object.assign({
1099
+ }, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, {
1100
+ className: "card-label-smaller"
1101
+ }, /*#__PURE__*/React.createElement(Tooltip, {
1102
+ label: `${t("IFSC_CODE")}`,
1103
+ isMandatory: false,
1104
+ message: t("INVALID_IFSC_CODE_ERROR_MESSAGE")
1105
+ })), /*#__PURE__*/React.createElement(TextInput, Object.assign({
1101
1106
  t: t,
1102
1107
  type: "text",
1103
1108
  isMandatory: false,
@@ -1178,25 +1183,14 @@ const VendorDetails = ({
1178
1183
  pattern: "[0-9]{9,18}",
1179
1184
  type: "text",
1180
1185
  title: t("INVALID_ACCOUNT_NO_ERROR_MESSAGE")
1181
- }))), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, null, `${t("PHONE_NO")}`), /*#__PURE__*/React.createElement(TextInput, Object.assign({
1182
- t: t,
1183
- type: "text",
1184
- isMandatory: false,
1185
- optionKey: "i18nKey",
1186
- name: "PhoneNo",
1186
+ }))), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, null, `${t("PHONE_NO")}`), /*#__PURE__*/React.createElement(MobileNumber, {
1187
1187
  value: PhoneNo,
1188
- onChange: setphoneno,
1188
+ name: "PhoneNo",
1189
+ onChange: setPhoneNo,
1189
1190
  style: {
1190
1191
  width: "100%"
1191
- },
1192
- ValidationRequired: true
1193
- }, validation = {
1194
- isRequired: true,
1195
- pattern: "[0-9]{9,18}",
1196
- type: "text",
1197
- title: t("INVALID_ACCOUNT_NO_ERROR_MESSAGE"),
1198
- length: 10
1199
- }))), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, null, `${t("CONTACT_PERSON")}`), /*#__PURE__*/React.createElement(TextInput, Object.assign({
1192
+ }
1193
+ })), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, null, `${t("CONTACT_PERSON")}`), /*#__PURE__*/React.createElement(TextInput, Object.assign({
1200
1194
  t: t,
1201
1195
  type: "text",
1202
1196
  isMandatory: false,
@@ -7674,9 +7668,16 @@ const ApplicationTable = ({
7674
7668
  pageSizeLimit,
7675
7669
  sortParams,
7676
7670
  totalRecords,
7677
- isPaginationRequired
7671
+ isPaginationRequired,
7672
+ showCSVExport,
7673
+ csvExportFileName,
7674
+ csvExportData,
7675
+ getCSVExportData,
7676
+ csvExportColumns,
7677
+ csvExportButtonLabel,
7678
+ ...rest
7678
7679
  }) => {
7679
- return /*#__PURE__*/React.createElement(Table, {
7680
+ return /*#__PURE__*/React.createElement(Table, Object.assign({
7680
7681
  className: _className,
7681
7682
  t: t,
7682
7683
  data: data,
@@ -7691,8 +7692,14 @@ const ApplicationTable = ({
7691
7692
  onSort: onSort,
7692
7693
  sortParams: sortParams,
7693
7694
  totalRecords: totalRecords,
7694
- isPaginationRequired: isPaginationRequired
7695
- });
7695
+ isPaginationRequired: isPaginationRequired,
7696
+ showCSVExport: showCSVExport,
7697
+ csvExportFileName: csvExportFileName,
7698
+ csvExportData: csvExportData,
7699
+ getCSVExportData: getCSVExportData,
7700
+ csvExportColumns: csvExportColumns,
7701
+ csvExportButtonLabel: csvExportButtonLabel
7702
+ }, rest));
7696
7703
  };
7697
7704
 
7698
7705
  const StatusCount = ({
@@ -8151,6 +8158,16 @@ const SearchApplication = ({
8151
8158
  }, t("ES_SEARCH_APPLICATION_ERROR")) : null))));
8152
8159
  };
8153
8160
 
8161
+ const parseAdditionalDetails = additionalDetails => {
8162
+ if (!additionalDetails) return {};
8163
+ if (typeof additionalDetails === "object") return additionalDetails;
8164
+ if (typeof additionalDetails !== "string") return {};
8165
+ try {
8166
+ return JSON.parse(additionalDetails);
8167
+ } catch (error) {
8168
+ return {};
8169
+ }
8170
+ };
8154
8171
  const VendorInbox = props => {
8155
8172
  const tenantId = Digit.ULBService.getCurrentTenantId();
8156
8173
  const {
@@ -8801,6 +8818,103 @@ const VendorInbox = props => {
8801
8818
  return [];
8802
8819
  }
8803
8820
  }, [props.selectedTab, vendors, drivers, tableData, additionalVendorData, allFillingPoints, t]);
8821
+ const csvExportColumns = React.useMemo(() => {
8822
+ switch (props.selectedTab) {
8823
+ case "VENDOR":
8824
+ return [{
8825
+ Header: t("ES_VENDOR_INBOX_VENDOR_NAME"),
8826
+ exportAccessor: row => {
8827
+ var _row$dsoDetails6;
8828
+ return (row === null || row === void 0 ? void 0 : row.name) || (row === null || row === void 0 ? void 0 : (_row$dsoDetails6 = row.dsoDetails) === null || _row$dsoDetails6 === void 0 ? void 0 : _row$dsoDetails6.name) || "NA";
8829
+ }
8830
+ }, {
8831
+ Header: t("ES_VENDOR_INBOX_DATE_VENDOR_CREATION"),
8832
+ exportAccessor: row => {
8833
+ var _row$auditDetails, _row$auditDetails2;
8834
+ return row !== null && row !== void 0 && (_row$auditDetails = row.auditDetails) !== null && _row$auditDetails !== void 0 && _row$auditDetails.createdTime ? Digit.DateUtils.ConvertEpochToDate(row === null || row === void 0 ? void 0 : (_row$auditDetails2 = row.auditDetails) === null || _row$auditDetails2 === void 0 ? void 0 : _row$auditDetails2.createdTime) : "";
8835
+ }
8836
+ }, {
8837
+ Header: t("WT_FILLING_POINT"),
8838
+ exportAccessor: row => {
8839
+ var _row$dsoDetails7, _row$dsoDetails7$fill, _row$dsoDetails8, _row$dsoDetails9;
8840
+ return (row === null || row === void 0 ? void 0 : (_row$dsoDetails7 = row.dsoDetails) === null || _row$dsoDetails7 === void 0 ? void 0 : (_row$dsoDetails7$fill = _row$dsoDetails7.fillingPoint) === null || _row$dsoDetails7$fill === void 0 ? void 0 : _row$dsoDetails7$fill.fillingPointName) || (row === null || row === void 0 ? void 0 : (_row$dsoDetails8 = row.dsoDetails) === null || _row$dsoDetails8 === void 0 ? void 0 : _row$dsoDetails8.fillingPoint) || (row === null || row === void 0 ? void 0 : row.fillingPoint) || (row === null || row === void 0 ? void 0 : (_row$dsoDetails9 = row.dsoDetails) === null || _row$dsoDetails9 === void 0 ? void 0 : _row$dsoDetails9.fillingPointId) || (row === null || row === void 0 ? void 0 : row.fillingPointId) || "NA";
8841
+ }
8842
+ }, {
8843
+ Header: t("ES_VENDOR_INBOX_SERVICE_TYPE"),
8844
+ exportAccessor: row => {
8845
+ var _parseAdditionalDetai, _row$dsoDetails0;
8846
+ return ((_parseAdditionalDetai = parseAdditionalDetails(row === null || row === void 0 ? void 0 : (_row$dsoDetails0 = row.dsoDetails) === null || _row$dsoDetails0 === void 0 ? void 0 : _row$dsoDetails0.additionalDetails)) === null || _parseAdditionalDetai === void 0 ? void 0 : _parseAdditionalDetai.serviceType) || "N/A";
8847
+ }
8848
+ }, {
8849
+ Header: t("ES_VENDOR_REGISTRY_INBOX_ENABLED"),
8850
+ exportAccessor: row => {
8851
+ var _row$dsoDetails1;
8852
+ return (row === null || row === void 0 ? void 0 : (_row$dsoDetails1 = row.dsoDetails) === null || _row$dsoDetails1 === void 0 ? void 0 : _row$dsoDetails1.status) || "NA";
8853
+ }
8854
+ }];
8855
+ case "VEHICLE":
8856
+ return [{
8857
+ Header: t("ES_FSM_REGISTRY_INBOX_VEHICLE_NAME"),
8858
+ exportAccessor: row => (row === null || row === void 0 ? void 0 : row.registrationNumber) || "NA"
8859
+ }, {
8860
+ Header: t("ES_FSM_REGISTRY_INBOX_DATE_VEHICLE_CREATION"),
8861
+ exportAccessor: row => {
8862
+ var _row$auditDetails3, _row$auditDetails4;
8863
+ return row !== null && row !== void 0 && (_row$auditDetails3 = row.auditDetails) !== null && _row$auditDetails3 !== void 0 && _row$auditDetails3.createdTime ? Digit.DateUtils.ConvertEpochToDate(row === null || row === void 0 ? void 0 : (_row$auditDetails4 = row.auditDetails) === null || _row$auditDetails4 === void 0 ? void 0 : _row$auditDetails4.createdTime) : "";
8864
+ }
8865
+ }, {
8866
+ Header: t("ES_FSM_REGISTRY_INBOX_VENDOR_NAME"),
8867
+ exportAccessor: row => {
8868
+ var _row$vendor3;
8869
+ return (row === null || row === void 0 ? void 0 : (_row$vendor3 = row.vendor) === null || _row$vendor3 === void 0 ? void 0 : _row$vendor3.name) || "NA";
8870
+ }
8871
+ }, {
8872
+ Header: t("ES_VENDOR_INBOX_SERVICE_TYPE"),
8873
+ exportAccessor: row => {
8874
+ var _parseAdditionalDetai2;
8875
+ return ((_parseAdditionalDetai2 = parseAdditionalDetails(row === null || row === void 0 ? void 0 : row.additionalDetails)) === null || _parseAdditionalDetai2 === void 0 ? void 0 : _parseAdditionalDetai2.serviceType) || "N/A";
8876
+ }
8877
+ }, {
8878
+ Header: t("ES_FSM_REGISTRY_SELECT_DRIVER"),
8879
+ exportAccessor: row => {
8880
+ var _row$driverData2, _row$driver2;
8881
+ return (row === null || row === void 0 ? void 0 : (_row$driverData2 = row.driverData) === null || _row$driverData2 === void 0 ? void 0 : _row$driverData2.name) || (row === null || row === void 0 ? void 0 : (_row$driver2 = row.driver) === null || _row$driver2 === void 0 ? void 0 : _row$driver2.name) || "NA";
8882
+ }
8883
+ }, {
8884
+ Header: t("ES_FSM_REGISTRY_INBOX_ENABLED"),
8885
+ exportAccessor: row => (row === null || row === void 0 ? void 0 : row.status) || "NA"
8886
+ }];
8887
+ case "DRIVER":
8888
+ return [{
8889
+ Header: t("ES_FSM_REGISTRY_INBOX_USERNAME"),
8890
+ exportAccessor: row => {
8891
+ var _row$owner2;
8892
+ return (row === null || row === void 0 ? void 0 : (_row$owner2 = row.owner) === null || _row$owner2 === void 0 ? void 0 : _row$owner2.userName) || "NA";
8893
+ }
8894
+ }, {
8895
+ Header: t("ES_FSM_REGISTRY_INBOX_DRIVER_NAME"),
8896
+ exportAccessor: row => (row === null || row === void 0 ? void 0 : row.name) || "NA"
8897
+ }, {
8898
+ Header: t("ES_FSM_REGISTRY_INBOX_DATE_DRIVER_CREATION"),
8899
+ exportAccessor: row => {
8900
+ var _row$auditDetails5, _row$auditDetails6;
8901
+ return row !== null && row !== void 0 && (_row$auditDetails5 = row.auditDetails) !== null && _row$auditDetails5 !== void 0 && _row$auditDetails5.createdTime ? Digit.DateUtils.ConvertEpochToDate(row === null || row === void 0 ? void 0 : (_row$auditDetails6 = row.auditDetails) === null || _row$auditDetails6 === void 0 ? void 0 : _row$auditDetails6.createdTime) : "";
8902
+ }
8903
+ }, {
8904
+ Header: t("ES_FSM_REGISTRY_INBOX_VENDOR_NAME"),
8905
+ exportAccessor: row => {
8906
+ var _row$vendorData2, _row$vendor4;
8907
+ return (row === null || row === void 0 ? void 0 : (_row$vendorData2 = row.vendorData) === null || _row$vendorData2 === void 0 ? void 0 : _row$vendorData2.name) || (row === null || row === void 0 ? void 0 : (_row$vendor4 = row.vendor) === null || _row$vendor4 === void 0 ? void 0 : _row$vendor4.name) || "NA";
8908
+ }
8909
+ }, {
8910
+ Header: t("ES_FSM_REGISTRY_INBOX_ENABLED"),
8911
+ exportAccessor: row => (row === null || row === void 0 ? void 0 : row.status) || "NA"
8912
+ }];
8913
+ default:
8914
+ return [];
8915
+ }
8916
+ }, [props.selectedTab, t]);
8917
+ const getCSVExportData = React.useCallback(async () => tableData, [tableData]);
8804
8918
  let result;
8805
8919
  if (props.isLoading || isAllFillingPointsLoading) {
8806
8920
  result = /*#__PURE__*/React.createElement(Loader, null);
@@ -8861,7 +8975,11 @@ const VendorInbox = props => {
8861
8975
  onSort: props.onSort,
8862
8976
  disableSort: props.disableSort,
8863
8977
  sortParams: props.sortParams,
8864
- totalRecords: props.totalRecords
8978
+ totalRecords: props.totalRecords,
8979
+ showCSVExport: true,
8980
+ getCSVExportData: getCSVExportData,
8981
+ csvExportColumns: csvExportColumns,
8982
+ csvExportFileName: `vendor-${String(props.selectedTab || "registry").toLowerCase()}-inbox`
8865
8983
  });
8866
8984
  }
8867
8985
  return /*#__PURE__*/React.createElement("div", {
@@ -8913,6 +9031,9 @@ const SearchVendor = () => {
8913
9031
  t
8914
9032
  } = useTranslation();
8915
9033
  const tenantId = Digit.ULBService.getCurrentTenantId();
9034
+ const {
9035
+ selectedTabs
9036
+ } = Digit.Hooks.useQueryParams();
8916
9037
  const [searchParams, setSearchParams] = useState({});
8917
9038
  const [sortParams, setSortParams] = useState([{
8918
9039
  id: "createdTime",
@@ -8920,7 +9041,7 @@ const SearchVendor = () => {
8920
9041
  }]);
8921
9042
  const [pageOffset, setPageOffset] = useState(0);
8922
9043
  const [pageSize, setPageSize] = useState(10);
8923
- const [tab, setTab] = useState("VENDOR");
9044
+ const [tab, setTab] = useState(selectedTabs || "VENDOR");
8924
9045
  const [vehicleIds, setVehicleIds] = useState("");
8925
9046
  const [driverIds, setDriverIds] = useState("");
8926
9047
  const [tableData, setTableData] = useState([]);
@@ -9232,7 +9353,10 @@ const DriverConfig = (t, disabled = false) => {
9232
9353
  name: "driverName",
9233
9354
  validation: {
9234
9355
  required: true,
9235
- pattern: /^[A-Za-z]/
9356
+ pattern: {
9357
+ value: /^[A-Za-z\s]+$/,
9358
+ message: t("FSM_REGISTRY_INVALID_NAME")
9359
+ }
9236
9360
  },
9237
9361
  error: t("FSM_REGISTRY_INVALID_NAME"),
9238
9362
  defaultValue: "",
@@ -9247,9 +9371,12 @@ const DriverConfig = (t, disabled = false) => {
9247
9371
  name: "license",
9248
9372
  validation: {
9249
9373
  required: true,
9250
- pattern: /^[a-zA-Z-]{0,}[- ]{0,1}[ 0-9]{1,}/
9374
+ pattern: {
9375
+ value: /^[A-Z]{2}-[0-9]{2}-[0-9]{4}-[0-9]{7}$/,
9376
+ message: t("ES_FSM_REGISTRY_INVALID_LICENSE")
9377
+ }
9251
9378
  },
9252
- error: t("FSM_REGISTRY_INVALID_DRIVER_LICENSE"),
9379
+ error: t("ES_FSM_REGISTRY_INVALID_LICENSE"),
9253
9380
  required: false,
9254
9381
  defaultValue: "",
9255
9382
  className: "payment-form-text-input-correction"
@@ -9290,7 +9417,7 @@ const DriverConfig = (t, disabled = false) => {
9290
9417
  }
9291
9418
  }, {
9292
9419
  label: t("ES_FSM_REGISTRY_NEW_DOB"),
9293
- isMandatory: false,
9420
+ isMandatory: true,
9294
9421
  type: "custom",
9295
9422
  key: "dob",
9296
9423
  populators: {
@@ -9302,7 +9429,11 @@ const DriverConfig = (t, disabled = false) => {
9302
9429
  onChange: props.onChange,
9303
9430
  date: props.value
9304
9431
  }, customProps, {
9305
- max: convertEpochToDate(new Date().setFullYear(new Date().getFullYear()))
9432
+ max: (() => {
9433
+ const date = new Date();
9434
+ date.setFullYear(date.getFullYear() - 18);
9435
+ return date.toISOString().split("T")[0];
9436
+ })()
9306
9437
  }))
9307
9438
  }
9308
9439
  }, {
@@ -9382,7 +9513,18 @@ const AddDriver = ({
9382
9513
  }
9383
9514
  };
9384
9515
  const onFormValueChange = (setValue, formData) => {
9385
- if (formData !== null && formData !== void 0 && formData.driverName && formData !== null && formData !== void 0 && formData.selectGender) {
9516
+ if (formData !== null && formData !== void 0 && formData.license) {
9517
+ const cleaned = formData.license.replace(/[^A-Za-z0-9]/g, "").toUpperCase();
9518
+ let formatted = cleaned;
9519
+ if (cleaned.length > 2) formatted = cleaned.slice(0, 2) + "-" + cleaned.slice(2);
9520
+ if (cleaned.length > 4) formatted = formatted.slice(0, 5) + "-" + formatted.slice(5);
9521
+ if (cleaned.length > 8) formatted = formatted.slice(0, 10) + "-" + formatted.slice(10);
9522
+ const finalFormatted = formatted.slice(0, 18);
9523
+ if (formData.license !== finalFormatted) {
9524
+ setValue("license", finalFormatted);
9525
+ }
9526
+ }
9527
+ if (formData !== null && formData !== void 0 && formData.driverName && /^[A-Za-z\s]+$/.test(formData === null || formData === void 0 ? void 0 : formData.driverName) && formData !== null && formData !== void 0 && formData.license && /^[A-Z]{2}-[0-9]{2}-[0-9]{4}-[0-9]{7}$/.test(formData === null || formData === void 0 ? void 0 : formData.license) && formData !== null && formData !== void 0 && formData.selectGender && formData !== null && formData !== void 0 && formData.dob && new Date(formData === null || formData === void 0 ? void 0 : formData.dob).getTime() <= new Date().setFullYear(new Date().getFullYear() - 18)) {
9386
9528
  setSubmitValve(true);
9387
9529
  } else {
9388
9530
  setSubmitValve(false);
@@ -9470,7 +9612,8 @@ const AddDriver = ({
9470
9612
  onSubmit: onSubmit,
9471
9613
  defaultValues: defaultValues,
9472
9614
  onFormValueChange: onFormValueChange,
9473
- noBreakLine: true
9615
+ noBreakLine: true,
9616
+ mode: "onChange"
9474
9617
  }), showToast && /*#__PURE__*/React.createElement(Toast, {
9475
9618
  error: showToast.key === "error" ? true : false,
9476
9619
  label: t(showToast.key === "success" ? `ES_FSM_${showToast.action}_SUCCESS` : showToast.action),
@@ -9796,9 +9939,7 @@ const EditVendorDetails = props => {
9796
9939
  marginBottom: "16px",
9797
9940
  marginTop: "32px"
9798
9941
  }
9799
- }, t(detail.title)), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
9800
- className: "formcomposer-section-grid"
9801
- }, detail === null || detail === void 0 ? void 0 : (_detail$values = detail.values) === null || _detail$values === void 0 ? void 0 : _detail$values.map((value, index) => {
9942
+ }, t(detail.title)), /*#__PURE__*/React.createElement("div", null, detail === null || detail === void 0 ? void 0 : (_detail$values = detail.values) === null || _detail$values === void 0 ? void 0 : _detail$values.map((value, index) => {
9802
9943
  var _detail$values2;
9803
9944
  if (value.title === "ES_FSM_REGISTRY_DETAILS_ADDITIONAL_DETAILS") {
9804
9945
  var _vendorAdditionalData, _vendorAdditionalData2;
@@ -9908,7 +10049,7 @@ const EditVendorDetails = props => {
9908
10049
  marginLeft: "16px"
9909
10050
  },
9910
10051
  onClick: () => onActionSelect(detail.type === "ES_FSM_REGISTRY_DETAILS_TYPE_DRIVER" ? "ADD_DRIVER" : "ADD_VEHICLE")
9911
- }, t(`${detail.type}_ADD`)))));
10052
+ }, t(`${detail.type}_ADD`))));
9912
10053
  })), showModal && /*#__PURE__*/React.createElement(Modal, {
9913
10054
  headerBarMain: /*#__PURE__*/React.createElement(Heading, {
9914
10055
  label: t(selectedAction === "DELETE" ? "ES_FSM_REGISTRY_DELETE_POPUP_HEADER" : selectedAction === "ADD_VEHICLE" ? "ES_FSM_REGISTRY_ADD_VEHICLE_POPUP_HEADER" : "ES_FSM_REGISTRY_ADD_DRIVER_POPUP_HEADER")
@@ -10060,7 +10201,10 @@ const VehicleConfig = (t, disabled = false) => {
10060
10201
  name: "ownerName",
10061
10202
  validation: {
10062
10203
  required: true,
10063
- pattern: /^[A-Za-z]/
10204
+ pattern: {
10205
+ value: /^[A-Za-z\s]+$/,
10206
+ message: t("FSM_REGISTRY_INVALID_NAME")
10207
+ }
10064
10208
  },
10065
10209
  error: t("FSM_REGISTRY_INVALID_NAME"),
10066
10210
  defaultValue: ""
@@ -10090,7 +10234,7 @@ const VehicleConfig = (t, disabled = false) => {
10090
10234
  component: "SelectGender"
10091
10235
  }, {
10092
10236
  label: t("ES_FSM_REGISTRY_NEW_DOB"),
10093
- isMandatory: false,
10237
+ isMandatory: true,
10094
10238
  type: "custom",
10095
10239
  key: "dob",
10096
10240
  populators: {
@@ -10102,7 +10246,11 @@ const VehicleConfig = (t, disabled = false) => {
10102
10246
  onChange: props.onChange,
10103
10247
  date: props.value
10104
10248
  }, customProps, {
10105
- max: convertEpochToDate(new Date().setFullYear(new Date().getFullYear()))
10249
+ max: (() => {
10250
+ const date = new Date();
10251
+ date.setFullYear(date.getFullYear() - 18);
10252
+ return date.toISOString().split("T")[0];
10253
+ })()
10106
10254
  }))
10107
10255
  }
10108
10256
  }, {
@@ -10195,7 +10343,7 @@ const AddVehicle = ({
10195
10343
  setValue("registrationNumber", updatedRegNo);
10196
10344
  }
10197
10345
  }
10198
- if (formData !== null && formData !== void 0 && formData.registrationNumber && formData !== null && formData !== void 0 && formData.ownerName && formData !== null && formData !== void 0 && formData.phone && formData !== null && formData !== void 0 && (_formData$vehicle = formData.vehicle) !== null && _formData$vehicle !== void 0 && _formData$vehicle.modal && formData !== null && formData !== void 0 && (_formData$vehicle2 = formData.vehicle) !== null && _formData$vehicle2 !== void 0 && _formData$vehicle2.type && formData !== null && formData !== void 0 && formData.selectGender) {
10346
+ if (formData !== null && formData !== void 0 && formData.registrationNumber && formData !== null && formData !== void 0 && formData.ownerName && formData !== null && formData !== void 0 && formData.phone && formData !== null && formData !== void 0 && (_formData$vehicle = formData.vehicle) !== null && _formData$vehicle !== void 0 && _formData$vehicle.modal && formData !== null && formData !== void 0 && (_formData$vehicle2 = formData.vehicle) !== null && _formData$vehicle2 !== void 0 && _formData$vehicle2.type && formData !== null && formData !== void 0 && formData.selectGender && formData !== null && formData !== void 0 && formData.dob && new Date(formData === null || formData === void 0 ? void 0 : formData.dob).getTime() <= new Date().setFullYear(new Date().getFullYear() - 18)) {
10199
10347
  setSubmitValve(true);
10200
10348
  } else {
10201
10349
  setSubmitValve(false);
@@ -10266,8 +10414,11 @@ const AddVehicle = ({
10266
10414
  key: "success",
10267
10415
  action: "ADD_VEHICLE"
10268
10416
  });
10269
- setTimeout(closeToast, 5000);
10270
10417
  queryClient.invalidateQueries("FSM_VEICLES_SEARCH");
10418
+ setTimeout(() => {
10419
+ closeToast();
10420
+ history.push(`/digit-ui/employee/vendor/search-vendor?selectedTabs=VEHICLE`);
10421
+ }, 3000);
10271
10422
  }
10272
10423
  });
10273
10424
  };
@@ -10301,7 +10452,8 @@ const AddVehicle = ({
10301
10452
  onSubmit: onSubmit,
10302
10453
  defaultValues: defaultValues,
10303
10454
  onFormValueChange: onFormValueChange,
10304
- noBreakLine: true
10455
+ noBreakLine: true,
10456
+ mode: "onChange"
10305
10457
  }), showToast && /*#__PURE__*/React.createElement(Toast, {
10306
10458
  error: showToast.key === "error" ? true : false,
10307
10459
  label: t(showToast.key === "success" ? `ES_FSM_REGISTRY_${showToast.action}_SUCCESS` : showToast.action),
@@ -11052,7 +11204,7 @@ const DriverDetails = props => {
11052
11204
  });
11053
11205
  }
11054
11206
  if (selectedAction === "ADD_VENDOR") {
11055
- return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(CardText, null, t(`ES_FSM_REGISTRY_SELECT_VENODOR`)), /*#__PURE__*/React.createElement(Dropdown$2, {
11207
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(CardText, null, t(`ES_FSM_REGISTRY_SELECT_VENODOR`)), /*#__PURE__*/React.createElement(Dropdown$2, {
11056
11208
  t: t,
11057
11209
  option: vendors,
11058
11210
  value: selectedOption,
@@ -11062,7 +11214,7 @@ const DriverDetails = props => {
11062
11214
  }));
11063
11215
  }
11064
11216
  if (selectedAction === "EDIT_VENDOR") {
11065
- return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(CardText, null, t(`ES_FSM_REGISTRY_SELECT_VENODOR`)), /*#__PURE__*/React.createElement(Dropdown$2, {
11217
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(CardText, null, t(`ES_FSM_REGISTRY_SELECT_VENODOR`)), /*#__PURE__*/React.createElement(Dropdown$2, {
11066
11218
  t: t,
11067
11219
  option: vendors,
11068
11220
  value: selectedOption,
@@ -11452,7 +11604,7 @@ const VehicleDetails = props => {
11452
11604
  });
11453
11605
  }
11454
11606
  if (selectedAction === "ADD_VENDOR") {
11455
- return /*#__PURE__*/React.createElement(Fragment$1, null, /*#__PURE__*/React.createElement(CardText, null, t(`ES_FSM_REGISTRY_SELECT_VENODOR`)), /*#__PURE__*/React.createElement(Dropdown$2, {
11607
+ return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(CardText, null, t(`ES_FSM_REGISTRY_SELECT_VENODOR`)), /*#__PURE__*/React.createElement(Dropdown$2, {
11456
11608
  t: t,
11457
11609
  option: vendors,
11458
11610
  value: selectedOption,
@@ -11462,7 +11614,7 @@ const VehicleDetails = props => {
11462
11614
  }));
11463
11615
  }
11464
11616
  if (selectedAction === "EDIT_VENDOR") {
11465
- return /*#__PURE__*/React.createElement(Fragment$1, null, /*#__PURE__*/React.createElement(CardText, null, t(`ES_FSM_REGISTRY_SELECT_VENODOR`)), /*#__PURE__*/React.createElement(Dropdown$2, {
11617
+ return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(CardText, null, t(`ES_FSM_REGISTRY_SELECT_VENODOR`)), /*#__PURE__*/React.createElement(Dropdown$2, {
11466
11618
  t: t,
11467
11619
  option: vendors,
11468
11620
  value: selectedOption,
@@ -11504,7 +11656,7 @@ const VehicleDetails = props => {
11504
11656
  }
11505
11657
  }, t(detail.title)), /*#__PURE__*/React.createElement(StatusTable, null, detail === null || detail === void 0 ? void 0 : (_detail$values = detail.values) === null || _detail$values === void 0 ? void 0 : _detail$values.map((value, index) => {
11506
11658
  var _detail$values2, _detail$values3;
11507
- return (value === null || value === void 0 ? void 0 : value.type) === "custom" ? /*#__PURE__*/React.createElement(Fragment$1, null, /*#__PURE__*/React.createElement("div", {
11659
+ return (value === null || value === void 0 ? void 0 : value.type) === "custom" ? /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("div", {
11508
11660
  className: `${index === (detail === null || detail === void 0 ? void 0 : (_detail$values2 = detail.values) === null || _detail$values2 === void 0 ? void 0 : _detail$values2.length) - 1 ? "row last" : "row"} border-none`
11509
11661
  }, /*#__PURE__*/React.createElement("h2", null, t(value.title)), /*#__PURE__*/React.createElement("div", {
11510
11662
  className: "value",