@djb25/digit-ui-module-wt 1.0.17 → 1.0.18
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 +85 -64
- package/dist/index.modern.js.map +1 -1
- package/package.json +1 -1
package/dist/index.modern.js
CHANGED
|
@@ -3559,6 +3559,7 @@ const AddTripModal = ({
|
|
|
3559
3559
|
const FixedPointScheduleManagement = ({
|
|
3560
3560
|
...props
|
|
3561
3561
|
}) => {
|
|
3562
|
+
var _data$;
|
|
3562
3563
|
const {
|
|
3563
3564
|
t
|
|
3564
3565
|
} = useTranslation();
|
|
@@ -3587,12 +3588,50 @@ const FixedPointScheduleManagement = ({
|
|
|
3587
3588
|
value: "all"
|
|
3588
3589
|
});
|
|
3589
3590
|
const [editingRowIndex, setEditingRowIndex] = useState(null);
|
|
3590
|
-
const [
|
|
3591
|
+
const [pageOffset, setPageOffset] = useState(0);
|
|
3592
|
+
const [pageSize, setPageSize] = useState(10);
|
|
3593
|
+
const [filters, setFilters] = useState({
|
|
3594
|
+
limit: 10,
|
|
3595
|
+
offset: 0
|
|
3596
|
+
});
|
|
3591
3597
|
const {
|
|
3592
3598
|
isLoading,
|
|
3593
3599
|
data: scheduleData,
|
|
3594
3600
|
refetch: reSearch
|
|
3595
3601
|
} = Digit.Hooks.wt.useFixedPointScheduleSearch(tenantId, filters);
|
|
3602
|
+
const {
|
|
3603
|
+
data: fixedPointData,
|
|
3604
|
+
isLoading: isFpLoading
|
|
3605
|
+
} = Digit.Hooks.wt.useFixedPointSearchAPI({
|
|
3606
|
+
tenantId,
|
|
3607
|
+
filters: {
|
|
3608
|
+
offset: 0,
|
|
3609
|
+
limit: 100
|
|
3610
|
+
}
|
|
3611
|
+
});
|
|
3612
|
+
const {
|
|
3613
|
+
data: allSchedulesData
|
|
3614
|
+
} = Digit.Hooks.wt.useFixedPointScheduleSearch(tenantId, {
|
|
3615
|
+
limit: 1000,
|
|
3616
|
+
offset: 0
|
|
3617
|
+
});
|
|
3618
|
+
const fixedPoints = React.useMemo(() => {
|
|
3619
|
+
const fromFpApi = (fixedPointData === null || fixedPointData === void 0 ? void 0 : fixedPointData.fixedPointTimeTableDetails) || (fixedPointData === null || fixedPointData === void 0 ? void 0 : fixedPointData.waterTankerBookingDetail) || (fixedPointData === null || fixedPointData === void 0 ? void 0 : fixedPointData.fixedPoints) || [];
|
|
3620
|
+
const fromScheduleApi = (allSchedulesData === null || allSchedulesData === void 0 ? void 0 : allSchedulesData.fixedPointTimeTableDetails) || [];
|
|
3621
|
+
const combinedData = [...fromFpApi, ...fromScheduleApi];
|
|
3622
|
+
const points = combinedData.map(fp => {
|
|
3623
|
+
var _fp$applicantDetail;
|
|
3624
|
+
return {
|
|
3625
|
+
label: fp.fixedPointCode || fp.name || ((_fp$applicantDetail = fp.applicantDetail) === null || _fp$applicantDetail === void 0 ? void 0 : _fp$applicantDetail.name) || fp.bookingId,
|
|
3626
|
+
value: fp.fixedPointCode || fp.bookingId
|
|
3627
|
+
};
|
|
3628
|
+
}).filter(p => p.label && p.value);
|
|
3629
|
+
const uniquePoints = points.filter((v, i, a) => a.findIndex(t => t.value === v.value) === i);
|
|
3630
|
+
return [{
|
|
3631
|
+
label: t("WT_ALL_FIXED_POINTS") !== "WT_ALL_FIXED_POINTS" ? t("WT_ALL_FIXED_POINTS") : "All Fixed Points",
|
|
3632
|
+
value: "all"
|
|
3633
|
+
}, ...uniquePoints];
|
|
3634
|
+
}, [fixedPointData, allSchedulesData, t]);
|
|
3596
3635
|
const {
|
|
3597
3636
|
mutate: createSchedule
|
|
3598
3637
|
} = Digit.Hooks.wt.useCreateFixedPointSchedule(tenantId);
|
|
@@ -3648,20 +3687,42 @@ const FixedPointScheduleManagement = ({
|
|
|
3648
3687
|
returnToFpl: item.timeOfArrivingBackFplAfterDelivery,
|
|
3649
3688
|
volume: item.volumeWaterTobeDelivery,
|
|
3650
3689
|
vehicle: item.vehicleId,
|
|
3651
|
-
active: item.isEnable ? "Y" : "N"
|
|
3690
|
+
active: item.isEnable ? "Y" : "N",
|
|
3691
|
+
totalCount: item.totalCount
|
|
3652
3692
|
}));
|
|
3653
3693
|
setData(mappedData);
|
|
3654
3694
|
}
|
|
3655
3695
|
}, [scheduleData]);
|
|
3656
|
-
const
|
|
3696
|
+
const fetchNextPage = () => {
|
|
3697
|
+
setPageOffset(prevState => prevState + pageSize);
|
|
3698
|
+
};
|
|
3699
|
+
const fetchPrevPage = () => {
|
|
3700
|
+
setPageOffset(prevState => prevState - pageSize);
|
|
3701
|
+
};
|
|
3702
|
+
const handlePageSizeChange = e => {
|
|
3703
|
+
setPageSize(Number(e.target.value));
|
|
3704
|
+
};
|
|
3705
|
+
const handleSearch = (customFilters = null, offset = null) => {
|
|
3657
3706
|
var _day$value;
|
|
3658
|
-
|
|
3707
|
+
const searchFilters = customFilters || {
|
|
3659
3708
|
fixedPointCode: (fixedPoint === null || fixedPoint === void 0 ? void 0 : fixedPoint.value) === "all" ? "" : fixedPoint === null || fixedPoint === void 0 ? void 0 : fixedPoint.value,
|
|
3660
3709
|
day: (day === null || day === void 0 ? void 0 : day.value) === "all" ? "" : day === null || day === void 0 ? void 0 : (_day$value = day.value) === null || _day$value === void 0 ? void 0 : _day$value.toUpperCase(),
|
|
3661
3710
|
status: (status === null || status === void 0 ? void 0 : status.value) === "all" ? "" : status === null || status === void 0 ? void 0 : status.value,
|
|
3662
3711
|
vehicleId: (vehicle === null || vehicle === void 0 ? void 0 : vehicle.value) === "all" ? "" : vehicle === null || vehicle === void 0 ? void 0 : vehicle.value
|
|
3712
|
+
};
|
|
3713
|
+
const newOffset = offset !== null ? offset : 0;
|
|
3714
|
+
if (offset === null) setPageOffset(0);
|
|
3715
|
+
setFilters({
|
|
3716
|
+
...searchFilters,
|
|
3717
|
+
limit: pageSize,
|
|
3718
|
+
offset: newOffset
|
|
3663
3719
|
});
|
|
3664
3720
|
};
|
|
3721
|
+
React.useEffect(() => {
|
|
3722
|
+
if (pageOffset !== 0) {
|
|
3723
|
+
handleSearch(null, pageOffset);
|
|
3724
|
+
}
|
|
3725
|
+
}, [pageOffset, pageSize]);
|
|
3665
3726
|
const columns = React.useMemo(() => [{
|
|
3666
3727
|
Header: t("WT_SCHEDULE_ID"),
|
|
3667
3728
|
accessor: "scheduleId"
|
|
@@ -3754,7 +3815,7 @@ const FixedPointScheduleManagement = ({
|
|
|
3754
3815
|
}
|
|
3755
3816
|
}, /*#__PURE__*/React.createElement("div", {
|
|
3756
3817
|
className: "finance-mainlayout-col1"
|
|
3757
|
-
}, /*#__PURE__*/React.createElement(CardLabel, null, t("
|
|
3818
|
+
}, /*#__PURE__*/React.createElement(CardLabel, null, t("WT_EXPORT")), /*#__PURE__*/React.createElement(Dropdown, {
|
|
3758
3819
|
option: [{
|
|
3759
3820
|
label: t("WT_EXCEL_WEEKWISE"),
|
|
3760
3821
|
value: "Weekwise"
|
|
@@ -3772,33 +3833,14 @@ const FixedPointScheduleManagement = ({
|
|
|
3772
3833
|
})), /*#__PURE__*/React.createElement("div", {
|
|
3773
3834
|
className: "finance-mainlayout-col1"
|
|
3774
3835
|
}, /*#__PURE__*/React.createElement(CardLabel, null, t("WT_FIXED_POINT")), /*#__PURE__*/React.createElement(Dropdown, {
|
|
3775
|
-
option:
|
|
3776
|
-
label: "All Fixed Points",
|
|
3777
|
-
value: "all"
|
|
3778
|
-
}, {
|
|
3779
|
-
label: "FP01",
|
|
3780
|
-
value: "FP01"
|
|
3781
|
-
}, {
|
|
3782
|
-
label: "FP02",
|
|
3783
|
-
value: "FP02"
|
|
3784
|
-
}, {
|
|
3785
|
-
label: "FP03",
|
|
3786
|
-
value: "FP03"
|
|
3787
|
-
}],
|
|
3836
|
+
option: fixedPoints,
|
|
3788
3837
|
optionKey: "label",
|
|
3789
3838
|
selected: fixedPoint,
|
|
3790
3839
|
t: t,
|
|
3791
3840
|
select: val => {
|
|
3792
|
-
var _day$value2;
|
|
3793
3841
|
setFixedPoint(val);
|
|
3794
|
-
handleSearch({
|
|
3795
|
-
fixedPointCode: (val === null || val === void 0 ? void 0 : val.value) === "all" ? "" : val === null || val === void 0 ? void 0 : val.value,
|
|
3796
|
-
day: (day === null || day === void 0 ? void 0 : day.value) === "all" ? "" : day === null || day === void 0 ? void 0 : (_day$value2 = day.value) === null || _day$value2 === void 0 ? void 0 : _day$value2.toUpperCase(),
|
|
3797
|
-
status: (status === null || status === void 0 ? void 0 : status.value) === "all" ? "" : status === null || status === void 0 ? void 0 : status.value,
|
|
3798
|
-
vehicleId: (vehicle === null || vehicle === void 0 ? void 0 : vehicle.value) === "all" ? "" : vehicle === null || vehicle === void 0 ? void 0 : vehicle.value
|
|
3799
|
-
});
|
|
3800
3842
|
},
|
|
3801
|
-
placeholder: "
|
|
3843
|
+
placeholder: t("WT_ALL_FIXED_POINTS")
|
|
3802
3844
|
})), /*#__PURE__*/React.createElement("div", {
|
|
3803
3845
|
className: "finance-mainlayout-col1"
|
|
3804
3846
|
}, /*#__PURE__*/React.createElement(CardLabel, null, t("WT_DAY")), /*#__PURE__*/React.createElement(Dropdown, {
|
|
@@ -3859,44 +3901,21 @@ const FixedPointScheduleManagement = ({
|
|
|
3859
3901
|
selected: status,
|
|
3860
3902
|
t: t,
|
|
3861
3903
|
select: val => {
|
|
3862
|
-
var _day$
|
|
3904
|
+
var _day$value2;
|
|
3863
3905
|
setStatus(val);
|
|
3864
3906
|
handleSearch({
|
|
3865
3907
|
fixedPointCode: (fixedPoint === null || fixedPoint === void 0 ? void 0 : fixedPoint.value) === "all" ? "" : fixedPoint === null || fixedPoint === void 0 ? void 0 : fixedPoint.value,
|
|
3866
|
-
day: (day === null || day === void 0 ? void 0 : day.value) === "all" ? "" : day === null || day === void 0 ? void 0 : (_day$
|
|
3908
|
+
day: (day === null || day === void 0 ? void 0 : day.value) === "all" ? "" : day === null || day === void 0 ? void 0 : (_day$value2 = day.value) === null || _day$value2 === void 0 ? void 0 : _day$value2.toUpperCase(),
|
|
3867
3909
|
status: (val === null || val === void 0 ? void 0 : val.value) === "all" ? "" : val === null || val === void 0 ? void 0 : val.value,
|
|
3868
3910
|
vehicleId: (vehicle === null || vehicle === void 0 ? void 0 : vehicle.value) === "all" ? "" : vehicle === null || vehicle === void 0 ? void 0 : vehicle.value
|
|
3869
3911
|
});
|
|
3870
3912
|
},
|
|
3871
3913
|
placeholder: "All Status"
|
|
3872
|
-
}))
|
|
3873
|
-
className: "finance-mainlayout",
|
|
3914
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
3915
|
+
className: "finance-mainlayout-col1",
|
|
3874
3916
|
style: {
|
|
3875
|
-
|
|
3917
|
+
alignSelf: "flex-end"
|
|
3876
3918
|
}
|
|
3877
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
3878
|
-
className: "finance-mainlayout-col1"
|
|
3879
|
-
}), /*#__PURE__*/React.createElement("div", {
|
|
3880
|
-
className: "finance-mainlayout-col1"
|
|
3881
|
-
}), /*#__PURE__*/React.createElement("div", {
|
|
3882
|
-
className: "finance-mainlayout-col1"
|
|
3883
|
-
}, /*#__PURE__*/React.createElement(Dropdown, {
|
|
3884
|
-
option: [{
|
|
3885
|
-
label: t("WT_EXCEL_WEEKWISE"),
|
|
3886
|
-
value: "Weekwise"
|
|
3887
|
-
}, {
|
|
3888
|
-
label: t("WT_EXCEL_MONTHWISE"),
|
|
3889
|
-
value: "Monthwise"
|
|
3890
|
-
}, {
|
|
3891
|
-
label: t("WT_EXCEL_YEARWISE"),
|
|
3892
|
-
value: "Yearwise"
|
|
3893
|
-
}],
|
|
3894
|
-
optionKey: "label",
|
|
3895
|
-
placeholder: t("WT_EXPORT"),
|
|
3896
|
-
t: t,
|
|
3897
|
-
select: handleDownload
|
|
3898
|
-
})), /*#__PURE__*/React.createElement("div", {
|
|
3899
|
-
className: "finance-mainlayout-col1"
|
|
3900
3919
|
}, /*#__PURE__*/React.createElement(SubmitBar, {
|
|
3901
3920
|
label: t("ES_COMMON_SEARCH"),
|
|
3902
3921
|
onSubmit: () => handleSearch()
|
|
@@ -3947,15 +3966,15 @@ const FixedPointScheduleManagement = ({
|
|
|
3947
3966
|
overflowX: "auto"
|
|
3948
3967
|
},
|
|
3949
3968
|
isLoading: isLoading,
|
|
3950
|
-
onPageSizeChange:
|
|
3951
|
-
currentPage:
|
|
3952
|
-
onNextPage:
|
|
3953
|
-
onPrevPage:
|
|
3954
|
-
pageSizeLimit:
|
|
3969
|
+
onPageSizeChange: handlePageSizeChange,
|
|
3970
|
+
currentPage: Math.floor(pageOffset / pageSize),
|
|
3971
|
+
onNextPage: fetchNextPage,
|
|
3972
|
+
onPrevPage: fetchPrevPage,
|
|
3973
|
+
pageSizeLimit: pageSize,
|
|
3955
3974
|
onSort: props.onSort,
|
|
3956
3975
|
disableSort: props.disableSort,
|
|
3957
3976
|
sortParams: props.sortParams,
|
|
3958
|
-
totalRecords:
|
|
3977
|
+
totalRecords: (scheduleData === null || scheduleData === void 0 ? void 0 : scheduleData.count) || (scheduleData === null || scheduleData === void 0 ? void 0 : scheduleData.totalCount) || (data === null || data === void 0 ? void 0 : (_data$ = data[0]) === null || _data$ === void 0 ? void 0 : _data$.totalCount)
|
|
3959
3978
|
})), /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement("button", {
|
|
3960
3979
|
onClick: () => {
|
|
3961
3980
|
setEditingRowIndex(null);
|
|
@@ -4012,11 +4031,11 @@ const FixedPointScheduleManagement = ({
|
|
|
4012
4031
|
const dayVal = typeof formDataDay === "string" ? formDataDay : formDataDay === null || formDataDay === void 0 ? void 0 : formDataDay.value;
|
|
4013
4032
|
if (dayVal && dayVal !== "WT_SELECT_ALL") daysArr = [dayVal];
|
|
4014
4033
|
}
|
|
4015
|
-
const
|
|
4034
|
+
const fixedPointDetails = {
|
|
4016
4035
|
tenantId,
|
|
4017
4036
|
system_assigned_schedule_id: formData.scheduleId,
|
|
4018
4037
|
fixed_point_code: formData.fixedPointCode,
|
|
4019
|
-
|
|
4038
|
+
day: daysArr.map(d => d.toUpperCase()),
|
|
4020
4039
|
trip_no: formData.frequencyNo,
|
|
4021
4040
|
arrival_time_to_fpl: formData.arrivalTimeFpl,
|
|
4022
4041
|
departure_time_from_fpl: formData.departureTimeFpl,
|
|
@@ -4030,7 +4049,7 @@ const FixedPointScheduleManagement = ({
|
|
|
4030
4049
|
vehicle_id: formData.vehicleId
|
|
4031
4050
|
};
|
|
4032
4051
|
const payload = {
|
|
4033
|
-
|
|
4052
|
+
fixedPointDetails
|
|
4034
4053
|
};
|
|
4035
4054
|
createSchedule(payload, {
|
|
4036
4055
|
onError: (error, variables) => {
|
|
@@ -21828,7 +21847,9 @@ const WTCitizenCard = () => {
|
|
|
21828
21847
|
links,
|
|
21829
21848
|
onDetailsClick: handleDetailsClick
|
|
21830
21849
|
};
|
|
21831
|
-
return /*#__PURE__*/React.createElement(
|
|
21850
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
21851
|
+
className: "wt-citizen-card-premium"
|
|
21852
|
+
}, /*#__PURE__*/React.createElement(EmployeeModuleCard, propsForModuleCard));
|
|
21832
21853
|
};
|
|
21833
21854
|
|
|
21834
21855
|
const MTCard = () => {
|