@djb25/digit-ui-module-wt 1.0.50 → 1.0.51
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 +90 -36
- package/dist/index.modern.js.map +1 -1
- package/package.json +1 -1
package/dist/index.modern.js
CHANGED
|
@@ -3805,7 +3805,7 @@ const AddTripModal = ({
|
|
|
3805
3805
|
});
|
|
3806
3806
|
const fillingPointOptions = fillingPoints.map(fp => ({
|
|
3807
3807
|
displayLabel: (fp === null || fp === void 0 ? void 0 : fp.fillingPointName) || "NA",
|
|
3808
|
-
value: fp === null || fp === void 0 ? void 0 : fp.id,
|
|
3808
|
+
value: (fp === null || fp === void 0 ? void 0 : fp.fillingPointId) || (fp === null || fp === void 0 ? void 0 : fp.id),
|
|
3809
3809
|
eeName: (fp === null || fp === void 0 ? void 0 : fp.eeName) || "NA",
|
|
3810
3810
|
aeName: (fp === null || fp === void 0 ? void 0 : fp.aeName) || "NA"
|
|
3811
3811
|
}));
|
|
@@ -3847,7 +3847,7 @@ const AddTripModal = ({
|
|
|
3847
3847
|
className: "custom-modal-overlay",
|
|
3848
3848
|
style: {
|
|
3849
3849
|
position: "fixed",
|
|
3850
|
-
top:
|
|
3850
|
+
top: 30,
|
|
3851
3851
|
left: 0,
|
|
3852
3852
|
width: "100%",
|
|
3853
3853
|
height: "100%",
|
|
@@ -4238,6 +4238,29 @@ const AddTripModal = ({
|
|
|
4238
4238
|
}, initialValues ? t("WT_UPDATE") : t("CS_COMMON_SAVE")))));
|
|
4239
4239
|
};
|
|
4240
4240
|
|
|
4241
|
+
const convertTo12Hour = time24 => {
|
|
4242
|
+
if (!time24) return time24;
|
|
4243
|
+
if (time24.includes("AM") || time24.includes("PM")) return time24;
|
|
4244
|
+
const parts = time24.split(":");
|
|
4245
|
+
if (parts.length < 2) return time24;
|
|
4246
|
+
let h = parseInt(parts[0], 10);
|
|
4247
|
+
const m = parts[1];
|
|
4248
|
+
const ampm = h >= 12 ? "PM" : "AM";
|
|
4249
|
+
h = h % 12 || 12;
|
|
4250
|
+
const strHours = h < 10 ? `0${h}` : h;
|
|
4251
|
+
return `${strHours}:${m} ${ampm}`;
|
|
4252
|
+
};
|
|
4253
|
+
const convertTo24Hour = time12 => {
|
|
4254
|
+
if (!time12) return time12;
|
|
4255
|
+
const match = time12.match(/^(\d{2}):(\d{2})\s?(AM|PM)$/i);
|
|
4256
|
+
if (!match) return time12;
|
|
4257
|
+
let [_, hours, minutes, ampm] = match;
|
|
4258
|
+
hours = parseInt(hours, 10);
|
|
4259
|
+
if (ampm.toUpperCase() === "PM" && hours < 12) hours += 12;
|
|
4260
|
+
if (ampm.toUpperCase() === "AM" && hours === 12) hours = 0;
|
|
4261
|
+
const strHours = hours < 10 ? `0${hours}` : hours;
|
|
4262
|
+
return `${strHours}:${minutes}`;
|
|
4263
|
+
};
|
|
4241
4264
|
const FixedPointScheduleManagement = ({
|
|
4242
4265
|
...props
|
|
4243
4266
|
}) => {
|
|
@@ -4360,19 +4383,37 @@ const FixedPointScheduleManagement = ({
|
|
|
4360
4383
|
volume: item.volumeWaterTobeDelivery,
|
|
4361
4384
|
vehicle: item.vehicleId,
|
|
4362
4385
|
active: item.isEnable ? "Y" : "N",
|
|
4363
|
-
totalCount: item.totalCount
|
|
4386
|
+
totalCount: item.totalCount,
|
|
4387
|
+
fillingPointId: item.fillingPointId
|
|
4364
4388
|
})), []);
|
|
4365
4389
|
const data = React.useMemo(() => {
|
|
4366
4390
|
return mapScheduleRows((scheduleData === null || scheduleData === void 0 ? void 0 : scheduleData.fixedPointTimeTableDetails) || []);
|
|
4367
4391
|
}, [scheduleData, mapScheduleRows]);
|
|
4368
4392
|
const fetchNextPage = () => {
|
|
4369
|
-
|
|
4393
|
+
const newOffset = pageOffset + pageSize;
|
|
4394
|
+
setPageOffset(newOffset);
|
|
4395
|
+
setFilters(prev => ({
|
|
4396
|
+
...prev,
|
|
4397
|
+
offset: newOffset
|
|
4398
|
+
}));
|
|
4370
4399
|
};
|
|
4371
4400
|
const fetchPrevPage = () => {
|
|
4372
|
-
|
|
4401
|
+
const newOffset = Math.max(0, pageOffset - pageSize);
|
|
4402
|
+
setPageOffset(newOffset);
|
|
4403
|
+
setFilters(prev => ({
|
|
4404
|
+
...prev,
|
|
4405
|
+
offset: newOffset
|
|
4406
|
+
}));
|
|
4373
4407
|
};
|
|
4374
4408
|
const handlePageSizeChange = e => {
|
|
4375
|
-
|
|
4409
|
+
const newPageSize = Number(e.target.value);
|
|
4410
|
+
setPageSize(newPageSize);
|
|
4411
|
+
setPageOffset(0);
|
|
4412
|
+
setFilters(prev => ({
|
|
4413
|
+
...prev,
|
|
4414
|
+
limit: newPageSize,
|
|
4415
|
+
offset: 0
|
|
4416
|
+
}));
|
|
4376
4417
|
};
|
|
4377
4418
|
const handleSearch = (customFilters = null, offset = null) => {
|
|
4378
4419
|
var _day$value;
|
|
@@ -4383,17 +4424,12 @@ const FixedPointScheduleManagement = ({
|
|
|
4383
4424
|
};
|
|
4384
4425
|
const newOffset = offset !== null ? offset : 0;
|
|
4385
4426
|
if (offset === null) setPageOffset(0);
|
|
4386
|
-
setFilters({
|
|
4427
|
+
setFilters(prev => ({
|
|
4387
4428
|
...searchFilters,
|
|
4388
|
-
limit:
|
|
4429
|
+
limit: prev.limit,
|
|
4389
4430
|
offset: newOffset
|
|
4390
|
-
});
|
|
4431
|
+
}));
|
|
4391
4432
|
};
|
|
4392
|
-
React.useEffect(() => {
|
|
4393
|
-
if (pageOffset !== 0) {
|
|
4394
|
-
handleSearch(null, pageOffset);
|
|
4395
|
-
}
|
|
4396
|
-
}, [pageOffset, pageSize]);
|
|
4397
4433
|
const columns = React.useMemo(() => [{
|
|
4398
4434
|
Header: t("WT_FIXED_POINT_CODE"),
|
|
4399
4435
|
accessor: "fixedPoint"
|
|
@@ -4749,16 +4785,17 @@ const FixedPointScheduleManagement = ({
|
|
|
4749
4785
|
scheduleId: data[editingRowIndex].scheduleId,
|
|
4750
4786
|
fixedPointCode: data[editingRowIndex].fixedPoint,
|
|
4751
4787
|
fixedPointId: data[editingRowIndex].fixedPointId,
|
|
4788
|
+
fillingPointCode: data[editingRowIndex].fillingPointId,
|
|
4752
4789
|
day: [{
|
|
4753
4790
|
label: t(data[editingRowIndex].day),
|
|
4754
4791
|
value: data[editingRowIndex].day
|
|
4755
4792
|
}],
|
|
4756
4793
|
frequencyNo: data[editingRowIndex].freq,
|
|
4757
|
-
arrivalTimeFpl: data[editingRowIndex].arrToFpl,
|
|
4758
|
-
departureTimeFpl: data[editingRowIndex].depFromFpl,
|
|
4759
|
-
arrivalFixedPoint: data[editingRowIndex].arrAtFixedPoint,
|
|
4760
|
-
departureFixedPoint: data[editingRowIndex].depAtFixedPoint,
|
|
4761
|
-
returnFpl: data[editingRowIndex].returnToFpl,
|
|
4794
|
+
arrivalTimeFpl: convertTo24Hour(data[editingRowIndex].arrToFpl),
|
|
4795
|
+
departureTimeFpl: convertTo24Hour(data[editingRowIndex].depFromFpl),
|
|
4796
|
+
arrivalFixedPoint: convertTo24Hour(data[editingRowIndex].arrAtFixedPoint),
|
|
4797
|
+
departureFixedPoint: convertTo24Hour(data[editingRowIndex].depAtFixedPoint),
|
|
4798
|
+
returnFpl: convertTo24Hour(data[editingRowIndex].returnToFpl),
|
|
4762
4799
|
volume: data[editingRowIndex].volume,
|
|
4763
4800
|
vehicleId: data[editingRowIndex].vehicle,
|
|
4764
4801
|
active: {
|
|
@@ -4784,14 +4821,14 @@ const FixedPointScheduleManagement = ({
|
|
|
4784
4821
|
const fixedPointDetails = {
|
|
4785
4822
|
system_assigned_schedule_id: formData.scheduleId || existingData.scheduleId || null,
|
|
4786
4823
|
fixed_point_code: formData.fixedPointId || formData.fixedPointCode || "",
|
|
4787
|
-
fillingPointId: formData.fillingPointCode || null,
|
|
4824
|
+
fillingPointId: formData.fillingPointCode || formData.fillingPointId || null,
|
|
4788
4825
|
day: daysArr.map(d => d.toUpperCase()),
|
|
4789
4826
|
trip_no: Number(formData.frequencyNo) || 1,
|
|
4790
|
-
arrival_time_to_fpl: formData.arrivalTimeFpl,
|
|
4791
|
-
departure_time_from_fpl: formData.departureTimeFpl,
|
|
4792
|
-
arrival_time_delivery_point: formData.arrivalFixedPoint,
|
|
4793
|
-
departure_time_delivery_point: formData.departureFixedPoint,
|
|
4794
|
-
time_of_arriving_back_fpl_after_delivery: formData.returnFpl,
|
|
4827
|
+
arrival_time_to_fpl: convertTo12Hour(formData.arrivalTimeFpl),
|
|
4828
|
+
departure_time_from_fpl: convertTo12Hour(formData.departureTimeFpl),
|
|
4829
|
+
arrival_time_delivery_point: convertTo12Hour(formData.arrivalFixedPoint),
|
|
4830
|
+
departure_time_delivery_point: convertTo12Hour(formData.departureFixedPoint),
|
|
4831
|
+
time_of_arriving_back_fpl_after_delivery: convertTo12Hour(formData.returnFpl),
|
|
4795
4832
|
volume_water_tobe_delivery: formData.volume,
|
|
4796
4833
|
active: finalActiveStatus,
|
|
4797
4834
|
is_enable: finalActiveStatus,
|
|
@@ -4809,20 +4846,32 @@ const FixedPointScheduleManagement = ({
|
|
|
4809
4846
|
};
|
|
4810
4847
|
const mutationOptions = {
|
|
4811
4848
|
onError: error => {
|
|
4812
|
-
var _error$response, _error$response$data, _error$response$data$, _error$
|
|
4849
|
+
var _error$response, _error$response$data, _error$response$data$, _error$response2, _error$response2$data, _error$response2$data2, _error$response2$data3;
|
|
4850
|
+
const errMsg = (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.error) === null || _error$response$data$ === void 0 ? void 0 : _error$response$data$.message) || (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 === null || error === void 0 ? void 0 : error.message) || "Operation Failed";
|
|
4813
4851
|
setToast({
|
|
4814
4852
|
key: "error",
|
|
4815
|
-
label:
|
|
4853
|
+
label: errMsg
|
|
4816
4854
|
});
|
|
4817
4855
|
setTimeout(closeToast, 5000);
|
|
4818
4856
|
},
|
|
4819
|
-
onSuccess:
|
|
4820
|
-
|
|
4821
|
-
|
|
4822
|
-
|
|
4823
|
-
|
|
4824
|
-
|
|
4825
|
-
|
|
4857
|
+
onSuccess: response => {
|
|
4858
|
+
var _response$data;
|
|
4859
|
+
if (response !== null && response !== void 0 && response.error || response !== null && response !== void 0 && (_response$data = response.data) !== null && _response$data !== void 0 && _response$data.error) {
|
|
4860
|
+
var _response$error, _response$data2, _response$data2$error;
|
|
4861
|
+
const errMsg = (response === null || response === void 0 ? void 0 : (_response$error = response.error) === null || _response$error === void 0 ? void 0 : _response$error.message) || (response === null || response === void 0 ? void 0 : (_response$data2 = response.data) === null || _response$data2 === void 0 ? void 0 : (_response$data2$error = _response$data2.error) === null || _response$data2$error === void 0 ? void 0 : _response$data2$error.message) || "Operation Failed";
|
|
4862
|
+
setToast({
|
|
4863
|
+
key: "error",
|
|
4864
|
+
label: errMsg
|
|
4865
|
+
});
|
|
4866
|
+
setTimeout(closeToast, 5000);
|
|
4867
|
+
} else {
|
|
4868
|
+
setToast({
|
|
4869
|
+
label: editingRowIndex !== null ? t("WT_SCHEDULE_UPDATE_SUCCESS") : t("WT_SCHEDULE_CREATE_SUCCESS")
|
|
4870
|
+
});
|
|
4871
|
+
setShowModal(false);
|
|
4872
|
+
setEditingRowIndex(null);
|
|
4873
|
+
queryClient.invalidateQueries(["FIXED_POINT_SCHEDULE_SEARCH", tenantId]);
|
|
4874
|
+
}
|
|
4826
4875
|
}
|
|
4827
4876
|
};
|
|
4828
4877
|
if (editingRowIndex !== null) {
|
|
@@ -4831,11 +4880,16 @@ const FixedPointScheduleManagement = ({
|
|
|
4831
4880
|
createSchedule(payload, mutationOptions);
|
|
4832
4881
|
}
|
|
4833
4882
|
}
|
|
4834
|
-
}), toast && /*#__PURE__*/React.createElement(
|
|
4883
|
+
}), toast && /*#__PURE__*/React.createElement("div", {
|
|
4884
|
+
style: {
|
|
4885
|
+
position: "fixed",
|
|
4886
|
+
zIndex: 300000
|
|
4887
|
+
}
|
|
4888
|
+
}, /*#__PURE__*/React.createElement(Toast, {
|
|
4835
4889
|
error: toast.key === "error",
|
|
4836
4890
|
label: toast.label,
|
|
4837
4891
|
onClose: closeToast
|
|
4838
|
-
}));
|
|
4892
|
+
})));
|
|
4839
4893
|
};
|
|
4840
4894
|
|
|
4841
4895
|
const locationCache = new Map();
|