@djb25/digit-ui-module-vendor 1.0.20 → 1.0.21
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 +42 -6
- package/dist/index.modern.js.map +1 -1
- package/package.json +1 -1
package/dist/index.modern.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useEffect, useMemo, useCallback, useState } from 'react';
|
|
2
2
|
import { useTranslation } from 'react-i18next';
|
|
3
|
-
import { useParams, useLocation, Switch,
|
|
3
|
+
import { useParams, useLocation, Switch, useHistory, Link, useRouteMatch, Route, Redirect } from 'react-router-dom';
|
|
4
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';
|
|
5
5
|
import { useForm, Controller } from 'react-hook-form';
|
|
6
6
|
import { useQueryClient } from 'react-query';
|
|
@@ -606,7 +606,7 @@ const VendorConfig = (t, disabled = false) => {
|
|
|
606
606
|
}, {
|
|
607
607
|
head: "ES_FSM_REGISTRY_NEW_ADDRESS_DETAILS",
|
|
608
608
|
body: [{
|
|
609
|
-
label: "
|
|
609
|
+
label: "HOUSE_NO",
|
|
610
610
|
isMandatory: false,
|
|
611
611
|
type: "text",
|
|
612
612
|
key: "doorNo",
|
|
@@ -696,6 +696,7 @@ const AddVendor = ({
|
|
|
696
696
|
const {
|
|
697
697
|
t
|
|
698
698
|
} = useTranslation();
|
|
699
|
+
const history = useHistory();
|
|
699
700
|
const [currentStep, setCurrentStep] = useState(1);
|
|
700
701
|
const [showToast, setShowToast] = useState(null);
|
|
701
702
|
const [canSubmit, setCanSubmit] = useState(false);
|
|
@@ -728,12 +729,43 @@ const AddVendor = ({
|
|
|
728
729
|
}
|
|
729
730
|
};
|
|
730
731
|
const onFormValueChange = (setValue, formData) => {
|
|
731
|
-
var _formData$serviceType;
|
|
732
|
-
|
|
732
|
+
var _formData$serviceType, _formData$address, _formData$address2;
|
|
733
|
+
const isVendorDetailsFilled = (formData === null || formData === void 0 ? void 0 : formData.vendorName) && (formData === null || formData === void 0 ? void 0 : formData.phone) && (formData === null || formData === void 0 ? void 0 : (_formData$serviceType = formData.serviceType) === null || _formData$serviceType === void 0 ? void 0 : _formData$serviceType.code);
|
|
734
|
+
const isAddressFilled = (formData === null || formData === void 0 ? void 0 : (_formData$address = formData.address) === null || _formData$address === void 0 ? void 0 : _formData$address.city) && (formData === null || formData === void 0 ? void 0 : (_formData$address2 = formData.address) === null || _formData$address2 === void 0 ? void 0 : _formData$address2.locality);
|
|
735
|
+
if (isVendorDetailsFilled && isAddressFilled) {
|
|
733
736
|
setCanSubmit(true);
|
|
734
737
|
} else {
|
|
735
738
|
setCanSubmit(false);
|
|
736
739
|
}
|
|
740
|
+
if (isVendorDetailsFilled) {
|
|
741
|
+
if (currentStep === 1) {
|
|
742
|
+
setCurrentStep(2);
|
|
743
|
+
setTimeout(() => {
|
|
744
|
+
const headers = Array.from(document.querySelectorAll(".collapsible-card-title"));
|
|
745
|
+
const addressHeader = headers.find(h => h.textContent.includes(t("ES_FSM_REGISTRY_NEW_ADDRESS_DETAILS")));
|
|
746
|
+
if (addressHeader) {
|
|
747
|
+
addressHeader.scrollIntoView({
|
|
748
|
+
behavior: "smooth",
|
|
749
|
+
block: "start"
|
|
750
|
+
});
|
|
751
|
+
}
|
|
752
|
+
}, 100);
|
|
753
|
+
}
|
|
754
|
+
} else {
|
|
755
|
+
if (currentStep === 2) {
|
|
756
|
+
setCurrentStep(1);
|
|
757
|
+
setTimeout(() => {
|
|
758
|
+
const headers = Array.from(document.querySelectorAll(".collapsible-card-title"));
|
|
759
|
+
const vendorHeader = headers.find(h => h.textContent.includes(t("ES_VRNDOR_NEW_VENDOR_DETAILS")));
|
|
760
|
+
if (vendorHeader) {
|
|
761
|
+
vendorHeader.scrollIntoView({
|
|
762
|
+
behavior: "smooth",
|
|
763
|
+
block: "start"
|
|
764
|
+
});
|
|
765
|
+
}
|
|
766
|
+
}, 100);
|
|
767
|
+
}
|
|
768
|
+
}
|
|
737
769
|
};
|
|
738
770
|
const closeToast = () => {
|
|
739
771
|
setShowToast(null);
|
|
@@ -821,7 +853,10 @@ const AddVendor = ({
|
|
|
821
853
|
key: "success",
|
|
822
854
|
action: "ADD_VENDOR"
|
|
823
855
|
});
|
|
824
|
-
setTimeout(
|
|
856
|
+
setTimeout(() => {
|
|
857
|
+
closeToast();
|
|
858
|
+
history.push("/digit-ui/employee/vendor/search-vendor");
|
|
859
|
+
}, 2000);
|
|
825
860
|
}
|
|
826
861
|
});
|
|
827
862
|
};
|
|
@@ -858,7 +893,8 @@ const AddVendor = ({
|
|
|
858
893
|
defaultValues: defaultValues,
|
|
859
894
|
onFormValueChange: onFormValueChange,
|
|
860
895
|
noBreakLine: true,
|
|
861
|
-
noCard: true
|
|
896
|
+
noCard: true,
|
|
897
|
+
isDisabled: !canSubmit
|
|
862
898
|
}), showToast && /*#__PURE__*/React.createElement(Toast, {
|
|
863
899
|
error: showToast.key === "error",
|
|
864
900
|
label: t(showToast.key === "success" ? `ES_FSM_REGISTRY_${showToast.action}_SUCCESS` : showToast.action),
|