@djb25/digit-ui-module-wt 1.0.11 → 1.0.13

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.
@@ -1,9 +1,13 @@
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, LabelFieldPair, MultiUploadWrapper, Close as Close$g, BreakLine, InfoBannerIcon, ViewsIcon, Menu, ButtonSelector, LocationIcon, CitizenHomeCard, PTIcon, ApplicantDetails, AddressDetails } from '@djb25/digit-ui-react-components';
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, 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, AddressDetails } 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
13
  head: "ES_TITILE_OWNER_DETAILS",
@@ -568,6 +572,80 @@ const treePruningPayload = data => {
568
572
  };
569
573
  return formdata;
570
574
  };
575
+ const fillingPointPayload = data => {
576
+ var _Digit$UserService$ge, _Digit$UserService$ge2, _data$owner11, _data$owner12, _data$owner13, _data$owner14, _data$owner15, _data$owner16, _data$owner17, _data$owner18, _data$owner19, _data$owner20, _data$owner21, _data$address36, _data$address37, _data$address38, _data$address39, _data$address40, _data$address41, _data$address41$city, _data$address42, _data$address43, _data$address44, _data$address44$city, _data$address45, _data$address46, _data$address46$local, _data$address47, _data$address48, _data$address48$local, _data$address49, _data$address50, _data$address51;
577
+ return {
578
+ RequestInfo: {
579
+ userInfo: {
580
+ uuid: ((_Digit$UserService$ge = Digit.UserService.getUser()) === null || _Digit$UserService$ge === void 0 ? void 0 : (_Digit$UserService$ge2 = _Digit$UserService$ge.info) === null || _Digit$UserService$ge2 === void 0 ? void 0 : _Digit$UserService$ge2.uuid) || "user-123"
581
+ }
582
+ },
583
+ fillingPoints: [{
584
+ id: data === null || data === void 0 ? void 0 : data.id,
585
+ bookingId: data === null || data === void 0 ? void 0 : data.bookingId,
586
+ tenantId: data === null || data === void 0 ? void 0 : data.tenantId,
587
+ fillingPointName: data === null || data === void 0 ? void 0 : (_data$owner11 = data.owner) === null || _data$owner11 === void 0 ? void 0 : _data$owner11.fillingPointName,
588
+ emergencyName: data === null || data === void 0 ? void 0 : (_data$owner12 = data.owner) === null || _data$owner12 === void 0 ? void 0 : _data$owner12.emergencyName,
589
+ eeName: data === null || data === void 0 ? void 0 : (_data$owner13 = data.owner) === null || _data$owner13 === void 0 ? void 0 : _data$owner13.eeName,
590
+ eeEmail: data === null || data === void 0 ? void 0 : (_data$owner14 = data.owner) === null || _data$owner14 === void 0 ? void 0 : _data$owner14.eeEmail,
591
+ eeMobile: data === null || data === void 0 ? void 0 : (_data$owner15 = data.owner) === null || _data$owner15 === void 0 ? void 0 : _data$owner15.eeMobile,
592
+ aeName: data === null || data === void 0 ? void 0 : (_data$owner16 = data.owner) === null || _data$owner16 === void 0 ? void 0 : _data$owner16.aeName,
593
+ aeEmail: data === null || data === void 0 ? void 0 : (_data$owner17 = data.owner) === null || _data$owner17 === void 0 ? void 0 : _data$owner17.aeEmail,
594
+ aeMobile: data === null || data === void 0 ? void 0 : (_data$owner18 = data.owner) === null || _data$owner18 === void 0 ? void 0 : _data$owner18.aeMobile,
595
+ jeName: data === null || data === void 0 ? void 0 : (_data$owner19 = data.owner) === null || _data$owner19 === void 0 ? void 0 : _data$owner19.jeName,
596
+ jeEmail: data === null || data === void 0 ? void 0 : (_data$owner20 = data.owner) === null || _data$owner20 === void 0 ? void 0 : _data$owner20.jeEmail,
597
+ jeMobile: data === null || data === void 0 ? void 0 : (_data$owner21 = data.owner) === null || _data$owner21 === void 0 ? void 0 : _data$owner21.jeMobile,
598
+ address: {
599
+ houseNo: data === null || data === void 0 ? void 0 : (_data$address36 = data.address) === null || _data$address36 === void 0 ? void 0 : _data$address36.houseNo,
600
+ streetName: data === null || data === void 0 ? void 0 : (_data$address37 = data.address) === null || _data$address37 === void 0 ? void 0 : _data$address37.streetName,
601
+ addressLine1: data === null || data === void 0 ? void 0 : (_data$address38 = data.address) === null || _data$address38 === void 0 ? void 0 : _data$address38.addressLine1,
602
+ addressLine2: data === null || data === void 0 ? void 0 : (_data$address39 = data.address) === null || _data$address39 === void 0 ? void 0 : _data$address39.addressLine2,
603
+ landmark: data === null || data === void 0 ? void 0 : (_data$address40 = data.address) === null || _data$address40 === void 0 ? void 0 : _data$address40.landmark,
604
+ city: (data === null || data === void 0 ? void 0 : (_data$address41 = data.address) === null || _data$address41 === void 0 ? void 0 : (_data$address41$city = _data$address41.city) === null || _data$address41$city === void 0 ? void 0 : _data$address41$city.name) || (data === null || data === void 0 ? void 0 : (_data$address42 = data.address) === null || _data$address42 === void 0 ? void 0 : _data$address42.city) || "",
605
+ cityCode: (data === null || data === void 0 ? void 0 : (_data$address43 = data.address) === null || _data$address43 === void 0 ? void 0 : _data$address43.cityCode) || (data === null || data === void 0 ? void 0 : (_data$address44 = data.address) === null || _data$address44 === void 0 ? void 0 : (_data$address44$city = _data$address44.city) === null || _data$address44$city === void 0 ? void 0 : _data$address44$city.code) || "",
606
+ locality: (data === null || data === void 0 ? void 0 : (_data$address45 = data.address) === null || _data$address45 === void 0 ? void 0 : _data$address45.localityCode) || (data === null || data === void 0 ? void 0 : (_data$address46 = data.address) === null || _data$address46 === void 0 ? void 0 : (_data$address46$local = _data$address46.locality) === null || _data$address46$local === void 0 ? void 0 : _data$address46$local.code) || "",
607
+ localityCode: (data === null || data === void 0 ? void 0 : (_data$address47 = data.address) === null || _data$address47 === void 0 ? void 0 : _data$address47.localityCode) || (data === null || data === void 0 ? void 0 : (_data$address48 = data.address) === null || _data$address48 === void 0 ? void 0 : (_data$address48$local = _data$address48.locality) === null || _data$address48$local === void 0 ? void 0 : _data$address48$local.code) || "",
608
+ pincode: data === null || data === void 0 ? void 0 : (_data$address49 = data.address) === null || _data$address49 === void 0 ? void 0 : _data$address49.pincode,
609
+ latitude: data === null || data === void 0 ? void 0 : (_data$address50 = data.address) === null || _data$address50 === void 0 ? void 0 : _data$address50.latitude,
610
+ longitude: data === null || data === void 0 ? void 0 : (_data$address51 = data.address) === null || _data$address51 === void 0 ? void 0 : _data$address51.longitude,
611
+ type: "FILLING-POINT"
612
+ }
613
+ }]
614
+ };
615
+ };
616
+ const fixedPointPayload = data => {
617
+ var _data$owner22, _data$owner23, _data$owner24, _data$owner25, _data$owner26, _data$address52, _data$address52$addre, _data$address53, _data$address54, _data$address54$city, _data$address55, _data$address56, _data$address56$city, _data$address57, _data$address58, _data$address58$local, _data$address59, _data$address59$local, _data$address60, _data$address61, _data$address61$local, _data$address62, _data$address63, _data$address64, _data$address65, _data$address66, _data$address67, _data$address68, _data$address69, _data$address70;
618
+ return {
619
+ waterTankerBookingDetail: {
620
+ tenantId: data === null || data === void 0 ? void 0 : data.tenantId,
621
+ bookingId: (data === null || data === void 0 ? void 0 : data.bookingId) || "",
622
+ auditDetails: (data === null || data === void 0 ? void 0 : data.auditDetails) || null,
623
+ applicantDetail: {
624
+ name: (data === null || data === void 0 ? void 0 : (_data$owner22 = data.owner) === null || _data$owner22 === void 0 ? void 0 : _data$owner22.name) || (data === null || data === void 0 ? void 0 : (_data$owner23 = data.owner) === null || _data$owner23 === void 0 ? void 0 : _data$owner23.applicantName) || "",
625
+ mobileNumber: (data === null || data === void 0 ? void 0 : (_data$owner24 = data.owner) === null || _data$owner24 === void 0 ? void 0 : _data$owner24.mobileNumber) || "",
626
+ alternateNumber: (data === null || data === void 0 ? void 0 : (_data$owner25 = data.owner) === null || _data$owner25 === void 0 ? void 0 : _data$owner25.alternateNumber) || "",
627
+ emailId: (data === null || data === void 0 ? void 0 : (_data$owner26 = data.owner) === null || _data$owner26 === void 0 ? void 0 : _data$owner26.emailId) || "",
628
+ type: "FIXED-POINT"
629
+ },
630
+ address: {
631
+ type: "FIXED-POINT",
632
+ addressType: (data === null || data === void 0 ? void 0 : (_data$address52 = data.address) === null || _data$address52 === void 0 ? void 0 : (_data$address52$addre = _data$address52.addressType) === null || _data$address52$addre === void 0 ? void 0 : _data$address52$addre.code) || (data === null || data === void 0 ? void 0 : (_data$address53 = data.address) === null || _data$address53 === void 0 ? void 0 : _data$address53.addressType) || "",
633
+ city: (data === null || data === void 0 ? void 0 : (_data$address54 = data.address) === null || _data$address54 === void 0 ? void 0 : (_data$address54$city = _data$address54.city) === null || _data$address54$city === void 0 ? void 0 : _data$address54$city.name) || (data === null || data === void 0 ? void 0 : (_data$address55 = data.address) === null || _data$address55 === void 0 ? void 0 : _data$address55.city) || "",
634
+ cityCode: (data === null || data === void 0 ? void 0 : (_data$address56 = data.address) === null || _data$address56 === void 0 ? void 0 : (_data$address56$city = _data$address56.city) === null || _data$address56$city === void 0 ? void 0 : _data$address56$city.code) || (data === null || data === void 0 ? void 0 : (_data$address57 = data.address) === null || _data$address57 === void 0 ? void 0 : _data$address57.cityCode) || "",
635
+ locality: (data === null || data === void 0 ? void 0 : (_data$address58 = data.address) === null || _data$address58 === void 0 ? void 0 : (_data$address58$local = _data$address58.locality) === null || _data$address58$local === void 0 ? void 0 : _data$address58$local.label) || (data === null || data === void 0 ? void 0 : (_data$address59 = data.address) === null || _data$address59 === void 0 ? void 0 : (_data$address59$local = _data$address59.locality) === null || _data$address59$local === void 0 ? void 0 : _data$address59$local.name) || (data === null || data === void 0 ? void 0 : (_data$address60 = data.address) === null || _data$address60 === void 0 ? void 0 : _data$address60.locality) || "",
636
+ localityCode: (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.code) || (data === null || data === void 0 ? void 0 : (_data$address62 = data.address) === null || _data$address62 === void 0 ? void 0 : _data$address62.localityCode) || "",
637
+ houseNo: (data === null || data === void 0 ? void 0 : (_data$address63 = data.address) === null || _data$address63 === void 0 ? void 0 : _data$address63.houseNo) || "",
638
+ streetName: (data === null || data === void 0 ? void 0 : (_data$address64 = data.address) === null || _data$address64 === void 0 ? void 0 : _data$address64.streetName) || "",
639
+ addressLine1: (data === null || data === void 0 ? void 0 : (_data$address65 = data.address) === null || _data$address65 === void 0 ? void 0 : _data$address65.addressLine1) || "",
640
+ addressLine2: (data === null || data === void 0 ? void 0 : (_data$address66 = data.address) === null || _data$address66 === void 0 ? void 0 : _data$address66.addressLine2) || "",
641
+ landmark: (data === null || data === void 0 ? void 0 : (_data$address67 = data.address) === null || _data$address67 === void 0 ? void 0 : _data$address67.landmark) || "",
642
+ pincode: (data === null || data === void 0 ? void 0 : (_data$address68 = data.address) === null || _data$address68 === void 0 ? void 0 : _data$address68.pincode) || "",
643
+ latitude: (data === null || data === void 0 ? void 0 : (_data$address69 = data.address) === null || _data$address69 === void 0 ? void 0 : _data$address69.latitude) || "",
644
+ longitude: (data === null || data === void 0 ? void 0 : (_data$address70 = data.address) === null || _data$address70 === void 0 ? void 0 : _data$address70.longitude) || ""
645
+ }
646
+ }
647
+ };
648
+ };
571
649
 
