@djb25/digit-ui-module-wt 1.0.46 → 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 +736 -164
- package/dist/index.modern.js.map +1 -1
- package/package.json +1 -1
package/dist/index.modern.js
CHANGED
|
@@ -5,7 +5,7 @@ import { useLocation, useRouteMatch, useHistory, Switch, Route, Redirect, Link,
|
|
|
5
5
|
import { useQueryClient } from 'react-query';
|
|
6
6
|
import { useForm, Controller } from 'react-hook-form';
|
|
7
7
|
import { io } from 'socket.io-client';
|
|
8
|
-
import { MapContainer, TileLayer, Marker, Popup, useMap, Polyline } from 'react-leaflet';
|
|
8
|
+
import { MapContainer, TileLayer, Marker, Popup, useMap, Polyline, Circle } from 'react-leaflet';
|
|
9
9
|
import L from 'leaflet';
|
|
10
10
|
import 'leaflet/dist/leaflet.css';
|
|
11
11
|
|
|
@@ -465,7 +465,7 @@ const WTCreate = () => {
|
|
|
465
465
|
};
|
|
466
466
|
|
|
467
467
|
const checkForNotNull = (value = "") => {
|
|
468
|
-
return value && value != null && value
|
|
468
|
+
return value && value != null && value !== undefined && value !== "" ? true : false;
|
|
469
469
|
};
|
|
470
470
|
const checkForNA = (value = "") => {
|
|
471
471
|
return checkForNotNull(value) ? value : "NA";
|
|
@@ -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(),
|
|
@@ -816,6 +818,10 @@ const WTSearchApplication = ({
|
|
|
816
818
|
moduleCode,
|
|
817
819
|
isFixedPoint
|
|
818
820
|
}) => {
|
|
821
|
+
console.log("WTSearchApplication Rendered", {
|
|
822
|
+
moduleCode,
|
|
823
|
+
isFixedPoint
|
|
824
|
+
});
|
|
819
825
|
const isMobile = window.Digit.Utils.browser.isMobile();
|
|
820
826
|
const user = Digit.UserService.getUser().info;
|
|
821
827
|
const [showImageModal, setShowImageModal] = useState(false);
|
|
@@ -1092,7 +1098,13 @@ const WTSearchApplication = ({
|
|
|
1092
1098
|
}),
|
|
1093
1099
|
type: "number",
|
|
1094
1100
|
maxlength: 10
|
|
1095
|
-
}), /*#__PURE__*/React.createElement(CardLabelError, null, formState === null || formState === void 0 ? void 0 : (_formState$errors = formState.errors) === null || _formState$errors === void 0 ? void 0 : (_formState$errors$mob = _formState$errors["mobileNumber"]) === null || _formState$errors$mob === void 0 ? void 0 : _formState$errors$mob.message))
|
|
1101
|
+
}), /*#__PURE__*/React.createElement(CardLabelError, null, formState === null || formState === void 0 ? void 0 : (_formState$errors = formState.errors) === null || _formState$errors === void 0 ? void 0 : (_formState$errors$mob = _formState$errors["mobileNumber"]) === null || _formState$errors$mob === void 0 ? void 0 : _formState$errors$mob.message)), /*#__PURE__*/React.createElement("div", {
|
|
1102
|
+
className: "search-field-wrapper"
|
|
1103
|
+
}, /*#__PURE__*/React.createElement("label", null, t("WT_BOOKING_NO")), /*#__PURE__*/React.createElement(TextInput, {
|
|
1104
|
+
name: "bookingNo",
|
|
1105
|
+
inputRef: register({}),
|
|
1106
|
+
id: "wt-booking-no-input"
|
|
1107
|
+
}))), activeTab === t("WT_ADVANCED_SEARCH") && /*#__PURE__*/React.createElement("div", {
|
|
1096
1108
|
className: "formcomposer-section-grid"
|
|
1097
1109
|
}, /*#__PURE__*/React.createElement("div", {
|
|
1098
1110
|
className: "search-field-wrapper"
|
|
@@ -1401,11 +1413,8 @@ const App = () => {
|
|
|
1401
1413
|
t
|
|
1402
1414
|
} = useTranslation();
|
|
1403
1415
|
const location = useLocation();
|
|
1404
|
-
const history = useHistory();
|
|
1405
1416
|
const {
|
|
1406
|
-
path
|
|
1407
|
-
url,
|
|
1408
|
-
...match
|
|
1417
|
+
path
|
|
1409
1418
|
} = useRouteMatch();
|
|
1410
1419
|
const WTCreate = (_Digit = Digit) === null || _Digit === void 0 ? void 0 : (_Digit$ComponentRegis = _Digit.ComponentRegistryService) === null || _Digit$ComponentRegis === void 0 ? void 0 : _Digit$ComponentRegis.getComponent("WTCreate");
|
|
1411
1420
|
const WTApplicationDetails = (_Digit2 = Digit) === null || _Digit2 === void 0 ? void 0 : (_Digit2$ComponentRegi = _Digit2.ComponentRegistryService) === null || _Digit2$ComponentRegi === void 0 ? void 0 : _Digit2$ComponentRegi.getComponent("WTApplicationDetails");
|
|
@@ -1416,8 +1425,6 @@ const App = () => {
|
|
|
1416
1425
|
const ApplicationDetails = (_Digit6 = Digit) === null || _Digit6 === void 0 ? void 0 : (_Digit6$ComponentRegi = _Digit6.ComponentRegistryService) === null || _Digit6$ComponentRegi === void 0 ? void 0 : _Digit6$ComponentRegi.getComponent("ApplicationDetails");
|
|
1417
1426
|
const getDynamicBreadcrumbs = () => {
|
|
1418
1427
|
const pathname = location.pathname;
|
|
1419
|
-
if (pathname.includes("/mt/")) ;
|
|
1420
|
-
if (pathname.includes("/tp/")) ;
|
|
1421
1428
|
let crumbs = [{
|
|
1422
1429
|
icon: HomeIcon,
|
|
1423
1430
|
path: "/digit-ui/citizen"
|
|
@@ -1486,7 +1493,7 @@ const App = () => {
|
|
|
1486
1493
|
onLeftClick: () => window.history.back(),
|
|
1487
1494
|
breadcrumbs: getDynamicBreadcrumbs()
|
|
1488
1495
|
}), /*#__PURE__*/React.createElement("div", {
|
|
1489
|
-
className: "employee-form-content"
|
|
1496
|
+
className: "employee-form-content abcd"
|
|
1490
1497
|
}, /*#__PURE__*/React.createElement(PrivateRoute, {
|
|
1491
1498
|
path: `${path}/inbox`,
|
|
1492
1499
|
component: () => /*#__PURE__*/React.createElement(Inbox, {
|
|
@@ -1535,7 +1542,7 @@ const App = () => {
|
|
|
1535
1542
|
parentRoute: path
|
|
1536
1543
|
})
|
|
1537
1544
|
}), /*#__PURE__*/React.createElement(PrivateRoute, {
|
|
1538
|
-
path: `${path}/
|
|
1545
|
+
path: `${path}/vendor`,
|
|
1539
1546
|
component: () => Digit.UserService.hasAccess(["WT_VENDOR"]) ? /*#__PURE__*/React.createElement("div", {
|
|
1540
1547
|
style: {
|
|
1541
1548
|
display: "flex",
|
|
@@ -3709,25 +3716,25 @@ const AddTripModal = ({
|
|
|
3709
3716
|
onSubmit,
|
|
3710
3717
|
initialValues
|
|
3711
3718
|
}) => {
|
|
3712
|
-
var _formData$day;
|
|
3713
3719
|
const now = new Date();
|
|
3714
3720
|
const currentTime = `${String(now.getHours()).padStart(2, "0")}:${String(now.getMinutes()).padStart(2, "0")}`;
|
|
3715
3721
|
const defaultValues = initialValues ? {
|
|
3716
3722
|
...initialValues,
|
|
3717
|
-
arrivalTimeFpl: initialValues.arrivalTimeFpl || currentTime,
|
|
3718
|
-
departureTimeFpl: initialValues.departureTimeFpl || currentTime,
|
|
3719
|
-
arrivalFixedPoint: initialValues.arrivalFixedPoint || currentTime,
|
|
3720
|
-
departureFixedPoint: initialValues.departureFixedPoint || currentTime,
|
|
3721
|
-
returnFpl: initialValues.returnFpl || currentTime,
|
|
3722
|
-
frequencyNo: initialValues.frequencyNo,
|
|
3723
|
-
vehicleId: initialValues.vehicleId,
|
|
3724
|
-
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 || "",
|
|
3725
3732
|
day: initialValues.day || [],
|
|
3726
|
-
volume: initialValues.volume || "",
|
|
3727
|
-
active: initialValues.active || null,
|
|
3733
|
+
volume: initialValues.volume || initialValues.volume_water_tobe_delivery || "",
|
|
3728
3734
|
remarks: initialValues.remarks || ""
|
|
3729
3735
|
} : {
|
|
3730
3736
|
fixedPointCode: "",
|
|
3737
|
+
fillingPointCode: "",
|
|
3731
3738
|
day: [],
|
|
3732
3739
|
arrivalTimeFpl: currentTime,
|
|
3733
3740
|
departureTimeFpl: currentTime,
|
|
@@ -3735,7 +3742,6 @@ const AddTripModal = ({
|
|
|
3735
3742
|
departureFixedPoint: currentTime,
|
|
3736
3743
|
returnFpl: currentTime,
|
|
3737
3744
|
volume: "",
|
|
3738
|
-
active: null,
|
|
3739
3745
|
remarks: "",
|
|
3740
3746
|
frequencyNo: 1
|
|
3741
3747
|
};
|
|
@@ -3746,33 +3752,69 @@ const AddTripModal = ({
|
|
|
3746
3752
|
formState: {
|
|
3747
3753
|
errors
|
|
3748
3754
|
},
|
|
3749
|
-
watch
|
|
3750
|
-
setValue
|
|
3755
|
+
watch
|
|
3751
3756
|
} = useForm({
|
|
3752
3757
|
defaultValues
|
|
3753
3758
|
});
|
|
3754
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
|
+
}, []);
|
|
3755
3771
|
const {
|
|
3756
3772
|
isLoading: isFixedPointLoading,
|
|
3757
3773
|
data: fixedPointsData
|
|
3758
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({
|
|
3759
3789
|
tenantId,
|
|
3760
3790
|
filters: {
|
|
3761
3791
|
limit: 1000
|
|
3762
3792
|
}
|
|
3763
3793
|
});
|
|
3764
3794
|
const fixedPoints = (fixedPointsData === null || fixedPointsData === void 0 ? void 0 : fixedPointsData.waterTankerBookingDetail) || [];
|
|
3795
|
+
const fillingPoints = (fillingPointsData === null || fillingPointsData === void 0 ? void 0 : fillingPointsData.fillingPoints) || [];
|
|
3765
3796
|
const fixedPointOptions = fixedPoints.map(fp => {
|
|
3766
|
-
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;
|
|
3767
3801
|
return {
|
|
3768
|
-
name:
|
|
3769
|
-
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",
|
|
3770
3804
|
locality: (fp === null || fp === void 0 ? void 0 : (_fp$address = fp.address) === null || _fp$address === void 0 ? void 0 : _fp$address.locality) || "NA",
|
|
3771
|
-
displayLabel: `${
|
|
3772
|
-
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) || "",
|
|
3773
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(", ")
|
|
3774
3810
|
};
|
|
3775
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
|
+
}));
|
|
3776
3818
|
const selectedFixedPointCode = watch("fixedPointCode");
|
|
3777
3819
|
const selectedFixedPoint = fixedPointOptions.find(opt => opt.value === selectedFixedPointCode);
|
|
3778
3820
|
const dayOptions = [{
|
|
@@ -3797,20 +3839,15 @@ const AddTripModal = ({
|
|
|
3797
3839
|
label: t("SUNDAY"),
|
|
3798
3840
|
value: "SUNDAY"
|
|
3799
3841
|
}];
|
|
3800
|
-
const activeOptions = [{
|
|
3801
|
-
label: t("YES"),
|
|
3802
|
-
value: "Yes"
|
|
3803
|
-
}, {
|
|
3804
|
-
label: t("NO"),
|
|
3805
|
-
value: "No"
|
|
3806
|
-
}];
|
|
3807
3842
|
const formData = watch();
|
|
3808
|
-
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);
|
|
3809
3843
|
const onFormSubmit = data => {
|
|
3810
|
-
|
|
3811
|
-
|
|
3812
|
-
...data
|
|
3813
|
-
|
|
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);
|
|
3814
3851
|
};
|
|
3815
3852
|
return /*#__PURE__*/React.createElement("div", {
|
|
3816
3853
|
className: "custom-modal-overlay",
|
|
@@ -3827,61 +3864,117 @@ const AddTripModal = ({
|
|
|
3827
3864
|
zIndex: 200000
|
|
3828
3865
|
}
|
|
3829
3866
|
}, /*#__PURE__*/React.createElement("style", null, `
|
|
3867
|
+
|
|
3830
3868
|
.custom-modal-content {
|
|
3869
|
+
|
|
3831
3870
|
background-color: #fff;
|
|
3871
|
+
|
|
3832
3872
|
border-radius: 8px;
|
|
3873
|
+
|
|
3833
3874
|
width: 70%;
|
|
3875
|
+
|
|
3834
3876
|
max-width: 800px;
|
|
3877
|
+
|
|
3835
3878
|
max-height: 90vh;
|
|
3879
|
+
|
|
3836
3880
|
display: flex;
|
|
3881
|
+
|
|
3837
3882
|
flex-direction: column;
|
|
3883
|
+
|
|
3838
3884
|
box-shadow: 0 4px 12px rgba(0,0,0,0.15);
|
|
3885
|
+
|
|
3839
3886
|
position: relative;
|
|
3887
|
+
|
|
3840
3888
|
}
|
|
3889
|
+
|
|
3841
3890
|
.add-trip-form {
|
|
3891
|
+
|
|
3842
3892
|
display: grid;
|
|
3893
|
+
|
|
3843
3894
|
grid-template-columns: repeat(2, 1fr);
|
|
3895
|
+
|
|
3844
3896
|
gap: 20px;
|
|
3897
|
+
|
|
3845
3898
|
}
|
|
3899
|
+
|
|
3846
3900
|
@media (max-width: 768px) {
|
|
3901
|
+
|
|
3847
3902
|
.custom-modal-content {
|
|
3903
|
+
|
|
3848
3904
|
width: 90%;
|
|
3905
|
+
|
|
3849
3906
|
max-height: 85vh;
|
|
3907
|
+
|
|
3850
3908
|
}
|
|
3909
|
+
|
|
3851
3910
|
.add-trip-form {
|
|
3911
|
+
|
|
3852
3912
|
grid-template-columns: 1fr;
|
|
3913
|
+
|
|
3853
3914
|
gap: 15px;
|
|
3915
|
+
|
|
3854
3916
|
}
|
|
3917
|
+
|
|
3855
3918
|
}
|
|
3919
|
+
|
|
3856
3920
|
@media (max-width: 480px) {
|
|
3921
|
+
|
|
3857
3922
|
.custom-modal-content {
|
|
3923
|
+
|
|
3858
3924
|
width: 95%;
|
|
3925
|
+
|
|
3859
3926
|
max-height: 95vh;
|
|
3927
|
+
|
|
3860
3928
|
}
|
|
3929
|
+
|
|
3861
3930
|
.custom-modal-body {
|
|
3931
|
+
|
|
3862
3932
|
padding: 15px !important;
|
|
3933
|
+
|
|
3863
3934
|
}
|
|
3935
|
+
|
|
3864
3936
|
.custom-modal-footer {
|
|
3937
|
+
|
|
3865
3938
|
padding: 12px 15px !important;
|
|
3939
|
+
|
|
3866
3940
|
flex-direction: row;
|
|
3941
|
+
|
|
3867
3942
|
justify-content: flex-end;
|
|
3943
|
+
|
|
3868
3944
|
}
|
|
3945
|
+
|
|
3869
3946
|
.custom-modal-header {
|
|
3947
|
+
|
|
3870
3948
|
padding: 12px 15px !important;
|
|
3949
|
+
|
|
3871
3950
|
}
|
|
3951
|
+
|
|
3872
3952
|
.custom-modal-header h1 {
|
|
3953
|
+
|
|
3873
3954
|
font-size: 18px !important;
|
|
3955
|
+
|
|
3874
3956
|
}
|
|
3957
|
+
|
|
3875
3958
|
}
|
|
3959
|
+
|
|
3876
3960
|
@media (max-width: 320px) {
|
|
3961
|
+
|
|
3877
3962
|
.custom-modal-footer {
|
|
3963
|
+
|
|
3878
3964
|
flex-direction: column-reverse;
|
|
3965
|
+
|
|
3879
3966
|
align-items: stretch;
|
|
3967
|
+
|
|
3880
3968
|
}
|
|
3969
|
+
|
|
3881
3970
|
.custom-modal-footer button {
|
|
3971
|
+
|
|
3882
3972
|
width: 100%;
|
|
3973
|
+
|
|
3883
3974
|
}
|
|
3975
|
+
|
|
3884
3976
|
}
|
|
3977
|
+
|
|
3885
3978
|
`), /*#__PURE__*/React.createElement("div", {
|
|
3886
3979
|
className: "custom-modal-content"
|
|
3887
3980
|
}, /*#__PURE__*/React.createElement("div", {
|
|
@@ -3927,7 +4020,7 @@ const AddTripModal = ({
|
|
|
3927
4020
|
}, t("WT_FIXED_POINT_CODE")), isFixedPointLoading ? /*#__PURE__*/React.createElement(Loader, null) : /*#__PURE__*/React.createElement(Controller, {
|
|
3928
4021
|
control: control,
|
|
3929
4022
|
name: "fixedPointCode",
|
|
3930
|
-
defaultValue: defaultValues.fixedPointCode,
|
|
4023
|
+
defaultValue: defaultValues.fixedPointId || defaultValues.fixedPointCode,
|
|
3931
4024
|
render: props => /*#__PURE__*/React.createElement(CustomNameDropdown, {
|
|
3932
4025
|
option: fixedPointOptions,
|
|
3933
4026
|
optionKey: "displayLabel",
|
|
@@ -3938,7 +4031,8 @@ const AddTripModal = ({
|
|
|
3938
4031
|
name: "WT_NAME",
|
|
3939
4032
|
mobileNumber: "WT_MOBILE_NUMBER",
|
|
3940
4033
|
locality: "WT_LOCALITY"
|
|
3941
|
-
}
|
|
4034
|
+
},
|
|
4035
|
+
onSearch: handleSearch
|
|
3942
4036
|
})
|
|
3943
4037
|
}), selectedFixedPoint && /*#__PURE__*/React.createElement("div", {
|
|
3944
4038
|
style: {
|
|
@@ -3957,6 +4051,24 @@ const AddTripModal = ({
|
|
|
3957
4051
|
marginBottom: "8px",
|
|
3958
4052
|
fontWeight: "500"
|
|
3959
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
|
+
}
|
|
3960
4072
|
}, t("WT_DAY")), /*#__PURE__*/React.createElement(Controller, {
|
|
3961
4073
|
control: control,
|
|
3962
4074
|
name: "day",
|
|
@@ -3970,7 +4082,14 @@ const AddTripModal = ({
|
|
|
3970
4082
|
},
|
|
3971
4083
|
t: t,
|
|
3972
4084
|
defaultLabel: t("WT_SELECT_DAYS"),
|
|
3973
|
-
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
|
+
}
|
|
3974
4093
|
})
|
|
3975
4094
|
})), /*#__PURE__*/React.createElement("div", {
|
|
3976
4095
|
className: "field-group"
|
|
@@ -4073,23 +4192,6 @@ const AddTripModal = ({
|
|
|
4073
4192
|
onChange: e => props.onChange(e.target.value),
|
|
4074
4193
|
onBlur: props.onBlur
|
|
4075
4194
|
})
|
|
4076
|
-
})), /*#__PURE__*/React.createElement("div", {
|
|
4077
|
-
className: "field-group"
|
|
4078
|
-
}, /*#__PURE__*/React.createElement(CardLabel, {
|
|
4079
|
-
style: {
|
|
4080
|
-
marginBottom: "8px",
|
|
4081
|
-
fontWeight: "500"
|
|
4082
|
-
}
|
|
4083
|
-
}, t("WT_ACTIVE")), /*#__PURE__*/React.createElement(Controller, {
|
|
4084
|
-
control: control,
|
|
4085
|
-
name: "active",
|
|
4086
|
-
render: props => /*#__PURE__*/React.createElement(Dropdown, {
|
|
4087
|
-
option: activeOptions,
|
|
4088
|
-
optionKey: "label",
|
|
4089
|
-
selected: props.value,
|
|
4090
|
-
select: props.onChange,
|
|
4091
|
-
t: t
|
|
4092
|
-
})
|
|
4093
4195
|
})), /*#__PURE__*/React.createElement("div", {
|
|
4094
4196
|
className: "field-group remarks-field-group",
|
|
4095
4197
|
style: {
|
|
@@ -4130,16 +4232,14 @@ const AddTripModal = ({
|
|
|
4130
4232
|
}
|
|
4131
4233
|
}, t("CS_COMMON_CANCEL")), /*#__PURE__*/React.createElement("button", {
|
|
4132
4234
|
className: "button-save",
|
|
4133
|
-
disabled: !isFormValid,
|
|
4134
4235
|
onClick: handleSubmit(onFormSubmit),
|
|
4135
4236
|
style: {
|
|
4136
4237
|
padding: "8px 20px",
|
|
4137
|
-
background:
|
|
4138
|
-
color: "#
|
|
4238
|
+
background: "#1D4E7F",
|
|
4239
|
+
color: "#ffffffff",
|
|
4139
4240
|
border: "none",
|
|
4140
4241
|
borderRadius: "4px",
|
|
4141
|
-
cursor:
|
|
4142
|
-
opacity: !isFormValid ? 0.7 : 1
|
|
4242
|
+
cursor: "pointer"
|
|
4143
4243
|
}
|
|
4144
4244
|
}, initialValues ? t("WT_UPDATE") : t("CS_COMMON_SAVE")))));
|
|
4145
4245
|
};
|
|
@@ -4255,6 +4355,7 @@ const FixedPointScheduleManagement = ({
|
|
|
4255
4355
|
scheduleId: item.systemAssignedScheduleId,
|
|
4256
4356
|
fixedPointName: item.fixedPointName,
|
|
4257
4357
|
fixedPoint: item.fixedPointCode || item.fixedPointId,
|
|
4358
|
+
fixedPointId: item.fixedPointId || item.id || null,
|
|
4258
4359
|
day: item.day,
|
|
4259
4360
|
freq: item.tripNo,
|
|
4260
4361
|
arrToFpl: item.arrivalTimeToFpl,
|
|
@@ -4597,7 +4698,24 @@ const FixedPointScheduleManagement = ({
|
|
|
4597
4698
|
color: selectedDay === dayItem ? "#fff" : "#333",
|
|
4598
4699
|
cursor: "pointer"
|
|
4599
4700
|
}
|
|
4600
|
-
}, 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", {
|
|
4601
4719
|
style: {
|
|
4602
4720
|
width: "100%",
|
|
4603
4721
|
overflowX: "auto"
|
|
@@ -4627,24 +4745,7 @@ const FixedPointScheduleManagement = ({
|
|
|
4627
4745
|
getCSVExportData: getCSVExportData,
|
|
4628
4746
|
csvExportColumns: csvExportColumns,
|
|
4629
4747
|
csvExportFileName: "wt-fixed-point-schedule"
|
|
4630
|
-
})),
|
|
4631
|
-
onClick: () => {
|
|
4632
|
-
setEditingRowIndex(null);
|
|
4633
|
-
setShowModal(true);
|
|
4634
|
-
},
|
|
4635
|
-
style: {
|
|
4636
|
-
background: "#1E8E3E",
|
|
4637
|
-
color: "#fff",
|
|
4638
|
-
border: "none",
|
|
4639
|
-
padding: "10px 20px",
|
|
4640
|
-
borderRadius: "4px",
|
|
4641
|
-
cursor: "pointer",
|
|
4642
|
-
display: "flex",
|
|
4643
|
-
alignItems: "center",
|
|
4644
|
-
gap: "5px",
|
|
4645
|
-
marginBottom: "10px"
|
|
4646
|
-
}
|
|
4647
|
-
}, /*#__PURE__*/React.createElement("span", null, "+"), " ", t("WT_ADD_TRIP")))), showModal && /*#__PURE__*/React.createElement(AddTripModal, {
|
|
4748
|
+
}))), showModal && /*#__PURE__*/React.createElement(AddTripModal, {
|
|
4648
4749
|
t: t,
|
|
4649
4750
|
closeModal: () => {
|
|
4650
4751
|
setShowModal(false);
|
|
@@ -4653,6 +4754,7 @@ const FixedPointScheduleManagement = ({
|
|
|
4653
4754
|
initialValues: editingRowIndex !== null ? {
|
|
4654
4755
|
scheduleId: data[editingRowIndex].scheduleId,
|
|
4655
4756
|
fixedPointCode: data[editingRowIndex].fixedPoint,
|
|
4757
|
+
fixedPointId: data[editingRowIndex].fixedPointId,
|
|
4656
4758
|
day: [{
|
|
4657
4759
|
label: t(data[editingRowIndex].day),
|
|
4658
4760
|
value: data[editingRowIndex].day
|
|
@@ -4671,86 +4773,68 @@ const FixedPointScheduleManagement = ({
|
|
|
4671
4773
|
}
|
|
4672
4774
|
} : null,
|
|
4673
4775
|
onSubmit: formData => {
|
|
4674
|
-
var _formData$active,
|
|
4776
|
+
var _formData$active, _scheduleData$fixedPo, _scheduleData$fixedPo2;
|
|
4777
|
+
console.log(formData, 'dsdsdsdsdsdsds');
|
|
4675
4778
|
const formDataDay = formData === null || formData === void 0 ? void 0 : formData.day;
|
|
4676
4779
|
let daysArr = [];
|
|
4677
4780
|
if (Array.isArray(formDataDay)) {
|
|
4678
|
-
daysArr = formDataDay.map(d => typeof d === "string" ? d : (d === null || d === void 0 ? void 0 : d.value) ||
|
|
4679
|
-
if (daysArr.length === 0 && formDataDay.some(d => {
|
|
4680
|
-
const val = typeof d === "string" ? d : (d === null || d === void 0 ? void 0 : d.value) || (Array.isArray(d) ? d[1] : d);
|
|
4681
|
-
return val === "WT_SELECT_ALL";
|
|
4682
|
-
})) {
|
|
4683
|
-
daysArr = ["MONDAY", "TUESDAY", "WEDNESDAY", "THURSDAY", "FRIDAY", "SATURDAY", "SUNDAY"];
|
|
4684
|
-
}
|
|
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");
|
|
4685
4782
|
} else if (formDataDay) {
|
|
4686
|
-
const
|
|
4687
|
-
if (
|
|
4783
|
+
const val = (formDataDay === null || formDataDay === void 0 ? void 0 : formDataDay.value) || formDataDay;
|
|
4784
|
+
if (val && val !== "WT_SELECT_ALL") daysArr = [val];
|
|
4688
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;
|
|
4689
4790
|
const fixedPointDetails = {
|
|
4690
|
-
|
|
4691
|
-
|
|
4692
|
-
|
|
4693
|
-
day: daysArr.map(d =>
|
|
4694
|
-
|
|
4695
|
-
return (d === null || d === void 0 ? void 0 : (_d$toUpperCase = d.toUpperCase) === null || _d$toUpperCase === void 0 ? void 0 : _d$toUpperCase.call(d)) || d;
|
|
4696
|
-
}),
|
|
4697
|
-
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,
|
|
4698
4796
|
arrival_time_to_fpl: formData.arrivalTimeFpl,
|
|
4699
4797
|
departure_time_from_fpl: formData.departureTimeFpl,
|
|
4700
4798
|
arrival_time_delivery_point: formData.arrivalFixedPoint,
|
|
4701
4799
|
departure_time_delivery_point: formData.departureFixedPoint,
|
|
4702
4800
|
time_of_arriving_back_fpl_after_delivery: formData.returnFpl,
|
|
4703
|
-
volume_water_tobe_delivery: formData.volume
|
|
4704
|
-
active:
|
|
4705
|
-
is_enable:
|
|
4706
|
-
remarks: formData.remarks,
|
|
4707
|
-
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
|
|
4708
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;
|
|
4709
4811
|
const payload = editingRowIndex !== null ? {
|
|
4710
4812
|
fixedPointDetailsList: [fixedPointDetails]
|
|
4711
4813
|
} : {
|
|
4712
4814
|
fixedPointDetails
|
|
4713
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
|
+
};
|
|
4714
4834
|
if (editingRowIndex !== null) {
|
|
4715
|
-
updateSchedule(payload,
|
|
4716
|
-
onError: (error, variables) => {
|
|
4717
|
-
var _error$response, _error$response$data, _error$response$data$, _error$response$data$2;
|
|
4718
|
-
setToast({
|
|
4719
|
-
key: "error",
|
|
4720
|
-
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"
|
|
4721
|
-
});
|
|
4722
|
-
setTimeout(closeToast, 5000);
|
|
4723
|
-
},
|
|
4724
|
-
onSuccess: (data, variables) => {
|
|
4725
|
-
setToast({
|
|
4726
|
-
label: t("WT_SCHEDULE_UPDATE_SUCCESS")
|
|
4727
|
-
});
|
|
4728
|
-
setTimeout(closeToast, 5000);
|
|
4729
|
-
setShowModal(false);
|
|
4730
|
-
setEditingRowIndex(null);
|
|
4731
|
-
queryClient.invalidateQueries(["FIXED_POINT_SCHEDULE_SEARCH", tenantId]);
|
|
4732
|
-
}
|
|
4733
|
-
});
|
|
4835
|
+
updateSchedule(payload, mutationOptions);
|
|
4734
4836
|
} else {
|
|
4735
|
-
createSchedule(payload,
|
|
4736
|
-
onError: (error, variables) => {
|
|
4737
|
-
var _error$response2, _error$response2$data, _error$response2$data2, _error$response2$data3;
|
|
4738
|
-
setToast({
|
|
4739
|
-
key: "error",
|
|
4740
|
-
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"
|
|
4741
|
-
});
|
|
4742
|
-
setTimeout(closeToast, 5000);
|
|
4743
|
-
},
|
|
4744
|
-
onSuccess: (data, variables) => {
|
|
4745
|
-
setToast({
|
|
4746
|
-
label: t("WT_SCHEDULE_CREATE_SUCCESS")
|
|
4747
|
-
});
|
|
4748
|
-
setTimeout(closeToast, 5000);
|
|
4749
|
-
setShowModal(false);
|
|
4750
|
-
setEditingRowIndex(null);
|
|
4751
|
-
queryClient.invalidateQueries(["FIXED_POINT_SCHEDULE_SEARCH", tenantId]);
|
|
4752
|
-
}
|
|
4753
|
-
});
|
|
4837
|
+
createSchedule(payload, mutationOptions);
|
|
4754
4838
|
}
|
|
4755
4839
|
}
|
|
4756
4840
|
}), toast && /*#__PURE__*/React.createElement(Toast, {
|
|
@@ -7286,6 +7370,477 @@ const LocalityModal = ({
|
|
|
7286
7370
|
}, t("CS_COMMON_SAVE")))));
|
|
7287
7371
|
};
|
|
7288
7372
|
|
|
7373
|
+
delete L.Icon.Default.prototype._getIconUrl;
|
|
7374
|
+
L.Icon.Default.mergeOptions({
|
|
7375
|
+
iconRetinaUrl: "https://unpkg.com/leaflet@1.9.4/dist/images/marker-icon-2x.png",
|
|
7376
|
+
iconUrl: "https://unpkg.com/leaflet@1.9.4/dist/images/marker-icon.png",
|
|
7377
|
+
shadowUrl: "https://unpkg.com/leaflet@1.9.4/dist/images/marker-shadow.png"
|
|
7378
|
+
});
|
|
7379
|
+
const fillingPointIcon = new L.Icon({
|
|
7380
|
+
iconUrl: "https://raw.githubusercontent.com/pointhi/leaflet-color-markers/master/img/marker-icon-2x-blue.png",
|
|
7381
|
+
shadowUrl: "https://cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.7/images/marker-shadow.png",
|
|
7382
|
+
iconSize: [25, 41],
|
|
7383
|
+
iconAnchor: [12, 41],
|
|
7384
|
+
popupAnchor: [1, -34],
|
|
7385
|
+
shadowSize: [41, 41]
|
|
7386
|
+
});
|
|
7387
|
+
const fixedPointIcon = new L.Icon({
|
|
7388
|
+
iconUrl: "https://raw.githubusercontent.com/pointhi/leaflet-color-markers/master/img/marker-icon-2x-green.png",
|
|
7389
|
+
shadowUrl: "https://cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.7/images/marker-shadow.png",
|
|
7390
|
+
iconSize: [25, 41],
|
|
7391
|
+
iconAnchor: [12.5, 41],
|
|
7392
|
+
popupAnchor: [1, -34],
|
|
7393
|
+
shadowSize: [41, 41]
|
|
7394
|
+
});
|
|
7395
|
+
const enlargedFixedPointIcon = new L.Icon({
|
|
7396
|
+
iconUrl: "https://raw.githubusercontent.com/pointhi/leaflet-color-markers/master/img/marker-icon-2x-green.png",
|
|
7397
|
+
shadowUrl: "https://cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.7/images/marker-shadow.png",
|
|
7398
|
+
iconSize: [35, 57],
|
|
7399
|
+
iconAnchor: [17.5, 57],
|
|
7400
|
+
popupAnchor: [1, -45],
|
|
7401
|
+
shadowSize: [50, 50],
|
|
7402
|
+
className: "bouncing-marker"
|
|
7403
|
+
});
|
|
7404
|
+
const bounceStyles = `
|
|
7405
|
+
@keyframes marker-bounce {
|
|
7406
|
+
0%, 100% { margin-top: 0px; }
|
|
7407
|
+
50% { margin-top: -15px; }
|
|
7408
|
+
}
|
|
7409
|
+
.bouncing-marker {
|
|
7410
|
+
animation: marker-bounce 0.6s infinite ease-in-out !important;
|
|
7411
|
+
}
|
|
7412
|
+
`;
|
|
7413
|
+
const ChangeView = ({
|
|
7414
|
+
bounds,
|
|
7415
|
+
center,
|
|
7416
|
+
zoom
|
|
7417
|
+
}) => {
|
|
7418
|
+
const map = useMap();
|
|
7419
|
+
useEffect(() => {
|
|
7420
|
+
if (center) {
|
|
7421
|
+
map.setView(center, zoom || 15, {
|
|
7422
|
+
animate: true
|
|
7423
|
+
});
|
|
7424
|
+
} else if (bounds && bounds.length > 0) {
|
|
7425
|
+
map.fitBounds(bounds);
|
|
7426
|
+
}
|
|
7427
|
+
}, [bounds, center, zoom, map]);
|
|
7428
|
+
return null;
|
|
7429
|
+
};
|
|
7430
|
+
const PointAddressMap = ({
|
|
7431
|
+
fillingPoints: _fillingPoints = [],
|
|
7432
|
+
fixedPoints: _fixedPoints = [],
|
|
7433
|
+
isLoading,
|
|
7434
|
+
t
|
|
7435
|
+
}) => {
|
|
7436
|
+
var _selectedFillingPoint;
|
|
7437
|
+
const [selectedFillingPoint, setSelectedFillingPoint] = useState(null);
|
|
7438
|
+
const [selectedFixedPoint, setSelectedFixedPoint] = useState(null);
|
|
7439
|
+
const [hoveredFixedPointId, setHoveredFixedPointId] = useState(null);
|
|
7440
|
+
const [mapCenter, setMapCenter] = useState(null);
|
|
7441
|
+
const [mapZoom, setMapZoom] = useState(11);
|
|
7442
|
+
const defaultCenter = [28.6139, 77.209];
|
|
7443
|
+
const getFpId = fp => {
|
|
7444
|
+
var _fp$fillingpointmetad;
|
|
7445
|
+
return (fp === null || fp === void 0 ? void 0 : fp.id) || (fp === null || fp === void 0 ? void 0 : fp.bookingId) || (fp === null || fp === void 0 ? void 0 : fp.fillingPointId) || (fp === null || fp === void 0 ? void 0 : fp.uuid) || (fp === null || fp === void 0 ? void 0 : (_fp$fillingpointmetad = fp.fillingpointmetadata) === null || _fp$fillingpointmetad === void 0 ? void 0 : _fp$fillingpointmetad.fillingPointId);
|
|
7446
|
+
};
|
|
7447
|
+
const {
|
|
7448
|
+
isLoading: isRelatedLoading,
|
|
7449
|
+
data: relatedFixedPointsData
|
|
7450
|
+
} = Digit.Hooks.wt.useFixedPointSearchAPI({
|
|
7451
|
+
tenantId: Digit.ULBService.getCurrentTenantId(),
|
|
7452
|
+
filters: {
|
|
7453
|
+
fillingPointId: getFpId(selectedFillingPoint),
|
|
7454
|
+
limit: 1000
|
|
7455
|
+
}
|
|
7456
|
+
}, {
|
|
7457
|
+
enabled: !!selectedFillingPoint
|
|
7458
|
+
});
|
|
7459
|
+
const relatedFixedPoints = useMemo(() => {
|
|
7460
|
+
if (!selectedFillingPoint) return [];
|
|
7461
|
+
return (relatedFixedPointsData === null || relatedFixedPointsData === void 0 ? void 0 : relatedFixedPointsData.waterTankerBookingDetail) || [];
|
|
7462
|
+
}, [selectedFillingPoint, relatedFixedPointsData]);
|
|
7463
|
+
const displayFillingPoints = useMemo(() => {
|
|
7464
|
+
if (selectedFillingPoint) {
|
|
7465
|
+
return [selectedFillingPoint].filter(fp => {
|
|
7466
|
+
var _fp$address, _fp$address2;
|
|
7467
|
+
return ((_fp$address = fp.address) === null || _fp$address === void 0 ? void 0 : _fp$address.latitude) && ((_fp$address2 = fp.address) === null || _fp$address2 === void 0 ? void 0 : _fp$address2.longitude);
|
|
7468
|
+
});
|
|
7469
|
+
}
|
|
7470
|
+
return (_fillingPoints === null || _fillingPoints === void 0 ? void 0 : _fillingPoints.filter(fp => {
|
|
7471
|
+
var _fp$address3, _fp$address4;
|
|
7472
|
+
return ((_fp$address3 = fp.address) === null || _fp$address3 === void 0 ? void 0 : _fp$address3.latitude) && ((_fp$address4 = fp.address) === null || _fp$address4 === void 0 ? void 0 : _fp$address4.longitude);
|
|
7473
|
+
})) || [];
|
|
7474
|
+
}, [_fillingPoints, selectedFillingPoint]);
|
|
7475
|
+
const displayFixedPoints = useMemo(() => {
|
|
7476
|
+
if (selectedFixedPoint) {
|
|
7477
|
+
return [selectedFixedPoint].filter(fx => {
|
|
7478
|
+
var _fx$address, _fx$address2;
|
|
7479
|
+
return ((_fx$address = fx.address) === null || _fx$address === void 0 ? void 0 : _fx$address.latitude) && ((_fx$address2 = fx.address) === null || _fx$address2 === void 0 ? void 0 : _fx$address2.longitude);
|
|
7480
|
+
});
|
|
7481
|
+
}
|
|
7482
|
+
return relatedFixedPoints.filter(fx => {
|
|
7483
|
+
var _fx$address3, _fx$address4;
|
|
7484
|
+
return ((_fx$address3 = fx.address) === null || _fx$address3 === void 0 ? void 0 : _fx$address3.latitude) && ((_fx$address4 = fx.address) === null || _fx$address4 === void 0 ? void 0 : _fx$address4.longitude);
|
|
7485
|
+
});
|
|
7486
|
+
}, [relatedFixedPoints, selectedFixedPoint]);
|
|
7487
|
+
const bounds = useMemo(() => {
|
|
7488
|
+
const allPoints = [...displayFillingPoints.map(p => [parseFloat(p.address.latitude), parseFloat(p.address.longitude)]), ...displayFixedPoints.map(p => [parseFloat(p.address.latitude), parseFloat(p.address.longitude)])];
|
|
7489
|
+
if (allPoints.length === 0) return null;
|
|
7490
|
+
return allPoints;
|
|
7491
|
+
}, [displayFillingPoints, displayFixedPoints]);
|
|
7492
|
+
const handleFillingPointSelect = val => {
|
|
7493
|
+
setSelectedFillingPoint(val);
|
|
7494
|
+
setSelectedFixedPoint(null);
|
|
7495
|
+
setMapCenter(null);
|
|
7496
|
+
};
|
|
7497
|
+
const handleFixedPointSelect = val => {
|
|
7498
|
+
var _val$address, _val$address2;
|
|
7499
|
+
setSelectedFixedPoint(val);
|
|
7500
|
+
if (val !== null && val !== void 0 && (_val$address = val.address) !== null && _val$address !== void 0 && _val$address.latitude && val !== null && val !== void 0 && (_val$address2 = val.address) !== null && _val$address2 !== void 0 && _val$address2.longitude) {
|
|
7501
|
+
setMapCenter([parseFloat(val.address.latitude), parseFloat(val.address.longitude)]);
|
|
7502
|
+
setMapZoom(16);
|
|
7503
|
+
}
|
|
7504
|
+
};
|
|
7505
|
+
const fixedPointOptions = useMemo(() => {
|
|
7506
|
+
return relatedFixedPoints.map(fx => {
|
|
7507
|
+
var _fx$applicantDetail;
|
|
7508
|
+
return {
|
|
7509
|
+
...fx,
|
|
7510
|
+
displayName: (fx === null || fx === void 0 ? void 0 : (_fx$applicantDetail = fx.applicantDetail) === null || _fx$applicantDetail === void 0 ? void 0 : _fx$applicantDetail.name) || (fx === null || fx === void 0 ? void 0 : fx.name) || "NA"
|
|
7511
|
+
};
|
|
7512
|
+
});
|
|
7513
|
+
}, [relatedFixedPoints]);
|
|
7514
|
+
const handleClear = () => {
|
|
7515
|
+
setSelectedFillingPoint(null);
|
|
7516
|
+
setSelectedFixedPoint(null);
|
|
7517
|
+
setMapCenter(null);
|
|
7518
|
+
setMapZoom(11);
|
|
7519
|
+
};
|
|
7520
|
+
if (isLoading || isRelatedLoading) return /*#__PURE__*/React.createElement(Loader, null);
|
|
7521
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
7522
|
+
style: {
|
|
7523
|
+
display: "flex",
|
|
7524
|
+
flexDirection: window.innerWidth < 768 ? "column" : "row",
|
|
7525
|
+
height: "700px",
|
|
7526
|
+
width: "100%",
|
|
7527
|
+
borderRadius: "12px",
|
|
7528
|
+
overflow: "hidden",
|
|
7529
|
+
border: "1px solid #ddd",
|
|
7530
|
+
marginTop: "20px",
|
|
7531
|
+
boxShadow: "0 8px 24px rgba(0,0,0,0.12)",
|
|
7532
|
+
background: "#fff"
|
|
7533
|
+
}
|
|
7534
|
+
}, /*#__PURE__*/React.createElement("style", null, bounceStyles), /*#__PURE__*/React.createElement("div", {
|
|
7535
|
+
style: {
|
|
7536
|
+
width: window.innerWidth < 768 ? "100%" : "320px",
|
|
7537
|
+
padding: "24px",
|
|
7538
|
+
borderRight: "1px solid #eee",
|
|
7539
|
+
display: "flex",
|
|
7540
|
+
flexDirection: "column",
|
|
7541
|
+
gap: "20px",
|
|
7542
|
+
background: "#f9f9f9",
|
|
7543
|
+
zIndex: 10
|
|
7544
|
+
}
|
|
7545
|
+
}, /*#__PURE__*/React.createElement("h3", {
|
|
7546
|
+
style: {
|
|
7547
|
+
margin: "0 0 8px 0",
|
|
7548
|
+
color: "#1D4E7F",
|
|
7549
|
+
fontSize: "20px",
|
|
7550
|
+
fontWeight: "600"
|
|
7551
|
+
}
|
|
7552
|
+
}, t("WT_MAP_FILTERS")), /*#__PURE__*/React.createElement("div", {
|
|
7553
|
+
className: "filter-item"
|
|
7554
|
+
}, /*#__PURE__*/React.createElement("label", {
|
|
7555
|
+
style: {
|
|
7556
|
+
display: "block",
|
|
7557
|
+
marginBottom: "8px",
|
|
7558
|
+
fontSize: "14px",
|
|
7559
|
+
fontWeight: "500",
|
|
7560
|
+
color: "#666"
|
|
7561
|
+
}
|
|
7562
|
+
}, t("WT_FILLING_POINT")), /*#__PURE__*/React.createElement(Dropdown, {
|
|
7563
|
+
option: _fillingPoints,
|
|
7564
|
+
optionKey: "fillingPointName",
|
|
7565
|
+
selected: selectedFillingPoint,
|
|
7566
|
+
select: handleFillingPointSelect,
|
|
7567
|
+
t: t,
|
|
7568
|
+
placeholder: t("WT_SELECT_FILLING_POINT")
|
|
7569
|
+
})), selectedFillingPoint && /*#__PURE__*/React.createElement("div", {
|
|
7570
|
+
className: "filter-item",
|
|
7571
|
+
style: {
|
|
7572
|
+
flex: 1,
|
|
7573
|
+
display: "flex",
|
|
7574
|
+
flexDirection: "column"
|
|
7575
|
+
}
|
|
7576
|
+
}, /*#__PURE__*/React.createElement("label", {
|
|
7577
|
+
style: {
|
|
7578
|
+
display: "block",
|
|
7579
|
+
marginBottom: "12px",
|
|
7580
|
+
fontSize: "14px",
|
|
7581
|
+
fontWeight: "600",
|
|
7582
|
+
color: "#1D4E7F"
|
|
7583
|
+
}
|
|
7584
|
+
}, t("WT_MAPPED_FIXED_POINTS"), " (", relatedFixedPoints.length, ")"), /*#__PURE__*/React.createElement("div", {
|
|
7585
|
+
style: {
|
|
7586
|
+
maxHeight: "350px",
|
|
7587
|
+
overflowY: "auto",
|
|
7588
|
+
paddingRight: "8px",
|
|
7589
|
+
display: "flex",
|
|
7590
|
+
flexDirection: "column",
|
|
7591
|
+
gap: "8px"
|
|
7592
|
+
}
|
|
7593
|
+
}, relatedFixedPoints.length > 0 ? relatedFixedPoints.map((fx, idx) => {
|
|
7594
|
+
var _fx$applicantDetail2, _selectedFixedPoint$a, _fx$applicantDetail3, _fx$applicantDetail5, _fx$applicantDetail6, _fx$applicantDetail7, _fx$applicantDetail8;
|
|
7595
|
+
const isSelected = (selectedFixedPoint === null || selectedFixedPoint === void 0 ? void 0 : selectedFixedPoint.id) === fx.id || ((_fx$applicantDetail2 = fx.applicantDetail) === null || _fx$applicantDetail2 === void 0 ? void 0 : _fx$applicantDetail2.applicantId) && (selectedFixedPoint === null || selectedFixedPoint === void 0 ? void 0 : (_selectedFixedPoint$a = selectedFixedPoint.applicantDetail) === null || _selectedFixedPoint$a === void 0 ? void 0 : _selectedFixedPoint$a.applicantId) === ((_fx$applicantDetail3 = fx.applicantDetail) === null || _fx$applicantDetail3 === void 0 ? void 0 : _fx$applicantDetail3.applicantId);
|
|
7596
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
7597
|
+
key: idx,
|
|
7598
|
+
onClick: () => handleFixedPointSelect(fx),
|
|
7599
|
+
onMouseEnter: () => {
|
|
7600
|
+
var _fx$applicantDetail4, _fx$address5, _fx$address6;
|
|
7601
|
+
setHoveredFixedPointId(fx.id || ((_fx$applicantDetail4 = fx.applicantDetail) === null || _fx$applicantDetail4 === void 0 ? void 0 : _fx$applicantDetail4.applicantId) || idx);
|
|
7602
|
+
if (fx !== null && fx !== void 0 && (_fx$address5 = fx.address) !== null && _fx$address5 !== void 0 && _fx$address5.latitude && fx !== null && fx !== void 0 && (_fx$address6 = fx.address) !== null && _fx$address6 !== void 0 && _fx$address6.longitude) {
|
|
7603
|
+
setMapCenter([parseFloat(fx.address.latitude), parseFloat(fx.address.longitude)]);
|
|
7604
|
+
setMapZoom(16);
|
|
7605
|
+
}
|
|
7606
|
+
},
|
|
7607
|
+
onMouseLeave: () => setHoveredFixedPointId(null),
|
|
7608
|
+
style: {
|
|
7609
|
+
padding: "12px",
|
|
7610
|
+
background: isSelected ? "#E6EEF5" : "#fff",
|
|
7611
|
+
border: isSelected ? "1.5px solid #1D4E7F" : "1px solid #e0e0e0",
|
|
7612
|
+
borderRadius: "8px",
|
|
7613
|
+
cursor: "pointer",
|
|
7614
|
+
transition: "all 0.2s ease",
|
|
7615
|
+
fontSize: "13px",
|
|
7616
|
+
color: isSelected ? "#1D4E7F" : "#333",
|
|
7617
|
+
fontWeight: isSelected ? "600" : "400",
|
|
7618
|
+
display: "flex",
|
|
7619
|
+
alignItems: "center",
|
|
7620
|
+
gap: "10px",
|
|
7621
|
+
boxShadow: isSelected ? "0 2px 8px rgba(29, 78, 127, 0.15)" : hoveredFixedPointId === (fx.id || ((_fx$applicantDetail5 = fx.applicantDetail) === null || _fx$applicantDetail5 === void 0 ? void 0 : _fx$applicantDetail5.applicantId) || idx) ? "0 4px 12px rgba(0,0,0,0.1)" : "none",
|
|
7622
|
+
transform: hoveredFixedPointId === (fx.id || ((_fx$applicantDetail6 = fx.applicantDetail) === null || _fx$applicantDetail6 === void 0 ? void 0 : _fx$applicantDetail6.applicantId) || idx) ? "translateX(4px)" : "none"
|
|
7623
|
+
}
|
|
7624
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
7625
|
+
style: {
|
|
7626
|
+
width: "10px",
|
|
7627
|
+
height: "10px",
|
|
7628
|
+
borderRadius: "50%",
|
|
7629
|
+
background: "#417505",
|
|
7630
|
+
boxShadow: "0 0 4px rgba(65, 117, 5, 0.4)"
|
|
7631
|
+
}
|
|
7632
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
7633
|
+
style: {
|
|
7634
|
+
display: "flex",
|
|
7635
|
+
flexDirection: "column"
|
|
7636
|
+
}
|
|
7637
|
+
}, /*#__PURE__*/React.createElement("span", null, (fx === null || fx === void 0 ? void 0 : (_fx$applicantDetail7 = fx.applicantDetail) === null || _fx$applicantDetail7 === void 0 ? void 0 : _fx$applicantDetail7.name) || (fx === null || fx === void 0 ? void 0 : fx.name) || "NA"), /*#__PURE__*/React.createElement("span", {
|
|
7638
|
+
style: {
|
|
7639
|
+
fontSize: "11px",
|
|
7640
|
+
color: "#888",
|
|
7641
|
+
fontWeight: "400"
|
|
7642
|
+
}
|
|
7643
|
+
}, fx === null || fx === void 0 ? void 0 : (_fx$applicantDetail8 = fx.applicantDetail) === null || _fx$applicantDetail8 === void 0 ? void 0 : _fx$applicantDetail8.fixedPointId)));
|
|
7644
|
+
}) : /*#__PURE__*/React.createElement("div", {
|
|
7645
|
+
style: {
|
|
7646
|
+
textAlign: "center",
|
|
7647
|
+
padding: "20px",
|
|
7648
|
+
color: "#999",
|
|
7649
|
+
fontSize: "13px",
|
|
7650
|
+
border: "1px dashed #ccc",
|
|
7651
|
+
borderRadius: "8px"
|
|
7652
|
+
}
|
|
7653
|
+
}, t("WT_NO_MAPPED_POINTS")))), /*#__PURE__*/React.createElement("button", {
|
|
7654
|
+
onClick: handleClear,
|
|
7655
|
+
style: {
|
|
7656
|
+
marginTop: "auto",
|
|
7657
|
+
padding: "12px",
|
|
7658
|
+
background: "#fff",
|
|
7659
|
+
border: "1px solid #1D4E7F",
|
|
7660
|
+
color: "#1D4E7F",
|
|
7661
|
+
borderRadius: "6px",
|
|
7662
|
+
cursor: "pointer",
|
|
7663
|
+
fontWeight: "600",
|
|
7664
|
+
transition: "all 0.2s"
|
|
7665
|
+
},
|
|
7666
|
+
onMouseOver: e => {
|
|
7667
|
+
e.target.style.background = "#1D4E7F";
|
|
7668
|
+
e.target.style.color = "#fff";
|
|
7669
|
+
},
|
|
7670
|
+
onMouseOut: e => {
|
|
7671
|
+
e.target.style.background = "#fff";
|
|
7672
|
+
e.target.style.color = "#1D4E7F";
|
|
7673
|
+
}
|
|
7674
|
+
}, t("ES_COMMON_CLEAR_ALL")), selectedFillingPoint && /*#__PURE__*/React.createElement("div", {
|
|
7675
|
+
style: {
|
|
7676
|
+
marginTop: "20px",
|
|
7677
|
+
padding: "16px",
|
|
7678
|
+
background: "#fff",
|
|
7679
|
+
borderRadius: "8px",
|
|
7680
|
+
border: "1px solid #e0e0e0"
|
|
7681
|
+
}
|
|
7682
|
+
}, /*#__PURE__*/React.createElement("h4", {
|
|
7683
|
+
style: {
|
|
7684
|
+
margin: "0 0 12px 0",
|
|
7685
|
+
fontSize: "14px",
|
|
7686
|
+
color: "#333",
|
|
7687
|
+
borderBottom: "1px solid #f0f0f0",
|
|
7688
|
+
paddingBottom: "8px"
|
|
7689
|
+
}
|
|
7690
|
+
}, t("WT_SUMMARY")), /*#__PURE__*/React.createElement("div", {
|
|
7691
|
+
style: {
|
|
7692
|
+
fontSize: "13px",
|
|
7693
|
+
display: "flex",
|
|
7694
|
+
flexDirection: "column",
|
|
7695
|
+
gap: "8px"
|
|
7696
|
+
}
|
|
7697
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
7698
|
+
style: {
|
|
7699
|
+
display: "flex",
|
|
7700
|
+
justifyContent: "space-between"
|
|
7701
|
+
}
|
|
7702
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
7703
|
+
style: {
|
|
7704
|
+
color: "#777"
|
|
7705
|
+
}
|
|
7706
|
+
}, t("WT_FIXED_POINTS"), ":"), /*#__PURE__*/React.createElement("span", {
|
|
7707
|
+
style: {
|
|
7708
|
+
fontWeight: "600"
|
|
7709
|
+
}
|
|
7710
|
+
}, relatedFixedPoints.length)), /*#__PURE__*/React.createElement("div", {
|
|
7711
|
+
style: {
|
|
7712
|
+
display: "flex",
|
|
7713
|
+
justifyContent: "space-between"
|
|
7714
|
+
}
|
|
7715
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
7716
|
+
style: {
|
|
7717
|
+
color: "#777"
|
|
7718
|
+
}
|
|
7719
|
+
}, t("WT_LOCALITY"), ":"), /*#__PURE__*/React.createElement("span", {
|
|
7720
|
+
style: {
|
|
7721
|
+
fontWeight: "600"
|
|
7722
|
+
}
|
|
7723
|
+
}, ((_selectedFillingPoint = selectedFillingPoint.address) === null || _selectedFillingPoint === void 0 ? void 0 : _selectedFillingPoint.locality) || "NA"))))), /*#__PURE__*/React.createElement("div", {
|
|
7724
|
+
style: {
|
|
7725
|
+
flex: 1,
|
|
7726
|
+
position: "relative"
|
|
7727
|
+
}
|
|
7728
|
+
}, /*#__PURE__*/React.createElement(MapContainer, {
|
|
7729
|
+
center: defaultCenter,
|
|
7730
|
+
zoom: 11,
|
|
7731
|
+
style: {
|
|
7732
|
+
height: "100%",
|
|
7733
|
+
width: "100%"
|
|
7734
|
+
},
|
|
7735
|
+
scrollWheelZoom: true
|
|
7736
|
+
}, /*#__PURE__*/React.createElement(TileLayer, {
|
|
7737
|
+
attribution: "\xA9 <a href=\"https://www.openstreetmap.org/copyright\">OpenStreetMap</a> contributors",
|
|
7738
|
+
url: "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"
|
|
7739
|
+
}), /*#__PURE__*/React.createElement(ChangeView, {
|
|
7740
|
+
bounds: bounds,
|
|
7741
|
+
center: mapCenter,
|
|
7742
|
+
zoom: mapZoom
|
|
7743
|
+
}), displayFillingPoints.map((fp, index) => {
|
|
7744
|
+
var _fp$address5;
|
|
7745
|
+
return /*#__PURE__*/React.createElement(React.Fragment, {
|
|
7746
|
+
key: `fp-group-${fp.id || index}`
|
|
7747
|
+
}, /*#__PURE__*/React.createElement(Circle, {
|
|
7748
|
+
center: [parseFloat(fp.address.latitude), parseFloat(fp.address.longitude)],
|
|
7749
|
+
radius: 5000,
|
|
7750
|
+
pathOptions: {
|
|
7751
|
+
color: "#0d2745ff",
|
|
7752
|
+
fillColor: "#041a34ff",
|
|
7753
|
+
fillOpacity: 0.1,
|
|
7754
|
+
weight: 1,
|
|
7755
|
+
dashArray: "5, 5"
|
|
7756
|
+
}
|
|
7757
|
+
}), /*#__PURE__*/React.createElement(Marker, {
|
|
7758
|
+
key: `fp-${fp.id || index}`,
|
|
7759
|
+
position: [parseFloat(fp.address.latitude), parseFloat(fp.address.longitude)],
|
|
7760
|
+
icon: fillingPointIcon
|
|
7761
|
+
}, /*#__PURE__*/React.createElement(Popup, null, /*#__PURE__*/React.createElement("div", {
|
|
7762
|
+
style: {
|
|
7763
|
+
padding: "8px",
|
|
7764
|
+
minWidth: "200px"
|
|
7765
|
+
}
|
|
7766
|
+
}, /*#__PURE__*/React.createElement("h4", {
|
|
7767
|
+
style: {
|
|
7768
|
+
margin: "0 0 8px 0",
|
|
7769
|
+
color: "#1F5FA8",
|
|
7770
|
+
fontSize: "16px",
|
|
7771
|
+
borderBottom: "1px solid #eee",
|
|
7772
|
+
paddingBottom: "4px"
|
|
7773
|
+
}
|
|
7774
|
+
}, fp.fillingPointName, " (Filling Point)"), /*#__PURE__*/React.createElement("div", {
|
|
7775
|
+
style: {
|
|
7776
|
+
display: "flex",
|
|
7777
|
+
flexDirection: "column",
|
|
7778
|
+
gap: "4px"
|
|
7779
|
+
}
|
|
7780
|
+
}, /*#__PURE__*/React.createElement("p", {
|
|
7781
|
+
style: {
|
|
7782
|
+
margin: 0,
|
|
7783
|
+
fontSize: "12px"
|
|
7784
|
+
}
|
|
7785
|
+
}, /*#__PURE__*/React.createElement("strong", null, t("WT_FILLING_POINT_CODE"), ":"), " ", fp.fillingPointId), /*#__PURE__*/React.createElement("p", {
|
|
7786
|
+
style: {
|
|
7787
|
+
margin: 0,
|
|
7788
|
+
fontSize: "12px"
|
|
7789
|
+
}
|
|
7790
|
+
}, /*#__PURE__*/React.createElement("strong", null, t("WT_LOCALITY"), ":"), " ", ((_fp$address5 = fp.address) === null || _fp$address5 === void 0 ? void 0 : _fp$address5.locality) || "NA"), /*#__PURE__*/React.createElement("p", {
|
|
7791
|
+
style: {
|
|
7792
|
+
margin: 0,
|
|
7793
|
+
fontSize: "12px",
|
|
7794
|
+
color: "#1F5FA8"
|
|
7795
|
+
}
|
|
7796
|
+
}, /*#__PURE__*/React.createElement("strong", null, "Coverage:"), " 5 KM Radius"))))));
|
|
7797
|
+
}), displayFixedPoints.map((fx, index) => {
|
|
7798
|
+
var _fx$applicantDetail9, _fx$applicantDetail0, _fx$applicantDetail1, _fx$applicantDetail10, _fx$address7;
|
|
7799
|
+
const fxId = fx.id || ((_fx$applicantDetail9 = fx.applicantDetail) === null || _fx$applicantDetail9 === void 0 ? void 0 : _fx$applicantDetail9.applicantId) || index;
|
|
7800
|
+
const isHovered = hoveredFixedPointId === fxId;
|
|
7801
|
+
return /*#__PURE__*/React.createElement(Marker, {
|
|
7802
|
+
key: `fx-${fxId}`,
|
|
7803
|
+
position: [parseFloat(fx.address.latitude), parseFloat(fx.address.longitude)],
|
|
7804
|
+
icon: isHovered ? enlargedFixedPointIcon : fixedPointIcon,
|
|
7805
|
+
zIndexOffset: isHovered ? 1000 : 0
|
|
7806
|
+
}, /*#__PURE__*/React.createElement(Popup, null, /*#__PURE__*/React.createElement("div", {
|
|
7807
|
+
style: {
|
|
7808
|
+
padding: "8px",
|
|
7809
|
+
minWidth: "200px"
|
|
7810
|
+
}
|
|
7811
|
+
}, /*#__PURE__*/React.createElement("h4", {
|
|
7812
|
+
style: {
|
|
7813
|
+
margin: "0 0 8px 0",
|
|
7814
|
+
color: "#417505",
|
|
7815
|
+
fontSize: "16px",
|
|
7816
|
+
borderBottom: "1px solid #eee",
|
|
7817
|
+
paddingBottom: "4px"
|
|
7818
|
+
}
|
|
7819
|
+
}, (fx === null || fx === void 0 ? void 0 : (_fx$applicantDetail0 = fx.applicantDetail) === null || _fx$applicantDetail0 === void 0 ? void 0 : _fx$applicantDetail0.name) || (fx === null || fx === void 0 ? void 0 : fx.name) || "NA", " (Fixed Point)"), /*#__PURE__*/React.createElement("div", {
|
|
7820
|
+
style: {
|
|
7821
|
+
display: "flex",
|
|
7822
|
+
flexDirection: "column",
|
|
7823
|
+
gap: "4px"
|
|
7824
|
+
}
|
|
7825
|
+
}, /*#__PURE__*/React.createElement("p", {
|
|
7826
|
+
style: {
|
|
7827
|
+
margin: 0,
|
|
7828
|
+
fontSize: "12px"
|
|
7829
|
+
}
|
|
7830
|
+
}, /*#__PURE__*/React.createElement("strong", null, t("WT_FIXED_POINT_CODE"), ":"), " ", (fx === null || fx === void 0 ? void 0 : (_fx$applicantDetail1 = fx.applicantDetail) === null || _fx$applicantDetail1 === void 0 ? void 0 : _fx$applicantDetail1.fixedPointId) || "NA"), /*#__PURE__*/React.createElement("p", {
|
|
7831
|
+
style: {
|
|
7832
|
+
margin: 0,
|
|
7833
|
+
fontSize: "12px"
|
|
7834
|
+
}
|
|
7835
|
+
}, /*#__PURE__*/React.createElement("strong", null, t("WT_MOBILE_NUMBER"), ":"), " ", (fx === null || fx === void 0 ? void 0 : (_fx$applicantDetail10 = fx.applicantDetail) === null || _fx$applicantDetail10 === void 0 ? void 0 : _fx$applicantDetail10.mobileNumber) || "NA"), /*#__PURE__*/React.createElement("p", {
|
|
7836
|
+
style: {
|
|
7837
|
+
margin: 0,
|
|
7838
|
+
fontSize: "12px"
|
|
7839
|
+
}
|
|
7840
|
+
}, /*#__PURE__*/React.createElement("strong", null, t("WT_LOCALITY"), ":"), " ", (fx === null || fx === void 0 ? void 0 : (_fx$address7 = fx.address) === null || _fx$address7 === void 0 ? void 0 : _fx$address7.locality) || "NA")))));
|
|
7841
|
+
}))));
|
|
7842
|
+
};
|
|
7843
|
+
|
|
7289
7844
|
const SearchFillingPointAddress = () => {
|
|
7290
7845
|
const {
|
|
7291
7846
|
t
|
|
@@ -7350,6 +7905,18 @@ const SearchFillingPointAddress = () => {
|
|
|
7350
7905
|
enabled: true
|
|
7351
7906
|
});
|
|
7352
7907
|
const allFillingPoints = (allFillingPointsData === null || allFillingPointsData === void 0 ? void 0 : allFillingPointsData.fillingPoints) || [];
|
|
7908
|
+
const {
|
|
7909
|
+
isLoading: isAllFixedPointsLoading,
|
|
7910
|
+
data: allFixedPointsData
|
|
7911
|
+
} = Digit.Hooks.wt.useFixedPointSearchAPI({
|
|
7912
|
+
tenantId,
|
|
7913
|
+
filters: {
|
|
7914
|
+
limit: 1000
|
|
7915
|
+
}
|
|
7916
|
+
}, {
|
|
7917
|
+
enabled: true
|
|
7918
|
+
});
|
|
7919
|
+
const allFixedPoints = (allFixedPointsData === null || allFixedPointsData === void 0 ? void 0 : allFixedPointsData.waterTankerBookingDetail) || [];
|
|
7353
7920
|
const {
|
|
7354
7921
|
mutate: mapFixedFilling
|
|
7355
7922
|
} = Digit.Hooks.wt.useVendorFillingMapping(tenantId);
|
|
@@ -7375,6 +7942,10 @@ const SearchFillingPointAddress = () => {
|
|
|
7375
7942
|
FILLING_POINT: {
|
|
7376
7943
|
label: "WT_FILLING_POINT_NAME",
|
|
7377
7944
|
placeholder: "WT_ENTER_FILLING_POINT_NAME"
|
|
7945
|
+
},
|
|
7946
|
+
VIEW_ON_MAP: {
|
|
7947
|
+
label: "WT_VIEW_ON_MAP",
|
|
7948
|
+
placeholder: ""
|
|
7378
7949
|
}
|
|
7379
7950
|
};
|
|
7380
7951
|
const statusOptions = [{
|
|
@@ -7801,7 +8372,13 @@ const SearchFillingPointAddress = () => {
|
|
|
7801
8372
|
style: {
|
|
7802
8373
|
width: isMobile ? "50%" : "auto"
|
|
7803
8374
|
}
|
|
7804
|
-
}, t("WT_FILLING_POINT"))
|
|
8375
|
+
}, t("WT_FILLING_POINT")), /*#__PURE__*/React.createElement("button", {
|
|
8376
|
+
className: selectedTab === "VIEW_ON_MAP" ? "search-tab-head-selected" : "search-tab-head",
|
|
8377
|
+
onClick: () => onTabChange("VIEW_ON_MAP"),
|
|
8378
|
+
style: {
|
|
8379
|
+
width: isMobile ? "50%" : "auto"
|
|
8380
|
+
}
|
|
8381
|
+
}, t("WT_VIEW_ON_MAP"))), /*#__PURE__*/React.createElement("div", {
|
|
7805
8382
|
className: "action-bar-wrap-registry",
|
|
7806
8383
|
style: {
|
|
7807
8384
|
alignSelf: isMobile ? "flex-end" : "auto"
|
|
@@ -7816,7 +8393,7 @@ const SearchFillingPointAddress = () => {
|
|
|
7816
8393
|
options: ["FIXED_POINT", "FILLING_POINT"],
|
|
7817
8394
|
t: t,
|
|
7818
8395
|
onSelect: onActionSelect
|
|
7819
|
-
}))), /*#__PURE__*/React.createElement("div", {
|
|
8396
|
+
}))), selectedTab !== "VIEW_ON_MAP" && /*#__PURE__*/React.createElement("div", {
|
|
7820
8397
|
className: "finance-mainlayout"
|
|
7821
8398
|
}, /*#__PURE__*/React.createElement("div", {
|
|
7822
8399
|
className: "finance-mainlayout-col1"
|
|
@@ -7872,7 +8449,12 @@ const SearchFillingPointAddress = () => {
|
|
|
7872
8449
|
}, /*#__PURE__*/React.createElement(Label, null, "\xA0"), /*#__PURE__*/React.createElement(SubmitBar, {
|
|
7873
8450
|
label: t("ES_COMMON_SEARCH"),
|
|
7874
8451
|
onSubmit: onSearch
|
|
7875
|
-
})))), /*#__PURE__*/React.createElement(Card, null, /*#__PURE__*/React.createElement(
|
|
8452
|
+
})))), selectedTab === "VIEW_ON_MAP" ? /*#__PURE__*/React.createElement(Card, null, /*#__PURE__*/React.createElement(PointAddressMap, {
|
|
8453
|
+
fillingPoints: allFillingPoints,
|
|
8454
|
+
fixedPoints: allFixedPoints,
|
|
8455
|
+
isLoading: isAllFillingPointsLoading || isAllFixedPointsLoading,
|
|
8456
|
+
t: t
|
|
8457
|
+
})) : /*#__PURE__*/React.createElement(Card, null, /*#__PURE__*/React.createElement(ApplicationTable, {
|
|
7876
8458
|
key: (allFillingPoints === null || allFillingPoints === void 0 ? void 0 : allFillingPoints.length) > 0 ? "loaded" : "loading",
|
|
7877
8459
|
data: tableData,
|
|
7878
8460
|
columns: columns,
|
|
@@ -24978,10 +25560,10 @@ const ApplicationDetails$1 = () => {
|
|
|
24978
25560
|
applicationData: appDetailsToShow === null || appDetailsToShow === void 0 ? void 0 : (_appDetailsToShow$app = appDetailsToShow.applicationData) === null || _appDetailsToShow$app === void 0 ? void 0 : _appDetailsToShow$app.applicationData,
|
|
24979
25561
|
closeModal: () => setShowEditModal(false)
|
|
24980
25562
|
}), /*#__PURE__*/React.createElement("div", {
|
|
24981
|
-
className: `workflow-timeline-wrapper ${hideTimeline ? "hide-workflow" : ""}`,
|
|
25563
|
+
className: `workflow-timeline-wrapper no-scrollbar ${hideTimeline ? "hide-workflow" : ""}`,
|
|
24982
25564
|
style: {
|
|
24983
25565
|
flex: "1 1 300px",
|
|
24984
|
-
maxWidth: hideTimeline ? "
|
|
25566
|
+
maxWidth: hideTimeline ? "fit-content" : "400px",
|
|
24985
25567
|
transition: "max-width 0.3s"
|
|
24986
25568
|
}
|
|
24987
25569
|
}, /*#__PURE__*/React.createElement(WorkflowTimeline, {
|
|
@@ -28114,16 +28696,6 @@ const WTModule = ({
|
|
|
28114
28696
|
path,
|
|
28115
28697
|
url
|
|
28116
28698
|
} = useRouteMatch();
|
|
28117
|
-
const moduleCode = "WT";
|
|
28118
|
-
const language = Digit.StoreData.getCurrentLanguage();
|
|
28119
|
-
const {
|
|
28120
|
-
isLoading,
|
|
28121
|
-
data: store
|
|
28122
|
-
} = Digit.Services.useStore({
|
|
28123
|
-
stateCode,
|
|
28124
|
-
moduleCode,
|
|
28125
|
-
language
|
|
28126
|
-
});
|
|
28127
28699
|
Digit.SessionStorage.set("WT_TENANTS", tenants);
|
|
28128
28700
|
useEffect(() => userType === "employee" && Digit.LocalizationService.getLocale({
|
|
28129
28701
|
modules: [`rainmaker-${Digit.ULBService.getCurrentTenantId()}`],
|
|
@@ -28145,7 +28717,7 @@ const WTLinks = ({
|
|
|
28145
28717
|
const {
|
|
28146
28718
|
t
|
|
28147
28719
|
} = useTranslation();
|
|
28148
|
-
const [
|
|
28720
|
+
const [,, clearParams] = Digit.Hooks.useSessionStorage("WT", {});
|
|
28149
28721
|
useEffect(() => {
|
|
28150
28722
|
clearParams();
|
|
28151
28723
|
}, []);
|