@djb25/digit-ui-module-wt 1.0.47 → 1.0.48
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 +216 -137
- package/dist/index.modern.js.map +1 -1
- package/package.json +1 -1
package/dist/index.modern.js
CHANGED
|
@@ -699,12 +699,14 @@ const fixedPointPayload = data => {
|
|
|
699
699
|
};
|
|
700
700
|
};
|
|
701
701
|
const emergencyWaterTankerPayload = data => {
|
|
702
|
-
var _data$owner29, _data$owner30, _ref2, _data$requestDetails12, _data$requestDetails13, _data$requestDetails14, _data$requestDetails15, _data$requestDetails16, _data$requestDetails17, _data$requestDetails18, _data$requestDetails19, _data$requestDetails20, _data$requestDetails21, _data$requestDetails22, _data$requestDetails23, _data$requestDetails24, _data$requestDetails25, _data$requestDetails26, _data$requestDetails27, _data$requestDetails28, _data$requestDetails29, _data$address82, _data$dispatchDetails, _data$dispatchDetails2, _data$owner31, _data$owner31$vendor, _data$dispatchDetails3, _data$dispatchDetails4, _data$owner32, _data$owner32$vehicle, _data$dispatchDetails5, _data$dispatchDetails6, _data$owner33, _data$owner33$driver, _data$dispatchDetails7, _data$dispatchDetails8, _data$owner34, _data$owner34$filling, _data$dispatchDetails9, _data$dispatchDetails0, _data$owner35, _data$owner35$vehicle, _data$dispatchDetails1, _data$dispatchDetails10, _data$owner36, _data$owner36$vehicle, _data$owner37, _data$owner38, _data$owner39, _data$owner40, _data$owner41, _data$owner42, _data$address83, _data$address84, _data$address84$addre, _data$address85, _data$address86, _data$address87, _data$address87$city, _data$address87$city$, _data$address88, _data$address88$city, _data$address89, _data$address90, _data$address90$city, _data$address90$city$, _data$address91, _data$address92, _data$address93, _data$address94, _data$address94$local, _data$address95, _data$address95$local, _data$address96, _data$address97, _data$address97$local, _data$address98, _data$address99, _data$address100, _data$address101, _data$address102, _data$address103, _data$address104, _data$address105, _data$address106, _data$address107, _data$address108, _data$requestDetails30;
|
|
702
|
+
var _data$owner29, _data$waterTankerBook, _data$waterTankerBook2, _data$owner30, _ref2, _data$requestDetails12, _data$requestDetails13, _data$requestDetails14, _data$requestDetails15, _data$requestDetails16, _data$requestDetails17, _data$requestDetails18, _data$requestDetails19, _data$requestDetails20, _data$requestDetails21, _data$requestDetails22, _data$requestDetails23, _data$requestDetails24, _data$requestDetails25, _data$requestDetails26, _data$requestDetails27, _data$requestDetails28, _data$requestDetails29, _data$address82, _data$dispatchDetails, _data$dispatchDetails2, _data$owner31, _data$owner31$vendor, _data$dispatchDetails3, _data$dispatchDetails4, _data$owner32, _data$owner32$vehicle, _data$dispatchDetails5, _data$dispatchDetails6, _data$owner33, _data$owner33$driver, _data$dispatchDetails7, _data$dispatchDetails8, _data$owner34, _data$owner34$filling, _data$dispatchDetails9, _data$dispatchDetails0, _data$owner35, _data$owner35$vehicle, _data$dispatchDetails1, _data$dispatchDetails10, _data$owner36, _data$owner36$vehicle, _data$owner37, _data$owner38, _data$owner39, _data$owner40, _data$owner41, _data$owner42, _data$address83, _data$address84, _data$address84$addre, _data$address85, _data$address86, _data$address87, _data$address87$city, _data$address87$city$, _data$address88, _data$address88$city, _data$address89, _data$address90, _data$address90$city, _data$address90$city$, _data$address91, _data$address92, _data$address93, _data$address94, _data$address94$local, _data$address95, _data$address95$local, _data$address96, _data$address97, _data$address97$local, _data$address98, _data$address99, _data$address100, _data$address101, _data$address102, _data$address103, _data$address104, _data$address105, _data$address106, _data$address107, _data$address108, _data$requestDetails30;
|
|
703
703
|
const fixedPoint = data === null || data === void 0 ? void 0 : (_data$owner29 = data.owner) === null || _data$owner29 === void 0 ? void 0 : _data$owner29.fixedPoint;
|
|
704
704
|
const applicantDetailFromFP = (fixedPoint === null || fixedPoint === void 0 ? void 0 : fixedPoint.applicantDetail) || {};
|
|
705
705
|
const addressFromFP = (fixedPoint === null || fixedPoint === void 0 ? void 0 : fixedPoint.address) || {};
|
|
706
706
|
const formdata = {
|
|
707
707
|
waterTankerBookingDetail: {
|
|
708
|
+
id: (data === null || data === void 0 ? void 0 : data.id) || (data === null || data === void 0 ? void 0 : (_data$waterTankerBook = data.waterTankerBookingDetail) === null || _data$waterTankerBook === void 0 ? void 0 : _data$waterTankerBook.id) || "",
|
|
709
|
+
bookingNo: (data === null || data === void 0 ? void 0 : data.bookingNo) || (data === null || data === void 0 ? void 0 : (_data$waterTankerBook2 = data.waterTankerBookingDetail) === null || _data$waterTankerBook2 === void 0 ? void 0 : _data$waterTankerBook2.bookingNo) || null,
|
|
708
710
|
applicantId: (applicantDetailFromFP === null || applicantDetailFromFP === void 0 ? void 0 : applicantDetailFromFP.applicantId) || (data === null || data === void 0 ? void 0 : (_data$owner30 = data.owner) === null || _data$owner30 === void 0 ? void 0 : _data$owner30.applicantId) || "",
|
|
709
711
|
tenantId: data === null || data === void 0 ? void 0 : data.tenantId,
|
|
710
712
|
tankerType: (_ref2 = (data === null || data === void 0 ? void 0 : (_data$requestDetails12 = data.requestDetails) === null || _data$requestDetails12 === void 0 ? void 0 : (_data$requestDetails13 = _data$requestDetails12.tankerType) === null || _data$requestDetails13 === void 0 ? void 0 : _data$requestDetails13.code) || (data === null || data === void 0 ? void 0 : (_data$requestDetails14 = data.requestDetails) === null || _data$requestDetails14 === void 0 ? void 0 : _data$requestDetails14.tankerType) || "") === null || _ref2 === void 0 ? void 0 : _ref2.toUpperCase(),
|
|
@@ -3714,25 +3716,25 @@ const AddTripModal = ({
|
|
|
3714
3716
|
onSubmit,
|
|
3715
3717
|
initialValues
|
|
3716
3718
|
}) => {
|
|
3717
|
-
var _formData$day;
|
|
3718
3719
|
const now = new Date();
|
|
3719
3720
|
const currentTime = `${String(now.getHours()).padStart(2, "0")}:${String(now.getMinutes()).padStart(2, "0")}`;
|
|
3720
3721
|
const defaultValues = initialValues ? {
|
|
3721
3722
|
...initialValues,
|
|
3722
|
-
arrivalTimeFpl: initialValues.arrivalTimeFpl || currentTime,
|
|
3723
|
-
departureTimeFpl: initialValues.departureTimeFpl || currentTime,
|
|
3724
|
-
arrivalFixedPoint: initialValues.arrivalFixedPoint || currentTime,
|
|
3725
|
-
departureFixedPoint: initialValues.departureFixedPoint || currentTime,
|
|
3726
|
-
returnFpl: initialValues.returnFpl || currentTime,
|
|
3727
|
-
frequencyNo: initialValues.frequencyNo,
|
|
3728
|
-
vehicleId: initialValues.vehicleId,
|
|
3729
|
-
fixedPointCode: initialValues.fixedPointCode,
|
|
3723
|
+
arrivalTimeFpl: initialValues.arrivalTimeFpl || initialValues.arrival_time_to_fpl || currentTime,
|
|
3724
|
+
departureTimeFpl: initialValues.departureTimeFpl || initialValues.departure_time_from_fpl || currentTime,
|
|
3725
|
+
arrivalFixedPoint: initialValues.arrivalFixedPoint || initialValues.arrival_time_delivery_point || currentTime,
|
|
3726
|
+
departureFixedPoint: initialValues.departureFixedPoint || initialValues.departure_time_delivery_point || currentTime,
|
|
3727
|
+
returnFpl: initialValues.returnFpl || initialValues.time_of_arriving_back_fpl_after_delivery || currentTime,
|
|
3728
|
+
frequencyNo: initialValues.frequencyNo || initialValues.trip_no || 1,
|
|
3729
|
+
vehicleId: initialValues.vehicleId || initialValues.vehicle_id || "",
|
|
3730
|
+
fixedPointCode: initialValues.fixedPointCode || initialValues.fixed_point_code || "",
|
|
3731
|
+
fillingPointCode: initialValues.fillingPointCode || initialValues.fillingPointId || "",
|
|
3730
3732
|
day: initialValues.day || [],
|
|
3731
|
-
volume: initialValues.volume || "",
|
|
3732
|
-
active: initialValues.active || null,
|
|
3733
|
+
volume: initialValues.volume || initialValues.volume_water_tobe_delivery || "",
|
|
3733
3734
|
remarks: initialValues.remarks || ""
|
|
3734
3735
|
} : {
|
|
3735
3736
|
fixedPointCode: "",
|
|
3737
|
+
fillingPointCode: "",
|
|
3736
3738
|
day: [],
|
|
3737
3739
|
arrivalTimeFpl: currentTime,
|
|
3738
3740
|
departureTimeFpl: currentTime,
|
|
@@ -3740,7 +3742,6 @@ const AddTripModal = ({
|
|
|
3740
3742
|
departureFixedPoint: currentTime,
|
|
3741
3743
|
returnFpl: currentTime,
|
|
3742
3744
|
volume: "",
|
|
3743
|
-
active: null,
|
|
3744
3745
|
remarks: "",
|
|
3745
3746
|
frequencyNo: 1
|
|
3746
3747
|
};
|
|
@@ -3751,33 +3752,69 @@ const AddTripModal = ({
|
|
|
3751
3752
|
formState: {
|
|
3752
3753
|
errors
|
|
3753
3754
|
},
|
|
3754
|
-
watch
|
|
3755
|
-
setValue
|
|
3755
|
+
watch
|
|
3756
3756
|
} = useForm({
|
|
3757
3757
|
defaultValues
|
|
3758
3758
|
});
|
|
3759
3759
|
const tenantId = Digit.ULBService.getCurrentTenantId();
|
|
3760
|
+
const [searchQuery, setSearchQuery] = useState("");
|
|
3761
|
+
const [debouncedSearchQuery, setDebouncedSearchQuery] = useState("");
|
|
3762
|
+
useEffect(() => {
|
|
3763
|
+
const handler = setTimeout(() => {
|
|
3764
|
+
setDebouncedSearchQuery(searchQuery);
|
|
3765
|
+
}, 500);
|
|
3766
|
+
return () => clearTimeout(handler);
|
|
3767
|
+
}, [searchQuery]);
|
|
3768
|
+
const handleSearch = useCallback(val => {
|
|
3769
|
+
setSearchQuery(val);
|
|
3770
|
+
}, []);
|
|
3760
3771
|
const {
|
|
3761
3772
|
isLoading: isFixedPointLoading,
|
|
3762
3773
|
data: fixedPointsData
|
|
3763
3774
|
} = Digit.Hooks.wt.useFixedPointSearchAPI({
|
|
3775
|
+
tenantId,
|
|
3776
|
+
filters: {
|
|
3777
|
+
limit: 1000,
|
|
3778
|
+
...(debouncedSearchQuery ? {
|
|
3779
|
+
name: debouncedSearchQuery
|
|
3780
|
+
} : {})
|
|
3781
|
+
}
|
|
3782
|
+
}, {
|
|
3783
|
+
keepPreviousData: true
|
|
3784
|
+
});
|
|
3785
|
+
const {
|
|
3786
|
+
isLoading: isFillingPointLoading,
|
|
3787
|
+
data: fillingPointsData
|
|
3788
|
+
} = Digit.Hooks.wt.useFillPointSearch({
|
|
3764
3789
|
tenantId,
|
|
3765
3790
|
filters: {
|
|
3766
3791
|
limit: 1000
|
|
3767
3792
|
}
|
|
3768
3793
|
});
|
|
3769
3794
|
const fixedPoints = (fixedPointsData === null || fixedPointsData === void 0 ? void 0 : fixedPointsData.waterTankerBookingDetail) || [];
|
|
3795
|
+
const fillingPoints = (fillingPointsData === null || fillingPointsData === void 0 ? void 0 : fillingPointsData.fillingPoints) || [];
|
|
3770
3796
|
const fixedPointOptions = fixedPoints.map(fp => {
|
|
3771
|
-
var _fp$applicantDetail, _fp$applicantDetail2, _fp$
|
|
3797
|
+
var _fp$applicantDetail, _fp$applicantDetail2, _fp$applicantDetail3, _fp$address, _fp$applicantDetail4, _fp$address2, _fp$applicantDetail5, _fp$applicantDetail6, _fp$applicantDetail7, _fp$address3, _fp$address4, _fp$address5, _fp$address6;
|
|
3798
|
+
const name = (fp === null || fp === void 0 ? void 0 : (_fp$applicantDetail = fp.applicantDetail) === null || _fp$applicantDetail === void 0 ? void 0 : _fp$applicantDetail.name) || "NA";
|
|
3799
|
+
const fixedPointId = (fp === null || fp === void 0 ? void 0 : (_fp$applicantDetail2 = fp.applicantDetail) === null || _fp$applicantDetail2 === void 0 ? void 0 : _fp$applicantDetail2.fixedPointId) || (fp === null || fp === void 0 ? void 0 : fp.fixedPointCode) || "";
|
|
3800
|
+
const displayName = fixedPointId ? `${name} (${fixedPointId})` : name;
|
|
3772
3801
|
return {
|
|
3773
|
-
name:
|
|
3774
|
-
mobileNumber: (fp === null || fp === void 0 ? void 0 : (_fp$
|
|
3802
|
+
name: displayName,
|
|
3803
|
+
mobileNumber: (fp === null || fp === void 0 ? void 0 : (_fp$applicantDetail3 = fp.applicantDetail) === null || _fp$applicantDetail3 === void 0 ? void 0 : _fp$applicantDetail3.mobileNumber) || "NA",
|
|
3775
3804
|
locality: (fp === null || fp === void 0 ? void 0 : (_fp$address = fp.address) === null || _fp$address === void 0 ? void 0 : _fp$address.locality) || "NA",
|
|
3776
|
-
displayLabel: `${
|
|
3777
|
-
value:
|
|
3805
|
+
displayLabel: `${displayName} | ${(fp === null || fp === void 0 ? void 0 : (_fp$applicantDetail4 = fp.applicantDetail) === null || _fp$applicantDetail4 === void 0 ? void 0 : _fp$applicantDetail4.mobileNumber) || "NA"} | ${(fp === null || fp === void 0 ? void 0 : (_fp$address2 = fp.address) === null || _fp$address2 === void 0 ? void 0 : _fp$address2.locality) || "NA"}`,
|
|
3806
|
+
value: (fp === null || fp === void 0 ? void 0 : (_fp$applicantDetail5 = fp.applicantDetail) === null || _fp$applicantDetail5 === void 0 ? void 0 : _fp$applicantDetail5.applicantId) || (fp === null || fp === void 0 ? void 0 : fp.id) || (fp === null || fp === void 0 ? void 0 : fp.bookingId),
|
|
3807
|
+
code: fp.fixedPointCode || (fp === null || fp === void 0 ? void 0 : (_fp$applicantDetail6 = fp.applicantDetail) === null || _fp$applicantDetail6 === void 0 ? void 0 : _fp$applicantDetail6.fixedPointId) || "",
|
|
3808
|
+
id: (fp === null || fp === void 0 ? void 0 : (_fp$applicantDetail7 = fp.applicantDetail) === null || _fp$applicantDetail7 === void 0 ? void 0 : _fp$applicantDetail7.fixedPointId) || "",
|
|
3778
3809
|
fullAddress: [(fp === null || fp === void 0 ? void 0 : (_fp$address3 = fp.address) === null || _fp$address3 === void 0 ? void 0 : _fp$address3.houseNo) && `${t("WT_HOUSE_NO")} = ${fp.address.houseNo}`, (fp === null || fp === void 0 ? void 0 : (_fp$address4 = fp.address) === null || _fp$address4 === void 0 ? void 0 : _fp$address4.streetName) && `${t("WT_STREET_NAME")} = ${fp.address.streetName}`, (fp === null || fp === void 0 ? void 0 : (_fp$address5 = fp.address) === null || _fp$address5 === void 0 ? void 0 : _fp$address5.landmark) && `${t("WT_LANDMARK")} = ${fp.address.landmark}`, (fp === null || fp === void 0 ? void 0 : (_fp$address6 = fp.address) === null || _fp$address6 === void 0 ? void 0 : _fp$address6.locality) && `${t("WT_LOCALITY")} = ${fp.address.locality}`].filter(Boolean).join(", ")
|
|
3779
3810
|
};
|
|
3780
3811
|
});
|
|
3812
|
+
const fillingPointOptions = fillingPoints.map(fp => ({
|
|
3813
|
+
displayLabel: (fp === null || fp === void 0 ? void 0 : fp.fillingPointName) || "NA",
|
|
3814
|
+
value: fp === null || fp === void 0 ? void 0 : fp.id,
|
|
3815
|
+
eeName: (fp === null || fp === void 0 ? void 0 : fp.eeName) || "NA",
|
|
3816
|
+
aeName: (fp === null || fp === void 0 ? void 0 : fp.aeName) || "NA"
|
|
3817
|
+
}));
|
|
3781
3818
|
const selectedFixedPointCode = watch("fixedPointCode");
|
|
3782
3819
|
const selectedFixedPoint = fixedPointOptions.find(opt => opt.value === selectedFixedPointCode);
|
|
3783
3820
|
const dayOptions = [{
|
|
@@ -3802,20 +3839,15 @@ const AddTripModal = ({
|
|
|
3802
3839
|
label: t("SUNDAY"),
|
|
3803
3840
|
value: "SUNDAY"
|
|
3804
3841
|
}];
|
|
3805
|
-
const activeOptions = [{
|
|
3806
|
-
label: t("YES"),
|
|
3807
|
-
value: "Yes"
|
|
3808
|
-
}, {
|
|
3809
|
-
label: t("NO"),
|
|
3810
|
-
value: "No"
|
|
3811
|
-
}];
|
|
3812
3842
|
const formData = watch();
|
|
3813
|
-
const isFormValid = (formData === null || formData === void 0 ? void 0 : formData.fixedPointCode) && (formData === null || formData === void 0 ? void 0 : formData.day) && Array.isArray(formData === null || formData === void 0 ? void 0 : formData.day) && (formData === null || formData === void 0 ? void 0 : (_formData$day = formData.day) === null || _formData$day === void 0 ? void 0 : _formData$day.length) > 0 && (formData === null || formData === void 0 ? void 0 : formData.arrivalTimeFpl) && (formData === null || formData === void 0 ? void 0 : formData.departureTimeFpl) && (formData === null || formData === void 0 ? void 0 : formData.arrivalFixedPoint) && (formData === null || formData === void 0 ? void 0 : formData.departureFixedPoint) && (formData === null || formData === void 0 ? void 0 : formData.returnFpl) && (formData === null || formData === void 0 ? void 0 : formData.volume) !== "" && (formData === null || formData === void 0 ? void 0 : formData.volume) !== undefined && (formData === null || formData === void 0 ? void 0 : formData.volume) !== null && (formData === null || formData === void 0 ? void 0 : formData.active);
|
|
3814
3843
|
const onFormSubmit = data => {
|
|
3815
|
-
|
|
3816
|
-
|
|
3817
|
-
...data
|
|
3818
|
-
|
|
3844
|
+
const selectedFixedPoint = fixedPointOptions.find(opt => opt.value === data.fixedPointCode);
|
|
3845
|
+
const enrichedData = {
|
|
3846
|
+
...data,
|
|
3847
|
+
fixedPointId: selectedFixedPoint ? selectedFixedPoint.id : (initialValues === null || initialValues === void 0 ? void 0 : initialValues.fixedPointId) || "",
|
|
3848
|
+
fixedPointCode: selectedFixedPoint ? selectedFixedPoint.code : (initialValues === null || initialValues === void 0 ? void 0 : initialValues.fixedPointCode) || ""
|
|
3849
|
+
};
|
|
3850
|
+
onSubmit(enrichedData);
|
|
3819
3851
|
};
|
|
3820
3852
|
return /*#__PURE__*/React.createElement("div", {
|
|
3821
3853
|
className: "custom-modal-overlay",
|
|
@@ -3832,61 +3864,117 @@ const AddTripModal = ({
|
|
|
3832
3864
|
zIndex: 200000
|
|
3833
3865
|
}
|
|
3834
3866
|
}, /*#__PURE__*/React.createElement("style", null, `
|
|
3867
|
+
|
|
3835
3868
|
.custom-modal-content {
|
|
3869
|
+
|
|
3836
3870
|
background-color: #fff;
|
|
3871
|
+
|
|
3837
3872
|
border-radius: 8px;
|
|
3873
|
+
|
|
3838
3874
|
width: 70%;
|
|
3875
|
+
|
|
3839
3876
|
max-width: 800px;
|
|
3877
|
+
|
|
3840
3878
|
max-height: 90vh;
|
|
3879
|
+
|
|
3841
3880
|
display: flex;
|
|
3881
|
+
|
|
3842
3882
|
flex-direction: column;
|
|
3883
|
+
|
|
3843
3884
|
box-shadow: 0 4px 12px rgba(0,0,0,0.15);
|
|
3885
|
+
|
|
3844
3886
|
position: relative;
|
|
3887
|
+
|
|
3845
3888
|
}
|
|
3889
|
+
|
|
3846
3890
|
.add-trip-form {
|
|
3891
|
+
|
|
3847
3892
|
display: grid;
|
|
3893
|
+
|
|
3848
3894
|
grid-template-columns: repeat(2, 1fr);
|
|
3895
|
+
|
|
3849
3896
|
gap: 20px;
|
|
3897
|
+
|
|
3850
3898
|
}
|
|
3899
|
+
|
|
3851
3900
|
@media (max-width: 768px) {
|
|
3901
|
+
|
|
3852
3902
|
.custom-modal-content {
|
|
3903
|
+
|
|
3853
3904
|
width: 90%;
|
|
3905
|
+
|
|
3854
3906
|
max-height: 85vh;
|
|
3907
|
+
|
|
3855
3908
|
}
|
|
3909
|
+
|
|
3856
3910
|
.add-trip-form {
|
|
3911
|
+
|
|
3857
3912
|
grid-template-columns: 1fr;
|
|
3913
|
+
|
|
3858
3914
|
gap: 15px;
|
|
3915
|
+
|
|
3859
3916
|
}
|
|
3917
|
+
|
|
3860
3918
|
}
|
|
3919
|
+
|
|
3861
3920
|
@media (max-width: 480px) {
|
|
3921
|
+
|
|
3862
3922
|
.custom-modal-content {
|
|
3923
|
+
|
|
3863
3924
|
width: 95%;
|
|
3925
|
+
|
|
3864
3926
|
max-height: 95vh;
|
|
3927
|
+
|
|
3865
3928
|
}
|
|
3929
|
+
|
|
3866
3930
|
.custom-modal-body {
|
|
3931
|
+
|
|
3867
3932
|
padding: 15px !important;
|
|
3933
|
+
|
|
3868
3934
|
}
|
|
3935
|
+
|
|
3869
3936
|
.custom-modal-footer {
|
|
3937
|
+
|
|
3870
3938
|
padding: 12px 15px !important;
|
|
3939
|
+
|
|
3871
3940
|
flex-direction: row;
|
|
3941
|
+
|
|
3872
3942
|
justify-content: flex-end;
|
|
3943
|
+
|
|
3873
3944
|
}
|
|
3945
|
+
|
|
3874
3946
|
.custom-modal-header {
|
|
3947
|
+
|
|
3875
3948
|
padding: 12px 15px !important;
|
|
3949
|
+
|
|
3876
3950
|
}
|
|
3951
|
+
|
|
3877
3952
|
.custom-modal-header h1 {
|
|
3953
|
+
|
|
3878
3954
|
font-size: 18px !important;
|
|
3955
|
+
|
|
3879
3956
|
}
|
|
3957
|
+
|
|
3880
3958
|
}
|
|
3959
|
+
|
|
3881
3960
|
@media (max-width: 320px) {
|
|
3961
|
+
|
|
3882
3962
|
.custom-modal-footer {
|
|
3963
|
+
|
|
3883
3964
|
flex-direction: column-reverse;
|
|
3965
|
+
|
|
3884
3966
|
align-items: stretch;
|
|
3967
|
+
|
|
3885
3968
|
}
|
|
3969
|
+
|
|
3886
3970
|
.custom-modal-footer button {
|
|
3971
|
+
|
|
3887
3972
|
width: 100%;
|
|
3973
|
+
|
|
3888
3974
|
}
|
|
3975
|
+
|
|
3889
3976
|
}
|
|
3977
|
+
|
|
3890
3978
|
`), /*#__PURE__*/React.createElement("div", {
|
|
3891
3979
|
className: "custom-modal-content"
|
|
3892
3980
|
}, /*#__PURE__*/React.createElement("div", {
|
|
@@ -3932,7 +4020,7 @@ const AddTripModal = ({
|
|
|
3932
4020
|
}, t("WT_FIXED_POINT_CODE")), isFixedPointLoading ? /*#__PURE__*/React.createElement(Loader, null) : /*#__PURE__*/React.createElement(Controller, {
|
|
3933
4021
|
control: control,
|
|
3934
4022
|
name: "fixedPointCode",
|
|
3935
|
-
defaultValue: defaultValues.fixedPointCode,
|
|
4023
|
+
defaultValue: defaultValues.fixedPointId || defaultValues.fixedPointCode,
|
|
3936
4024
|
render: props => /*#__PURE__*/React.createElement(CustomNameDropdown, {
|
|
3937
4025
|
option: fixedPointOptions,
|
|
3938
4026
|
optionKey: "displayLabel",
|
|
@@ -3943,7 +4031,8 @@ const AddTripModal = ({
|
|
|
3943
4031
|
name: "WT_NAME",
|
|
3944
4032
|
mobileNumber: "WT_MOBILE_NUMBER",
|
|
3945
4033
|
locality: "WT_LOCALITY"
|
|
3946
|
-
}
|
|
4034
|
+
},
|
|
4035
|
+
onSearch: handleSearch
|
|
3947
4036
|
})
|
|
3948
4037
|
}), selectedFixedPoint && /*#__PURE__*/React.createElement("div", {
|
|
3949
4038
|
style: {
|
|
@@ -3962,6 +4051,24 @@ const AddTripModal = ({
|
|
|
3962
4051
|
marginBottom: "8px",
|
|
3963
4052
|
fontWeight: "500"
|
|
3964
4053
|
}
|
|
4054
|
+
}, t("WT_FILLING_POINT")), isFillingPointLoading ? /*#__PURE__*/React.createElement(Loader, null) : /*#__PURE__*/React.createElement(Controller, {
|
|
4055
|
+
control: control,
|
|
4056
|
+
name: "fillingPointCode",
|
|
4057
|
+
defaultValue: defaultValues.fillingPointCode,
|
|
4058
|
+
render: props => /*#__PURE__*/React.createElement(CustomNameDropdown, {
|
|
4059
|
+
option: fillingPointOptions,
|
|
4060
|
+
optionKey: "displayLabel",
|
|
4061
|
+
selected: fillingPointOptions.find(opt => opt.value === props.value),
|
|
4062
|
+
select: val => props.onChange(val.value),
|
|
4063
|
+
t: t
|
|
4064
|
+
})
|
|
4065
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
4066
|
+
className: "field-group"
|
|
4067
|
+
}, /*#__PURE__*/React.createElement(CardLabel, {
|
|
4068
|
+
style: {
|
|
4069
|
+
marginBottom: "8px",
|
|
4070
|
+
fontWeight: "500"
|
|
4071
|
+
}
|
|
3965
4072
|
}, t("WT_DAY")), /*#__PURE__*/React.createElement(Controller, {
|
|
3966
4073
|
control: control,
|
|
3967
4074
|
name: "day",
|
|
@@ -3975,7 +4082,14 @@ const AddTripModal = ({
|
|
|
3975
4082
|
},
|
|
3976
4083
|
t: t,
|
|
3977
4084
|
defaultLabel: t("WT_SELECT_DAYS"),
|
|
3978
|
-
defaultUnit: t("WT_DAYS")
|
|
4085
|
+
defaultUnit: t("WT_DAYS"),
|
|
4086
|
+
ServerStyle: {
|
|
4087
|
+
backgroundColor: "#fff",
|
|
4088
|
+
zIndex: 1000,
|
|
4089
|
+
border: "1px solid #ccc",
|
|
4090
|
+
boxShadow: "0px 4px 6px rgba(0,0,0,0.1)",
|
|
4091
|
+
borderRadius: "4px"
|
|
4092
|
+
}
|
|
3979
4093
|
})
|
|
3980
4094
|
})), /*#__PURE__*/React.createElement("div", {
|
|
3981
4095
|
className: "field-group"
|
|
@@ -4078,23 +4192,6 @@ const AddTripModal = ({
|
|
|
4078
4192
|
onChange: e => props.onChange(e.target.value),
|
|
4079
4193
|
onBlur: props.onBlur
|
|
4080
4194
|
})
|
|
4081
|
-
})), /*#__PURE__*/React.createElement("div", {
|
|
4082
|
-
className: "field-group"
|
|
4083
|
-
}, /*#__PURE__*/React.createElement(CardLabel, {
|
|
4084
|
-
style: {
|
|
4085
|
-
marginBottom: "8px",
|
|
4086
|
-
fontWeight: "500"
|
|
4087
|
-
}
|
|
4088
|
-
}, t("WT_ACTIVE")), /*#__PURE__*/React.createElement(Controller, {
|
|
4089
|
-
control: control,
|
|
4090
|
-
name: "active",
|
|
4091
|
-
render: props => /*#__PURE__*/React.createElement(Dropdown, {
|
|
4092
|
-
option: activeOptions,
|
|
4093
|
-
optionKey: "label",
|
|
4094
|
-
selected: props.value,
|
|
4095
|
-
select: props.onChange,
|
|
4096
|
-
t: t
|
|
4097
|
-
})
|
|
4098
4195
|
})), /*#__PURE__*/React.createElement("div", {
|
|
4099
4196
|
className: "field-group remarks-field-group",
|
|
4100
4197
|
style: {
|
|
@@ -4135,16 +4232,14 @@ const AddTripModal = ({
|
|
|
4135
4232
|
}
|
|
4136
4233
|
}, t("CS_COMMON_CANCEL")), /*#__PURE__*/React.createElement("button", {
|
|
4137
4234
|
className: "button-save",
|
|
4138
|
-
disabled: !isFormValid,
|
|
4139
4235
|
onClick: handleSubmit(onFormSubmit),
|
|
4140
4236
|
style: {
|
|
4141
4237
|
padding: "8px 20px",
|
|
4142
|
-
background:
|
|
4143
|
-
color: "#
|
|
4238
|
+
background: "#1D4E7F",
|
|
4239
|
+
color: "#ffffffff",
|
|
4144
4240
|
border: "none",
|
|
4145
4241
|
borderRadius: "4px",
|
|
4146
|
-
cursor:
|
|
4147
|
-
opacity: !isFormValid ? 0.7 : 1
|
|
4242
|
+
cursor: "pointer"
|
|
4148
4243
|
}
|
|
4149
4244
|
}, initialValues ? t("WT_UPDATE") : t("CS_COMMON_SAVE")))));
|
|
4150
4245
|
};
|
|
@@ -4260,6 +4355,7 @@ const FixedPointScheduleManagement = ({
|
|
|
4260
4355
|
scheduleId: item.systemAssignedScheduleId,
|
|
4261
4356
|
fixedPointName: item.fixedPointName,
|
|
4262
4357
|
fixedPoint: item.fixedPointCode || item.fixedPointId,
|
|
4358
|
+
fixedPointId: item.fixedPointId || item.id || null,
|
|
4263
4359
|
day: item.day,
|
|
4264
4360
|
freq: item.tripNo,
|
|
4265
4361
|
arrToFpl: item.arrivalTimeToFpl,
|
|
@@ -4602,7 +4698,24 @@ const FixedPointScheduleManagement = ({
|
|
|
4602
4698
|
color: selectedDay === dayItem ? "#fff" : "#333",
|
|
4603
4699
|
cursor: "pointer"
|
|
4604
4700
|
}
|
|
4605
|
-
}, t(dayItem.toUpperCase())))), /*#__PURE__*/React.createElement("
|
|
4701
|
+
}, t(dayItem.toUpperCase())))), /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement("button", {
|
|
4702
|
+
onClick: () => {
|
|
4703
|
+
setEditingRowIndex(null);
|
|
4704
|
+
setShowModal(true);
|
|
4705
|
+
},
|
|
4706
|
+
style: {
|
|
4707
|
+
background: "#1E8E3E",
|
|
4708
|
+
color: "#fff",
|
|
4709
|
+
border: "none",
|
|
4710
|
+
padding: "10px 20px",
|
|
4711
|
+
borderRadius: "4px",
|
|
4712
|
+
cursor: "pointer",
|
|
4713
|
+
display: "flex",
|
|
4714
|
+
alignItems: "center",
|
|
4715
|
+
gap: "5px",
|
|
4716
|
+
marginBottom: "10px"
|
|
4717
|
+
}
|
|
4718
|
+
}, /*#__PURE__*/React.createElement("span", null, "+"), " ", t("WT_ADD_TRIP"))), /*#__PURE__*/React.createElement("div", {
|
|
4606
4719
|
style: {
|
|
4607
4720
|
width: "100%",
|
|
4608
4721
|
overflowX: "auto"
|
|
@@ -4632,24 +4745,7 @@ const FixedPointScheduleManagement = ({
|
|
|
4632
4745
|
getCSVExportData: getCSVExportData,
|
|
4633
4746
|
csvExportColumns: csvExportColumns,
|
|
4634
4747
|
csvExportFileName: "wt-fixed-point-schedule"
|
|
4635
|
-
})),
|
|
4636
|
-
onClick: () => {
|
|
4637
|
-
setEditingRowIndex(null);
|
|
4638
|
-
setShowModal(true);
|
|
4639
|
-
},
|
|
4640
|
-
style: {
|
|
4641
|
-
background: "#1E8E3E",
|
|
4642
|
-
color: "#fff",
|
|
4643
|
-
border: "none",
|
|
4644
|
-
padding: "10px 20px",
|
|
4645
|
-
borderRadius: "4px",
|
|
4646
|
-
cursor: "pointer",
|
|
4647
|
-
display: "flex",
|
|
4648
|
-
alignItems: "center",
|
|
4649
|
-
gap: "5px",
|
|
4650
|
-
marginBottom: "10px"
|
|
4651
|
-
}
|
|
4652
|
-
}, /*#__PURE__*/React.createElement("span", null, "+"), " ", t("WT_ADD_TRIP")))), showModal && /*#__PURE__*/React.createElement(AddTripModal, {
|
|
4748
|
+
}))), showModal && /*#__PURE__*/React.createElement(AddTripModal, {
|
|
4653
4749
|
t: t,
|
|
4654
4750
|
closeModal: () => {
|
|
4655
4751
|
setShowModal(false);
|
|
@@ -4658,6 +4754,7 @@ const FixedPointScheduleManagement = ({
|
|
|
4658
4754
|
initialValues: editingRowIndex !== null ? {
|
|
4659
4755
|
scheduleId: data[editingRowIndex].scheduleId,
|
|
4660
4756
|
fixedPointCode: data[editingRowIndex].fixedPoint,
|
|
4757
|
+
fixedPointId: data[editingRowIndex].fixedPointId,
|
|
4661
4758
|
day: [{
|
|
4662
4759
|
label: t(data[editingRowIndex].day),
|
|
4663
4760
|
value: data[editingRowIndex].day
|
|
@@ -4676,86 +4773,68 @@ const FixedPointScheduleManagement = ({
|
|
|
4676
4773
|
}
|
|
4677
4774
|
} : null,
|
|
4678
4775
|
onSubmit: formData => {
|
|
4679
|
-
var _formData$active,
|
|
4776
|
+
var _formData$active, _scheduleData$fixedPo, _scheduleData$fixedPo2;
|
|
4777
|
+
console.log(formData, 'dsdsdsdsdsdsds');
|
|
4680
4778
|
const formDataDay = formData === null || formData === void 0 ? void 0 : formData.day;
|
|
4681
4779
|
let daysArr = [];
|
|
4682
4780
|
if (Array.isArray(formDataDay)) {
|
|
4683
|
-
daysArr = formDataDay.map(d => typeof d === "string" ? d : (d === null || d === void 0 ? void 0 : d.value) ||
|
|
4684
|
-
if (daysArr.length === 0 && formDataDay.some(d => {
|
|
4685
|
-
const val = typeof d === "string" ? d : (d === null || d === void 0 ? void 0 : d.value) || (Array.isArray(d) ? d[1] : d);
|
|
4686
|
-
return val === "WT_SELECT_ALL";
|
|
4687
|
-
})) {
|
|
4688
|
-
daysArr = ["MONDAY", "TUESDAY", "WEDNESDAY", "THURSDAY", "FRIDAY", "SATURDAY", "SUNDAY"];
|
|
4689
|
-
}
|
|
4781
|
+
daysArr = formDataDay.map(d => typeof d === "string" ? d : (d === null || d === void 0 ? void 0 : d.value) || d).filter(d => d && d !== "WT_SELECT_ALL");
|
|
4690
4782
|
} else if (formDataDay) {
|
|
4691
|
-
const
|
|
4692
|
-
if (
|
|
4783
|
+
const val = (formDataDay === null || formDataDay === void 0 ? void 0 : formDataDay.value) || formDataDay;
|
|
4784
|
+
if (val && val !== "WT_SELECT_ALL") daysArr = [val];
|
|
4693
4785
|
}
|
|
4786
|
+
const existingData = editingRowIndex !== null ? data[editingRowIndex] : {};
|
|
4787
|
+
const isFormActive = ((_formData$active = formData.active) === null || _formData$active === void 0 ? void 0 : _formData$active.value) === "Yes" || formData.active === "Yes" || formData.active === true;
|
|
4788
|
+
const isExistingActive = (existingData === null || existingData === void 0 ? void 0 : existingData.active) === "Y";
|
|
4789
|
+
const finalActiveStatus = formData.active !== undefined ? isFormActive : editingRowIndex !== null ? isExistingActive : true;
|
|
4694
4790
|
const fixedPointDetails = {
|
|
4695
|
-
|
|
4696
|
-
|
|
4697
|
-
|
|
4698
|
-
day: daysArr.map(d =>
|
|
4699
|
-
|
|
4700
|
-
return (d === null || d === void 0 ? void 0 : (_d$toUpperCase = d.toUpperCase) === null || _d$toUpperCase === void 0 ? void 0 : _d$toUpperCase.call(d)) || d;
|
|
4701
|
-
}),
|
|
4702
|
-
trip_no: Number(formData.frequencyNo) || Number(formData.tripNo) || 1,
|
|
4791
|
+
system_assigned_schedule_id: formData.scheduleId || existingData.scheduleId || null,
|
|
4792
|
+
fixed_point_code: formData.fixedPointId || formData.fixedPointCode || "",
|
|
4793
|
+
fillingPointId: formData.fillingPointCode || null,
|
|
4794
|
+
day: daysArr.map(d => d.toUpperCase()),
|
|
4795
|
+
trip_no: Number(formData.frequencyNo) || 1,
|
|
4703
4796
|
arrival_time_to_fpl: formData.arrivalTimeFpl,
|
|
4704
4797
|
departure_time_from_fpl: formData.departureTimeFpl,
|
|
4705
4798
|
arrival_time_delivery_point: formData.arrivalFixedPoint,
|
|
4706
4799
|
departure_time_delivery_point: formData.departureFixedPoint,
|
|
4707
4800
|
time_of_arriving_back_fpl_after_delivery: formData.returnFpl,
|
|
4708
|
-
volume_water_tobe_delivery: formData.volume
|
|
4709
|
-
active:
|
|
4710
|
-
is_enable:
|
|
4711
|
-
remarks: formData.remarks,
|
|
4712
|
-
vehicle_id: formData.vehicleId
|
|
4801
|
+
volume_water_tobe_delivery: formData.volume,
|
|
4802
|
+
active: finalActiveStatus,
|
|
4803
|
+
is_enable: finalActiveStatus,
|
|
4804
|
+
remarks: formData.remarks || "",
|
|
4805
|
+
vehicle_id: formData.vehicleId || existingData.vehicle || null,
|
|
4806
|
+
audit_details: (scheduleData === null || scheduleData === void 0 ? void 0 : (_scheduleData$fixedPo = scheduleData.fixedPointTimeTableDetails) === null || _scheduleData$fixedPo === void 0 ? void 0 : (_scheduleData$fixedPo2 = _scheduleData$fixedPo[editingRowIndex]) === null || _scheduleData$fixedPo2 === void 0 ? void 0 : _scheduleData$fixedPo2.auditDetails) || null
|
|
4713
4807
|
};
|
|
4808
|
+
if (!fixedPointDetails.system_assigned_schedule_id) delete fixedPointDetails.system_assigned_schedule_id;
|
|
4809
|
+
if (!fixedPointDetails.vehicle_id) delete fixedPointDetails.vehicle_id;
|
|
4810
|
+
if (!fixedPointDetails.audit_details) delete fixedPointDetails.audit_details;
|
|
4714
4811
|
const payload = editingRowIndex !== null ? {
|
|
4715
4812
|
fixedPointDetailsList: [fixedPointDetails]
|
|
4716
4813
|
} : {
|
|
4717
4814
|
fixedPointDetails
|
|
4718
4815
|
};
|
|
4816
|
+
const mutationOptions = {
|
|
4817
|
+
onError: error => {
|
|
4818
|
+
var _error$response, _error$response$data, _error$response$data$, _error$response$data$2;
|
|
4819
|
+
setToast({
|
|
4820
|
+
key: "error",
|
|
4821
|
+
label: (error === null || error === void 0 ? void 0 : (_error$response = error.response) === null || _error$response === void 0 ? void 0 : (_error$response$data = _error$response.data) === null || _error$response$data === void 0 ? void 0 : (_error$response$data$ = _error$response$data.Errors) === null || _error$response$data$ === void 0 ? void 0 : (_error$response$data$2 = _error$response$data$[0]) === null || _error$response$data$2 === void 0 ? void 0 : _error$response$data$2.message) || "Operation Failed"
|
|
4822
|
+
});
|
|
4823
|
+
setTimeout(closeToast, 5000);
|
|
4824
|
+
},
|
|
4825
|
+
onSuccess: () => {
|
|
4826
|
+
setToast({
|
|
4827
|
+
label: editingRowIndex !== null ? t("WT_SCHEDULE_UPDATE_SUCCESS") : t("WT_SCHEDULE_CREATE_SUCCESS")
|
|
4828
|
+
});
|
|
4829
|
+
setShowModal(false);
|
|
4830
|
+
setEditingRowIndex(null);
|
|
4831
|
+
queryClient.invalidateQueries(["FIXED_POINT_SCHEDULE_SEARCH", tenantId]);
|
|
4832
|
+
}
|
|
4833
|
+
};
|
|
4719
4834
|
if (editingRowIndex !== null) {
|
|
4720
|
-
updateSchedule(payload,
|
|
4721
|
-
onError: (error, variables) => {
|
|
4722
|
-
var _error$response, _error$response$data, _error$response$data$, _error$response$data$2;
|
|
4723
|
-
setToast({
|
|
4724
|
-
key: "error",
|
|
4725
|
-
label: (error === null || error === void 0 ? void 0 : (_error$response = error.response) === null || _error$response === void 0 ? void 0 : (_error$response$data = _error$response.data) === null || _error$response$data === void 0 ? void 0 : (_error$response$data$ = _error$response$data.Errors) === null || _error$response$data$ === void 0 ? void 0 : (_error$response$data$2 = _error$response$data$[0]) === null || _error$response$data$2 === void 0 ? void 0 : _error$response$data$2.message) || "ERROR_WHILE_UPDATING_SCHEDULE"
|
|
4726
|
-
});
|
|
4727
|
-
setTimeout(closeToast, 5000);
|
|
4728
|
-
},
|
|
4729
|
-
onSuccess: (data, variables) => {
|
|
4730
|
-
setToast({
|
|
4731
|
-
label: t("WT_SCHEDULE_UPDATE_SUCCESS")
|
|
4732
|
-
});
|
|
4733
|
-
setTimeout(closeToast, 5000);
|
|
4734
|
-
setShowModal(false);
|
|
4735
|
-
setEditingRowIndex(null);
|
|
4736
|
-
queryClient.invalidateQueries(["FIXED_POINT_SCHEDULE_SEARCH", tenantId]);
|
|
4737
|
-
}
|
|
4738
|
-
});
|
|
4835
|
+
updateSchedule(payload, mutationOptions);
|
|
4739
4836
|
} else {
|
|
4740
|
-
createSchedule(payload,
|
|
4741
|
-
onError: (error, variables) => {
|
|
4742
|
-
var _error$response2, _error$response2$data, _error$response2$data2, _error$response2$data3;
|
|
4743
|
-
setToast({
|
|
4744
|
-
key: "error",
|
|
4745
|
-
label: (error === null || error === void 0 ? void 0 : (_error$response2 = error.response) === null || _error$response2 === void 0 ? void 0 : (_error$response2$data = _error$response2.data) === null || _error$response2$data === void 0 ? void 0 : (_error$response2$data2 = _error$response2$data.Errors) === null || _error$response2$data2 === void 0 ? void 0 : (_error$response2$data3 = _error$response2$data2[0]) === null || _error$response2$data3 === void 0 ? void 0 : _error$response2$data3.message) || "ERROR_WHILE_CREATING_SCHEDULE"
|
|
4746
|
-
});
|
|
4747
|
-
setTimeout(closeToast, 5000);
|
|
4748
|
-
},
|
|
4749
|
-
onSuccess: (data, variables) => {
|
|
4750
|
-
setToast({
|
|
4751
|
-
label: t("WT_SCHEDULE_CREATE_SUCCESS")
|
|
4752
|
-
});
|
|
4753
|
-
setTimeout(closeToast, 5000);
|
|
4754
|
-
setShowModal(false);
|
|
4755
|
-
setEditingRowIndex(null);
|
|
4756
|
-
queryClient.invalidateQueries(["FIXED_POINT_SCHEDULE_SEARCH", tenantId]);
|
|
4757
|
-
}
|
|
4758
|
-
});
|
|
4837
|
+
createSchedule(payload, mutationOptions);
|
|
4759
4838
|
}
|
|
4760
4839
|
}
|
|
4761
4840
|
}), toast && /*#__PURE__*/React.createElement(Toast, {
|