572
650
  const CollapsibleCardPage = ({
573
651
  number,
@@ -774,7 +852,7 @@ const WTSearchApplication = ({
774
852
  className: "wt-search-grid",
775
853
  style: {
776
854
  display: "grid",
777
- gridTemplateColumns: "1fr 1fr",
855
+ gridTemplateColumns: isMobile ? "1fr" : "1fr 1fr",
778
856
  gap: "24px"
779
857
  }
780
858
  }, /*#__PURE__*/React.createElement("div", {
@@ -866,7 +944,8 @@ const WTSearchApplication = ({
866
944
  className: "wt-search-actions",
867
945
  style: {
868
946
  display: "flex",
869
- justifyContent: "flex-end",
947
+ justifyContent: isMobile ? "center" : "flex-end",
948
+ flexDirection: isMobile ? "column-reverse" : "row",
870
949
  gap: "24px",
871
950
  marginTop: "16px"
872
951
  }
@@ -881,7 +960,7 @@ const WTSearchApplication = ({
881
960
  }
882
961
  }, t("ES_COMMON_CLEAR_ALL")), /*#__PURE__*/React.createElement("div", {
883
962
  style: {
884
- minWidth: "160px"
963
+ minWidth: isMobile ? "100%" : "160px"
885
964
  }
886
965
  }, /*#__PURE__*/React.createElement(SubmitBar, {
887
966
  label: t("ES_COMMON_SEARCH"),
@@ -2199,6 +2278,15 @@ const WTCard = () => {
2199
2278
  }, {
2200
2279
  label: t("WT_APPLICATION_CREATE"),
2201
2280
  link: `${APPLICATION_PATH}/employee/wt/request-service`
2281
+ }, {
2282
+ label: t("WT_FIXED_POINT_SCHEDULE_MANAGEMENT"),
2283
+ link: `${APPLICATION_PATH}/employee/wt/fixed-point-schedule`
2284
+ }, {
2285
+ label: t("WT_LIVE_TRACKING_SYSTEM"),
2286
+ link: `${APPLICATION_PATH}/employee/wt/live-tracking`
2287
+ }, {
2288
+ label: t("WT_SEARCH_FIX_POINT"),
2289
+ link: `${APPLICATION_PATH}/employee/wt/search-filling-fix-point`
2202
2290
  }];
2203
2291
  const WT_CEMP = Digit.UserService.hasAccess(["WT_CEMP"]) || false;
2204
2292
  const propsForModuleCard = {
@@ -3033,103 +3121,3192 @@ const Inbox = ({
3033
3121
  }
3034
3122
  };
3035
3123
 
3036
- const EmployeeApp = ({
3037
- path
3124
+ const AddTripModal = ({
3125
+ t,
3126
+ closeModal,
3127
+ onSubmit,
3128
+ initialValues
3038
3129
  }) => {
3039
- var _Digit, _Digit$ComponentRegis, _Digit2, _Digit2$ComponentRegi;
3130
+ const {
3131
+ register,
3132
+ handleSubmit,
3133
+ control,
3134
+ formState: {
3135
+ errors
3136
+ }
3137
+ } = useForm({
3138
+ defaultValues: initialValues || {}
3139
+ });
3140
+ const dayOptions = [{
3141
+ label: t("MON"),
3142
+ value: "Mon"
3143
+ }, {
3144
+ label: t("TUE"),
3145
+ value: "Tue"
3146
+ }, {
3147
+ label: t("WED"),
3148
+ value: "Wed"
3149
+ }, {
3150
+ label: t("THU"),
3151
+ value: "Thu"
3152
+ }, {
3153
+ label: t("FRI"),
3154
+ value: "Fri"
3155
+ }, {
3156
+ label: t("SAT"),
3157
+ value: "Sat"
3158
+ }, {
3159
+ label: t("SUN"),
3160
+ value: "Sun"
3161
+ }];
3162
+ const activeOptions = [{
3163
+ label: t("YES"),
3164
+ value: "Yes"
3165
+ }, {
3166
+ label: t("NO"),
3167
+ value: "No"
3168
+ }];
3169
+ const onFormSubmit = data => {
3170
+ onSubmit(data);
3171
+ };
3172
+ return /*#__PURE__*/React.createElement("div", {
3173
+ className: "custom-modal-overlay",
3174
+ style: {
3175
+ position: "fixed",
3176
+ top: 0,
3177
+ left: 0,
3178
+ width: "100%",
3179
+ height: "100%",
3180
+ backgroundColor: "rgba(0, 0, 0, 0.5)",
3181
+ display: "flex",
3182
+ justifyContent: "center",
3183
+ alignItems: "center",
3184
+ zIndex: 9999
3185
+ }
3186
+ }, /*#__PURE__*/React.createElement("div", {
3187
+ className: "custom-modal-content",
3188
+ style: {
3189
+ backgroundColor: "#fff",
3190
+ borderRadius: "8px",
3191
+ width: "70%",
3192
+ maxWidth: "800px",
3193
+ maxHeight: "90vh",
3194
+ display: "flex",
3195
+ flexDirection: "column",
3196
+ boxShadow: "0 4px 12px rgba(0,0,0,0.15)",
3197
+ position: "relative"
3198
+ }
3199
+ }, /*#__PURE__*/React.createElement("div", {
3200
+ className: "custom-modal-header",
3201
+ style: {
3202
+ padding: "16px 24px",
3203
+ borderBottom: "1px solid #eee",
3204
+ display: "flex",
3205
+ justifyContent: "space-between",
3206
+ alignItems: "center"
3207
+ }
3208
+ }, /*#__PURE__*/React.createElement("h1", {
3209
+ style: {
3210
+ margin: 0,
3211
+ fontSize: "20px",
3212
+ fontWeight: "600",
3213
+ color: "#1D4E7F"
3214
+ }
3215
+ }, initialValues ? t("WT_EDIT_TRIP") : t("WT_ADD_TRIP")), /*#__PURE__*/React.createElement("button", {
3216
+ onClick: closeModal,
3217
+ style: {
3218
+ background: "none",
3219
+ border: "none",
3220
+ fontSize: "24px",
3221
+ cursor: "pointer",
3222
+ color: "#666"
3223
+ }
3224
+ }, "\xD7")), /*#__PURE__*/React.createElement("div", {
3225
+ className: "custom-modal-body",
3226
+ style: {
3227
+ padding: "24px",
3228
+ overflowY: "auto"
3229
+ }
3230
+ }, /*#__PURE__*/React.createElement("div", {
3231
+ className: "add-trip-form",
3232
+ style: {
3233
+ display: "grid",
3234
+ gridTemplateColumns: "repeat(3, 1fr)",
3235
+ gap: "20px"
3236
+ }
3237
+ }, /*#__PURE__*/React.createElement("div", {
3238
+ className: "field-group"
3239
+ }, /*#__PURE__*/React.createElement(CardLabel, {
3240
+ style: {
3241
+ marginBottom: "8px",
3242
+ fontWeight: "500"
3243
+ }
3244
+ }, t("WT_SCHEDULE_ID")), /*#__PURE__*/React.createElement(TextInput, {
3245
+ name: "scheduleId",
3246
+ inputRef: register()
3247
+ })), /*#__PURE__*/React.createElement("div", {
3248
+ className: "field-group"
3249
+ }, /*#__PURE__*/React.createElement(CardLabel, {
3250
+ style: {
3251
+ marginBottom: "8px",
3252
+ fontWeight: "500"
3253
+ }
3254
+ }, t("WT_FIXED_POINT_CODE")), /*#__PURE__*/React.createElement(TextInput, {
3255
+ name: "fixedPointCode",
3256
+ inputRef: register()
3257
+ })), /*#__PURE__*/React.createElement("div", {
3258
+ className: "field-group"
3259
+ }, /*#__PURE__*/React.createElement(CardLabel, {
3260
+ style: {
3261
+ marginBottom: "8px",
3262
+ fontWeight: "500"
3263
+ }
3264
+ }, t("WT_DAY")), /*#__PURE__*/React.createElement(Controller, {
3265
+ control: control,
3266
+ name: "day",
3267
+ render: props => /*#__PURE__*/React.createElement(Dropdown, {
3268
+ option: dayOptions,
3269
+ optionKey: "label",
3270
+ selected: props.value,
3271
+ select: props.onChange,
3272
+ t: t
3273
+ })
3274
+ })), /*#__PURE__*/React.createElement("div", {
3275
+ className: "field-group"
3276
+ }, /*#__PURE__*/React.createElement(CardLabel, {
3277
+ style: {
3278
+ marginBottom: "8px",
3279
+ fontWeight: "500"
3280
+ }
3281
+ }, t("WT_FREQUENCY_NO")), /*#__PURE__*/React.createElement(TextInput, {
3282
+ name: "frequencyNo",
3283
+ inputRef: register()
3284
+ })), /*#__PURE__*/React.createElement("div", {
3285
+ className: "field-group"
3286
+ }, /*#__PURE__*/React.createElement(CardLabel, {
3287
+ style: {
3288
+ marginBottom: "8px",
3289
+ fontWeight: "500"
3290
+ }
3291
+ }, t("WT_VEHICLE_ID")), /*#__PURE__*/React.createElement(TextInput, {
3292
+ name: "vehicleId",
3293
+ inputRef: register()
3294
+ })), /*#__PURE__*/React.createElement("div", {
3295
+ className: "field-group"
3296
+ }, /*#__PURE__*/React.createElement(CardLabel, {
3297
+ style: {
3298
+ marginBottom: "8px",
3299
+ fontWeight: "500"
3300
+ }
3301
+ }, t("WT_ARRIVAL_TIME_TO_FPL")), /*#__PURE__*/React.createElement(TextInput, {
3302
+ name: "arrivalTimeFpl",
3303
+ inputRef: register(),
3304
+ type: "time"
3305
+ })), /*#__PURE__*/React.createElement("div", {
3306
+ className: "field-group"
3307
+ }, /*#__PURE__*/React.createElement(CardLabel, {
3308
+ style: {
3309
+ marginBottom: "8px",
3310
+ fontWeight: "500"
3311
+ }
3312
+ }, t("WT_DEPARTURE_TIME_FROM_FPL")), /*#__PURE__*/React.createElement(TextInput, {
3313
+ name: "departureTimeFpl",
3314
+ inputRef: register(),
3315
+ type: "time"
3316
+ })), /*#__PURE__*/React.createElement("div", {
3317
+ className: "field-group"
3318
+ }, /*#__PURE__*/React.createElement(CardLabel, {
3319
+ style: {
3320
+ marginBottom: "8px",
3321
+ fontWeight: "500"
3322
+ }
3323
+ }, t("WT_ARRIVAL_AT_FIXED_POINT")), /*#__PURE__*/React.createElement(TextInput, {
3324
+ name: "arrivalFixedPoint",
3325
+ inputRef: register(),
3326
+ type: "time"
3327
+ })), /*#__PURE__*/React.createElement("div", {
3328
+ className: "field-group"
3329
+ }, /*#__PURE__*/React.createElement(CardLabel, {
3330
+ style: {
3331
+ marginBottom: "8px",
3332
+ fontWeight: "500"
3333
+ }
3334
+ }, t("WT_DEPARTURE_AT_FIXED_POINT")), /*#__PURE__*/React.createElement(TextInput, {
3335
+ name: "departureFixedPoint",
3336
+ inputRef: register(),
3337
+ type: "time"
3338
+ })), /*#__PURE__*/React.createElement("div", {
3339
+ className: "field-group"
3340
+ }, /*#__PURE__*/React.createElement(CardLabel, {
3341
+ style: {
3342
+ marginBottom: "8px",
3343
+ fontWeight: "500"
3344
+ }
3345
+ }, t("WT_RETURN_TO_FPL")), /*#__PURE__*/React.createElement(TextInput, {
3346
+ name: "returnFpl",
3347
+ inputRef: register(),
3348
+ type: "time"
3349
+ })), /*#__PURE__*/React.createElement("div", {
3350
+ className: "field-group"
3351
+ }, /*#__PURE__*/React.createElement(CardLabel, {
3352
+ style: {
3353
+ marginBottom: "8px",
3354
+ fontWeight: "500"
3355
+ }
3356
+ }, t("WT_VOLUME")), /*#__PURE__*/React.createElement(TextInput, {
3357
+ name: "volume",
3358
+ inputRef: register()
3359
+ })), /*#__PURE__*/React.createElement("div", {
3360
+ className: "field-group"
3361
+ }, /*#__PURE__*/React.createElement(CardLabel, {
3362
+ style: {
3363
+ marginBottom: "8px",
3364
+ fontWeight: "500"
3365
+ }
3366
+ }, t("WT_ACTIVE")), /*#__PURE__*/React.createElement(Controller, {
3367
+ control: control,
3368
+ name: "active",
3369
+ render: props => /*#__PURE__*/React.createElement(Dropdown, {
3370
+ option: activeOptions,
3371
+ optionKey: "label",
3372
+ selected: props.value,
3373
+ select: props.onChange,
3374
+ t: t
3375
+ })
3376
+ })), /*#__PURE__*/React.createElement("div", {
3377
+ className: "field-group",
3378
+ style: {
3379
+ gridColumn: "span 2"
3380
+ }
3381
+ }, /*#__PURE__*/React.createElement(CardLabel, {
3382
+ style: {
3383
+ marginBottom: "8px",
3384
+ fontWeight: "500"
3385
+ }
3386
+ }, t("WT_REMARKS")), /*#__PURE__*/React.createElement(TextInput, {
3387
+ name: "remarks",
3388
+ inputRef: register()
3389
+ })))), /*#__PURE__*/React.createElement("div", {
3390
+ className: "custom-modal-footer",
3391
+ style: {
3392
+ padding: "16px 24px",
3393
+ borderTop: "1px solid #eee",
3394
+ display: "flex",
3395
+ justifyContent: "flex-end",
3396
+ gap: "12px"
3397
+ }
3398
+ }, /*#__PURE__*/React.createElement("button", {
3399
+ className: "button-cancel",
3400
+ onClick: closeModal,
3401
+ style: {
3402
+ padding: "8px 20px",
3403
+ border: "1px solid #ccc",
3404
+ background: "#f4f4f4",
3405
+ borderRadius: "4px",
3406
+ cursor: "pointer"
3407
+ }
3408
+ }, t("CS_COMMON_CANCEL")), /*#__PURE__*/React.createElement("button", {
3409
+ className: "button-save",
3410
+ onClick: handleSubmit(onFormSubmit),
3411
+ style: {
3412
+ padding: "8px 20px",
3413
+ background: "#1D4E7F",
3414
+ color: "#fff",
3415
+ border: "none",
3416
+ borderRadius: "4px",
3417
+ cursor: "pointer"
3418
+ }
3419
+ }, initialValues ? t("WT_UPDATE") : t("CS_COMMON_SAVE")))));
3420
+ };
3421
+
3422
+ const FixedPointScheduleManagement = () => {
3040
3423
  const {
3041
3424
  t
3042
3425
  } = useTranslation();
3043
- const location = useLocation();
3044
- sessionStorage.removeItem("revalidateddone");
3045
- const getDynamicBreadcrumbs = () => {
3046
- const pathname = location.pathname;
3047
- let moduleName = "WT";
3048
- if (pathname.includes("/mt/")) moduleName = "MT";
3049
- if (pathname.includes("/tp/")) moduleName = "TP";
3050
- let crumbs = [{
3051
- icon: HomeIcon,
3052
- path: "/digit-ui/employee"
3053
- }, {
3054
- label: t("WT_MODULE_NAME"),
3055
- path: `/digit-ui/employee/module/details?moduleName=${moduleName}`
3056
- }];
3057
- if (pathname.includes("/inbox")) {
3058
- let label = "ES_COMMON_INBOX";
3059
- if (pathname.includes("/tp/inbox")) label = "TP_INBOX";
3060
- crumbs.push({
3061
- label: t(label)
3062
- });
3063
- } else if (pathname.includes("/my-bookings")) {
3064
- let label = "WT_SEARCH_BOOKINGS";
3065
- if (pathname.includes("/mt/my-bookings")) label = "MT_SEARCH_BOOKINGS";
3066
- if (pathname.includes("/tp/my-bookings")) label = "TP_SEARCH_BOOKINGS";
3067
- crumbs.push({
3068
- label: t(label)
3069
- });
3070
- } else if (pathname.includes("/request-service")) {
3071
- crumbs.push({
3072
- label: t("WT_REQUEST_SERVICE")
3073
- });
3074
- } else if (pathname.includes("/booking-details") || pathname.includes("/bookingsearch/booking-details")) {
3075
- const isSearch = pathname.includes("/bookingsearch");
3076
- if (isSearch) {
3077
- crumbs.push({
3078
- label: t("WT_SEARCH_BOOKINGS"),
3079
- path: `${path}/my-bookings`
3080
- });
3081
- } else {
3082
- crumbs.push({
3083
- label: t("ES_COMMON_INBOX"),
3084
- path: `${path}/inbox`
3426
+ const [showModal, setShowModal] = useState(false);
3427
+ const [selectedDay, setSelectedDay] = useState("Mon");
3428
+ const [year, setYear] = useState({
3429
+ label: "Year 2026",
3430
+ value: "2026"
3431
+ });
3432
+ const [fixedPoint, setFixedPoint] = useState({
3433
+ label: "FP01",
3434
+ value: "FP01"
3435
+ });
3436
+ const [day, setDay] = useState({
3437
+ label: "Mon",
3438
+ value: "Mon"
3439
+ });
3440
+ const [status, setStatus] = useState({
3441
+ label: "All Status",
3442
+ value: "all"
3443
+ });
3444
+ const [vehicle, setVehicle] = useState({
3445
+ label: "DL1LAG7729",
3446
+ value: "DL1LAG7729"
3447
+ });
3448
+ const [editingRowIndex, setEditingRowIndex] = useState(null);
3449
+ const handleDelete = index => {
3450
+ const updatedData = data.filter((_, i) => i !== index);
3451
+ setData(updatedData);
3452
+ };
3453
+ const handleDownload = type => {
3454
+ const filename = `FixedPointSchedule_${type.value}_${new Date().toLocaleDateString()}`;
3455
+ if (window.Digit && window.Digit.Download && window.Digit.Download.Excel) {
3456
+ window.Digit.Download.Excel(data, filename);
3457
+ } else {
3458
+ const csvRows = [];
3459
+ const headers = Object.keys(data[0]);
3460
+ csvRows.push(headers.join(","));
3461
+ for (const row of data) {
3462
+ const values = headers.map(header => {
3463
+ const escaped = ("" + row[header]).replace(/"/g, '\\"');
3464
+ return `"${escaped}"`;
3085
3465
  });
3466
+ csvRows.push(values.join(","));
3086
3467
  }
3087
- crumbs.push({
3088
- label: t("WT_BOOKING_DETAILS")
3468
+ const blob = new Blob([csvRows.join("\n")], {
3469
+ type: "text/csv"
3089
3470
  });
3471
+ const url = window.URL.createObjectURL(blob);
3472
+ const a = document.createElement("a");
3473
+ a.setAttribute("hidden", "");
3474
+ a.setAttribute("href", url);
3475
+ a.setAttribute("download", `${filename}.csv`);
3476
+ document.body.appendChild(a);
3477
+ a.click();
3478
+ document.body.removeChild(a);
3090
3479
  }
3091
- return crumbs;
3092
3480
  };
3093
- const inboxInitialState = {
3094
- searchParams: {
3095
- uuid: {
3096
- code: "ASSIGNED_TO_ALL",
3097
- name: "ES_INBOX_ASSIGNED_TO_ALL"
3098
- },
3099
- services: ["watertanker"],
3100
- applicationStatus: [],
3101
- locality: []
3481
+ const [data, setData] = useState([{
3482
+ scheduleId: "SASID-0001",
3483
+ fixedPoint: "FP01",
3484
+ day: "Mon",
3485
+ freq: "1",
3486
+ arrToFpl: "06:00",
3487
+ depFromFpl: "06:10",
3488
+ arrAtFixedPoint: "06:40",
3489
+ depAtFixedPoint: "06:55",
3490
+ returnToFpl: "07:20",
3491
+ volume: "3 KL",
3492
+ vehicle: "DL1LAG7729",
3493
+ active: "Y"
3494
+ }, {
3495
+ scheduleId: "SASID-0002",
3496
+ fixedPoint: "FP01",
3497
+ day: "Mon",
3498
+ freq: "2",
3499
+ arrToFpl: "07:20",
3500
+ depFromFpl: "07:30",
3501
+ arrAtFixedPoint: "08:00",
3502
+ depAtFixedPoint: "08:15",
3503
+ returnToFpl: "08:40",
3504
+ volume: "3 KL",
3505
+ vehicle: "DL1LAG7729",
3506
+ active: "Y"
3507
+ }, {
3508
+ scheduleId: "SASID-0003",
3509
+ fixedPoint: "FP02",
3510
+ day: "Tue",
3511
+ freq: "3",
3512
+ arrToFpl: "08:40",
3513
+ depFromFpl: "08:50",
3514
+ arrAtFixedPoint: "09:20",
3515
+ depAtFixedPoint: "09:35",
3516
+ returnToFpl: "10:00",
3517
+ volume: "3 KL",
3518
+ vehicle: "DL1LAG7730",
3519
+ active: "Y"
3520
+ }, {
3521
+ scheduleId: "SASID-0004",
3522
+ fixedPoint: "FP03",
3523
+ day: "Wed",
3524
+ freq: "1",
3525
+ arrToFpl: "09:00",
3526
+ depFromFpl: "09:10",
3527
+ arrAtFixedPoint: "09:40",
3528
+ depAtFixedPoint: "09:55",
3529
+ returnToFpl: "10:20",
3530
+ volume: "5 KL",
3531
+ vehicle: "DL1LAG7731",
3532
+ active: "N"
3533
+ }]);
3534
+ const [masterData] = useState(data);
3535
+ const handleSearch = () => {
3536
+ let filteredData = [...masterData];
3537
+ if (fixedPoint !== null && fixedPoint !== void 0 && fixedPoint.value && fixedPoint.value !== "all") {
3538
+ filteredData = filteredData.filter(item => item.fixedPoint === fixedPoint.value);
3102
3539
  }
3103
- };
3104
- const inboxInitialStateMt = {
3105
- searchParams: {
3106
- uuid: {
3107
- code: "ASSIGNED_TO_ALL",
3108
- name: "ES_INBOX_ASSIGNED_TO_ALL"
3109
- },
3110
- services: ["mobileToilet"],
3111
- applicationStatus: [],
3112
- locality: []
3540
+ if (day !== null && day !== void 0 && day.value && day.value !== "all") {
3541
+ filteredData = filteredData.filter(item => item.day === day.value);
3113
3542
  }
3114
- };
3115
- const inboxInitialStateTp = {
3116
- searchParams: {
3117
- uuid: {
3118
- code: "ASSIGNED_TO_ALL",
3119
- name: "ES_INBOX_ASSIGNED_TO_ALL"
3120
- },
3121
- services: ["treePruning"],
3122
- applicationStatus: [],
3123
- locality: []
3543
+ if (status !== null && status !== void 0 && status.value && status.value !== "all") {
3544
+ const activeStatus = status.value === "Active" ? "Y" : "N";
3545
+ filteredData = filteredData.filter(item => item.active === activeStatus);
3124
3546
  }
3547
+ if (vehicle !== null && vehicle !== void 0 && vehicle.value && vehicle.value !== "all") {
3548
+ filteredData = filteredData.filter(item => item.vehicle === vehicle.value);
3549
+ }
3550
+ setData(filteredData);
3125
3551
  };
3126
- const ApplicationDetails = (_Digit = Digit) === null || _Digit === void 0 ? void 0 : (_Digit$ComponentRegis = _Digit.ComponentRegistryService) === null || _Digit$ComponentRegis === void 0 ? void 0 : _Digit$ComponentRegis.getComponent("ApplicationDetails");
3127
- const WTCreate = (_Digit2 = Digit) === null || _Digit2 === void 0 ? void 0 : (_Digit2$ComponentRegi = _Digit2.ComponentRegistryService) === null || _Digit2$ComponentRegi === void 0 ? void 0 : _Digit2$ComponentRegi.getComponent("WTCreate");
3128
- return /*#__PURE__*/React.createElement(Switch, null, /*#__PURE__*/React.createElement(AppContainer, null, /*#__PURE__*/React.createElement("div", {
3129
- className: "ground-container employee-app-container form-container"
3130
- }, /*#__PURE__*/React.createElement(ModuleHeader, {
3131
- leftContent: /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ArrowLeft, {
3132
- className: "icon"
3552
+ const columns = React.useMemo(() => [{
3553
+ Header: t("WT_SCHEDULE_ID"),
3554
+ accessor: "scheduleId"
3555
+ }, {
3556
+ Header: t("WT_FIXED_POINT"),
3557
+ accessor: "fixedPoint"
3558
+ }, {
3559
+ Header: t("WT_DAY"),
3560
+ accessor: "day"
3561
+ }, {
3562
+ Header: t("WT_FREQ"),
3563
+ accessor: "freq"
3564
+ }, {
3565
+ Header: t("WT_ARR_TO_FPL"),
3566
+ accessor: "arrToFpl"
3567
+ }, {
3568
+ Header: t("WT_DEP_FROM_FPL"),
3569
+ accessor: "depFromFpl"
3570
+ }, {
3571
+ Header: t("WT_ARR_AT_FIXED_POINT"),
3572
+ accessor: "arrAtFixedPoint"
3573
+ }, {
3574
+ Header: t("WT_DEP_AT_FIXED_POINT"),
3575
+ accessor: "depAtFixedPoint"
3576
+ }, {
3577
+ Header: t("WT_RETURN_TO_FPL"),
3578
+ accessor: "returnToFpl"
3579
+ }, {
3580
+ Header: t("WT_VOLUME"),
3581
+ accessor: "volume"
3582
+ }, {
3583
+ Header: t("WT_VEHICLE"),
3584
+ accessor: "vehicle"
3585
+ }, {
3586
+ Header: t("WT_ACTIVE"),
3587
+ accessor: "active",
3588
+ Cell: ({
3589
+ value
3590
+ }) => /*#__PURE__*/React.createElement("span", {
3591
+ style: {
3592
+ background: value === "Y" ? "#E6F4EA" : "#FCE8E6",
3593
+ padding: "2px 8px",
3594
+ borderRadius: "10px",
3595
+ color: value === "Y" ? "#1E8E3E" : "#D93025"
3596
+ }
3597
+ }, value)
3598
+ }, {
3599
+ Header: t("WT_ACTION"),
3600
+ Cell: ({
3601
+ row
3602
+ }) => /*#__PURE__*/React.createElement("div", {
3603
+ style: {
3604
+ display: "flex",
3605
+ gap: "5px"
3606
+ }
3607
+ }, /*#__PURE__*/React.createElement("button", {
3608
+ onClick: () => {
3609
+ setEditingRowIndex(row.index);
3610
+ setShowModal(true);
3611
+ },
3612
+ style: {
3613
+ color: "#1D4E7F",
3614
+ border: "1px solid #1D4E7F",
3615
+ background: "none",
3616
+ padding: "2px 8px",
3617
+ cursor: "pointer"
3618
+ }
3619
+ }, t("WT_EDIT")), /*#__PURE__*/React.createElement("button", {
3620
+ onClick: () => handleDelete(row.index),
3621
+ style: {
3622
+ color: "#fff",
3623
+ border: "none",
3624
+ background: "#D93025",
3625
+ padding: "2px 8px",
3626
+ cursor: "pointer"
3627
+ }
3628
+ }, t("WT_DELETE")))
3629
+ }], [t]);
3630
+ const days = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"];
3631
+ return /*#__PURE__*/React.createElement("div", {
3632
+ className: "fixed-point-schedule-management"
3633
+ }, /*#__PURE__*/React.createElement(Card, {
3634
+ style: {
3635
+ padding: "20px"
3636
+ }
3637
+ }, /*#__PURE__*/React.createElement("div", {
3638
+ className: "finance-mainlayout",
3639
+ style: {
3640
+ marginBottom: "20px"
3641
+ }
3642
+ }, /*#__PURE__*/React.createElement("div", {
3643
+ className: "finance-mainlayout-col1"
3644
+ }, /*#__PURE__*/React.createElement(Dropdown, {
3645
+ option: [{
3646
+ label: "Year 2024",
3647
+ value: "2024"
3648
+ }, {
3649
+ label: "Year 2025",
3650
+ value: "2025"
3651
+ }, {
3652
+ label: "Year 2026",
3653
+ value: "2026"
3654
+ }],
3655
+ optionKey: "label",
3656
+ selected: year,
3657
+ t: t,
3658
+ select: setYear
3659
+ })), /*#__PURE__*/React.createElement("div", {
3660
+ className: "finance-mainlayout-col1"
3661
+ }, /*#__PURE__*/React.createElement(Dropdown, {
3662
+ option: [{
3663
+ label: "All Fixed Points",
3664
+ value: "all"
3665
+ }, {
3666
+ label: "FP01",
3667
+ value: "FP01"
3668
+ }, {
3669
+ label: "FP02",
3670
+ value: "FP02"
3671
+ }, {
3672
+ label: "FP03",
3673
+ value: "FP03"
3674
+ }],
3675
+ optionKey: "label",
3676
+ selected: fixedPoint,
3677
+ t: t,
3678
+ select: setFixedPoint,
3679
+ placeholder: "All Fixed Points"
3680
+ })), /*#__PURE__*/React.createElement("div", {
3681
+ className: "finance-mainlayout-col1"
3682
+ }, /*#__PURE__*/React.createElement(Dropdown, {
3683
+ option: [{
3684
+ label: "All Days",
3685
+ value: "all"
3686
+ }, {
3687
+ label: "Mon",
3688
+ value: "Mon"
3689
+ }, {
3690
+ label: "Tue",
3691
+ value: "Tue"
3692
+ }, {
3693
+ label: "Wed",
3694
+ value: "Wed"
3695
+ }, {
3696
+ label: "Thu",
3697
+ value: "Thu"
3698
+ }, {
3699
+ label: "Fri",
3700
+ value: "Fri"
3701
+ }, {
3702
+ label: "Sat",
3703
+ value: "Sat"
3704
+ }, {
3705
+ label: "Sun",
3706
+ value: "Sun"
3707
+ }],
3708
+ optionKey: "label",
3709
+ selected: day,
3710
+ t: t,
3711
+ select: setDay,
3712
+ placeholder: "All Days"
3713
+ })), /*#__PURE__*/React.createElement("div", {
3714
+ className: "finance-mainlayout-col1"
3715
+ }, /*#__PURE__*/React.createElement(Dropdown, {
3716
+ option: [{
3717
+ label: "All Status",
3718
+ value: "all"
3719
+ }, {
3720
+ label: "Active",
3721
+ value: "Active"
3722
+ }, {
3723
+ label: "Inactive",
3724
+ value: "Inactive"
3725
+ }],
3726
+ optionKey: "label",
3727
+ selected: status,
3728
+ t: t,
3729
+ select: setStatus,
3730
+ placeholder: "All Status"
3731
+ }))), /*#__PURE__*/React.createElement("div", {
3732
+ className: "finance-mainlayout",
3733
+ style: {
3734
+ marginBottom: "20px"
3735
+ }
3736
+ }, /*#__PURE__*/React.createElement("div", {
3737
+ className: "finance-mainlayout-col1"
3738
+ }, /*#__PURE__*/React.createElement(Dropdown, {
3739
+ option: [{
3740
+ label: "All Vehicles",
3741
+ value: "all"
3742
+ }, {
3743
+ label: "DL1LAG7729",
3744
+ value: "DL1LAG7729"
3745
+ }, {
3746
+ label: "DL1LAG7730",
3747
+ value: "DL1LAG7730"
3748
+ }, {
3749
+ label: "DL1LAG7731",
3750
+ value: "DL1LAG7731"
3751
+ }],
3752
+ optionKey: "label",
3753
+ selected: vehicle,
3754
+ t: t,
3755
+ select: setVehicle,
3756
+ placeholder: "All Vehicles"
3757
+ })), /*#__PURE__*/React.createElement("div", {
3758
+ className: "finance-mainlayout-col1"
3759
+ }), /*#__PURE__*/React.createElement("div", {
3760
+ className: "finance-mainlayout-col1"
3761
+ }, /*#__PURE__*/React.createElement(Dropdown, {
3762
+ option: [{
3763
+ label: t("WT_EXCEL_WEEKWISE"),
3764
+ value: "Weekwise"
3765
+ }, {
3766
+ label: t("WT_EXCEL_MONTHWISE"),
3767
+ value: "Monthwise"
3768
+ }, {
3769
+ label: t("WT_EXCEL_YEARWISE"),
3770
+ value: "Yearwise"
3771
+ }],
3772
+ optionKey: "label",
3773
+ placeholder: t("WT_EXPORT"),
3774
+ t: t,
3775
+ select: handleDownload
3776
+ })), /*#__PURE__*/React.createElement("div", {
3777
+ className: "finance-mainlayout-col1"
3778
+ }, /*#__PURE__*/React.createElement(SubmitBar, {
3779
+ label: t("ES_COMMON_SEARCH"),
3780
+ onSubmit: handleSearch
3781
+ }))), /*#__PURE__*/React.createElement("div", {
3782
+ style: {
3783
+ display: "flex",
3784
+ gap: "5px",
3785
+ marginBottom: "20px"
3786
+ }
3787
+ }, days.map(day => /*#__PURE__*/React.createElement("button", {
3788
+ key: day,
3789
+ onClick: () => setSelectedDay(day),
3790
+ style: {
3791
+ padding: "8px 16px",
3792
+ border: "1px solid #ccc",
3793
+ borderRadius: "4px",
3794
+ background: selectedDay === day ? "#1D4E7F" : "#fff",
3795
+ color: selectedDay === day ? "#fff" : "#333",
3796
+ cursor: "pointer"
3797
+ }
3798
+ }, t(day.toUpperCase())))), /*#__PURE__*/React.createElement(Table, {
3799
+ t: t,
3800
+ data: data,
3801
+ columns: columns,
3802
+ getCellProps: cellInfo => ({}),
3803
+ styles: {
3804
+ minWidth: "1200px"
3805
+ },
3806
+ inboxStyles: {
3807
+ overflowX: "auto"
3808
+ }
3809
+ }), /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement("button", {
3810
+ onClick: () => {
3811
+ setEditingRowIndex(null);
3812
+ setShowModal(true);
3813
+ },
3814
+ style: {
3815
+ background: "#1E8E3E",
3816
+ color: "#fff",
3817
+ border: "none",
3818
+ padding: "10px 20px",
3819
+ borderRadius: "4px",
3820
+ cursor: "pointer",
3821
+ display: "flex",
3822
+ alignItems: "center",
3823
+ gap: "5px",
3824
+ marginBottom: "10px"
3825
+ }
3826
+ }, /*#__PURE__*/React.createElement("span", null, "+"), " ", t("WT_ADD_TRIP")))), showModal && /*#__PURE__*/React.createElement(AddTripModal, {
3827
+ t: t,
3828
+ closeModal: () => {
3829
+ setShowModal(false);
3830
+ setEditingRowIndex(null);
3831
+ },
3832
+ initialValues: editingRowIndex !== null ? {
3833
+ scheduleId: data[editingRowIndex].scheduleId,
3834
+ fixedPointCode: data[editingRowIndex].fixedPoint,
3835
+ day: {
3836
+ label: t(data[editingRowIndex].day.toUpperCase()),
3837
+ value: data[editingRowIndex].day
3838
+ },
3839
+ frequencyNo: data[editingRowIndex].freq,
3840
+ arrivalTimeFpl: data[editingRowIndex].arrToFpl,
3841
+ departureTimeFpl: data[editingRowIndex].depFromFpl,
3842
+ arrivalFixedPoint: data[editingRowIndex].arrAtFixedPoint,
3843
+ departureFixedPoint: data[editingRowIndex].depAtFixedPoint,
3844
+ returnFpl: data[editingRowIndex].returnToFpl,
3845
+ volume: data[editingRowIndex].volume,
3846
+ vehicleId: data[editingRowIndex].vehicle,
3847
+ active: {
3848
+ label: data[editingRowIndex].active === "Y" ? t("YES") : t("NO"),
3849
+ value: data[editingRowIndex].active === "Y" ? "Yes" : "No"
3850
+ }
3851
+ } : null,
3852
+ onSubmit: formData => {
3853
+ var _formData$day, _formData$active;
3854
+ const rowData = {
3855
+ scheduleId: formData.scheduleId || `SASID-000${data.length + 1}`,
3856
+ fixedPoint: formData.fixedPointCode || "FP01",
3857
+ day: ((_formData$day = formData.day) === null || _formData$day === void 0 ? void 0 : _formData$day.value) || "Mon",
3858
+ freq: formData.frequencyNo || "1",
3859
+ arrToFpl: formData.arrivalTimeFpl || "--:--",
3860
+ depFromFpl: formData.departureTimeFpl || "--:--",
3861
+ arrAtFixedPoint: formData.arrivalFixedPoint || "--:--",
3862
+ depAtFixedPoint: formData.departureFixedPoint || "--:--",
3863
+ returnToFpl: formData.returnFpl || "--:--",
3864
+ volume: formData.volume || "0 KL",
3865
+ vehicle: formData.vehicleId || "NA",
3866
+ active: ((_formData$active = formData.active) === null || _formData$active === void 0 ? void 0 : _formData$active.value) === "Yes" ? "Y" : "N"
3867
+ };
3868
+ if (editingRowIndex !== null) {
3869
+ const updatedData = [...data];
3870
+ updatedData[editingRowIndex] = rowData;
3871
+ setData(updatedData);
3872
+ } else {
3873
+ setData([...data, rowData]);
3874
+ }
3875
+ setShowModal(false);
3876
+ setEditingRowIndex(null);
3877
+ }
3878
+ }));
3879
+ };
3880
+
3881
+ delete L.Icon.Default.prototype._getIconUrl;
3882
+ L.Icon.Default.mergeOptions({
3883
+ iconRetinaUrl: "https://unpkg.com/leaflet@1.9.4/dist/images/marker-icon-2x.png",
3884
+ iconUrl: "https://unpkg.com/leaflet@1.9.4/dist/images/marker-icon.png",
3885
+ shadowUrl: "https://unpkg.com/leaflet@1.9.4/dist/images/marker-shadow.png"
3886
+ });
3887
+ const onlineIcon = new L.Icon({
3888
+ iconUrl: "https://raw.githubusercontent.com/pointhi/leaflet-color-markers/master/img/marker-icon-2x-green.png",
3889
+ shadowUrl: "https://cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.7/images/marker-shadow.png",
3890
+ iconSize: [25, 41],
3891
+ iconAnchor: [12, 41],
3892
+ popupAnchor: [1, -34],
3893
+ shadowSize: [41, 41]
3894
+ });
3895
+ const offlineIcon = new L.Icon({
3896
+ iconUrl: "https://raw.githubusercontent.com/pointhi/leaflet-color-markers/master/img/marker-icon-2x-red.png",
3897
+ shadowUrl: "https://cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.7/images/marker-shadow.png",
3898
+ iconSize: [25, 41],
3899
+ iconAnchor: [12, 41],
3900
+ popupAnchor: [1, -34],
3901
+ shadowSize: [41, 41]
3902
+ });
3903
+ const destinationIcon = new L.Icon({
3904
+ iconUrl: "https://raw.githubusercontent.com/pointhi/leaflet-color-markers/master/img/marker-icon-2x-blue.png",
3905
+ shadowUrl: "https://cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.7/images/marker-shadow.png",
3906
+ iconSize: [25, 41],
3907
+ iconAnchor: [12, 41],
3908
+ popupAnchor: [1, -34],
3909
+ shadowSize: [41, 41]
3910
+ });
3911
+ const SOCKET_URL = "http://localhost:3000";
3912
+ const MapController = ({
3913
+ selectedDriver
3914
+ }) => {
3915
+ const map = useMap();
3916
+ useEffect(() => {
3917
+ if (selectedDriver !== null && selectedDriver !== void 0 && selectedDriver.lat && selectedDriver !== null && selectedDriver !== void 0 && selectedDriver.lng) {
3918
+ map.setView([selectedDriver.lat, selectedDriver.lng], 15, {
3919
+ animate: true,
3920
+ duration: 1
3921
+ });
3922
+ }
3923
+ }, [selectedDriver, map]);
3924
+ return null;
3925
+ };
3926
+ const useRoute = (start, end) => {
3927
+ const [routeData, setRouteData] = useState(null);
3928
+ const [loading, setLoading] = useState(false);
3929
+ const [error, setError] = useState(null);
3930
+ useEffect(() => {
3931
+ if (!start || !end) return;
3932
+ const fetchRoute = async () => {
3933
+ setLoading(true);
3934
+ try {
3935
+ 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`);
3936
+ if (!response.ok) throw new Error("Failed to fetch route");
3937
+ const data = await response.json();
3938
+ if (data.routes && data.routes[0]) {
3939
+ const route = data.routes[0];
3940
+ const coordinates = route.geometry.coordinates.map(coord => [coord[1], coord[0]]);
3941
+ setRouteData({
3942
+ coordinates,
3943
+ distance: route.distance,
3944
+ duration: route.duration,
3945
+ legs: route.legs
3946
+ });
3947
+ }
3948
+ } catch (err) {
3949
+ console.error("Error fetching route:", err);
3950
+ setError(err.message);
3951
+ } finally {
3952
+ setLoading(false);
3953
+ }
3954
+ };
3955
+ fetchRoute();
3956
+ }, [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]);
3957
+ return {
3958
+ routeData,
3959
+ loading,
3960
+ error
3961
+ };
3962
+ };
3963
+ const RouteLayer = ({
3964
+ start,
3965
+ end,
3966
+ color: _color = "#2196f3",
3967
+ weight: _weight = 6
3968
+ }) => {
3969
+ const {
3970
+ routeData,
3971
+ loading,
3972
+ error
3973
+ } = useRoute(start, end);
3974
+ const [showSteps, setShowSteps] = useState(false);
3975
+ const [selectedStep, setSelectedStep] = useState(null);
3976
+ if (loading) {
3977
+ return /*#__PURE__*/React.createElement("div", {
3978
+ style: {
3979
+ position: "absolute",
3980
+ top: "20px",
3981
+ left: "20px",
3982
+ background: "white",
3983
+ padding: "8px 16px",
3984
+ borderRadius: "4px",
3985
+ boxShadow: "0 2px 4px rgba(0,0,0,0.1)",
3986
+ zIndex: 1000
3987
+ }
3988
+ }, "Loading route...");
3989
+ }
3990
+ if (error) {
3991
+ return /*#__PURE__*/React.createElement("div", {
3992
+ style: {
3993
+ position: "absolute",
3994
+ top: "20px",
3995
+ left: "20px",
3996
+ background: "#ffebee",
3997
+ color: "#c62828",
3998
+ padding: "8px 16px",
3999
+ borderRadius: "4px",
4000
+ boxShadow: "0 2px 4px rgba(0,0,0,0.1)",
4001
+ zIndex: 1000
4002
+ }
4003
+ }, "Error loading route: ", error);
4004
+ }
4005
+ if (!routeData) return null;
4006
+ const renderRouteSegments = () => {
4007
+ if (!routeData.legs) return null;
4008
+ const segments = [];
4009
+ routeData.legs.forEach((leg, legIndex) => {
4010
+ leg.steps.forEach((step, stepIndex) => {
4011
+ const stepCoordinates = step.geometry.coordinates.map(coord => [coord[1], coord[0]]);
4012
+ let segmentColor = _color;
4013
+ if (step.maneuver.type === "turn") {
4014
+ segmentColor = "#ff9800";
4015
+ } else if (step.maneuver.type === "straight") {
4016
+ segmentColor = "#4caf50";
4017
+ } else if (step.maneuver.type === "arrive") {
4018
+ segmentColor = "#f44336";
4019
+ }
4020
+ segments.push(/*#__PURE__*/React.createElement(React.Fragment, {
4021
+ key: `${legIndex}-${stepIndex}`
4022
+ }, /*#__PURE__*/React.createElement(Polyline, {
4023
+ positions: stepCoordinates,
4024
+ color: segmentColor,
4025
+ weight: _weight + 2,
4026
+ opacity: 0.3,
4027
+ lineCap: "round"
4028
+ }), /*#__PURE__*/React.createElement(Polyline, {
4029
+ positions: stepCoordinates,
4030
+ color: segmentColor,
4031
+ weight: _weight,
4032
+ opacity: 0.9,
4033
+ lineCap: "round",
4034
+ eventHandlers: {
4035
+ mouseover: () => setSelectedStep(step),
4036
+ mouseout: () => setSelectedStep(null),
4037
+ click: () => setShowSteps(!showSteps)
4038
+ }
4039
+ }), stepCoordinates.map((coord, idx) => {
4040
+ if (idx % 5 === 0 && idx < stepCoordinates.length - 1) {
4041
+ const nextCoord = stepCoordinates[idx + 1];
4042
+ const angle = Math.atan2(nextCoord[0] - coord[0], nextCoord[1] - coord[1]) * 180 / Math.PI;
4043
+ return /*#__PURE__*/React.createElement(Marker, {
4044
+ key: `dot-${legIndex}-${stepIndex}-${idx}`,
4045
+ position: coord,
4046
+ icon: L.divIcon({
4047
+ className: "direction-dot",
4048
+ html: `<div style="
4049
+ width: 6px;
4050
+ height: 6px;
4051
+ background: white;
4052
+ border: 2px solid ${segmentColor};
4053
+ border-radius: 50%;
4054
+ transform: rotate(${angle}deg);
4055
+ "></div>`,
4056
+ iconSize: [10, 10],
4057
+ iconAnchor: [5, 5]
4058
+ })
4059
+ });
4060
+ }
4061
+ return null;
4062
+ })));
4063
+ });
4064
+ });
4065
+ return segments;
4066
+ };
4067
+ return /*#__PURE__*/React.createElement(React.Fragment, null, renderRouteSegments(), (selectedStep || showSteps) && /*#__PURE__*/React.createElement("div", {
4068
+ style: {
4069
+ position: "absolute",
4070
+ bottom: "80px",
4071
+ left: "10px",
4072
+ right: "10px",
4073
+ background: "white",
4074
+ padding: "16px",
4075
+ borderRadius: "8px",
4076
+ boxShadow: "0 4px 12px rgba(0,0,0,0.15)",
4077
+ zIndex: 1000,
4078
+ maxWidth: "calc(100% - 20px)",
4079
+ border: "1px solid #e0e0e0",
4080
+ maxHeight: "50vh",
4081
+ overflowY: "auto"
4082
+ }
4083
+ }, /*#__PURE__*/React.createElement("div", {
4084
+ style: {
4085
+ display: "flex",
4086
+ justifyContent: "space-between",
4087
+ alignItems: "center",
4088
+ marginBottom: "8px"
4089
+ }
4090
+ }, /*#__PURE__*/React.createElement("h4", {
4091
+ style: {
4092
+ margin: 0,
4093
+ color: "#1a237e"
4094
+ }
4095
+ }, "Route Information"), /*#__PURE__*/React.createElement("button", {
4096
+ onClick: () => setShowSteps(false),
4097
+ style: {
4098
+ background: "none",
4099
+ border: "none",
4100
+ cursor: "pointer",
4101
+ fontSize: "24px",
4102
+ color: "#666",
4103
+ padding: "0 8px"
4104
+ }
4105
+ }, "\xD7")), /*#__PURE__*/React.createElement("div", {
4106
+ style: {
4107
+ marginBottom: "12px"
4108
+ }
4109
+ }, /*#__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", {
4110
+ style: {
4111
+ padding: "8px",
4112
+ background: "#f5f5f5",
4113
+ borderRadius: "4px",
4114
+ marginBottom: "8px"
4115
+ }
4116
+ }, /*#__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", {
4117
+ style: {
4118
+ maxHeight: "200px",
4119
+ overflowY: "auto"
4120
+ }
4121
+ }, /*#__PURE__*/React.createElement("h5", {
4122
+ style: {
4123
+ margin: "8px 0",
4124
+ color: "#666"
4125
+ }
4126
+ }, "Turn-by-turn directions:"), routeData.legs[0].steps.map((step, idx) => /*#__PURE__*/React.createElement("div", {
4127
+ key: idx,
4128
+ style: {
4129
+ padding: "8px",
4130
+ borderBottom: "1px solid #eee",
4131
+ fontSize: "12px",
4132
+ cursor: "pointer",
4133
+ background: selectedStep === step ? "#e3f2fd" : "transparent"
4134
+ },
4135
+ onMouseEnter: () => setSelectedStep(step),
4136
+ onMouseLeave: () => setSelectedStep(null)
4137
+ }, /*#__PURE__*/React.createElement("div", {
4138
+ style: {
4139
+ display: "flex",
4140
+ alignItems: "center",
4141
+ gap: "8px"
4142
+ }
4143
+ }, /*#__PURE__*/React.createElement("span", {
4144
+ style: {
4145
+ width: "20px",
4146
+ height: "20px",
4147
+ borderRadius: "50%",
4148
+ background: "#1a237e",
4149
+ color: "white",
4150
+ display: "flex",
4151
+ alignItems: "center",
4152
+ justifyContent: "center",
4153
+ fontSize: "10px",
4154
+ flexShrink: 0
4155
+ }
4156
+ }, idx + 1), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
4157
+ style: {
4158
+ fontWeight: "500"
4159
+ }
4160
+ }, step.maneuver.instruction || step.name), /*#__PURE__*/React.createElement("div", {
4161
+ style: {
4162
+ color: "#666"
4163
+ }
4164
+ }, (step.distance / 1000).toFixed(2), " km \xB7 ", Math.round(step.duration / 60), " min"))))))), routeData.distance > 1000 && routeData.coordinates && /*#__PURE__*/React.createElement(RouteMarkers, {
4165
+ coordinates: routeData.coordinates,
4166
+ totalDistance: routeData.distance
4167
+ }));
4168
+ };
4169
+ const RouteMarkers = ({
4170
+ coordinates,
4171
+ totalDistance
4172
+ }) => {
4173
+ const markers = [];
4174
+ const interval = 1000;
4175
+ for (let i = interval; i < totalDistance; i += interval) {
4176
+ const fraction = i / totalDistance;
4177
+ const index = Math.floor(coordinates.length * fraction);
4178
+ if (index < coordinates.length) {
4179
+ markers.push(/*#__PURE__*/React.createElement(Marker, {
4180
+ key: `dist-${i}`,
4181
+ position: coordinates[index],
4182
+ icon: L.divIcon({
4183
+ className: "distance-marker",
4184
+ html: `<div style="
4185
+ background: white;
4186
+ border: 2px solid #2196f3;
4187
+ border-radius: 12px;
4188
+ padding: 2px 6px;
4189
+ font-size: 10px;
4190
+ font-weight: bold;
4191
+ color: #1a237e;
4192
+ white-space: nowrap;
4193
+ ">${(i / 1000).toFixed(0)} km</div>`,
4194
+ iconSize: [40, 20],
4195
+ iconAnchor: [20, 10]
4196
+ })
4197
+ }));
4198
+ }
4199
+ }
4200
+ return /*#__PURE__*/React.createElement(React.Fragment, null, markers);
4201
+ };
4202
+ const StatusBadge = ({
4203
+ isOnline
4204
+ }) => /*#__PURE__*/React.createElement("span", {
4205
+ style: {
4206
+ display: "inline-block",
4207
+ padding: "4px 8px",
4208
+ borderRadius: "12px",
4209
+ fontSize: "12px",
4210
+ fontWeight: "600",
4211
+ backgroundColor: isOnline ? "#e6f7e6" : "#ffe6e6",
4212
+ color: isOnline ? "#2e7d32" : "#c62828",
4213
+ border: `1px solid ${isOnline ? "#a5d6a7" : "#ef9a9a"}`
4214
+ }
4215
+ }, /*#__PURE__*/React.createElement("span", {
4216
+ style: {
4217
+ display: "inline-block",
4218
+ width: "8px",
4219
+ height: "8px",
4220
+ borderRadius: "50%",
4221
+ backgroundColor: isOnline ? "#4caf50" : "#f44336",
4222
+ marginRight: "6px"
4223
+ }
4224
+ }), isOnline ? "ONLINE" : "OFFLINE");
4225
+ const DriverCard = ({
4226
+ driver,
4227
+ isSelected,
4228
+ onClick
4229
+ }) => {
4230
+ const calculateETA = () => {
4231
+ if (!driver.lat || !driver.lng || !driver.deliveryLat || !driver.deliveryLng) return null;
4232
+ const distance = calculateDistance(driver.lat, driver.lng, driver.deliveryLat, driver.deliveryLng);
4233
+ const minutes = Math.round(distance / 30 * 60);
4234
+ return minutes;
4235
+ };
4236
+ const eta = calculateETA();
4237
+ return /*#__PURE__*/React.createElement("div", {
4238
+ onClick: onClick,
4239
+ style: {
4240
+ padding: "16px",
4241
+ marginBottom: "12px",
4242
+ borderRadius: "12px",
4243
+ background: isSelected ? "#e3f2fd" : "#ffffff",
4244
+ border: `2px solid ${isSelected ? "#2196f3" : "#e0e0e0"}`,
4245
+ boxShadow: isSelected ? "0 4px 12px rgba(33, 150, 243, 0.2)" : "0 2px 8px rgba(0, 0, 0, 0.05)",
4246
+ cursor: "pointer",
4247
+ transition: "all 0.2s ease",
4248
+ position: "relative",
4249
+ overflow: "hidden"
4250
+ }
4251
+ }, /*#__PURE__*/React.createElement("div", {
4252
+ style: {
4253
+ position: "absolute",
4254
+ top: 0,
4255
+ left: 0,
4256
+ right: 0,
4257
+ height: "4px",
4258
+ background: driver.isOnline ? "linear-gradient(90deg, #4caf50, #81c784)" : "linear-gradient(90deg, #f44336, #e57373)"
4259
+ }
4260
+ }), /*#__PURE__*/React.createElement("div", {
4261
+ style: {
4262
+ display: "flex",
4263
+ alignItems: "center",
4264
+ marginBottom: "12px"
4265
+ }
4266
+ }, /*#__PURE__*/React.createElement("div", {
4267
+ style: {
4268
+ width: "40px",
4269
+ height: "40px",
4270
+ borderRadius: "50%",
4271
+ background: driver.isOnline ? "linear-gradient(135deg, #4caf50, #81c784)" : "linear-gradient(135deg, #9e9e9e, #bdbdbd)",
4272
+ display: "flex",
4273
+ alignItems: "center",
4274
+ justifyContent: "center",
4275
+ color: "white",
4276
+ fontWeight: "bold",
4277
+ fontSize: "16px",
4278
+ marginRight: "12px",
4279
+ flexShrink: 0
4280
+ }
4281
+ }, driver.driverId.charAt(0).toUpperCase()), /*#__PURE__*/React.createElement("div", {
4282
+ style: {
4283
+ flex: 1,
4284
+ minWidth: 0
4285
+ }
4286
+ }, /*#__PURE__*/React.createElement("div", {
4287
+ style: {
4288
+ fontWeight: "600",
4289
+ fontSize: "16px",
4290
+ color: "#1a237e",
4291
+ marginBottom: "4px",
4292
+ overflow: "hidden",
4293
+ textOverflow: "ellipsis",
4294
+ whiteSpace: "nowrap"
4295
+ }
4296
+ }, "Driver #", driver.driverId.substring(0, 8), "..."), /*#__PURE__*/React.createElement(StatusBadge, {
4297
+ isOnline: driver.isOnline
4298
+ }))), driver.lat && driver.lng && /*#__PURE__*/React.createElement("div", {
4299
+ style: {
4300
+ marginBottom: "8px"
4301
+ }
4302
+ }, /*#__PURE__*/React.createElement("div", {
4303
+ style: {
4304
+ fontSize: "12px",
4305
+ color: "#666",
4306
+ marginBottom: "4px"
4307
+ }
4308
+ }, "Current Location"), /*#__PURE__*/React.createElement("div", {
4309
+ style: {
4310
+ display: "grid",
4311
+ gridTemplateColumns: "1fr 1fr",
4312
+ gap: "4px",
4313
+ fontSize: "11px"
4314
+ }
4315
+ }, /*#__PURE__*/React.createElement("span", {
4316
+ style: {
4317
+ color: "#666"
4318
+ }
4319
+ }, "Lat:"), /*#__PURE__*/React.createElement("span", {
4320
+ style: {
4321
+ fontFamily: "monospace",
4322
+ overflow: "hidden",
4323
+ textOverflow: "ellipsis"
4324
+ }
4325
+ }, driver.lat.toFixed(4)), /*#__PURE__*/React.createElement("span", {
4326
+ style: {
4327
+ color: "#666"
4328
+ }
4329
+ }, "Lng:"), /*#__PURE__*/React.createElement("span", {
4330
+ style: {
4331
+ fontFamily: "monospace",
4332
+ overflow: "hidden",
4333
+ textOverflow: "ellipsis"
4334
+ }
4335
+ }, driver.lng.toFixed(4)))), driver.deliveryLat && driver.deliveryLng && /*#__PURE__*/React.createElement("div", {
4336
+ style: {
4337
+ marginBottom: "8px"
4338
+ }
4339
+ }, /*#__PURE__*/React.createElement("div", {
4340
+ style: {
4341
+ fontSize: "12px",
4342
+ color: "#666",
4343
+ marginBottom: "4px"
4344
+ }
4345
+ }, "Delivery Destination"), /*#__PURE__*/React.createElement("div", {
4346
+ style: {
4347
+ display: "grid",
4348
+ gridTemplateColumns: "1fr 1fr",
4349
+ gap: "4px",
4350
+ fontSize: "11px"
4351
+ }
4352
+ }, /*#__PURE__*/React.createElement("span", {
4353
+ style: {
4354
+ color: "#666"
4355
+ }
4356
+ }, "Lat:"), /*#__PURE__*/React.createElement("span", {
4357
+ style: {
4358
+ fontFamily: "monospace",
4359
+ overflow: "hidden",
4360
+ textOverflow: "ellipsis"
4361
+ }
4362
+ }, driver.deliveryLat.toFixed(4)), /*#__PURE__*/React.createElement("span", {
4363
+ style: {
4364
+ color: "#666"
4365
+ }
4366
+ }, "Lng:"), /*#__PURE__*/React.createElement("span", {
4367
+ style: {
4368
+ fontFamily: "monospace",
4369
+ overflow: "hidden",
4370
+ textOverflow: "ellipsis"
4371
+ }
4372
+ }, driver.deliveryLng.toFixed(4)))), eta !== null && /*#__PURE__*/React.createElement("div", {
4373
+ style: {
4374
+ marginTop: "8px",
4375
+ padding: "8px",
4376
+ background: "#f5f5f5",
4377
+ borderRadius: "6px",
4378
+ display: "flex",
4379
+ justifyContent: "space-between",
4380
+ alignItems: "center",
4381
+ flexWrap: "wrap",
4382
+ gap: "8px"
4383
+ }
4384
+ }, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
4385
+ style: {
4386
+ fontSize: "11px",
4387
+ color: "#666"
4388
+ }
4389
+ }, "Est. Arrival"), /*#__PURE__*/React.createElement("div", {
4390
+ style: {
4391
+ fontSize: "14px",
4392
+ fontWeight: "600",
4393
+ color: "#1a237e"
4394
+ }
4395
+ }, eta, " min")), driver.speed && /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
4396
+ style: {
4397
+ fontSize: "11px",
4398
+ color: "#666"
4399
+ }
4400
+ }, "Speed"), /*#__PURE__*/React.createElement("div", {
4401
+ style: {
4402
+ fontSize: "14px",
4403
+ fontWeight: "600",
4404
+ color: "#4caf50"
4405
+ }
4406
+ }, Math.round(driver.speed * 3.6), " km/h"))), /*#__PURE__*/React.createElement("div", {
4407
+ style: {
4408
+ marginTop: "12px",
4409
+ fontSize: "11px",
4410
+ color: "#999",
4411
+ borderTop: "1px solid #eee",
4412
+ paddingTop: "8px",
4413
+ display: "grid",
4414
+ gridTemplateColumns: "1fr 1fr",
4415
+ gap: "4px"
4416
+ }
4417
+ }, 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()))));
4418
+ };
4419
+ function calculateDistance(lat1, lon1, lat2, lon2) {
4420
+ const R = 6371;
4421
+ const dLat = (lat2 - lat1) * Math.PI / 180;
4422
+ const dLon = (lon2 - lon1) * Math.PI / 180;
4423
+ 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);
4424
+ const c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
4425
+ return R * c;
4426
+ }
4427
+ function LiveTrackingSystem() {
4428
+ var _selectedDriver$lat, _selectedDriver$lng, _selectedDriver$lat2, _selectedDriver$lng2;
4429
+ const [drivers, setDrivers] = useState({});
4430
+ const [isConnected, setIsConnected] = useState(false);
4431
+ const [selectedDriver, setSelectedDriver] = useState(null);
4432
+ const [searchTerm, setSearchTerm] = useState("");
4433
+ const [filterOnline, setFilterOnline] = useState("all");
4434
+ const [showRoutes, setShowRoutes] = useState(true);
4435
+ const [mapCenter, setMapCenter] = useState([28.6139, 77.209]);
4436
+ const [mapZoom, setMapZoom] = useState(12);
4437
+ const [showSidebar, setShowSidebar] = useState(true);
4438
+ const [isMobile, setIsMobile] = useState(window.innerWidth <= 768);
4439
+ useEffect(() => {
4440
+ const handleResize = () => {
4441
+ setIsMobile(window.innerWidth <= 768);
4442
+ if (window.innerWidth <= 768) {
4443
+ setShowSidebar(false);
4444
+ } else {
4445
+ setShowSidebar(true);
4446
+ }
4447
+ };
4448
+ window.addEventListener("resize", handleResize);
4449
+ handleResize();
4450
+ return () => window.removeEventListener("resize", handleResize);
4451
+ }, []);
4452
+ const socket = useMemo(() => {
4453
+ return io(SOCKET_URL, {
4454
+ transports: ["websocket"],
4455
+ autoConnect: false
4456
+ });
4457
+ }, []);
4458
+ useEffect(() => {
4459
+ socket.connect();
4460
+ socket.on("connect", () => {
4461
+ console.log("Admin connected:", socket.id);
4462
+ setIsConnected(true);
4463
+ socket.emit("admin-join");
4464
+ });
4465
+ socket.on("disconnect", () => {
4466
+ console.log("Admin disconnected");
4467
+ setIsConnected(false);
4468
+ });
4469
+ socket.on("drivers-snapshot", data => {
4470
+ console.log("drivers-snapshot", data);
4471
+ if (!Array.isArray(data)) return;
4472
+ const mapped = {};
4473
+ data.forEach(driver => {
4474
+ if (driver && driver.driverId) {
4475
+ mapped[driver.driverId] = {
4476
+ ...driver,
4477
+ lastUpdate: new Date().toISOString()
4478
+ };
4479
+ }
4480
+ });
4481
+ setDrivers(mapped);
4482
+ });
4483
+ socket.on("driver-location-update", driver => {
4484
+ console.log("driver-location-update", driver);
4485
+ if (!driver || !driver.driverId) return;
4486
+ setDrivers(prev => {
4487
+ const existingDriver = prev[driver.driverId] || {};
4488
+ return {
4489
+ ...prev,
4490
+ [driver.driverId]: {
4491
+ ...existingDriver,
4492
+ ...driver,
4493
+ lastUpdate: new Date().toISOString()
4494
+ }
4495
+ };
4496
+ });
4497
+ });
4498
+ socket.on("driver-status", driver => {
4499
+ console.log("driver-status", driver);
4500
+ if (!driver || !driver.driverId) return;
4501
+ setDrivers(prev => ({
4502
+ ...prev,
4503
+ [driver.driverId]: {
4504
+ ...prev[driver.driverId],
4505
+ ...driver,
4506
+ lastUpdate: new Date().toISOString()
4507
+ }
4508
+ }));
4509
+ });
4510
+ return () => {
4511
+ socket.disconnect();
4512
+ };
4513
+ }, [socket]);
4514
+ useEffect(() => {
4515
+ if (selectedDriver !== null && selectedDriver !== void 0 && selectedDriver.lat && selectedDriver !== null && selectedDriver !== void 0 && selectedDriver.lng) {
4516
+ setMapCenter([selectedDriver.lat, selectedDriver.lng]);
4517
+ setMapZoom(15);
4518
+ }
4519
+ }, [selectedDriver]);
4520
+ const filteredDrivers = Object.values(drivers).filter(driver => {
4521
+ const matchesSearch = driver.driverId.toLowerCase().includes(searchTerm.toLowerCase());
4522
+ const matchesStatus = filterOnline === "all" || filterOnline === "online" && driver.isOnline || filterOnline === "offline" && !driver.isOnline;
4523
+ return matchesSearch && matchesStatus;
4524
+ });
4525
+ const onlineCount = Object.values(drivers).filter(d => d.isOnline).length;
4526
+ const offlineCount = Object.values(drivers).filter(d => !d.isOnline).length;
4527
+ const activeDeliveries = Object.values(drivers).filter(d => d.isOnline && d.deliveryLat && d.deliveryLng).length;
4528
+ const toggleSidebar = () => {
4529
+ setShowSidebar(!showSidebar);
4530
+ };
4531
+ return /*#__PURE__*/React.createElement("div", {
4532
+ style: {
4533
+ display: "flex",
4534
+ height: "100vh",
4535
+ width: "100%",
4536
+ fontFamily: "'Inter', -apple-system, BlinkMacSystemFont, sans-serif",
4537
+ position: "relative",
4538
+ overflow: "hidden"
4539
+ }
4540
+ }, isMobile && /*#__PURE__*/React.createElement("button", {
4541
+ onClick: toggleSidebar,
4542
+ style: {
4543
+ position: "absolute",
4544
+ top: "10px",
4545
+ left: "10px",
4546
+ zIndex: 2000,
4547
+ background: "#1a237e",
4548
+ color: "white",
4549
+ border: "none",
4550
+ borderRadius: "8px",
4551
+ padding: "10px 16px",
4552
+ fontSize: "14px",
4553
+ fontWeight: "500",
4554
+ cursor: "pointer",
4555
+ boxShadow: "0 2px 8px rgba(0,0,0,0.2)",
4556
+ display: "flex",
4557
+ alignItems: "center",
4558
+ gap: "8px"
4559
+ }
4560
+ }, /*#__PURE__*/React.createElement("span", {
4561
+ style: {
4562
+ fontSize: "20px"
4563
+ }
4564
+ }, "\u2630"), showSidebar ? "Hide List" : "Show Drivers"), /*#__PURE__*/React.createElement("div", {
4565
+ style: {
4566
+ width: isMobile ? showSidebar ? "100%" : "0" : "380px",
4567
+ height: "100%",
4568
+ borderRight: isMobile ? "none" : "1px solid #e0e0e0",
4569
+ display: "flex",
4570
+ flexDirection: "column",
4571
+ background: "#ffffff",
4572
+ boxShadow: isMobile ? showSidebar ? "0 0 20px rgba(0,0,0,0.2)" : "none" : "2px 0 8px rgba(0, 0, 0, 0.05)",
4573
+ position: isMobile ? "absolute" : "relative",
4574
+ top: 0,
4575
+ left: 0,
4576
+ zIndex: 1500,
4577
+ transition: "all 0.3s ease-in-out",
4578
+ overflow: showSidebar ? "visible" : "hidden",
4579
+ ...(isMobile && !showSidebar && {
4580
+ width: "0",
4581
+ opacity: 0,
4582
+ pointerEvents: "none"
4583
+ })
4584
+ }
4585
+ }, showSidebar && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
4586
+ style: {
4587
+ padding: isMobile ? "16px" : "24px",
4588
+ background: "linear-gradient(135deg, #1a237e, #0d47a1)",
4589
+ color: "white"
4590
+ }
4591
+ }, isMobile && /*#__PURE__*/React.createElement("button", {
4592
+ onClick: toggleSidebar,
4593
+ style: {
4594
+ position: "absolute",
4595
+ top: "10px",
4596
+ right: "10px",
4597
+ background: "rgba(255,255,255,0.2)",
4598
+ border: "none",
4599
+ color: "white",
4600
+ fontSize: "20px",
4601
+ cursor: "pointer",
4602
+ width: "30px",
4603
+ height: "30px",
4604
+ borderRadius: "4px",
4605
+ display: "flex",
4606
+ alignItems: "center",
4607
+ justifyContent: "center"
4608
+ }
4609
+ }, "\u2715"), /*#__PURE__*/React.createElement("h2", {
4610
+ style: {
4611
+ margin: "0 0 8px 0",
4612
+ fontSize: isMobile ? "20px" : "24px",
4613
+ fontWeight: "600",
4614
+ letterSpacing: "-0.5px"
4615
+ }
4616
+ }, "Live Driver Tracking"), /*#__PURE__*/React.createElement("div", {
4617
+ style: {
4618
+ display: "flex",
4619
+ alignItems: "center",
4620
+ gap: "8px",
4621
+ fontSize: "14px",
4622
+ opacity: 0.9
4623
+ }
4624
+ }, /*#__PURE__*/React.createElement("span", {
4625
+ style: {
4626
+ display: "inline-block",
4627
+ width: "10px",
4628
+ height: "10px",
4629
+ borderRadius: "50%",
4630
+ backgroundColor: isConnected ? "#4caf50" : "#f44336",
4631
+ animation: isConnected ? "pulse 2s infinite" : "none"
4632
+ }
4633
+ }), /*#__PURE__*/React.createElement("span", null, isConnected ? "Connected to server" : "Disconnected"))), /*#__PURE__*/React.createElement("div", {
4634
+ style: {
4635
+ display: "grid",
4636
+ gridTemplateColumns: "1fr 1fr 1fr 1fr",
4637
+ gap: isMobile ? "4px" : "8px",
4638
+ padding: isMobile ? "12px" : "16px",
4639
+ background: "#f5f5f5",
4640
+ borderBottom: "1px solid #e0e0e0"
4641
+ }
4642
+ }, /*#__PURE__*/React.createElement("div", {
4643
+ style: {
4644
+ textAlign: "center"
4645
+ }
4646
+ }, /*#__PURE__*/React.createElement("div", {
4647
+ style: {
4648
+ fontSize: isMobile ? "10px" : "11px",
4649
+ color: "#666"
4650
+ }
4651
+ }, "Total"), /*#__PURE__*/React.createElement("div", {
4652
+ style: {
4653
+ fontSize: isMobile ? "16px" : "20px",
4654
+ fontWeight: "bold",
4655
+ color: "#1a237e"
4656
+ }
4657
+ }, Object.keys(drivers).length)), /*#__PURE__*/React.createElement("div", {
4658
+ style: {
4659
+ textAlign: "center"
4660
+ }
4661
+ }, /*#__PURE__*/React.createElement("div", {
4662
+ style: {
4663
+ fontSize: isMobile ? "10px" : "11px",
4664
+ color: "#666"
4665
+ }
4666
+ }, "Online"), /*#__PURE__*/React.createElement("div", {
4667
+ style: {
4668
+ fontSize: isMobile ? "16px" : "20px",
4669
+ fontWeight: "bold",
4670
+ color: "#4caf50"
4671
+ }
4672
+ }, onlineCount)), /*#__PURE__*/React.createElement("div", {
4673
+ style: {
4674
+ textAlign: "center"
4675
+ }
4676
+ }, /*#__PURE__*/React.createElement("div", {
4677
+ style: {
4678
+ fontSize: isMobile ? "10px" : "11px",
4679
+ color: "#666"
4680
+ }
4681
+ }, "Offline"), /*#__PURE__*/React.createElement("div", {
4682
+ style: {
4683
+ fontSize: isMobile ? "16px" : "20px",
4684
+ fontWeight: "bold",
4685
+ color: "#f44336"
4686
+ }
4687
+ }, offlineCount)), /*#__PURE__*/React.createElement("div", {
4688
+ style: {
4689
+ textAlign: "center"
4690
+ }
4691
+ }, /*#__PURE__*/React.createElement("div", {
4692
+ style: {
4693
+ fontSize: isMobile ? "10px" : "11px",
4694
+ color: "#666"
4695
+ }
4696
+ }, "Active"), /*#__PURE__*/React.createElement("div", {
4697
+ style: {
4698
+ fontSize: isMobile ? "16px" : "20px",
4699
+ fontWeight: "bold",
4700
+ color: "#ff9800"
4701
+ }
4702
+ }, activeDeliveries))), /*#__PURE__*/React.createElement("div", {
4703
+ style: {
4704
+ padding: isMobile ? "12px" : "16px",
4705
+ borderBottom: "1px solid #e0e0e0",
4706
+ background: "#fafafa"
4707
+ }
4708
+ }, /*#__PURE__*/React.createElement("input", {
4709
+ type: "text",
4710
+ placeholder: "Search by driver ID...",
4711
+ value: searchTerm,
4712
+ onChange: e => setSearchTerm(e.target.value),
4713
+ style: {
4714
+ width: "100%",
4715
+ padding: isMobile ? "10px" : "12px",
4716
+ border: "1px solid #e0e0e0",
4717
+ borderRadius: "8px",
4718
+ fontSize: isMobile ? "14px" : "14px",
4719
+ marginBottom: "12px",
4720
+ outline: "none",
4721
+ transition: "border-color 0.2s",
4722
+ boxSizing: "border-box"
4723
+ },
4724
+ onFocus: e => e.target.style.borderColor = "#1a237e",
4725
+ onBlur: e => e.target.style.borderColor = "#e0e0e0"
4726
+ }), /*#__PURE__*/React.createElement("div", {
4727
+ style: {
4728
+ display: "flex",
4729
+ gap: "8px",
4730
+ marginBottom: "8px"
4731
+ }
4732
+ }, ["all", "online", "offline"].map(filter => /*#__PURE__*/React.createElement("button", {
4733
+ key: filter,
4734
+ onClick: () => setFilterOnline(filter),
4735
+ style: {
4736
+ flex: 1,
4737
+ padding: isMobile ? "6px" : "8px",
4738
+ border: "1px solid #e0e0e0",
4739
+ borderRadius: "6px",
4740
+ background: filterOnline === filter ? "#1a237e" : "white",
4741
+ color: filterOnline === filter ? "white" : "#333",
4742
+ cursor: "pointer",
4743
+ fontSize: isMobile ? "11px" : "12px",
4744
+ fontWeight: "500",
4745
+ textTransform: "capitalize",
4746
+ transition: "all 0.2s"
4747
+ }
4748
+ }, filter))), /*#__PURE__*/React.createElement("div", {
4749
+ style: {
4750
+ display: "flex",
4751
+ alignItems: "center",
4752
+ gap: "8px",
4753
+ marginTop: "8px"
4754
+ }
4755
+ }, /*#__PURE__*/React.createElement("input", {
4756
+ type: "checkbox",
4757
+ id: "showRoutes",
4758
+ checked: showRoutes,
4759
+ onChange: e => setShowRoutes(e.target.checked),
4760
+ style: {
4761
+ cursor: "pointer",
4762
+ width: "16px",
4763
+ height: "16px"
4764
+ }
4765
+ }), /*#__PURE__*/React.createElement("label", {
4766
+ htmlFor: "showRoutes",
4767
+ style: {
4768
+ fontSize: isMobile ? "12px" : "13px",
4769
+ color: "#333",
4770
+ cursor: "pointer"
4771
+ }
4772
+ }, "Show delivery routes"))), /*#__PURE__*/React.createElement("div", {
4773
+ style: {
4774
+ flex: 1,
4775
+ overflowY: "auto",
4776
+ padding: isMobile ? "12px" : "16px",
4777
+ background: "#f5f5f5"
4778
+ }
4779
+ }, filteredDrivers.length === 0 ? /*#__PURE__*/React.createElement("div", {
4780
+ style: {
4781
+ textAlign: "center",
4782
+ padding: isMobile ? "20px" : "40px 20px",
4783
+ color: "#999",
4784
+ background: "white",
4785
+ borderRadius: "12px"
4786
+ }
4787
+ }, /*#__PURE__*/React.createElement("div", {
4788
+ style: {
4789
+ fontSize: isMobile ? "36px" : "48px",
4790
+ marginBottom: "16px"
4791
+ }
4792
+ }, "\uD83D\uDE97"), /*#__PURE__*/React.createElement("p", {
4793
+ style: {
4794
+ fontSize: isMobile ? "14px" : "16px",
4795
+ margin: 0
4796
+ }
4797
+ }, Object.keys(drivers).length === 0 ? "No drivers available" : "No drivers match your filters")) : filteredDrivers.map(driver => /*#__PURE__*/React.createElement(DriverCard, {
4798
+ key: driver.driverId,
4799
+ driver: driver,
4800
+ isSelected: (selectedDriver === null || selectedDriver === void 0 ? void 0 : selectedDriver.driverId) === driver.driverId,
4801
+ onClick: () => {
4802
+ setSelectedDriver(driver);
4803
+ if (isMobile) {
4804
+ setShowSidebar(false);
4805
+ }
4806
+ }
4807
+ }))))), /*#__PURE__*/React.createElement("div", {
4808
+ style: {
4809
+ flex: 1,
4810
+ position: "relative",
4811
+ width: isMobile ? "100%" : "calc(100% - 380px)",
4812
+ height: "100%"
4813
+ }
4814
+ }, /*#__PURE__*/React.createElement(MapContainer, {
4815
+ center: mapCenter,
4816
+ zoom: mapZoom,
4817
+ style: {
4818
+ height: "100%",
4819
+ width: "100%"
4820
+ },
4821
+ zoomControl: false
4822
+ }, /*#__PURE__*/React.createElement(TileLayer, {
4823
+ url: "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",
4824
+ attribution: "\xA9 <a href=\"https://www.openstreetmap.org/copyright\">OpenStreetMap</a>"
4825
+ }), /*#__PURE__*/React.createElement(MapController, {
4826
+ selectedDriver: selectedDriver
4827
+ }), selectedDriver && selectedDriver.lat != null && selectedDriver.lng != null && /*#__PURE__*/React.createElement(Marker, {
4828
+ key: selectedDriver.driverId,
4829
+ position: [Number(selectedDriver.lat), Number(selectedDriver.lng)],
4830
+ icon: selectedDriver.isOnline ? onlineIcon : offlineIcon
4831
+ }, /*#__PURE__*/React.createElement(Popup, null, /*#__PURE__*/React.createElement("div", {
4832
+ style: {
4833
+ minWidth: isMobile ? "200px" : "250px",
4834
+ padding: "8px"
4835
+ }
4836
+ }, /*#__PURE__*/React.createElement("div", {
4837
+ style: {
4838
+ fontWeight: "bold",
4839
+ fontSize: isMobile ? "14px" : "16px",
4840
+ color: "#1a237e",
4841
+ marginBottom: "8px",
4842
+ borderBottom: "1px solid #eee",
4843
+ paddingBottom: "4px"
4844
+ }
4845
+ }, "Driver #", selectedDriver.driverId.substring(0, 8), "... (Selected)"), /*#__PURE__*/React.createElement("div", {
4846
+ style: {
4847
+ marginBottom: "8px"
4848
+ }
4849
+ }, /*#__PURE__*/React.createElement(StatusBadge, {
4850
+ isOnline: selectedDriver.isOnline
4851
+ })), /*#__PURE__*/React.createElement("div", {
4852
+ style: {
4853
+ fontSize: isMobile ? "12px" : "13px"
4854
+ }
4855
+ }, /*#__PURE__*/React.createElement("div", {
4856
+ style: {
4857
+ marginBottom: "8px"
4858
+ }
4859
+ }, /*#__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", {
4860
+ style: {
4861
+ marginBottom: "8px"
4862
+ }
4863
+ }, /*#__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", {
4864
+ style: {
4865
+ display: "grid",
4866
+ gridTemplateColumns: "1fr 1fr",
4867
+ gap: "8px",
4868
+ background: "#f5f5f5",
4869
+ padding: "8px",
4870
+ borderRadius: "4px",
4871
+ marginTop: "8px"
4872
+ }
4873
+ }, 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", {
4874
+ style: {
4875
+ marginTop: "8px",
4876
+ color: "#666",
4877
+ fontSize: "10px"
4878
+ }
4879
+ }, "Last update: ", new Date(selectedDriver.lastUpdate).toLocaleString()))))), selectedDriver && selectedDriver.deliveryLat != null && selectedDriver.deliveryLng != null && /*#__PURE__*/React.createElement(Marker, {
4880
+ key: `dest-${selectedDriver.driverId}`,
4881
+ position: [Number(selectedDriver.deliveryLat), Number(selectedDriver.deliveryLng)],
4882
+ icon: destinationIcon
4883
+ }, /*#__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, {
4884
+ start: {
4885
+ lat: selectedDriver.lat,
4886
+ lng: selectedDriver.lng
4887
+ },
4888
+ end: {
4889
+ lat: selectedDriver.deliveryLat,
4890
+ lng: selectedDriver.deliveryLng
4891
+ },
4892
+ color: "#2196f3",
4893
+ weight: 6
4894
+ })), /*#__PURE__*/React.createElement("div", {
4895
+ style: {
4896
+ position: "absolute",
4897
+ top: isMobile ? "60px" : "20px",
4898
+ right: "10px",
4899
+ zIndex: 1000,
4900
+ background: "white",
4901
+ borderRadius: "8px",
4902
+ boxShadow: "0 2px 8px rgba(0, 0, 0, 0.15)",
4903
+ padding: "4px",
4904
+ display: "flex",
4905
+ flexDirection: isMobile ? "column" : "row",
4906
+ gap: "4px"
4907
+ }
4908
+ }, selectedDriver && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("button", {
4909
+ onClick: () => {
4910
+ if (selectedDriver !== null && selectedDriver !== void 0 && selectedDriver.lat && selectedDriver !== null && selectedDriver !== void 0 && selectedDriver.lng) {
4911
+ setMapCenter([selectedDriver.lat, selectedDriver.lng]);
4912
+ setMapZoom(15);
4913
+ }
4914
+ },
4915
+ style: {
4916
+ padding: isMobile ? "10px 12px" : "8px 16px",
4917
+ background: "#1a237e",
4918
+ color: "white",
4919
+ border: "none",
4920
+ borderRadius: "4px",
4921
+ cursor: "pointer",
4922
+ fontSize: isMobile ? "12px" : "14px",
4923
+ fontWeight: "500",
4924
+ whiteSpace: "nowrap"
4925
+ }
4926
+ }, "Center"), /*#__PURE__*/React.createElement("button", {
4927
+ onClick: () => setSelectedDriver(null),
4928
+ style: {
4929
+ padding: isMobile ? "10px 12px" : "8px 16px",
4930
+ background: "#f44336",
4931
+ color: "white",
4932
+ border: "none",
4933
+ borderRadius: "4px",
4934
+ cursor: "pointer",
4935
+ fontSize: isMobile ? "12px" : "14px",
4936
+ fontWeight: "500",
4937
+ whiteSpace: "nowrap"
4938
+ }
4939
+ }, "Clear")), !selectedDriver && /*#__PURE__*/React.createElement("div", {
4940
+ style: {
4941
+ padding: isMobile ? "10px 12px" : "8px 16px",
4942
+ background: "#f5f5f5",
4943
+ color: "#666",
4944
+ borderRadius: "4px",
4945
+ fontSize: isMobile ? "12px" : "14px"
4946
+ }
4947
+ }, isMobile ? "Select driver" : "Select a driver from the list")), selectedDriver && /*#__PURE__*/React.createElement("div", {
4948
+ style: {
4949
+ position: "absolute",
4950
+ bottom: isMobile ? "10px" : "20px",
4951
+ left: isMobile ? "10px" : "20px",
4952
+ right: isMobile ? "10px" : "auto",
4953
+ zIndex: 1000,
4954
+ background: "white",
4955
+ borderRadius: "8px",
4956
+ boxShadow: "0 4px 12px rgba(0,0,0,0.15)",
4957
+ padding: isMobile ? "12px" : "16px",
4958
+ maxWidth: isMobile ? "calc(100% - 20px)" : "300px",
4959
+ border: "2px solid #2196f3"
4960
+ }
4961
+ }, /*#__PURE__*/React.createElement("div", {
4962
+ style: {
4963
+ display: "flex",
4964
+ justifyContent: "space-between",
4965
+ alignItems: "center",
4966
+ marginBottom: "8px"
4967
+ }
4968
+ }, /*#__PURE__*/React.createElement("h4", {
4969
+ style: {
4970
+ margin: 0,
4971
+ color: "#1a237e",
4972
+ fontSize: isMobile ? "14px" : "16px"
4973
+ }
4974
+ }, "Selected Driver"), /*#__PURE__*/React.createElement("span", {
4975
+ style: {
4976
+ background: selectedDriver.isOnline ? "#4caf50" : "#f44336",
4977
+ color: "white",
4978
+ padding: "2px 8px",
4979
+ borderRadius: "12px",
4980
+ fontSize: isMobile ? "10px" : "11px",
4981
+ fontWeight: "bold"
4982
+ }
4983
+ }, selectedDriver.isOnline ? "ONLINE" : "OFFLINE")), /*#__PURE__*/React.createElement("div", {
4984
+ style: {
4985
+ fontSize: isMobile ? "12px" : "13px"
4986
+ }
4987
+ }, /*#__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())))));
4988
+ }
4989
+
4990
+ const Timeline = ({
4991
+ steps: _steps = [],
4992
+ currentStep: _currentStep = 1
4993
+ }) => {
4994
+ const {
4995
+ t
4996
+ } = useTranslation();
4997
+ return /*#__PURE__*/React.createElement("div", {
4998
+ className: "custom-stepper-card"
4999
+ }, _steps.map((label, index) => {
5000
+ const stepNumber = index + 1;
5001
+ const isActive = stepNumber === _currentStep;
5002
+ const isCompleted = stepNumber < _currentStep;
5003
+ return /*#__PURE__*/React.createElement("div", {
5004
+ className: "stepper-row-vendor",
5005
+ key: index
5006
+ }, /*#__PURE__*/React.createElement("div", {
5007
+ className: "stepper-left"
5008
+ }, /*#__PURE__*/React.createElement("div", {
5009
+ className: `step-circle
5010
+ ${isActive ? "active" : ""}
5011
+ ${isCompleted ? "completed" : ""}`
5012
+ }, isCompleted ? /*#__PURE__*/React.createElement(TickMark, {
5013
+ fillColor: "#fff"
5014
+ }) : stepNumber), index !== _steps.length - 1 && /*#__PURE__*/React.createElement("div", {
5015
+ className: `step-line ${isCompleted ? "completed-line" : ""}`
5016
+ })), /*#__PURE__*/React.createElement("div", {
5017
+ className: `step-label
5018
+ ${isActive ? "active-text" : ""}
5019
+ ${isCompleted ? "completed-text" : ""}`
5020
+ }, t(label)));
5021
+ }));
5022
+ };
5023
+
5024
+ const AddFillingPointMetaData = ({
5025
+ t,
5026
+ formData: _formData = {},
5027
+ onSelect,
5028
+ config: _config = {},
5029
+ visibleFields: _visibleFields = []
5030
+ }) => {
5031
+ const sectionKey = (_config === null || _config === void 0 ? void 0 : _config.key) || "metaData";
5032
+ const inputs = [{
5033
+ label: "WT_FILLING_POINT_NAME",
5034
+ name: "fillingPointName",
5035
+ isMandatory: true
5036
+ }, {
5037
+ label: "WT_EMERGENCY_NAME",
5038
+ name: "emergencyName"
5039
+ }, {
5040
+ label: "WT_AE_NAME",
5041
+ name: "aeName",
5042
+ validation: {
5043
+ pattern: "^[a-zA-Z]+( [a-zA-Z]+)*$"
5044
+ }
5045
+ }, {
5046
+ label: "WT_AE_MOBILE_NUMBER",
5047
+ name: "aeMobile",
5048
+ componentInFront: /*#__PURE__*/React.createElement("div", {
5049
+ className: "employee-card-input employee-card-input--front"
5050
+ }, "+91"),
5051
+ validation: {
5052
+ pattern: "[6-9]{1}[0-9]{9}",
5053
+ type: "tel",
5054
+ maxLength: 10
5055
+ }
5056
+ }, {
5057
+ label: "WT_AE_EMAIL_ID",
5058
+ name: "aeEmail",
5059
+ validation: {
5060
+ pattern: "^[a-zA-Z0-9._%+-]+@[a-z.-]+\\.(com|org|in)$"
5061
+ }
5062
+ }, {
5063
+ label: "WT_JE_NAME",
5064
+ name: "jeName",
5065
+ validation: {
5066
+ pattern: "^[a-zA-Z]+( [a-zA-Z]+)*$"
5067
+ }
5068
+ }, {
5069
+ label: "WT_JE_MOBILE_NUMBER",
5070
+ name: "jeMobile",
5071
+ componentInFront: /*#__PURE__*/React.createElement("div", {
5072
+ className: "employee-card-input employee-card-input--front"
5073
+ }, "+91"),
5074
+ validation: {
5075
+ pattern: "[6-9]{1}[0-9]{9}",
5076
+ type: "tel",
5077
+ maxLength: 10
5078
+ }
5079
+ }, {
5080
+ label: "WT_JE_EMAIL_ID",
5081
+ name: "jeEmail",
5082
+ validation: {
5083
+ pattern: "^[a-zA-Z0-9._%+-]+@[a-z.-]+\\.(com|org|in)$"
5084
+ }
5085
+ }, {
5086
+ label: "WT_EE_NAME",
5087
+ name: "eeName",
5088
+ validation: {
5089
+ pattern: "^[a-zA-Z]+( [a-zA-Z]+)*$"
5090
+ }
5091
+ }, {
5092
+ label: "WT_EE_MOBILE_NUMBER",
5093
+ name: "eeMobile",
5094
+ componentInFront: /*#__PURE__*/React.createElement("div", {
5095
+ className: "employee-card-input employee-card-input--front"
5096
+ }, "+91"),
5097
+ validation: {
5098
+ pattern: "[6-9]{1}[0-9]{9}",
5099
+ type: "tel",
5100
+ maxLength: 10
5101
+ }
5102
+ }, {
5103
+ label: "WT_EE_EMAIL_ID",
5104
+ name: "eeEmail",
5105
+ validation: {
5106
+ pattern: "^[a-zA-Z0-9._%+-]+@[a-z.-]+\\.(com|org|in)$"
5107
+ }
5108
+ }];
5109
+ const filteredInputs = _visibleFields && _visibleFields.length > 0 ? inputs.filter(input => _visibleFields.includes(input.name)) : inputs;
5110
+ const handleChange = (value, name) => {
5111
+ if (!onSelect) return;
5112
+ let newValue = value;
5113
+ if (["aeMobile", "jeMobile", "eeMobile", "alternateNumber"].includes(name)) {
5114
+ newValue = value.slice(0, 10).replace(/[^0-9]/g, "");
5115
+ }
5116
+ onSelect(sectionKey, {
5117
+ ...(_formData === null || _formData === void 0 ? void 0 : _formData[sectionKey]),
5118
+ [name]: newValue
5119
+ });
5120
+ };
5121
+ const isMobile = window.Digit.Utils.browser.isMobile();
5122
+ return /*#__PURE__*/React.createElement(Card, null, /*#__PURE__*/React.createElement("div", {
5123
+ style: {
5124
+ display: "grid",
5125
+ gridTemplateColumns: isMobile ? "1fr" : "1fr 1fr",
5126
+ gap: "16px"
5127
+ }
5128
+ }, filteredInputs.map(input => {
5129
+ var _formData$sectionKey, _input$validation;
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
+ maxLength: (_input$validation = input.validation) === null || _input$validation === void 0 ? void 0 : _input$validation.maxLength
5142
+ }, input.validation)))));
5143
+ })));
5144
+ };
5145
+
5146
+ const allOptions = [{
5147
+ name: "Correspondence",
5148
+ code: "CORRESPONDENCE",
5149
+ i18nKey: "COMMON_ADDRESS_TYPE_CORRESPONDENCE"
5150
+ }, {
5151
+ name: "Permanent",
5152
+ code: "PERMANENT",
5153
+ i18nKey: "COMMON_ADDRESS_TYPE_PERMANENT"
5154
+ }, {
5155
+ name: "Other",
5156
+ code: "OTHER",
5157
+ i18nKey: "COMMON_ADDRESS_TYPE_OTHER"
5158
+ }];
5159
+ const AddFixFillAddress = ({
5160
+ t,
5161
+ config,
5162
+ formData,
5163
+ onSelect,
5164
+ isEdit,
5165
+ userDetails
5166
+ }) => {
5167
+ 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;
5168
+ const {
5169
+ data: allCities
5170
+ } = Digit.Hooks.useTenants();
5171
+ const {
5172
+ control
5173
+ } = useForm();
5174
+ const location = useLocation();
5175
+ const usedAddressTypes = ((_location$state = location.state) === null || _location$state === void 0 ? void 0 : _location$state.usedAddressTypes) || [];
5176
+ const user = Digit.UserService.getUser().info;
5177
+ 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) || "");
5178
+ 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);
5179
+ 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);
5180
+ 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) || "");
5181
+ 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) || "");
5182
+ 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) || "");
5183
+ 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) || "");
5184
+ 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) || "");
5185
+ 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);
5186
+ 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) || "");
5187
+ 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) || "");
5188
+ const [selectedAddress, setSelectedAddress] = useState("");
5189
+ const isInitialized = useRef(false);
5190
+ const lastSyncedAddress = useRef(null);
5191
+ const lastBookingId = useRef(null);
5192
+ const availableAddressTypeOptions = useMemo(() => {
5193
+ if (usedAddressTypes.length === 3) {
5194
+ return allOptions.filter(opt => opt.code === "OTHER");
5195
+ }
5196
+ return allOptions.filter(opt => !usedAddressTypes.includes(opt.code));
5197
+ }, [usedAddressTypes]);
5198
+ const {
5199
+ data: fetchedLocalities
5200
+ } = Digit.Hooks.useBoundaryLocalities(city === null || city === void 0 ? void 0 : city.code, "revenue", {
5201
+ enabled: !!city
5202
+ }, t);
5203
+ const structuredLocality = (fetchedLocalities === null || fetchedLocalities === void 0 ? void 0 : fetchedLocalities.map(local => ({
5204
+ i18nKey: local.i18nkey,
5205
+ code: local.code,
5206
+ label: local.label
5207
+ }))) || [];
5208
+ useEffect(() => {
5209
+ if (formData !== null && formData !== void 0 && formData.bookingId && lastBookingId.current !== formData.bookingId) {
5210
+ isInitialized.current = false;
5211
+ lastBookingId.current = formData.bookingId;
5212
+ }
5213
+ if (formData !== null && formData !== void 0 && formData.address && !isInitialized.current && allCities && (fetchedLocalities || !formData.address.cityCode)) {
5214
+ const addressData = formData.address;
5215
+ const cityObj = allCities.find(c => c.code === addressData.cityCode || c.code === addressData.city || c.name === addressData.city) || addressData.city;
5216
+ setPincode(addressData.pincode || "");
5217
+ setCity(cityObj || null);
5218
+ setHouseNo(addressData.houseNo || "");
5219
+ setStreetName(addressData.streetName || "");
5220
+ setLandmark(addressData.landmark || "");
5221
+ setAddressLine1(addressData.addressLine1 || "");
5222
+ setAddressLine2(addressData.addressLine2 || "");
5223
+ setAddressType(allOptions.find(a => a.code === addressData.addressType) || addressData.addressType || null);
5224
+ setLatitude(addressData.latitude || "");
5225
+ setLongitude(addressData.longitude || "");
5226
+ if (fetchedLocalities) {
5227
+ const localityObj = fetchedLocalities.find(l => l.code === addressData.localityCode || l.code === addressData.locality || l.i18nkey === addressData.locality);
5228
+ setLocality(localityObj || addressData.locality || null);
5229
+ } else {
5230
+ setLocality(addressData.locality || null);
5231
+ }
5232
+ isInitialized.current = true;
5233
+ lastSyncedAddress.current = JSON.stringify(addressData);
5234
+ }
5235
+ }, [formData === null || formData === void 0 ? void 0 : formData.address, allCities, fetchedLocalities]);
5236
+ useEffect(() => {
5237
+ if (!navigator.geolocation) return;
5238
+ navigator.geolocation.getCurrentPosition(pos => {
5239
+ setLatitude(pos.coords.latitude);
5240
+ setLongitude(pos.coords.longitude);
5241
+ }, () => console.log("Location blocked"));
5242
+ }, []);
5243
+ useEffect(() => {
5244
+ if (selectedAddress && Object.keys(selectedAddress).length) {
5245
+ setPincode(selectedAddress.pinCode);
5246
+ setCity(allCities === null || allCities === void 0 ? void 0 : allCities.find(c => c.name === selectedAddress.city));
5247
+ setLocality(fetchedLocalities === null || fetchedLocalities === void 0 ? void 0 : fetchedLocalities.find(l => l.i18nkey === selectedAddress.locality));
5248
+ setHouseNo(selectedAddress.houseNumber);
5249
+ setStreetName(selectedAddress.streetName);
5250
+ setLandmark(selectedAddress.landmark);
5251
+ setAddressLine1(selectedAddress.address);
5252
+ setAddressLine2(selectedAddress.address2);
5253
+ setLatitude(selectedAddress.latitude);
5254
+ setLongitude(selectedAddress.longitude);
5255
+ setAddressType(allOptions.find(a => a.code === selectedAddress.addressType));
5256
+ }
5257
+ }, [selectedAddress]);
5258
+ useEffect(() => {
5259
+ if (!onSelect) return;
5260
+ const currentAddress = {
5261
+ pincode: pincode || "",
5262
+ city: (city === null || city === void 0 ? void 0 : city.code) || city || null,
5263
+ locality: (locality === null || locality === void 0 ? void 0 : locality.code) || locality || null,
5264
+ houseNo: houseNo || "",
5265
+ landmark: landmark || "",
5266
+ addressLine1: addressLine1 || "",
5267
+ addressLine2: addressLine2 || "",
5268
+ streetName: streetName || "",
5269
+ addressType: (addressType === null || addressType === void 0 ? void 0 : addressType.code) || addressType || null,
5270
+ latitude: latitude || "",
5271
+ longitude: longitude || ""
5272
+ };
5273
+ const addressString = JSON.stringify(currentAddress);
5274
+ if (lastSyncedAddress.current !== addressString) {
5275
+ lastSyncedAddress.current = addressString;
5276
+ onSelect((config === null || config === void 0 ? void 0 : config.key) || "address", currentAddress);
5277
+ }
5278
+ }, [pincode, city, locality, houseNo, landmark, addressLine1, addressLine2, streetName, addressType, latitude, longitude]);
5279
+ return /*#__PURE__*/React.createElement(FormStep, {
5280
+ config: config,
5281
+ t: t,
5282
+ isDisabled: !houseNo || !city || !locality || !pincode || !addressLine1 || !streetName || !addressLine2
5283
+ }, (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", {
5284
+ style: {
5285
+ gridColumn: "span 2"
5286
+ }
5287
+ }, /*#__PURE__*/React.createElement(CardLabel, null, t("COMMON_ADDRESS_TYPE")), /*#__PURE__*/React.createElement(Dropdown, {
5288
+ selected: selectedAddress,
5289
+ select: setSelectedAddress,
5290
+ option: userDetails.addresses,
5291
+ optionKey: "address",
5292
+ t: t,
5293
+ style: {
5294
+ width: "100%"
5295
+ }
5296
+ })), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, null, t("COMMON_ADDRESS_TYPE")), /*#__PURE__*/React.createElement(Dropdown, {
5297
+ selected: addressType,
5298
+ select: setAddressType,
5299
+ option: availableAddressTypeOptions,
5300
+ optionKey: "i18nKey",
5301
+ t: t,
5302
+ style: {
5303
+ width: "100%"
5304
+ }
5305
+ })), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, null, t("HOUSE_NO")), /*#__PURE__*/React.createElement(TextInput, {
5306
+ value: houseNo,
5307
+ onChange: e => setHouseNo(e.target.value)
5308
+ })), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, null, t("STREET_NAME")), /*#__PURE__*/React.createElement(TextInput, {
5309
+ value: streetName,
5310
+ onChange: e => setStreetName(e.target.value)
5311
+ })), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, null, t("ADDRESS_LINE1")), /*#__PURE__*/React.createElement(TextInput, {
5312
+ value: addressLine1,
5313
+ onChange: e => setAddressLine1(e.target.value)
5314
+ })), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, null, t("ADDRESS_LINE2")), /*#__PURE__*/React.createElement(TextInput, {
5315
+ value: addressLine2,
5316
+ onChange: e => setAddressLine2(e.target.value)
5317
+ })), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, null, t("LANDMARK")), /*#__PURE__*/React.createElement(TextInput, {
5318
+ value: landmark,
5319
+ onChange: e => setLandmark(e.target.value)
5320
+ })), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, null, t("CITY")), /*#__PURE__*/React.createElement(Controller, {
5321
+ control: control,
5322
+ name: "city",
5323
+ render: () => /*#__PURE__*/React.createElement(Dropdown, {
5324
+ selected: city,
5325
+ select: setCity,
5326
+ option: allCities,
5327
+ optionKey: "i18nKey",
5328
+ t: t
5329
+ })
5330
+ })), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, null, t("LOCALITY")), /*#__PURE__*/React.createElement(Controller, {
5331
+ control: control,
5332
+ name: "locality",
5333
+ render: () => /*#__PURE__*/React.createElement(Dropdown, {
5334
+ selected: locality,
5335
+ select: setLocality,
5336
+ option: structuredLocality,
5337
+ optionKey: "i18nKey",
5338
+ t: t
5339
+ })
5340
+ })), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, null, t("LATITUDE")), /*#__PURE__*/React.createElement(TextInput, {
5341
+ value: latitude,
5342
+ onChange: e => setLatitude(e.target.value)
5343
+ })), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, null, t("LONGITUDE")), /*#__PURE__*/React.createElement(TextInput, {
5344
+ value: longitude,
5345
+ onChange: e => setLongitude(e.target.value)
5346
+ })), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, null, t("PINCODE")), /*#__PURE__*/React.createElement(TextInput, {
5347
+ value: pincode,
5348
+ onChange: e => setPincode(e.target.value),
5349
+ maxLength: 6
5350
+ })));
5351
+ };
5352
+
5353
+ const AddFillingPointAddress = () => {
5354
+ const {
5355
+ t
5356
+ } = useTranslation();
5357
+ const location = useLocation();
5358
+ const queryParams = new URLSearchParams(location.search);
5359
+ const editId = queryParams.get("id");
5360
+ const [formData, setFormData] = useState({});
5361
+ const [showToast, setShowToast] = useState(null);
5362
+ const tenantId = Digit.ULBService.getCurrentTenantId();
5363
+ const addressConfig = {
5364
+ key: "address"
5365
+ };
5366
+ const {
5367
+ isLoading: isEditLoading,
5368
+ data: editData
5369
+ } = Digit.Hooks.wt.useTankerSearchAPI({
5370
+ tenantId,
5371
+ filters: {
5372
+ bookingId: editId
5373
+ }
5374
+ }, {
5375
+ enabled: !!editId
5376
+ });
5377
+ const handleSelect = (key, data) => {
5378
+ setFormData(prev => ({
5379
+ ...prev,
5380
+ [key]: {
5381
+ ...(prev[key] || {}),
5382
+ ...data
5383
+ }
5384
+ }));
5385
+ };
5386
+ useEffect(() => {
5387
+ if (editId && editData !== null && editData !== void 0 && editData.waterTankerBookingDetail) {
5388
+ const data = editData.waterTankerBookingDetail.find(item => item.bookingId === editId);
5389
+ if (data) {
5390
+ var _data$fillingpointmet, _data$fillingpointmet2, _data$fillingpointmet3, _data$fillingpointmet4, _data$fillingpointmet5, _data$fillingpointmet6, _data$fillingpointmet7, _data$fillingpointmet8, _data$fillingpointmet9, _data$fillingpointmet0, _data$fillingpointmet1, _data$fillingpointmet10, _data$fillingpointmet11, _data$fillingpointmet12, _data$fillingpointmet13, _data$fillingpointmet14, _data$fillingpointmet15, _data$fillingpointmet16;
5391
+ setFormData({
5392
+ owner: {
5393
+ fillingPointName: ((_data$fillingpointmet = data.fillingpointmetadata) === null || _data$fillingpointmet === void 0 ? void 0 : _data$fillingpointmet.fillingPointName) || ((_data$fillingpointmet2 = data.fillingpointmetadata) === null || _data$fillingpointmet2 === void 0 ? void 0 : _data$fillingpointmet2.name),
5394
+ emergencyName: (_data$fillingpointmet3 = data.fillingpointmetadata) === null || _data$fillingpointmet3 === void 0 ? void 0 : _data$fillingpointmet3.emergencyName,
5395
+ aeName: (_data$fillingpointmet4 = data.fillingpointmetadata) === null || _data$fillingpointmet4 === void 0 ? void 0 : _data$fillingpointmet4.aeName,
5396
+ aeMobile: ((_data$fillingpointmet5 = data.fillingpointmetadata) === null || _data$fillingpointmet5 === void 0 ? void 0 : _data$fillingpointmet5.aeMobile) || ((_data$fillingpointmet6 = data.fillingpointmetadata) === null || _data$fillingpointmet6 === void 0 ? void 0 : _data$fillingpointmet6.mobileNumber),
5397
+ aeEmail: ((_data$fillingpointmet7 = data.fillingpointmetadata) === null || _data$fillingpointmet7 === void 0 ? void 0 : _data$fillingpointmet7.aeEmail) || ((_data$fillingpointmet8 = data.fillingpointmetadata) === null || _data$fillingpointmet8 === void 0 ? void 0 : _data$fillingpointmet8.emailId),
5398
+ jeName: (_data$fillingpointmet9 = data.fillingpointmetadata) === null || _data$fillingpointmet9 === void 0 ? void 0 : _data$fillingpointmet9.jeName,
5399
+ jeMobile: ((_data$fillingpointmet0 = data.fillingpointmetadata) === null || _data$fillingpointmet0 === void 0 ? void 0 : _data$fillingpointmet0.jeMobile) || ((_data$fillingpointmet1 = data.fillingpointmetadata) === null || _data$fillingpointmet1 === void 0 ? void 0 : _data$fillingpointmet1.jeMobileNumber),
5400
+ jeEmail: ((_data$fillingpointmet10 = data.fillingpointmetadata) === null || _data$fillingpointmet10 === void 0 ? void 0 : _data$fillingpointmet10.jeEmail) || ((_data$fillingpointmet11 = data.fillingpointmetadata) === null || _data$fillingpointmet11 === void 0 ? void 0 : _data$fillingpointmet11.jeEmailId),
5401
+ eeName: (_data$fillingpointmet12 = data.fillingpointmetadata) === null || _data$fillingpointmet12 === void 0 ? void 0 : _data$fillingpointmet12.eeName,
5402
+ eeMobile: ((_data$fillingpointmet13 = data.fillingpointmetadata) === null || _data$fillingpointmet13 === void 0 ? void 0 : _data$fillingpointmet13.eeMobile) || ((_data$fillingpointmet14 = data.fillingpointmetadata) === null || _data$fillingpointmet14 === void 0 ? void 0 : _data$fillingpointmet14.eeMobileNumber),
5403
+ eeEmail: ((_data$fillingpointmet15 = data.fillingpointmetadata) === null || _data$fillingpointmet15 === void 0 ? void 0 : _data$fillingpointmet15.eeEmail) || ((_data$fillingpointmet16 = data.fillingpointmetadata) === null || _data$fillingpointmet16 === void 0 ? void 0 : _data$fillingpointmet16.eeEmailId)
5404
+ },
5405
+ address: {
5406
+ ...data.address
5407
+ },
5408
+ bookingId: data.bookingId,
5409
+ auditDetails: data.auditDetails
5410
+ });
5411
+ }
5412
+ }
5413
+ }, [editData, editId]);
5414
+ const onSelect = (key, data) => {
5415
+ setFormData(prev => ({
5416
+ ...prev,
5417
+ [key]: data
5418
+ }));
5419
+ };
5420
+ const steps = ["WT_FILLING_POINT"];
5421
+ const {
5422
+ mutate: createFillingPoint
5423
+ } = Digit.Hooks.wt.useCreateFillPoint(tenantId);
5424
+ const {
5425
+ mutate: updateFillingPoint
5426
+ } = Digit.Hooks.wt.useUpdateFillPoint(tenantId);
5427
+ const handleSubmit = e => {
5428
+ if (e && e.preventDefault) e.preventDefault();
5429
+ const payload = fillingPointPayload({
5430
+ ...formData,
5431
+ tenantId
5432
+ });
5433
+ const mutation = editId ? updateFillingPoint : createFillingPoint;
5434
+ mutation(payload, {
5435
+ onSuccess: () => {
5436
+ setShowToast({
5437
+ label: editId ? t("WT_FILLING_POINT_UPDATED_SUCCESS") : t("WT_FILLING_POINT_CREATED_SUCCESS")
5438
+ });
5439
+ setTimeout(() => setShowToast(null), 5000);
5440
+ },
5441
+ onError: error => {
5442
+ var _error$response, _error$response$data, _error$response$data$, _error$response$data$2;
5443
+ setShowToast({
5444
+ 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")),
5445
+ isError: true
5446
+ });
5447
+ setTimeout(() => setShowToast(null), 5000);
5448
+ }
5449
+ });
5450
+ };
5451
+ const isMobile = window.Digit.Utils.browser.isMobile();
5452
+ if (isEditLoading) return /*#__PURE__*/React.createElement(Loader, null);
5453
+ return /*#__PURE__*/React.createElement("div", {
5454
+ style: {
5455
+ display: "flex",
5456
+ gap: "24px",
5457
+ flexDirection: isMobile ? "column" : "row"
5458
+ }
5459
+ }, /*#__PURE__*/React.createElement(Timeline, {
5460
+ steps: steps,
5461
+ currentStep: 1
5462
+ }), /*#__PURE__*/React.createElement("div", {
5463
+ style: {
5464
+ flex: 1,
5465
+ marginLeft: isMobile ? "0px" : "24px"
5466
+ }
5467
+ }, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(AddFillingPointMetaData, {
5468
+ t: t,
5469
+ config: {
5470
+ key: "owner"
5471
+ },
5472
+ onSelect: onSelect,
5473
+ formData: formData,
5474
+ visibleFields: ["fillingPointName", "emergencyName", "aeName", "aeMobile", "aeEmail", "jeName", "jeMobile", "jeEmail", "eeName", "eeMobile", "eeEmail"]
5475
+ }), /*#__PURE__*/React.createElement(AddFixFillAddress, {
5476
+ t: t,
5477
+ config: addressConfig,
5478
+ onSelect: handleSelect,
5479
+ formData: formData
5480
+ }), /*#__PURE__*/React.createElement("div", {
5481
+ style: {
5482
+ display: "flex",
5483
+ marginBottom: "24px",
5484
+ justifyContent: isMobile ? "center" : "flex-end"
5485
+ }
5486
+ }, /*#__PURE__*/React.createElement(SubmitBar, {
5487
+ label: editId ? t("ES_COMMON_UPDATE") : t("ES_COMMON_SAVE_NEXT"),
5488
+ onSubmit: handleSubmit
5489
+ }))), showToast && /*#__PURE__*/React.createElement(Toast, {
5490
+ error: showToast.isError,
5491
+ label: showToast.label,
5492
+ onClose: () => setShowToast(null)
5493
+ })));
5494
+ };
5495
+
5496
+ const AddFixPointAddress = () => {
5497
+ var _formData$owner, _formData$owner2, _formData$owner3, _formData$owner4;
5498
+ const {
5499
+ t
5500
+ } = useTranslation();
5501
+ const location = useLocation();
5502
+ const history = useHistory();
5503
+ const queryClient = useQueryClient();
5504
+ const queryParams = new URLSearchParams(location.search);
5505
+ const editId = queryParams.get("id");
5506
+ const [formData, setFormData] = useState({});
5507
+ const [showToast, setShowToast] = useState(null);
5508
+ const tenantId = Digit.ULBService.getCurrentTenantId();
5509
+ const {
5510
+ isLoading: isEditLoading,
5511
+ data: editData
5512
+ } = Digit.Hooks.wt.useFixedPointSearchAPI({
5513
+ tenantId,
5514
+ filters: {
5515
+ bookingId: editId
5516
+ }
5517
+ }, {
5518
+ enabled: !!editId
5519
+ });
5520
+ useEffect(() => {
5521
+ console.log("Edit ID:", editId);
5522
+ console.log("Search Result:", editData);
5523
+ if (editId && editData !== null && editData !== void 0 && editData.waterTankerBookingDetail) {
5524
+ const data = editData.waterTankerBookingDetail.find(item => item.bookingId === editId);
5525
+ if (data) {
5526
+ var _data$applicantDetail, _data$applicantDetail2, _data$applicantDetail3, _data$applicantDetail4;
5527
+ setFormData({
5528
+ owner: {
5529
+ name: (_data$applicantDetail = data.applicantDetail) === null || _data$applicantDetail === void 0 ? void 0 : _data$applicantDetail.name,
5530
+ mobileNumber: (_data$applicantDetail2 = data.applicantDetail) === null || _data$applicantDetail2 === void 0 ? void 0 : _data$applicantDetail2.mobileNumber,
5531
+ alternateNumber: (_data$applicantDetail3 = data.applicantDetail) === null || _data$applicantDetail3 === void 0 ? void 0 : _data$applicantDetail3.alternateNumber,
5532
+ emailId: (_data$applicantDetail4 = data.applicantDetail) === null || _data$applicantDetail4 === void 0 ? void 0 : _data$applicantDetail4.emailId
5533
+ },
5534
+ address: {
5535
+ ...data.address
5536
+ },
5537
+ bookingId: data.bookingId,
5538
+ auditDetails: data.auditDetails
5539
+ });
5540
+ }
5541
+ }
5542
+ }, [editData, editId]);
5543
+ const addressConfig = {
5544
+ key: "address"
5545
+ };
5546
+ const handleSelect = (key, data) => {
5547
+ setFormData(prev => ({
5548
+ ...prev,
5549
+ [key]: {
5550
+ ...(prev[key] || {}),
5551
+ ...data
5552
+ }
5553
+ }));
5554
+ };
5555
+ const {
5556
+ mutate: createFixedPoint
5557
+ } = Digit.Hooks.wt.useCreateFixedPoint(tenantId);
5558
+ const {
5559
+ mutate: updateFixedPoint
5560
+ } = Digit.Hooks.wt.useUpdateFixedPoint(tenantId);
5561
+ const handleSubmit = e => {
5562
+ const payload = fixedPointPayload({
5563
+ ...formData,
5564
+ tenantId
5565
+ });
5566
+ const mutation = editId ? updateFixedPoint : createFixedPoint;
5567
+ mutation(payload, {
5568
+ onSuccess: () => {
5569
+ setShowToast({
5570
+ label: editId ? t("WT_FILLING_POINT_UPDATED_SUCCESS") : t("WT_FILLING_POINT_CREATED_SUCCESS")
5571
+ });
5572
+ queryClient.invalidateQueries("wtFixedPointSearchList");
5573
+ setTimeout(() => {
5574
+ setShowToast(null);
5575
+ history.push("/digit-ui/employee/wt/search-filling-fix-point");
5576
+ }, 3000);
5577
+ },
5578
+ onError: error => {
5579
+ var _error$response, _error$response$data, _error$response$data$, _error$response$data$2;
5580
+ setShowToast({
5581
+ 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")),
5582
+ isError: true
5583
+ });
5584
+ setTimeout(() => setShowToast(null), 5000);
5585
+ }
5586
+ });
5587
+ };
5588
+ const isMobile = window.Digit.Utils.browser.isMobile();
5589
+ if (isEditLoading) return /*#__PURE__*/React.createElement(Loader, null);
5590
+ return /*#__PURE__*/React.createElement("div", {
5591
+ style: {
5592
+ display: "flex",
5593
+ flexDirection: isMobile ? "column" : "row"
5594
+ }
5595
+ }, /*#__PURE__*/React.createElement(Timeline, {
5596
+ steps: ["WT_FIXED_POINT"],
5597
+ currentStep: 1
5598
+ }), /*#__PURE__*/React.createElement("div", {
5599
+ style: {
5600
+ flex: 1,
5601
+ marginLeft: isMobile ? "0px" : "24px"
5602
+ }
5603
+ }, /*#__PURE__*/React.createElement(Card, null, /*#__PURE__*/React.createElement("div", {
5604
+ style: {
5605
+ display: "grid",
5606
+ gridTemplateColumns: isMobile ? "1fr" : "1fr 1fr",
5607
+ columnGap: "32px",
5608
+ rowGap: "8px"
5609
+ }
5610
+ }, /*#__PURE__*/React.createElement("div", {
5611
+ style: {
5612
+ display: "flex",
5613
+ flexDirection: "column"
5614
+ }
5615
+ }, /*#__PURE__*/React.createElement(CardLabel, null, `${t("COMMON_APPLICANT_NAME")}`, " ", /*#__PURE__*/React.createElement("span", {
5616
+ className: "astericColor"
5617
+ }, "*")), /*#__PURE__*/React.createElement(TextInput, {
5618
+ t: t,
5619
+ type: "text",
5620
+ isMandatory: true,
5621
+ name: "name",
5622
+ value: formData === null || formData === void 0 ? void 0 : (_formData$owner = formData.owner) === null || _formData$owner === void 0 ? void 0 : _formData$owner.name,
5623
+ style: {
5624
+ width: "100%"
5625
+ },
5626
+ onChange: e => handleSelect("owner", {
5627
+ name: e.target.value
5628
+ })
5629
+ })), /*#__PURE__*/React.createElement("div", {
5630
+ style: {
5631
+ display: "flex",
5632
+ flexDirection: "column"
5633
+ }
5634
+ }, /*#__PURE__*/React.createElement(CardLabel, null, `${t("COMMON_MOBILE_NUMBER")}`, " ", /*#__PURE__*/React.createElement("span", {
5635
+ className: "astericColor"
5636
+ }, "*")), /*#__PURE__*/React.createElement(MobileNumber, {
5637
+ value: formData === null || formData === void 0 ? void 0 : (_formData$owner2 = formData.owner) === null || _formData$owner2 === void 0 ? void 0 : _formData$owner2.mobileNumber,
5638
+ name: "mobileNumber",
5639
+ onChange: value => handleSelect("owner", {
5640
+ mobileNumber: value
5641
+ }),
5642
+ style: {
5643
+ width: "100%"
5644
+ }
5645
+ })), /*#__PURE__*/React.createElement("div", {
5646
+ style: {
5647
+ display: "flex",
5648
+ flexDirection: "column"
5649
+ }
5650
+ }, /*#__PURE__*/React.createElement(CardLabel, null, `${t("COMMON_ALT_MOBILE_NUMBER")}`), /*#__PURE__*/React.createElement(MobileNumber, {
5651
+ value: formData === null || formData === void 0 ? void 0 : (_formData$owner3 = formData.owner) === null || _formData$owner3 === void 0 ? void 0 : _formData$owner3.alternateNumber,
5652
+ name: "alternateNumber",
5653
+ onChange: value => handleSelect("owner", {
5654
+ alternateNumber: value
5655
+ }),
5656
+ style: {
5657
+ width: "100%"
5658
+ }
5659
+ })), /*#__PURE__*/React.createElement("div", {
5660
+ style: {
5661
+ display: "flex",
5662
+ flexDirection: "column"
5663
+ }
5664
+ }, /*#__PURE__*/React.createElement(CardLabel, null, `${t("COMMON_EMAIL_ID")}`, " ", /*#__PURE__*/React.createElement("span", {
5665
+ className: "astericColor"
5666
+ }, "*")), /*#__PURE__*/React.createElement(TextInput, {
5667
+ t: t,
5668
+ type: "email",
5669
+ isMandatory: true,
5670
+ name: "emailId",
5671
+ value: formData === null || formData === void 0 ? void 0 : (_formData$owner4 = formData.owner) === null || _formData$owner4 === void 0 ? void 0 : _formData$owner4.emailId,
5672
+ style: {
5673
+ width: "100%"
5674
+ },
5675
+ onChange: e => handleSelect("owner", {
5676
+ emailId: e.target.value
5677
+ })
5678
+ })))), /*#__PURE__*/React.createElement(AddFixFillAddress, {
5679
+ t: t,
5680
+ config: addressConfig,
5681
+ onSelect: handleSelect,
5682
+ formData: formData
5683
+ }), /*#__PURE__*/React.createElement("div", {
5684
+ style: {
5685
+ display: "flex",
5686
+ marginBottom: "24px",
5687
+ justifyContent: isMobile ? "center" : "flex-end"
5688
+ }
5689
+ }, /*#__PURE__*/React.createElement(SubmitBar, {
5690
+ label: editId ? t("ES_COMMON_UPDATE") : t("ES_COMMON_SAVE"),
5691
+ onSubmit: handleSubmit
5692
+ }))), showToast && /*#__PURE__*/React.createElement(Toast, {
5693
+ error: showToast.isError,
5694
+ label: showToast.label,
5695
+ onClose: () => setShowToast(null)
5696
+ }));
5697
+ };
5698
+
5699
+ const SearchFillingPointAddress = () => {
5700
+ const {
5701
+ t
5702
+ } = useTranslation();
5703
+ const history = useHistory();
5704
+ const [selectedTab, setSelectedTab] = useState("FIXED_POINT");
5705
+ const [showAddMenu, setShowAddMenu] = useState(false);
5706
+ const [searchValue, setSearchValue] = useState("");
5707
+ const [mobileNumber, setMobileNumber] = useState("");
5708
+ const [status, setStatus] = useState(null);
5709
+ const [searchParams, setSearchParams] = useState({});
5710
+ const tenantId = Digit.ULBService.getCurrentTenantId();
5711
+ const {
5712
+ isLoading: isFixedLoading,
5713
+ data: fixedPointData,
5714
+ refetch: refetchFixed
5715
+ } = Digit.Hooks.wt.useFixedPointSearchAPI({
5716
+ tenantId,
5717
+ filters: searchParams
5718
+ }, {
5719
+ enabled: selectedTab === "FIXED_POINT"
5720
+ });
5721
+ const {
5722
+ isLoading: isFillingLoading,
5723
+ data: fillingPointData,
5724
+ refetch: refetchFilling
5725
+ } = Digit.Hooks.wt.useTankerSearchAPI({
5726
+ tenantId,
5727
+ filters: searchParams
5728
+ }, {
5729
+ enabled: selectedTab === "FILLING_POINT"
5730
+ });
5731
+ const isLoading = selectedTab === "FIXED_POINT" ? isFixedLoading : isFillingLoading;
5732
+ const tableData = (selectedTab === "FIXED_POINT" ? fixedPointData === null || fixedPointData === void 0 ? void 0 : fixedPointData.waterTankerBookingDetail : fillingPointData === null || fillingPointData === void 0 ? void 0 : fillingPointData.waterTankerBookingDetail) || [];
5733
+ const searchConfig = {
5734
+ FIXED_POINT: {
5735
+ label: "WT_FIXED_POINT_NAME",
5736
+ placeholder: "WT_ENTER_FIXED_POINT_NAME"
5737
+ },
5738
+ FILLING_POINT: {
5739
+ label: "WT_FILLING_POINT_NAME",
5740
+ placeholder: "WT_ENTER_FILLING_POINT_NAME"
5741
+ }
5742
+ };
5743
+ const statusOptions = [{
5744
+ i18nKey: "WT_BOOKING_CREATED",
5745
+ code: "BOOKING_CREATED"
5746
+ }, {
5747
+ i18nKey: "WT_BOOKING_APPROVED",
5748
+ code: "APPROVED"
5749
+ }, {
5750
+ i18nKey: "WT_TANKER_DELIVERED",
5751
+ code: "TANKER_DELIVERED"
5752
+ }, {
5753
+ i18nKey: "WT_ASSIGN_VENDOR",
5754
+ code: "ASSIGN_VENDOR"
5755
+ }, {
5756
+ i18nKey: "WT_BOOKING_REJECTED",
5757
+ code: "REJECT"
5758
+ }];
5759
+ const {
5760
+ label,
5761
+ placeholder
5762
+ } = searchConfig[selectedTab];
5763
+ const clearSearch = () => {
5764
+ setSearchValue("");
5765
+ setMobileNumber("");
5766
+ setStatus(null);
5767
+ setSearchParams({});
5768
+ };
5769
+ const onTabChange = tab => {
5770
+ setSelectedTab(tab);
5771
+ clearSearch();
5772
+ };
5773
+ const onAddClick = () => {
5774
+ setShowAddMenu(prev => !prev);
5775
+ };
5776
+ const onActionSelect = option => {
5777
+ if (option === "FILLING_POINT") {
5778
+ history.push(`/digit-ui/employee/wt/add-filling-point-address`);
5779
+ } else if (option === "FIXED_POINT") {
5780
+ history.push(`/digit-ui/employee/wt/add-fix-point-address`);
5781
+ }
5782
+ setShowAddMenu(false);
5783
+ };
5784
+ const onSearch = () => {
5785
+ setSearchParams({
5786
+ name: searchValue,
5787
+ mobileNumber: mobileNumber,
5788
+ status: status === null || status === void 0 ? void 0 : status.code
5789
+ });
5790
+ };
5791
+ const columns = React.useMemo(() => {
5792
+ if (selectedTab === "FIXED_POINT") {
5793
+ return [{
5794
+ Header: t("WT_APPLICANT_NAME"),
5795
+ accessor: row => {
5796
+ var _row$applicantDetail;
5797
+ return (row === null || row === void 0 ? void 0 : (_row$applicantDetail = row.applicantDetail) === null || _row$applicantDetail === void 0 ? void 0 : _row$applicantDetail.name) || "NA";
5798
+ },
5799
+ id: "applicantName",
5800
+ Cell: ({
5801
+ row
5802
+ }) => {
5803
+ var _row$original$applica;
5804
+ return /*#__PURE__*/React.createElement("span", {
5805
+ className: "link"
5806
+ }, /*#__PURE__*/React.createElement(Link, {
5807
+ to: `/digit-ui/employee/wt/add-fix-point-address?id=${row.original.bookingId}`
5808
+ }, ((_row$original$applica = row.original.applicantDetail) === null || _row$original$applica === void 0 ? void 0 : _row$original$applica.name) || "NA"));
5809
+ }
5810
+ }, {
5811
+ Header: t("WT_MOBILE_NUMBER"),
5812
+ accessor: row => {
5813
+ var _row$applicantDetail2;
5814
+ return (row === null || row === void 0 ? void 0 : (_row$applicantDetail2 = row.applicantDetail) === null || _row$applicantDetail2 === void 0 ? void 0 : _row$applicantDetail2.mobileNumber) || "NA";
5815
+ },
5816
+ id: "mobileNumber"
5817
+ }, {
5818
+ Header: t("WT_LOCALITY"),
5819
+ accessor: row => {
5820
+ var _row$address;
5821
+ return (row === null || row === void 0 ? void 0 : (_row$address = row.address) === null || _row$address === void 0 ? void 0 : _row$address.locality) || "NA";
5822
+ },
5823
+ id: "locality"
5824
+ }];
5825
+ } else {
5826
+ return [{
5827
+ Header: t("WT_FILLING_POINT_NAME"),
5828
+ accessor: row => {
5829
+ var _row$fillingpointmeta;
5830
+ return (row === null || row === void 0 ? void 0 : (_row$fillingpointmeta = row.fillingpointmetadata) === null || _row$fillingpointmeta === void 0 ? void 0 : _row$fillingpointmeta.name) || "NA";
5831
+ },
5832
+ id: "fillingPointName",
5833
+ Cell: ({
5834
+ row
5835
+ }) => {
5836
+ var _row$original$filling;
5837
+ return /*#__PURE__*/React.createElement("span", {
5838
+ className: "link"
5839
+ }, /*#__PURE__*/React.createElement(Link, {
5840
+ to: `/digit-ui/employee/wt/add-filling-point-address?id=${row.original.bookingId}`
5841
+ }, ((_row$original$filling = row.original.fillingpointmetadata) === null || _row$original$filling === void 0 ? void 0 : _row$original$filling.name) || "NA"));
5842
+ }
5843
+ }, {
5844
+ Header: t("WT_JE_NAME"),
5845
+ accessor: row => {
5846
+ var _row$fillingpointmeta2;
5847
+ return (row === null || row === void 0 ? void 0 : (_row$fillingpointmeta2 = row.fillingpointmetadata) === null || _row$fillingpointmeta2 === void 0 ? void 0 : _row$fillingpointmeta2.jeName) || "NA";
5848
+ },
5849
+ id: "jeName"
5850
+ }, {
5851
+ Header: t("WT_LOCALITY"),
5852
+ accessor: row => {
5853
+ var _row$address2;
5854
+ return (row === null || row === void 0 ? void 0 : (_row$address2 = row.address) === null || _row$address2 === void 0 ? void 0 : _row$address2.locality) || "NA";
5855
+ },
5856
+ id: "locality"
5857
+ }];
5858
+ }
5859
+ }, [selectedTab, t]);
5860
+ const isMobile = window.Digit.Utils.browser.isMobile();
5861
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Card, null, /*#__PURE__*/React.createElement("div", {
5862
+ className: "search-tabs-container",
5863
+ style: {
5864
+ flexDirection: isMobile ? "column" : "row",
5865
+ gap: isMobile ? "16px" : "0"
5866
+ }
5867
+ }, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("button", {
5868
+ className: selectedTab === "FIXED_POINT" ? "search-tab-head-selected" : "search-tab-head",
5869
+ onClick: () => onTabChange("FIXED_POINT"),
5870
+ style: {
5871
+ width: isMobile ? "50%" : "auto"
5872
+ }
5873
+ }, t("WT_FIXED_POINT")), /*#__PURE__*/React.createElement("button", {
5874
+ className: selectedTab === "FILLING_POINT" ? "search-tab-head-selected" : "search-tab-head",
5875
+ onClick: () => onTabChange("FILLING_POINT"),
5876
+ style: {
5877
+ width: isMobile ? "50%" : "auto"
5878
+ }
5879
+ }, t("WT_FILLING_POINT"))), /*#__PURE__*/React.createElement("div", {
5880
+ className: "action-bar-wrap-registry",
5881
+ style: {
5882
+ alignSelf: isMobile ? "flex-end" : "auto"
5883
+ }
5884
+ }, /*#__PURE__*/React.createElement("div", {
5885
+ className: "search-add",
5886
+ onClick: onAddClick
5887
+ }, t("ES_VENDOR_REGISTRY_INBOX_HEADER_ADD"), /*#__PURE__*/React.createElement("div", {
5888
+ className: "search-add-icon"
5889
+ }, /*#__PURE__*/React.createElement(AddIcon, null))), showAddMenu && /*#__PURE__*/React.createElement(Menu, {
5890
+ localeKeyPrefix: "ES_FSM_ACTION_CREATE",
5891
+ options: ["FIXED_POINT", "FILLING_POINT"],
5892
+ t: t,
5893
+ onSelect: onActionSelect
5894
+ }))), /*#__PURE__*/React.createElement("div", {
5895
+ className: "finance-mainlayout"
5896
+ }, /*#__PURE__*/React.createElement("div", {
5897
+ className: "finance-mainlayout-col1"
5898
+ }, /*#__PURE__*/React.createElement(Label, null, t(label)), /*#__PURE__*/React.createElement(TextInput, {
5899
+ value: searchValue,
5900
+ onChange: e => setSearchValue(e.target.value),
5901
+ placeholder: t(placeholder)
5902
+ })), /*#__PURE__*/React.createElement("div", {
5903
+ className: "finance-mainlayout-col1"
5904
+ }, /*#__PURE__*/React.createElement(Label, null, t("WT_MOBILE_NUMBER")), /*#__PURE__*/React.createElement(TextInput, {
5905
+ value: mobileNumber,
5906
+ onChange: e => setMobileNumber(e.target.value),
5907
+ placeholder: t("WT_ENTER_MOBILE_NUMBER")
5908
+ })), selectedTab === "FILLING_POINT" && /*#__PURE__*/React.createElement("div", {
5909
+ className: "finance-mainlayout-col1"
5910
+ }, /*#__PURE__*/React.createElement(Label, null, t("PT_COMMON_TABLE_COL_STATUS_LABEL")), /*#__PURE__*/React.createElement(Dropdown, {
5911
+ option: statusOptions,
5912
+ optionKey: "i18nKey",
5913
+ selected: status,
5914
+ select: setStatus,
5915
+ t: t
5916
+ })), /*#__PURE__*/React.createElement("div", {
5917
+ style: {
5918
+ display: "flex",
5919
+ marginTop: "32px",
5920
+ justifyContent: isMobile ? "center" : "flex-end",
5921
+ flexDirection: isMobile ? "column-reverse" : "row",
5922
+ gap: "16px"
5923
+ }
5924
+ }, /*#__PURE__*/React.createElement("span", {
5925
+ className: "clear-search",
5926
+ onClick: clearSearch,
5927
+ style: {
5928
+ alignSelf: "center"
5929
+ }
5930
+ }, t("ES_COMMON_CLEAR_SEARCH")), /*#__PURE__*/React.createElement(SubmitBar, {
5931
+ label: t("ES_COMMON_SEARCH"),
5932
+ onSubmit: onSearch
5933
+ })))), /*#__PURE__*/React.createElement(Card, null, /*#__PURE__*/React.createElement(Table, {
5934
+ data: tableData,
5935
+ columns: columns,
5936
+ pageSize: 10,
5937
+ showPagination: true,
5938
+ showPageSizeOptions: true,
5939
+ showSearch: false,
5940
+ getCellProps: () => ({
5941
+ style: {
5942
+ padding: "20px 18px",
5943
+ fontSize: "16px"
5944
+ }
5945
+ }),
5946
+ t: t,
5947
+ isLoading: isLoading,
5948
+ isSearchRequired: false,
5949
+ isDownloadRequired: true,
5950
+ isFilterRequired: true,
5951
+ isSortRequired: true
5952
+ })));
5953
+ };
5954
+
5955
+ const VendorAssign = ({
5956
+ parentUrl,
5957
+ heading
5958
+ }) => {
5959
+ const tenantId = Digit.ULBService.getCurrentTenantId();
5960
+ const {
5961
+ t
5962
+ } = useTranslation();
5963
+ const [showToast, setShowToast] = useState(null);
5964
+ const [formData, setFormData] = useState({});
5965
+ const [applicantName, setApplicantName] = useState("");
5966
+ const [mobileNumber, setMobileNumber] = useState("");
5967
+ const [alternateNumber, setAlternateNumber] = useState("");
5968
+ const [emailId, setEmailId] = useState("");
5969
+ const [validFrom, setValidFrom] = useState("");
5970
+ const [validTo, setValidTo] = useState("");
5971
+ const [fillingPoint, setFillingPoint] = useState(null);
5972
+ const {
5973
+ data: fetchedOptions,
5974
+ isLoading: isFillingLoading
5975
+ } = Digit.Hooks.wt.useTankerSearchAPI({
5976
+ tenantId,
5977
+ filters: {}
5978
+ }, {
5979
+ select: data => {
5980
+ var _data$waterTankerBook, _data$waterTankerBook2;
5981
+ return data === null || data === void 0 ? void 0 : (_data$waterTankerBook = data.waterTankerBookingDetail) === null || _data$waterTankerBook === void 0 ? void 0 : (_data$waterTankerBook2 = _data$waterTankerBook.filter(fp => fp.fillingpointmetadata)) === null || _data$waterTankerBook2 === void 0 ? void 0 : _data$waterTankerBook2.map(fp => {
5982
+ var _fp$fillingpointmetad, _fp$fillingpointmetad2, _fp$fillingpointmetad3, _fp$fillingpointmetad4, _fp$fillingpointmetad5;
5983
+ return {
5984
+ name: ((_fp$fillingpointmetad = fp.fillingpointmetadata) === null || _fp$fillingpointmetad === void 0 ? void 0 : _fp$fillingpointmetad.fillingPointName) || ((_fp$fillingpointmetad2 = fp.fillingpointmetadata) === null || _fp$fillingpointmetad2 === void 0 ? void 0 : _fp$fillingpointmetad2.name),
5985
+ code: ((_fp$fillingpointmetad3 = fp.fillingpointmetadata) === null || _fp$fillingpointmetad3 === void 0 ? void 0 : _fp$fillingpointmetad3.fillingPointId) || fp.bookingId,
5986
+ i18nKey: ((_fp$fillingpointmetad4 = fp.fillingpointmetadata) === null || _fp$fillingpointmetad4 === void 0 ? void 0 : _fp$fillingpointmetad4.fillingPointName) || ((_fp$fillingpointmetad5 = fp.fillingpointmetadata) === null || _fp$fillingpointmetad5 === void 0 ? void 0 : _fp$fillingpointmetad5.name)
5987
+ };
5988
+ });
5989
+ }
5990
+ });
5991
+ const fillingPointOptions = (fetchedOptions === null || fetchedOptions === void 0 ? void 0 : fetchedOptions.length) > 0 ? fetchedOptions : [{
5992
+ name: "Filling Point 1",
5993
+ code: "FILLING_POINT_1",
5994
+ i18nKey: "WT_FILLING_POINT_1"
5995
+ }, {
5996
+ name: "Filling Point 2",
5997
+ code: "FILLING_POINT_2",
5998
+ i18nKey: "WT_FILLING_POINT_2"
5999
+ }, {
6000
+ name: "Filling Point 3",
6001
+ code: "FILLING_POINT_3",
6002
+ i18nKey: "WT_FILLING_POINT_3"
6003
+ }, {
6004
+ name: "Filling Point 4",
6005
+ code: "FILLING_POINT_4",
6006
+ i18nKey: "WT_FILLING_POINT_4"
6007
+ }];
6008
+ const handleSubmit = () => {
6009
+ if (!applicantName || !mobileNumber || !emailId || !validFrom || !validTo || !formData.address) {
6010
+ setShowToast({
6011
+ isError: true,
6012
+ label: t("ES_COMMON_FILL_ALL_MANDATORY_FIELDS")
6013
+ });
6014
+ return;
6015
+ }
6016
+ const payload = {
6017
+ vendor: {
6018
+ tenantId,
6019
+ name: applicantName,
6020
+ mobileNumber,
6021
+ alternateNumber,
6022
+ emailId,
6023
+ validFrom,
6024
+ validTo,
6025
+ fillingPoint: fillingPoint === null || fillingPoint === void 0 ? void 0 : fillingPoint.code,
6026
+ address: formData.address
6027
+ }
6028
+ };
6029
+ Digit.VendorService.createVendor(payload, tenantId).then(result => {
6030
+ setShowToast({
6031
+ isError: false,
6032
+ label: t("ES_COMMON_SAVE_SUCCESS")
6033
+ });
6034
+ }).catch(err => {
6035
+ var _err$response, _err$response$data, _err$response$data$Er, _err$response$data$Er2;
6036
+ setShowToast({
6037
+ isError: true,
6038
+ label: (err === null || err === void 0 ? void 0 : (_err$response = err.response) === null || _err$response === void 0 ? void 0 : (_err$response$data = _err$response.data) === null || _err$response$data === void 0 ? void 0 : (_err$response$data$Er = _err$response$data.Errors) === null || _err$response$data$Er === void 0 ? void 0 : (_err$response$data$Er2 = _err$response$data$Er[0]) === null || _err$response$data$Er2 === void 0 ? void 0 : _err$response$data$Er2.message) || t("ES_COMMON_ERROR_SAVING")
6039
+ });
6040
+ });
6041
+ };
6042
+ const isMobile = window.Digit.Utils.browser.isMobile();
6043
+ return /*#__PURE__*/React.createElement("div", {
6044
+ style: {
6045
+ display: "flex",
6046
+ flexDirection: isMobile ? "column" : "row"
6047
+ }
6048
+ }, /*#__PURE__*/React.createElement(Timeline, {
6049
+ steps: ["Vendor Assign"],
6050
+ currentStep: 1
6051
+ }), /*#__PURE__*/React.createElement("div", {
6052
+ style: {
6053
+ flex: 1,
6054
+ marginLeft: isMobile ? "0px" : "24px"
6055
+ }
6056
+ }, /*#__PURE__*/React.createElement(Card, null, /*#__PURE__*/React.createElement("div", {
6057
+ style: {
6058
+ display: "grid",
6059
+ gridTemplateColumns: isMobile ? "1fr" : "1fr 1fr",
6060
+ columnGap: "32px",
6061
+ rowGap: "8px"
6062
+ }
6063
+ }, /*#__PURE__*/React.createElement("div", {
6064
+ style: {
6065
+ display: "flex",
6066
+ flexDirection: "column"
6067
+ }
6068
+ }, /*#__PURE__*/React.createElement(CardLabel, null, `${t("COMMON_APPLICANT_NAME")}`, " ", /*#__PURE__*/React.createElement("span", {
6069
+ className: "astericColor"
6070
+ }, "*")), /*#__PURE__*/React.createElement(TextInput, {
6071
+ t: t,
6072
+ type: "text",
6073
+ isMandatory: true,
6074
+ name: "applicantName",
6075
+ value: applicantName,
6076
+ style: {
6077
+ width: "100%"
6078
+ },
6079
+ onChange: e => setApplicantName(e.target.value)
6080
+ })), /*#__PURE__*/React.createElement("div", {
6081
+ style: {
6082
+ display: "flex",
6083
+ flexDirection: "column"
6084
+ }
6085
+ }, /*#__PURE__*/React.createElement(CardLabel, null, `${t("CORE_COMMON_APPLICANT_MOBILE_NUMBER")}`, " ", /*#__PURE__*/React.createElement("span", {
6086
+ className: "astericColor"
6087
+ }, "*")), /*#__PURE__*/React.createElement(MobileNumber, {
6088
+ value: mobileNumber,
6089
+ name: "mobileNumber",
6090
+ onChange: value => setMobileNumber(value),
6091
+ style: {
6092
+ width: "100%"
6093
+ }
6094
+ })), /*#__PURE__*/React.createElement("div", {
6095
+ style: {
6096
+ display: "flex",
6097
+ flexDirection: "column"
6098
+ }
6099
+ }, /*#__PURE__*/React.createElement(CardLabel, null, `${t("WT_VENDOR_ALT_MOBILE_NUMBER")}`), /*#__PURE__*/React.createElement(MobileNumber, {
6100
+ value: alternateNumber,
6101
+ name: "alternateNumber",
6102
+ onChange: value => setAlternateNumber(value),
6103
+ style: {
6104
+ width: "100%"
6105
+ }
6106
+ })), /*#__PURE__*/React.createElement("div", {
6107
+ style: {
6108
+ display: "flex",
6109
+ flexDirection: "column"
6110
+ }
6111
+ }, /*#__PURE__*/React.createElement(CardLabel, null, `${t("CORE_COMMON_APPLICANT_EMAIL_ID")}`, " ", /*#__PURE__*/React.createElement("span", {
6112
+ className: "astericColor"
6113
+ }, "*")), /*#__PURE__*/React.createElement(TextInput, {
6114
+ t: t,
6115
+ type: "email",
6116
+ isMandatory: true,
6117
+ name: "emailId",
6118
+ value: emailId,
6119
+ style: {
6120
+ width: "100%"
6121
+ },
6122
+ onChange: e => setEmailId(e.target.value)
6123
+ })), /*#__PURE__*/React.createElement("div", {
6124
+ style: {
6125
+ display: "flex",
6126
+ flexDirection: "column"
6127
+ }
6128
+ }, /*#__PURE__*/React.createElement(CardLabel, null, `${t("COMMON_VALID_FROM_DATE")}`, " ", /*#__PURE__*/React.createElement("span", {
6129
+ className: "astericColor"
6130
+ }, "*")), /*#__PURE__*/React.createElement(DatePicker, {
6131
+ date: validFrom,
6132
+ onChange: date => setValidFrom(date),
6133
+ style: {
6134
+ width: "100%"
6135
+ }
6136
+ })), /*#__PURE__*/React.createElement("div", {
6137
+ style: {
6138
+ display: "flex",
6139
+ flexDirection: "column"
6140
+ }
6141
+ }, /*#__PURE__*/React.createElement(CardLabel, null, `${t("COMMON_VALID_TO_DATE")}`, " ", /*#__PURE__*/React.createElement("span", {
6142
+ className: "astericColor"
6143
+ }, "*")), /*#__PURE__*/React.createElement(DatePicker, {
6144
+ date: validTo,
6145
+ onChange: date => setValidTo(date),
6146
+ style: {
6147
+ width: "100%"
6148
+ }
6149
+ })), /*#__PURE__*/React.createElement("div", {
6150
+ style: {
6151
+ display: "flex",
6152
+ flexDirection: "column"
6153
+ }
6154
+ }, /*#__PURE__*/React.createElement(CardLabel, null, `${t("COMMON_FILLING_POINT")}`, " ", /*#__PURE__*/React.createElement("span", {
6155
+ className: "astericColor"
6156
+ }, "*")), /*#__PURE__*/React.createElement(Dropdown, {
6157
+ className: "form-field",
6158
+ selected: fillingPoint,
6159
+ disable: isFillingLoading,
6160
+ select: setFillingPoint,
6161
+ option: fillingPointOptions,
6162
+ optionKey: "i18nKey",
6163
+ optionCardStyles: {
6164
+ overflowY: "auto",
6165
+ maxHeight: "300px"
6166
+ },
6167
+ t: t,
6168
+ name: "fillingPoint",
6169
+ placeholder: t("WT_SELECT_FILLING_POINT") || "Select Filling Point",
6170
+ style: {
6171
+ width: "100%"
6172
+ }
6173
+ })))), /*#__PURE__*/React.createElement("div", {
6174
+ style: {
6175
+ display: "flex",
6176
+ marginTop: "24px",
6177
+ justifyContent: isMobile ? "center" : "flex-end"
6178
+ }
6179
+ }, /*#__PURE__*/React.createElement(SubmitBar, {
6180
+ label: t("ES_COMMON_SAVE"),
6181
+ onSubmit: handleSubmit
6182
+ }))), showToast && /*#__PURE__*/React.createElement(Toast, {
6183
+ error: showToast.isError,
6184
+ label: showToast.label,
6185
+ onClose: () => setShowToast(null)
6186
+ }));
6187
+ };
6188
+
6189
+ const EmployeeApp = ({
6190
+ path
6191
+ }) => {
6192
+ var _Digit, _Digit$ComponentRegis, _Digit2, _Digit2$ComponentRegi;
6193
+ const {
6194
+ t
6195
+ } = useTranslation();
6196
+ const location = useLocation();
6197
+ sessionStorage.removeItem("revalidateddone");
6198
+ const getDynamicBreadcrumbs = () => {
6199
+ const pathname = location.pathname;
6200
+ let moduleName = "WT";
6201
+ if (pathname.includes("/mt/")) moduleName = "MT";
6202
+ if (pathname.includes("/tp/")) moduleName = "TP";
6203
+ let crumbs = [{
6204
+ icon: HomeIcon,
6205
+ path: "/digit-ui/employee"
6206
+ }, {
6207
+ label: t("WT_MODULE_NAME"),
6208
+ path: `/digit-ui/employee/module/details?moduleName=${moduleName}`
6209
+ }];
6210
+ if (pathname.includes("/inbox")) {
6211
+ let label = "ES_COMMON_INBOX";
6212
+ if (pathname.includes("/tp/inbox")) label = "TP_INBOX";
6213
+ crumbs.push({
6214
+ label: t(label)
6215
+ });
6216
+ } else if (pathname.includes("/my-bookings")) {
6217
+ let label = "WT_SEARCH_BOOKINGS";
6218
+ if (pathname.includes("/mt/my-bookings")) label = "MT_SEARCH_BOOKINGS";
6219
+ if (pathname.includes("/tp/my-bookings")) label = "TP_SEARCH_BOOKINGS";
6220
+ crumbs.push({
6221
+ label: t(label)
6222
+ });
6223
+ } else if (pathname.includes("/request-service")) {
6224
+ crumbs.push({
6225
+ label: t("WT_REQUEST_SERVICE")
6226
+ });
6227
+ } else if (pathname.includes("/booking-details") || pathname.includes("/bookingsearch/booking-details")) {
6228
+ const isSearch = pathname.includes("/bookingsearch");
6229
+ if (isSearch) {
6230
+ crumbs.push({
6231
+ label: t("WT_SEARCH_BOOKINGS"),
6232
+ path: `${path}/my-bookings`
6233
+ });
6234
+ } else {
6235
+ crumbs.push({
6236
+ label: t("ES_COMMON_INBOX"),
6237
+ path: `${path}/inbox`
6238
+ });
6239
+ }
6240
+ crumbs.push({
6241
+ label: t("WT_BOOKING_DETAILS")
6242
+ });
6243
+ } else if (pathname.includes("/fixed-point-schedule")) {
6244
+ crumbs.push({
6245
+ label: t("WT_FIXED_POINT_SCHEDULE_MANAGEMENT")
6246
+ });
6247
+ } else if (pathname.includes("/live-tracking")) {
6248
+ crumbs.push({
6249
+ label: t("WT_LIVE_TRACKING_SYSTEM")
6250
+ });
6251
+ } else if (pathname.includes("/add-filling-point-address")) {
6252
+ crumbs.push({
6253
+ label: t("WT_ADD_FILLING_POINT_ADDRESS")
6254
+ });
6255
+ } else if (pathname.includes("/add-fix-point-address")) {
6256
+ crumbs.push({
6257
+ label: t("WT_ADD_FIX_POINT_ADDRESS")
6258
+ });
6259
+ } else if (pathname.includes("/search-filling-fix-point")) {
6260
+ crumbs.push({
6261
+ label: t("WT_SEARCH_FIX_POINT")
6262
+ });
6263
+ } else if (pathname.includes("/vendor-assign")) {
6264
+ crumbs.push({
6265
+ label: t("WT_VENDOR_ASSIGN")
6266
+ });
6267
+ }
6268
+ return crumbs;
6269
+ };
6270
+ const inboxInitialState = {
6271
+ searchParams: {
6272
+ uuid: {
6273
+ code: "ASSIGNED_TO_ALL",
6274
+ name: "ES_INBOX_ASSIGNED_TO_ALL"
6275
+ },
6276
+ services: ["watertanker"],
6277
+ applicationStatus: [],
6278
+ locality: []
6279
+ }
6280
+ };
6281
+ const inboxInitialStateMt = {
6282
+ searchParams: {
6283
+ uuid: {
6284
+ code: "ASSIGNED_TO_ALL",
6285
+ name: "ES_INBOX_ASSIGNED_TO_ALL"
6286
+ },
6287
+ services: ["mobileToilet"],
6288
+ applicationStatus: [],
6289
+ locality: []
6290
+ }
6291
+ };
6292
+ const inboxInitialStateTp = {
6293
+ searchParams: {
6294
+ uuid: {
6295
+ code: "ASSIGNED_TO_ALL",
6296
+ name: "ES_INBOX_ASSIGNED_TO_ALL"
6297
+ },
6298
+ services: ["treePruning"],
6299
+ applicationStatus: [],
6300
+ locality: []
6301
+ }
6302
+ };
6303
+ const ApplicationDetails = (_Digit = Digit) === null || _Digit === void 0 ? void 0 : (_Digit$ComponentRegis = _Digit.ComponentRegistryService) === null || _Digit$ComponentRegis === void 0 ? void 0 : _Digit$ComponentRegis.getComponent("ApplicationDetails");
6304
+ const WTCreate = (_Digit2 = Digit) === null || _Digit2 === void 0 ? void 0 : (_Digit2$ComponentRegi = _Digit2.ComponentRegistryService) === null || _Digit2$ComponentRegi === void 0 ? void 0 : _Digit2$ComponentRegi.getComponent("WTCreate");
6305
+ return /*#__PURE__*/React.createElement(Switch, null, /*#__PURE__*/React.createElement(AppContainer, null, /*#__PURE__*/React.createElement("div", {
6306
+ className: "ground-container employee-app-container form-container"
6307
+ }, /*#__PURE__*/React.createElement(ModuleHeader, {
6308
+ leftContent: /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ArrowLeft, {
6309
+ className: "icon"
3133
6310
  }), "Back"),
3134
6311
  onLeftClick: () => window.history.back(),
3135
6312
  breadcrumbs: getDynamicBreadcrumbs()
@@ -3139,7 +6316,7 @@ const EmployeeApp = ({
3139
6316
  className: "employee-form-content"
3140
6317
  }, /*#__PURE__*/React.createElement(PrivateRoute, {
3141
6318
  path: `${path}/inbox`,
3142
- component: () => /*#__PURE__*/React.createElement(Inbox, {
6319
+ component: props => /*#__PURE__*/React.createElement(Inbox, Object.assign({}, props, {
3143
6320
  useNewInboxAPI: true,
3144
6321
  parentRoute: path,
3145
6322
  businessService: "watertanker",
@@ -3147,10 +6324,10 @@ const EmployeeApp = ({
3147
6324
  filterComponent: "WT_INBOX_FILTER",
3148
6325
  initialStates: inboxInitialState,
3149
6326
  isInbox: true
3150
- })
6327
+ }))
3151
6328
  }), /*#__PURE__*/React.createElement(PrivateRoute, {
3152
6329
  path: `${path}/mt/inbox`,
3153
- component: () => /*#__PURE__*/React.createElement(Inbox, {
6330
+ component: props => /*#__PURE__*/React.createElement(Inbox, Object.assign({}, props, {
3154
6331
  useNewInboxAPI: true,
3155
6332
  parentRoute: path,
3156
6333
  moduleCode: "MT",
@@ -3158,10 +6335,10 @@ const EmployeeApp = ({
3158
6335
  filterComponent: "WT_INBOX_FILTER",
3159
6336
  initialStates: inboxInitialStateMt,
3160
6337
  isInbox: true
3161
- })
6338
+ }))
3162
6339
  }), /*#__PURE__*/React.createElement(PrivateRoute, {
3163
6340
  path: `${path}/tp/inbox`,
3164
- component: () => /*#__PURE__*/React.createElement(Inbox, {
6341
+ component: props => /*#__PURE__*/React.createElement(Inbox, Object.assign({}, props, {
3165
6342
  useNewInboxAPI: true,
3166
6343
  parentRoute: path,
3167
6344
  moduleCode: "TP",
@@ -3169,7 +6346,7 @@ const EmployeeApp = ({
3169
6346
  filterComponent: "WT_INBOX_FILTER",
3170
6347
  initialStates: inboxInitialStateTp,
3171
6348
  isInbox: true
3172
- })
6349
+ }))
3173
6350
  }), /*#__PURE__*/React.createElement(PrivateRoute, {
3174
6351
  path: `${path}/request-service`,
3175
6352
  component: WTCreate
@@ -3181,14 +6358,14 @@ const EmployeeApp = ({
3181
6358
  component: WTCreate
3182
6359
  }), /*#__PURE__*/React.createElement(PrivateRoute, {
3183
6360
  path: `${path}/booking-details/:id`,
3184
- component: () => /*#__PURE__*/React.createElement(ApplicationDetails, {
6361
+ component: props => /*#__PURE__*/React.createElement(ApplicationDetails, Object.assign({}, props, {
3185
6362
  parentRoute: path
3186
- })
6363
+ }))
3187
6364
  }), /*#__PURE__*/React.createElement(PrivateRoute, {
3188
6365
  path: `${path}/bookingsearch/booking-details/:id`,
3189
- component: () => /*#__PURE__*/React.createElement(ApplicationDetails, {
6366
+ component: props => /*#__PURE__*/React.createElement(ApplicationDetails, Object.assign({}, props, {
3190
6367
  parentRoute: path
3191
- })
6368
+ }))
3192
6369
  }), /*#__PURE__*/React.createElement(PrivateRoute, {
3193
6370
  path: `${path}/my-bookings`,
3194
6371
  component: props => /*#__PURE__*/React.createElement(SearchApp, Object.assign({}, props, {
@@ -3207,6 +6384,24 @@ const EmployeeApp = ({
3207
6384
  parentRoute: path,
3208
6385
  moduleCode: "TP"
3209
6386
  }))
6387
+ }), /*#__PURE__*/React.createElement(PrivateRoute, {
6388
+ path: `${path}/fixed-point-schedule`,
6389
+ component: FixedPointScheduleManagement
6390
+ }), /*#__PURE__*/React.createElement(PrivateRoute, {
6391
+ path: `${path}/live-tracking`,
6392
+ component: LiveTrackingSystem
6393
+ }), /*#__PURE__*/React.createElement(PrivateRoute, {
6394
+ path: `${path}/add-filling-point-address`,
6395
+ component: AddFillingPointAddress
6396
+ }), /*#__PURE__*/React.createElement(PrivateRoute, {
6397
+ path: `${path}/add-fix-point-address`,
6398
+ component: AddFixPointAddress
6399
+ }), /*#__PURE__*/React.createElement(PrivateRoute, {
6400
+ path: `${path}/search-filling-fix-point`,
6401
+ component: SearchFillingPointAddress
6402
+ }), /*#__PURE__*/React.createElement(PrivateRoute, {
6403
+ path: `${path}/vendor-assignment`,
6404
+ component: VendorAssign
3210
6405
  }))))));
3211
6406
  };
3212
6407
 
@@ -18329,6 +21524,7 @@ const ApplicationDetails$1 = () => {
18329
21524
  }, [workflowDetails.data]);
18330
21525
  const [showTimeline, setShowTimeline] = useState(true);
18331
21526
  return /*#__PURE__*/React.createElement("div", {
21527
+ className: "employee-form-content-with-action-bar",
18332
21528
  style: {
18333
21529
  padding: (user === null || user === void 0 ? void 0 : user.type) === "CITIZEN" ? "0 15px" : ""
18334
21530
  }
@@ -19904,7 +23100,14 @@ const componentsToRegister = {
19904
23100
  TreePruningRequestDetails,
19905
23101
  MTAcknowledgement,
19906
23102
  TPAcknowledgement,
19907
- MTCitizenCard: MTCitizenCard
23103
+ MTCitizenCard: MTCitizenCard,
23104
+ FixedPointScheduleManagement,
23105
+ LiveTrackingSystem,
23106
+ AddFillingPointAddress,
23107
+ AddFixPointAddress,
23108
+ AddFillingPointMetaData,
23109
+ WTSearchPointAddress: SearchFillingPointAddress,
23110
+ VendorAssign
19908
23111
  };
19909
23112
  const initWTComponents = () => {
19910
23113
  Object.entries(componentsToRegister).forEach(([key, value]) => {