@djb25/digit-ui-module-vendor 1.0.15 → 1.0.16
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.
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +234 -73
- package/dist/index.modern.js.map +1 -1
- package/package.json +1 -1
package/dist/index.modern.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useEffect, useMemo, useCallback, useState, Fragment as Fragment$1 } 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,49 +383,67 @@ const EmployeeApp = ({
|
|
|
383
383
|
breadcrumbs: getDynamicBreadcrumbs()
|
|
384
384
|
}), /*#__PURE__*/React.createElement(PrivateRoute, {
|
|
385
385
|
path: `${path}/search-vendor`,
|
|
386
|
-
component:
|
|
386
|
+
component: props => /*#__PURE__*/React.createElement(LayoutWrapper, {
|
|
387
|
+
layoutClass: "normal"
|
|
388
|
+
}, /*#__PURE__*/React.createElement(SearchVendor, Object.assign({}, props, {
|
|
387
389
|
parentRoute: path
|
|
388
|
-
}))
|
|
390
|
+
})))
|
|
389
391
|
}), /*#__PURE__*/React.createElement(PrivateRoute, {
|
|
390
392
|
path: `${path}/registry/new-driver`,
|
|
391
|
-
component:
|
|
393
|
+
component: props => /*#__PURE__*/React.createElement(LayoutWrapper, {
|
|
394
|
+
layoutClass: "action"
|
|
395
|
+
}, /*#__PURE__*/React.createElement(AddDriver, Object.assign({}, props, {
|
|
392
396
|
parentRoute: path
|
|
393
|
-
}))
|
|
397
|
+
})))
|
|
394
398
|
}), /*#__PURE__*/React.createElement(PrivateRoute, {
|
|
395
399
|
path: `${path}/registry/new-vehicle`,
|
|
396
|
-
component:
|
|
400
|
+
component: props => /*#__PURE__*/React.createElement(LayoutWrapper, {
|
|
401
|
+
layoutClass: "action"
|
|
402
|
+
}, /*#__PURE__*/React.createElement(AddVehicle, Object.assign({}, props, {
|
|
397
403
|
parentRoute: path
|
|
398
|
-
}))
|
|
404
|
+
})))
|
|
399
405
|
}), /*#__PURE__*/React.createElement(PrivateRoute, {
|
|
400
406
|
path: `${path}/registry/additionaldetails`,
|
|
401
|
-
component: renderWithLayout(props => /*#__PURE__*/React.createElement(
|
|
407
|
+
component: renderWithLayout(props => /*#__PURE__*/React.createElement(LayoutWrapper, {
|
|
408
|
+
layoutClass: "normal"
|
|
409
|
+
}, /*#__PURE__*/React.createElement(VendorCreate, Object.assign({}, props, {
|
|
402
410
|
parentRoute: path
|
|
403
|
-
})), layouts.
|
|
411
|
+
}))), layouts.action)
|
|
404
412
|
}), /*#__PURE__*/React.createElement(PrivateRoute, {
|
|
405
413
|
path: `${path}/registry/driver-details/:id`,
|
|
406
|
-
component: renderWithLayout(props => /*#__PURE__*/React.createElement(
|
|
414
|
+
component: renderWithLayout(props => /*#__PURE__*/React.createElement(LayoutWrapper, {
|
|
415
|
+
layoutClass: "action"
|
|
416
|
+
}, /*#__PURE__*/React.createElement(DriverDetails, Object.assign({}, props, {
|
|
407
417
|
parentRoute: path
|
|
408
|
-
}))
|
|
418
|
+
}))).layouts.action)
|
|
409
419
|
}), /*#__PURE__*/React.createElement(PrivateRoute, {
|
|
410
420
|
path: `${path}/common-search/:id`,
|
|
411
|
-
component:
|
|
421
|
+
component: props => /*#__PURE__*/React.createElement(LayoutWrapper, {
|
|
422
|
+
layoutClass: "normal"
|
|
423
|
+
}, /*#__PURE__*/React.createElement(SearchApp, Object.assign({}, props, {
|
|
412
424
|
parentRoute: path
|
|
413
|
-
}))
|
|
425
|
+
})))
|
|
414
426
|
}), /*#__PURE__*/React.createElement(PrivateRoute, {
|
|
415
427
|
path: `${path}/registry/new-vendor`,
|
|
416
|
-
component:
|
|
428
|
+
component: props => /*#__PURE__*/React.createElement(LayoutWrapper, {
|
|
429
|
+
layoutClass: "action"
|
|
430
|
+
}, /*#__PURE__*/React.createElement(AddVendor, Object.assign({}, props, {
|
|
417
431
|
parentRoute: path
|
|
418
|
-
}))
|
|
432
|
+
})))
|
|
419
433
|
}), /*#__PURE__*/React.createElement(PrivateRoute, {
|
|
420
434
|
path: `${path}/registry/vendor-details/:id`,
|
|
421
|
-
component:
|
|
435
|
+
component: props => /*#__PURE__*/React.createElement(LayoutWrapper, {
|
|
436
|
+
layoutClass: "action"
|
|
437
|
+
}, /*#__PURE__*/React.createElement(EditVendorDetails, Object.assign({}, props, {
|
|
422
438
|
parentRoute: path
|
|
423
|
-
}))
|
|
439
|
+
})))
|
|
424
440
|
}), /*#__PURE__*/React.createElement(PrivateRoute, {
|
|
425
441
|
path: `${path}/registry/vehicle-details/:id`,
|
|
426
|
-
component:
|
|
442
|
+
component: props => /*#__PURE__*/React.createElement(LayoutWrapper, {
|
|
443
|
+
layoutClass: "action"
|
|
444
|
+
}, /*#__PURE__*/React.createElement(VehicleDetails, Object.assign({}, props, {
|
|
427
445
|
parentRoute: path
|
|
428
|
-
}))
|
|
446
|
+
})))
|
|
429
447
|
})))));
|
|
430
448
|
};
|
|
431
449
|
const renderWithLayout = (Component, layoutClass) => routeProps => /*#__PURE__*/React.createElement("div", {
|
|
@@ -471,19 +489,6 @@ const checkForNotNull = (value = "") => {
|
|
|
471
489
|
const checkForNA = (value = "") => {
|
|
472
490
|
return checkForNotNull(value) ? value : "NA";
|
|
473
491
|
};
|
|
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
492
|
const VendorData = data => {
|
|
488
493
|
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
494
|
const formdata = {
|
|
@@ -544,7 +549,7 @@ const VendorConfig = (t, disabled = false) => {
|
|
|
544
549
|
name: "vendorName",
|
|
545
550
|
validation: {
|
|
546
551
|
required: true,
|
|
547
|
-
pattern: /^[A-Za-z]
|
|
552
|
+
pattern: /^[A-Za-z\s]+$/
|
|
548
553
|
},
|
|
549
554
|
error: t("FSM_REGISTRY_INVALID_NAME"),
|
|
550
555
|
defaultValue: "",
|
|
@@ -860,6 +865,7 @@ const AddVendor = ({
|
|
|
860
865
|
overflowY: "auto"
|
|
861
866
|
}
|
|
862
867
|
}, currentStep === 1 && /*#__PURE__*/React.createElement(FormComposer, {
|
|
868
|
+
key: "step1",
|
|
863
869
|
isDisabled: !canSubmit,
|
|
864
870
|
label: t("CS_COMMON_NEXT"),
|
|
865
871
|
config: vendorStepConfig.filter(i => !i.hideInEmployee).map(config => ({
|
|
@@ -874,13 +880,16 @@ const AddVendor = ({
|
|
|
874
880
|
onFormValueChange: onFormValueChange,
|
|
875
881
|
noBreakLine: true
|
|
876
882
|
}), currentStep === 2 && /*#__PURE__*/React.createElement(FormComposer, {
|
|
883
|
+
key: "step2",
|
|
877
884
|
label: t("ES_COMMON_APPLICATION_SUBMIT"),
|
|
878
885
|
config: addressStepConfig.filter(i => !i.hideInEmployee).map(config => ({
|
|
879
886
|
...config,
|
|
880
887
|
body: config.body.filter(a => !a.hideInEmployee)
|
|
881
888
|
})),
|
|
882
889
|
onSubmit: onSubmit,
|
|
883
|
-
defaultValues:
|
|
890
|
+
defaultValues: {
|
|
891
|
+
...defaultValues
|
|
892
|
+
},
|
|
884
893
|
onFormValueChange: (setValue, formData) => {},
|
|
885
894
|
noBreakLine: true
|
|
886
895
|
}), showToast && /*#__PURE__*/React.createElement(Toast, {
|
|
@@ -992,9 +1001,6 @@ const VendorDetails = ({
|
|
|
992
1001
|
function setesino(e) {
|
|
993
1002
|
setEsiNo(e.target.value);
|
|
994
1003
|
}
|
|
995
|
-
function setphoneno(e) {
|
|
996
|
-
setPhoneNo(e.target.value);
|
|
997
|
-
}
|
|
998
1004
|
function setcontactperson(e) {
|
|
999
1005
|
setContactPerson(e.target.value);
|
|
1000
1006
|
}
|
|
@@ -1097,7 +1103,13 @@ const VendorDetails = ({
|
|
|
1097
1103
|
config: config,
|
|
1098
1104
|
onSelect: goNext,
|
|
1099
1105
|
t: t
|
|
1100
|
-
}, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel,
|
|
1106
|
+
}, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, {
|
|
1107
|
+
className: "card-label-smaller"
|
|
1108
|
+
}, /*#__PURE__*/React.createElement(Tooltip, {
|
|
1109
|
+
label: `${t("IFSC_CODE")}`,
|
|
1110
|
+
isMandatory: false,
|
|
1111
|
+
message: t("INVALID_IFSC_CODE_ERROR_MESSAGE")
|
|
1112
|
+
})), /*#__PURE__*/React.createElement(TextInput, Object.assign({
|
|
1101
1113
|
t: t,
|
|
1102
1114
|
type: "text",
|
|
1103
1115
|
isMandatory: false,
|
|
@@ -1178,25 +1190,14 @@ const VendorDetails = ({
|
|
|
1178
1190
|
pattern: "[0-9]{9,18}",
|
|
1179
1191
|
type: "text",
|
|
1180
1192
|
title: t("INVALID_ACCOUNT_NO_ERROR_MESSAGE")
|
|
1181
|
-
}))), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, null, `${t("PHONE_NO")}`), /*#__PURE__*/React.createElement(
|
|
1182
|
-
t: t,
|
|
1183
|
-
type: "text",
|
|
1184
|
-
isMandatory: false,
|
|
1185
|
-
optionKey: "i18nKey",
|
|
1186
|
-
name: "PhoneNo",
|
|
1193
|
+
}))), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, null, `${t("PHONE_NO")}`), /*#__PURE__*/React.createElement(MobileNumber, {
|
|
1187
1194
|
value: PhoneNo,
|
|
1188
|
-
|
|
1195
|
+
name: "PhoneNo",
|
|
1196
|
+
onChange: setPhoneNo,
|
|
1189
1197
|
style: {
|
|
1190
1198
|
width: "100%"
|
|
1191
|
-
}
|
|
1192
|
-
|
|
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({
|
|
1199
|
+
}
|
|
1200
|
+
})), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, null, `${t("CONTACT_PERSON")}`), /*#__PURE__*/React.createElement(TextInput, Object.assign({
|
|
1200
1201
|
t: t,
|
|
1201
1202
|
type: "text",
|
|
1202
1203
|
isMandatory: false,
|
|
@@ -7674,9 +7675,16 @@ const ApplicationTable = ({
|
|
|
7674
7675
|
pageSizeLimit,
|
|
7675
7676
|
sortParams,
|
|
7676
7677
|
totalRecords,
|
|
7677
|
-
isPaginationRequired
|
|
7678
|
+
isPaginationRequired,
|
|
7679
|
+
showCSVExport,
|
|
7680
|
+
csvExportFileName,
|
|
7681
|
+
csvExportData,
|
|
7682
|
+
getCSVExportData,
|
|
7683
|
+
csvExportColumns,
|
|
7684
|
+
csvExportButtonLabel,
|
|
7685
|
+
...rest
|
|
7678
7686
|
}) => {
|
|
7679
|
-
return /*#__PURE__*/React.createElement(Table, {
|
|
7687
|
+
return /*#__PURE__*/React.createElement(Table, Object.assign({
|
|
7680
7688
|
className: _className,
|
|
7681
7689
|
t: t,
|
|
7682
7690
|
data: data,
|
|
@@ -7691,8 +7699,14 @@ const ApplicationTable = ({
|
|
|
7691
7699
|
onSort: onSort,
|
|
7692
7700
|
sortParams: sortParams,
|
|
7693
7701
|
totalRecords: totalRecords,
|
|
7694
|
-
isPaginationRequired: isPaginationRequired
|
|
7695
|
-
|
|
7702
|
+
isPaginationRequired: isPaginationRequired,
|
|
7703
|
+
showCSVExport: showCSVExport,
|
|
7704
|
+
csvExportFileName: csvExportFileName,
|
|
7705
|
+
csvExportData: csvExportData,
|
|
7706
|
+
getCSVExportData: getCSVExportData,
|
|
7707
|
+
csvExportColumns: csvExportColumns,
|
|
7708
|
+
csvExportButtonLabel: csvExportButtonLabel
|
|
7709
|
+
}, rest));
|
|
7696
7710
|
};
|
|
7697
7711
|
|
|
7698
7712
|
const StatusCount = ({
|
|
@@ -8151,6 +8165,16 @@ const SearchApplication = ({
|
|
|
8151
8165
|
}, t("ES_SEARCH_APPLICATION_ERROR")) : null))));
|
|
8152
8166
|
};
|
|
8153
8167
|
|
|
8168
|
+
const parseAdditionalDetails = additionalDetails => {
|
|
8169
|
+
if (!additionalDetails) return {};
|
|
8170
|
+
if (typeof additionalDetails === "object") return additionalDetails;
|
|
8171
|
+
if (typeof additionalDetails !== "string") return {};
|
|
8172
|
+
try {
|
|
8173
|
+
return JSON.parse(additionalDetails);
|
|
8174
|
+
} catch (error) {
|
|
8175
|
+
return {};
|
|
8176
|
+
}
|
|
8177
|
+
};
|
|
8154
8178
|
const VendorInbox = props => {
|
|
8155
8179
|
const tenantId = Digit.ULBService.getCurrentTenantId();
|
|
8156
8180
|
const {
|
|
@@ -8801,6 +8825,103 @@ const VendorInbox = props => {
|
|
|
8801
8825
|
return [];
|
|
8802
8826
|
}
|
|
8803
8827
|
}, [props.selectedTab, vendors, drivers, tableData, additionalVendorData, allFillingPoints, t]);
|
|
8828
|
+
const csvExportColumns = React.useMemo(() => {
|
|
8829
|
+
switch (props.selectedTab) {
|
|
8830
|
+
case "VENDOR":
|
|
8831
|
+
return [{
|
|
8832
|
+
Header: t("ES_VENDOR_INBOX_VENDOR_NAME"),
|
|
8833
|
+
exportAccessor: row => {
|
|
8834
|
+
var _row$dsoDetails6;
|
|
8835
|
+
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";
|
|
8836
|
+
}
|
|
8837
|
+
}, {
|
|
8838
|
+
Header: t("ES_VENDOR_INBOX_DATE_VENDOR_CREATION"),
|
|
8839
|
+
exportAccessor: row => {
|
|
8840
|
+
var _row$auditDetails, _row$auditDetails2;
|
|
8841
|
+
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) : "";
|
|
8842
|
+
}
|
|
8843
|
+
}, {
|
|
8844
|
+
Header: t("WT_FILLING_POINT"),
|
|
8845
|
+
exportAccessor: row => {
|
|
8846
|
+
var _row$dsoDetails7, _row$dsoDetails7$fill, _row$dsoDetails8, _row$dsoDetails9;
|
|
8847
|
+
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";
|
|
8848
|
+
}
|
|
8849
|
+
}, {
|
|
8850
|
+
Header: t("ES_VENDOR_INBOX_SERVICE_TYPE"),
|
|
8851
|
+
exportAccessor: row => {
|
|
8852
|
+
var _parseAdditionalDetai, _row$dsoDetails0;
|
|
8853
|
+
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";
|
|
8854
|
+
}
|
|
8855
|
+
}, {
|
|
8856
|
+
Header: t("ES_VENDOR_REGISTRY_INBOX_ENABLED"),
|
|
8857
|
+
exportAccessor: row => {
|
|
8858
|
+
var _row$dsoDetails1;
|
|
8859
|
+
return (row === null || row === void 0 ? void 0 : (_row$dsoDetails1 = row.dsoDetails) === null || _row$dsoDetails1 === void 0 ? void 0 : _row$dsoDetails1.status) || "NA";
|
|
8860
|
+
}
|
|
8861
|
+
}];
|
|
8862
|
+
case "VEHICLE":
|
|
8863
|
+
return [{
|
|
8864
|
+
Header: t("ES_FSM_REGISTRY_INBOX_VEHICLE_NAME"),
|
|
8865
|
+
exportAccessor: row => (row === null || row === void 0 ? void 0 : row.registrationNumber) || "NA"
|
|
8866
|
+
}, {
|
|
8867
|
+
Header: t("ES_FSM_REGISTRY_INBOX_DATE_VEHICLE_CREATION"),
|
|
8868
|
+
exportAccessor: row => {
|
|
8869
|
+
var _row$auditDetails3, _row$auditDetails4;
|
|
8870
|
+
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) : "";
|
|
8871
|
+
}
|
|
8872
|
+
}, {
|
|
8873
|
+
Header: t("ES_FSM_REGISTRY_INBOX_VENDOR_NAME"),
|
|
8874
|
+
exportAccessor: row => {
|
|
8875
|
+
var _row$vendor3;
|
|
8876
|
+
return (row === null || row === void 0 ? void 0 : (_row$vendor3 = row.vendor) === null || _row$vendor3 === void 0 ? void 0 : _row$vendor3.name) || "NA";
|
|
8877
|
+
}
|
|
8878
|
+
}, {
|
|
8879
|
+
Header: t("ES_VENDOR_INBOX_SERVICE_TYPE"),
|
|
8880
|
+
exportAccessor: row => {
|
|
8881
|
+
var _parseAdditionalDetai2;
|
|
8882
|
+
return ((_parseAdditionalDetai2 = parseAdditionalDetails(row === null || row === void 0 ? void 0 : row.additionalDetails)) === null || _parseAdditionalDetai2 === void 0 ? void 0 : _parseAdditionalDetai2.serviceType) || "N/A";
|
|
8883
|
+
}
|
|
8884
|
+
}, {
|
|
8885
|
+
Header: t("ES_FSM_REGISTRY_SELECT_DRIVER"),
|
|
8886
|
+
exportAccessor: row => {
|
|
8887
|
+
var _row$driverData2, _row$driver2;
|
|
8888
|
+
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";
|
|
8889
|
+
}
|
|
8890
|
+
}, {
|
|
8891
|
+
Header: t("ES_FSM_REGISTRY_INBOX_ENABLED"),
|
|
8892
|
+
exportAccessor: row => (row === null || row === void 0 ? void 0 : row.status) || "NA"
|
|
8893
|
+
}];
|
|
8894
|
+
case "DRIVER":
|
|
8895
|
+
return [{
|
|
8896
|
+
Header: t("ES_FSM_REGISTRY_INBOX_USERNAME"),
|
|
8897
|
+
exportAccessor: row => {
|
|
8898
|
+
var _row$owner2;
|
|
8899
|
+
return (row === null || row === void 0 ? void 0 : (_row$owner2 = row.owner) === null || _row$owner2 === void 0 ? void 0 : _row$owner2.userName) || "NA";
|
|
8900
|
+
}
|
|
8901
|
+
}, {
|
|
8902
|
+
Header: t("ES_FSM_REGISTRY_INBOX_DRIVER_NAME"),
|
|
8903
|
+
exportAccessor: row => (row === null || row === void 0 ? void 0 : row.name) || "NA"
|
|
8904
|
+
}, {
|
|
8905
|
+
Header: t("ES_FSM_REGISTRY_INBOX_DATE_DRIVER_CREATION"),
|
|
8906
|
+
exportAccessor: row => {
|
|
8907
|
+
var _row$auditDetails5, _row$auditDetails6;
|
|
8908
|
+
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) : "";
|
|
8909
|
+
}
|
|
8910
|
+
}, {
|
|
8911
|
+
Header: t("ES_FSM_REGISTRY_INBOX_VENDOR_NAME"),
|
|
8912
|
+
exportAccessor: row => {
|
|
8913
|
+
var _row$vendorData2, _row$vendor4;
|
|
8914
|
+
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";
|
|
8915
|
+
}
|
|
8916
|
+
}, {
|
|
8917
|
+
Header: t("ES_FSM_REGISTRY_INBOX_ENABLED"),
|
|
8918
|
+
exportAccessor: row => (row === null || row === void 0 ? void 0 : row.status) || "NA"
|
|
8919
|
+
}];
|
|
8920
|
+
default:
|
|
8921
|
+
return [];
|
|
8922
|
+
}
|
|
8923
|
+
}, [props.selectedTab, t]);
|
|
8924
|
+
const getCSVExportData = React.useCallback(async () => tableData, [tableData]);
|
|
8804
8925
|
let result;
|
|
8805
8926
|
if (props.isLoading || isAllFillingPointsLoading) {
|
|
8806
8927
|
result = /*#__PURE__*/React.createElement(Loader, null);
|
|
@@ -8861,7 +8982,11 @@ const VendorInbox = props => {
|
|
|
8861
8982
|
onSort: props.onSort,
|
|
8862
8983
|
disableSort: props.disableSort,
|
|
8863
8984
|
sortParams: props.sortParams,
|
|
8864
|
-
totalRecords: props.totalRecords
|
|
8985
|
+
totalRecords: props.totalRecords,
|
|
8986
|
+
showCSVExport: true,
|
|
8987
|
+
getCSVExportData: getCSVExportData,
|
|
8988
|
+
csvExportColumns: csvExportColumns,
|
|
8989
|
+
csvExportFileName: `vendor-${String(props.selectedTab || "registry").toLowerCase()}-inbox`
|
|
8865
8990
|
});
|
|
8866
8991
|
}
|
|
8867
8992
|
return /*#__PURE__*/React.createElement("div", {
|
|
@@ -8913,6 +9038,9 @@ const SearchVendor = () => {
|
|
|
8913
9038
|
t
|
|
8914
9039
|
} = useTranslation();
|
|
8915
9040
|
const tenantId = Digit.ULBService.getCurrentTenantId();
|
|
9041
|
+
const {
|
|
9042
|
+
selectedTabs
|
|
9043
|
+
} = Digit.Hooks.useQueryParams();
|
|
8916
9044
|
const [searchParams, setSearchParams] = useState({});
|
|
8917
9045
|
const [sortParams, setSortParams] = useState([{
|
|
8918
9046
|
id: "createdTime",
|
|
@@ -8920,7 +9048,7 @@ const SearchVendor = () => {
|
|
|
8920
9048
|
}]);
|
|
8921
9049
|
const [pageOffset, setPageOffset] = useState(0);
|
|
8922
9050
|
const [pageSize, setPageSize] = useState(10);
|
|
8923
|
-
const [tab, setTab] = useState("VENDOR");
|
|
9051
|
+
const [tab, setTab] = useState(selectedTabs || "VENDOR");
|
|
8924
9052
|
const [vehicleIds, setVehicleIds] = useState("");
|
|
8925
9053
|
const [driverIds, setDriverIds] = useState("");
|
|
8926
9054
|
const [tableData, setTableData] = useState([]);
|
|
@@ -9232,7 +9360,10 @@ const DriverConfig = (t, disabled = false) => {
|
|
|
9232
9360
|
name: "driverName",
|
|
9233
9361
|
validation: {
|
|
9234
9362
|
required: true,
|
|
9235
|
-
pattern:
|
|
9363
|
+
pattern: {
|
|
9364
|
+
value: /^[A-Za-z\s]+$/,
|
|
9365
|
+
message: t("FSM_REGISTRY_INVALID_NAME")
|
|
9366
|
+
}
|
|
9236
9367
|
},
|
|
9237
9368
|
error: t("FSM_REGISTRY_INVALID_NAME"),
|
|
9238
9369
|
defaultValue: "",
|
|
@@ -9247,9 +9378,12 @@ const DriverConfig = (t, disabled = false) => {
|
|
|
9247
9378
|
name: "license",
|
|
9248
9379
|
validation: {
|
|
9249
9380
|
required: true,
|
|
9250
|
-
pattern:
|
|
9381
|
+
pattern: {
|
|
9382
|
+
value: /^[A-Z]{2}-[0-9]{2}-[0-9]{4}-[0-9]{7}$/,
|
|
9383
|
+
message: t("ES_FSM_REGISTRY_INVALID_LICENSE")
|
|
9384
|
+
}
|
|
9251
9385
|
},
|
|
9252
|
-
error: t("
|
|
9386
|
+
error: t("ES_FSM_REGISTRY_INVALID_LICENSE"),
|
|
9253
9387
|
required: false,
|
|
9254
9388
|
defaultValue: "",
|
|
9255
9389
|
className: "payment-form-text-input-correction"
|
|
@@ -9290,7 +9424,7 @@ const DriverConfig = (t, disabled = false) => {
|
|
|
9290
9424
|
}
|
|
9291
9425
|
}, {
|
|
9292
9426
|
label: t("ES_FSM_REGISTRY_NEW_DOB"),
|
|
9293
|
-
isMandatory:
|
|
9427
|
+
isMandatory: true,
|
|
9294
9428
|
type: "custom",
|
|
9295
9429
|
key: "dob",
|
|
9296
9430
|
populators: {
|
|
@@ -9302,7 +9436,11 @@ const DriverConfig = (t, disabled = false) => {
|
|
|
9302
9436
|
onChange: props.onChange,
|
|
9303
9437
|
date: props.value
|
|
9304
9438
|
}, customProps, {
|
|
9305
|
-
max:
|
|
9439
|
+
max: (() => {
|
|
9440
|
+
const date = new Date();
|
|
9441
|
+
date.setFullYear(date.getFullYear() - 18);
|
|
9442
|
+
return date.toISOString().split("T")[0];
|
|
9443
|
+
})()
|
|
9306
9444
|
}))
|
|
9307
9445
|
}
|
|
9308
9446
|
}, {
|
|
@@ -9382,7 +9520,18 @@ const AddDriver = ({
|
|
|
9382
9520
|
}
|
|
9383
9521
|
};
|
|
9384
9522
|
const onFormValueChange = (setValue, formData) => {
|
|
9385
|
-
if (formData !== null && formData !== void 0 && formData.
|
|
9523
|
+
if (formData !== null && formData !== void 0 && formData.license) {
|
|
9524
|
+
const cleaned = formData.license.replace(/[^A-Za-z0-9]/g, "").toUpperCase();
|
|
9525
|
+
let formatted = cleaned;
|
|
9526
|
+
if (cleaned.length > 2) formatted = cleaned.slice(0, 2) + "-" + cleaned.slice(2);
|
|
9527
|
+
if (cleaned.length > 4) formatted = formatted.slice(0, 5) + "-" + formatted.slice(5);
|
|
9528
|
+
if (cleaned.length > 8) formatted = formatted.slice(0, 10) + "-" + formatted.slice(10);
|
|
9529
|
+
const finalFormatted = formatted.slice(0, 18);
|
|
9530
|
+
if (formData.license !== finalFormatted) {
|
|
9531
|
+
setValue("license", finalFormatted);
|
|
9532
|
+
}
|
|
9533
|
+
}
|
|
9534
|
+
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
9535
|
setSubmitValve(true);
|
|
9387
9536
|
} else {
|
|
9388
9537
|
setSubmitValve(false);
|
|
@@ -9470,7 +9619,8 @@ const AddDriver = ({
|
|
|
9470
9619
|
onSubmit: onSubmit,
|
|
9471
9620
|
defaultValues: defaultValues,
|
|
9472
9621
|
onFormValueChange: onFormValueChange,
|
|
9473
|
-
noBreakLine: true
|
|
9622
|
+
noBreakLine: true,
|
|
9623
|
+
mode: "onChange"
|
|
9474
9624
|
}), showToast && /*#__PURE__*/React.createElement(Toast, {
|
|
9475
9625
|
error: showToast.key === "error" ? true : false,
|
|
9476
9626
|
label: t(showToast.key === "success" ? `ES_FSM_${showToast.action}_SUCCESS` : showToast.action),
|
|
@@ -10060,7 +10210,10 @@ const VehicleConfig = (t, disabled = false) => {
|
|
|
10060
10210
|
name: "ownerName",
|
|
10061
10211
|
validation: {
|
|
10062
10212
|
required: true,
|
|
10063
|
-
pattern:
|
|
10213
|
+
pattern: {
|
|
10214
|
+
value: /^[A-Za-z\s]+$/,
|
|
10215
|
+
message: t("FSM_REGISTRY_INVALID_NAME")
|
|
10216
|
+
}
|
|
10064
10217
|
},
|
|
10065
10218
|
error: t("FSM_REGISTRY_INVALID_NAME"),
|
|
10066
10219
|
defaultValue: ""
|
|
@@ -10090,7 +10243,7 @@ const VehicleConfig = (t, disabled = false) => {
|
|
|
10090
10243
|
component: "SelectGender"
|
|
10091
10244
|
}, {
|
|
10092
10245
|
label: t("ES_FSM_REGISTRY_NEW_DOB"),
|
|
10093
|
-
isMandatory:
|
|
10246
|
+
isMandatory: true,
|
|
10094
10247
|
type: "custom",
|
|
10095
10248
|
key: "dob",
|
|
10096
10249
|
populators: {
|
|
@@ -10102,7 +10255,11 @@ const VehicleConfig = (t, disabled = false) => {
|
|
|
10102
10255
|
onChange: props.onChange,
|
|
10103
10256
|
date: props.value
|
|
10104
10257
|
}, customProps, {
|
|
10105
|
-
max:
|
|
10258
|
+
max: (() => {
|
|
10259
|
+
const date = new Date();
|
|
10260
|
+
date.setFullYear(date.getFullYear() - 18);
|
|
10261
|
+
return date.toISOString().split("T")[0];
|
|
10262
|
+
})()
|
|
10106
10263
|
}))
|
|
10107
10264
|
}
|
|
10108
10265
|
}, {
|
|
@@ -10195,7 +10352,7 @@ const AddVehicle = ({
|
|
|
10195
10352
|
setValue("registrationNumber", updatedRegNo);
|
|
10196
10353
|
}
|
|
10197
10354
|
}
|
|
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) {
|
|
10355
|
+
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
10356
|
setSubmitValve(true);
|
|
10200
10357
|
} else {
|
|
10201
10358
|
setSubmitValve(false);
|
|
@@ -10266,8 +10423,11 @@ const AddVehicle = ({
|
|
|
10266
10423
|
key: "success",
|
|
10267
10424
|
action: "ADD_VEHICLE"
|
|
10268
10425
|
});
|
|
10269
|
-
setTimeout(closeToast, 5000);
|
|
10270
10426
|
queryClient.invalidateQueries("FSM_VEICLES_SEARCH");
|
|
10427
|
+
setTimeout(() => {
|
|
10428
|
+
closeToast();
|
|
10429
|
+
history.push(`/digit-ui/employee/vendor/search-vendor?selectedTabs=VEHICLE`);
|
|
10430
|
+
}, 3000);
|
|
10271
10431
|
}
|
|
10272
10432
|
});
|
|
10273
10433
|
};
|
|
@@ -10301,7 +10461,8 @@ const AddVehicle = ({
|
|
|
10301
10461
|
onSubmit: onSubmit,
|
|
10302
10462
|
defaultValues: defaultValues,
|
|
10303
10463
|
onFormValueChange: onFormValueChange,
|
|
10304
|
-
noBreakLine: true
|
|
10464
|
+
noBreakLine: true,
|
|
10465
|
+
mode: "onChange"
|
|
10305
10466
|
}), showToast && /*#__PURE__*/React.createElement(Toast, {
|
|
10306
10467
|
error: showToast.key === "error" ? true : false,
|
|
10307
10468
|
label: t(showToast.key === "success" ? `ES_FSM_REGISTRY_${showToast.action}_SUCCESS` : showToast.action),
|