@djb25/digit-ui-module-vendor 1.0.4 → 1.0.6
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 +75 -88
- package/dist/index.modern.js.map +1 -1
- package/package.json +1 -1
package/dist/index.modern.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
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,
|
|
1
|
+
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, Stepper, FormComposer, TickMark, FormStep, CardLabel, TextInput, LabelFieldPair, UploadFile, CardSubHeader, CardText, RadioOrSelect, ShippingTruck, CheckBox, RadioButtons, CloseSvg, Localities, RemoveableTag, ActionBar, ApplyFilterBar, AddIcon, Menu, Label, LinkLabel, ToggleSwitch, CardSectionHeader, StatusTable, Row, EditIcon, DeleteIcon, Modal, InfoIcon, CardHeader, LinkButton, Banner } from '@djb25/digit-ui-react-components';
|
|
2
2
|
import React, { useEffect, useMemo, useCallback, useState, useRef, Fragment } from 'react';
|
|
3
3
|
import { useTranslation } from 'react-i18next';
|
|
4
|
-
import { useParams, useLocation, Switch,
|
|
4
|
+
import { useParams, useLocation, Switch, Link, useHistory, useRouteMatch, Route, Redirect } from 'react-router-dom';
|
|
5
5
|
import { useForm, Controller } from 'react-hook-form';
|
|
6
6
|
import { useQueryClient } from 'react-query';
|
|
7
7
|
|
|
@@ -316,13 +316,11 @@ const EmployeeApp = ({
|
|
|
316
316
|
url,
|
|
317
317
|
userType
|
|
318
318
|
}) => {
|
|
319
|
-
console.log("tttttttttttt", path);
|
|
320
319
|
const {
|
|
321
320
|
t
|
|
322
321
|
} = useTranslation();
|
|
323
322
|
const location = useLocation();
|
|
324
323
|
sessionStorage.removeItem("revalidateddone");
|
|
325
|
-
const isMobile = window.Digit.Utils.browser.isMobile();
|
|
326
324
|
const AddVendor = Digit.ComponentRegistryService.getComponent("AddVendor");
|
|
327
325
|
const SearchVendor = Digit.ComponentRegistryService.getComponent("SearchVendor");
|
|
328
326
|
const AddDriver = Digit.ComponentRegistryService.getComponent("AddDriver");
|
|
@@ -376,16 +374,16 @@ const EmployeeApp = ({
|
|
|
376
374
|
return crumbs;
|
|
377
375
|
};
|
|
378
376
|
return /*#__PURE__*/React.createElement(Switch, null, /*#__PURE__*/React.createElement(AppContainer, null, /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
379
|
-
className: "ground-container"
|
|
380
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
381
|
-
className: "form-container"
|
|
377
|
+
className: "ground-container employee-app-container form-container"
|
|
382
378
|
}, /*#__PURE__*/React.createElement(ModuleHeader, {
|
|
383
379
|
leftContent: /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ArrowLeft, {
|
|
384
380
|
className: "icon"
|
|
385
381
|
}), "Back"),
|
|
386
382
|
onLeftClick: () => window.history.back(),
|
|
387
383
|
breadcrumbs: getDynamicBreadcrumbs()
|
|
388
|
-
}), /*#__PURE__*/React.createElement(
|
|
384
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
385
|
+
className: "employee-form"
|
|
386
|
+
}, /*#__PURE__*/React.createElement(PrivateRoute, {
|
|
389
387
|
path: `${path}/registry/new-vendor`,
|
|
390
388
|
component: () => /*#__PURE__*/React.createElement(AddVendor, {
|
|
391
389
|
parentRoute: path
|
|
@@ -700,36 +698,6 @@ const VendorConfig = (t, disabled = false) => {
|
|
|
700
698
|
}];
|
|
701
699
|
};
|
|
702
700
|
|
|
703
|
-
const Timeline = ({
|
|
704
|
-
steps: _steps = [],
|
|
705
|
-
currentStep: _currentStep = 1
|
|
706
|
-
}) => {
|
|
707
|
-
const {
|
|
708
|
-
t
|
|
709
|
-
} = useTranslation();
|
|
710
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
711
|
-
className: "custom-stepper-card"
|
|
712
|
-
}, _steps.map((label, index) => {
|
|
713
|
-
const stepNumber = index + 1;
|
|
714
|
-
const isActive = stepNumber === _currentStep;
|
|
715
|
-
const isCompleted = stepNumber < _currentStep;
|
|
716
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
717
|
-
className: "stepper-row",
|
|
718
|
-
key: index
|
|
719
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
720
|
-
className: "stepper-left"
|
|
721
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
722
|
-
className: `step-circle ${isActive ? "active" : ""} ${isCompleted ? "completed" : ""}`
|
|
723
|
-
}, isCompleted ? /*#__PURE__*/React.createElement(TickMark, {
|
|
724
|
-
fillColor: "red"
|
|
725
|
-
}) : stepNumber), index !== _steps.length - 1 && /*#__PURE__*/React.createElement("div", {
|
|
726
|
-
className: `step-line ${isCompleted ? "completed-line" : ""}`
|
|
727
|
-
})), /*#__PURE__*/React.createElement("div", {
|
|
728
|
-
className: `step-label ${isActive ? "active-text" : ""} ${isCompleted ? "completed-text" : ""}`
|
|
729
|
-
}, t(label)));
|
|
730
|
-
}));
|
|
731
|
-
};
|
|
732
|
-
|
|
733
701
|
const AddVendor = ({
|
|
734
702
|
parentUrl,
|
|
735
703
|
heading
|
|
@@ -739,8 +707,6 @@ const AddVendor = ({
|
|
|
739
707
|
const {
|
|
740
708
|
t
|
|
741
709
|
} = useTranslation();
|
|
742
|
-
const history = useHistory();
|
|
743
|
-
const queryClient = useQueryClient();
|
|
744
710
|
const [currentStep, setCurrentStep] = useState(1);
|
|
745
711
|
const [showToast, setShowToast] = useState(null);
|
|
746
712
|
const [canSubmit, setCanSubmit] = useState(false);
|
|
@@ -770,7 +736,11 @@ const AddVendor = ({
|
|
|
770
736
|
};
|
|
771
737
|
const vendorStepConfig = Config.filter(config => config.head === "ES_VRNDOR_NEW_VENDOR_DETAILS");
|
|
772
738
|
const addressStepConfig = Config.filter(config => config.head === "ES_FSM_REGISTRY_NEW_ADDRESS_DETAILS");
|
|
773
|
-
const steps = [
|
|
739
|
+
const steps = [{
|
|
740
|
+
label: "ES_VRNDOR_NEW_VENDOR_DETAILS"
|
|
741
|
+
}, {
|
|
742
|
+
label: "ES_FSM_REGISTRY_NEW_ADDRESS_DETAILS"
|
|
743
|
+
}];
|
|
774
744
|
const onFormValueChange = (setValue, formData) => {
|
|
775
745
|
var _formData$selectGende;
|
|
776
746
|
if (formData !== null && formData !== void 0 && formData.vendorName && formData !== null && formData !== void 0 && formData.phone && formData !== null && formData !== void 0 && (_formData$selectGende = formData.selectGender) !== null && _formData$selectGende !== void 0 && _formData$selectGende.code) {
|
|
@@ -877,15 +847,11 @@ const AddVendor = ({
|
|
|
877
847
|
}
|
|
878
848
|
});
|
|
879
849
|
};
|
|
880
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(
|
|
881
|
-
style: {
|
|
882
|
-
display: "flex",
|
|
883
|
-
width: "100%",
|
|
884
|
-
gap: "24px"
|
|
885
|
-
}
|
|
886
|
-
}, /*#__PURE__*/React.createElement(Timeline, {
|
|
850
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Stepper, {
|
|
887
851
|
steps: steps,
|
|
888
|
-
currentStep: currentStep
|
|
852
|
+
currentStep: currentStep - 1,
|
|
853
|
+
onStepClick: step => setCurrentStep(step + 1),
|
|
854
|
+
t: t
|
|
889
855
|
}), /*#__PURE__*/React.createElement("div", {
|
|
890
856
|
style: {
|
|
891
857
|
flex: "1",
|
|
@@ -919,7 +885,37 @@ const AddVendor = ({
|
|
|
919
885
|
error: showToast.key === "error",
|
|
920
886
|
label: t(showToast.key === "success" ? `ES_FSM_REGISTRY_${showToast.action}_SUCCESS` : showToast.action),
|
|
921
887
|
onClose: closeToast
|
|
922
|
-
})))
|
|
888
|
+
})));
|
|
889
|
+
};
|
|
890
|
+
|
|
891
|
+
const Timeline = ({
|
|
892
|
+
steps: _steps = [],
|
|
893
|
+
currentStep: _currentStep = 1
|
|
894
|
+
}) => {
|
|
895
|
+
const {
|
|
896
|
+
t
|
|
897
|
+
} = useTranslation();
|
|
898
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
899
|
+
className: "custom-stepper-card"
|
|
900
|
+
}, _steps.map((label, index) => {
|
|
901
|
+
const stepNumber = index + 1;
|
|
902
|
+
const isActive = stepNumber === _currentStep;
|
|
903
|
+
const isCompleted = stepNumber < _currentStep;
|
|
904
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
905
|
+
className: "stepper-row",
|
|
906
|
+
key: index
|
|
907
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
908
|
+
className: "stepper-left"
|
|
909
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
910
|
+
className: `step-circle ${isActive ? "active" : ""} ${isCompleted ? "completed" : ""}`
|
|
911
|
+
}, isCompleted ? /*#__PURE__*/React.createElement(TickMark, {
|
|
912
|
+
fillColor: "red"
|
|
913
|
+
}) : stepNumber), index !== _steps.length - 1 && /*#__PURE__*/React.createElement("div", {
|
|
914
|
+
className: `step-line ${isCompleted ? "completed-line" : ""}`
|
|
915
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
916
|
+
className: `step-label ${isActive ? "active-text" : ""} ${isCompleted ? "completed-text" : ""}`
|
|
917
|
+
}, t(label)));
|
|
918
|
+
}));
|
|
923
919
|
};
|
|
924
920
|
|
|
925
921
|
const VendorDetails = ({
|
|
@@ -1712,7 +1708,7 @@ const VendorSelectAddress = ({
|
|
|
1712
1708
|
userType,
|
|
1713
1709
|
formData
|
|
1714
1710
|
}) => {
|
|
1715
|
-
var _sessionStorage, _formData$
|
|
1711
|
+
var _sessionStorage, _formData$cpt3, _formData$cpt3$detail;
|
|
1716
1712
|
const allCities = Digit.Hooks.vendor.useTenants();
|
|
1717
1713
|
let tenantId = Digit.ULBService.getCurrentTenantId();
|
|
1718
1714
|
const {
|
|
@@ -1728,7 +1724,6 @@ const VendorSelectAddress = ({
|
|
|
1728
1724
|
var _sessionStorage2;
|
|
1729
1725
|
property = JSON.parse((_sessionStorage2 = sessionStorage) === null || _sessionStorage2 === void 0 ? void 0 : _sessionStorage2.getItem("Digit_FSM_PT"));
|
|
1730
1726
|
}
|
|
1731
|
-
console.log("properfferrfrty", property);
|
|
1732
1727
|
let cityDetail = {};
|
|
1733
1728
|
if (property) {
|
|
1734
1729
|
cityDetail = cities.filter(city => {
|
|
@@ -1759,25 +1754,24 @@ const VendorSelectAddress = ({
|
|
|
1759
1754
|
}, [cities]);
|
|
1760
1755
|
useEffect(() => {
|
|
1761
1756
|
if (selectedCity && fetchedLocalities) {
|
|
1762
|
-
var _formData$address3, _formData$cpt2, _formData$cpt2$detail, _formData$cpt2$detail2, _property3, _property3$propertyDe, _property3$propertyDe2, _formData$address4
|
|
1757
|
+
var _formData$address3, _formData$cpt2, _formData$cpt2$detail, _formData$cpt2$detail2, _property3, _property3$propertyDe, _property3$propertyDe2, _formData$address4;
|
|
1763
1758
|
let __localityList = fetchedLocalities;
|
|
1764
1759
|
let filteredLocalityList = [];
|
|
1765
|
-
|
|
1766
|
-
if (formData !== null && formData !== void 0 && (_formData$address4 = formData.address) !== null && _formData$address4 !== void 0 && _formData$address4.locality) {
|
|
1760
|
+
if (formData !== null && formData !== void 0 && (_formData$address3 = formData.address) !== null && _formData$address3 !== void 0 && _formData$address3.locality) {
|
|
1767
1761
|
setSelectedLocality(formData.address.locality);
|
|
1768
|
-
} else if (formData !== null && formData !== void 0 && (_formData$
|
|
1762
|
+
} else if (formData !== null && formData !== void 0 && (_formData$cpt2 = formData.cpt) !== null && _formData$cpt2 !== void 0 && (_formData$cpt2$detail = _formData$cpt2.details) !== null && _formData$cpt2$detail !== void 0 && (_formData$cpt2$detail2 = _formData$cpt2$detail.address) !== null && _formData$cpt2$detail2 !== void 0 && _formData$cpt2$detail2.locality) {
|
|
1769
1763
|
setSelectedLocality(formData.cpt.details.address.locality);
|
|
1770
|
-
} else if ((
|
|
1771
|
-
var
|
|
1772
|
-
setSelectedLocality((
|
|
1764
|
+
} else if ((_property3 = property) !== null && _property3 !== void 0 && (_property3$propertyDe = _property3.propertyDetails) !== null && _property3$propertyDe !== void 0 && (_property3$propertyDe2 = _property3$propertyDe.address) !== null && _property3$propertyDe2 !== void 0 && _property3$propertyDe2.locality) {
|
|
1765
|
+
var _property4, _property4$propertyDe, _property4$propertyDe2;
|
|
1766
|
+
setSelectedLocality((_property4 = property) === null || _property4 === void 0 ? void 0 : (_property4$propertyDe = _property4.propertyDetails) === null || _property4$propertyDe === void 0 ? void 0 : (_property4$propertyDe2 = _property4$propertyDe.address) === null || _property4$propertyDe2 === void 0 ? void 0 : _property4$propertyDe2.locality);
|
|
1773
1767
|
}
|
|
1774
|
-
if (formData !== null && formData !== void 0 && (_formData$
|
|
1775
|
-
var _formData$
|
|
1768
|
+
if (formData !== null && formData !== void 0 && (_formData$address4 = formData.address) !== null && _formData$address4 !== void 0 && _formData$address4.pincode) {
|
|
1769
|
+
var _formData$address5;
|
|
1776
1770
|
filteredLocalityList = __localityList.filter(obj => {
|
|
1777
1771
|
var _obj$pincode;
|
|
1778
1772
|
return (_obj$pincode = obj.pincode) === null || _obj$pincode === void 0 ? void 0 : _obj$pincode.find(item => item == formData.address.pincode);
|
|
1779
1773
|
});
|
|
1780
|
-
if (!(formData !== null && formData !== void 0 && (_formData$
|
|
1774
|
+
if (!(formData !== null && formData !== void 0 && (_formData$address5 = formData.address) !== null && _formData$address5 !== void 0 && _formData$address5.locality)) setSelectedLocality();
|
|
1781
1775
|
}
|
|
1782
1776
|
if (userType === "employee") {
|
|
1783
1777
|
onSelect(config.key, {
|
|
@@ -1796,7 +1790,7 @@ const VendorSelectAddress = ({
|
|
|
1796
1790
|
}
|
|
1797
1791
|
}
|
|
1798
1792
|
}
|
|
1799
|
-
}, [selectedCity, formData === null || formData === void 0 ? void 0 : (_formData$
|
|
1793
|
+
}, [selectedCity, formData === null || formData === void 0 ? void 0 : (_formData$cpt3 = formData.cpt) === null || _formData$cpt3 === void 0 ? void 0 : (_formData$cpt3$detail = _formData$cpt3.details) === null || _formData$cpt3$detail === void 0 ? void 0 : _formData$cpt3$detail.address, fetchedLocalities]);
|
|
1800
1794
|
function selectCity(city) {
|
|
1801
1795
|
setSelectedLocality(null);
|
|
1802
1796
|
setLocalities(null);
|
|
@@ -1819,9 +1813,7 @@ const VendorSelectAddress = ({
|
|
|
1819
1813
|
});
|
|
1820
1814
|
}
|
|
1821
1815
|
if (userType === "employee") {
|
|
1822
|
-
return /*#__PURE__*/React.createElement(
|
|
1823
|
-
className: ""
|
|
1824
|
-
}, /*#__PURE__*/React.createElement(LabelFieldPair, null, /*#__PURE__*/React.createElement(CardLabel, {
|
|
1816
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(LabelFieldPair, null, /*#__PURE__*/React.createElement(CardLabel, {
|
|
1825
1817
|
className: "card-label-smaller"
|
|
1826
1818
|
}, t("MYCITY_CODE_LABEL"), config.isMandatory ? " * " : null), /*#__PURE__*/React.createElement(Dropdown$2, {
|
|
1827
1819
|
className: "",
|
|
@@ -8988,7 +8980,9 @@ const SearchVendor = () => {
|
|
|
8988
8980
|
refetch();
|
|
8989
8981
|
refetchVendor();
|
|
8990
8982
|
}, []);
|
|
8991
|
-
return /*#__PURE__*/React.createElement(
|
|
8983
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
8984
|
+
className: "employee-form-content"
|
|
8985
|
+
}, /*#__PURE__*/React.createElement(VendorInbox, {
|
|
8992
8986
|
data: {
|
|
8993
8987
|
table: tableData
|
|
8994
8988
|
},
|
|
@@ -9010,7 +9004,7 @@ const SearchVendor = () => {
|
|
|
9010
9004
|
selectedTab: tab,
|
|
9011
9005
|
refetchData: refetchData,
|
|
9012
9006
|
refetchVendor: refetchVendorData
|
|
9013
|
-
}));
|
|
9007
|
+
})));
|
|
9014
9008
|
};
|
|
9015
9009
|
|
|
9016
9010
|
const SelectServiceType = ({
|
|
@@ -9572,7 +9566,7 @@ const EditVendorDetails = props => {
|
|
|
9572
9566
|
});
|
|
9573
9567
|
}
|
|
9574
9568
|
if (selectedAction === "ADD_VEHICLE") {
|
|
9575
|
-
return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(CardText, null, t(`ES_FSM_REGISTRY_SELECT_VEHICLE`)), /*#__PURE__*/React.createElement(Dropdown$2, {
|
|
9569
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(CardText, null, t(`ES_FSM_REGISTRY_SELECT_VEHICLE`)), /*#__PURE__*/React.createElement(Dropdown$2, {
|
|
9576
9570
|
t: t,
|
|
9577
9571
|
option: vehicles,
|
|
9578
9572
|
value: selectedOption,
|
|
@@ -9582,7 +9576,7 @@ const EditVendorDetails = props => {
|
|
|
9582
9576
|
}));
|
|
9583
9577
|
}
|
|
9584
9578
|
if (selectedAction === "ADD_DRIVER") {
|
|
9585
|
-
return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(CardText, null, t(`ES_FSM_REGISTRY_SELECT_DRIVER`)), /*#__PURE__*/React.createElement(Dropdown$2, {
|
|
9579
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(CardText, null, t(`ES_FSM_REGISTRY_SELECT_DRIVER`)), /*#__PURE__*/React.createElement(Dropdown$2, {
|
|
9586
9580
|
t: t,
|
|
9587
9581
|
option: drivers,
|
|
9588
9582
|
value: selectedOption,
|
|
@@ -9597,15 +9591,9 @@ const EditVendorDetails = props => {
|
|
|
9597
9591
|
return /*#__PURE__*/React.createElement(Loader, null);
|
|
9598
9592
|
}
|
|
9599
9593
|
const excludedKeys = ["vendorAdditionalDetailsId", "vendorId", "tenantId", "code", "lastModifiedTime", "createdTime", "lastModifiedBy", "createdBy", "active", "status", "vendorType", "vendorGroup", "narration", "documents"];
|
|
9600
|
-
return /*#__PURE__*/React.createElement(
|
|
9601
|
-
|
|
9602
|
-
|
|
9603
|
-
}
|
|
9604
|
-
}, t("ES_FSM_REGISTRY_VENDOR_DETAILS")), /*#__PURE__*/React.createElement("div", {
|
|
9605
|
-
style: !isMobile ? {
|
|
9606
|
-
marginLeft: "-15px"
|
|
9607
|
-
} : {}
|
|
9608
|
-
}, /*#__PURE__*/React.createElement(Card, {
|
|
9594
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
9595
|
+
className: "employee-form-content"
|
|
9596
|
+
}, !isLoading ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Card, {
|
|
9609
9597
|
style: {
|
|
9610
9598
|
position: "relative"
|
|
9611
9599
|
}
|
|
@@ -10272,8 +10260,6 @@ const VENDORCreate = ({
|
|
|
10272
10260
|
config = config.concat(obj.body.filter(a => !a.hideInCitizen));
|
|
10273
10261
|
});
|
|
10274
10262
|
config.indexRoute = "info";
|
|
10275
|
-
console.log(commonFields, "commanFields");
|
|
10276
|
-
console.log(config, "config");
|
|
10277
10263
|
const CheckPage = (_Digit = Digit) === null || _Digit === void 0 ? void 0 : (_Digit$ComponentRegis = _Digit.ComponentRegistryService) === null || _Digit$ComponentRegis === void 0 ? void 0 : _Digit$ComponentRegis.getComponent("VENDORCheckPage");
|
|
10278
10264
|
const NewResponse = (_Digit2 = Digit) === null || _Digit2 === void 0 ? void 0 : (_Digit2$ComponentRegi = _Digit2.ComponentRegistryService) === null || _Digit2$ComponentRegi === void 0 ? void 0 : _Digit2$ComponentRegi.getComponent("NewResponse");
|
|
10279
10265
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
@@ -11372,13 +11358,14 @@ const SelectVehicleType = ({
|
|
|
11372
11358
|
formData,
|
|
11373
11359
|
setValue
|
|
11374
11360
|
}) => {
|
|
11375
|
-
var _formData$
|
|
11361
|
+
var _formData$serviceType;
|
|
11376
11362
|
const stateId = Digit.ULBService.getStateId();
|
|
11377
11363
|
const tenantId = Digit.ULBService.getCurrentTenantId();
|
|
11378
11364
|
const {
|
|
11379
11365
|
data: vehicleData,
|
|
11380
11366
|
isLoading: vehicleLoading
|
|
11381
|
-
} = Digit.Hooks.
|
|
11367
|
+
} = Digit.Hooks.wt.useMDMS(stateId, "Vehicle", "VehicleMakeModel");
|
|
11368
|
+
console.log("vehicleData", vehicleData);
|
|
11382
11369
|
const {
|
|
11383
11370
|
data: serviceTypeData,
|
|
11384
11371
|
isLoading: serviceLoading
|
|
@@ -11396,15 +11383,15 @@ const SelectVehicleType = ({
|
|
|
11396
11383
|
const [types, setTypes] = useState([]);
|
|
11397
11384
|
const [selectedType, setSelectedType] = useState({});
|
|
11398
11385
|
const [selectedCapacity, setSelectedCapacity] = useState("");
|
|
11399
|
-
const selectedServiceType = formData === null || formData === void 0 ? void 0 : (_formData$
|
|
11386
|
+
const selectedServiceType = (formData === null || formData === void 0 ? void 0 : (_formData$serviceType = formData.serviceType) === null || _formData$serviceType === void 0 ? void 0 : _formData$serviceType.code) || (formData === null || formData === void 0 ? void 0 : formData.serviceType);
|
|
11400
11387
|
const memoizedServiceTypeFilters = useMemo(() => {
|
|
11401
11388
|
if (!serviceTypeData || !vehicleData) return {};
|
|
11402
11389
|
const filters = {};
|
|
11403
11390
|
serviceTypeData.forEach(service => {
|
|
11404
11391
|
if (service.code === "WT") {
|
|
11405
|
-
filters[service.code] = ["TANKER"];
|
|
11406
|
-
} else if (service.code === "FSM" || service.code === "CND") {
|
|
11407
11392
|
filters[service.code] = vehicleData.filter(vehicle => ["MAHINDRA", "TATA", "TRACTOR", "TAFE", "SONALIKA"].includes(vehicle.code)).map(vehicle => vehicle.code);
|
|
11393
|
+
} else if (service.code === "CND") {
|
|
11394
|
+
filters[service.code] = vehicleData.filter(vehicle => ["MAHINDRA", "TATA"].includes(vehicle.code)).map(vehicle => vehicle.code);
|
|
11408
11395
|
}
|
|
11409
11396
|
});
|
|
11410
11397
|
return filters;
|
|
@@ -11414,8 +11401,8 @@ const SelectVehicleType = ({
|
|
|
11414
11401
|
}, [memoizedServiceTypeFilters]);
|
|
11415
11402
|
useEffect(() => {
|
|
11416
11403
|
if (!vehicleData) return;
|
|
11417
|
-
const allowedModels = serviceTypeFilters[selectedServiceType]
|
|
11418
|
-
const filteredModals = vehicleData.filter(vehicle => allowedModels.includes(vehicle.code));
|
|
11404
|
+
const allowedModels = serviceTypeFilters[selectedServiceType];
|
|
11405
|
+
const filteredModals = allowedModels ? vehicleData.filter(vehicle => allowedModels.includes(vehicle.code)) : vehicleData;
|
|
11419
11406
|
setModals(filteredModals);
|
|
11420
11407
|
setSelectedModal({});
|
|
11421
11408
|
setTypes([]);
|