@djb25/digit-ui-module-wt 1.0.10 → 1.0.12
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.css +87 -0
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +3133 -298
- package/dist/index.modern.js.map +1 -1
- package/package.json +36 -33
package/dist/index.modern.js
CHANGED
|
@@ -1,125 +1,129 @@
|
|
|
1
|
-
import { TickMark, ArrowDown, MobileNumber, CardLabelError, TextInput, Dropdown, DatePicker, SubmitBar, Card, Table, Loader, Toast, AppContainer, BackButton, PrivateRoute, KeyNote, Modal, CardHeader, CardText, FormStep, CardLabel, RadioButtons, UploadFile, TextArea, CheckBox, CardSubHeader, StatusTable, Row, GenericFileIcon, LinkButton, EditIcon, Banner, CHBIcon, EmployeeModuleCard, HomeIcon, CloseSvg, Label, LinkLabel, ActionBar, DetailsCard, SearchAction, FilterAction, PopUp, ShippingTruck, ModuleHeader, ArrowLeft, Header, TelePhone, DisplayPhotos, CardSectionHeader, CheckPoint, ConnectingCheckPoints, MultiLink, Localities, RemoveableTag, FormComposer, PDFSvg,
|
|
1
|
+
import { TickMark, ArrowDown, MobileNumber, CardLabelError, TextInput, Dropdown, DatePicker, SubmitBar, Card, Table, Loader, Toast, AppContainer, BackButton, PrivateRoute, KeyNote, Modal, CardHeader, CardText, FormStep, CardLabel, RadioButtons, UploadFile, TextArea, CheckBox, CardSubHeader, StatusTable, Row, GenericFileIcon, LinkButton, EditIcon, Banner, CHBIcon, EmployeeModuleCard, HomeIcon, CloseSvg, Label, LinkLabel, ActionBar, DetailsCard, SearchAction, FilterAction, PopUp, ShippingTruck, LabelFieldPair, AddressDetails, AddIcon, Menu, ModuleHeader, ArrowLeft, Header, TelePhone, DisplayPhotos, CardSectionHeader, CheckPoint, ConnectingCheckPoints, MultiLink, Localities, RemoveableTag, FormComposer, PDFSvg, MultiUploadWrapper, Close as Close$g, BreakLine, InfoBannerIcon, ViewsIcon, ButtonSelector, LocationIcon, CitizenHomeCard, PTIcon, ApplicantDetails } from '@djb25/digit-ui-react-components';
|
|
2
2
|
import React, { useState, useMemo, useCallback, useEffect, Fragment, useRef } from 'react';
|
|
3
3
|
import { useTranslation } from 'react-i18next';
|
|
4
4
|
import { useLocation, useHistory, useRouteMatch, Switch, Route, Redirect, Link, useParams } from 'react-router-dom';
|
|
5
5
|
import { useQueryClient } from 'react-query';
|
|
6
6
|
import { useForm, Controller } from 'react-hook-form';
|
|
7
|
+
import { io } from 'socket.io-client';
|
|
8
|
+
import { MapContainer, TileLayer, Marker, Popup, useMap, Polyline } from 'react-leaflet';
|
|
9
|
+
import L from 'leaflet';
|
|
10
|
+
import 'leaflet/dist/leaflet.css';
|
|
7
11
|
|
|
8
12
|
const commonConfig = [{
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
13
|
+
head: "ES_TITILE_OWNER_DETAILS",
|
|
14
|
+
body: [{
|
|
15
|
+
route: "service-type",
|
|
16
|
+
component: "ServiceTypes",
|
|
17
|
+
withoutLabel: true,
|
|
18
|
+
key: "serviceType",
|
|
19
|
+
type: "component",
|
|
20
|
+
nextStep: "info",
|
|
21
|
+
hideInEmployee: true,
|
|
22
|
+
isMandatory: true,
|
|
23
|
+
texts: {
|
|
24
|
+
submitBarLabel: "COMMON_SAVE_NEXT"
|
|
21
25
|
}
|
|
22
26
|
}, {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
+
route: "info",
|
|
28
|
+
component: "InfoPage",
|
|
29
|
+
nextStep: "applicant-details",
|
|
30
|
+
key: "infodetails"
|
|
27
31
|
}, {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
32
|
+
route: "applicant-details",
|
|
33
|
+
component: "ApplicantDetails",
|
|
34
|
+
withoutLabel: true,
|
|
35
|
+
key: "owner",
|
|
36
|
+
type: "component",
|
|
37
|
+
nextStep: "address-details",
|
|
38
|
+
hideInEmployee: true,
|
|
39
|
+
isMandatory: true,
|
|
40
|
+
texts: {
|
|
41
|
+
submitBarLabel: "COMMON_SAVE_NEXT",
|
|
42
|
+
header: "ES_APPLICANT_DETAILS"
|
|
39
43
|
},
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
44
|
+
timeLine: [{
|
|
45
|
+
currentStep: 1,
|
|
46
|
+
actions: "ES_APPLICANT_DETAILS"
|
|
43
47
|
}]
|
|
44
48
|
}]
|
|
45
49
|
}, {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
50
|
+
head: "ES_TITLE_ADDRESS_DETAILS",
|
|
51
|
+
body: [{
|
|
52
|
+
route: "address-details",
|
|
53
|
+
component: "AddressDetails",
|
|
54
|
+
withoutLabel: true,
|
|
55
|
+
key: "address",
|
|
56
|
+
type: "component",
|
|
57
|
+
isMandatory: true,
|
|
58
|
+
hideInEmployee: true,
|
|
59
|
+
nextStep: "request-details",
|
|
60
|
+
texts: {
|
|
61
|
+
submitBarLabel: "COMMON_SAVE_NEXT",
|
|
62
|
+
header: "ES_ADDRESS_DETAILS"
|
|
59
63
|
},
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
64
|
+
timeLine: [{
|
|
65
|
+
currentStep: 2,
|
|
66
|
+
actions: "ES_ADDRESS_DETAILS"
|
|
63
67
|
}]
|
|
64
68
|
}]
|
|
65
69
|
}, {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
70
|
+
head: "ES_REQUEST_DETAILS",
|
|
71
|
+
body: [{
|
|
72
|
+
route: "request-details",
|
|
73
|
+
component: "RequestDetails",
|
|
74
|
+
withoutLabel: true,
|
|
75
|
+
key: "requestDetails",
|
|
76
|
+
type: "component",
|
|
77
|
+
isMandatory: true,
|
|
78
|
+
hideInEmployee: true,
|
|
79
|
+
nextStep: null,
|
|
80
|
+
texts: {
|
|
81
|
+
submitBarLabel: "COMMON_SAVE_NEXT",
|
|
82
|
+
header: "WT_REQUEST_DETAILS"
|
|
79
83
|
},
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
84
|
+
timeLine: [{
|
|
85
|
+
currentStep: 3,
|
|
86
|
+
actions: "ES_REQUEST_DETAILS"
|
|
83
87
|
}]
|
|
84
88
|
}]
|
|
85
89
|
}, {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
90
|
+
head: "ES_TOILET_REQUEST_DETAILS",
|
|
91
|
+
body: [{
|
|
92
|
+
route: "toiletRequest-details",
|
|
93
|
+
component: "ToiletRequestDetails",
|
|
94
|
+
withoutLabel: true,
|
|
95
|
+
key: "toiletRequestDetails",
|
|
96
|
+
type: "component",
|
|
97
|
+
isMandatory: true,
|
|
98
|
+
hideInEmployee: true,
|
|
99
|
+
nextStep: null,
|
|
100
|
+
texts: {
|
|
101
|
+
submitBarLabel: "COMMON_SAVE_NEXT",
|
|
102
|
+
header: "MT_REQUEST_DETAILS"
|
|
99
103
|
},
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
104
|
+
timeLine: [{
|
|
105
|
+
currentStep: 3,
|
|
106
|
+
actions: "ES_TOILET_REQUEST_DETAILS"
|
|
103
107
|
}]
|
|
104
108
|
}]
|
|
105
109
|
}, {
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
110
|
+
head: "ES_TREE_PRUNING_REQUEST_DETAILS",
|
|
111
|
+
body: [{
|
|
112
|
+
route: "treePruningRequest-details",
|
|
113
|
+
component: "TreePruningRequestDetails",
|
|
114
|
+
withoutLabel: true,
|
|
115
|
+
key: "treePruningRequestDetails",
|
|
116
|
+
type: "component",
|
|
117
|
+
isMandatory: true,
|
|
118
|
+
hideInEmployee: true,
|
|
119
|
+
nextStep: null,
|
|
120
|
+
texts: {
|
|
121
|
+
submitBarLabel: "COMMON_SAVE_NEXT",
|
|
122
|
+
header: "TP_REQUEST_DETAILS"
|
|
119
123
|
},
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
124
|
+
timeLine: [{
|
|
125
|
+
currentStep: 3,
|
|
126
|
+
actions: "ES_TREE_PRUNING_REQUEST_DETAILS"
|
|
123
127
|
}]
|
|
124
128
|
}]
|
|
125
129
|
}];
|
|
@@ -182,7 +186,7 @@ const VerticalTimeline = ({
|
|
|
182
186
|
};
|
|
183
187
|
|
|
184
188
|
const WTCreate = () => {
|
|
185
|
-
var _Digit, _Digit$ComponentRegis, _Digit2, _Digit2$ComponentRegi, _Digit3, _Digit3$ComponentRegi, _Digit4, _Digit4$ComponentRegi;
|
|
189
|
+
var _userInfo$info, _Digit, _Digit$ComponentRegis, _Digit2, _Digit2$ComponentRegi, _Digit3, _Digit3$ComponentRegi, _Digit4, _Digit4$ComponentRegi;
|
|
186
190
|
const queryClient = useQueryClient();
|
|
187
191
|
const match = useRouteMatch();
|
|
188
192
|
const {
|
|
@@ -194,9 +198,19 @@ const WTCreate = () => {
|
|
|
194
198
|
const history = useHistory();
|
|
195
199
|
let config = [];
|
|
196
200
|
const [params, setParams, clearParams] = Digit.Hooks.useSessionStorage("WT_Create", {});
|
|
201
|
+
const userInfo = Digit.UserService.getUser();
|
|
202
|
+
const tenantId = Digit.ULBService.getCurrentTenantId();
|
|
203
|
+
const uuid = userInfo === null || userInfo === void 0 ? void 0 : (_userInfo$info = userInfo.info) === null || _userInfo$info === void 0 ? void 0 : _userInfo$info.uuid;
|
|
204
|
+
const {
|
|
205
|
+
data: userDetails,
|
|
206
|
+
isLoading: isUserLoading
|
|
207
|
+
} = Digit.Hooks.useUserSearch(tenantId, {
|
|
208
|
+
uuid: [uuid]
|
|
209
|
+
}, {}, {
|
|
210
|
+
enabled: uuid ? true : false
|
|
211
|
+
});
|
|
197
212
|
if ((!params.serviceType || Object.keys(params.serviceType).length === 0) && pathname.includes("employee")) {
|
|
198
213
|
if (pathname.includes("mt")) {
|
|
199
|
-
console.log("MT Create");
|
|
200
214
|
setParams({
|
|
201
215
|
serviceType: {
|
|
202
216
|
serviceType: {
|
|
@@ -359,6 +373,7 @@ const WTCreate = () => {
|
|
|
359
373
|
overflowY: "auto"
|
|
360
374
|
}
|
|
361
375
|
}, /*#__PURE__*/React.createElement(Switch, null, config.map((routeObj, index) => {
|
|
376
|
+
var _userDetails$user;
|
|
362
377
|
const {
|
|
363
378
|
component,
|
|
364
379
|
texts,
|
|
@@ -379,7 +394,8 @@ const WTCreate = () => {
|
|
|
379
394
|
},
|
|
380
395
|
onSelect: handleSelect,
|
|
381
396
|
t: t,
|
|
382
|
-
formData: params
|
|
397
|
+
formData: params,
|
|
398
|
+
userDetails: userDetails === null || userDetails === void 0 ? void 0 : (_userDetails$user = userDetails.user) === null || _userDetails$user === void 0 ? void 0 : _userDetails$user[0]
|
|
383
399
|
}));
|
|
384
400
|
}), /*#__PURE__*/React.createElement(Route, {
|
|
385
401
|
path: `${match.path}/check`
|
|
@@ -426,7 +442,7 @@ const formatDate = dateString => {
|
|
|
426
442
|
};
|
|
427
443
|
const APPLICATION_PATH = "/digit-ui";
|
|
428
444
|
const waterTankerPayload = data => {
|
|
429
|
-
var _data$requestDetails, _data$requestDetails$, _data$requestDetails2, _data$requestDetails3, _data$requestDetails4, _data$requestDetails5, _data$requestDetails6, _data$requestDetails7, _data$requestDetails8, _data$requestDetails9, _data$requestDetails0, _data$requestDetails1, _data$address, _data$owner, _data$owner2, _data$owner3, _data$owner4, _data$address2, _data$address2$addres, _data$address3, _data$address4, _data$address4$city, _data$address4$city$c, _data$address5, _data$address5$city, _data$address5$city$c, _data$address6, _data$address7, _data$address8, _data$address8$locali, _data$address9, _data$address9$locali, _data$address0, _data$address1, _data$address10, _data$requestDetails10;
|
|
445
|
+
var _data$requestDetails, _data$requestDetails$, _data$requestDetails2, _data$requestDetails3, _data$requestDetails4, _data$requestDetails5, _data$requestDetails6, _data$requestDetails7, _data$requestDetails8, _data$requestDetails9, _data$requestDetails0, _data$requestDetails1, _data$address, _data$owner, _data$owner2, _data$owner3, _data$owner4, _data$address2, _data$address2$addres, _data$address3, _data$address4, _data$address4$city, _data$address4$city$c, _data$address5, _data$address5$city, _data$address5$city$c, _data$address6, _data$address7, _data$address8, _data$address8$locali, _data$address9, _data$address9$locali, _data$address0, _data$address1, _data$address10, _data$address11, _data$address12, _data$requestDetails10;
|
|
430
446
|
const formdata = {
|
|
431
447
|
waterTankerBookingDetail: {
|
|
432
448
|
tenantId: data === null || data === void 0 ? void 0 : data.tenantId,
|
|
@@ -456,7 +472,9 @@ const waterTankerPayload = data => {
|
|
|
456
472
|
localityCode: data === null || data === void 0 ? void 0 : (_data$address9 = data.address) === null || _data$address9 === void 0 ? void 0 : (_data$address9$locali = _data$address9.locality) === null || _data$address9$locali === void 0 ? void 0 : _data$address9$locali.code,
|
|
457
473
|
streetName: data === null || data === void 0 ? void 0 : (_data$address0 = data.address) === null || _data$address0 === void 0 ? void 0 : _data$address0.streetName,
|
|
458
474
|
houseNo: data === null || data === void 0 ? void 0 : (_data$address1 = data.address) === null || _data$address1 === void 0 ? void 0 : _data$address1.houseNo,
|
|
459
|
-
landmark: data === null || data === void 0 ? void 0 : (_data$address10 = data.address) === null || _data$address10 === void 0 ? void 0 : _data$address10.landmark
|
|
475
|
+
landmark: data === null || data === void 0 ? void 0 : (_data$address10 = data.address) === null || _data$address10 === void 0 ? void 0 : _data$address10.landmark,
|
|
476
|
+
latitude: data === null || data === void 0 ? void 0 : (_data$address11 = data.address) === null || _data$address11 === void 0 ? void 0 : _data$address11.latitude,
|
|
477
|
+
longitude: data === null || data === void 0 ? void 0 : (_data$address12 = data.address) === null || _data$address12 === void 0 ? void 0 : _data$address12.longitude
|
|
460
478
|
},
|
|
461
479
|
WTfileStoreId: data === null || data === void 0 ? void 0 : (_data$requestDetails10 = data.requestDetails) === null || _data$requestDetails10 === void 0 ? void 0 : _data$requestDetails10.fileStoreId,
|
|
462
480
|
bookingStatus: "BOOKING_CREATED",
|
|
@@ -471,7 +489,7 @@ const waterTankerPayload = data => {
|
|
|
471
489
|
return formdata;
|
|
472
490
|
};
|
|
473
491
|
const mobileToiletPayload = data => {
|
|
474
|
-
var _data$toiletRequestDe, _data$toiletRequestDe2, _data$toiletRequestDe3, _data$toiletRequestDe4, _data$toiletRequestDe5, _data$toiletRequestDe6, _data$toiletRequestDe7, _data$
|
|
492
|
+
var _data$toiletRequestDe, _data$toiletRequestDe2, _data$toiletRequestDe3, _data$toiletRequestDe4, _data$toiletRequestDe5, _data$toiletRequestDe6, _data$toiletRequestDe7, _data$address13, _data$owner5, _data$owner6, _data$owner7, _data$owner8, _data$address14, _data$address14$addre, _data$address15, _data$address16, _data$address16$city, _data$address16$city$, _data$address17, _data$address17$city, _data$address17$city$, _data$address18, _data$address19, _data$address20, _data$address20$local, _data$address21, _data$address21$local, _data$address22, _data$address23, _data$address24;
|
|
475
493
|
const formdata = {
|
|
476
494
|
mobileToiletBookingDetail: {
|
|
477
495
|
tenantId: data === null || data === void 0 ? void 0 : data.tenantId,
|
|
@@ -481,7 +499,7 @@ const mobileToiletPayload = data => {
|
|
|
481
499
|
deliveryToDate: data === null || data === void 0 ? void 0 : (_data$toiletRequestDe5 = data.toiletRequestDetails) === null || _data$toiletRequestDe5 === void 0 ? void 0 : _data$toiletRequestDe5.deliverytoDate,
|
|
482
500
|
deliveryFromTime: data === null || data === void 0 ? void 0 : (_data$toiletRequestDe6 = data.toiletRequestDetails) === null || _data$toiletRequestDe6 === void 0 ? void 0 : _data$toiletRequestDe6.deliveryfromTime,
|
|
483
501
|
deliveryToTime: data === null || data === void 0 ? void 0 : (_data$toiletRequestDe7 = data.toiletRequestDetails) === null || _data$toiletRequestDe7 === void 0 ? void 0 : _data$toiletRequestDe7.deliverytoTime,
|
|
484
|
-
addressDetailId: (data === null || data === void 0 ? void 0 : (_data$
|
|
502
|
+
addressDetailId: (data === null || data === void 0 ? void 0 : (_data$address13 = data.address) === null || _data$address13 === void 0 ? void 0 : _data$address13.addressDetailId) || "",
|
|
485
503
|
applicantDetail: {
|
|
486
504
|
name: data === null || data === void 0 ? void 0 : (_data$owner5 = data.owner) === null || _data$owner5 === void 0 ? void 0 : _data$owner5.applicantName,
|
|
487
505
|
mobileNumber: data === null || data === void 0 ? void 0 : (_data$owner6 = data.owner) === null || _data$owner6 === void 0 ? void 0 : _data$owner6.mobileNumber,
|
|
@@ -489,17 +507,17 @@ const mobileToiletPayload = data => {
|
|
|
489
507
|
emailId: data === null || data === void 0 ? void 0 : (_data$owner8 = data.owner) === null || _data$owner8 === void 0 ? void 0 : _data$owner8.emailId
|
|
490
508
|
},
|
|
491
509
|
address: {
|
|
492
|
-
addressType: data === null || data === void 0 ? void 0 : (_data$
|
|
493
|
-
pincode: data === null || data === void 0 ? void 0 : (_data$
|
|
494
|
-
city: data === null || data === void 0 ? void 0 : (_data$
|
|
495
|
-
cityCode: data === null || data === void 0 ? void 0 : (_data$
|
|
496
|
-
addressLine1: data === null || data === void 0 ? void 0 : (_data$
|
|
497
|
-
addressLine2: data === null || data === void 0 ? void 0 : (_data$
|
|
498
|
-
locality: data === null || data === void 0 ? void 0 : (_data$
|
|
499
|
-
localityCode: data === null || data === void 0 ? void 0 : (_data$
|
|
500
|
-
streetName: data === null || data === void 0 ? void 0 : (_data$
|
|
501
|
-
houseNo: data === null || data === void 0 ? void 0 : (_data$
|
|
502
|
-
landmark: data === null || data === void 0 ? void 0 : (_data$
|
|
510
|
+
addressType: data === null || data === void 0 ? void 0 : (_data$address14 = data.address) === null || _data$address14 === void 0 ? void 0 : (_data$address14$addre = _data$address14.addressType) === null || _data$address14$addre === void 0 ? void 0 : _data$address14$addre.code,
|
|
511
|
+
pincode: data === null || data === void 0 ? void 0 : (_data$address15 = data.address) === null || _data$address15 === void 0 ? void 0 : _data$address15.pincode,
|
|
512
|
+
city: data === null || data === void 0 ? void 0 : (_data$address16 = data.address) === null || _data$address16 === void 0 ? void 0 : (_data$address16$city = _data$address16.city) === null || _data$address16$city === void 0 ? void 0 : (_data$address16$city$ = _data$address16$city.city) === null || _data$address16$city$ === void 0 ? void 0 : _data$address16$city$.name,
|
|
513
|
+
cityCode: data === null || data === void 0 ? void 0 : (_data$address17 = data.address) === null || _data$address17 === void 0 ? void 0 : (_data$address17$city = _data$address17.city) === null || _data$address17$city === void 0 ? void 0 : (_data$address17$city$ = _data$address17$city.city) === null || _data$address17$city$ === void 0 ? void 0 : _data$address17$city$.code,
|
|
514
|
+
addressLine1: data === null || data === void 0 ? void 0 : (_data$address18 = data.address) === null || _data$address18 === void 0 ? void 0 : _data$address18.addressLine1,
|
|
515
|
+
addressLine2: data === null || data === void 0 ? void 0 : (_data$address19 = data.address) === null || _data$address19 === void 0 ? void 0 : _data$address19.addressLine2,
|
|
516
|
+
locality: data === null || data === void 0 ? void 0 : (_data$address20 = data.address) === null || _data$address20 === void 0 ? void 0 : (_data$address20$local = _data$address20.locality) === null || _data$address20$local === void 0 ? void 0 : _data$address20$local.i18nKey,
|
|
517
|
+
localityCode: data === null || data === void 0 ? void 0 : (_data$address21 = data.address) === null || _data$address21 === void 0 ? void 0 : (_data$address21$local = _data$address21.locality) === null || _data$address21$local === void 0 ? void 0 : _data$address21$local.code,
|
|
518
|
+
streetName: data === null || data === void 0 ? void 0 : (_data$address22 = data.address) === null || _data$address22 === void 0 ? void 0 : _data$address22.streetName,
|
|
519
|
+
houseNo: data === null || data === void 0 ? void 0 : (_data$address23 = data.address) === null || _data$address23 === void 0 ? void 0 : _data$address23.houseNo,
|
|
520
|
+
landmark: data === null || data === void 0 ? void 0 : (_data$address24 = data.address) === null || _data$address24 === void 0 ? void 0 : _data$address24.landmark
|
|
503
521
|
},
|
|
504
522
|
bookingStatus: "BOOKING_CREATED",
|
|
505
523
|
workflow: {
|
|
@@ -513,7 +531,7 @@ const mobileToiletPayload = data => {
|
|
|
513
531
|
return formdata;
|
|
514
532
|
};
|
|
515
533
|
const treePruningPayload = data => {
|
|
516
|
-
var _data$treePruningRequ, _data$treePruningRequ2, _data$treePruningRequ3, _data$treePruningRequ4, _data$owner9, _data$owner0, _data$owner1, _data$owner10, _data$treePruningRequ5, _data$
|
|
534
|
+
var _data$treePruningRequ, _data$treePruningRequ2, _data$treePruningRequ3, _data$treePruningRequ4, _data$owner9, _data$owner0, _data$owner1, _data$owner10, _data$treePruningRequ5, _data$address25, _data$address25$addre, _data$address26, _data$address27, _data$address27$city, _data$address27$city$, _data$address28, _data$address28$city, _data$address28$city$, _data$address29, _data$address30, _data$address31, _data$address31$local, _data$address32, _data$address32$local, _data$address33, _data$address34, _data$address35;
|
|
517
535
|
const formdata = {
|
|
518
536
|
treePruningBookingDetail: {
|
|
519
537
|
tenantId: data === null || data === void 0 ? void 0 : data.tenantId,
|
|
@@ -531,17 +549,17 @@ const treePruningPayload = data => {
|
|
|
531
549
|
fileStoreId: data === null || data === void 0 ? void 0 : (_data$treePruningRequ5 = data.treePruningRequestDetails) === null || _data$treePruningRequ5 === void 0 ? void 0 : _data$treePruningRequ5.supportingDocumentFile
|
|
532
550
|
}],
|
|
533
551
|
address: {
|
|
534
|
-
addressType: data === null || data === void 0 ? void 0 : (_data$
|
|
535
|
-
pincode: data === null || data === void 0 ? void 0 : (_data$
|
|
536
|
-
city: data === null || data === void 0 ? void 0 : (_data$
|
|
537
|
-
cityCode: data === null || data === void 0 ? void 0 : (_data$
|
|
538
|
-
addressLine1: data === null || data === void 0 ? void 0 : (_data$
|
|
539
|
-
addressLine2: data === null || data === void 0 ? void 0 : (_data$
|
|
540
|
-
locality: data === null || data === void 0 ? void 0 : (_data$
|
|
541
|
-
localityCode: data === null || data === void 0 ? void 0 : (_data$
|
|
542
|
-
streetName: data === null || data === void 0 ? void 0 : (_data$
|
|
543
|
-
houseNo: data === null || data === void 0 ? void 0 : (_data$
|
|
544
|
-
landmark: data === null || data === void 0 ? void 0 : (_data$
|
|
552
|
+
addressType: data === null || data === void 0 ? void 0 : (_data$address25 = data.address) === null || _data$address25 === void 0 ? void 0 : (_data$address25$addre = _data$address25.addressType) === null || _data$address25$addre === void 0 ? void 0 : _data$address25$addre.code,
|
|
553
|
+
pincode: data === null || data === void 0 ? void 0 : (_data$address26 = data.address) === null || _data$address26 === void 0 ? void 0 : _data$address26.pincode,
|
|
554
|
+
city: data === null || data === void 0 ? void 0 : (_data$address27 = data.address) === null || _data$address27 === void 0 ? void 0 : (_data$address27$city = _data$address27.city) === null || _data$address27$city === void 0 ? void 0 : (_data$address27$city$ = _data$address27$city.city) === null || _data$address27$city$ === void 0 ? void 0 : _data$address27$city$.name,
|
|
555
|
+
cityCode: data === null || data === void 0 ? void 0 : (_data$address28 = data.address) === null || _data$address28 === void 0 ? void 0 : (_data$address28$city = _data$address28.city) === null || _data$address28$city === void 0 ? void 0 : (_data$address28$city$ = _data$address28$city.city) === null || _data$address28$city$ === void 0 ? void 0 : _data$address28$city$.code,
|
|
556
|
+
addressLine1: data === null || data === void 0 ? void 0 : (_data$address29 = data.address) === null || _data$address29 === void 0 ? void 0 : _data$address29.addressLine1,
|
|
557
|
+
addressLine2: data === null || data === void 0 ? void 0 : (_data$address30 = data.address) === null || _data$address30 === void 0 ? void 0 : _data$address30.addressLine2,
|
|
558
|
+
locality: data === null || data === void 0 ? void 0 : (_data$address31 = data.address) === null || _data$address31 === void 0 ? void 0 : (_data$address31$local = _data$address31.locality) === null || _data$address31$local === void 0 ? void 0 : _data$address31$local.i18nKey,
|
|
559
|
+
localityCode: data === null || data === void 0 ? void 0 : (_data$address32 = data.address) === null || _data$address32 === void 0 ? void 0 : (_data$address32$local = _data$address32.locality) === null || _data$address32$local === void 0 ? void 0 : _data$address32$local.code,
|
|
560
|
+
streetName: data === null || data === void 0 ? void 0 : (_data$address33 = data.address) === null || _data$address33 === void 0 ? void 0 : _data$address33.streetName,
|
|
561
|
+
houseNo: data === null || data === void 0 ? void 0 : (_data$address34 = data.address) === null || _data$address34 === void 0 ? void 0 : _data$address34.houseNo,
|
|
562
|
+
landmark: data === null || data === void 0 ? void 0 : (_data$address35 = data.address) === null || _data$address35 === void 0 ? void 0 : _data$address35.landmark
|
|
545
563
|
},
|
|
546
564
|
bookingStatus: "BOOKING_CREATED",
|
|
547
565
|
workflow: {
|
|
@@ -554,6 +572,78 @@ const treePruningPayload = data => {
|
|
|
554
572
|
};
|
|
555
573
|
return formdata;
|
|
556
574
|
};
|
|
575
|
+
const fillingPointPayload = data => {
|
|
576
|
+
var _data$owner11, _data$owner12, _data$owner13, _data$owner14, _data$owner15, _data$owner16, _data$owner17, _data$owner18, _data$owner19, _data$address36, _data$address36$addre, _data$address37, _data$address38, _data$address38$city, _data$address39, _data$address40, _data$address40$city, _data$address41, _data$address42, _data$address42$local, _data$address43, _data$address43$local, _data$address44, _data$address45, _data$address45$local, _data$address46, _data$address47, _data$address48, _data$address49, _data$address50, _data$address51, _data$address52, _data$address53, _data$address54;
|
|
577
|
+
const formdata = {
|
|
578
|
+
waterTankerBookingDetail: {
|
|
579
|
+
tenantId: data === null || data === void 0 ? void 0 : data.tenantId,
|
|
580
|
+
bookingId: (data === null || data === void 0 ? void 0 : data.bookingId) || "",
|
|
581
|
+
auditDetails: (data === null || data === void 0 ? void 0 : data.auditDetails) || null,
|
|
582
|
+
fillingpointmetadata: {
|
|
583
|
+
name: data === null || data === void 0 ? void 0 : (_data$owner11 = data.owner) === null || _data$owner11 === void 0 ? void 0 : _data$owner11.name,
|
|
584
|
+
mobileNumber: data === null || data === void 0 ? void 0 : (_data$owner12 = data.owner) === null || _data$owner12 === void 0 ? void 0 : _data$owner12.mobileNumber,
|
|
585
|
+
emailId: data === null || data === void 0 ? void 0 : (_data$owner13 = data.owner) === null || _data$owner13 === void 0 ? void 0 : _data$owner13.emailId,
|
|
586
|
+
jeName: data === null || data === void 0 ? void 0 : (_data$owner14 = data.owner) === null || _data$owner14 === void 0 ? void 0 : _data$owner14.jeName,
|
|
587
|
+
jeMobileNumber: data === null || data === void 0 ? void 0 : (_data$owner15 = data.owner) === null || _data$owner15 === void 0 ? void 0 : _data$owner15.jeMobileNumber,
|
|
588
|
+
jeEmailId: data === null || data === void 0 ? void 0 : (_data$owner16 = data.owner) === null || _data$owner16 === void 0 ? void 0 : _data$owner16.jeEmailId,
|
|
589
|
+
eeName: data === null || data === void 0 ? void 0 : (_data$owner17 = data.owner) === null || _data$owner17 === void 0 ? void 0 : _data$owner17.eeName,
|
|
590
|
+
eeMobileNumber: data === null || data === void 0 ? void 0 : (_data$owner18 = data.owner) === null || _data$owner18 === void 0 ? void 0 : _data$owner18.eeMobileNumber,
|
|
591
|
+
eeEmailId: data === null || data === void 0 ? void 0 : (_data$owner19 = data.owner) === null || _data$owner19 === void 0 ? void 0 : _data$owner19.eeEmailId,
|
|
592
|
+
type: "FILLING-POINT"
|
|
593
|
+
},
|
|
594
|
+
address: {
|
|
595
|
+
addressType: (data === null || data === void 0 ? void 0 : (_data$address36 = data.address) === null || _data$address36 === void 0 ? void 0 : (_data$address36$addre = _data$address36.addressType) === null || _data$address36$addre === void 0 ? void 0 : _data$address36$addre.code) || (data === null || data === void 0 ? void 0 : (_data$address37 = data.address) === null || _data$address37 === void 0 ? void 0 : _data$address37.addressType) || "",
|
|
596
|
+
type: "FILLING-POINT",
|
|
597
|
+
city: (data === null || data === void 0 ? void 0 : (_data$address38 = data.address) === null || _data$address38 === void 0 ? void 0 : (_data$address38$city = _data$address38.city) === null || _data$address38$city === void 0 ? void 0 : _data$address38$city.name) || (data === null || data === void 0 ? void 0 : (_data$address39 = data.address) === null || _data$address39 === void 0 ? void 0 : _data$address39.city) || "",
|
|
598
|
+
cityCode: (data === null || data === void 0 ? void 0 : (_data$address40 = data.address) === null || _data$address40 === void 0 ? void 0 : (_data$address40$city = _data$address40.city) === null || _data$address40$city === void 0 ? void 0 : _data$address40$city.code) || (data === null || data === void 0 ? void 0 : (_data$address41 = data.address) === null || _data$address41 === void 0 ? void 0 : _data$address41.cityCode) || "",
|
|
599
|
+
locality: (data === null || data === void 0 ? void 0 : (_data$address42 = data.address) === null || _data$address42 === void 0 ? void 0 : (_data$address42$local = _data$address42.locality) === null || _data$address42$local === void 0 ? void 0 : _data$address42$local.name) || (data === null || data === void 0 ? void 0 : (_data$address43 = data.address) === null || _data$address43 === void 0 ? void 0 : (_data$address43$local = _data$address43.locality) === null || _data$address43$local === void 0 ? void 0 : _data$address43$local.label) || (data === null || data === void 0 ? void 0 : (_data$address44 = data.address) === null || _data$address44 === void 0 ? void 0 : _data$address44.locality) || "",
|
|
600
|
+
localityCode: (data === null || data === void 0 ? void 0 : (_data$address45 = data.address) === null || _data$address45 === void 0 ? void 0 : (_data$address45$local = _data$address45.locality) === null || _data$address45$local === void 0 ? void 0 : _data$address45$local.code) || (data === null || data === void 0 ? void 0 : (_data$address46 = data.address) === null || _data$address46 === void 0 ? void 0 : _data$address46.localityCode) || "",
|
|
601
|
+
pincode: data === null || data === void 0 ? void 0 : (_data$address47 = data.address) === null || _data$address47 === void 0 ? void 0 : _data$address47.pincode,
|
|
602
|
+
landmark: data === null || data === void 0 ? void 0 : (_data$address48 = data.address) === null || _data$address48 === void 0 ? void 0 : _data$address48.landmark,
|
|
603
|
+
houseNo: data === null || data === void 0 ? void 0 : (_data$address49 = data.address) === null || _data$address49 === void 0 ? void 0 : _data$address49.houseNo,
|
|
604
|
+
streetName: data === null || data === void 0 ? void 0 : (_data$address50 = data.address) === null || _data$address50 === void 0 ? void 0 : _data$address50.streetName,
|
|
605
|
+
addressLine1: data === null || data === void 0 ? void 0 : (_data$address51 = data.address) === null || _data$address51 === void 0 ? void 0 : _data$address51.addressLine1,
|
|
606
|
+
addressLine2: data === null || data === void 0 ? void 0 : (_data$address52 = data.address) === null || _data$address52 === void 0 ? void 0 : _data$address52.addressLine2,
|
|
607
|
+
latitude: data === null || data === void 0 ? void 0 : (_data$address53 = data.address) === null || _data$address53 === void 0 ? void 0 : _data$address53.latitude,
|
|
608
|
+
longitude: data === null || data === void 0 ? void 0 : (_data$address54 = data.address) === null || _data$address54 === void 0 ? void 0 : _data$address54.longitude
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
};
|
|
612
|
+
return formdata;
|
|
613
|
+
};
|
|
614
|
+
const fixedPointPayload = data => {
|
|
615
|
+
var _data$owner20, _data$owner21, _data$owner22, _data$owner23, _data$owner24, _data$address55, _data$address55$addre, _data$address56, _data$address57, _data$address57$city, _data$address58, _data$address59, _data$address59$city, _data$address60, _data$address61, _data$address61$local, _data$address62, _data$address62$local, _data$address63, _data$address64, _data$address64$local, _data$address65, _data$address66, _data$address67, _data$address68, _data$address69, _data$address70, _data$address71, _data$address72, _data$address73;
|
|
616
|
+
return {
|
|
617
|
+
waterTankerBookingDetail: {
|
|
618
|
+
tenantId: data === null || data === void 0 ? void 0 : data.tenantId,
|
|
619
|
+
bookingId: (data === null || data === void 0 ? void 0 : data.bookingId) || "",
|
|
620
|
+
auditDetails: (data === null || data === void 0 ? void 0 : data.auditDetails) || null,
|
|
621
|
+
applicantDetail: {
|
|
622
|
+
name: (data === null || data === void 0 ? void 0 : (_data$owner20 = data.owner) === null || _data$owner20 === void 0 ? void 0 : _data$owner20.name) || (data === null || data === void 0 ? void 0 : (_data$owner21 = data.owner) === null || _data$owner21 === void 0 ? void 0 : _data$owner21.applicantName) || "",
|
|
623
|
+
mobileNumber: (data === null || data === void 0 ? void 0 : (_data$owner22 = data.owner) === null || _data$owner22 === void 0 ? void 0 : _data$owner22.mobileNumber) || "",
|
|
624
|
+
alternateNumber: (data === null || data === void 0 ? void 0 : (_data$owner23 = data.owner) === null || _data$owner23 === void 0 ? void 0 : _data$owner23.alternateNumber) || "",
|
|
625
|
+
emailId: (data === null || data === void 0 ? void 0 : (_data$owner24 = data.owner) === null || _data$owner24 === void 0 ? void 0 : _data$owner24.emailId) || "",
|
|
626
|
+
type: "FIXED-POINT"
|
|
627
|
+
},
|
|
628
|
+
address: {
|
|
629
|
+
type: "FIXED-POINT",
|
|
630
|
+
addressType: (data === null || data === void 0 ? void 0 : (_data$address55 = data.address) === null || _data$address55 === void 0 ? void 0 : (_data$address55$addre = _data$address55.addressType) === null || _data$address55$addre === void 0 ? void 0 : _data$address55$addre.code) || (data === null || data === void 0 ? void 0 : (_data$address56 = data.address) === null || _data$address56 === void 0 ? void 0 : _data$address56.addressType) || "",
|
|
631
|
+
city: (data === null || data === void 0 ? void 0 : (_data$address57 = data.address) === null || _data$address57 === void 0 ? void 0 : (_data$address57$city = _data$address57.city) === null || _data$address57$city === void 0 ? void 0 : _data$address57$city.name) || (data === null || data === void 0 ? void 0 : (_data$address58 = data.address) === null || _data$address58 === void 0 ? void 0 : _data$address58.city) || "",
|
|
632
|
+
cityCode: (data === null || data === void 0 ? void 0 : (_data$address59 = data.address) === null || _data$address59 === void 0 ? void 0 : (_data$address59$city = _data$address59.city) === null || _data$address59$city === void 0 ? void 0 : _data$address59$city.code) || (data === null || data === void 0 ? void 0 : (_data$address60 = data.address) === null || _data$address60 === void 0 ? void 0 : _data$address60.cityCode) || "",
|
|
633
|
+
locality: (data === null || data === void 0 ? void 0 : (_data$address61 = data.address) === null || _data$address61 === void 0 ? void 0 : (_data$address61$local = _data$address61.locality) === null || _data$address61$local === void 0 ? void 0 : _data$address61$local.label) || (data === null || data === void 0 ? void 0 : (_data$address62 = data.address) === null || _data$address62 === void 0 ? void 0 : (_data$address62$local = _data$address62.locality) === null || _data$address62$local === void 0 ? void 0 : _data$address62$local.name) || (data === null || data === void 0 ? void 0 : (_data$address63 = data.address) === null || _data$address63 === void 0 ? void 0 : _data$address63.locality) || "",
|
|
634
|
+
localityCode: (data === null || data === void 0 ? void 0 : (_data$address64 = data.address) === null || _data$address64 === void 0 ? void 0 : (_data$address64$local = _data$address64.locality) === null || _data$address64$local === void 0 ? void 0 : _data$address64$local.code) || (data === null || data === void 0 ? void 0 : (_data$address65 = data.address) === null || _data$address65 === void 0 ? void 0 : _data$address65.localityCode) || "",
|
|
635
|
+
houseNo: (data === null || data === void 0 ? void 0 : (_data$address66 = data.address) === null || _data$address66 === void 0 ? void 0 : _data$address66.houseNo) || "",
|
|
636
|
+
streetName: (data === null || data === void 0 ? void 0 : (_data$address67 = data.address) === null || _data$address67 === void 0 ? void 0 : _data$address67.streetName) || "",
|
|
637
|
+
addressLine1: (data === null || data === void 0 ? void 0 : (_data$address68 = data.address) === null || _data$address68 === void 0 ? void 0 : _data$address68.addressLine1) || "",
|
|
638
|
+
addressLine2: (data === null || data === void 0 ? void 0 : (_data$address69 = data.address) === null || _data$address69 === void 0 ? void 0 : _data$address69.addressLine2) || "",
|
|
639
|
+
landmark: (data === null || data === void 0 ? void 0 : (_data$address70 = data.address) === null || _data$address70 === void 0 ? void 0 : _data$address70.landmark) || "",
|
|
640
|
+
pincode: (data === null || data === void 0 ? void 0 : (_data$address71 = data.address) === null || _data$address71 === void 0 ? void 0 : _data$address71.pincode) || "",
|
|
641
|
+
latitude: (data === null || data === void 0 ? void 0 : (_data$address72 = data.address) === null || _data$address72 === void 0 ? void 0 : _data$address72.latitude) || "",
|
|
642
|
+
longitude: (data === null || data === void 0 ? void 0 : (_data$address73 = data.address) === null || _data$address73 === void 0 ? void 0 : _data$address73.longitude) || ""
|
|
643
|
+
}
|
|
644
|
+
}
|
|
645
|
+
};
|
|
646
|
+
};
|
|
557
647
|
|
|
558
648
|
const CollapsibleCardPage = ({
|
|
559
649
|
number,
|
|
@@ -1762,18 +1852,18 @@ const openFilePDF = fileId => {
|
|
|
1762
1852
|
var _res$data, _res$data$fileStoreId, _res$data$fileStoreId2;
|
|
1763
1853
|
const concatenatedUrls = res === null || res === void 0 ? void 0 : (_res$data = res.data) === null || _res$data === void 0 ? void 0 : (_res$data$fileStoreId = _res$data.fileStoreIds) === null || _res$data$fileStoreId === void 0 ? void 0 : (_res$data$fileStoreId2 = _res$data$fileStoreId[0]) === null || _res$data$fileStoreId2 === void 0 ? void 0 : _res$data$fileStoreId2.url;
|
|
1764
1854
|
if (concatenatedUrls) {
|
|
1765
|
-
const urlArray = concatenatedUrls.split(
|
|
1855
|
+
const urlArray = concatenatedUrls.split(",");
|
|
1766
1856
|
const fileUrl = urlArray[0];
|
|
1767
1857
|
if (fileUrl) {
|
|
1768
|
-
window.open(fileUrl,
|
|
1858
|
+
window.open(fileUrl, "_blank");
|
|
1769
1859
|
} else {
|
|
1770
|
-
console.error(
|
|
1860
|
+
console.error("No valid URL found to open!");
|
|
1771
1861
|
}
|
|
1772
1862
|
} else {
|
|
1773
|
-
console.error(
|
|
1863
|
+
console.error("URL is missing in the response!");
|
|
1774
1864
|
}
|
|
1775
1865
|
}).catch(error => {
|
|
1776
|
-
console.error(
|
|
1866
|
+
console.error("Error fetching file:", error);
|
|
1777
1867
|
});
|
|
1778
1868
|
};
|
|
1779
1869
|
const WTCheckPage = ({
|
|
@@ -2107,7 +2197,7 @@ const WTAcknowledgement = ({
|
|
|
2107
2197
|
} catch (err) {}
|
|
2108
2198
|
}, []);
|
|
2109
2199
|
Digit.Hooks.useCustomBackNavigation({
|
|
2110
|
-
redirectPath:
|
|
2200
|
+
redirectPath: "${APPLICATION_PATH}/citizen"
|
|
2111
2201
|
});
|
|
2112
2202
|
const handleDownloadPdf = async () => {
|
|
2113
2203
|
var _mutation$data;
|
|
@@ -2185,6 +2275,15 @@ const WTCard = () => {
|
|
|
2185
2275
|
}, {
|
|
2186
2276
|
label: t("WT_APPLICATION_CREATE"),
|
|
2187
2277
|
link: `${APPLICATION_PATH}/employee/wt/request-service`
|
|
2278
|
+
}, {
|
|
2279
|
+
label: t("WT_FIXED_POINT_SCHEDULE_MANAGEMENT"),
|
|
2280
|
+
link: `${APPLICATION_PATH}/employee/wt/fixed-point-schedule`
|
|
2281
|
+
}, {
|
|
2282
|
+
label: t("WT_LIVE_TRACKING_SYSTEM"),
|
|
2283
|
+
link: `${APPLICATION_PATH}/employee/wt/live-tracking`
|
|
2284
|
+
}, {
|
|
2285
|
+
label: t("WT_SEARCH_FIX_POINT"),
|
|
2286
|
+
link: `${APPLICATION_PATH}/employee/wt/search-filling-fix-point`
|
|
2188
2287
|
}];
|
|
2189
2288
|
const WT_CEMP = Digit.UserService.hasAccess(["WT_CEMP"]) || false;
|
|
2190
2289
|
const propsForModuleCard = {
|
|
@@ -2264,12 +2363,9 @@ const InboxLinks = ({
|
|
|
2264
2363
|
return (
|
|
2265
2364
|
/*#__PURE__*/
|
|
2266
2365
|
React.createElement(Card, {
|
|
2267
|
-
className: "
|
|
2366
|
+
className: "filter inboxLinks"
|
|
2268
2367
|
}, /*#__PURE__*/React.createElement("div", {
|
|
2269
|
-
className: "complaint-links-container"
|
|
2270
|
-
style: {
|
|
2271
|
-
padding: "10px"
|
|
2272
|
-
}
|
|
2368
|
+
className: "complaint-links-container"
|
|
2273
2369
|
}, GetLogo(), /*#__PURE__*/React.createElement("div", {
|
|
2274
2370
|
className: "body"
|
|
2275
2371
|
}, links.map(({
|
|
@@ -2387,7 +2483,7 @@ const SearchApplication = ({
|
|
|
2387
2483
|
style: {
|
|
2388
2484
|
width: "auto",
|
|
2389
2485
|
marginBottom: "16px",
|
|
2390
|
-
marginLeft: isInboxPage ? "
|
|
2486
|
+
marginLeft: isInboxPage ? "" : "revert"
|
|
2391
2487
|
}
|
|
2392
2488
|
}, /*#__PURE__*/React.createElement("div", {
|
|
2393
2489
|
className: "search-complaint-container",
|
|
@@ -2549,11 +2645,13 @@ const WTDesktopInbox = ({
|
|
|
2549
2645
|
return /*#__PURE__*/React.createElement("div", {
|
|
2550
2646
|
className: "inbox-container"
|
|
2551
2647
|
}, !props.isSearch && /*#__PURE__*/React.createElement("div", {
|
|
2552
|
-
className: "
|
|
2648
|
+
className: "side-panel-item"
|
|
2553
2649
|
}, /*#__PURE__*/React.createElement(InboxLinks, {
|
|
2554
2650
|
parentRoute: props.parentRoute,
|
|
2555
2651
|
businessService: props.moduleCode
|
|
2556
|
-
}), /*#__PURE__*/React.createElement("div",
|
|
2652
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
2653
|
+
className: "filter-form "
|
|
2654
|
+
}, /*#__PURE__*/React.createElement(FilterComponent, {
|
|
2557
2655
|
defaultSearchParams: props.defaultSearchParams,
|
|
2558
2656
|
onFilterChange: props.onFilterChange,
|
|
2559
2657
|
searchParams: props.searchParams,
|
|
@@ -2562,6 +2660,7 @@ const WTDesktopInbox = ({
|
|
|
2562
2660
|
statusMap: useNewInboxAPI ? data === null || data === void 0 ? void 0 : data[0].statusMap : null,
|
|
2563
2661
|
moduleCode: props.moduleCode
|
|
2564
2662
|
}))), /*#__PURE__*/React.createElement("div", {
|
|
2663
|
+
className: "employee-form-content",
|
|
2565
2664
|
style: {
|
|
2566
2665
|
flex: 1
|
|
2567
2666
|
}
|
|
@@ -2579,7 +2678,6 @@ const WTDesktopInbox = ({
|
|
|
2579
2678
|
}), /*#__PURE__*/React.createElement("div", {
|
|
2580
2679
|
className: "result",
|
|
2581
2680
|
style: {
|
|
2582
|
-
marginLeft: !(props !== null && props !== void 0 && props.isSearch) ? "16px" : "",
|
|
2583
2681
|
flex: 1
|
|
2584
2682
|
}
|
|
2585
2683
|
}, result)));
|
|
@@ -2850,173 +2948,2866 @@ const MobileInbox = ({
|
|
|
2850
2948
|
}))));
|
|
2851
2949
|
};
|
|
2852
2950
|
|
|
2853
|
-
const Inbox = ({
|
|
2854
|
-
useNewInboxAPI,
|
|
2855
|
-
parentRoute,
|
|
2856
|
-
moduleCode,
|
|
2857
|
-
initialStates: _initialStates = {},
|
|
2858
|
-
filterComponent,
|
|
2859
|
-
isInbox,
|
|
2860
|
-
rawWfHandler,
|
|
2861
|
-
rawSearchHandler,
|
|
2862
|
-
combineResponse,
|
|
2863
|
-
wfConfig,
|
|
2864
|
-
searchConfig,
|
|
2865
|
-
middlewaresWf,
|
|
2866
|
-
middlewareSearch,
|
|
2867
|
-
EmptyResultInboxComp
|
|
2868
|
-
}) => {
|
|
2869
|
-
var _sortParams$, _sortParams$2, _sortParams$3, _sortParams$4, _rest$data;
|
|
2870
|
-
const tenantId = Digit.ULBService.getCitizenCurrentTenant(true) || Digit.ULBService.getCurrentTenantId();
|
|
2871
|
-
const user = Digit.UserService.getUser().info;
|
|
2951
|
+
const Inbox = ({
|
|
2952
|
+
useNewInboxAPI,
|
|
2953
|
+
parentRoute,
|
|
2954
|
+
moduleCode,
|
|
2955
|
+
initialStates: _initialStates = {},
|
|
2956
|
+
filterComponent,
|
|
2957
|
+
isInbox,
|
|
2958
|
+
rawWfHandler,
|
|
2959
|
+
rawSearchHandler,
|
|
2960
|
+
combineResponse,
|
|
2961
|
+
wfConfig,
|
|
2962
|
+
searchConfig,
|
|
2963
|
+
middlewaresWf,
|
|
2964
|
+
middlewareSearch,
|
|
2965
|
+
EmptyResultInboxComp
|
|
2966
|
+
}) => {
|
|
2967
|
+
var _sortParams$, _sortParams$2, _sortParams$3, _sortParams$4, _rest$data;
|
|
2968
|
+
const tenantId = Digit.ULBService.getCitizenCurrentTenant(true) || Digit.ULBService.getCurrentTenantId();
|
|
2969
|
+
const user = Digit.UserService.getUser().info;
|
|
2970
|
+
const {
|
|
2971
|
+
t
|
|
2972
|
+
} = useTranslation();
|
|
2973
|
+
const [enableSarch, setEnableSearch] = useState(() => isInbox ? {} : {
|
|
2974
|
+
enabled: false
|
|
2975
|
+
});
|
|
2976
|
+
const [TableConfig, setTableConfig] = useState(() => {
|
|
2977
|
+
var _Digit$ComponentRegis;
|
|
2978
|
+
return (_Digit$ComponentRegis = Digit.ComponentRegistryService) === null || _Digit$ComponentRegis === void 0 ? void 0 : _Digit$ComponentRegis.getComponent("WTInboxTableConfig");
|
|
2979
|
+
});
|
|
2980
|
+
const [pageOffset, setPageOffset] = useState(_initialStates.pageOffset || 0);
|
|
2981
|
+
const [pageSize, setPageSize] = useState(_initialStates.pageSize || 10);
|
|
2982
|
+
const [sortParams, setSortParams] = useState(_initialStates.sortParams || [{
|
|
2983
|
+
id: "createdTime",
|
|
2984
|
+
desc: true
|
|
2985
|
+
}]);
|
|
2986
|
+
const [searchParams, setSearchParams] = useState(_initialStates.searchParams || {});
|
|
2987
|
+
let isMobile = window.Digit.Utils.browser.isMobile();
|
|
2988
|
+
let paginationParams = isMobile ? {
|
|
2989
|
+
limit: 100,
|
|
2990
|
+
offset: 0,
|
|
2991
|
+
sortBy: sortParams === null || sortParams === void 0 ? void 0 : (_sortParams$ = sortParams[0]) === null || _sortParams$ === void 0 ? void 0 : _sortParams$.id,
|
|
2992
|
+
sortOrder: sortParams !== null && sortParams !== void 0 && (_sortParams$2 = sortParams[0]) !== null && _sortParams$2 !== void 0 && _sortParams$2.desc ? "DESC" : "ASC"
|
|
2993
|
+
} : {
|
|
2994
|
+
limit: pageSize,
|
|
2995
|
+
offset: pageOffset,
|
|
2996
|
+
sortBy: sortParams === null || sortParams === void 0 ? void 0 : (_sortParams$3 = sortParams[0]) === null || _sortParams$3 === void 0 ? void 0 : _sortParams$3.id,
|
|
2997
|
+
sortOrder: sortParams !== null && sortParams !== void 0 && (_sortParams$4 = sortParams[0]) !== null && _sortParams$4 !== void 0 && _sortParams$4.desc ? "DESC" : "ASC"
|
|
2998
|
+
};
|
|
2999
|
+
const {
|
|
3000
|
+
isFetching,
|
|
3001
|
+
isLoading: hookLoading,
|
|
3002
|
+
searchResponseKey,
|
|
3003
|
+
data,
|
|
3004
|
+
searchFields,
|
|
3005
|
+
...rest
|
|
3006
|
+
} = useNewInboxAPI ? Digit.Hooks.useNewInboxGeneral({
|
|
3007
|
+
tenantId,
|
|
3008
|
+
ModuleCode: moduleCode,
|
|
3009
|
+
filters: {
|
|
3010
|
+
...searchParams,
|
|
3011
|
+
...paginationParams,
|
|
3012
|
+
sortParams
|
|
3013
|
+
}
|
|
3014
|
+
}) : Digit.Hooks.useInboxGeneral({
|
|
3015
|
+
tenantId,
|
|
3016
|
+
businessService: moduleCode,
|
|
3017
|
+
isInbox,
|
|
3018
|
+
filters: {
|
|
3019
|
+
...searchParams,
|
|
3020
|
+
...paginationParams,
|
|
3021
|
+
sortParams
|
|
3022
|
+
},
|
|
3023
|
+
rawWfHandler,
|
|
3024
|
+
rawSearchHandler,
|
|
3025
|
+
combineResponse,
|
|
3026
|
+
wfConfig,
|
|
3027
|
+
searchConfig: {
|
|
3028
|
+
...enableSarch,
|
|
3029
|
+
...searchConfig
|
|
3030
|
+
},
|
|
3031
|
+
middlewaresWf,
|
|
3032
|
+
middlewareSearch
|
|
3033
|
+
});
|
|
3034
|
+
useEffect(() => {
|
|
3035
|
+
setPageOffset(0);
|
|
3036
|
+
}, [searchParams]);
|
|
3037
|
+
const fetchNextPage = () => {
|
|
3038
|
+
setPageOffset(prevState => prevState + pageSize);
|
|
3039
|
+
};
|
|
3040
|
+
const fetchPrevPage = () => {
|
|
3041
|
+
setPageOffset(prevState => prevState - pageSize);
|
|
3042
|
+
};
|
|
3043
|
+
const handleFilterChange = filterParam => {
|
|
3044
|
+
let keys_to_delete = filterParam.delete;
|
|
3045
|
+
let _new = {
|
|
3046
|
+
...searchParams,
|
|
3047
|
+
...filterParam
|
|
3048
|
+
};
|
|
3049
|
+
if (keys_to_delete) keys_to_delete.forEach(key => delete _new[key]);
|
|
3050
|
+
delete filterParam.delete;
|
|
3051
|
+
setSearchParams({
|
|
3052
|
+
..._new
|
|
3053
|
+
});
|
|
3054
|
+
setEnableSearch({
|
|
3055
|
+
enabled: true
|
|
3056
|
+
});
|
|
3057
|
+
};
|
|
3058
|
+
const handleSort = useCallback(args => {
|
|
3059
|
+
if (args.length === 0) return;
|
|
3060
|
+
setSortParams(args);
|
|
3061
|
+
}, []);
|
|
3062
|
+
const handlePageSizeChange = e => {
|
|
3063
|
+
setPageSize(Number(e.target.value));
|
|
3064
|
+
};
|
|
3065
|
+
if ((rest === null || rest === void 0 ? void 0 : (_rest$data = rest.data) === null || _rest$data === void 0 ? void 0 : _rest$data.length) !== null) {
|
|
3066
|
+
if (isMobile) {
|
|
3067
|
+
var _res;
|
|
3068
|
+
return /*#__PURE__*/React.createElement(MobileInbox, {
|
|
3069
|
+
data: data,
|
|
3070
|
+
isLoading: hookLoading,
|
|
3071
|
+
isSearch: !isInbox,
|
|
3072
|
+
searchFields: searchFields,
|
|
3073
|
+
onFilterChange: handleFilterChange,
|
|
3074
|
+
onSearch: handleFilterChange,
|
|
3075
|
+
onSort: handleSort,
|
|
3076
|
+
parentRoute: parentRoute,
|
|
3077
|
+
searchParams: searchParams,
|
|
3078
|
+
sortParams: sortParams,
|
|
3079
|
+
linkPrefix: `${parentRoute}/application-details/`,
|
|
3080
|
+
tableConfig: rest !== null && rest !== void 0 && rest.tableConfig ? (_res = res) === null || _res === void 0 ? void 0 : _res.tableConfig : TableConfig(t)[moduleCode],
|
|
3081
|
+
filterComponent: filterComponent,
|
|
3082
|
+
EmptyResultInboxComp: EmptyResultInboxComp,
|
|
3083
|
+
useNewInboxAPI: useNewInboxAPI
|
|
3084
|
+
});
|
|
3085
|
+
} else {
|
|
3086
|
+
var _data$;
|
|
3087
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
3088
|
+
className: "app-container",
|
|
3089
|
+
style: {
|
|
3090
|
+
padding: (user === null || user === void 0 ? void 0 : user.type) === "CITIZEN" ? "0 24px" : ""
|
|
3091
|
+
}
|
|
3092
|
+
}, /*#__PURE__*/React.createElement(WTDesktopInbox, {
|
|
3093
|
+
moduleCode: moduleCode,
|
|
3094
|
+
data: data,
|
|
3095
|
+
tableConfig: TableConfig(t)[moduleCode],
|
|
3096
|
+
isLoading: hookLoading,
|
|
3097
|
+
defaultSearchParams: _initialStates.searchParams,
|
|
3098
|
+
isSearch: !isInbox,
|
|
3099
|
+
onFilterChange: handleFilterChange,
|
|
3100
|
+
searchFields: searchFields,
|
|
3101
|
+
onSearch: handleFilterChange,
|
|
3102
|
+
onSort: handleSort,
|
|
3103
|
+
onNextPage: fetchNextPage,
|
|
3104
|
+
onPrevPage: fetchPrevPage,
|
|
3105
|
+
currentPage: Math.floor(pageOffset / pageSize),
|
|
3106
|
+
pageSizeLimit: pageSize,
|
|
3107
|
+
disableSort: false,
|
|
3108
|
+
onPageSizeChange: handlePageSizeChange,
|
|
3109
|
+
parentRoute: parentRoute,
|
|
3110
|
+
searchParams: searchParams,
|
|
3111
|
+
sortParams: sortParams,
|
|
3112
|
+
totalRecords: Number(data === null || data === void 0 ? void 0 : (_data$ = data[0]) === null || _data$ === void 0 ? void 0 : _data$.totalCount),
|
|
3113
|
+
filterComponent: filterComponent,
|
|
3114
|
+
EmptyResultInboxComp: EmptyResultInboxComp,
|
|
3115
|
+
useNewInboxAPI: useNewInboxAPI
|
|
3116
|
+
}));
|
|
3117
|
+
}
|
|
3118
|
+
}
|
|
3119
|
+
};
|
|
3120
|
+
|
|
3121
|
+
const AddTripModal = ({
|
|
3122
|
+
t,
|
|
3123
|
+
closeModal,
|
|
3124
|
+
onSubmit,
|
|
3125
|
+
initialValues
|
|
3126
|
+
}) => {
|
|
3127
|
+
const {
|
|
3128
|
+
register,
|
|
3129
|
+
handleSubmit,
|
|
3130
|
+
control,
|
|
3131
|
+
formState: {
|
|
3132
|
+
errors
|
|
3133
|
+
}
|
|
3134
|
+
} = useForm({
|
|
3135
|
+
defaultValues: initialValues || {}
|
|
3136
|
+
});
|
|
3137
|
+
const dayOptions = [{
|
|
3138
|
+
label: t("MON"),
|
|
3139
|
+
value: "Mon"
|
|
3140
|
+
}, {
|
|
3141
|
+
label: t("TUE"),
|
|
3142
|
+
value: "Tue"
|
|
3143
|
+
}, {
|
|
3144
|
+
label: t("WED"),
|
|
3145
|
+
value: "Wed"
|
|
3146
|
+
}, {
|
|
3147
|
+
label: t("THU"),
|
|
3148
|
+
value: "Thu"
|
|
3149
|
+
}, {
|
|
3150
|
+
label: t("FRI"),
|
|
3151
|
+
value: "Fri"
|
|
3152
|
+
}, {
|
|
3153
|
+
label: t("SAT"),
|
|
3154
|
+
value: "Sat"
|
|
3155
|
+
}, {
|
|
3156
|
+
label: t("SUN"),
|
|
3157
|
+
value: "Sun"
|
|
3158
|
+
}];
|
|
3159
|
+
const activeOptions = [{
|
|
3160
|
+
label: t("YES"),
|
|
3161
|
+
value: "Yes"
|
|
3162
|
+
}, {
|
|
3163
|
+
label: t("NO"),
|
|
3164
|
+
value: "No"
|
|
3165
|
+
}];
|
|
3166
|
+
const onFormSubmit = data => {
|
|
3167
|
+
onSubmit(data);
|
|
3168
|
+
};
|
|
3169
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
3170
|
+
className: "custom-modal-overlay",
|
|
3171
|
+
style: {
|
|
3172
|
+
position: "fixed",
|
|
3173
|
+
top: 0,
|
|
3174
|
+
left: 0,
|
|
3175
|
+
width: "100%",
|
|
3176
|
+
height: "100%",
|
|
3177
|
+
backgroundColor: "rgba(0, 0, 0, 0.5)",
|
|
3178
|
+
display: "flex",
|
|
3179
|
+
justifyContent: "center",
|
|
3180
|
+
alignItems: "center",
|
|
3181
|
+
zIndex: 9999
|
|
3182
|
+
}
|
|
3183
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
3184
|
+
className: "custom-modal-content",
|
|
3185
|
+
style: {
|
|
3186
|
+
backgroundColor: "#fff",
|
|
3187
|
+
borderRadius: "8px",
|
|
3188
|
+
width: "70%",
|
|
3189
|
+
maxWidth: "800px",
|
|
3190
|
+
maxHeight: "90vh",
|
|
3191
|
+
display: "flex",
|
|
3192
|
+
flexDirection: "column",
|
|
3193
|
+
boxShadow: "0 4px 12px rgba(0,0,0,0.15)",
|
|
3194
|
+
position: "relative"
|
|
3195
|
+
}
|
|
3196
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
3197
|
+
className: "custom-modal-header",
|
|
3198
|
+
style: {
|
|
3199
|
+
padding: "16px 24px",
|
|
3200
|
+
borderBottom: "1px solid #eee",
|
|
3201
|
+
display: "flex",
|
|
3202
|
+
justifyContent: "space-between",
|
|
3203
|
+
alignItems: "center"
|
|
3204
|
+
}
|
|
3205
|
+
}, /*#__PURE__*/React.createElement("h1", {
|
|
3206
|
+
style: {
|
|
3207
|
+
margin: 0,
|
|
3208
|
+
fontSize: "20px",
|
|
3209
|
+
fontWeight: "600",
|
|
3210
|
+
color: "#1D4E7F"
|
|
3211
|
+
}
|
|
3212
|
+
}, initialValues ? t("WT_EDIT_TRIP") : t("WT_ADD_TRIP")), /*#__PURE__*/React.createElement("button", {
|
|
3213
|
+
onClick: closeModal,
|
|
3214
|
+
style: {
|
|
3215
|
+
background: "none",
|
|
3216
|
+
border: "none",
|
|
3217
|
+
fontSize: "24px",
|
|
3218
|
+
cursor: "pointer",
|
|
3219
|
+
color: "#666"
|
|
3220
|
+
}
|
|
3221
|
+
}, "\xD7")), /*#__PURE__*/React.createElement("div", {
|
|
3222
|
+
className: "custom-modal-body",
|
|
3223
|
+
style: {
|
|
3224
|
+
padding: "24px",
|
|
3225
|
+
overflowY: "auto"
|
|
3226
|
+
}
|
|
3227
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
3228
|
+
className: "add-trip-form",
|
|
3229
|
+
style: {
|
|
3230
|
+
display: "grid",
|
|
3231
|
+
gridTemplateColumns: "repeat(3, 1fr)",
|
|
3232
|
+
gap: "20px"
|
|
3233
|
+
}
|
|
3234
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
3235
|
+
className: "field-group"
|
|
3236
|
+
}, /*#__PURE__*/React.createElement(CardLabel, {
|
|
3237
|
+
style: {
|
|
3238
|
+
marginBottom: "8px",
|
|
3239
|
+
fontWeight: "500"
|
|
3240
|
+
}
|
|
3241
|
+
}, t("WT_SCHEDULE_ID")), /*#__PURE__*/React.createElement(TextInput, {
|
|
3242
|
+
name: "scheduleId",
|
|
3243
|
+
inputRef: register()
|
|
3244
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
3245
|
+
className: "field-group"
|
|
3246
|
+
}, /*#__PURE__*/React.createElement(CardLabel, {
|
|
3247
|
+
style: {
|
|
3248
|
+
marginBottom: "8px",
|
|
3249
|
+
fontWeight: "500"
|
|
3250
|
+
}
|
|
3251
|
+
}, t("WT_FIXED_POINT_CODE")), /*#__PURE__*/React.createElement(TextInput, {
|
|
3252
|
+
name: "fixedPointCode",
|
|
3253
|
+
inputRef: register()
|
|
3254
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
3255
|
+
className: "field-group"
|
|
3256
|
+
}, /*#__PURE__*/React.createElement(CardLabel, {
|
|
3257
|
+
style: {
|
|
3258
|
+
marginBottom: "8px",
|
|
3259
|
+
fontWeight: "500"
|
|
3260
|
+
}
|
|
3261
|
+
}, t("WT_DAY")), /*#__PURE__*/React.createElement(Controller, {
|
|
3262
|
+
control: control,
|
|
3263
|
+
name: "day",
|
|
3264
|
+
render: props => /*#__PURE__*/React.createElement(Dropdown, {
|
|
3265
|
+
option: dayOptions,
|
|
3266
|
+
optionKey: "label",
|
|
3267
|
+
selected: props.value,
|
|
3268
|
+
select: props.onChange,
|
|
3269
|
+
t: t
|
|
3270
|
+
})
|
|
3271
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
3272
|
+
className: "field-group"
|
|
3273
|
+
}, /*#__PURE__*/React.createElement(CardLabel, {
|
|
3274
|
+
style: {
|
|
3275
|
+
marginBottom: "8px",
|
|
3276
|
+
fontWeight: "500"
|
|
3277
|
+
}
|
|
3278
|
+
}, t("WT_FREQUENCY_NO")), /*#__PURE__*/React.createElement(TextInput, {
|
|
3279
|
+
name: "frequencyNo",
|
|
3280
|
+
inputRef: register()
|
|
3281
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
3282
|
+
className: "field-group"
|
|
3283
|
+
}, /*#__PURE__*/React.createElement(CardLabel, {
|
|
3284
|
+
style: {
|
|
3285
|
+
marginBottom: "8px",
|
|
3286
|
+
fontWeight: "500"
|
|
3287
|
+
}
|
|
3288
|
+
}, t("WT_VEHICLE_ID")), /*#__PURE__*/React.createElement(TextInput, {
|
|
3289
|
+
name: "vehicleId",
|
|
3290
|
+
inputRef: register()
|
|
3291
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
3292
|
+
className: "field-group"
|
|
3293
|
+
}, /*#__PURE__*/React.createElement(CardLabel, {
|
|
3294
|
+
style: {
|
|
3295
|
+
marginBottom: "8px",
|
|
3296
|
+
fontWeight: "500"
|
|
3297
|
+
}
|
|
3298
|
+
}, t("WT_ARRIVAL_TIME_TO_FPL")), /*#__PURE__*/React.createElement(TextInput, {
|
|
3299
|
+
name: "arrivalTimeFpl",
|
|
3300
|
+
inputRef: register(),
|
|
3301
|
+
type: "time"
|
|
3302
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
3303
|
+
className: "field-group"
|
|
3304
|
+
}, /*#__PURE__*/React.createElement(CardLabel, {
|
|
3305
|
+
style: {
|
|
3306
|
+
marginBottom: "8px",
|
|
3307
|
+
fontWeight: "500"
|
|
3308
|
+
}
|
|
3309
|
+
}, t("WT_DEPARTURE_TIME_FROM_FPL")), /*#__PURE__*/React.createElement(TextInput, {
|
|
3310
|
+
name: "departureTimeFpl",
|
|
3311
|
+
inputRef: register(),
|
|
3312
|
+
type: "time"
|
|
3313
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
3314
|
+
className: "field-group"
|
|
3315
|
+
}, /*#__PURE__*/React.createElement(CardLabel, {
|
|
3316
|
+
style: {
|
|
3317
|
+
marginBottom: "8px",
|
|
3318
|
+
fontWeight: "500"
|
|
3319
|
+
}
|
|
3320
|
+
}, t("WT_ARRIVAL_AT_FIXED_POINT")), /*#__PURE__*/React.createElement(TextInput, {
|
|
3321
|
+
name: "arrivalFixedPoint",
|
|
3322
|
+
inputRef: register(),
|
|
3323
|
+
type: "time"
|
|
3324
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
3325
|
+
className: "field-group"
|
|
3326
|
+
}, /*#__PURE__*/React.createElement(CardLabel, {
|
|
3327
|
+
style: {
|
|
3328
|
+
marginBottom: "8px",
|
|
3329
|
+
fontWeight: "500"
|
|
3330
|
+
}
|
|
3331
|
+
}, t("WT_DEPARTURE_AT_FIXED_POINT")), /*#__PURE__*/React.createElement(TextInput, {
|
|
3332
|
+
name: "departureFixedPoint",
|
|
3333
|
+
inputRef: register(),
|
|
3334
|
+
type: "time"
|
|
3335
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
3336
|
+
className: "field-group"
|
|
3337
|
+
}, /*#__PURE__*/React.createElement(CardLabel, {
|
|
3338
|
+
style: {
|
|
3339
|
+
marginBottom: "8px",
|
|
3340
|
+
fontWeight: "500"
|
|
3341
|
+
}
|
|
3342
|
+
}, t("WT_RETURN_TO_FPL")), /*#__PURE__*/React.createElement(TextInput, {
|
|
3343
|
+
name: "returnFpl",
|
|
3344
|
+
inputRef: register(),
|
|
3345
|
+
type: "time"
|
|
3346
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
3347
|
+
className: "field-group"
|
|
3348
|
+
}, /*#__PURE__*/React.createElement(CardLabel, {
|
|
3349
|
+
style: {
|
|
3350
|
+
marginBottom: "8px",
|
|
3351
|
+
fontWeight: "500"
|
|
3352
|
+
}
|
|
3353
|
+
}, t("WT_VOLUME")), /*#__PURE__*/React.createElement(TextInput, {
|
|
3354
|
+
name: "volume",
|
|
3355
|
+
inputRef: register()
|
|
3356
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
3357
|
+
className: "field-group"
|
|
3358
|
+
}, /*#__PURE__*/React.createElement(CardLabel, {
|
|
3359
|
+
style: {
|
|
3360
|
+
marginBottom: "8px",
|
|
3361
|
+
fontWeight: "500"
|
|
3362
|
+
}
|
|
3363
|
+
}, t("WT_ACTIVE")), /*#__PURE__*/React.createElement(Controller, {
|
|
3364
|
+
control: control,
|
|
3365
|
+
name: "active",
|
|
3366
|
+
render: props => /*#__PURE__*/React.createElement(Dropdown, {
|
|
3367
|
+
option: activeOptions,
|
|
3368
|
+
optionKey: "label",
|
|
3369
|
+
selected: props.value,
|
|
3370
|
+
select: props.onChange,
|
|
3371
|
+
t: t
|
|
3372
|
+
})
|
|
3373
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
3374
|
+
className: "field-group",
|
|
3375
|
+
style: {
|
|
3376
|
+
gridColumn: "span 2"
|
|
3377
|
+
}
|
|
3378
|
+
}, /*#__PURE__*/React.createElement(CardLabel, {
|
|
3379
|
+
style: {
|
|
3380
|
+
marginBottom: "8px",
|
|
3381
|
+
fontWeight: "500"
|
|
3382
|
+
}
|
|
3383
|
+
}, t("WT_REMARKS")), /*#__PURE__*/React.createElement(TextInput, {
|
|
3384
|
+
name: "remarks",
|
|
3385
|
+
inputRef: register()
|
|
3386
|
+
})))), /*#__PURE__*/React.createElement("div", {
|
|
3387
|
+
className: "custom-modal-footer",
|
|
3388
|
+
style: {
|
|
3389
|
+
padding: "16px 24px",
|
|
3390
|
+
borderTop: "1px solid #eee",
|
|
3391
|
+
display: "flex",
|
|
3392
|
+
justifyContent: "flex-end",
|
|
3393
|
+
gap: "12px"
|
|
3394
|
+
}
|
|
3395
|
+
}, /*#__PURE__*/React.createElement("button", {
|
|
3396
|
+
className: "button-cancel",
|
|
3397
|
+
onClick: closeModal,
|
|
3398
|
+
style: {
|
|
3399
|
+
padding: "8px 20px",
|
|
3400
|
+
border: "1px solid #ccc",
|
|
3401
|
+
background: "#f4f4f4",
|
|
3402
|
+
borderRadius: "4px",
|
|
3403
|
+
cursor: "pointer"
|
|
3404
|
+
}
|
|
3405
|
+
}, t("CS_COMMON_CANCEL")), /*#__PURE__*/React.createElement("button", {
|
|
3406
|
+
className: "button-save",
|
|
3407
|
+
onClick: handleSubmit(onFormSubmit),
|
|
3408
|
+
style: {
|
|
3409
|
+
padding: "8px 20px",
|
|
3410
|
+
background: "#1D4E7F",
|
|
3411
|
+
color: "#fff",
|
|
3412
|
+
border: "none",
|
|
3413
|
+
borderRadius: "4px",
|
|
3414
|
+
cursor: "pointer"
|
|
3415
|
+
}
|
|
3416
|
+
}, initialValues ? t("WT_UPDATE") : t("CS_COMMON_SAVE")))));
|
|
3417
|
+
};
|
|
3418
|
+
|
|
3419
|
+
const FixedPointScheduleManagement = () => {
|
|
3420
|
+
const {
|
|
3421
|
+
t
|
|
3422
|
+
} = useTranslation();
|
|
3423
|
+
const [showModal, setShowModal] = useState(false);
|
|
3424
|
+
const [selectedDay, setSelectedDay] = useState("Mon");
|
|
3425
|
+
const [year, setYear] = useState({
|
|
3426
|
+
label: "Year 2026",
|
|
3427
|
+
value: "2026"
|
|
3428
|
+
});
|
|
3429
|
+
const [fixedPoint, setFixedPoint] = useState({
|
|
3430
|
+
label: "FP01",
|
|
3431
|
+
value: "FP01"
|
|
3432
|
+
});
|
|
3433
|
+
const [day, setDay] = useState({
|
|
3434
|
+
label: "Mon",
|
|
3435
|
+
value: "Mon"
|
|
3436
|
+
});
|
|
3437
|
+
const [status, setStatus] = useState({
|
|
3438
|
+
label: "All Status",
|
|
3439
|
+
value: "all"
|
|
3440
|
+
});
|
|
3441
|
+
const [vehicle, setVehicle] = useState({
|
|
3442
|
+
label: "DL1LAG7729",
|
|
3443
|
+
value: "DL1LAG7729"
|
|
3444
|
+
});
|
|
3445
|
+
const [editingRowIndex, setEditingRowIndex] = useState(null);
|
|
3446
|
+
const handleDelete = index => {
|
|
3447
|
+
const updatedData = data.filter((_, i) => i !== index);
|
|
3448
|
+
setData(updatedData);
|
|
3449
|
+
};
|
|
3450
|
+
const handleDownload = type => {
|
|
3451
|
+
const filename = `FixedPointSchedule_${type.value}_${new Date().toLocaleDateString()}`;
|
|
3452
|
+
if (window.Digit && window.Digit.Download && window.Digit.Download.Excel) {
|
|
3453
|
+
window.Digit.Download.Excel(data, filename);
|
|
3454
|
+
} else {
|
|
3455
|
+
const csvRows = [];
|
|
3456
|
+
const headers = Object.keys(data[0]);
|
|
3457
|
+
csvRows.push(headers.join(","));
|
|
3458
|
+
for (const row of data) {
|
|
3459
|
+
const values = headers.map(header => {
|
|
3460
|
+
const escaped = ("" + row[header]).replace(/"/g, '\\"');
|
|
3461
|
+
return `"${escaped}"`;
|
|
3462
|
+
});
|
|
3463
|
+
csvRows.push(values.join(","));
|
|
3464
|
+
}
|
|
3465
|
+
const blob = new Blob([csvRows.join("\n")], {
|
|
3466
|
+
type: "text/csv"
|
|
3467
|
+
});
|
|
3468
|
+
const url = window.URL.createObjectURL(blob);
|
|
3469
|
+
const a = document.createElement("a");
|
|
3470
|
+
a.setAttribute("hidden", "");
|
|
3471
|
+
a.setAttribute("href", url);
|
|
3472
|
+
a.setAttribute("download", `${filename}.csv`);
|
|
3473
|
+
document.body.appendChild(a);
|
|
3474
|
+
a.click();
|
|
3475
|
+
document.body.removeChild(a);
|
|
3476
|
+
}
|
|
3477
|
+
};
|
|
3478
|
+
const [data, setData] = useState([{
|
|
3479
|
+
scheduleId: "SASID-0001",
|
|
3480
|
+
fixedPoint: "FP01",
|
|
3481
|
+
day: "Mon",
|
|
3482
|
+
freq: "1",
|
|
3483
|
+
arrToFpl: "06:00",
|
|
3484
|
+
depFromFpl: "06:10",
|
|
3485
|
+
arrAtFixedPoint: "06:40",
|
|
3486
|
+
depAtFixedPoint: "06:55",
|
|
3487
|
+
returnToFpl: "07:20",
|
|
3488
|
+
volume: "3 KL",
|
|
3489
|
+
vehicle: "DL1LAG7729",
|
|
3490
|
+
active: "Y"
|
|
3491
|
+
}, {
|
|
3492
|
+
scheduleId: "SASID-0002",
|
|
3493
|
+
fixedPoint: "FP01",
|
|
3494
|
+
day: "Mon",
|
|
3495
|
+
freq: "2",
|
|
3496
|
+
arrToFpl: "07:20",
|
|
3497
|
+
depFromFpl: "07:30",
|
|
3498
|
+
arrAtFixedPoint: "08:00",
|
|
3499
|
+
depAtFixedPoint: "08:15",
|
|
3500
|
+
returnToFpl: "08:40",
|
|
3501
|
+
volume: "3 KL",
|
|
3502
|
+
vehicle: "DL1LAG7729",
|
|
3503
|
+
active: "Y"
|
|
3504
|
+
}, {
|
|
3505
|
+
scheduleId: "SASID-0003",
|
|
3506
|
+
fixedPoint: "FP02",
|
|
3507
|
+
day: "Tue",
|
|
3508
|
+
freq: "3",
|
|
3509
|
+
arrToFpl: "08:40",
|
|
3510
|
+
depFromFpl: "08:50",
|
|
3511
|
+
arrAtFixedPoint: "09:20",
|
|
3512
|
+
depAtFixedPoint: "09:35",
|
|
3513
|
+
returnToFpl: "10:00",
|
|
3514
|
+
volume: "3 KL",
|
|
3515
|
+
vehicle: "DL1LAG7730",
|
|
3516
|
+
active: "Y"
|
|
3517
|
+
}, {
|
|
3518
|
+
scheduleId: "SASID-0004",
|
|
3519
|
+
fixedPoint: "FP03",
|
|
3520
|
+
day: "Wed",
|
|
3521
|
+
freq: "1",
|
|
3522
|
+
arrToFpl: "09:00",
|
|
3523
|
+
depFromFpl: "09:10",
|
|
3524
|
+
arrAtFixedPoint: "09:40",
|
|
3525
|
+
depAtFixedPoint: "09:55",
|
|
3526
|
+
returnToFpl: "10:20",
|
|
3527
|
+
volume: "5 KL",
|
|
3528
|
+
vehicle: "DL1LAG7731",
|
|
3529
|
+
active: "N"
|
|
3530
|
+
}]);
|
|
3531
|
+
const [masterData] = useState(data);
|
|
3532
|
+
const handleSearch = () => {
|
|
3533
|
+
let filteredData = [...masterData];
|
|
3534
|
+
if (fixedPoint !== null && fixedPoint !== void 0 && fixedPoint.value && fixedPoint.value !== "all") {
|
|
3535
|
+
filteredData = filteredData.filter(item => item.fixedPoint === fixedPoint.value);
|
|
3536
|
+
}
|
|
3537
|
+
if (day !== null && day !== void 0 && day.value && day.value !== "all") {
|
|
3538
|
+
filteredData = filteredData.filter(item => item.day === day.value);
|
|
3539
|
+
}
|
|
3540
|
+
if (status !== null && status !== void 0 && status.value && status.value !== "all") {
|
|
3541
|
+
const activeStatus = status.value === "Active" ? "Y" : "N";
|
|
3542
|
+
filteredData = filteredData.filter(item => item.active === activeStatus);
|
|
3543
|
+
}
|
|
3544
|
+
if (vehicle !== null && vehicle !== void 0 && vehicle.value && vehicle.value !== "all") {
|
|
3545
|
+
filteredData = filteredData.filter(item => item.vehicle === vehicle.value);
|
|
3546
|
+
}
|
|
3547
|
+
setData(filteredData);
|
|
3548
|
+
};
|
|
3549
|
+
const columns = React.useMemo(() => [{
|
|
3550
|
+
Header: t("WT_SCHEDULE_ID"),
|
|
3551
|
+
accessor: "scheduleId"
|
|
3552
|
+
}, {
|
|
3553
|
+
Header: t("WT_FIXED_POINT"),
|
|
3554
|
+
accessor: "fixedPoint"
|
|
3555
|
+
}, {
|
|
3556
|
+
Header: t("WT_DAY"),
|
|
3557
|
+
accessor: "day"
|
|
3558
|
+
}, {
|
|
3559
|
+
Header: t("WT_FREQ"),
|
|
3560
|
+
accessor: "freq"
|
|
3561
|
+
}, {
|
|
3562
|
+
Header: t("WT_ARR_TO_FPL"),
|
|
3563
|
+
accessor: "arrToFpl"
|
|
3564
|
+
}, {
|
|
3565
|
+
Header: t("WT_DEP_FROM_FPL"),
|
|
3566
|
+
accessor: "depFromFpl"
|
|
3567
|
+
}, {
|
|
3568
|
+
Header: t("WT_ARR_AT_FIXED_POINT"),
|
|
3569
|
+
accessor: "arrAtFixedPoint"
|
|
3570
|
+
}, {
|
|
3571
|
+
Header: t("WT_DEP_AT_FIXED_POINT"),
|
|
3572
|
+
accessor: "depAtFixedPoint"
|
|
3573
|
+
}, {
|
|
3574
|
+
Header: t("WT_RETURN_TO_FPL"),
|
|
3575
|
+
accessor: "returnToFpl"
|
|
3576
|
+
}, {
|
|
3577
|
+
Header: t("WT_VOLUME"),
|
|
3578
|
+
accessor: "volume"
|
|
3579
|
+
}, {
|
|
3580
|
+
Header: t("WT_VEHICLE"),
|
|
3581
|
+
accessor: "vehicle"
|
|
3582
|
+
}, {
|
|
3583
|
+
Header: t("WT_ACTIVE"),
|
|
3584
|
+
accessor: "active",
|
|
3585
|
+
Cell: ({
|
|
3586
|
+
value
|
|
3587
|
+
}) => /*#__PURE__*/React.createElement("span", {
|
|
3588
|
+
style: {
|
|
3589
|
+
background: value === "Y" ? "#E6F4EA" : "#FCE8E6",
|
|
3590
|
+
padding: "2px 8px",
|
|
3591
|
+
borderRadius: "10px",
|
|
3592
|
+
color: value === "Y" ? "#1E8E3E" : "#D93025"
|
|
3593
|
+
}
|
|
3594
|
+
}, value)
|
|
3595
|
+
}, {
|
|
3596
|
+
Header: t("WT_ACTION"),
|
|
3597
|
+
Cell: ({
|
|
3598
|
+
row
|
|
3599
|
+
}) => /*#__PURE__*/React.createElement("div", {
|
|
3600
|
+
style: {
|
|
3601
|
+
display: "flex",
|
|
3602
|
+
gap: "5px"
|
|
3603
|
+
}
|
|
3604
|
+
}, /*#__PURE__*/React.createElement("button", {
|
|
3605
|
+
onClick: () => {
|
|
3606
|
+
setEditingRowIndex(row.index);
|
|
3607
|
+
setShowModal(true);
|
|
3608
|
+
},
|
|
3609
|
+
style: {
|
|
3610
|
+
color: "#1D4E7F",
|
|
3611
|
+
border: "1px solid #1D4E7F",
|
|
3612
|
+
background: "none",
|
|
3613
|
+
padding: "2px 8px",
|
|
3614
|
+
cursor: "pointer"
|
|
3615
|
+
}
|
|
3616
|
+
}, t("WT_EDIT")), /*#__PURE__*/React.createElement("button", {
|
|
3617
|
+
onClick: () => handleDelete(row.index),
|
|
3618
|
+
style: {
|
|
3619
|
+
color: "#fff",
|
|
3620
|
+
border: "none",
|
|
3621
|
+
background: "#D93025",
|
|
3622
|
+
padding: "2px 8px",
|
|
3623
|
+
cursor: "pointer"
|
|
3624
|
+
}
|
|
3625
|
+
}, t("WT_DELETE")))
|
|
3626
|
+
}], [t]);
|
|
3627
|
+
const days = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"];
|
|
3628
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
3629
|
+
className: "fixed-point-schedule-management"
|
|
3630
|
+
}, /*#__PURE__*/React.createElement(Card, {
|
|
3631
|
+
style: {
|
|
3632
|
+
padding: "20px"
|
|
3633
|
+
}
|
|
3634
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
3635
|
+
className: "finance-mainlayout",
|
|
3636
|
+
style: {
|
|
3637
|
+
marginBottom: "20px"
|
|
3638
|
+
}
|
|
3639
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
3640
|
+
className: "finance-mainlayout-col1"
|
|
3641
|
+
}, /*#__PURE__*/React.createElement(Dropdown, {
|
|
3642
|
+
option: [{
|
|
3643
|
+
label: "Year 2024",
|
|
3644
|
+
value: "2024"
|
|
3645
|
+
}, {
|
|
3646
|
+
label: "Year 2025",
|
|
3647
|
+
value: "2025"
|
|
3648
|
+
}, {
|
|
3649
|
+
label: "Year 2026",
|
|
3650
|
+
value: "2026"
|
|
3651
|
+
}],
|
|
3652
|
+
optionKey: "label",
|
|
3653
|
+
selected: year,
|
|
3654
|
+
t: t,
|
|
3655
|
+
select: setYear
|
|
3656
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
3657
|
+
className: "finance-mainlayout-col1"
|
|
3658
|
+
}, /*#__PURE__*/React.createElement(Dropdown, {
|
|
3659
|
+
option: [{
|
|
3660
|
+
label: "All Fixed Points",
|
|
3661
|
+
value: "all"
|
|
3662
|
+
}, {
|
|
3663
|
+
label: "FP01",
|
|
3664
|
+
value: "FP01"
|
|
3665
|
+
}, {
|
|
3666
|
+
label: "FP02",
|
|
3667
|
+
value: "FP02"
|
|
3668
|
+
}, {
|
|
3669
|
+
label: "FP03",
|
|
3670
|
+
value: "FP03"
|
|
3671
|
+
}],
|
|
3672
|
+
optionKey: "label",
|
|
3673
|
+
selected: fixedPoint,
|
|
3674
|
+
t: t,
|
|
3675
|
+
select: setFixedPoint,
|
|
3676
|
+
placeholder: "All Fixed Points"
|
|
3677
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
3678
|
+
className: "finance-mainlayout-col1"
|
|
3679
|
+
}, /*#__PURE__*/React.createElement(Dropdown, {
|
|
3680
|
+
option: [{
|
|
3681
|
+
label: "All Days",
|
|
3682
|
+
value: "all"
|
|
3683
|
+
}, {
|
|
3684
|
+
label: "Mon",
|
|
3685
|
+
value: "Mon"
|
|
3686
|
+
}, {
|
|
3687
|
+
label: "Tue",
|
|
3688
|
+
value: "Tue"
|
|
3689
|
+
}, {
|
|
3690
|
+
label: "Wed",
|
|
3691
|
+
value: "Wed"
|
|
3692
|
+
}, {
|
|
3693
|
+
label: "Thu",
|
|
3694
|
+
value: "Thu"
|
|
3695
|
+
}, {
|
|
3696
|
+
label: "Fri",
|
|
3697
|
+
value: "Fri"
|
|
3698
|
+
}, {
|
|
3699
|
+
label: "Sat",
|
|
3700
|
+
value: "Sat"
|
|
3701
|
+
}, {
|
|
3702
|
+
label: "Sun",
|
|
3703
|
+
value: "Sun"
|
|
3704
|
+
}],
|
|
3705
|
+
optionKey: "label",
|
|
3706
|
+
selected: day,
|
|
3707
|
+
t: t,
|
|
3708
|
+
select: setDay,
|
|
3709
|
+
placeholder: "All Days"
|
|
3710
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
3711
|
+
className: "finance-mainlayout-col1"
|
|
3712
|
+
}, /*#__PURE__*/React.createElement(Dropdown, {
|
|
3713
|
+
option: [{
|
|
3714
|
+
label: "All Status",
|
|
3715
|
+
value: "all"
|
|
3716
|
+
}, {
|
|
3717
|
+
label: "Active",
|
|
3718
|
+
value: "Active"
|
|
3719
|
+
}, {
|
|
3720
|
+
label: "Inactive",
|
|
3721
|
+
value: "Inactive"
|
|
3722
|
+
}],
|
|
3723
|
+
optionKey: "label",
|
|
3724
|
+
selected: status,
|
|
3725
|
+
t: t,
|
|
3726
|
+
select: setStatus,
|
|
3727
|
+
placeholder: "All Status"
|
|
3728
|
+
}))), /*#__PURE__*/React.createElement("div", {
|
|
3729
|
+
className: "finance-mainlayout",
|
|
3730
|
+
style: {
|
|
3731
|
+
marginBottom: "20px"
|
|
3732
|
+
}
|
|
3733
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
3734
|
+
className: "finance-mainlayout-col1"
|
|
3735
|
+
}, /*#__PURE__*/React.createElement(Dropdown, {
|
|
3736
|
+
option: [{
|
|
3737
|
+
label: "All Vehicles",
|
|
3738
|
+
value: "all"
|
|
3739
|
+
}, {
|
|
3740
|
+
label: "DL1LAG7729",
|
|
3741
|
+
value: "DL1LAG7729"
|
|
3742
|
+
}, {
|
|
3743
|
+
label: "DL1LAG7730",
|
|
3744
|
+
value: "DL1LAG7730"
|
|
3745
|
+
}, {
|
|
3746
|
+
label: "DL1LAG7731",
|
|
3747
|
+
value: "DL1LAG7731"
|
|
3748
|
+
}],
|
|
3749
|
+
optionKey: "label",
|
|
3750
|
+
selected: vehicle,
|
|
3751
|
+
t: t,
|
|
3752
|
+
select: setVehicle,
|
|
3753
|
+
placeholder: "All Vehicles"
|
|
3754
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
3755
|
+
className: "finance-mainlayout-col1"
|
|
3756
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
3757
|
+
className: "finance-mainlayout-col1"
|
|
3758
|
+
}, /*#__PURE__*/React.createElement(Dropdown, {
|
|
3759
|
+
option: [{
|
|
3760
|
+
label: t("WT_EXCEL_WEEKWISE"),
|
|
3761
|
+
value: "Weekwise"
|
|
3762
|
+
}, {
|
|
3763
|
+
label: t("WT_EXCEL_MONTHWISE"),
|
|
3764
|
+
value: "Monthwise"
|
|
3765
|
+
}, {
|
|
3766
|
+
label: t("WT_EXCEL_YEARWISE"),
|
|
3767
|
+
value: "Yearwise"
|
|
3768
|
+
}],
|
|
3769
|
+
optionKey: "label",
|
|
3770
|
+
placeholder: t("WT_EXPORT"),
|
|
3771
|
+
t: t,
|
|
3772
|
+
select: handleDownload
|
|
3773
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
3774
|
+
className: "finance-mainlayout-col1"
|
|
3775
|
+
}, /*#__PURE__*/React.createElement(SubmitBar, {
|
|
3776
|
+
label: t("ES_COMMON_SEARCH"),
|
|
3777
|
+
onSubmit: handleSearch
|
|
3778
|
+
}))), /*#__PURE__*/React.createElement("div", {
|
|
3779
|
+
style: {
|
|
3780
|
+
display: "flex",
|
|
3781
|
+
gap: "5px",
|
|
3782
|
+
marginBottom: "20px"
|
|
3783
|
+
}
|
|
3784
|
+
}, days.map(day => /*#__PURE__*/React.createElement("button", {
|
|
3785
|
+
key: day,
|
|
3786
|
+
onClick: () => setSelectedDay(day),
|
|
3787
|
+
style: {
|
|
3788
|
+
padding: "8px 16px",
|
|
3789
|
+
border: "1px solid #ccc",
|
|
3790
|
+
borderRadius: "4px",
|
|
3791
|
+
background: selectedDay === day ? "#1D4E7F" : "#fff",
|
|
3792
|
+
color: selectedDay === day ? "#fff" : "#333",
|
|
3793
|
+
cursor: "pointer"
|
|
3794
|
+
}
|
|
3795
|
+
}, t(day.toUpperCase())))), /*#__PURE__*/React.createElement(Table, {
|
|
3796
|
+
t: t,
|
|
3797
|
+
data: data,
|
|
3798
|
+
columns: columns,
|
|
3799
|
+
getCellProps: cellInfo => ({}),
|
|
3800
|
+
styles: {
|
|
3801
|
+
minWidth: "1200px"
|
|
3802
|
+
},
|
|
3803
|
+
inboxStyles: {
|
|
3804
|
+
overflowX: "auto"
|
|
3805
|
+
}
|
|
3806
|
+
}), /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement("button", {
|
|
3807
|
+
onClick: () => {
|
|
3808
|
+
setEditingRowIndex(null);
|
|
3809
|
+
setShowModal(true);
|
|
3810
|
+
},
|
|
3811
|
+
style: {
|
|
3812
|
+
background: "#1E8E3E",
|
|
3813
|
+
color: "#fff",
|
|
3814
|
+
border: "none",
|
|
3815
|
+
padding: "10px 20px",
|
|
3816
|
+
borderRadius: "4px",
|
|
3817
|
+
cursor: "pointer",
|
|
3818
|
+
display: "flex",
|
|
3819
|
+
alignItems: "center",
|
|
3820
|
+
gap: "5px",
|
|
3821
|
+
marginBottom: "10px"
|
|
3822
|
+
}
|
|
3823
|
+
}, /*#__PURE__*/React.createElement("span", null, "+"), " ", t("WT_ADD_TRIP")))), showModal && /*#__PURE__*/React.createElement(AddTripModal, {
|
|
3824
|
+
t: t,
|
|
3825
|
+
closeModal: () => {
|
|
3826
|
+
setShowModal(false);
|
|
3827
|
+
setEditingRowIndex(null);
|
|
3828
|
+
},
|
|
3829
|
+
initialValues: editingRowIndex !== null ? {
|
|
3830
|
+
scheduleId: data[editingRowIndex].scheduleId,
|
|
3831
|
+
fixedPointCode: data[editingRowIndex].fixedPoint,
|
|
3832
|
+
day: {
|
|
3833
|
+
label: t(data[editingRowIndex].day.toUpperCase()),
|
|
3834
|
+
value: data[editingRowIndex].day
|
|
3835
|
+
},
|
|
3836
|
+
frequencyNo: data[editingRowIndex].freq,
|
|
3837
|
+
arrivalTimeFpl: data[editingRowIndex].arrToFpl,
|
|
3838
|
+
departureTimeFpl: data[editingRowIndex].depFromFpl,
|
|
3839
|
+
arrivalFixedPoint: data[editingRowIndex].arrAtFixedPoint,
|
|
3840
|
+
departureFixedPoint: data[editingRowIndex].depAtFixedPoint,
|
|
3841
|
+
returnFpl: data[editingRowIndex].returnToFpl,
|
|
3842
|
+
volume: data[editingRowIndex].volume,
|
|
3843
|
+
vehicleId: data[editingRowIndex].vehicle,
|
|
3844
|
+
active: {
|
|
3845
|
+
label: data[editingRowIndex].active === "Y" ? t("YES") : t("NO"),
|
|
3846
|
+
value: data[editingRowIndex].active === "Y" ? "Yes" : "No"
|
|
3847
|
+
}
|
|
3848
|
+
} : null,
|
|
3849
|
+
onSubmit: formData => {
|
|
3850
|
+
var _formData$day, _formData$active;
|
|
3851
|
+
const rowData = {
|
|
3852
|
+
scheduleId: formData.scheduleId || `SASID-000${data.length + 1}`,
|
|
3853
|
+
fixedPoint: formData.fixedPointCode || "FP01",
|
|
3854
|
+
day: ((_formData$day = formData.day) === null || _formData$day === void 0 ? void 0 : _formData$day.value) || "Mon",
|
|
3855
|
+
freq: formData.frequencyNo || "1",
|
|
3856
|
+
arrToFpl: formData.arrivalTimeFpl || "--:--",
|
|
3857
|
+
depFromFpl: formData.departureTimeFpl || "--:--",
|
|
3858
|
+
arrAtFixedPoint: formData.arrivalFixedPoint || "--:--",
|
|
3859
|
+
depAtFixedPoint: formData.departureFixedPoint || "--:--",
|
|
3860
|
+
returnToFpl: formData.returnFpl || "--:--",
|
|
3861
|
+
volume: formData.volume || "0 KL",
|
|
3862
|
+
vehicle: formData.vehicleId || "NA",
|
|
3863
|
+
active: ((_formData$active = formData.active) === null || _formData$active === void 0 ? void 0 : _formData$active.value) === "Yes" ? "Y" : "N"
|
|
3864
|
+
};
|
|
3865
|
+
if (editingRowIndex !== null) {
|
|
3866
|
+
const updatedData = [...data];
|
|
3867
|
+
updatedData[editingRowIndex] = rowData;
|
|
3868
|
+
setData(updatedData);
|
|
3869
|
+
} else {
|
|
3870
|
+
setData([...data, rowData]);
|
|
3871
|
+
}
|
|
3872
|
+
setShowModal(false);
|
|
3873
|
+
setEditingRowIndex(null);
|
|
3874
|
+
}
|
|
3875
|
+
}));
|
|
3876
|
+
};
|
|
3877
|
+
|
|
3878
|
+
delete L.Icon.Default.prototype._getIconUrl;
|
|
3879
|
+
L.Icon.Default.mergeOptions({
|
|
3880
|
+
iconRetinaUrl: "https://unpkg.com/leaflet@1.9.4/dist/images/marker-icon-2x.png",
|
|
3881
|
+
iconUrl: "https://unpkg.com/leaflet@1.9.4/dist/images/marker-icon.png",
|
|
3882
|
+
shadowUrl: "https://unpkg.com/leaflet@1.9.4/dist/images/marker-shadow.png"
|
|
3883
|
+
});
|
|
3884
|
+
const onlineIcon = new L.Icon({
|
|
3885
|
+
iconUrl: "https://raw.githubusercontent.com/pointhi/leaflet-color-markers/master/img/marker-icon-2x-green.png",
|
|
3886
|
+
shadowUrl: "https://cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.7/images/marker-shadow.png",
|
|
3887
|
+
iconSize: [25, 41],
|
|
3888
|
+
iconAnchor: [12, 41],
|
|
3889
|
+
popupAnchor: [1, -34],
|
|
3890
|
+
shadowSize: [41, 41]
|
|
3891
|
+
});
|
|
3892
|
+
const offlineIcon = new L.Icon({
|
|
3893
|
+
iconUrl: "https://raw.githubusercontent.com/pointhi/leaflet-color-markers/master/img/marker-icon-2x-red.png",
|
|
3894
|
+
shadowUrl: "https://cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.7/images/marker-shadow.png",
|
|
3895
|
+
iconSize: [25, 41],
|
|
3896
|
+
iconAnchor: [12, 41],
|
|
3897
|
+
popupAnchor: [1, -34],
|
|
3898
|
+
shadowSize: [41, 41]
|
|
3899
|
+
});
|
|
3900
|
+
const destinationIcon = new L.Icon({
|
|
3901
|
+
iconUrl: "https://raw.githubusercontent.com/pointhi/leaflet-color-markers/master/img/marker-icon-2x-blue.png",
|
|
3902
|
+
shadowUrl: "https://cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.7/images/marker-shadow.png",
|
|
3903
|
+
iconSize: [25, 41],
|
|
3904
|
+
iconAnchor: [12, 41],
|
|
3905
|
+
popupAnchor: [1, -34],
|
|
3906
|
+
shadowSize: [41, 41]
|
|
3907
|
+
});
|
|
3908
|
+
const SOCKET_URL = "http://localhost:3000";
|
|
3909
|
+
const MapController = ({
|
|
3910
|
+
selectedDriver
|
|
3911
|
+
}) => {
|
|
3912
|
+
const map = useMap();
|
|
3913
|
+
useEffect(() => {
|
|
3914
|
+
if (selectedDriver !== null && selectedDriver !== void 0 && selectedDriver.lat && selectedDriver !== null && selectedDriver !== void 0 && selectedDriver.lng) {
|
|
3915
|
+
map.setView([selectedDriver.lat, selectedDriver.lng], 15, {
|
|
3916
|
+
animate: true,
|
|
3917
|
+
duration: 1
|
|
3918
|
+
});
|
|
3919
|
+
}
|
|
3920
|
+
}, [selectedDriver, map]);
|
|
3921
|
+
return null;
|
|
3922
|
+
};
|
|
3923
|
+
const useRoute = (start, end) => {
|
|
3924
|
+
const [routeData, setRouteData] = useState(null);
|
|
3925
|
+
const [loading, setLoading] = useState(false);
|
|
3926
|
+
const [error, setError] = useState(null);
|
|
3927
|
+
useEffect(() => {
|
|
3928
|
+
if (!start || !end) return;
|
|
3929
|
+
const fetchRoute = async () => {
|
|
3930
|
+
setLoading(true);
|
|
3931
|
+
try {
|
|
3932
|
+
const response = await fetch(`https://router.project-osrm.org/route/v1/driving/${start.lng},${start.lat};${end.lng},${end.lat}?overview=full&geometries=geojson&steps=true`);
|
|
3933
|
+
if (!response.ok) throw new Error("Failed to fetch route");
|
|
3934
|
+
const data = await response.json();
|
|
3935
|
+
if (data.routes && data.routes[0]) {
|
|
3936
|
+
const route = data.routes[0];
|
|
3937
|
+
const coordinates = route.geometry.coordinates.map(coord => [coord[1], coord[0]]);
|
|
3938
|
+
setRouteData({
|
|
3939
|
+
coordinates,
|
|
3940
|
+
distance: route.distance,
|
|
3941
|
+
duration: route.duration,
|
|
3942
|
+
legs: route.legs
|
|
3943
|
+
});
|
|
3944
|
+
}
|
|
3945
|
+
} catch (err) {
|
|
3946
|
+
console.error("Error fetching route:", err);
|
|
3947
|
+
setError(err.message);
|
|
3948
|
+
} finally {
|
|
3949
|
+
setLoading(false);
|
|
3950
|
+
}
|
|
3951
|
+
};
|
|
3952
|
+
fetchRoute();
|
|
3953
|
+
}, [start === null || start === void 0 ? void 0 : start.lat, start === null || start === void 0 ? void 0 : start.lng, end === null || end === void 0 ? void 0 : end.lat, end === null || end === void 0 ? void 0 : end.lng]);
|
|
3954
|
+
return {
|
|
3955
|
+
routeData,
|
|
3956
|
+
loading,
|
|
3957
|
+
error
|
|
3958
|
+
};
|
|
3959
|
+
};
|
|
3960
|
+
const RouteLayer = ({
|
|
3961
|
+
start,
|
|
3962
|
+
end,
|
|
3963
|
+
color: _color = "#2196f3",
|
|
3964
|
+
weight: _weight = 6
|
|
3965
|
+
}) => {
|
|
3966
|
+
const {
|
|
3967
|
+
routeData,
|
|
3968
|
+
loading,
|
|
3969
|
+
error
|
|
3970
|
+
} = useRoute(start, end);
|
|
3971
|
+
const [showSteps, setShowSteps] = useState(false);
|
|
3972
|
+
const [selectedStep, setSelectedStep] = useState(null);
|
|
3973
|
+
if (loading) {
|
|
3974
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
3975
|
+
style: {
|
|
3976
|
+
position: "absolute",
|
|
3977
|
+
top: "20px",
|
|
3978
|
+
left: "20px",
|
|
3979
|
+
background: "white",
|
|
3980
|
+
padding: "8px 16px",
|
|
3981
|
+
borderRadius: "4px",
|
|
3982
|
+
boxShadow: "0 2px 4px rgba(0,0,0,0.1)",
|
|
3983
|
+
zIndex: 1000
|
|
3984
|
+
}
|
|
3985
|
+
}, "Loading route...");
|
|
3986
|
+
}
|
|
3987
|
+
if (error) {
|
|
3988
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
3989
|
+
style: {
|
|
3990
|
+
position: "absolute",
|
|
3991
|
+
top: "20px",
|
|
3992
|
+
left: "20px",
|
|
3993
|
+
background: "#ffebee",
|
|
3994
|
+
color: "#c62828",
|
|
3995
|
+
padding: "8px 16px",
|
|
3996
|
+
borderRadius: "4px",
|
|
3997
|
+
boxShadow: "0 2px 4px rgba(0,0,0,0.1)",
|
|
3998
|
+
zIndex: 1000
|
|
3999
|
+
}
|
|
4000
|
+
}, "Error loading route: ", error);
|
|
4001
|
+
}
|
|
4002
|
+
if (!routeData) return null;
|
|
4003
|
+
const renderRouteSegments = () => {
|
|
4004
|
+
if (!routeData.legs) return null;
|
|
4005
|
+
const segments = [];
|
|
4006
|
+
routeData.legs.forEach((leg, legIndex) => {
|
|
4007
|
+
leg.steps.forEach((step, stepIndex) => {
|
|
4008
|
+
const stepCoordinates = step.geometry.coordinates.map(coord => [coord[1], coord[0]]);
|
|
4009
|
+
let segmentColor = _color;
|
|
4010
|
+
if (step.maneuver.type === "turn") {
|
|
4011
|
+
segmentColor = "#ff9800";
|
|
4012
|
+
} else if (step.maneuver.type === "straight") {
|
|
4013
|
+
segmentColor = "#4caf50";
|
|
4014
|
+
} else if (step.maneuver.type === "arrive") {
|
|
4015
|
+
segmentColor = "#f44336";
|
|
4016
|
+
}
|
|
4017
|
+
segments.push(/*#__PURE__*/React.createElement(React.Fragment, {
|
|
4018
|
+
key: `${legIndex}-${stepIndex}`
|
|
4019
|
+
}, /*#__PURE__*/React.createElement(Polyline, {
|
|
4020
|
+
positions: stepCoordinates,
|
|
4021
|
+
color: segmentColor,
|
|
4022
|
+
weight: _weight + 2,
|
|
4023
|
+
opacity: 0.3,
|
|
4024
|
+
lineCap: "round"
|
|
4025
|
+
}), /*#__PURE__*/React.createElement(Polyline, {
|
|
4026
|
+
positions: stepCoordinates,
|
|
4027
|
+
color: segmentColor,
|
|
4028
|
+
weight: _weight,
|
|
4029
|
+
opacity: 0.9,
|
|
4030
|
+
lineCap: "round",
|
|
4031
|
+
eventHandlers: {
|
|
4032
|
+
mouseover: () => setSelectedStep(step),
|
|
4033
|
+
mouseout: () => setSelectedStep(null),
|
|
4034
|
+
click: () => setShowSteps(!showSteps)
|
|
4035
|
+
}
|
|
4036
|
+
}), stepCoordinates.map((coord, idx) => {
|
|
4037
|
+
if (idx % 5 === 0 && idx < stepCoordinates.length - 1) {
|
|
4038
|
+
const nextCoord = stepCoordinates[idx + 1];
|
|
4039
|
+
const angle = Math.atan2(nextCoord[0] - coord[0], nextCoord[1] - coord[1]) * 180 / Math.PI;
|
|
4040
|
+
return /*#__PURE__*/React.createElement(Marker, {
|
|
4041
|
+
key: `dot-${legIndex}-${stepIndex}-${idx}`,
|
|
4042
|
+
position: coord,
|
|
4043
|
+
icon: L.divIcon({
|
|
4044
|
+
className: "direction-dot",
|
|
4045
|
+
html: `<div style="
|
|
4046
|
+
width: 6px;
|
|
4047
|
+
height: 6px;
|
|
4048
|
+
background: white;
|
|
4049
|
+
border: 2px solid ${segmentColor};
|
|
4050
|
+
border-radius: 50%;
|
|
4051
|
+
transform: rotate(${angle}deg);
|
|
4052
|
+
"></div>`,
|
|
4053
|
+
iconSize: [10, 10],
|
|
4054
|
+
iconAnchor: [5, 5]
|
|
4055
|
+
})
|
|
4056
|
+
});
|
|
4057
|
+
}
|
|
4058
|
+
return null;
|
|
4059
|
+
})));
|
|
4060
|
+
});
|
|
4061
|
+
});
|
|
4062
|
+
return segments;
|
|
4063
|
+
};
|
|
4064
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, renderRouteSegments(), (selectedStep || showSteps) && /*#__PURE__*/React.createElement("div", {
|
|
4065
|
+
style: {
|
|
4066
|
+
position: "absolute",
|
|
4067
|
+
bottom: "80px",
|
|
4068
|
+
left: "10px",
|
|
4069
|
+
right: "10px",
|
|
4070
|
+
background: "white",
|
|
4071
|
+
padding: "16px",
|
|
4072
|
+
borderRadius: "8px",
|
|
4073
|
+
boxShadow: "0 4px 12px rgba(0,0,0,0.15)",
|
|
4074
|
+
zIndex: 1000,
|
|
4075
|
+
maxWidth: "calc(100% - 20px)",
|
|
4076
|
+
border: "1px solid #e0e0e0",
|
|
4077
|
+
maxHeight: "50vh",
|
|
4078
|
+
overflowY: "auto"
|
|
4079
|
+
}
|
|
4080
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
4081
|
+
style: {
|
|
4082
|
+
display: "flex",
|
|
4083
|
+
justifyContent: "space-between",
|
|
4084
|
+
alignItems: "center",
|
|
4085
|
+
marginBottom: "8px"
|
|
4086
|
+
}
|
|
4087
|
+
}, /*#__PURE__*/React.createElement("h4", {
|
|
4088
|
+
style: {
|
|
4089
|
+
margin: 0,
|
|
4090
|
+
color: "#1a237e"
|
|
4091
|
+
}
|
|
4092
|
+
}, "Route Information"), /*#__PURE__*/React.createElement("button", {
|
|
4093
|
+
onClick: () => setShowSteps(false),
|
|
4094
|
+
style: {
|
|
4095
|
+
background: "none",
|
|
4096
|
+
border: "none",
|
|
4097
|
+
cursor: "pointer",
|
|
4098
|
+
fontSize: "24px",
|
|
4099
|
+
color: "#666",
|
|
4100
|
+
padding: "0 8px"
|
|
4101
|
+
}
|
|
4102
|
+
}, "\xD7")), /*#__PURE__*/React.createElement("div", {
|
|
4103
|
+
style: {
|
|
4104
|
+
marginBottom: "12px"
|
|
4105
|
+
}
|
|
4106
|
+
}, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("strong", null, "Total Distance:"), " ", (routeData.distance / 1000).toFixed(2), " km"), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("strong", null, "Est. Time:"), " ", Math.round(routeData.duration / 60), " minutes")), selectedStep && /*#__PURE__*/React.createElement("div", {
|
|
4107
|
+
style: {
|
|
4108
|
+
padding: "8px",
|
|
4109
|
+
background: "#f5f5f5",
|
|
4110
|
+
borderRadius: "4px",
|
|
4111
|
+
marginBottom: "8px"
|
|
4112
|
+
}
|
|
4113
|
+
}, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("strong", null, "Current Step:"), " ", selectedStep.maneuver.type), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("strong", null, "Instruction:"), " ", selectedStep.maneuver.instruction || selectedStep.name), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("strong", null, "Distance:"), " ", (selectedStep.distance / 1000).toFixed(2), " km"), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("strong", null, "Duration:"), " ", Math.round(selectedStep.duration / 60), " min")), showSteps && routeData.legs && /*#__PURE__*/React.createElement("div", {
|
|
4114
|
+
style: {
|
|
4115
|
+
maxHeight: "200px",
|
|
4116
|
+
overflowY: "auto"
|
|
4117
|
+
}
|
|
4118
|
+
}, /*#__PURE__*/React.createElement("h5", {
|
|
4119
|
+
style: {
|
|
4120
|
+
margin: "8px 0",
|
|
4121
|
+
color: "#666"
|
|
4122
|
+
}
|
|
4123
|
+
}, "Turn-by-turn directions:"), routeData.legs[0].steps.map((step, idx) => /*#__PURE__*/React.createElement("div", {
|
|
4124
|
+
key: idx,
|
|
4125
|
+
style: {
|
|
4126
|
+
padding: "8px",
|
|
4127
|
+
borderBottom: "1px solid #eee",
|
|
4128
|
+
fontSize: "12px",
|
|
4129
|
+
cursor: "pointer",
|
|
4130
|
+
background: selectedStep === step ? "#e3f2fd" : "transparent"
|
|
4131
|
+
},
|
|
4132
|
+
onMouseEnter: () => setSelectedStep(step),
|
|
4133
|
+
onMouseLeave: () => setSelectedStep(null)
|
|
4134
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
4135
|
+
style: {
|
|
4136
|
+
display: "flex",
|
|
4137
|
+
alignItems: "center",
|
|
4138
|
+
gap: "8px"
|
|
4139
|
+
}
|
|
4140
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
4141
|
+
style: {
|
|
4142
|
+
width: "20px",
|
|
4143
|
+
height: "20px",
|
|
4144
|
+
borderRadius: "50%",
|
|
4145
|
+
background: "#1a237e",
|
|
4146
|
+
color: "white",
|
|
4147
|
+
display: "flex",
|
|
4148
|
+
alignItems: "center",
|
|
4149
|
+
justifyContent: "center",
|
|
4150
|
+
fontSize: "10px",
|
|
4151
|
+
flexShrink: 0
|
|
4152
|
+
}
|
|
4153
|
+
}, idx + 1), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
|
|
4154
|
+
style: {
|
|
4155
|
+
fontWeight: "500"
|
|
4156
|
+
}
|
|
4157
|
+
}, step.maneuver.instruction || step.name), /*#__PURE__*/React.createElement("div", {
|
|
4158
|
+
style: {
|
|
4159
|
+
color: "#666"
|
|
4160
|
+
}
|
|
4161
|
+
}, (step.distance / 1000).toFixed(2), " km \xB7 ", Math.round(step.duration / 60), " min"))))))), routeData.distance > 1000 && routeData.coordinates && /*#__PURE__*/React.createElement(RouteMarkers, {
|
|
4162
|
+
coordinates: routeData.coordinates,
|
|
4163
|
+
totalDistance: routeData.distance
|
|
4164
|
+
}));
|
|
4165
|
+
};
|
|
4166
|
+
const RouteMarkers = ({
|
|
4167
|
+
coordinates,
|
|
4168
|
+
totalDistance
|
|
4169
|
+
}) => {
|
|
4170
|
+
const markers = [];
|
|
4171
|
+
const interval = 1000;
|
|
4172
|
+
for (let i = interval; i < totalDistance; i += interval) {
|
|
4173
|
+
const fraction = i / totalDistance;
|
|
4174
|
+
const index = Math.floor(coordinates.length * fraction);
|
|
4175
|
+
if (index < coordinates.length) {
|
|
4176
|
+
markers.push(/*#__PURE__*/React.createElement(Marker, {
|
|
4177
|
+
key: `dist-${i}`,
|
|
4178
|
+
position: coordinates[index],
|
|
4179
|
+
icon: L.divIcon({
|
|
4180
|
+
className: "distance-marker",
|
|
4181
|
+
html: `<div style="
|
|
4182
|
+
background: white;
|
|
4183
|
+
border: 2px solid #2196f3;
|
|
4184
|
+
border-radius: 12px;
|
|
4185
|
+
padding: 2px 6px;
|
|
4186
|
+
font-size: 10px;
|
|
4187
|
+
font-weight: bold;
|
|
4188
|
+
color: #1a237e;
|
|
4189
|
+
white-space: nowrap;
|
|
4190
|
+
">${(i / 1000).toFixed(0)} km</div>`,
|
|
4191
|
+
iconSize: [40, 20],
|
|
4192
|
+
iconAnchor: [20, 10]
|
|
4193
|
+
})
|
|
4194
|
+
}));
|
|
4195
|
+
}
|
|
4196
|
+
}
|
|
4197
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, markers);
|
|
4198
|
+
};
|
|
4199
|
+
const StatusBadge = ({
|
|
4200
|
+
isOnline
|
|
4201
|
+
}) => /*#__PURE__*/React.createElement("span", {
|
|
4202
|
+
style: {
|
|
4203
|
+
display: "inline-block",
|
|
4204
|
+
padding: "4px 8px",
|
|
4205
|
+
borderRadius: "12px",
|
|
4206
|
+
fontSize: "12px",
|
|
4207
|
+
fontWeight: "600",
|
|
4208
|
+
backgroundColor: isOnline ? "#e6f7e6" : "#ffe6e6",
|
|
4209
|
+
color: isOnline ? "#2e7d32" : "#c62828",
|
|
4210
|
+
border: `1px solid ${isOnline ? "#a5d6a7" : "#ef9a9a"}`
|
|
4211
|
+
}
|
|
4212
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
4213
|
+
style: {
|
|
4214
|
+
display: "inline-block",
|
|
4215
|
+
width: "8px",
|
|
4216
|
+
height: "8px",
|
|
4217
|
+
borderRadius: "50%",
|
|
4218
|
+
backgroundColor: isOnline ? "#4caf50" : "#f44336",
|
|
4219
|
+
marginRight: "6px"
|
|
4220
|
+
}
|
|
4221
|
+
}), isOnline ? "ONLINE" : "OFFLINE");
|
|
4222
|
+
const DriverCard = ({
|
|
4223
|
+
driver,
|
|
4224
|
+
isSelected,
|
|
4225
|
+
onClick
|
|
4226
|
+
}) => {
|
|
4227
|
+
const calculateETA = () => {
|
|
4228
|
+
if (!driver.lat || !driver.lng || !driver.deliveryLat || !driver.deliveryLng) return null;
|
|
4229
|
+
const distance = calculateDistance(driver.lat, driver.lng, driver.deliveryLat, driver.deliveryLng);
|
|
4230
|
+
const minutes = Math.round(distance / 30 * 60);
|
|
4231
|
+
return minutes;
|
|
4232
|
+
};
|
|
4233
|
+
const eta = calculateETA();
|
|
4234
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
4235
|
+
onClick: onClick,
|
|
4236
|
+
style: {
|
|
4237
|
+
padding: "16px",
|
|
4238
|
+
marginBottom: "12px",
|
|
4239
|
+
borderRadius: "12px",
|
|
4240
|
+
background: isSelected ? "#e3f2fd" : "#ffffff",
|
|
4241
|
+
border: `2px solid ${isSelected ? "#2196f3" : "#e0e0e0"}`,
|
|
4242
|
+
boxShadow: isSelected ? "0 4px 12px rgba(33, 150, 243, 0.2)" : "0 2px 8px rgba(0, 0, 0, 0.05)",
|
|
4243
|
+
cursor: "pointer",
|
|
4244
|
+
transition: "all 0.2s ease",
|
|
4245
|
+
position: "relative",
|
|
4246
|
+
overflow: "hidden"
|
|
4247
|
+
}
|
|
4248
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
4249
|
+
style: {
|
|
4250
|
+
position: "absolute",
|
|
4251
|
+
top: 0,
|
|
4252
|
+
left: 0,
|
|
4253
|
+
right: 0,
|
|
4254
|
+
height: "4px",
|
|
4255
|
+
background: driver.isOnline ? "linear-gradient(90deg, #4caf50, #81c784)" : "linear-gradient(90deg, #f44336, #e57373)"
|
|
4256
|
+
}
|
|
4257
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
4258
|
+
style: {
|
|
4259
|
+
display: "flex",
|
|
4260
|
+
alignItems: "center",
|
|
4261
|
+
marginBottom: "12px"
|
|
4262
|
+
}
|
|
4263
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
4264
|
+
style: {
|
|
4265
|
+
width: "40px",
|
|
4266
|
+
height: "40px",
|
|
4267
|
+
borderRadius: "50%",
|
|
4268
|
+
background: driver.isOnline ? "linear-gradient(135deg, #4caf50, #81c784)" : "linear-gradient(135deg, #9e9e9e, #bdbdbd)",
|
|
4269
|
+
display: "flex",
|
|
4270
|
+
alignItems: "center",
|
|
4271
|
+
justifyContent: "center",
|
|
4272
|
+
color: "white",
|
|
4273
|
+
fontWeight: "bold",
|
|
4274
|
+
fontSize: "16px",
|
|
4275
|
+
marginRight: "12px",
|
|
4276
|
+
flexShrink: 0
|
|
4277
|
+
}
|
|
4278
|
+
}, driver.driverId.charAt(0).toUpperCase()), /*#__PURE__*/React.createElement("div", {
|
|
4279
|
+
style: {
|
|
4280
|
+
flex: 1,
|
|
4281
|
+
minWidth: 0
|
|
4282
|
+
}
|
|
4283
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
4284
|
+
style: {
|
|
4285
|
+
fontWeight: "600",
|
|
4286
|
+
fontSize: "16px",
|
|
4287
|
+
color: "#1a237e",
|
|
4288
|
+
marginBottom: "4px",
|
|
4289
|
+
overflow: "hidden",
|
|
4290
|
+
textOverflow: "ellipsis",
|
|
4291
|
+
whiteSpace: "nowrap"
|
|
4292
|
+
}
|
|
4293
|
+
}, "Driver #", driver.driverId.substring(0, 8), "..."), /*#__PURE__*/React.createElement(StatusBadge, {
|
|
4294
|
+
isOnline: driver.isOnline
|
|
4295
|
+
}))), driver.lat && driver.lng && /*#__PURE__*/React.createElement("div", {
|
|
4296
|
+
style: {
|
|
4297
|
+
marginBottom: "8px"
|
|
4298
|
+
}
|
|
4299
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
4300
|
+
style: {
|
|
4301
|
+
fontSize: "12px",
|
|
4302
|
+
color: "#666",
|
|
4303
|
+
marginBottom: "4px"
|
|
4304
|
+
}
|
|
4305
|
+
}, "Current Location"), /*#__PURE__*/React.createElement("div", {
|
|
4306
|
+
style: {
|
|
4307
|
+
display: "grid",
|
|
4308
|
+
gridTemplateColumns: "1fr 1fr",
|
|
4309
|
+
gap: "4px",
|
|
4310
|
+
fontSize: "11px"
|
|
4311
|
+
}
|
|
4312
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
4313
|
+
style: {
|
|
4314
|
+
color: "#666"
|
|
4315
|
+
}
|
|
4316
|
+
}, "Lat:"), /*#__PURE__*/React.createElement("span", {
|
|
4317
|
+
style: {
|
|
4318
|
+
fontFamily: "monospace",
|
|
4319
|
+
overflow: "hidden",
|
|
4320
|
+
textOverflow: "ellipsis"
|
|
4321
|
+
}
|
|
4322
|
+
}, driver.lat.toFixed(4)), /*#__PURE__*/React.createElement("span", {
|
|
4323
|
+
style: {
|
|
4324
|
+
color: "#666"
|
|
4325
|
+
}
|
|
4326
|
+
}, "Lng:"), /*#__PURE__*/React.createElement("span", {
|
|
4327
|
+
style: {
|
|
4328
|
+
fontFamily: "monospace",
|
|
4329
|
+
overflow: "hidden",
|
|
4330
|
+
textOverflow: "ellipsis"
|
|
4331
|
+
}
|
|
4332
|
+
}, driver.lng.toFixed(4)))), driver.deliveryLat && driver.deliveryLng && /*#__PURE__*/React.createElement("div", {
|
|
4333
|
+
style: {
|
|
4334
|
+
marginBottom: "8px"
|
|
4335
|
+
}
|
|
4336
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
4337
|
+
style: {
|
|
4338
|
+
fontSize: "12px",
|
|
4339
|
+
color: "#666",
|
|
4340
|
+
marginBottom: "4px"
|
|
4341
|
+
}
|
|
4342
|
+
}, "Delivery Destination"), /*#__PURE__*/React.createElement("div", {
|
|
4343
|
+
style: {
|
|
4344
|
+
display: "grid",
|
|
4345
|
+
gridTemplateColumns: "1fr 1fr",
|
|
4346
|
+
gap: "4px",
|
|
4347
|
+
fontSize: "11px"
|
|
4348
|
+
}
|
|
4349
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
4350
|
+
style: {
|
|
4351
|
+
color: "#666"
|
|
4352
|
+
}
|
|
4353
|
+
}, "Lat:"), /*#__PURE__*/React.createElement("span", {
|
|
4354
|
+
style: {
|
|
4355
|
+
fontFamily: "monospace",
|
|
4356
|
+
overflow: "hidden",
|
|
4357
|
+
textOverflow: "ellipsis"
|
|
4358
|
+
}
|
|
4359
|
+
}, driver.deliveryLat.toFixed(4)), /*#__PURE__*/React.createElement("span", {
|
|
4360
|
+
style: {
|
|
4361
|
+
color: "#666"
|
|
4362
|
+
}
|
|
4363
|
+
}, "Lng:"), /*#__PURE__*/React.createElement("span", {
|
|
4364
|
+
style: {
|
|
4365
|
+
fontFamily: "monospace",
|
|
4366
|
+
overflow: "hidden",
|
|
4367
|
+
textOverflow: "ellipsis"
|
|
4368
|
+
}
|
|
4369
|
+
}, driver.deliveryLng.toFixed(4)))), eta !== null && /*#__PURE__*/React.createElement("div", {
|
|
4370
|
+
style: {
|
|
4371
|
+
marginTop: "8px",
|
|
4372
|
+
padding: "8px",
|
|
4373
|
+
background: "#f5f5f5",
|
|
4374
|
+
borderRadius: "6px",
|
|
4375
|
+
display: "flex",
|
|
4376
|
+
justifyContent: "space-between",
|
|
4377
|
+
alignItems: "center",
|
|
4378
|
+
flexWrap: "wrap",
|
|
4379
|
+
gap: "8px"
|
|
4380
|
+
}
|
|
4381
|
+
}, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
|
|
4382
|
+
style: {
|
|
4383
|
+
fontSize: "11px",
|
|
4384
|
+
color: "#666"
|
|
4385
|
+
}
|
|
4386
|
+
}, "Est. Arrival"), /*#__PURE__*/React.createElement("div", {
|
|
4387
|
+
style: {
|
|
4388
|
+
fontSize: "14px",
|
|
4389
|
+
fontWeight: "600",
|
|
4390
|
+
color: "#1a237e"
|
|
4391
|
+
}
|
|
4392
|
+
}, eta, " min")), driver.speed && /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
|
|
4393
|
+
style: {
|
|
4394
|
+
fontSize: "11px",
|
|
4395
|
+
color: "#666"
|
|
4396
|
+
}
|
|
4397
|
+
}, "Speed"), /*#__PURE__*/React.createElement("div", {
|
|
4398
|
+
style: {
|
|
4399
|
+
fontSize: "14px",
|
|
4400
|
+
fontWeight: "600",
|
|
4401
|
+
color: "#4caf50"
|
|
4402
|
+
}
|
|
4403
|
+
}, Math.round(driver.speed * 3.6), " km/h"))), /*#__PURE__*/React.createElement("div", {
|
|
4404
|
+
style: {
|
|
4405
|
+
marginTop: "12px",
|
|
4406
|
+
fontSize: "11px",
|
|
4407
|
+
color: "#999",
|
|
4408
|
+
borderTop: "1px solid #eee",
|
|
4409
|
+
paddingTop: "8px",
|
|
4410
|
+
display: "grid",
|
|
4411
|
+
gridTemplateColumns: "1fr 1fr",
|
|
4412
|
+
gap: "4px"
|
|
4413
|
+
}
|
|
4414
|
+
}, driver.accuracy && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", null, "Accuracy"), /*#__PURE__*/React.createElement("span", null, Math.round(driver.accuracy), "m")), driver.heading && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", null, "Heading"), /*#__PURE__*/React.createElement("span", null, Math.round(driver.heading), "\xB0")), driver.lastSeen && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", null, "Last seen"), /*#__PURE__*/React.createElement("span", null, new Date(driver.lastSeen).toLocaleTimeString()))));
|
|
4415
|
+
};
|
|
4416
|
+
function calculateDistance(lat1, lon1, lat2, lon2) {
|
|
4417
|
+
const R = 6371;
|
|
4418
|
+
const dLat = (lat2 - lat1) * Math.PI / 180;
|
|
4419
|
+
const dLon = (lon2 - lon1) * Math.PI / 180;
|
|
4420
|
+
const a = Math.sin(dLat / 2) * Math.sin(dLat / 2) + Math.cos(lat1 * Math.PI / 180) * Math.cos(lat2 * Math.PI / 180) * Math.sin(dLon / 2) * Math.sin(dLon / 2);
|
|
4421
|
+
const c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
|
|
4422
|
+
return R * c;
|
|
4423
|
+
}
|
|
4424
|
+
function LiveTrackingSystem() {
|
|
4425
|
+
var _selectedDriver$lat, _selectedDriver$lng, _selectedDriver$lat2, _selectedDriver$lng2;
|
|
4426
|
+
const [drivers, setDrivers] = useState({});
|
|
4427
|
+
const [isConnected, setIsConnected] = useState(false);
|
|
4428
|
+
const [selectedDriver, setSelectedDriver] = useState(null);
|
|
4429
|
+
const [searchTerm, setSearchTerm] = useState("");
|
|
4430
|
+
const [filterOnline, setFilterOnline] = useState("all");
|
|
4431
|
+
const [showRoutes, setShowRoutes] = useState(true);
|
|
4432
|
+
const [mapCenter, setMapCenter] = useState([28.6139, 77.209]);
|
|
4433
|
+
const [mapZoom, setMapZoom] = useState(12);
|
|
4434
|
+
const [showSidebar, setShowSidebar] = useState(true);
|
|
4435
|
+
const [isMobile, setIsMobile] = useState(window.innerWidth <= 768);
|
|
4436
|
+
useEffect(() => {
|
|
4437
|
+
const handleResize = () => {
|
|
4438
|
+
setIsMobile(window.innerWidth <= 768);
|
|
4439
|
+
if (window.innerWidth <= 768) {
|
|
4440
|
+
setShowSidebar(false);
|
|
4441
|
+
} else {
|
|
4442
|
+
setShowSidebar(true);
|
|
4443
|
+
}
|
|
4444
|
+
};
|
|
4445
|
+
window.addEventListener("resize", handleResize);
|
|
4446
|
+
handleResize();
|
|
4447
|
+
return () => window.removeEventListener("resize", handleResize);
|
|
4448
|
+
}, []);
|
|
4449
|
+
const socket = useMemo(() => {
|
|
4450
|
+
return io(SOCKET_URL, {
|
|
4451
|
+
transports: ["websocket"],
|
|
4452
|
+
autoConnect: false
|
|
4453
|
+
});
|
|
4454
|
+
}, []);
|
|
4455
|
+
useEffect(() => {
|
|
4456
|
+
socket.connect();
|
|
4457
|
+
socket.on("connect", () => {
|
|
4458
|
+
console.log("Admin connected:", socket.id);
|
|
4459
|
+
setIsConnected(true);
|
|
4460
|
+
socket.emit("admin-join");
|
|
4461
|
+
});
|
|
4462
|
+
socket.on("disconnect", () => {
|
|
4463
|
+
console.log("Admin disconnected");
|
|
4464
|
+
setIsConnected(false);
|
|
4465
|
+
});
|
|
4466
|
+
socket.on("drivers-snapshot", data => {
|
|
4467
|
+
console.log("drivers-snapshot", data);
|
|
4468
|
+
if (!Array.isArray(data)) return;
|
|
4469
|
+
const mapped = {};
|
|
4470
|
+
data.forEach(driver => {
|
|
4471
|
+
if (driver && driver.driverId) {
|
|
4472
|
+
mapped[driver.driverId] = {
|
|
4473
|
+
...driver,
|
|
4474
|
+
lastUpdate: new Date().toISOString()
|
|
4475
|
+
};
|
|
4476
|
+
}
|
|
4477
|
+
});
|
|
4478
|
+
setDrivers(mapped);
|
|
4479
|
+
});
|
|
4480
|
+
socket.on("driver-location-update", driver => {
|
|
4481
|
+
console.log("driver-location-update", driver);
|
|
4482
|
+
if (!driver || !driver.driverId) return;
|
|
4483
|
+
setDrivers(prev => {
|
|
4484
|
+
const existingDriver = prev[driver.driverId] || {};
|
|
4485
|
+
return {
|
|
4486
|
+
...prev,
|
|
4487
|
+
[driver.driverId]: {
|
|
4488
|
+
...existingDriver,
|
|
4489
|
+
...driver,
|
|
4490
|
+
lastUpdate: new Date().toISOString()
|
|
4491
|
+
}
|
|
4492
|
+
};
|
|
4493
|
+
});
|
|
4494
|
+
});
|
|
4495
|
+
socket.on("driver-status", driver => {
|
|
4496
|
+
console.log("driver-status", driver);
|
|
4497
|
+
if (!driver || !driver.driverId) return;
|
|
4498
|
+
setDrivers(prev => ({
|
|
4499
|
+
...prev,
|
|
4500
|
+
[driver.driverId]: {
|
|
4501
|
+
...prev[driver.driverId],
|
|
4502
|
+
...driver,
|
|
4503
|
+
lastUpdate: new Date().toISOString()
|
|
4504
|
+
}
|
|
4505
|
+
}));
|
|
4506
|
+
});
|
|
4507
|
+
return () => {
|
|
4508
|
+
socket.disconnect();
|
|
4509
|
+
};
|
|
4510
|
+
}, [socket]);
|
|
4511
|
+
useEffect(() => {
|
|
4512
|
+
if (selectedDriver !== null && selectedDriver !== void 0 && selectedDriver.lat && selectedDriver !== null && selectedDriver !== void 0 && selectedDriver.lng) {
|
|
4513
|
+
setMapCenter([selectedDriver.lat, selectedDriver.lng]);
|
|
4514
|
+
setMapZoom(15);
|
|
4515
|
+
}
|
|
4516
|
+
}, [selectedDriver]);
|
|
4517
|
+
const filteredDrivers = Object.values(drivers).filter(driver => {
|
|
4518
|
+
const matchesSearch = driver.driverId.toLowerCase().includes(searchTerm.toLowerCase());
|
|
4519
|
+
const matchesStatus = filterOnline === "all" || filterOnline === "online" && driver.isOnline || filterOnline === "offline" && !driver.isOnline;
|
|
4520
|
+
return matchesSearch && matchesStatus;
|
|
4521
|
+
});
|
|
4522
|
+
const onlineCount = Object.values(drivers).filter(d => d.isOnline).length;
|
|
4523
|
+
const offlineCount = Object.values(drivers).filter(d => !d.isOnline).length;
|
|
4524
|
+
const activeDeliveries = Object.values(drivers).filter(d => d.isOnline && d.deliveryLat && d.deliveryLng).length;
|
|
4525
|
+
const toggleSidebar = () => {
|
|
4526
|
+
setShowSidebar(!showSidebar);
|
|
4527
|
+
};
|
|
4528
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
4529
|
+
style: {
|
|
4530
|
+
display: "flex",
|
|
4531
|
+
height: "100vh",
|
|
4532
|
+
width: "100%",
|
|
4533
|
+
fontFamily: "'Inter', -apple-system, BlinkMacSystemFont, sans-serif",
|
|
4534
|
+
position: "relative",
|
|
4535
|
+
overflow: "hidden"
|
|
4536
|
+
}
|
|
4537
|
+
}, isMobile && /*#__PURE__*/React.createElement("button", {
|
|
4538
|
+
onClick: toggleSidebar,
|
|
4539
|
+
style: {
|
|
4540
|
+
position: "absolute",
|
|
4541
|
+
top: "10px",
|
|
4542
|
+
left: "10px",
|
|
4543
|
+
zIndex: 2000,
|
|
4544
|
+
background: "#1a237e",
|
|
4545
|
+
color: "white",
|
|
4546
|
+
border: "none",
|
|
4547
|
+
borderRadius: "8px",
|
|
4548
|
+
padding: "10px 16px",
|
|
4549
|
+
fontSize: "14px",
|
|
4550
|
+
fontWeight: "500",
|
|
4551
|
+
cursor: "pointer",
|
|
4552
|
+
boxShadow: "0 2px 8px rgba(0,0,0,0.2)",
|
|
4553
|
+
display: "flex",
|
|
4554
|
+
alignItems: "center",
|
|
4555
|
+
gap: "8px"
|
|
4556
|
+
}
|
|
4557
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
4558
|
+
style: {
|
|
4559
|
+
fontSize: "20px"
|
|
4560
|
+
}
|
|
4561
|
+
}, "\u2630"), showSidebar ? "Hide List" : "Show Drivers"), /*#__PURE__*/React.createElement("div", {
|
|
4562
|
+
style: {
|
|
4563
|
+
width: isMobile ? showSidebar ? "100%" : "0" : "380px",
|
|
4564
|
+
height: "100%",
|
|
4565
|
+
borderRight: isMobile ? "none" : "1px solid #e0e0e0",
|
|
4566
|
+
display: "flex",
|
|
4567
|
+
flexDirection: "column",
|
|
4568
|
+
background: "#ffffff",
|
|
4569
|
+
boxShadow: isMobile ? showSidebar ? "0 0 20px rgba(0,0,0,0.2)" : "none" : "2px 0 8px rgba(0, 0, 0, 0.05)",
|
|
4570
|
+
position: isMobile ? "absolute" : "relative",
|
|
4571
|
+
top: 0,
|
|
4572
|
+
left: 0,
|
|
4573
|
+
zIndex: 1500,
|
|
4574
|
+
transition: "all 0.3s ease-in-out",
|
|
4575
|
+
overflow: showSidebar ? "visible" : "hidden",
|
|
4576
|
+
...(isMobile && !showSidebar && {
|
|
4577
|
+
width: "0",
|
|
4578
|
+
opacity: 0,
|
|
4579
|
+
pointerEvents: "none"
|
|
4580
|
+
})
|
|
4581
|
+
}
|
|
4582
|
+
}, showSidebar && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
4583
|
+
style: {
|
|
4584
|
+
padding: isMobile ? "16px" : "24px",
|
|
4585
|
+
background: "linear-gradient(135deg, #1a237e, #0d47a1)",
|
|
4586
|
+
color: "white"
|
|
4587
|
+
}
|
|
4588
|
+
}, isMobile && /*#__PURE__*/React.createElement("button", {
|
|
4589
|
+
onClick: toggleSidebar,
|
|
4590
|
+
style: {
|
|
4591
|
+
position: "absolute",
|
|
4592
|
+
top: "10px",
|
|
4593
|
+
right: "10px",
|
|
4594
|
+
background: "rgba(255,255,255,0.2)",
|
|
4595
|
+
border: "none",
|
|
4596
|
+
color: "white",
|
|
4597
|
+
fontSize: "20px",
|
|
4598
|
+
cursor: "pointer",
|
|
4599
|
+
width: "30px",
|
|
4600
|
+
height: "30px",
|
|
4601
|
+
borderRadius: "4px",
|
|
4602
|
+
display: "flex",
|
|
4603
|
+
alignItems: "center",
|
|
4604
|
+
justifyContent: "center"
|
|
4605
|
+
}
|
|
4606
|
+
}, "\u2715"), /*#__PURE__*/React.createElement("h2", {
|
|
4607
|
+
style: {
|
|
4608
|
+
margin: "0 0 8px 0",
|
|
4609
|
+
fontSize: isMobile ? "20px" : "24px",
|
|
4610
|
+
fontWeight: "600",
|
|
4611
|
+
letterSpacing: "-0.5px"
|
|
4612
|
+
}
|
|
4613
|
+
}, "Live Driver Tracking"), /*#__PURE__*/React.createElement("div", {
|
|
4614
|
+
style: {
|
|
4615
|
+
display: "flex",
|
|
4616
|
+
alignItems: "center",
|
|
4617
|
+
gap: "8px",
|
|
4618
|
+
fontSize: "14px",
|
|
4619
|
+
opacity: 0.9
|
|
4620
|
+
}
|
|
4621
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
4622
|
+
style: {
|
|
4623
|
+
display: "inline-block",
|
|
4624
|
+
width: "10px",
|
|
4625
|
+
height: "10px",
|
|
4626
|
+
borderRadius: "50%",
|
|
4627
|
+
backgroundColor: isConnected ? "#4caf50" : "#f44336",
|
|
4628
|
+
animation: isConnected ? "pulse 2s infinite" : "none"
|
|
4629
|
+
}
|
|
4630
|
+
}), /*#__PURE__*/React.createElement("span", null, isConnected ? "Connected to server" : "Disconnected"))), /*#__PURE__*/React.createElement("div", {
|
|
4631
|
+
style: {
|
|
4632
|
+
display: "grid",
|
|
4633
|
+
gridTemplateColumns: "1fr 1fr 1fr 1fr",
|
|
4634
|
+
gap: isMobile ? "4px" : "8px",
|
|
4635
|
+
padding: isMobile ? "12px" : "16px",
|
|
4636
|
+
background: "#f5f5f5",
|
|
4637
|
+
borderBottom: "1px solid #e0e0e0"
|
|
4638
|
+
}
|
|
4639
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
4640
|
+
style: {
|
|
4641
|
+
textAlign: "center"
|
|
4642
|
+
}
|
|
4643
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
4644
|
+
style: {
|
|
4645
|
+
fontSize: isMobile ? "10px" : "11px",
|
|
4646
|
+
color: "#666"
|
|
4647
|
+
}
|
|
4648
|
+
}, "Total"), /*#__PURE__*/React.createElement("div", {
|
|
4649
|
+
style: {
|
|
4650
|
+
fontSize: isMobile ? "16px" : "20px",
|
|
4651
|
+
fontWeight: "bold",
|
|
4652
|
+
color: "#1a237e"
|
|
4653
|
+
}
|
|
4654
|
+
}, Object.keys(drivers).length)), /*#__PURE__*/React.createElement("div", {
|
|
4655
|
+
style: {
|
|
4656
|
+
textAlign: "center"
|
|
4657
|
+
}
|
|
4658
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
4659
|
+
style: {
|
|
4660
|
+
fontSize: isMobile ? "10px" : "11px",
|
|
4661
|
+
color: "#666"
|
|
4662
|
+
}
|
|
4663
|
+
}, "Online"), /*#__PURE__*/React.createElement("div", {
|
|
4664
|
+
style: {
|
|
4665
|
+
fontSize: isMobile ? "16px" : "20px",
|
|
4666
|
+
fontWeight: "bold",
|
|
4667
|
+
color: "#4caf50"
|
|
4668
|
+
}
|
|
4669
|
+
}, onlineCount)), /*#__PURE__*/React.createElement("div", {
|
|
4670
|
+
style: {
|
|
4671
|
+
textAlign: "center"
|
|
4672
|
+
}
|
|
4673
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
4674
|
+
style: {
|
|
4675
|
+
fontSize: isMobile ? "10px" : "11px",
|
|
4676
|
+
color: "#666"
|
|
4677
|
+
}
|
|
4678
|
+
}, "Offline"), /*#__PURE__*/React.createElement("div", {
|
|
4679
|
+
style: {
|
|
4680
|
+
fontSize: isMobile ? "16px" : "20px",
|
|
4681
|
+
fontWeight: "bold",
|
|
4682
|
+
color: "#f44336"
|
|
4683
|
+
}
|
|
4684
|
+
}, offlineCount)), /*#__PURE__*/React.createElement("div", {
|
|
4685
|
+
style: {
|
|
4686
|
+
textAlign: "center"
|
|
4687
|
+
}
|
|
4688
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
4689
|
+
style: {
|
|
4690
|
+
fontSize: isMobile ? "10px" : "11px",
|
|
4691
|
+
color: "#666"
|
|
4692
|
+
}
|
|
4693
|
+
}, "Active"), /*#__PURE__*/React.createElement("div", {
|
|
4694
|
+
style: {
|
|
4695
|
+
fontSize: isMobile ? "16px" : "20px",
|
|
4696
|
+
fontWeight: "bold",
|
|
4697
|
+
color: "#ff9800"
|
|
4698
|
+
}
|
|
4699
|
+
}, activeDeliveries))), /*#__PURE__*/React.createElement("div", {
|
|
4700
|
+
style: {
|
|
4701
|
+
padding: isMobile ? "12px" : "16px",
|
|
4702
|
+
borderBottom: "1px solid #e0e0e0",
|
|
4703
|
+
background: "#fafafa"
|
|
4704
|
+
}
|
|
4705
|
+
}, /*#__PURE__*/React.createElement("input", {
|
|
4706
|
+
type: "text",
|
|
4707
|
+
placeholder: "Search by driver ID...",
|
|
4708
|
+
value: searchTerm,
|
|
4709
|
+
onChange: e => setSearchTerm(e.target.value),
|
|
4710
|
+
style: {
|
|
4711
|
+
width: "100%",
|
|
4712
|
+
padding: isMobile ? "10px" : "12px",
|
|
4713
|
+
border: "1px solid #e0e0e0",
|
|
4714
|
+
borderRadius: "8px",
|
|
4715
|
+
fontSize: isMobile ? "14px" : "14px",
|
|
4716
|
+
marginBottom: "12px",
|
|
4717
|
+
outline: "none",
|
|
4718
|
+
transition: "border-color 0.2s",
|
|
4719
|
+
boxSizing: "border-box"
|
|
4720
|
+
},
|
|
4721
|
+
onFocus: e => e.target.style.borderColor = "#1a237e",
|
|
4722
|
+
onBlur: e => e.target.style.borderColor = "#e0e0e0"
|
|
4723
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
4724
|
+
style: {
|
|
4725
|
+
display: "flex",
|
|
4726
|
+
gap: "8px",
|
|
4727
|
+
marginBottom: "8px"
|
|
4728
|
+
}
|
|
4729
|
+
}, ["all", "online", "offline"].map(filter => /*#__PURE__*/React.createElement("button", {
|
|
4730
|
+
key: filter,
|
|
4731
|
+
onClick: () => setFilterOnline(filter),
|
|
4732
|
+
style: {
|
|
4733
|
+
flex: 1,
|
|
4734
|
+
padding: isMobile ? "6px" : "8px",
|
|
4735
|
+
border: "1px solid #e0e0e0",
|
|
4736
|
+
borderRadius: "6px",
|
|
4737
|
+
background: filterOnline === filter ? "#1a237e" : "white",
|
|
4738
|
+
color: filterOnline === filter ? "white" : "#333",
|
|
4739
|
+
cursor: "pointer",
|
|
4740
|
+
fontSize: isMobile ? "11px" : "12px",
|
|
4741
|
+
fontWeight: "500",
|
|
4742
|
+
textTransform: "capitalize",
|
|
4743
|
+
transition: "all 0.2s"
|
|
4744
|
+
}
|
|
4745
|
+
}, filter))), /*#__PURE__*/React.createElement("div", {
|
|
4746
|
+
style: {
|
|
4747
|
+
display: "flex",
|
|
4748
|
+
alignItems: "center",
|
|
4749
|
+
gap: "8px",
|
|
4750
|
+
marginTop: "8px"
|
|
4751
|
+
}
|
|
4752
|
+
}, /*#__PURE__*/React.createElement("input", {
|
|
4753
|
+
type: "checkbox",
|
|
4754
|
+
id: "showRoutes",
|
|
4755
|
+
checked: showRoutes,
|
|
4756
|
+
onChange: e => setShowRoutes(e.target.checked),
|
|
4757
|
+
style: {
|
|
4758
|
+
cursor: "pointer",
|
|
4759
|
+
width: "16px",
|
|
4760
|
+
height: "16px"
|
|
4761
|
+
}
|
|
4762
|
+
}), /*#__PURE__*/React.createElement("label", {
|
|
4763
|
+
htmlFor: "showRoutes",
|
|
4764
|
+
style: {
|
|
4765
|
+
fontSize: isMobile ? "12px" : "13px",
|
|
4766
|
+
color: "#333",
|
|
4767
|
+
cursor: "pointer"
|
|
4768
|
+
}
|
|
4769
|
+
}, "Show delivery routes"))), /*#__PURE__*/React.createElement("div", {
|
|
4770
|
+
style: {
|
|
4771
|
+
flex: 1,
|
|
4772
|
+
overflowY: "auto",
|
|
4773
|
+
padding: isMobile ? "12px" : "16px",
|
|
4774
|
+
background: "#f5f5f5"
|
|
4775
|
+
}
|
|
4776
|
+
}, filteredDrivers.length === 0 ? /*#__PURE__*/React.createElement("div", {
|
|
4777
|
+
style: {
|
|
4778
|
+
textAlign: "center",
|
|
4779
|
+
padding: isMobile ? "20px" : "40px 20px",
|
|
4780
|
+
color: "#999",
|
|
4781
|
+
background: "white",
|
|
4782
|
+
borderRadius: "12px"
|
|
4783
|
+
}
|
|
4784
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
4785
|
+
style: {
|
|
4786
|
+
fontSize: isMobile ? "36px" : "48px",
|
|
4787
|
+
marginBottom: "16px"
|
|
4788
|
+
}
|
|
4789
|
+
}, "\uD83D\uDE97"), /*#__PURE__*/React.createElement("p", {
|
|
4790
|
+
style: {
|
|
4791
|
+
fontSize: isMobile ? "14px" : "16px",
|
|
4792
|
+
margin: 0
|
|
4793
|
+
}
|
|
4794
|
+
}, Object.keys(drivers).length === 0 ? "No drivers available" : "No drivers match your filters")) : filteredDrivers.map(driver => /*#__PURE__*/React.createElement(DriverCard, {
|
|
4795
|
+
key: driver.driverId,
|
|
4796
|
+
driver: driver,
|
|
4797
|
+
isSelected: (selectedDriver === null || selectedDriver === void 0 ? void 0 : selectedDriver.driverId) === driver.driverId,
|
|
4798
|
+
onClick: () => {
|
|
4799
|
+
setSelectedDriver(driver);
|
|
4800
|
+
if (isMobile) {
|
|
4801
|
+
setShowSidebar(false);
|
|
4802
|
+
}
|
|
4803
|
+
}
|
|
4804
|
+
}))))), /*#__PURE__*/React.createElement("div", {
|
|
4805
|
+
style: {
|
|
4806
|
+
flex: 1,
|
|
4807
|
+
position: "relative",
|
|
4808
|
+
width: isMobile ? "100%" : "calc(100% - 380px)",
|
|
4809
|
+
height: "100%"
|
|
4810
|
+
}
|
|
4811
|
+
}, /*#__PURE__*/React.createElement(MapContainer, {
|
|
4812
|
+
center: mapCenter,
|
|
4813
|
+
zoom: mapZoom,
|
|
4814
|
+
style: {
|
|
4815
|
+
height: "100%",
|
|
4816
|
+
width: "100%"
|
|
4817
|
+
},
|
|
4818
|
+
zoomControl: false
|
|
4819
|
+
}, /*#__PURE__*/React.createElement(TileLayer, {
|
|
4820
|
+
url: "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",
|
|
4821
|
+
attribution: "\xA9 <a href=\"https://www.openstreetmap.org/copyright\">OpenStreetMap</a>"
|
|
4822
|
+
}), /*#__PURE__*/React.createElement(MapController, {
|
|
4823
|
+
selectedDriver: selectedDriver
|
|
4824
|
+
}), selectedDriver && selectedDriver.lat != null && selectedDriver.lng != null && /*#__PURE__*/React.createElement(Marker, {
|
|
4825
|
+
key: selectedDriver.driverId,
|
|
4826
|
+
position: [Number(selectedDriver.lat), Number(selectedDriver.lng)],
|
|
4827
|
+
icon: selectedDriver.isOnline ? onlineIcon : offlineIcon
|
|
4828
|
+
}, /*#__PURE__*/React.createElement(Popup, null, /*#__PURE__*/React.createElement("div", {
|
|
4829
|
+
style: {
|
|
4830
|
+
minWidth: isMobile ? "200px" : "250px",
|
|
4831
|
+
padding: "8px"
|
|
4832
|
+
}
|
|
4833
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
4834
|
+
style: {
|
|
4835
|
+
fontWeight: "bold",
|
|
4836
|
+
fontSize: isMobile ? "14px" : "16px",
|
|
4837
|
+
color: "#1a237e",
|
|
4838
|
+
marginBottom: "8px",
|
|
4839
|
+
borderBottom: "1px solid #eee",
|
|
4840
|
+
paddingBottom: "4px"
|
|
4841
|
+
}
|
|
4842
|
+
}, "Driver #", selectedDriver.driverId.substring(0, 8), "... (Selected)"), /*#__PURE__*/React.createElement("div", {
|
|
4843
|
+
style: {
|
|
4844
|
+
marginBottom: "8px"
|
|
4845
|
+
}
|
|
4846
|
+
}, /*#__PURE__*/React.createElement(StatusBadge, {
|
|
4847
|
+
isOnline: selectedDriver.isOnline
|
|
4848
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
4849
|
+
style: {
|
|
4850
|
+
fontSize: isMobile ? "12px" : "13px"
|
|
4851
|
+
}
|
|
4852
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
4853
|
+
style: {
|
|
4854
|
+
marginBottom: "8px"
|
|
4855
|
+
}
|
|
4856
|
+
}, /*#__PURE__*/React.createElement("strong", null, "\uD83D\uDCCD Current Location"), /*#__PURE__*/React.createElement("div", null, "Lat: ", (_selectedDriver$lat = selectedDriver.lat) === null || _selectedDriver$lat === void 0 ? void 0 : _selectedDriver$lat.toFixed(6)), /*#__PURE__*/React.createElement("div", null, "Lng: ", (_selectedDriver$lng = selectedDriver.lng) === null || _selectedDriver$lng === void 0 ? void 0 : _selectedDriver$lng.toFixed(6))), selectedDriver.deliveryLat && selectedDriver.deliveryLng && /*#__PURE__*/React.createElement("div", {
|
|
4857
|
+
style: {
|
|
4858
|
+
marginBottom: "8px"
|
|
4859
|
+
}
|
|
4860
|
+
}, /*#__PURE__*/React.createElement("strong", null, "\uD83C\uDFAF Delivery Destination"), /*#__PURE__*/React.createElement("div", null, "Lat: ", selectedDriver.deliveryLat.toFixed(6)), /*#__PURE__*/React.createElement("div", null, "Lng: ", selectedDriver.deliveryLng.toFixed(6))), /*#__PURE__*/React.createElement("div", {
|
|
4861
|
+
style: {
|
|
4862
|
+
display: "grid",
|
|
4863
|
+
gridTemplateColumns: "1fr 1fr",
|
|
4864
|
+
gap: "8px",
|
|
4865
|
+
background: "#f5f5f5",
|
|
4866
|
+
padding: "8px",
|
|
4867
|
+
borderRadius: "4px",
|
|
4868
|
+
marginTop: "8px"
|
|
4869
|
+
}
|
|
4870
|
+
}, selectedDriver.speed && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", null, "Speed:"), /*#__PURE__*/React.createElement("span", null, (selectedDriver.speed * 3.6).toFixed(1), " km/h")), selectedDriver.heading && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", null, "Heading:"), /*#__PURE__*/React.createElement("span", null, Math.round(selectedDriver.heading), "\xB0")), selectedDriver.accuracy && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", null, "Accuracy:"), /*#__PURE__*/React.createElement("span", null, Math.round(selectedDriver.accuracy), "m"))), selectedDriver.lastUpdate && /*#__PURE__*/React.createElement("div", {
|
|
4871
|
+
style: {
|
|
4872
|
+
marginTop: "8px",
|
|
4873
|
+
color: "#666",
|
|
4874
|
+
fontSize: "10px"
|
|
4875
|
+
}
|
|
4876
|
+
}, "Last update: ", new Date(selectedDriver.lastUpdate).toLocaleString()))))), selectedDriver && selectedDriver.deliveryLat != null && selectedDriver.deliveryLng != null && /*#__PURE__*/React.createElement(Marker, {
|
|
4877
|
+
key: `dest-${selectedDriver.driverId}`,
|
|
4878
|
+
position: [Number(selectedDriver.deliveryLat), Number(selectedDriver.deliveryLng)],
|
|
4879
|
+
icon: destinationIcon
|
|
4880
|
+
}, /*#__PURE__*/React.createElement(Popup, null, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("strong", null, "Delivery Destination"), /*#__PURE__*/React.createElement("div", null, "Driver: #", selectedDriver.driverId.substring(0, 8), "...")))), showRoutes && selectedDriver && selectedDriver.lat && selectedDriver.lng && selectedDriver.deliveryLat && selectedDriver.deliveryLng && /*#__PURE__*/React.createElement(RouteLayer, {
|
|
4881
|
+
start: {
|
|
4882
|
+
lat: selectedDriver.lat,
|
|
4883
|
+
lng: selectedDriver.lng
|
|
4884
|
+
},
|
|
4885
|
+
end: {
|
|
4886
|
+
lat: selectedDriver.deliveryLat,
|
|
4887
|
+
lng: selectedDriver.deliveryLng
|
|
4888
|
+
},
|
|
4889
|
+
color: "#2196f3",
|
|
4890
|
+
weight: 6
|
|
4891
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
4892
|
+
style: {
|
|
4893
|
+
position: "absolute",
|
|
4894
|
+
top: isMobile ? "60px" : "20px",
|
|
4895
|
+
right: "10px",
|
|
4896
|
+
zIndex: 1000,
|
|
4897
|
+
background: "white",
|
|
4898
|
+
borderRadius: "8px",
|
|
4899
|
+
boxShadow: "0 2px 8px rgba(0, 0, 0, 0.15)",
|
|
4900
|
+
padding: "4px",
|
|
4901
|
+
display: "flex",
|
|
4902
|
+
flexDirection: isMobile ? "column" : "row",
|
|
4903
|
+
gap: "4px"
|
|
4904
|
+
}
|
|
4905
|
+
}, selectedDriver && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("button", {
|
|
4906
|
+
onClick: () => {
|
|
4907
|
+
if (selectedDriver !== null && selectedDriver !== void 0 && selectedDriver.lat && selectedDriver !== null && selectedDriver !== void 0 && selectedDriver.lng) {
|
|
4908
|
+
setMapCenter([selectedDriver.lat, selectedDriver.lng]);
|
|
4909
|
+
setMapZoom(15);
|
|
4910
|
+
}
|
|
4911
|
+
},
|
|
4912
|
+
style: {
|
|
4913
|
+
padding: isMobile ? "10px 12px" : "8px 16px",
|
|
4914
|
+
background: "#1a237e",
|
|
4915
|
+
color: "white",
|
|
4916
|
+
border: "none",
|
|
4917
|
+
borderRadius: "4px",
|
|
4918
|
+
cursor: "pointer",
|
|
4919
|
+
fontSize: isMobile ? "12px" : "14px",
|
|
4920
|
+
fontWeight: "500",
|
|
4921
|
+
whiteSpace: "nowrap"
|
|
4922
|
+
}
|
|
4923
|
+
}, "Center"), /*#__PURE__*/React.createElement("button", {
|
|
4924
|
+
onClick: () => setSelectedDriver(null),
|
|
4925
|
+
style: {
|
|
4926
|
+
padding: isMobile ? "10px 12px" : "8px 16px",
|
|
4927
|
+
background: "#f44336",
|
|
4928
|
+
color: "white",
|
|
4929
|
+
border: "none",
|
|
4930
|
+
borderRadius: "4px",
|
|
4931
|
+
cursor: "pointer",
|
|
4932
|
+
fontSize: isMobile ? "12px" : "14px",
|
|
4933
|
+
fontWeight: "500",
|
|
4934
|
+
whiteSpace: "nowrap"
|
|
4935
|
+
}
|
|
4936
|
+
}, "Clear")), !selectedDriver && /*#__PURE__*/React.createElement("div", {
|
|
4937
|
+
style: {
|
|
4938
|
+
padding: isMobile ? "10px 12px" : "8px 16px",
|
|
4939
|
+
background: "#f5f5f5",
|
|
4940
|
+
color: "#666",
|
|
4941
|
+
borderRadius: "4px",
|
|
4942
|
+
fontSize: isMobile ? "12px" : "14px"
|
|
4943
|
+
}
|
|
4944
|
+
}, isMobile ? "Select driver" : "Select a driver from the list")), selectedDriver && /*#__PURE__*/React.createElement("div", {
|
|
4945
|
+
style: {
|
|
4946
|
+
position: "absolute",
|
|
4947
|
+
bottom: isMobile ? "10px" : "20px",
|
|
4948
|
+
left: isMobile ? "10px" : "20px",
|
|
4949
|
+
right: isMobile ? "10px" : "auto",
|
|
4950
|
+
zIndex: 1000,
|
|
4951
|
+
background: "white",
|
|
4952
|
+
borderRadius: "8px",
|
|
4953
|
+
boxShadow: "0 4px 12px rgba(0,0,0,0.15)",
|
|
4954
|
+
padding: isMobile ? "12px" : "16px",
|
|
4955
|
+
maxWidth: isMobile ? "calc(100% - 20px)" : "300px",
|
|
4956
|
+
border: "2px solid #2196f3"
|
|
4957
|
+
}
|
|
4958
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
4959
|
+
style: {
|
|
4960
|
+
display: "flex",
|
|
4961
|
+
justifyContent: "space-between",
|
|
4962
|
+
alignItems: "center",
|
|
4963
|
+
marginBottom: "8px"
|
|
4964
|
+
}
|
|
4965
|
+
}, /*#__PURE__*/React.createElement("h4", {
|
|
4966
|
+
style: {
|
|
4967
|
+
margin: 0,
|
|
4968
|
+
color: "#1a237e",
|
|
4969
|
+
fontSize: isMobile ? "14px" : "16px"
|
|
4970
|
+
}
|
|
4971
|
+
}, "Selected Driver"), /*#__PURE__*/React.createElement("span", {
|
|
4972
|
+
style: {
|
|
4973
|
+
background: selectedDriver.isOnline ? "#4caf50" : "#f44336",
|
|
4974
|
+
color: "white",
|
|
4975
|
+
padding: "2px 8px",
|
|
4976
|
+
borderRadius: "12px",
|
|
4977
|
+
fontSize: isMobile ? "10px" : "11px",
|
|
4978
|
+
fontWeight: "bold"
|
|
4979
|
+
}
|
|
4980
|
+
}, selectedDriver.isOnline ? "ONLINE" : "OFFLINE")), /*#__PURE__*/React.createElement("div", {
|
|
4981
|
+
style: {
|
|
4982
|
+
fontSize: isMobile ? "12px" : "13px"
|
|
4983
|
+
}
|
|
4984
|
+
}, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("strong", null, "ID:"), " ", selectedDriver.driverId.substring(0, 12), "..."), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("strong", null, "Location:"), " ", (_selectedDriver$lat2 = selectedDriver.lat) === null || _selectedDriver$lat2 === void 0 ? void 0 : _selectedDriver$lat2.toFixed(4), ", ", (_selectedDriver$lng2 = selectedDriver.lng) === null || _selectedDriver$lng2 === void 0 ? void 0 : _selectedDriver$lng2.toFixed(4)), selectedDriver.speed && /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("strong", null, "Speed:"), " ", Math.round(selectedDriver.speed * 3.6), " km/h"), selectedDriver.lastSeen && /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("strong", null, "Last seen:"), " ", new Date(selectedDriver.lastSeen).toLocaleTimeString())))));
|
|
4985
|
+
}
|
|
4986
|
+
|
|
4987
|
+
const Timeline = ({
|
|
4988
|
+
steps: _steps = [],
|
|
4989
|
+
currentStep: _currentStep = 1
|
|
4990
|
+
}) => {
|
|
4991
|
+
const {
|
|
4992
|
+
t
|
|
4993
|
+
} = useTranslation();
|
|
4994
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
4995
|
+
className: "custom-stepper-card"
|
|
4996
|
+
}, _steps.map((label, index) => {
|
|
4997
|
+
const stepNumber = index + 1;
|
|
4998
|
+
const isActive = stepNumber === _currentStep;
|
|
4999
|
+
const isCompleted = stepNumber < _currentStep;
|
|
5000
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
5001
|
+
className: "stepper-row-vendor",
|
|
5002
|
+
key: index
|
|
5003
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
5004
|
+
className: "stepper-left"
|
|
5005
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
5006
|
+
className: `step-circle
|
|
5007
|
+
${isActive ? "active" : ""}
|
|
5008
|
+
${isCompleted ? "completed" : ""}`
|
|
5009
|
+
}, isCompleted ? /*#__PURE__*/React.createElement(TickMark, {
|
|
5010
|
+
fillColor: "#fff"
|
|
5011
|
+
}) : stepNumber), index !== _steps.length - 1 && /*#__PURE__*/React.createElement("div", {
|
|
5012
|
+
className: `step-line ${isCompleted ? "completed-line" : ""}`
|
|
5013
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
5014
|
+
className: `step-label
|
|
5015
|
+
${isActive ? "active-text" : ""}
|
|
5016
|
+
${isCompleted ? "completed-text" : ""}`
|
|
5017
|
+
}, t(label)));
|
|
5018
|
+
}));
|
|
5019
|
+
};
|
|
5020
|
+
|
|
5021
|
+
const AddFillingPointMetaData = ({
|
|
5022
|
+
t,
|
|
5023
|
+
formData: _formData = {},
|
|
5024
|
+
onSelect,
|
|
5025
|
+
config: _config = {},
|
|
5026
|
+
visibleFields: _visibleFields = []
|
|
5027
|
+
}) => {
|
|
5028
|
+
const sectionKey = (_config === null || _config === void 0 ? void 0 : _config.key) || "metaData";
|
|
5029
|
+
const inputs = [{
|
|
5030
|
+
label: "WT_AE_NAME",
|
|
5031
|
+
name: "name",
|
|
5032
|
+
isMandatory: true,
|
|
5033
|
+
validation: {
|
|
5034
|
+
pattern: "^[a-zA-Z]+( [a-zA-Z]+)*$",
|
|
5035
|
+
title: t("CORE_COMMON_APPLICANT_NAME_INVALID")
|
|
5036
|
+
}
|
|
5037
|
+
}, {
|
|
5038
|
+
label: "WT_AE_MOBILE_NUMBER",
|
|
5039
|
+
name: "mobileNumber",
|
|
5040
|
+
isMandatory: true,
|
|
5041
|
+
componentInFront: /*#__PURE__*/React.createElement("div", {
|
|
5042
|
+
className: "employee-card-input employee-card-input--front"
|
|
5043
|
+
}, "+91"),
|
|
5044
|
+
validation: {
|
|
5045
|
+
pattern: "[6-9]{1}[0-9]{9}",
|
|
5046
|
+
type: "tel",
|
|
5047
|
+
maxLength: 10
|
|
5048
|
+
}
|
|
5049
|
+
}, {
|
|
5050
|
+
label: "WT_AE_EMAIL_ID",
|
|
5051
|
+
name: "emailId",
|
|
5052
|
+
validation: {
|
|
5053
|
+
pattern: "^[a-zA-Z0-9._%+-]+@[a-z.-]+\\.(com|org|in)$",
|
|
5054
|
+
title: t("CORE_COMMON_EMAIL_ID_INVALID")
|
|
5055
|
+
}
|
|
5056
|
+
}, {
|
|
5057
|
+
label: "WT_JE_NAME",
|
|
5058
|
+
name: "jeName",
|
|
5059
|
+
validation: {
|
|
5060
|
+
pattern: "^[a-zA-Z]+( [a-zA-Z]+)*$"
|
|
5061
|
+
}
|
|
5062
|
+
}, {
|
|
5063
|
+
label: "WT_JE_MOBILE_NUMBER",
|
|
5064
|
+
name: "jeMobileNumber",
|
|
5065
|
+
componentInFront: /*#__PURE__*/React.createElement("div", {
|
|
5066
|
+
className: "employee-card-input employee-card-input--front"
|
|
5067
|
+
}, "+91"),
|
|
5068
|
+
validation: {
|
|
5069
|
+
pattern: "[6-9]{1}[0-9]{9}",
|
|
5070
|
+
type: "tel",
|
|
5071
|
+
maxLength: 10
|
|
5072
|
+
}
|
|
5073
|
+
}, {
|
|
5074
|
+
label: "WT_JE_EMAIL_ID",
|
|
5075
|
+
name: "jeEmailId",
|
|
5076
|
+
validation: {
|
|
5077
|
+
pattern: "^[a-zA-Z0-9._%+-]+@[a-z.-]+\\.(com|org|in)$"
|
|
5078
|
+
}
|
|
5079
|
+
}, {
|
|
5080
|
+
label: "WT_EE_NAME",
|
|
5081
|
+
name: "eeName",
|
|
5082
|
+
validation: {
|
|
5083
|
+
pattern: "^[a-zA-Z]+( [a-zA-Z]+)*$"
|
|
5084
|
+
}
|
|
5085
|
+
}, {
|
|
5086
|
+
label: "WT_EE_MOBILE_NUMBER",
|
|
5087
|
+
name: "eeMobileNumber",
|
|
5088
|
+
componentInFront: /*#__PURE__*/React.createElement("div", {
|
|
5089
|
+
className: "employee-card-input employee-card-input--front"
|
|
5090
|
+
}, "+91"),
|
|
5091
|
+
validation: {
|
|
5092
|
+
pattern: "[6-9]{1}[0-9]{9}",
|
|
5093
|
+
type: "tel",
|
|
5094
|
+
maxLength: 10
|
|
5095
|
+
}
|
|
5096
|
+
}, {
|
|
5097
|
+
label: "WT_EE_ALT_MOBILE_NUMBER",
|
|
5098
|
+
name: "alternateNumber",
|
|
5099
|
+
componentInFront: /*#__PURE__*/React.createElement("div", {
|
|
5100
|
+
className: "employee-card-input employee-card-input--front"
|
|
5101
|
+
}, "+91"),
|
|
5102
|
+
validation: {
|
|
5103
|
+
pattern: "[6-9]{1}[0-9]{9}",
|
|
5104
|
+
type: "tel",
|
|
5105
|
+
maxLength: 10
|
|
5106
|
+
}
|
|
5107
|
+
}, {
|
|
5108
|
+
label: "WT_EE_EMAIL_ID",
|
|
5109
|
+
name: "eeEmailId",
|
|
5110
|
+
validation: {
|
|
5111
|
+
pattern: "^[a-zA-Z0-9._%+-]+@[a-z.-]+\\.(com|org|in)$"
|
|
5112
|
+
}
|
|
5113
|
+
}];
|
|
5114
|
+
const filteredInputs = _visibleFields && _visibleFields.length > 0 ? inputs.filter(input => _visibleFields.includes(input.name)) : inputs;
|
|
5115
|
+
const handleChange = (value, name) => {
|
|
5116
|
+
if (!onSelect) return;
|
|
5117
|
+
onSelect(sectionKey, {
|
|
5118
|
+
...(_formData === null || _formData === void 0 ? void 0 : _formData[sectionKey]),
|
|
5119
|
+
[name]: value
|
|
5120
|
+
});
|
|
5121
|
+
};
|
|
5122
|
+
return /*#__PURE__*/React.createElement(Card, null, /*#__PURE__*/React.createElement("div", {
|
|
5123
|
+
style: {
|
|
5124
|
+
display: "grid",
|
|
5125
|
+
gridTemplateColumns: "1fr 1fr",
|
|
5126
|
+
gap: "16px"
|
|
5127
|
+
}
|
|
5128
|
+
}, filteredInputs.map(input => {
|
|
5129
|
+
var _formData$sectionKey;
|
|
5130
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
5131
|
+
key: input.name
|
|
5132
|
+
}, /*#__PURE__*/React.createElement(LabelFieldPair, null, /*#__PURE__*/React.createElement(CardLabel, {
|
|
5133
|
+
className: "card-label-smaller"
|
|
5134
|
+
}, t(input.label), input.isMandatory ? " *" : ""), /*#__PURE__*/React.createElement("div", {
|
|
5135
|
+
style: {
|
|
5136
|
+
display: "flex"
|
|
5137
|
+
}
|
|
5138
|
+
}, input.componentInFront || null, /*#__PURE__*/React.createElement(TextInput, Object.assign({
|
|
5139
|
+
value: (_formData === null || _formData === void 0 ? void 0 : (_formData$sectionKey = _formData[sectionKey]) === null || _formData$sectionKey === void 0 ? void 0 : _formData$sectionKey[input.name]) || "",
|
|
5140
|
+
onChange: e => handleChange(e.target.value, input.name)
|
|
5141
|
+
}, input.validation)))));
|
|
5142
|
+
})));
|
|
5143
|
+
};
|
|
5144
|
+
|
|
5145
|
+
const AddFillingPointAddress = () => {
|
|
5146
|
+
const {
|
|
5147
|
+
t
|
|
5148
|
+
} = useTranslation();
|
|
5149
|
+
const location = useLocation();
|
|
5150
|
+
const queryParams = new URLSearchParams(location.search);
|
|
5151
|
+
const editId = queryParams.get("id");
|
|
5152
|
+
const [formData, setFormData] = useState({});
|
|
5153
|
+
const [showToast, setShowToast] = useState(null);
|
|
5154
|
+
const tenantId = Digit.ULBService.getCurrentTenantId();
|
|
5155
|
+
const {
|
|
5156
|
+
isLoading: isEditLoading,
|
|
5157
|
+
data: editData
|
|
5158
|
+
} = Digit.Hooks.wt.useTankerSearchAPI({
|
|
5159
|
+
tenantId,
|
|
5160
|
+
filters: {
|
|
5161
|
+
bookingId: editId
|
|
5162
|
+
}
|
|
5163
|
+
}, {
|
|
5164
|
+
enabled: !!editId
|
|
5165
|
+
});
|
|
5166
|
+
useEffect(() => {
|
|
5167
|
+
console.log("Edit ID:", editId);
|
|
5168
|
+
console.log("Search Result:", editData);
|
|
5169
|
+
if (editId && editData !== null && editData !== void 0 && editData.waterTankerBookingDetail) {
|
|
5170
|
+
const data = editData.waterTankerBookingDetail.find(item => item.bookingId === editId);
|
|
5171
|
+
if (data) {
|
|
5172
|
+
var _data$fillingpointmet, _data$fillingpointmet2, _data$fillingpointmet3, _data$fillingpointmet4, _data$fillingpointmet5, _data$fillingpointmet6, _data$fillingpointmet7, _data$fillingpointmet8, _data$fillingpointmet9;
|
|
5173
|
+
setFormData({
|
|
5174
|
+
owner: {
|
|
5175
|
+
name: (_data$fillingpointmet = data.fillingpointmetadata) === null || _data$fillingpointmet === void 0 ? void 0 : _data$fillingpointmet.name,
|
|
5176
|
+
mobileNumber: (_data$fillingpointmet2 = data.fillingpointmetadata) === null || _data$fillingpointmet2 === void 0 ? void 0 : _data$fillingpointmet2.mobileNumber,
|
|
5177
|
+
emailId: (_data$fillingpointmet3 = data.fillingpointmetadata) === null || _data$fillingpointmet3 === void 0 ? void 0 : _data$fillingpointmet3.emailId,
|
|
5178
|
+
jeName: (_data$fillingpointmet4 = data.fillingpointmetadata) === null || _data$fillingpointmet4 === void 0 ? void 0 : _data$fillingpointmet4.jeName,
|
|
5179
|
+
jeMobileNumber: (_data$fillingpointmet5 = data.fillingpointmetadata) === null || _data$fillingpointmet5 === void 0 ? void 0 : _data$fillingpointmet5.jeMobileNumber,
|
|
5180
|
+
jeEmailId: (_data$fillingpointmet6 = data.fillingpointmetadata) === null || _data$fillingpointmet6 === void 0 ? void 0 : _data$fillingpointmet6.jeEmailId,
|
|
5181
|
+
eeName: (_data$fillingpointmet7 = data.fillingpointmetadata) === null || _data$fillingpointmet7 === void 0 ? void 0 : _data$fillingpointmet7.eeName,
|
|
5182
|
+
eeMobileNumber: (_data$fillingpointmet8 = data.fillingpointmetadata) === null || _data$fillingpointmet8 === void 0 ? void 0 : _data$fillingpointmet8.eeMobileNumber,
|
|
5183
|
+
eeEmailId: (_data$fillingpointmet9 = data.fillingpointmetadata) === null || _data$fillingpointmet9 === void 0 ? void 0 : _data$fillingpointmet9.eeEmailId
|
|
5184
|
+
},
|
|
5185
|
+
address: {
|
|
5186
|
+
...data.address
|
|
5187
|
+
},
|
|
5188
|
+
bookingId: data.bookingId,
|
|
5189
|
+
auditDetails: data.auditDetails
|
|
5190
|
+
});
|
|
5191
|
+
}
|
|
5192
|
+
}
|
|
5193
|
+
}, [editData, editId]);
|
|
5194
|
+
const onSelect = (key, data) => {
|
|
5195
|
+
setFormData(prev => ({
|
|
5196
|
+
...prev,
|
|
5197
|
+
[key]: data
|
|
5198
|
+
}));
|
|
5199
|
+
};
|
|
5200
|
+
const steps = ["WT_FILLING_POINT"];
|
|
5201
|
+
const createFillingPoint = [];
|
|
5202
|
+
const handleSubmit = e => {
|
|
5203
|
+
if (e && e.preventDefault) e.preventDefault();
|
|
5204
|
+
const payload = fillingPointPayload({
|
|
5205
|
+
...formData,
|
|
5206
|
+
tenantId
|
|
5207
|
+
});
|
|
5208
|
+
const mutation = createFillingPoint;
|
|
5209
|
+
mutation(payload, {
|
|
5210
|
+
onSuccess: () => {
|
|
5211
|
+
setShowToast({
|
|
5212
|
+
label: editId ? t("WT_FILLING_POINT_UPDATED_SUCCESS") : t("WT_FILLING_POINT_CREATED_SUCCESS")
|
|
5213
|
+
});
|
|
5214
|
+
setTimeout(() => setShowToast(null), 5000);
|
|
5215
|
+
},
|
|
5216
|
+
onError: error => {
|
|
5217
|
+
var _error$response, _error$response$data, _error$response$data$, _error$response$data$2;
|
|
5218
|
+
setShowToast({
|
|
5219
|
+
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) || (editId ? t("WT_FILLING_POINT_UPDATED_ERROR") : t("WT_FILLING_POINT_CREATED_ERROR")),
|
|
5220
|
+
isError: true
|
|
5221
|
+
});
|
|
5222
|
+
setTimeout(() => setShowToast(null), 5000);
|
|
5223
|
+
}
|
|
5224
|
+
});
|
|
5225
|
+
};
|
|
5226
|
+
if (isEditLoading) return /*#__PURE__*/React.createElement(Loader, null);
|
|
5227
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
5228
|
+
style: {
|
|
5229
|
+
display: "flex",
|
|
5230
|
+
gap: "24px"
|
|
5231
|
+
}
|
|
5232
|
+
}, /*#__PURE__*/React.createElement(Timeline, {
|
|
5233
|
+
steps: steps,
|
|
5234
|
+
currentStep: 1
|
|
5235
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
5236
|
+
style: {
|
|
5237
|
+
flex: 1
|
|
5238
|
+
}
|
|
5239
|
+
}, /*#__PURE__*/React.createElement("form", {
|
|
5240
|
+
onSubmit: handleSubmit
|
|
5241
|
+
}, /*#__PURE__*/React.createElement(AddFillingPointMetaData, {
|
|
5242
|
+
t: t,
|
|
5243
|
+
config: {
|
|
5244
|
+
key: "owner"
|
|
5245
|
+
},
|
|
5246
|
+
onSelect: onSelect,
|
|
5247
|
+
formData: formData
|
|
5248
|
+
}), /*#__PURE__*/React.createElement(AddressDetails, {
|
|
5249
|
+
t: t,
|
|
5250
|
+
onSelect: (key, data) => setFormData(prev => ({
|
|
5251
|
+
...prev,
|
|
5252
|
+
[key]: data
|
|
5253
|
+
})),
|
|
5254
|
+
formData: formData
|
|
5255
|
+
}), /*#__PURE__*/React.createElement(SubmitBar, {
|
|
5256
|
+
label: editId ? t("ES_COMMON_UPDATE") : t("ES_COMMON_SAVE_NEXT"),
|
|
5257
|
+
onSubmit: handleSubmit
|
|
5258
|
+
})), showToast && /*#__PURE__*/React.createElement(Toast, {
|
|
5259
|
+
error: showToast.isError,
|
|
5260
|
+
label: showToast.label,
|
|
5261
|
+
onClose: () => setShowToast(null)
|
|
5262
|
+
})));
|
|
5263
|
+
};
|
|
5264
|
+
|
|
5265
|
+
const allOptions = [{
|
|
5266
|
+
name: "Correspondence",
|
|
5267
|
+
code: "CORRESPONDENCE",
|
|
5268
|
+
i18nKey: "COMMON_ADDRESS_TYPE_CORRESPONDENCE"
|
|
5269
|
+
}, {
|
|
5270
|
+
name: "Permanent",
|
|
5271
|
+
code: "PERMANENT",
|
|
5272
|
+
i18nKey: "COMMON_ADDRESS_TYPE_PERMANENT"
|
|
5273
|
+
}, {
|
|
5274
|
+
name: "Other",
|
|
5275
|
+
code: "OTHER",
|
|
5276
|
+
i18nKey: "COMMON_ADDRESS_TYPE_OTHER"
|
|
5277
|
+
}];
|
|
5278
|
+
const AddFixFillAddress = ({
|
|
5279
|
+
t,
|
|
5280
|
+
config,
|
|
5281
|
+
formData,
|
|
5282
|
+
onSelect,
|
|
5283
|
+
isEdit,
|
|
5284
|
+
userDetails
|
|
5285
|
+
}) => {
|
|
5286
|
+
var _location$state, _formData$address, _formData$address2, _formData$address3, _formData$address4, _formData$address5, _formData$address6, _formData$address7, _formData$address8, _formData$address9, _formData$address0, _formData$address1, _userDetails$addresse;
|
|
5287
|
+
const {
|
|
5288
|
+
data: allCities
|
|
5289
|
+
} = Digit.Hooks.useTenants();
|
|
5290
|
+
const {
|
|
5291
|
+
control
|
|
5292
|
+
} = useForm();
|
|
5293
|
+
const location = useLocation();
|
|
5294
|
+
const usedAddressTypes = ((_location$state = location.state) === null || _location$state === void 0 ? void 0 : _location$state.usedAddressTypes) || [];
|
|
5295
|
+
const user = Digit.UserService.getUser().info;
|
|
5296
|
+
const [pincode, setPincode] = useState((formData === null || formData === void 0 ? void 0 : (_formData$address = formData.address) === null || _formData$address === void 0 ? void 0 : _formData$address.pincode) || "");
|
|
5297
|
+
const [city, setCity] = useState((formData === null || formData === void 0 ? void 0 : (_formData$address2 = formData.address) === null || _formData$address2 === void 0 ? void 0 : _formData$address2.city) || null);
|
|
5298
|
+
const [locality, setLocality] = useState((formData === null || formData === void 0 ? void 0 : (_formData$address3 = formData.address) === null || _formData$address3 === void 0 ? void 0 : _formData$address3.locality) || null);
|
|
5299
|
+
const [houseNo, setHouseNo] = useState((formData === null || formData === void 0 ? void 0 : (_formData$address4 = formData.address) === null || _formData$address4 === void 0 ? void 0 : _formData$address4.houseNo) || "");
|
|
5300
|
+
const [streetName, setStreetName] = useState((formData === null || formData === void 0 ? void 0 : (_formData$address5 = formData.address) === null || _formData$address5 === void 0 ? void 0 : _formData$address5.streetName) || "");
|
|
5301
|
+
const [landmark, setLandmark] = useState((formData === null || formData === void 0 ? void 0 : (_formData$address6 = formData.address) === null || _formData$address6 === void 0 ? void 0 : _formData$address6.landmark) || "");
|
|
5302
|
+
const [addressLine1, setAddressLine1] = useState((formData === null || formData === void 0 ? void 0 : (_formData$address7 = formData.address) === null || _formData$address7 === void 0 ? void 0 : _formData$address7.addressLine1) || "");
|
|
5303
|
+
const [addressLine2, setAddressLine2] = useState((formData === null || formData === void 0 ? void 0 : (_formData$address8 = formData.address) === null || _formData$address8 === void 0 ? void 0 : _formData$address8.addressLine2) || "");
|
|
5304
|
+
const [addressType, setAddressType] = useState((formData === null || formData === void 0 ? void 0 : (_formData$address9 = formData.address) === null || _formData$address9 === void 0 ? void 0 : _formData$address9.addressType) || null);
|
|
5305
|
+
const [latitude, setLatitude] = useState((formData === null || formData === void 0 ? void 0 : (_formData$address0 = formData.address) === null || _formData$address0 === void 0 ? void 0 : _formData$address0.latitude) || "");
|
|
5306
|
+
const [longitude, setLongitude] = useState((formData === null || formData === void 0 ? void 0 : (_formData$address1 = formData.address) === null || _formData$address1 === void 0 ? void 0 : _formData$address1.longitude) || "");
|
|
5307
|
+
const [selectedAddress, setSelectedAddress] = useState("");
|
|
5308
|
+
useEffect(() => {
|
|
5309
|
+
if (formData !== null && formData !== void 0 && formData.address) {
|
|
5310
|
+
setPincode(formData.address.pincode || "");
|
|
5311
|
+
setCity(formData.address.city || null);
|
|
5312
|
+
setLocality(formData.address.locality || null);
|
|
5313
|
+
setHouseNo(formData.address.houseNo || "");
|
|
5314
|
+
setStreetName(formData.address.streetName || "");
|
|
5315
|
+
setLandmark(formData.address.landmark || "");
|
|
5316
|
+
setAddressLine1(formData.address.addressLine1 || "");
|
|
5317
|
+
setAddressLine2(formData.address.addressLine2 || "");
|
|
5318
|
+
setAddressType(formData.address.addressType || null);
|
|
5319
|
+
setLatitude(formData.address.latitude || "");
|
|
5320
|
+
setLongitude(formData.address.longitude || "");
|
|
5321
|
+
}
|
|
5322
|
+
}, [formData === null || formData === void 0 ? void 0 : formData.address]);
|
|
5323
|
+
const availableAddressTypeOptions = useMemo(() => {
|
|
5324
|
+
if (usedAddressTypes.length === 3) {
|
|
5325
|
+
return allOptions.filter(opt => opt.code === "OTHER");
|
|
5326
|
+
}
|
|
5327
|
+
return allOptions.filter(opt => !usedAddressTypes.includes(opt.code));
|
|
5328
|
+
}, [usedAddressTypes]);
|
|
5329
|
+
const {
|
|
5330
|
+
data: fetchedLocalities
|
|
5331
|
+
} = Digit.Hooks.useBoundaryLocalities(city === null || city === void 0 ? void 0 : city.code, "revenue", {
|
|
5332
|
+
enabled: !!city
|
|
5333
|
+
}, t);
|
|
5334
|
+
const structuredLocality = (fetchedLocalities === null || fetchedLocalities === void 0 ? void 0 : fetchedLocalities.map(local => ({
|
|
5335
|
+
i18nKey: local.i18nkey,
|
|
5336
|
+
code: local.code,
|
|
5337
|
+
label: local.label
|
|
5338
|
+
}))) || [];
|
|
5339
|
+
useEffect(() => {
|
|
5340
|
+
if (!navigator.geolocation) return;
|
|
5341
|
+
navigator.geolocation.getCurrentPosition(pos => {
|
|
5342
|
+
setLatitude(pos.coords.latitude);
|
|
5343
|
+
setLongitude(pos.coords.longitude);
|
|
5344
|
+
}, () => console.log("Location blocked"));
|
|
5345
|
+
}, []);
|
|
5346
|
+
useEffect(() => {
|
|
5347
|
+
if (selectedAddress && Object.keys(selectedAddress).length) {
|
|
5348
|
+
setPincode(selectedAddress.pinCode);
|
|
5349
|
+
setCity(allCities === null || allCities === void 0 ? void 0 : allCities.find(c => c.name === selectedAddress.city));
|
|
5350
|
+
setLocality(fetchedLocalities === null || fetchedLocalities === void 0 ? void 0 : fetchedLocalities.find(l => l.i18nkey === selectedAddress.locality));
|
|
5351
|
+
setHouseNo(selectedAddress.houseNumber);
|
|
5352
|
+
setStreetName(selectedAddress.streetName);
|
|
5353
|
+
setLandmark(selectedAddress.landmark);
|
|
5354
|
+
setAddressLine1(selectedAddress.address);
|
|
5355
|
+
setAddressLine2(selectedAddress.address2);
|
|
5356
|
+
setLatitude(selectedAddress.latitude);
|
|
5357
|
+
setLongitude(selectedAddress.longitude);
|
|
5358
|
+
setAddressType(allOptions.find(a => a.code === selectedAddress.addressType));
|
|
5359
|
+
}
|
|
5360
|
+
}, [selectedAddress]);
|
|
5361
|
+
useEffect(() => {
|
|
5362
|
+
if (!onSelect) return;
|
|
5363
|
+
onSelect((config === null || config === void 0 ? void 0 : config.key) || "address", {
|
|
5364
|
+
pincode,
|
|
5365
|
+
city: (city === null || city === void 0 ? void 0 : city.code) || city,
|
|
5366
|
+
locality: (locality === null || locality === void 0 ? void 0 : locality.code) || locality,
|
|
5367
|
+
houseNo,
|
|
5368
|
+
landmark,
|
|
5369
|
+
addressLine1,
|
|
5370
|
+
addressLine2,
|
|
5371
|
+
streetName,
|
|
5372
|
+
addressType: (addressType === null || addressType === void 0 ? void 0 : addressType.code) || addressType,
|
|
5373
|
+
latitude,
|
|
5374
|
+
longitude
|
|
5375
|
+
});
|
|
5376
|
+
}, [pincode, city, locality, houseNo, landmark, addressLine1, addressLine2, streetName, addressType, latitude, longitude]);
|
|
5377
|
+
return /*#__PURE__*/React.createElement(FormStep, {
|
|
5378
|
+
config: config,
|
|
5379
|
+
t: t,
|
|
5380
|
+
isDisabled: !houseNo || !city || !locality || !pincode || !addressLine1 || !streetName || !addressLine2
|
|
5381
|
+
}, (userDetails === null || userDetails === void 0 ? void 0 : (_userDetails$addresse = userDetails.addresses) === null || _userDetails$addresse === void 0 ? void 0 : _userDetails$addresse.length) > 0 && /*#__PURE__*/React.createElement("div", {
|
|
5382
|
+
style: {
|
|
5383
|
+
gridColumn: "span 2"
|
|
5384
|
+
}
|
|
5385
|
+
}, /*#__PURE__*/React.createElement(CardLabel, null, t("COMMON_ADDRESS_TYPE")), /*#__PURE__*/React.createElement(Dropdown, {
|
|
5386
|
+
selected: selectedAddress,
|
|
5387
|
+
select: setSelectedAddress,
|
|
5388
|
+
option: userDetails.addresses,
|
|
5389
|
+
optionKey: "address",
|
|
5390
|
+
t: t,
|
|
5391
|
+
style: {
|
|
5392
|
+
width: "100%"
|
|
5393
|
+
}
|
|
5394
|
+
})), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, null, t("COMMON_ADDRESS_TYPE")), /*#__PURE__*/React.createElement(Dropdown, {
|
|
5395
|
+
selected: addressType,
|
|
5396
|
+
select: setAddressType,
|
|
5397
|
+
option: availableAddressTypeOptions,
|
|
5398
|
+
optionKey: "i18nKey",
|
|
5399
|
+
t: t,
|
|
5400
|
+
style: {
|
|
5401
|
+
width: "100%"
|
|
5402
|
+
}
|
|
5403
|
+
})), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, null, t("HOUSE_NO")), /*#__PURE__*/React.createElement(TextInput, {
|
|
5404
|
+
value: houseNo,
|
|
5405
|
+
onChange: e => setHouseNo(e.target.value)
|
|
5406
|
+
})), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, null, t("STREET_NAME")), /*#__PURE__*/React.createElement(TextInput, {
|
|
5407
|
+
value: streetName,
|
|
5408
|
+
onChange: e => setStreetName(e.target.value)
|
|
5409
|
+
})), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, null, t("ADDRESS_LINE1")), /*#__PURE__*/React.createElement(TextInput, {
|
|
5410
|
+
value: addressLine1,
|
|
5411
|
+
onChange: e => setAddressLine1(e.target.value)
|
|
5412
|
+
})), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, null, t("ADDRESS_LINE2")), /*#__PURE__*/React.createElement(TextInput, {
|
|
5413
|
+
value: addressLine2,
|
|
5414
|
+
onChange: e => setAddressLine2(e.target.value)
|
|
5415
|
+
})), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, null, t("LANDMARK")), /*#__PURE__*/React.createElement(TextInput, {
|
|
5416
|
+
value: landmark,
|
|
5417
|
+
onChange: e => setLandmark(e.target.value)
|
|
5418
|
+
})), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, null, t("CITY")), /*#__PURE__*/React.createElement(Controller, {
|
|
5419
|
+
control: control,
|
|
5420
|
+
name: "city",
|
|
5421
|
+
render: () => /*#__PURE__*/React.createElement(Dropdown, {
|
|
5422
|
+
selected: city,
|
|
5423
|
+
select: setCity,
|
|
5424
|
+
option: allCities,
|
|
5425
|
+
optionKey: "i18nKey",
|
|
5426
|
+
t: t
|
|
5427
|
+
})
|
|
5428
|
+
})), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, null, t("LOCALITY")), /*#__PURE__*/React.createElement(Controller, {
|
|
5429
|
+
control: control,
|
|
5430
|
+
name: "locality",
|
|
5431
|
+
render: () => /*#__PURE__*/React.createElement(Dropdown, {
|
|
5432
|
+
selected: locality,
|
|
5433
|
+
select: setLocality,
|
|
5434
|
+
option: structuredLocality,
|
|
5435
|
+
optionKey: "i18nKey",
|
|
5436
|
+
t: t
|
|
5437
|
+
})
|
|
5438
|
+
})), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, null, t("LATITUDE")), /*#__PURE__*/React.createElement(TextInput, {
|
|
5439
|
+
value: latitude,
|
|
5440
|
+
onChange: e => setLatitude(e.target.value)
|
|
5441
|
+
})), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, null, t("LONGITUDE")), /*#__PURE__*/React.createElement(TextInput, {
|
|
5442
|
+
value: longitude,
|
|
5443
|
+
onChange: e => setLongitude(e.target.value)
|
|
5444
|
+
})), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, null, t("PINCODE")), /*#__PURE__*/React.createElement(TextInput, {
|
|
5445
|
+
value: pincode,
|
|
5446
|
+
onChange: e => setPincode(e.target.value),
|
|
5447
|
+
maxLength: 6
|
|
5448
|
+
})));
|
|
5449
|
+
};
|
|
5450
|
+
|
|
5451
|
+
const AddFixPointAddress = () => {
|
|
5452
|
+
const {
|
|
5453
|
+
t
|
|
5454
|
+
} = useTranslation();
|
|
5455
|
+
const location = useLocation();
|
|
5456
|
+
const queryParams = new URLSearchParams(location.search);
|
|
5457
|
+
const editId = queryParams.get("id");
|
|
5458
|
+
const [formData, setFormData] = useState({});
|
|
5459
|
+
const [showToast, setShowToast] = useState(null);
|
|
5460
|
+
const tenantId = Digit.ULBService.getCurrentTenantId();
|
|
5461
|
+
const {
|
|
5462
|
+
isLoading: isEditLoading,
|
|
5463
|
+
data: editData
|
|
5464
|
+
} = Digit.Hooks.wt.useFixedPointSearchAPI({
|
|
5465
|
+
tenantId,
|
|
5466
|
+
filters: {
|
|
5467
|
+
bookingId: editId
|
|
5468
|
+
}
|
|
5469
|
+
}, {
|
|
5470
|
+
enabled: !!editId
|
|
5471
|
+
});
|
|
5472
|
+
useEffect(() => {
|
|
5473
|
+
console.log("Edit ID:", editId);
|
|
5474
|
+
console.log("Search Result:", editData);
|
|
5475
|
+
if (editId && editData !== null && editData !== void 0 && editData.waterTankerBookingDetail) {
|
|
5476
|
+
const data = editData.waterTankerBookingDetail.find(item => item.bookingId === editId);
|
|
5477
|
+
if (data) {
|
|
5478
|
+
var _data$applicantDetail, _data$applicantDetail2, _data$applicantDetail3, _data$applicantDetail4;
|
|
5479
|
+
setFormData({
|
|
5480
|
+
owner: {
|
|
5481
|
+
name: (_data$applicantDetail = data.applicantDetail) === null || _data$applicantDetail === void 0 ? void 0 : _data$applicantDetail.name,
|
|
5482
|
+
mobileNumber: (_data$applicantDetail2 = data.applicantDetail) === null || _data$applicantDetail2 === void 0 ? void 0 : _data$applicantDetail2.mobileNumber,
|
|
5483
|
+
alternateNumber: (_data$applicantDetail3 = data.applicantDetail) === null || _data$applicantDetail3 === void 0 ? void 0 : _data$applicantDetail3.alternateNumber,
|
|
5484
|
+
emailId: (_data$applicantDetail4 = data.applicantDetail) === null || _data$applicantDetail4 === void 0 ? void 0 : _data$applicantDetail4.emailId
|
|
5485
|
+
},
|
|
5486
|
+
address: {
|
|
5487
|
+
...data.address
|
|
5488
|
+
},
|
|
5489
|
+
bookingId: data.bookingId,
|
|
5490
|
+
auditDetails: data.auditDetails
|
|
5491
|
+
});
|
|
5492
|
+
}
|
|
5493
|
+
}
|
|
5494
|
+
}, [editData, editId]);
|
|
5495
|
+
const addressConfig = {
|
|
5496
|
+
key: "address"
|
|
5497
|
+
};
|
|
5498
|
+
const handleSelect = (key, data) => {
|
|
5499
|
+
setFormData(prev => ({
|
|
5500
|
+
...prev,
|
|
5501
|
+
[key]: {
|
|
5502
|
+
...(prev[key] || {}),
|
|
5503
|
+
...data
|
|
5504
|
+
}
|
|
5505
|
+
}));
|
|
5506
|
+
};
|
|
5507
|
+
const {
|
|
5508
|
+
mutate: createFixedPoint
|
|
5509
|
+
} = Digit.Hooks.wt.useCreateFixedPoint(tenantId);
|
|
5510
|
+
const handleSubmit = e => {
|
|
5511
|
+
const payload = fixedPointPayload({
|
|
5512
|
+
...formData,
|
|
5513
|
+
tenantId
|
|
5514
|
+
});
|
|
5515
|
+
const mutation = createFixedPoint;
|
|
5516
|
+
mutation(payload, {
|
|
5517
|
+
onSuccess: () => {
|
|
5518
|
+
setShowToast({
|
|
5519
|
+
label: editId ? t("WT_FILLING_POINT_UPDATED_SUCCESS") : t("WT_FILLING_POINT_CREATED_SUCCESS")
|
|
5520
|
+
});
|
|
5521
|
+
setTimeout(() => setShowToast(null), 5000);
|
|
5522
|
+
},
|
|
5523
|
+
onError: error => {
|
|
5524
|
+
var _error$response, _error$response$data, _error$response$data$, _error$response$data$2;
|
|
5525
|
+
setShowToast({
|
|
5526
|
+
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) || (editId ? t("WT_FILLING_POINT_UPDATED_ERROR") : t("WT_FILLING_POINT_CREATED_ERROR")),
|
|
5527
|
+
isError: true
|
|
5528
|
+
});
|
|
5529
|
+
setTimeout(() => setShowToast(null), 5000);
|
|
5530
|
+
}
|
|
5531
|
+
});
|
|
5532
|
+
};
|
|
5533
|
+
if (isEditLoading) return /*#__PURE__*/React.createElement(Loader, null);
|
|
5534
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
5535
|
+
style: {
|
|
5536
|
+
display: "flex",
|
|
5537
|
+
gap: "24px"
|
|
5538
|
+
}
|
|
5539
|
+
}, /*#__PURE__*/React.createElement(Timeline, {
|
|
5540
|
+
steps: ["WT_FIXED_POINT"],
|
|
5541
|
+
currentStep: 1
|
|
5542
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
5543
|
+
style: {
|
|
5544
|
+
flex: 1
|
|
5545
|
+
}
|
|
5546
|
+
}, /*#__PURE__*/React.createElement(AddFillingPointMetaData, {
|
|
5547
|
+
t: t,
|
|
5548
|
+
config: {
|
|
5549
|
+
key: "owner"
|
|
5550
|
+
},
|
|
5551
|
+
onSelect: handleSelect,
|
|
5552
|
+
formData: formData,
|
|
5553
|
+
visibleFields: ["name", "mobileNumber", "alternateNumber", "emailId"]
|
|
5554
|
+
}), /*#__PURE__*/React.createElement(AddFixFillAddress, {
|
|
5555
|
+
t: t,
|
|
5556
|
+
config: addressConfig,
|
|
5557
|
+
onSelect: handleSelect,
|
|
5558
|
+
formData: formData
|
|
5559
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
5560
|
+
style: {
|
|
5561
|
+
display: "flex",
|
|
5562
|
+
marginBottom: "24px",
|
|
5563
|
+
justifyContent: "flex-end"
|
|
5564
|
+
}
|
|
5565
|
+
}, /*#__PURE__*/React.createElement(SubmitBar, {
|
|
5566
|
+
label: editId ? t("ES_COMMON_UPDATE") : t("ES_COMMON_SAVE"),
|
|
5567
|
+
onSubmit: handleSubmit
|
|
5568
|
+
}))), showToast && /*#__PURE__*/React.createElement(Toast, {
|
|
5569
|
+
error: showToast.isError,
|
|
5570
|
+
label: showToast.label,
|
|
5571
|
+
onClose: () => setShowToast(null)
|
|
5572
|
+
}));
|
|
5573
|
+
};
|
|
5574
|
+
|
|
5575
|
+
const SearchFillingPointAddress = () => {
|
|
2872
5576
|
const {
|
|
2873
5577
|
t
|
|
2874
5578
|
} = useTranslation();
|
|
2875
|
-
const
|
|
2876
|
-
|
|
2877
|
-
|
|
2878
|
-
const [
|
|
2879
|
-
|
|
2880
|
-
|
|
2881
|
-
});
|
|
2882
|
-
const
|
|
2883
|
-
const [pageSize, setPageSize] = useState(_initialStates.pageSize || 10);
|
|
2884
|
-
const [sortParams, setSortParams] = useState(_initialStates.sortParams || [{
|
|
2885
|
-
id: "createdTime",
|
|
2886
|
-
desc: true
|
|
2887
|
-
}]);
|
|
2888
|
-
const [searchParams, setSearchParams] = useState(_initialStates.searchParams || {});
|
|
2889
|
-
let isMobile = window.Digit.Utils.browser.isMobile();
|
|
2890
|
-
let paginationParams = isMobile ? {
|
|
2891
|
-
limit: 100,
|
|
2892
|
-
offset: 0,
|
|
2893
|
-
sortBy: sortParams === null || sortParams === void 0 ? void 0 : (_sortParams$ = sortParams[0]) === null || _sortParams$ === void 0 ? void 0 : _sortParams$.id,
|
|
2894
|
-
sortOrder: sortParams !== null && sortParams !== void 0 && (_sortParams$2 = sortParams[0]) !== null && _sortParams$2 !== void 0 && _sortParams$2.desc ? "DESC" : "ASC"
|
|
2895
|
-
} : {
|
|
2896
|
-
limit: pageSize,
|
|
2897
|
-
offset: pageOffset,
|
|
2898
|
-
sortBy: sortParams === null || sortParams === void 0 ? void 0 : (_sortParams$3 = sortParams[0]) === null || _sortParams$3 === void 0 ? void 0 : _sortParams$3.id,
|
|
2899
|
-
sortOrder: sortParams !== null && sortParams !== void 0 && (_sortParams$4 = sortParams[0]) !== null && _sortParams$4 !== void 0 && _sortParams$4.desc ? "DESC" : "ASC"
|
|
2900
|
-
};
|
|
5579
|
+
const history = useHistory();
|
|
5580
|
+
const [selectedTab, setSelectedTab] = useState("FIXED_POINT");
|
|
5581
|
+
const [showAddMenu, setShowAddMenu] = useState(false);
|
|
5582
|
+
const [searchValue, setSearchValue] = useState("");
|
|
5583
|
+
const [mobileNumber, setMobileNumber] = useState("");
|
|
5584
|
+
const [status, setStatus] = useState(null);
|
|
5585
|
+
const [searchParams, setSearchParams] = useState({});
|
|
5586
|
+
const tenantId = Digit.ULBService.getCurrentTenantId();
|
|
2901
5587
|
const {
|
|
2902
|
-
|
|
2903
|
-
|
|
2904
|
-
|
|
2905
|
-
|
|
2906
|
-
searchFields,
|
|
2907
|
-
...rest
|
|
2908
|
-
} = useNewInboxAPI ? Digit.Hooks.useNewInboxGeneral({
|
|
5588
|
+
isLoading: isFixedLoading,
|
|
5589
|
+
data: fixedPointData,
|
|
5590
|
+
refetch: refetchFixed
|
|
5591
|
+
} = Digit.Hooks.wt.useFixedPointSearchAPI({
|
|
2909
5592
|
tenantId,
|
|
2910
|
-
|
|
2911
|
-
|
|
2912
|
-
|
|
2913
|
-
|
|
2914
|
-
|
|
2915
|
-
|
|
2916
|
-
|
|
5593
|
+
filters: searchParams
|
|
5594
|
+
}, {
|
|
5595
|
+
enabled: selectedTab === "FIXED_POINT"
|
|
5596
|
+
});
|
|
5597
|
+
const {
|
|
5598
|
+
isLoading: isFillingLoading,
|
|
5599
|
+
data: fillingPointData,
|
|
5600
|
+
refetch: refetchFilling
|
|
5601
|
+
} = Digit.Hooks.wt.useTankerSearchAPI({
|
|
2917
5602
|
tenantId,
|
|
2918
|
-
|
|
2919
|
-
|
|
2920
|
-
|
|
2921
|
-
...searchParams,
|
|
2922
|
-
...paginationParams,
|
|
2923
|
-
sortParams
|
|
2924
|
-
},
|
|
2925
|
-
rawWfHandler,
|
|
2926
|
-
rawSearchHandler,
|
|
2927
|
-
combineResponse,
|
|
2928
|
-
wfConfig,
|
|
2929
|
-
searchConfig: {
|
|
2930
|
-
...enableSarch,
|
|
2931
|
-
...searchConfig
|
|
2932
|
-
},
|
|
2933
|
-
middlewaresWf,
|
|
2934
|
-
middlewareSearch
|
|
5603
|
+
filters: searchParams
|
|
5604
|
+
}, {
|
|
5605
|
+
enabled: selectedTab === "FILLING_POINT"
|
|
2935
5606
|
});
|
|
2936
|
-
|
|
2937
|
-
|
|
2938
|
-
|
|
2939
|
-
|
|
2940
|
-
|
|
5607
|
+
const isLoading = selectedTab === "FIXED_POINT" ? isFixedLoading : isFillingLoading;
|
|
5608
|
+
const tableData = (selectedTab === "FIXED_POINT" ? fixedPointData === null || fixedPointData === void 0 ? void 0 : fixedPointData.waterTankerBookingDetail : fillingPointData === null || fillingPointData === void 0 ? void 0 : fillingPointData.waterTankerBookingDetail) || [];
|
|
5609
|
+
const searchConfig = {
|
|
5610
|
+
FIXED_POINT: {
|
|
5611
|
+
label: "WT_FIXED_POINT_NAME",
|
|
5612
|
+
placeholder: "WT_ENTER_FIXED_POINT_NAME"
|
|
5613
|
+
},
|
|
5614
|
+
FILLING_POINT: {
|
|
5615
|
+
label: "WT_FILLING_POINT_NAME",
|
|
5616
|
+
placeholder: "WT_ENTER_FILLING_POINT_NAME"
|
|
5617
|
+
}
|
|
2941
5618
|
};
|
|
2942
|
-
const
|
|
2943
|
-
|
|
5619
|
+
const statusOptions = [{
|
|
5620
|
+
i18nKey: "WT_BOOKING_CREATED",
|
|
5621
|
+
code: "BOOKING_CREATED"
|
|
5622
|
+
}, {
|
|
5623
|
+
i18nKey: "WT_BOOKING_APPROVED",
|
|
5624
|
+
code: "APPROVED"
|
|
5625
|
+
}, {
|
|
5626
|
+
i18nKey: "WT_TANKER_DELIVERED",
|
|
5627
|
+
code: "TANKER_DELIVERED"
|
|
5628
|
+
}, {
|
|
5629
|
+
i18nKey: "WT_ASSIGN_VENDOR",
|
|
5630
|
+
code: "ASSIGN_VENDOR"
|
|
5631
|
+
}, {
|
|
5632
|
+
i18nKey: "WT_BOOKING_REJECTED",
|
|
5633
|
+
code: "REJECT"
|
|
5634
|
+
}];
|
|
5635
|
+
const {
|
|
5636
|
+
label,
|
|
5637
|
+
placeholder
|
|
5638
|
+
} = searchConfig[selectedTab];
|
|
5639
|
+
const clearSearch = () => {
|
|
5640
|
+
setSearchValue("");
|
|
5641
|
+
setMobileNumber("");
|
|
5642
|
+
setStatus(null);
|
|
5643
|
+
setSearchParams({});
|
|
2944
5644
|
};
|
|
2945
|
-
const
|
|
2946
|
-
|
|
2947
|
-
|
|
2948
|
-
|
|
2949
|
-
|
|
2950
|
-
|
|
2951
|
-
|
|
2952
|
-
|
|
5645
|
+
const onTabChange = tab => {
|
|
5646
|
+
setSelectedTab(tab);
|
|
5647
|
+
clearSearch();
|
|
5648
|
+
};
|
|
5649
|
+
const onAddClick = () => {
|
|
5650
|
+
setShowAddMenu(prev => !prev);
|
|
5651
|
+
};
|
|
5652
|
+
const onActionSelect = option => {
|
|
5653
|
+
if (option === "FILLING_POINT") {
|
|
5654
|
+
history.push(`/digit-ui/employee/wt/add-filling-point-address`);
|
|
5655
|
+
} else if (option === "FIXED_POINT") {
|
|
5656
|
+
history.push(`/digit-ui/employee/wt/add-fix-point-address`);
|
|
5657
|
+
}
|
|
5658
|
+
setShowAddMenu(false);
|
|
5659
|
+
};
|
|
5660
|
+
const onSearch = () => {
|
|
2953
5661
|
setSearchParams({
|
|
2954
|
-
|
|
2955
|
-
|
|
2956
|
-
|
|
2957
|
-
enabled: true
|
|
5662
|
+
name: searchValue,
|
|
5663
|
+
mobileNumber: mobileNumber,
|
|
5664
|
+
status: status === null || status === void 0 ? void 0 : status.code
|
|
2958
5665
|
});
|
|
2959
5666
|
};
|
|
2960
|
-
const
|
|
2961
|
-
if (
|
|
2962
|
-
|
|
2963
|
-
|
|
2964
|
-
|
|
2965
|
-
|
|
2966
|
-
|
|
2967
|
-
|
|
2968
|
-
|
|
2969
|
-
|
|
2970
|
-
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
|
|
2974
|
-
|
|
2975
|
-
|
|
2976
|
-
|
|
2977
|
-
|
|
2978
|
-
|
|
2979
|
-
|
|
2980
|
-
|
|
2981
|
-
|
|
2982
|
-
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
}
|
|
5667
|
+
const columns = React.useMemo(() => {
|
|
5668
|
+
if (selectedTab === "FIXED_POINT") {
|
|
5669
|
+
return [{
|
|
5670
|
+
Header: t("WT_APPLICANT_NAME"),
|
|
5671
|
+
accessor: row => {
|
|
5672
|
+
var _row$applicantDetail;
|
|
5673
|
+
return (row === null || row === void 0 ? void 0 : (_row$applicantDetail = row.applicantDetail) === null || _row$applicantDetail === void 0 ? void 0 : _row$applicantDetail.name) || "NA";
|
|
5674
|
+
},
|
|
5675
|
+
id: "applicantName",
|
|
5676
|
+
Cell: ({
|
|
5677
|
+
row
|
|
5678
|
+
}) => {
|
|
5679
|
+
var _row$original$applica;
|
|
5680
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
5681
|
+
className: "link"
|
|
5682
|
+
}, /*#__PURE__*/React.createElement(Link, {
|
|
5683
|
+
to: `/digit-ui/employee/wt/add-fix-point-address?id=${row.original.bookingId}`
|
|
5684
|
+
}, ((_row$original$applica = row.original.applicantDetail) === null || _row$original$applica === void 0 ? void 0 : _row$original$applica.name) || "NA"));
|
|
5685
|
+
}
|
|
5686
|
+
}, {
|
|
5687
|
+
Header: t("WT_MOBILE_NUMBER"),
|
|
5688
|
+
accessor: row => {
|
|
5689
|
+
var _row$applicantDetail2;
|
|
5690
|
+
return (row === null || row === void 0 ? void 0 : (_row$applicantDetail2 = row.applicantDetail) === null || _row$applicantDetail2 === void 0 ? void 0 : _row$applicantDetail2.mobileNumber) || "NA";
|
|
5691
|
+
},
|
|
5692
|
+
id: "mobileNumber"
|
|
5693
|
+
}, {
|
|
5694
|
+
Header: t("WT_LOCALITY"),
|
|
5695
|
+
accessor: row => {
|
|
5696
|
+
var _row$address;
|
|
5697
|
+
return (row === null || row === void 0 ? void 0 : (_row$address = row.address) === null || _row$address === void 0 ? void 0 : _row$address.locality) || "NA";
|
|
5698
|
+
},
|
|
5699
|
+
id: "locality"
|
|
5700
|
+
}];
|
|
2987
5701
|
} else {
|
|
2988
|
-
|
|
2989
|
-
|
|
2990
|
-
|
|
2991
|
-
|
|
5702
|
+
return [{
|
|
5703
|
+
Header: t("WT_FILLING_POINT_NAME"),
|
|
5704
|
+
accessor: row => {
|
|
5705
|
+
var _row$fillingpointmeta;
|
|
5706
|
+
return (row === null || row === void 0 ? void 0 : (_row$fillingpointmeta = row.fillingpointmetadata) === null || _row$fillingpointmeta === void 0 ? void 0 : _row$fillingpointmeta.name) || "NA";
|
|
5707
|
+
},
|
|
5708
|
+
id: "fillingPointName",
|
|
5709
|
+
Cell: ({
|
|
5710
|
+
row
|
|
5711
|
+
}) => {
|
|
5712
|
+
var _row$original$filling;
|
|
5713
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
5714
|
+
className: "link"
|
|
5715
|
+
}, /*#__PURE__*/React.createElement(Link, {
|
|
5716
|
+
to: `/digit-ui/employee/wt/add-filling-point-address?id=${row.original.bookingId}`
|
|
5717
|
+
}, ((_row$original$filling = row.original.fillingpointmetadata) === null || _row$original$filling === void 0 ? void 0 : _row$original$filling.name) || "NA"));
|
|
2992
5718
|
}
|
|
2993
|
-
},
|
|
2994
|
-
|
|
2995
|
-
|
|
2996
|
-
|
|
2997
|
-
|
|
2998
|
-
|
|
2999
|
-
|
|
3000
|
-
|
|
3001
|
-
|
|
3002
|
-
|
|
3003
|
-
|
|
3004
|
-
|
|
3005
|
-
|
|
3006
|
-
|
|
3007
|
-
|
|
3008
|
-
disableSort: false,
|
|
3009
|
-
onPageSizeChange: handlePageSizeChange,
|
|
3010
|
-
parentRoute: parentRoute,
|
|
3011
|
-
searchParams: searchParams,
|
|
3012
|
-
sortParams: sortParams,
|
|
3013
|
-
totalRecords: Number(data === null || data === void 0 ? void 0 : (_data$ = data[0]) === null || _data$ === void 0 ? void 0 : _data$.totalCount),
|
|
3014
|
-
filterComponent: filterComponent,
|
|
3015
|
-
EmptyResultInboxComp: EmptyResultInboxComp,
|
|
3016
|
-
useNewInboxAPI: useNewInboxAPI
|
|
3017
|
-
}));
|
|
5719
|
+
}, {
|
|
5720
|
+
Header: t("WT_JE_NAME"),
|
|
5721
|
+
accessor: row => {
|
|
5722
|
+
var _row$fillingpointmeta2;
|
|
5723
|
+
return (row === null || row === void 0 ? void 0 : (_row$fillingpointmeta2 = row.fillingpointmetadata) === null || _row$fillingpointmeta2 === void 0 ? void 0 : _row$fillingpointmeta2.jeName) || "NA";
|
|
5724
|
+
},
|
|
5725
|
+
id: "jeName"
|
|
5726
|
+
}, {
|
|
5727
|
+
Header: t("WT_LOCALITY"),
|
|
5728
|
+
accessor: row => {
|
|
5729
|
+
var _row$address2;
|
|
5730
|
+
return (row === null || row === void 0 ? void 0 : (_row$address2 = row.address) === null || _row$address2 === void 0 ? void 0 : _row$address2.locality) || "NA";
|
|
5731
|
+
},
|
|
5732
|
+
id: "locality"
|
|
5733
|
+
}];
|
|
3018
5734
|
}
|
|
3019
|
-
}
|
|
5735
|
+
}, [selectedTab, t]);
|
|
5736
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Card, null, /*#__PURE__*/React.createElement("div", {
|
|
5737
|
+
className: "search-tabs-container"
|
|
5738
|
+
}, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("button", {
|
|
5739
|
+
className: selectedTab === "FIXED_POINT" ? "search-tab-head-selected" : "search-tab-head",
|
|
5740
|
+
onClick: () => onTabChange("FIXED_POINT")
|
|
5741
|
+
}, t("WT_FIXED_POINT")), /*#__PURE__*/React.createElement("button", {
|
|
5742
|
+
className: selectedTab === "FILLING_POINT" ? "search-tab-head-selected" : "search-tab-head",
|
|
5743
|
+
onClick: () => onTabChange("FILLING_POINT")
|
|
5744
|
+
}, t("WT_FILLING_POINT"))), /*#__PURE__*/React.createElement("div", {
|
|
5745
|
+
className: "action-bar-wrap-registry"
|
|
5746
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
5747
|
+
className: "search-add",
|
|
5748
|
+
onClick: onAddClick
|
|
5749
|
+
}, t("ES_VENDOR_REGISTRY_INBOX_HEADER_ADD"), /*#__PURE__*/React.createElement("div", {
|
|
5750
|
+
className: "search-add-icon"
|
|
5751
|
+
}, /*#__PURE__*/React.createElement(AddIcon, null))), showAddMenu && /*#__PURE__*/React.createElement(Menu, {
|
|
5752
|
+
localeKeyPrefix: "ES_FSM_ACTION_CREATE",
|
|
5753
|
+
options: ["FIXED_POINT", "FILLING_POINT"],
|
|
5754
|
+
t: t,
|
|
5755
|
+
onSelect: onActionSelect
|
|
5756
|
+
}))), /*#__PURE__*/React.createElement("div", {
|
|
5757
|
+
className: "finance-mainlayout"
|
|
5758
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
5759
|
+
className: "finance-mainlayout-col1"
|
|
5760
|
+
}, /*#__PURE__*/React.createElement(Label, null, t(label)), /*#__PURE__*/React.createElement(TextInput, {
|
|
5761
|
+
value: searchValue,
|
|
5762
|
+
onChange: e => setSearchValue(e.target.value),
|
|
5763
|
+
placeholder: t(placeholder)
|
|
5764
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
5765
|
+
className: "finance-mainlayout-col1"
|
|
5766
|
+
}, /*#__PURE__*/React.createElement(Label, null, t("WT_MOBILE_NUMBER")), /*#__PURE__*/React.createElement(TextInput, {
|
|
5767
|
+
value: mobileNumber,
|
|
5768
|
+
onChange: e => setMobileNumber(e.target.value),
|
|
5769
|
+
placeholder: t("WT_ENTER_MOBILE_NUMBER")
|
|
5770
|
+
})), selectedTab === "FILLING_POINT" && /*#__PURE__*/React.createElement("div", {
|
|
5771
|
+
className: "finance-mainlayout-col1"
|
|
5772
|
+
}, /*#__PURE__*/React.createElement(Label, null, t("PT_COMMON_TABLE_COL_STATUS_LABEL")), /*#__PURE__*/React.createElement(Dropdown, {
|
|
5773
|
+
option: statusOptions,
|
|
5774
|
+
optionKey: "i18nKey",
|
|
5775
|
+
selected: status,
|
|
5776
|
+
select: setStatus,
|
|
5777
|
+
t: t
|
|
5778
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
5779
|
+
style: {
|
|
5780
|
+
display: "flex",
|
|
5781
|
+
marginTop: "32px",
|
|
5782
|
+
justifyContent: "flex-end",
|
|
5783
|
+
gap: "16px"
|
|
5784
|
+
}
|
|
5785
|
+
}, /*#__PURE__*/React.createElement(SubmitBar, {
|
|
5786
|
+
label: t("ES_COMMON_SEARCH"),
|
|
5787
|
+
onSubmit: onSearch
|
|
5788
|
+
}), /*#__PURE__*/React.createElement("span", {
|
|
5789
|
+
className: "clear-search",
|
|
5790
|
+
onClick: clearSearch
|
|
5791
|
+
}, t("ES_COMMON_CLEAR_SEARCH"))))), /*#__PURE__*/React.createElement(Card, null, /*#__PURE__*/React.createElement(Table, {
|
|
5792
|
+
data: tableData,
|
|
5793
|
+
columns: columns,
|
|
5794
|
+
pageSize: 10,
|
|
5795
|
+
showPagination: true,
|
|
5796
|
+
showPageSizeOptions: true,
|
|
5797
|
+
showSearch: false,
|
|
5798
|
+
getCellProps: () => ({
|
|
5799
|
+
style: {
|
|
5800
|
+
padding: "20px 18px",
|
|
5801
|
+
fontSize: "16px"
|
|
5802
|
+
}
|
|
5803
|
+
}),
|
|
5804
|
+
t: t,
|
|
5805
|
+
isLoading: isLoading,
|
|
5806
|
+
isSearchRequired: false,
|
|
5807
|
+
isDownloadRequired: true,
|
|
5808
|
+
isFilterRequired: true,
|
|
5809
|
+
isSortRequired: true
|
|
5810
|
+
})));
|
|
3020
5811
|
};
|
|
3021
5812
|
|
|
3022
5813
|
const EmployeeApp = ({
|
|
@@ -3073,6 +5864,26 @@ const EmployeeApp = ({
|
|
|
3073
5864
|
crumbs.push({
|
|
3074
5865
|
label: t("WT_BOOKING_DETAILS")
|
|
3075
5866
|
});
|
|
5867
|
+
} else if (pathname.includes("/fixed-point-schedule")) {
|
|
5868
|
+
crumbs.push({
|
|
5869
|
+
label: t("WT_FIXED_POINT_SCHEDULE_MANAGEMENT")
|
|
5870
|
+
});
|
|
5871
|
+
} else if (pathname.includes("/live-tracking")) {
|
|
5872
|
+
crumbs.push({
|
|
5873
|
+
label: t("WT_LIVE_TRACKING_SYSTEM")
|
|
5874
|
+
});
|
|
5875
|
+
} else if (pathname.includes("/add-filling-point-address")) {
|
|
5876
|
+
crumbs.push({
|
|
5877
|
+
label: t("WT_ADD_FILLING_POINT_ADDRESS")
|
|
5878
|
+
});
|
|
5879
|
+
} else if (pathname.includes("/add-fix-point-address")) {
|
|
5880
|
+
crumbs.push({
|
|
5881
|
+
label: t("WT_ADD_FIX_POINT_ADDRESS")
|
|
5882
|
+
});
|
|
5883
|
+
} else if (pathname.includes("/search-filling-fix-point")) {
|
|
5884
|
+
crumbs.push({
|
|
5885
|
+
label: t("WT_SEARCH_FIX_POINT")
|
|
5886
|
+
});
|
|
3076
5887
|
}
|
|
3077
5888
|
return crumbs;
|
|
3078
5889
|
};
|
|
@@ -3193,6 +6004,21 @@ const EmployeeApp = ({
|
|
|
3193
6004
|
parentRoute: path,
|
|
3194
6005
|
moduleCode: "TP"
|
|
3195
6006
|
}))
|
|
6007
|
+
}), /*#__PURE__*/React.createElement(PrivateRoute, {
|
|
6008
|
+
path: `${path}/fixed-point-schedule`,
|
|
6009
|
+
component: () => /*#__PURE__*/React.createElement(FixedPointScheduleManagement, null)
|
|
6010
|
+
}), /*#__PURE__*/React.createElement(PrivateRoute, {
|
|
6011
|
+
path: `${path}/live-tracking`,
|
|
6012
|
+
component: () => /*#__PURE__*/React.createElement(LiveTrackingSystem, null)
|
|
6013
|
+
}), /*#__PURE__*/React.createElement(PrivateRoute, {
|
|
6014
|
+
path: `${path}/add-filling-point-address`,
|
|
6015
|
+
component: () => /*#__PURE__*/React.createElement(AddFillingPointAddress, null)
|
|
6016
|
+
}), /*#__PURE__*/React.createElement(PrivateRoute, {
|
|
6017
|
+
path: `${path}/add-fix-point-address`,
|
|
6018
|
+
component: () => /*#__PURE__*/React.createElement(AddFixPointAddress, null)
|
|
6019
|
+
}), /*#__PURE__*/React.createElement(PrivateRoute, {
|
|
6020
|
+
path: `${path}/search-filling-fix-point`,
|
|
6021
|
+
component: () => /*#__PURE__*/React.createElement(SearchFillingPointAddress, null)
|
|
3196
6022
|
}))))));
|
|
3197
6023
|
};
|
|
3198
6024
|
|
|
@@ -10428,8 +13254,6 @@ const Filter = ({
|
|
|
10428
13254
|
});
|
|
10429
13255
|
};
|
|
10430
13256
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
10431
|
-
className: "filter"
|
|
10432
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
10433
13257
|
className: "filter-card"
|
|
10434
13258
|
}, /*#__PURE__*/React.createElement("div", {
|
|
10435
13259
|
className: "heading",
|
|
@@ -10477,7 +13301,11 @@ const Filter = ({
|
|
|
10477
13301
|
fill: "#505A5F"
|
|
10478
13302
|
}))), props.type === "mobile" && /*#__PURE__*/React.createElement("span", {
|
|
10479
13303
|
onClick: props.onClose
|
|
10480
|
-
}, /*#__PURE__*/React.createElement(CloseSvg, null))), /*#__PURE__*/React.createElement("
|
|
13304
|
+
}, /*#__PURE__*/React.createElement(CloseSvg, null))), /*#__PURE__*/React.createElement("form", {
|
|
13305
|
+
id: "filter-form"
|
|
13306
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
13307
|
+
className: "filter-form-field"
|
|
13308
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
10481
13309
|
className: "filter-label",
|
|
10482
13310
|
style: {
|
|
10483
13311
|
fontWeight: "normal"
|
|
@@ -10487,7 +13315,7 @@ const Filter = ({
|
|
|
10487
13315
|
tenantId: tenantId,
|
|
10488
13316
|
boundaryType: "revenue"
|
|
10489
13317
|
}), /*#__PURE__*/React.createElement("div", {
|
|
10490
|
-
className: "tag-container"
|
|
13318
|
+
className: "tag-container hide-x-scrollbar"
|
|
10491
13319
|
}, _searchParams === null || _searchParams === void 0 ? void 0 : (_searchParams$localit = _searchParams.locality) === null || _searchParams$localit === void 0 ? void 0 : _searchParams$localit.map((locality, index) => {
|
|
10492
13320
|
return /*#__PURE__*/React.createElement(RemoveableTag, {
|
|
10493
13321
|
key: index,
|
|
@@ -10499,9 +13327,10 @@ const Filter = ({
|
|
|
10499
13327
|
}
|
|
10500
13328
|
});
|
|
10501
13329
|
}))), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(SubmitBar, {
|
|
13330
|
+
className: "w-fullwidth",
|
|
10502
13331
|
onSubmit: () => applyLocalFilters(),
|
|
10503
13332
|
label: t("ES_COMMON_APPLY")
|
|
10504
|
-
})))))
|
|
13333
|
+
})))));
|
|
10505
13334
|
};
|
|
10506
13335
|
|
|
10507
13336
|
const configPTApproverApplication = ({
|
|
@@ -19887,7 +22716,13 @@ const componentsToRegister = {
|
|
|
19887
22716
|
TreePruningRequestDetails,
|
|
19888
22717
|
MTAcknowledgement,
|
|
19889
22718
|
TPAcknowledgement,
|
|
19890
|
-
MTCitizenCard: MTCitizenCard
|
|
22719
|
+
MTCitizenCard: MTCitizenCard,
|
|
22720
|
+
FixedPointScheduleManagement,
|
|
22721
|
+
LiveTrackingSystem,
|
|
22722
|
+
AddFillingPointAddress,
|
|
22723
|
+
AddFixPointAddress,
|
|
22724
|
+
AddFillingPointMetaData,
|
|
22725
|
+
WTSearchPointAddress: SearchFillingPointAddress
|
|
19891
22726
|
};
|
|
19892
22727
|
const initWTComponents = () => {
|
|
19893
22728
|
Object.entries(componentsToRegister).forEach(([key, value]) => {
|