@djb25/digit-ui-module-wt 1.0.16 → 1.0.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
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';
1
+ import { TickMark, ArrowDown, MobileNumber, CardLabelError, TextInput, Dropdown, DatePicker, SubmitBar, Card, Table, Loader, Toast, AppContainer, ModuleHeader, ArrowLeft, PrivateRoute, HomeIcon, KeyNote, Modal, CardHeader, CardText, FormStep, CardLabel, RadioButtons, UploadFile, TextArea, CheckBox, CardSubHeader, StatusTable, Row, GenericFileIcon, LinkButton, EditIcon, Banner, CHBIcon, EmployeeModuleCard, CloseSvg, Label, LinkLabel, ActionBar, DetailsCard, SearchAction, FilterAction, PopUp, ShippingTruck, CustomNameDropdown, MultiSelectDropdown, LabelFieldPair, AddIcon, Menu, 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';
@@ -795,25 +795,25 @@ const WTSearchApplication = ({
795
795
  code: "TREE_PRUNING_SERVICE_COMPLETED",
796
796
  value: t("TP_TREE_PRUNING_SERVICE_COMPLETED")
797
797
  }] : [{
798
- i18nKey: "Booking Created",
798
+ i18nKey: "WT_BOOKING_CREATED",
799
799
  code: "BOOKING_CREATED",
800
800
  value: t("WT_BOOKING_CREATED")
801
801
  }, {
802
- i18nKey: "Booking Approved",
803
- code: "APPROVED",
804
- value: t("WT_BOOKING_APPROVED")
802
+ i18nKey: "WT_VENDOR_ASSIGNED",
803
+ code: "VENDOR_ASSIGNED",
804
+ value: t("WT_VENDOR_ASSIGNED")
805
805
  }, {
806
- i18nKey: "Tanker Delivered",
807
- code: "TANKER_DELIVERED",
808
- value: t("WT_TANKER_DELIVERED")
806
+ i18nKey: "WT_DELIVERY_PENDING",
807
+ code: "DELIVERY_PENDING",
808
+ value: t("WT_DELIVERY_PENDING")
809
809
  }, {
810
- i18nKey: "Vendor Assigned",
811
- code: "ASSIGN_VENDOR",
812
- value: t("WT_ASSIGN_VENDOR")
810
+ i18nKey: "WT_DELIVERED",
811
+ code: "DELIVERED",
812
+ value: t("WT_DELIVERED")
813
813
  }, {
814
- i18nKey: "Rejected",
815
- code: "REJECT",
816
- value: t("WT_BOOKING_REJECTED")
814
+ i18nKey: "WT_REQUEST_REJECTED",
815
+ code: "REQUEST_REJECTED",
816
+ value: t("WT_REQUEST_REJECTED")
817
817
  }];
818
818
  const onSort = useCallback(args => {
819
819
  if (args.length === 0) return;
@@ -1128,6 +1128,10 @@ const SearchApp = ({
1128
1128
 
1129
1129
  const App = () => {
1130
1130
  var _Digit, _Digit$ComponentRegis, _Digit2, _Digit2$ComponentRegi, _Digit3, _Digit3$ComponentRegi, _Digit4, _Digit4$ComponentRegi, _Digit5, _Digit5$ComponentRegi, _Digit6, _Digit6$ComponentRegi;
1131
+ const {
1132
+ t
1133
+ } = useTranslation();
1134
+ const location = useLocation();
1131
1135
  const {
1132
1136
  path,
1133
1137
  url,
@@ -1142,6 +1146,52 @@ const App = () => {
1142
1146
  const WTCard = Digit.ComponentRegistryService.getComponent("WTCitizenCard");
1143
1147
  const MTCard = Digit.ComponentRegistryService.getComponent("MTCitizenCard");
1144
1148
  const ApplicationDetails = (_Digit6 = Digit) === null || _Digit6 === void 0 ? void 0 : (_Digit6$ComponentRegi = _Digit6.ComponentRegistryService) === null || _Digit6$ComponentRegi === void 0 ? void 0 : _Digit6$ComponentRegi.getComponent("ApplicationDetails");
1149
+ const getDynamicBreadcrumbs = () => {
1150
+ const pathname = location.pathname;
1151
+ if (pathname.includes("/mt/")) ;
1152
+ if (pathname.includes("/tp/")) ;
1153
+ let crumbs = [{
1154
+ icon: HomeIcon,
1155
+ path: "/digit-ui/citizen"
1156
+ }, {
1157
+ label: t("WT_MODULE_NAME"),
1158
+ path: `${path}/wt-Vendor`
1159
+ }];
1160
+ if (pathname.includes("/inbox")) {
1161
+ let label = "ES_COMMON_INBOX";
1162
+ if (pathname.includes("/mt/inbox")) {
1163
+ crumbs = [{
1164
+ icon: HomeIcon,
1165
+ path: "/digit-ui/citizen"
1166
+ }, {
1167
+ label: t("ACTION_TEST_MT"),
1168
+ path: `${path}/mt-Vendor`
1169
+ }];
1170
+ }
1171
+ crumbs.push({
1172
+ label: t(label)
1173
+ });
1174
+ } else if (pathname.includes("/my-bookings")) {
1175
+ let label = "WT_SEARCH_BOOKINGS";
1176
+ if (pathname.includes("/mt/my-bookings")) label = "MT_SEARCH_BOOKINGS";
1177
+ crumbs.push({
1178
+ label: t(label)
1179
+ });
1180
+ } else if (pathname.includes("/status")) {
1181
+ crumbs.push({
1182
+ label: t("WT_MY_APPLICATIONS")
1183
+ });
1184
+ } else if (pathname.includes("/booking/") || pathname.includes("/booking-details") || pathname.includes("/bookingsearch/booking-details")) {
1185
+ crumbs.push({
1186
+ label: t("ES_COMMON_INBOX"),
1187
+ path: pathname.includes("/mt/") ? `${path}/mt/inbox` : `${path}/inbox`
1188
+ });
1189
+ crumbs.push({
1190
+ label: t("WT_BOOKING_DETAILS")
1191
+ });
1192
+ }
1193
+ return crumbs;
1194
+ };
1145
1195
  const getInboxInitialState = service => ({
1146
1196
  searchParams: {
1147
1197
  uuid: {
@@ -1159,7 +1209,17 @@ const App = () => {
1159
1209
  style: {
1160
1210
  width: "100%"
1161
1211
  }
1162
- }, /*#__PURE__*/React.createElement(Switch, null, /*#__PURE__*/React.createElement(AppContainer, null, /*#__PURE__*/React.createElement(BackButton, null, "Back"), /*#__PURE__*/React.createElement(PrivateRoute, {
1212
+ }, /*#__PURE__*/React.createElement(Switch, null, /*#__PURE__*/React.createElement(AppContainer, null, /*#__PURE__*/React.createElement("div", {
1213
+ className: "ground-container employee-app-container form-container"
1214
+ }, /*#__PURE__*/React.createElement(ModuleHeader, {
1215
+ leftContent: /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ArrowLeft, {
1216
+ className: "icon"
1217
+ }), t("CS_COMMON_BACK")),
1218
+ onLeftClick: () => window.history.back(),
1219
+ breadcrumbs: getDynamicBreadcrumbs()
1220
+ }), /*#__PURE__*/React.createElement("div", {
1221
+ className: "employee-form-content"
1222
+ }, /*#__PURE__*/React.createElement(PrivateRoute, {
1163
1223
  path: `${path}/inbox`,
1164
1224
  component: () => /*#__PURE__*/React.createElement(Inbox, {
1165
1225
  useNewInboxAPI: true,
@@ -1244,7 +1304,7 @@ const App = () => {
1244
1304
  parentRoute: path,
1245
1305
  moduleCode: "MT"
1246
1306
  }))
1247
- }))));
1307
+ }))))));
1248
1308
  };
1249
1309
 
1250
1310
  const ExistingBookingDetails = ({
@@ -2291,6 +2351,9 @@ const WTCard = () => {
2291
2351
  }, {
2292
2352
  label: t("WT_SEARCH_FIX_POINT"),
2293
2353
  link: `${APPLICATION_PATH}/employee/wt/search-filling-fix-point`
2354
+ }, {
2355
+ label: t("Vendor_Assign"),
2356
+ link: `${APPLICATION_PATH}/employee/wt/vendor-assignment`
2294
2357
  }];
2295
2358
  const WT_CEMP = Digit.UserService.hasAccess(["WT_CEMP"]) || false;
2296
2359
  const propsForModuleCard = {
@@ -2373,7 +2436,7 @@ const InboxLinks = ({
2373
2436
  className: "filter inboxLinks"
2374
2437
  }, /*#__PURE__*/React.createElement("div", {
2375
2438
  className: "complaint-links-container"
2376
- }, GetLogo(), /*#__PURE__*/React.createElement("div", {
2439
+ }, Digit.UserService.getUser().info.type !== "CITIZEN" && GetLogo(), /*#__PURE__*/React.createElement("div", {
2377
2440
  className: "body"
2378
2441
  }, links.map(({
2379
2442
  link,
@@ -3137,10 +3200,36 @@ const AddTripModal = ({
3137
3200
  control,
3138
3201
  formState: {
3139
3202
  errors
3140
- }
3203
+ },
3204
+ watch,
3205
+ setValue
3141
3206
  } = useForm({
3142
3207
  defaultValues: initialValues || {}
3143
3208
  });
3209
+ const tenantId = Digit.ULBService.getCurrentTenantId();
3210
+ const {
3211
+ isLoading: isFixedPointLoading,
3212
+ data: fixedPointsData
3213
+ } = Digit.Hooks.wt.useFixedPointSearchAPI({
3214
+ tenantId,
3215
+ filters: {
3216
+ limit: 1000
3217
+ }
3218
+ });
3219
+ const fixedPoints = (fixedPointsData === null || fixedPointsData === void 0 ? void 0 : fixedPointsData.waterTankerBookingDetail) || [];
3220
+ const fixedPointOptions = fixedPoints.map(fp => {
3221
+ var _fp$applicantDetail, _fp$applicantDetail2, _fp$address, _fp$applicantDetail3, _fp$applicantDetail4, _fp$address2, _fp$address3, _fp$address4, _fp$address5, _fp$address6;
3222
+ return {
3223
+ name: (fp === null || fp === void 0 ? void 0 : (_fp$applicantDetail = fp.applicantDetail) === null || _fp$applicantDetail === void 0 ? void 0 : _fp$applicantDetail.name) || "NA",
3224
+ mobileNumber: (fp === null || fp === void 0 ? void 0 : (_fp$applicantDetail2 = fp.applicantDetail) === null || _fp$applicantDetail2 === void 0 ? void 0 : _fp$applicantDetail2.mobileNumber) || "NA",
3225
+ locality: (fp === null || fp === void 0 ? void 0 : (_fp$address = fp.address) === null || _fp$address === void 0 ? void 0 : _fp$address.locality) || "NA",
3226
+ displayLabel: `${(fp === null || fp === void 0 ? void 0 : (_fp$applicantDetail3 = fp.applicantDetail) === null || _fp$applicantDetail3 === void 0 ? void 0 : _fp$applicantDetail3.name) || "NA"} | ${(fp === null || fp === void 0 ? void 0 : (_fp$applicantDetail4 = fp.applicantDetail) === null || _fp$applicantDetail4 === void 0 ? void 0 : _fp$applicantDetail4.mobileNumber) || "NA"} | ${(fp === null || fp === void 0 ? void 0 : (_fp$address2 = fp.address) === null || _fp$address2 === void 0 ? void 0 : _fp$address2.locality) || "NA"}`,
3227
+ value: fp.bookingId,
3228
+ fullAddress: [(fp === null || fp === void 0 ? void 0 : (_fp$address3 = fp.address) === null || _fp$address3 === void 0 ? void 0 : _fp$address3.houseNo) && `${t("WT_HOUSE_NO")} = ${fp.address.houseNo}`, (fp === null || fp === void 0 ? void 0 : (_fp$address4 = fp.address) === null || _fp$address4 === void 0 ? void 0 : _fp$address4.streetName) && `${t("WT_STREET_NAME")} = ${fp.address.streetName}`, (fp === null || fp === void 0 ? void 0 : (_fp$address5 = fp.address) === null || _fp$address5 === void 0 ? void 0 : _fp$address5.landmark) && `${t("WT_LANDMARK")} = ${fp.address.landmark}`, (fp === null || fp === void 0 ? void 0 : (_fp$address6 = fp.address) === null || _fp$address6 === void 0 ? void 0 : _fp$address6.locality) && `${t("WT_LOCALITY")} = ${fp.address.locality}`].filter(Boolean).join(", ")
3229
+ };
3230
+ });
3231
+ const selectedFixedPointCode = watch("fixedPointCode");
3232
+ const selectedFixedPoint = fixedPointOptions.find(opt => opt.value === selectedFixedPointCode);
3144
3233
  const dayOptions = [{
3145
3234
  label: t("MONDAY"),
3146
3235
  value: "MONDAY"
@@ -3185,21 +3274,66 @@ const AddTripModal = ({
3185
3274
  display: "flex",
3186
3275
  justifyContent: "center",
3187
3276
  alignItems: "center",
3188
- zIndex: 9999
3189
- }
3190
- }, /*#__PURE__*/React.createElement("div", {
3191
- className: "custom-modal-content",
3192
- style: {
3193
- backgroundColor: "#fff",
3194
- borderRadius: "8px",
3195
- width: "70%",
3196
- maxWidth: "800px",
3197
- maxHeight: "90vh",
3198
- display: "flex",
3199
- flexDirection: "column",
3200
- boxShadow: "0 4px 12px rgba(0,0,0,0.15)",
3201
- position: "relative"
3202
- }
3277
+ zIndex: 200000
3278
+ }
3279
+ }, /*#__PURE__*/React.createElement("style", null, `
3280
+ .custom-modal-content {
3281
+ background-color: #fff;
3282
+ border-radius: 8px;
3283
+ width: 70%;
3284
+ max-width: 800px;
3285
+ max-height: 90vh;
3286
+ display: flex;
3287
+ flex-direction: column;
3288
+ box-shadow: 0 4px 12px rgba(0,0,0,0.15);
3289
+ position: relative;
3290
+ }
3291
+ .add-trip-form {
3292
+ display: grid;
3293
+ grid-template-columns: repeat(2, 1fr);
3294
+ gap: 20px;
3295
+ }
3296
+ @media (max-width: 768px) {
3297
+ .custom-modal-content {
3298
+ width: 90%;
3299
+ max-height: 85vh;
3300
+ }
3301
+ .add-trip-form {
3302
+ grid-template-columns: 1fr;
3303
+ gap: 15px;
3304
+ }
3305
+ }
3306
+ @media (max-width: 480px) {
3307
+ .custom-modal-content {
3308
+ width: 95%;
3309
+ max-height: 95vh;
3310
+ }
3311
+ .custom-modal-body {
3312
+ padding: 15px !important;
3313
+ }
3314
+ .custom-modal-footer {
3315
+ padding: 12px 15px !important;
3316
+ flex-direction: row;
3317
+ justify-content: flex-end;
3318
+ }
3319
+ .custom-modal-header {
3320
+ padding: 12px 15px !important;
3321
+ }
3322
+ .custom-modal-header h1 {
3323
+ font-size: 18px !important;
3324
+ }
3325
+ }
3326
+ @media (max-width: 320px) {
3327
+ .custom-modal-footer {
3328
+ flex-direction: column-reverse;
3329
+ align-items: stretch;
3330
+ }
3331
+ .custom-modal-footer button {
3332
+ width: 100%;
3333
+ }
3334
+ }
3335
+ `), /*#__PURE__*/React.createElement("div", {
3336
+ className: "custom-modal-content"
3203
3337
  }, /*#__PURE__*/React.createElement("div", {
3204
3338
  className: "custom-modal-header",
3205
3339
  style: {
@@ -3232,12 +3366,7 @@ const AddTripModal = ({
3232
3366
  overflowY: "auto"
3233
3367
  }
3234
3368
  }, /*#__PURE__*/React.createElement("div", {
3235
- className: "add-trip-form",
3236
- style: {
3237
- display: "grid",
3238
- gridTemplateColumns: "repeat(3, 1fr)",
3239
- gap: "20px"
3240
- }
3369
+ className: "add-trip-form"
3241
3370
  }, /*#__PURE__*/React.createElement("div", {
3242
3371
  className: "field-group"
3243
3372
  }, /*#__PURE__*/React.createElement(CardLabel, {
@@ -3245,10 +3374,32 @@ const AddTripModal = ({
3245
3374
  marginBottom: "8px",
3246
3375
  fontWeight: "500"
3247
3376
  }
3248
- }, t("WT_FIXED_POINT_CODE")), /*#__PURE__*/React.createElement(TextInput, {
3377
+ }, t("WT_FIXED_POINT_CODE")), isFixedPointLoading ? /*#__PURE__*/React.createElement(Loader, null) : /*#__PURE__*/React.createElement(Controller, {
3378
+ control: control,
3249
3379
  name: "fixedPointCode",
3250
- inputRef: register()
3251
- })), /*#__PURE__*/React.createElement("div", {
3380
+ render: props => /*#__PURE__*/React.createElement(CustomNameDropdown, {
3381
+ option: fixedPointOptions,
3382
+ optionKey: "displayLabel",
3383
+ selected: fixedPointOptions.find(opt => opt.value === props.value),
3384
+ select: val => props.onChange(val.value),
3385
+ t: t,
3386
+ optionsHeader: {
3387
+ name: "WT_NAME",
3388
+ mobileNumber: "WT_MOBILE_NUMBER",
3389
+ locality: "WT_LOCALITY"
3390
+ }
3391
+ })
3392
+ }), selectedFixedPoint && /*#__PURE__*/React.createElement("div", {
3393
+ style: {
3394
+ marginTop: "8px",
3395
+ padding: "10px",
3396
+ backgroundColor: "#f9f9f9",
3397
+ border: "1px solid #ddd",
3398
+ borderRadius: "4px",
3399
+ fontSize: "14px",
3400
+ color: "#555"
3401
+ }
3402
+ }, /*#__PURE__*/React.createElement("strong", null, t("WT_ADDRESS"), ":"), " ", selectedFixedPoint.fullAddress)), /*#__PURE__*/React.createElement("div", {
3252
3403
  className: "field-group"
3253
3404
  }, /*#__PURE__*/React.createElement(CardLabel, {
3254
3405
  style: {
@@ -3258,12 +3409,14 @@ const AddTripModal = ({
3258
3409
  }, t("WT_DAY")), /*#__PURE__*/React.createElement(Controller, {
3259
3410
  control: control,
3260
3411
  name: "day",
3261
- render: props => /*#__PURE__*/React.createElement(Dropdown, {
3262
- option: dayOptions,
3263
- optionKey: "label",
3264
- selected: props.value,
3265
- select: props.onChange,
3266
- t: t
3412
+ render: props => /*#__PURE__*/React.createElement(MultiSelectDropdown, {
3413
+ options: dayOptions,
3414
+ optionsKey: "label",
3415
+ selected: dayOptions.filter(opt => (props.value || []).some(v => v === opt.value || (v === null || v === void 0 ? void 0 : v.value) === opt.value)),
3416
+ onSelect: val => props.onChange(val.map(v => Array.isArray(v) ? v[1] : (v === null || v === void 0 ? void 0 : v.value) || v)),
3417
+ t: t,
3418
+ defaultLabel: t("WT_SELECT_DAYS"),
3419
+ defaultUnit: t("WT_DAYS")
3267
3420
  })
3268
3421
  })), /*#__PURE__*/React.createElement("div", {
3269
3422
  className: "field-group"
@@ -3282,16 +3435,6 @@ const AddTripModal = ({
3282
3435
  marginBottom: "8px",
3283
3436
  fontWeight: "500"
3284
3437
  }
3285
- }, t("WT_VEHICLE_ID")), /*#__PURE__*/React.createElement(TextInput, {
3286
- name: "vehicleId",
3287
- inputRef: register()
3288
- })), /*#__PURE__*/React.createElement("div", {
3289
- className: "field-group"
3290
- }, /*#__PURE__*/React.createElement(CardLabel, {
3291
- style: {
3292
- marginBottom: "8px",
3293
- fontWeight: "500"
3294
- }
3295
3438
  }, t("WT_ARRIVAL_TIME_TO_FPL")), /*#__PURE__*/React.createElement(TextInput, {
3296
3439
  name: "arrivalTimeFpl",
3297
3440
  inputRef: register(),
@@ -3368,7 +3511,7 @@ const AddTripModal = ({
3368
3511
  t: t
3369
3512
  })
3370
3513
  })), /*#__PURE__*/React.createElement("div", {
3371
- className: "field-group",
3514
+ className: "field-group remarks-field-group",
3372
3515
  style: {
3373
3516
  gridColumn: "span 2"
3374
3517
  }
@@ -3413,41 +3556,82 @@ const AddTripModal = ({
3413
3556
  }, initialValues ? t("WT_UPDATE") : t("CS_COMMON_SAVE")))));
3414
3557
  };
3415
3558
 
3416
- const FixedPointScheduleManagement = () => {
3559
+ const FixedPointScheduleManagement = ({
3560
+ ...props
3561
+ }) => {
3562
+ var _data$;
3417
3563
  const {
3418
3564
  t
3419
3565
  } = useTranslation();
3420
3566
  const tenantId = Digit.ULBService.getCurrentTenantId();
3421
3567
  const [showModal, setShowModal] = useState(false);
3422
3568
  const [toast, setToast] = useState(null);
3423
- const [selectedDay, setSelectedDay] = useState("Mon");
3569
+ const [selectedDay, setSelectedDay] = useState("all");
3424
3570
  const [year, setYear] = useState({
3425
3571
  label: "Year 2026",
3426
3572
  value: "2026"
3427
3573
  });
3428
3574
  const [fixedPoint, setFixedPoint] = useState({
3429
- label: "FP01",
3430
- value: "FP01"
3575
+ label: "All Fixed Points",
3576
+ value: "all"
3431
3577
  });
3432
3578
  const [day, setDay] = useState({
3433
- label: "Mon",
3434
- value: "Mon"
3579
+ label: "All Days",
3580
+ value: "all"
3435
3581
  });
3436
3582
  const [status, setStatus] = useState({
3437
3583
  label: "All Status",
3438
3584
  value: "all"
3439
3585
  });
3440
3586
  const [vehicle, setVehicle] = useState({
3441
- label: "DL1LAG7729",
3442
- value: "DL1LAG7729"
3587
+ label: "All Vehicles",
3588
+ value: "all"
3443
3589
  });
3444
3590
  const [editingRowIndex, setEditingRowIndex] = useState(null);
3445
- const [filters, setFilters] = useState({});
3591
+ const [pageOffset, setPageOffset] = useState(0);
3592
+ const [pageSize, setPageSize] = useState(10);
3593
+ const [filters, setFilters] = useState({
3594
+ limit: 10,
3595
+ offset: 0
3596
+ });
3446
3597
  const {
3447
3598
  isLoading,
3448
3599
  data: scheduleData,
3449
3600
  refetch: reSearch
3450
3601
  } = Digit.Hooks.wt.useFixedPointScheduleSearch(tenantId, filters);
3602
+ const {
3603
+ data: fixedPointData,
3604
+ isLoading: isFpLoading
3605
+ } = Digit.Hooks.wt.useFixedPointSearchAPI({
3606
+ tenantId,
3607
+ filters: {
3608
+ offset: 0,
3609
+ limit: 100
3610
+ }
3611
+ });
3612
+ const {
3613
+ data: allSchedulesData
3614
+ } = Digit.Hooks.wt.useFixedPointScheduleSearch(tenantId, {
3615
+ limit: 1000,
3616
+ offset: 0
3617
+ });
3618
+ const fixedPoints = React.useMemo(() => {
3619
+ const fromFpApi = (fixedPointData === null || fixedPointData === void 0 ? void 0 : fixedPointData.fixedPointTimeTableDetails) || (fixedPointData === null || fixedPointData === void 0 ? void 0 : fixedPointData.waterTankerBookingDetail) || (fixedPointData === null || fixedPointData === void 0 ? void 0 : fixedPointData.fixedPoints) || [];
3620
+ const fromScheduleApi = (allSchedulesData === null || allSchedulesData === void 0 ? void 0 : allSchedulesData.fixedPointTimeTableDetails) || [];
3621
+ const combinedData = [...fromFpApi, ...fromScheduleApi];
3622
+ const points = combinedData.map(fp => {
3623
+ var _fp$applicantDetail;
3624
+ return {
3625
+ label: fp.fixedPointCode || fp.name || ((_fp$applicantDetail = fp.applicantDetail) === null || _fp$applicantDetail === void 0 ? void 0 : _fp$applicantDetail.name) || fp.bookingId,
3626
+ value: fp.fixedPointCode || fp.bookingId
3627
+ };
3628
+ }).filter(p => p.label && p.value);
3629
+ const uniquePoints = points.filter((v, i, a) => a.findIndex(t => t.value === v.value) === i);
3630
+ return [{
3631
+ label: t("WT_ALL_FIXED_POINTS") !== "WT_ALL_FIXED_POINTS" ? t("WT_ALL_FIXED_POINTS") : "All Fixed Points",
3632
+ value: "all"
3633
+ }, ...uniquePoints];
3634
+ }, [fixedPointData, allSchedulesData, t]);
3451
3635
  const {
3452
3636
  mutate: createSchedule
3453
3637
  } = Digit.Hooks.wt.useCreateFixedPointSchedule(tenantId);
@@ -3503,20 +3687,42 @@ const FixedPointScheduleManagement = () => {
3503
3687
  returnToFpl: item.timeOfArrivingBackFplAfterDelivery,
3504
3688
  volume: item.volumeWaterTobeDelivery,
3505
3689
  vehicle: item.vehicleId,
3506
- active: item.isEnable ? "Y" : "N"
3690
+ active: item.isEnable ? "Y" : "N",
3691
+ totalCount: item.totalCount
3507
3692
  }));
3508
3693
  setData(mappedData);
3509
3694
  }
3510
3695
  }, [scheduleData]);
3511
- const handleSearch = () => {
3696
+ const fetchNextPage = () => {
3697
+ setPageOffset(prevState => prevState + pageSize);
3698
+ };
3699
+ const fetchPrevPage = () => {
3700
+ setPageOffset(prevState => prevState - pageSize);
3701
+ };
3702
+ const handlePageSizeChange = e => {
3703
+ setPageSize(Number(e.target.value));
3704
+ };
3705
+ const handleSearch = (customFilters = null, offset = null) => {
3512
3706
  var _day$value;
3513
- setFilters({
3707
+ const searchFilters = customFilters || {
3514
3708
  fixedPointCode: (fixedPoint === null || fixedPoint === void 0 ? void 0 : fixedPoint.value) === "all" ? "" : fixedPoint === null || fixedPoint === void 0 ? void 0 : fixedPoint.value,
3515
3709
  day: (day === null || day === void 0 ? void 0 : day.value) === "all" ? "" : day === null || day === void 0 ? void 0 : (_day$value = day.value) === null || _day$value === void 0 ? void 0 : _day$value.toUpperCase(),
3516
3710
  status: (status === null || status === void 0 ? void 0 : status.value) === "all" ? "" : status === null || status === void 0 ? void 0 : status.value,
3517
3711
  vehicleId: (vehicle === null || vehicle === void 0 ? void 0 : vehicle.value) === "all" ? "" : vehicle === null || vehicle === void 0 ? void 0 : vehicle.value
3712
+ };
3713
+ const newOffset = offset !== null ? offset : 0;
3714
+ if (offset === null) setPageOffset(0);
3715
+ setFilters({
3716
+ ...searchFilters,
3717
+ limit: pageSize,
3718
+ offset: newOffset
3518
3719
  });
3519
3720
  };
3721
+ React.useEffect(() => {
3722
+ if (pageOffset !== 0) {
3723
+ handleSearch(null, pageOffset);
3724
+ }
3725
+ }, [pageOffset, pageSize]);
3520
3726
  const columns = React.useMemo(() => [{
3521
3727
  Header: t("WT_SCHEDULE_ID"),
3522
3728
  accessor: "scheduleId"
@@ -3595,7 +3801,7 @@ const FixedPointScheduleManagement = () => {
3595
3801
  }
3596
3802
  }, t("WT_DELETE")))
3597
3803
  }], [t]);
3598
- const days = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"];
3804
+ const days = ["MONDAY", "TUESDAY", "WEDNESDAY", "THURSDAY", "FRIDAY", "SATURDAY", "SUNDAY"];
3599
3805
  return /*#__PURE__*/React.createElement("div", {
3600
3806
  className: "fixed-point-schedule-management"
3601
3807
  }, /*#__PURE__*/React.createElement(Card, {
@@ -3609,78 +3815,78 @@ const FixedPointScheduleManagement = () => {
3609
3815
  }
3610
3816
  }, /*#__PURE__*/React.createElement("div", {
3611
3817
  className: "finance-mainlayout-col1"
3612
- }, /*#__PURE__*/React.createElement(Dropdown, {
3818
+ }, /*#__PURE__*/React.createElement(CardLabel, null, t("WT_EXPORT")), /*#__PURE__*/React.createElement(Dropdown, {
3613
3819
  option: [{
3614
- label: "Year 2024",
3615
- value: "2024"
3820
+ label: t("WT_EXCEL_WEEKWISE"),
3821
+ value: "Weekwise"
3616
3822
  }, {
3617
- label: "Year 2025",
3618
- value: "2025"
3823
+ label: t("WT_EXCEL_MONTHWISE"),
3824
+ value: "Monthwise"
3619
3825
  }, {
3620
- label: "Year 2026",
3621
- value: "2026"
3826
+ label: t("WT_EXCEL_YEARWISE"),
3827
+ value: "Yearwise"
3622
3828
  }],
3623
3829
  optionKey: "label",
3624
- selected: year,
3830
+ placeholder: t("WT_EXPORT"),
3625
3831
  t: t,
3626
- select: setYear
3832
+ select: handleDownload
3627
3833
  })), /*#__PURE__*/React.createElement("div", {
3628
3834
  className: "finance-mainlayout-col1"
3629
- }, /*#__PURE__*/React.createElement(Dropdown, {
3630
- option: [{
3631
- label: "All Fixed Points",
3632
- value: "all"
3633
- }, {
3634
- label: "FP01",
3635
- value: "FP01"
3636
- }, {
3637
- label: "FP02",
3638
- value: "FP02"
3639
- }, {
3640
- label: "FP03",
3641
- value: "FP03"
3642
- }],
3835
+ }, /*#__PURE__*/React.createElement(CardLabel, null, t("WT_FIXED_POINT")), /*#__PURE__*/React.createElement(Dropdown, {
3836
+ option: fixedPoints,
3643
3837
  optionKey: "label",
3644
3838
  selected: fixedPoint,
3645
3839
  t: t,
3646
- select: setFixedPoint,
3647
- placeholder: "All Fixed Points"
3840
+ select: val => {
3841
+ setFixedPoint(val);
3842
+ },
3843
+ placeholder: t("WT_ALL_FIXED_POINTS")
3648
3844
  })), /*#__PURE__*/React.createElement("div", {
3649
3845
  className: "finance-mainlayout-col1"
3650
- }, /*#__PURE__*/React.createElement(Dropdown, {
3846
+ }, /*#__PURE__*/React.createElement(CardLabel, null, t("WT_DAY")), /*#__PURE__*/React.createElement(Dropdown, {
3651
3847
  option: [{
3652
3848
  label: "All Days",
3653
3849
  value: "all"
3654
3850
  }, {
3655
- label: "Mon",
3656
- value: "Mon"
3851
+ label: t("MONDAY"),
3852
+ value: "MONDAY"
3657
3853
  }, {
3658
- label: "Tue",
3659
- value: "Tue"
3854
+ label: t("TUESDAY"),
3855
+ value: "TUESDAY"
3660
3856
  }, {
3661
- label: "Wed",
3662
- value: "Wed"
3857
+ label: t("WEDNESDAY"),
3858
+ value: "WEDNESDAY"
3663
3859
  }, {
3664
- label: "Thu",
3665
- value: "Thu"
3860
+ label: t("THURSDAY"),
3861
+ value: "THURSDAY"
3666
3862
  }, {
3667
- label: "Fri",
3668
- value: "Fri"
3863
+ label: t("FRIDAY"),
3864
+ value: "FRIDAY"
3669
3865
  }, {
3670
- label: "Sat",
3671
- value: "Sat"
3866
+ label: t("SATURDAY"),
3867
+ value: "SATURDAY"
3672
3868
  }, {
3673
- label: "Sun",
3674
- value: "Sun"
3869
+ label: t("SUNDAY"),
3870
+ value: "SUNDAY"
3675
3871
  }],
3676
3872
  optionKey: "label",
3677
3873
  selected: day,
3678
3874
  t: t,
3679
- select: setDay,
3875
+ select: val => {
3876
+ var _val$value;
3877
+ setDay(val);
3878
+ setSelectedDay(val.value);
3879
+ handleSearch({
3880
+ fixedPointCode: (fixedPoint === null || fixedPoint === void 0 ? void 0 : fixedPoint.value) === "all" ? "" : fixedPoint === null || fixedPoint === void 0 ? void 0 : fixedPoint.value,
3881
+ day: (val === null || val === void 0 ? void 0 : val.value) === "all" ? "" : val === null || val === void 0 ? void 0 : (_val$value = val.value) === null || _val$value === void 0 ? void 0 : _val$value.toUpperCase(),
3882
+ status: (status === null || status === void 0 ? void 0 : status.value) === "all" ? "" : status === null || status === void 0 ? void 0 : status.value,
3883
+ vehicleId: (vehicle === null || vehicle === void 0 ? void 0 : vehicle.value) === "all" ? "" : vehicle === null || vehicle === void 0 ? void 0 : vehicle.value
3884
+ });
3885
+ },
3680
3886
  placeholder: "All Days"
3681
3887
  })), /*#__PURE__*/React.createElement("div", {
3682
3888
  className: "finance-mainlayout-col1"
3683
- }, /*#__PURE__*/React.createElement(Dropdown, {
3889
+ }, /*#__PURE__*/React.createElement(CardLabel, null, t("WT_STATUS")), /*#__PURE__*/React.createElement(Dropdown, {
3684
3890
  option: [{
3685
3891
  label: "All Status",
3686
3892
  value: "all"
@@ -3694,76 +3900,61 @@ const FixedPointScheduleManagement = () => {
3694
3900
  optionKey: "label",
3695
3901
  selected: status,
3696
3902
  t: t,
3697
- select: setStatus,
3903
+ select: val => {
3904
+ var _day$value2;
3905
+ setStatus(val);
3906
+ handleSearch({
3907
+ fixedPointCode: (fixedPoint === null || fixedPoint === void 0 ? void 0 : fixedPoint.value) === "all" ? "" : fixedPoint === null || fixedPoint === void 0 ? void 0 : fixedPoint.value,
3908
+ day: (day === null || day === void 0 ? void 0 : day.value) === "all" ? "" : day === null || day === void 0 ? void 0 : (_day$value2 = day.value) === null || _day$value2 === void 0 ? void 0 : _day$value2.toUpperCase(),
3909
+ status: (val === null || val === void 0 ? void 0 : val.value) === "all" ? "" : val === null || val === void 0 ? void 0 : val.value,
3910
+ vehicleId: (vehicle === null || vehicle === void 0 ? void 0 : vehicle.value) === "all" ? "" : vehicle === null || vehicle === void 0 ? void 0 : vehicle.value
3911
+ });
3912
+ },
3698
3913
  placeholder: "All Status"
3699
- }))), /*#__PURE__*/React.createElement("div", {
3700
- className: "finance-mainlayout",
3914
+ })), /*#__PURE__*/React.createElement("div", {
3915
+ className: "finance-mainlayout-col1",
3701
3916
  style: {
3702
- marginBottom: "20px"
3917
+ alignSelf: "flex-end"
3703
3918
  }
3704
- }, /*#__PURE__*/React.createElement("div", {
3705
- className: "finance-mainlayout-col1"
3706
- }, /*#__PURE__*/React.createElement(Dropdown, {
3707
- option: [{
3708
- label: "All Vehicles",
3709
- value: "all"
3710
- }, {
3711
- label: "DL1LAG7729",
3712
- value: "DL1LAG7729"
3713
- }, {
3714
- label: "DL1LAG7730",
3715
- value: "DL1LAG7730"
3716
- }, {
3717
- label: "DL1LAG7731",
3718
- value: "DL1LAG7731"
3719
- }],
3720
- optionKey: "label",
3721
- selected: vehicle,
3722
- t: t,
3723
- select: setVehicle,
3724
- placeholder: "All Vehicles"
3725
- })), /*#__PURE__*/React.createElement("div", {
3726
- className: "finance-mainlayout-col1"
3727
- }), /*#__PURE__*/React.createElement("div", {
3728
- className: "finance-mainlayout-col1"
3729
- }, /*#__PURE__*/React.createElement(Dropdown, {
3730
- option: [{
3731
- label: t("WT_EXCEL_WEEKWISE"),
3732
- value: "Weekwise"
3733
- }, {
3734
- label: t("WT_EXCEL_MONTHWISE"),
3735
- value: "Monthwise"
3736
- }, {
3737
- label: t("WT_EXCEL_YEARWISE"),
3738
- value: "Yearwise"
3739
- }],
3740
- optionKey: "label",
3741
- placeholder: t("WT_EXPORT"),
3742
- t: t,
3743
- select: handleDownload
3744
- })), /*#__PURE__*/React.createElement("div", {
3745
- className: "finance-mainlayout-col1"
3746
3919
  }, /*#__PURE__*/React.createElement(SubmitBar, {
3747
3920
  label: t("ES_COMMON_SEARCH"),
3748
- onSubmit: handleSearch
3921
+ onSubmit: () => handleSearch()
3749
3922
  }))), /*#__PURE__*/React.createElement("div", {
3750
3923
  style: {
3751
3924
  display: "flex",
3752
3925
  gap: "5px",
3753
3926
  marginBottom: "20px"
3754
3927
  }
3755
- }, days.map(day => /*#__PURE__*/React.createElement("button", {
3756
- key: day,
3757
- onClick: () => setSelectedDay(day),
3928
+ }, days.map(dayItem => /*#__PURE__*/React.createElement("button", {
3929
+ key: dayItem,
3930
+ onClick: () => {
3931
+ setSelectedDay(dayItem);
3932
+ const dayOption = {
3933
+ label: dayItem,
3934
+ value: dayItem
3935
+ };
3936
+ setDay(dayOption);
3937
+ handleSearch({
3938
+ fixedPointCode: (fixedPoint === null || fixedPoint === void 0 ? void 0 : fixedPoint.value) === "all" ? "" : fixedPoint === null || fixedPoint === void 0 ? void 0 : fixedPoint.value,
3939
+ day: dayItem.toUpperCase(),
3940
+ status: (status === null || status === void 0 ? void 0 : status.value) === "all" ? "" : status === null || status === void 0 ? void 0 : status.value,
3941
+ vehicleId: (vehicle === null || vehicle === void 0 ? void 0 : vehicle.value) === "all" ? "" : vehicle === null || vehicle === void 0 ? void 0 : vehicle.value
3942
+ });
3943
+ },
3758
3944
  style: {
3759
3945
  padding: "8px 16px",
3760
3946
  border: "1px solid #ccc",
3761
3947
  borderRadius: "4px",
3762
- background: selectedDay === day ? "#1D4E7F" : "#fff",
3763
- color: selectedDay === day ? "#fff" : "#333",
3948
+ background: selectedDay === dayItem ? "#1D4E7F" : "#fff",
3949
+ color: selectedDay === dayItem ? "#fff" : "#333",
3764
3950
  cursor: "pointer"
3765
3951
  }
3766
- }, t(day.toUpperCase())))), /*#__PURE__*/React.createElement(Table, {
3952
+ }, t(dayItem.toUpperCase())))), /*#__PURE__*/React.createElement("div", {
3953
+ style: {
3954
+ width: "100%",
3955
+ overflowX: "auto"
3956
+ }
3957
+ }, /*#__PURE__*/React.createElement(ApplicationTable, {
3767
3958
  t: t,
3768
3959
  data: data,
3769
3960
  columns: columns,
@@ -3774,8 +3965,17 @@ const FixedPointScheduleManagement = () => {
3774
3965
  inboxStyles: {
3775
3966
  overflowX: "auto"
3776
3967
  },
3777
- isLoading: isLoading
3778
- }), /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement("button", {
3968
+ isLoading: isLoading,
3969
+ onPageSizeChange: handlePageSizeChange,
3970
+ currentPage: Math.floor(pageOffset / pageSize),
3971
+ onNextPage: fetchNextPage,
3972
+ onPrevPage: fetchPrevPage,
3973
+ pageSizeLimit: pageSize,
3974
+ onSort: props.onSort,
3975
+ disableSort: props.disableSort,
3976
+ sortParams: props.sortParams,
3977
+ totalRecords: (scheduleData === null || scheduleData === void 0 ? void 0 : scheduleData.count) || (scheduleData === null || scheduleData === void 0 ? void 0 : scheduleData.totalCount) || (data === null || data === void 0 ? void 0 : (_data$ = data[0]) === null || _data$ === void 0 ? void 0 : _data$.totalCount)
3978
+ })), /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement("button", {
3779
3979
  onClick: () => {
3780
3980
  setEditingRowIndex(null);
3781
3981
  setShowModal(true);
@@ -3801,10 +4001,10 @@ const FixedPointScheduleManagement = () => {
3801
4001
  initialValues: editingRowIndex !== null ? {
3802
4002
  scheduleId: data[editingRowIndex].scheduleId,
3803
4003
  fixedPointCode: data[editingRowIndex].fixedPoint,
3804
- day: {
4004
+ day: [{
3805
4005
  label: t(data[editingRowIndex].day),
3806
4006
  value: data[editingRowIndex].day
3807
- },
4007
+ }],
3808
4008
  frequencyNo: data[editingRowIndex].freq,
3809
4009
  arrivalTimeFpl: data[editingRowIndex].arrToFpl,
3810
4010
  departureTimeFpl: data[editingRowIndex].depFromFpl,
@@ -3819,24 +4019,37 @@ const FixedPointScheduleManagement = () => {
3819
4019
  }
3820
4020
  } : null,
3821
4021
  onSubmit: formData => {
3822
- var _formData$day, _formData$day$value, _formData$active, _formData$active2;
4022
+ var _formData$active, _formData$active2;
4023
+ const formDataDay = formData === null || formData === void 0 ? void 0 : formData.day;
4024
+ let daysArr = [];
4025
+ if (Array.isArray(formDataDay)) {
4026
+ daysArr = formDataDay.map(d => typeof d === "string" ? d : (d === null || d === void 0 ? void 0 : d.value) || (Array.isArray(d) ? d[1] : d)).filter(d => typeof d === "string" && d !== "WT_SELECT_ALL");
4027
+ if (daysArr.length === 0 && formDataDay.some(d => (typeof d === "string" ? d : (d === null || d === void 0 ? void 0 : d.value) || (Array.isArray(d) ? d[1] : d)) === "WT_SELECT_ALL")) {
4028
+ daysArr = ["MONDAY", "TUESDAY", "WEDNESDAY", "THURSDAY", "FRIDAY", "SATURDAY", "SUNDAY"];
4029
+ }
4030
+ } else if (formDataDay) {
4031
+ const dayVal = typeof formDataDay === "string" ? formDataDay : formDataDay === null || formDataDay === void 0 ? void 0 : formDataDay.value;
4032
+ if (dayVal && dayVal !== "WT_SELECT_ALL") daysArr = [dayVal];
4033
+ }
4034
+ const fixedPointDetails = {
4035
+ tenantId,
4036
+ system_assigned_schedule_id: formData.scheduleId,
4037
+ fixed_point_code: formData.fixedPointCode,
4038
+ day: daysArr.map(d => d.toUpperCase()),
4039
+ trip_no: formData.frequencyNo,
4040
+ arrival_time_to_fpl: formData.arrivalTimeFpl,
4041
+ departure_time_from_fpl: formData.departureTimeFpl,
4042
+ arrival_time_delivery_point: formData.arrivalFixedPoint,
4043
+ departure_time_delivery_point: formData.departureFixedPoint,
4044
+ time_of_arriving_back_fpl_after_delivery: formData.returnFpl,
4045
+ volume_water_tobe_delivery: formData.volume,
4046
+ active: ((_formData$active = formData.active) === null || _formData$active === void 0 ? void 0 : _formData$active.value) === "Yes" || formData.active === "Yes",
4047
+ is_enable: ((_formData$active2 = formData.active) === null || _formData$active2 === void 0 ? void 0 : _formData$active2.value) === "Yes" || formData.active === "Yes",
4048
+ remarks: formData.remarks,
4049
+ vehicle_id: formData.vehicleId
4050
+ };
3823
4051
  const payload = {
3824
- fixedPointDetails: {
3825
- system_assigned_schedule_id: formData.scheduleId,
3826
- fixed_point_code: formData.fixedPointCode,
3827
- day: (_formData$day = formData.day) === null || _formData$day === void 0 ? void 0 : (_formData$day$value = _formData$day.value) === null || _formData$day$value === void 0 ? void 0 : _formData$day$value.toUpperCase(),
3828
- trip_no: formData.frequencyNo,
3829
- arrival_time_to_fpl: formData.arrivalTimeFpl,
3830
- departure_time_from_fpl: formData.departureTimeFpl,
3831
- arrival_time_delivery_point: formData.arrivalFixedPoint,
3832
- departure_time_delivery_point: formData.departureFixedPoint,
3833
- time_of_arriving_back_fpl_after_delivery: formData.returnFpl,
3834
- volume_water_tobe_delivery: formData.volume,
3835
- active: ((_formData$active = formData.active) === null || _formData$active === void 0 ? void 0 : _formData$active.value) === "Yes",
3836
- is_enable: ((_formData$active2 = formData.active) === null || _formData$active2 === void 0 ? void 0 : _formData$active2.value) === "Yes",
3837
- remarks: formData.remarks,
3838
- vehicle_id: formData.vehicleId
3839
- }
4052
+ fixedPointDetails
3840
4053
  };
3841
4054
  createSchedule(payload, {
3842
4055
  onError: (error, variables) => {
@@ -4077,7 +4290,7 @@ const RouteLayer = ({
4077
4290
  }, /*#__PURE__*/React.createElement("h4", {
4078
4291
  style: {
4079
4292
  margin: 0,
4080
- color: "#1a237e"
4293
+ color: "#667eea"
4081
4294
  }
4082
4295
  }, "Route Information"), /*#__PURE__*/React.createElement("button", {
4083
4296
  onClick: () => setShowSteps(false),
@@ -4132,7 +4345,7 @@ const RouteLayer = ({
4132
4345
  width: "20px",
4133
4346
  height: "20px",
4134
4347
  borderRadius: "50%",
4135
- background: "#1a237e",
4348
+ background: "#667eea",
4136
4349
  color: "white",
4137
4350
  display: "flex",
4138
4351
  alignItems: "center",
@@ -4170,12 +4383,12 @@ const RouteMarkers = ({
4170
4383
  className: "distance-marker",
4171
4384
  html: `<div style="
4172
4385
  background: white;
4173
- border: 2px solid #2196f3;
4386
+ border: 2px solid #667eea;
4174
4387
  border-radius: 12px;
4175
4388
  padding: 2px 6px;
4176
4389
  font-size: 10px;
4177
4390
  font-weight: bold;
4178
- color: #1a237e;
4391
+ color: #667eea;
4179
4392
  white-space: nowrap;
4180
4393
  ">${(i / 1000).toFixed(0)} km</div>`,
4181
4394
  iconSize: [40, 20],
@@ -4274,7 +4487,7 @@ const DriverCard = ({
4274
4487
  style: {
4275
4488
  fontWeight: "600",
4276
4489
  fontSize: "16px",
4277
- color: "#1a237e",
4490
+ color: "#667eea",
4278
4491
  marginBottom: "4px",
4279
4492
  overflow: "hidden",
4280
4493
  textOverflow: "ellipsis",
@@ -4377,7 +4590,7 @@ const DriverCard = ({
4377
4590
  style: {
4378
4591
  fontSize: "14px",
4379
4592
  fontWeight: "600",
4380
- color: "#1a237e"
4593
+ color: "#667eea"
4381
4594
  }
4382
4595
  }, eta, " min")), driver.speed && /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
4383
4596
  style: {
@@ -4531,7 +4744,7 @@ function LiveTrackingSystem() {
4531
4744
  top: "10px",
4532
4745
  left: "10px",
4533
4746
  zIndex: 2000,
4534
- background: "#1a237e",
4747
+ background: "#667eea",
4535
4748
  color: "white",
4536
4749
  border: "none",
4537
4750
  borderRadius: "8px",
@@ -4572,7 +4785,7 @@ function LiveTrackingSystem() {
4572
4785
  }, showSidebar && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
4573
4786
  style: {
4574
4787
  padding: isMobile ? "16px" : "24px",
4575
- background: "linear-gradient(135deg, #1a237e, #0d47a1)",
4788
+ background: "linear-gradient(135deg, #667eea, #0d47a1)",
4576
4789
  color: "white"
4577
4790
  }
4578
4791
  }, isMobile && /*#__PURE__*/React.createElement("button", {
@@ -4639,7 +4852,7 @@ function LiveTrackingSystem() {
4639
4852
  style: {
4640
4853
  fontSize: isMobile ? "16px" : "20px",
4641
4854
  fontWeight: "bold",
4642
- color: "#1a237e"
4855
+ color: "#667eea"
4643
4856
  }
4644
4857
  }, Object.keys(drivers).length)), /*#__PURE__*/React.createElement("div", {
4645
4858
  style: {
@@ -4708,7 +4921,7 @@ function LiveTrackingSystem() {
4708
4921
  transition: "border-color 0.2s",
4709
4922
  boxSizing: "border-box"
4710
4923
  },
4711
- onFocus: e => e.target.style.borderColor = "#1a237e",
4924
+ onFocus: e => e.target.style.borderColor = "#667eea",
4712
4925
  onBlur: e => e.target.style.borderColor = "#e0e0e0"
4713
4926
  }), /*#__PURE__*/React.createElement("div", {
4714
4927
  style: {
@@ -4724,7 +4937,7 @@ function LiveTrackingSystem() {
4724
4937
  padding: isMobile ? "6px" : "8px",
4725
4938
  border: "1px solid #e0e0e0",
4726
4939
  borderRadius: "6px",
4727
- background: filterOnline === filter ? "#1a237e" : "white",
4940
+ background: filterOnline === filter ? "#667eea" : "white",
4728
4941
  color: filterOnline === filter ? "white" : "#333",
4729
4942
  cursor: "pointer",
4730
4943
  fontSize: isMobile ? "11px" : "12px",
@@ -4824,7 +5037,7 @@ function LiveTrackingSystem() {
4824
5037
  style: {
4825
5038
  fontWeight: "bold",
4826
5039
  fontSize: isMobile ? "14px" : "16px",
4827
- color: "#1a237e",
5040
+ color: "#667eea",
4828
5041
  marginBottom: "8px",
4829
5042
  borderBottom: "1px solid #eee",
4830
5043
  paddingBottom: "4px"
@@ -4901,7 +5114,7 @@ function LiveTrackingSystem() {
4901
5114
  },
4902
5115
  style: {
4903
5116
  padding: isMobile ? "10px 12px" : "8px 16px",
4904
- background: "#1a237e",
5117
+ background: "#667eea",
4905
5118
  color: "white",
4906
5119
  border: "none",
4907
5120
  borderRadius: "4px",
@@ -4955,7 +5168,7 @@ function LiveTrackingSystem() {
4955
5168
  }, /*#__PURE__*/React.createElement("h4", {
4956
5169
  style: {
4957
5170
  margin: 0,
4958
- color: "#1a237e",
5171
+ color: "#667eea",
4959
5172
  fontSize: isMobile ? "14px" : "16px"
4960
5173
  }
4961
5174
  }, "Selected Driver"), /*#__PURE__*/React.createElement("span", {
@@ -5186,9 +5399,11 @@ const AddFixFillAddress = ({
5186
5399
  label: local.label
5187
5400
  }))) || [];
5188
5401
  useEffect(() => {
5189
- if (formData !== null && formData !== void 0 && formData.bookingId && lastBookingId.current !== formData.bookingId) {
5402
+ var _formData$address10;
5403
+ const currentId = (formData === null || formData === void 0 ? void 0 : formData.id) || (formData === null || formData === void 0 ? void 0 : formData.bookingId) || (formData === null || formData === void 0 ? void 0 : (_formData$address10 = formData.address) === null || _formData$address10 === void 0 ? void 0 : _formData$address10.id);
5404
+ if (currentId && lastBookingId.current !== currentId) {
5190
5405
  isInitialized.current = false;
5191
- lastBookingId.current = formData.bookingId;
5406
+ lastBookingId.current = currentId;
5192
5407
  }
5193
5408
  if (formData !== null && formData !== void 0 && formData.address && !isInitialized.current && allCities) {
5194
5409
  const addressData = formData.address;
@@ -5349,6 +5564,7 @@ const AddFillingPointAddress = () => {
5349
5564
  t
5350
5565
  } = useTranslation();
5351
5566
  const location = useLocation();
5567
+ const history = useHistory();
5352
5568
  const queryParams = new URLSearchParams(location.search);
5353
5569
  const editId = queryParams.get("id");
5354
5570
  const [formData, setFormData] = useState({});
@@ -5360,10 +5576,10 @@ const AddFillingPointAddress = () => {
5360
5576
  const {
5361
5577
  isLoading: isEditLoading,
5362
5578
  data: editData
5363
- } = Digit.Hooks.wt.useTankerSearchAPI({
5579
+ } = Digit.Hooks.wt.useFillPointSearch({
5364
5580
  tenantId,
5365
5581
  filters: {
5366
- bookingId: editId
5582
+ id: editId
5367
5583
  }
5368
5584
  }, {
5369
5585
  enabled: !!editId
@@ -5378,29 +5594,28 @@ const AddFillingPointAddress = () => {
5378
5594
  }));
5379
5595
  };
5380
5596
  useEffect(() => {
5381
- if (editId && editData !== null && editData !== void 0 && editData.waterTankerBookingDetail) {
5382
- const data = editData.waterTankerBookingDetail.find(item => item.bookingId === editId);
5597
+ if (editId && editData !== null && editData !== void 0 && editData.fillingPoints) {
5598
+ const data = editData.fillingPoints.find(item => item.id === editId);
5383
5599
  if (data) {
5384
- 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;
5385
5600
  setFormData({
5601
+ id: data.id,
5602
+ tenantId: data.tenantId,
5386
5603
  owner: {
5387
- 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),
5388
- emergencyName: (_data$fillingpointmet3 = data.fillingpointmetadata) === null || _data$fillingpointmet3 === void 0 ? void 0 : _data$fillingpointmet3.emergencyName,
5389
- aeName: (_data$fillingpointmet4 = data.fillingpointmetadata) === null || _data$fillingpointmet4 === void 0 ? void 0 : _data$fillingpointmet4.aeName,
5390
- 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),
5391
- 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),
5392
- jeName: (_data$fillingpointmet9 = data.fillingpointmetadata) === null || _data$fillingpointmet9 === void 0 ? void 0 : _data$fillingpointmet9.jeName,
5393
- 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),
5394
- 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),
5395
- eeName: (_data$fillingpointmet12 = data.fillingpointmetadata) === null || _data$fillingpointmet12 === void 0 ? void 0 : _data$fillingpointmet12.eeName,
5396
- 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),
5397
- 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)
5604
+ fillingPointName: data.fillingPointName,
5605
+ emergencyName: data.emergencyName,
5606
+ aeName: data.aeName,
5607
+ aeMobile: data.aeMobile,
5608
+ aeEmail: data.aeEmail,
5609
+ jeName: data.jeName,
5610
+ jeMobile: data.jeMobile,
5611
+ jeEmail: data.jeEmail,
5612
+ eeName: data.eeName,
5613
+ eeMobile: data.eeMobile,
5614
+ eeEmail: data.eeEmail
5398
5615
  },
5399
5616
  address: {
5400
5617
  ...data.address
5401
- },
5402
- bookingId: data.bookingId,
5403
- auditDetails: data.auditDetails
5618
+ }
5404
5619
  });
5405
5620
  }
5406
5621
  }
@@ -5415,19 +5630,25 @@ const AddFillingPointAddress = () => {
5415
5630
  const {
5416
5631
  mutate: createFillingPoint
5417
5632
  } = Digit.Hooks.wt.useCreateFillPoint(tenantId);
5633
+ const {
5634
+ mutate: updateFillingPoint
5635
+ } = Digit.Hooks.wt.useUpdateFillPoint(tenantId);
5418
5636
  const handleSubmit = e => {
5419
5637
  if (e && e.preventDefault) e.preventDefault();
5420
5638
  const payload = fillingPointPayload({
5421
5639
  ...formData,
5422
5640
  tenantId
5423
5641
  });
5424
- const mutation = createFillingPoint;
5642
+ const mutation = editId ? updateFillingPoint : createFillingPoint;
5425
5643
  mutation(payload, {
5426
5644
  onSuccess: () => {
5427
5645
  setShowToast({
5428
5646
  label: editId ? t("WT_FILLING_POINT_UPDATED_SUCCESS") : t("WT_FILLING_POINT_CREATED_SUCCESS")
5429
5647
  });
5430
- setTimeout(() => setShowToast(null), 5000);
5648
+ setTimeout(() => {
5649
+ setShowToast(null);
5650
+ history.push(`/digit-ui/employee/wt/search-filling-fix-point`);
5651
+ }, 3000);
5431
5652
  },
5432
5653
  onError: error => {
5433
5654
  var _error$response, _error$response$data, _error$response$data$, _error$response$data$2;
@@ -5466,7 +5687,8 @@ const AddFillingPointAddress = () => {
5466
5687
  t: t,
5467
5688
  config: addressConfig,
5468
5689
  onSelect: handleSelect,
5469
- formData: formData
5690
+ formData: formData,
5691
+ isEdit: !!editId
5470
5692
  }), /*#__PURE__*/React.createElement("div", {
5471
5693
  style: {
5472
5694
  display: "flex",
@@ -5707,7 +5929,11 @@ const SearchFillingPointAddress = () => {
5707
5929
  const [mobileNumber, setMobileNumber] = useState("");
5708
5930
  const [status, setStatus] = useState(null);
5709
5931
  const [searchParams, setSearchParams] = useState({});
5932
+ const [toast, setToast] = useState(null);
5710
5933
  const tenantId = Digit.ULBService.getCurrentTenantId();
5934
+ const closeToast = () => {
5935
+ setToast(null);
5936
+ };
5711
5937
  const {
5712
5938
  isLoading: isFixedLoading,
5713
5939
  data: fixedPointData,
@@ -5728,6 +5954,21 @@ const SearchFillingPointAddress = () => {
5728
5954
  }, {
5729
5955
  enabled: selectedTab === "FILLING_POINT"
5730
5956
  });
5957
+ const {
5958
+ isLoading: isAllFillingPointsLoading,
5959
+ data: allFillingPointsData
5960
+ } = Digit.Hooks.wt.useFillPointSearch({
5961
+ tenantId,
5962
+ filters: {
5963
+ limit: 1000
5964
+ }
5965
+ }, {
5966
+ enabled: true
5967
+ });
5968
+ const allFillingPoints = (allFillingPointsData === null || allFillingPointsData === void 0 ? void 0 : allFillingPointsData.fillingPoints) || [];
5969
+ const {
5970
+ mutate: mapFixedFilling
5971
+ } = Digit.Hooks.wt.useFixedFillingMapping(tenantId);
5731
5972
  const isLoading = selectedTab === "FIXED_POINT" ? isFixedLoading : isFillingLoading;
5732
5973
  const tableData = (selectedTab === "FIXED_POINT" ? fixedPointData === null || fixedPointData === void 0 ? void 0 : fixedPointData.waterTankerBookingDetail : fillingPointData === null || fillingPointData === void 0 ? void 0 : fillingPointData.fillingPoints) || [];
5733
5974
  const searchConfig = {
@@ -5794,6 +6035,32 @@ const SearchFillingPointAddress = () => {
5794
6035
  };
5795
6036
  setSearchParams(filters);
5796
6037
  };
6038
+ const onFillingPointSelect = (row, value) => {
6039
+ var _row$original$applica, _value$fillingpointme;
6040
+ const payload = {
6041
+ fixedFillingPointMapping: {
6042
+ fixed_pt_name: (_row$original$applica = row.original.applicantDetail) === null || _row$original$applica === void 0 ? void 0 : _row$original$applica.applicantId,
6043
+ filling_pt_name: value.id || value.bookingId || value.fillingPointId || value.uuid || ((_value$fillingpointme = value.fillingpointmetadata) === null || _value$fillingpointme === void 0 ? void 0 : _value$fillingpointme.fillingPointId)
6044
+ }
6045
+ };
6046
+ mapFixedFilling(payload, {
6047
+ onSuccess: () => {
6048
+ setToast({
6049
+ label: t("WT_FIXED_FILLING_MAPPING_SUCCESS")
6050
+ });
6051
+ setTimeout(closeToast, 5000);
6052
+ refetchFixed();
6053
+ },
6054
+ onError: err => {
6055
+ var _err$response, _err$response$data, _err$response$data$Er, _err$response$data$Er2;
6056
+ setToast({
6057
+ 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("WT_FIXED_FILLING_MAPPING_FAIL"),
6058
+ error: true
6059
+ });
6060
+ setTimeout(closeToast, 5000);
6061
+ }
6062
+ });
6063
+ };
5797
6064
  const columns = React.useMemo(() => {
5798
6065
  if (selectedTab === "FIXED_POINT") {
5799
6066
  return [{
@@ -5806,12 +6073,12 @@ const SearchFillingPointAddress = () => {
5806
6073
  Cell: ({
5807
6074
  row
5808
6075
  }) => {
5809
- var _row$original$applica;
6076
+ var _row$original$applica2;
5810
6077
  return /*#__PURE__*/React.createElement("span", {
5811
6078
  className: "link"
5812
6079
  }, /*#__PURE__*/React.createElement(Link, {
5813
6080
  to: `/digit-ui/employee/wt/add-fix-point-address?id=${row.original.bookingId}`
5814
- }, ((_row$original$applica = row.original.applicantDetail) === null || _row$original$applica === void 0 ? void 0 : _row$original$applica.name) || "NA"));
6081
+ }, ((_row$original$applica2 = row.original.applicantDetail) === null || _row$original$applica2 === void 0 ? void 0 : _row$original$applica2.name) || "NA"));
5815
6082
  }
5816
6083
  }, {
5817
6084
  Header: t("WT_MOBILE_NUMBER"),
@@ -5827,6 +6094,35 @@ const SearchFillingPointAddress = () => {
5827
6094
  return (row === null || row === void 0 ? void 0 : (_row$address = row.address) === null || _row$address === void 0 ? void 0 : _row$address.locality) || "NA";
5828
6095
  },
5829
6096
  id: "locality"
6097
+ }, {
6098
+ Header: t("WT_FILLING_POINT"),
6099
+ accessor: row => {
6100
+ var _row$fillingpointmeta;
6101
+ return (row === null || row === void 0 ? void 0 : row.fillingPointId) || (row === null || row === void 0 ? void 0 : (_row$fillingpointmeta = row.fillingpointmetadata) === null || _row$fillingpointmeta === void 0 ? void 0 : _row$fillingpointmeta.fillingPointId) || (row === null || row === void 0 ? void 0 : row.fillingPtName) || (row === null || row === void 0 ? void 0 : row.filling_pt_name) || (row === null || row === void 0 ? void 0 : row.fillingPoint) || "NA";
6102
+ },
6103
+ id: "fillingPoint",
6104
+ Cell: ({
6105
+ row
6106
+ }) => {
6107
+ var _row$original$filling, _row$original$filling2, _row$original$filling3, _row$original$filling4;
6108
+ const rowFpId = String(row.original.fillingPointId || ((_row$original$filling = row.original.fillingpointmetadata) === null || _row$original$filling === void 0 ? void 0 : _row$original$filling.fillingPointId) || row.original.fillingPtName || row.original.filling_pt_name || (typeof row.original.fillingPoint === "object" ? (_row$original$filling2 = row.original.fillingPoint) === null || _row$original$filling2 === void 0 ? void 0 : _row$original$filling2.id : row.original.fillingPoint) || ((_row$original$filling3 = row.original.fillingPointDetail) === null || _row$original$filling3 === void 0 ? void 0 : _row$original$filling3.id) || ((_row$original$filling4 = row.original.fillingPointDetail) === null || _row$original$filling4 === void 0 ? void 0 : _row$original$filling4.bookingId) || "");
6109
+ const selectedOption = allFillingPoints === null || allFillingPoints === void 0 ? void 0 : allFillingPoints.find(fp => {
6110
+ var _fp$fillingpointmetad;
6111
+ const fpId = String(fp.id || fp.bookingId || fp.fillingPointId || fp.uuid || ((_fp$fillingpointmetad = fp.fillingpointmetadata) === null || _fp$fillingpointmetad === void 0 ? void 0 : _fp$fillingpointmetad.fillingPointId));
6112
+ return fpId === rowFpId && rowFpId !== "undefined" && rowFpId !== "null" && rowFpId !== "";
6113
+ });
6114
+ return /*#__PURE__*/React.createElement(Dropdown, {
6115
+ className: "fsm-registry-dropdown",
6116
+ selected: selectedOption,
6117
+ option: allFillingPoints,
6118
+ select: value => onFillingPointSelect(row, value),
6119
+ style: {
6120
+ textAlign: "left"
6121
+ },
6122
+ optionKey: "fillingPointName",
6123
+ t: t
6124
+ });
6125
+ }
5830
6126
  }];
5831
6127
  } else {
5832
6128
  return [{
@@ -5840,10 +6136,18 @@ const SearchFillingPointAddress = () => {
5840
6136
  }, /*#__PURE__*/React.createElement(Link, {
5841
6137
  to: `/digit-ui/employee/wt/add-filling-point-address?id=${row.original.id}`
5842
6138
  }, row.original.fillingPointName || "NA"))
6139
+ }, {
6140
+ Header: t("WT_AE_NAME"),
6141
+ accessor: row => (row === null || row === void 0 ? void 0 : row.aeName) || "NA",
6142
+ id: "aeName"
5843
6143
  }, {
5844
6144
  Header: t("WT_JE_NAME"),
5845
6145
  accessor: row => (row === null || row === void 0 ? void 0 : row.jeName) || "NA",
5846
6146
  id: "jeName"
6147
+ }, {
6148
+ Header: t("WT_EE_NAME"),
6149
+ accessor: row => (row === null || row === void 0 ? void 0 : row.eeName) || "NA",
6150
+ id: "eeName"
5847
6151
  }, {
5848
6152
  Header: t("WT_LOCALITY"),
5849
6153
  accessor: row => {
@@ -5853,7 +6157,7 @@ const SearchFillingPointAddress = () => {
5853
6157
  id: "locality"
5854
6158
  }];
5855
6159
  }
5856
- }, [selectedTab, t]);
6160
+ }, [allFillingPoints, selectedTab, t]);
5857
6161
  const isMobile = window.Digit.Utils.browser.isMobile();
5858
6162
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Card, null, /*#__PURE__*/React.createElement("div", {
5859
6163
  className: "search-tabs-container",
@@ -5928,6 +6232,7 @@ const SearchFillingPointAddress = () => {
5928
6232
  label: t("ES_COMMON_SEARCH"),
5929
6233
  onSubmit: onSearch
5930
6234
  })))), /*#__PURE__*/React.createElement(Card, null, /*#__PURE__*/React.createElement(Table, {
6235
+ key: (allFillingPoints === null || allFillingPoints === void 0 ? void 0 : allFillingPoints.length) > 0 ? "loaded" : "loading",
5931
6236
  data: tableData,
5932
6237
  columns: columns,
5933
6238
  pageSize: 10,
@@ -5941,12 +6246,16 @@ const SearchFillingPointAddress = () => {
5941
6246
  }
5942
6247
  }),
5943
6248
  t: t,
5944
- isLoading: isLoading,
6249
+ isLoading: isLoading || isAllFillingPointsLoading,
5945
6250
  isSearchRequired: false,
5946
6251
  isDownloadRequired: true,
5947
6252
  isFilterRequired: true,
5948
6253
  isSortRequired: true
5949
- })));
6254
+ })), toast && /*#__PURE__*/React.createElement(Toast, {
6255
+ error: toast.error,
6256
+ label: toast.label,
6257
+ onClose: closeToast
6258
+ }));
5950
6259
  };
5951
6260
 
5952
6261
  const VendorAssign = ({
@@ -5958,83 +6267,60 @@ const VendorAssign = ({
5958
6267
  t
5959
6268
  } = useTranslation();
5960
6269
  const [showToast, setShowToast] = useState(null);
5961
- const [formData, setFormData] = useState({});
6270
+ const [workOrderId, setWorkOrderId] = useState("");
6271
+ const [vendor, setVendor] = useState(null);
5962
6272
  const [applicantName, setApplicantName] = useState("");
5963
6273
  const [mobileNumber, setMobileNumber] = useState("");
5964
6274
  const [alternateNumber, setAlternateNumber] = useState("");
5965
6275
  const [emailId, setEmailId] = useState("");
5966
6276
  const [validFrom, setValidFrom] = useState("");
5967
6277
  const [validTo, setValidTo] = useState("");
5968
- const [fillingPoint, setFillingPoint] = useState(null);
5969
6278
  const {
5970
- data: fetchedOptions,
5971
- isLoading: isFillingLoading
5972
- } = Digit.Hooks.wt.useTankerSearchAPI({
6279
+ data: vendorOptions,
6280
+ isLoading: isVendorLoading
6281
+ } = Digit.Hooks.fsm.useVendorSearch({
5973
6282
  tenantId,
5974
- filters: {}
5975
- }, {
5976
- select: data => {
5977
- var _data$waterTankerBook, _data$waterTankerBook2;
5978
- 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 => {
5979
- var _fp$fillingpointmetad, _fp$fillingpointmetad2, _fp$fillingpointmetad3, _fp$fillingpointmetad4, _fp$fillingpointmetad5;
5980
- return {
5981
- 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),
5982
- code: ((_fp$fillingpointmetad3 = fp.fillingpointmetadata) === null || _fp$fillingpointmetad3 === void 0 ? void 0 : _fp$fillingpointmetad3.fillingPointId) || fp.bookingId,
5983
- 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)
5984
- };
5985
- });
6283
+ filters: {
6284
+ status: "ACTIVE"
6285
+ },
6286
+ config: {
6287
+ select: data => (data === null || data === void 0 ? void 0 : data.vendor) || []
5986
6288
  }
5987
6289
  });
5988
- const fillingPointOptions = (fetchedOptions === null || fetchedOptions === void 0 ? void 0 : fetchedOptions.length) > 0 ? fetchedOptions : [{
5989
- name: "Filling Point 1",
5990
- code: "FILLING_POINT_1",
5991
- i18nKey: "WT_FILLING_POINT_1"
5992
- }, {
5993
- name: "Filling Point 2",
5994
- code: "FILLING_POINT_2",
5995
- i18nKey: "WT_FILLING_POINT_2"
5996
- }, {
5997
- name: "Filling Point 3",
5998
- code: "FILLING_POINT_3",
5999
- i18nKey: "WT_FILLING_POINT_3"
6000
- }, {
6001
- name: "Filling Point 4",
6002
- code: "FILLING_POINT_4",
6003
- i18nKey: "WT_FILLING_POINT_4"
6004
- }];
6290
+ const {
6291
+ mutate: createWorkOrder
6292
+ } = Digit.Hooks.wt.useVendorWorkOrderCreate(tenantId);
6005
6293
  const handleSubmit = () => {
6006
- if (!applicantName || !mobileNumber || !emailId || !validFrom || !validTo || !formData.address) {
6007
- setShowToast({
6008
- isError: true,
6009
- label: t("ES_COMMON_FILL_ALL_MANDATORY_FIELDS")
6010
- });
6011
- return;
6012
- }
6013
6294
  const payload = {
6014
- vendor: {
6295
+ vendorWorkOrder: {
6296
+ id: workOrderId,
6015
6297
  tenantId,
6016
6298
  name: applicantName,
6299
+ vendorId: (vendor === null || vendor === void 0 ? void 0 : vendor.code) || (vendor === null || vendor === void 0 ? void 0 : vendor.id),
6300
+ validFrom: new Date(validFrom).getTime(),
6301
+ validTo: new Date(validTo).getTime(),
6017
6302
  mobileNumber,
6018
6303
  alternateNumber,
6019
6304
  emailId,
6020
- validFrom,
6021
- validTo,
6022
- fillingPoint: fillingPoint === null || fillingPoint === void 0 ? void 0 : fillingPoint.code,
6023
- address: formData.address
6305
+ serviceType: "WT"
6024
6306
  }
6025
6307
  };
6026
- Digit.VendorService.createVendor(payload, tenantId).then(result => {
6027
- setShowToast({
6028
- isError: false,
6029
- label: t("ES_COMMON_SAVE_SUCCESS")
6030
- });
6031
- }).catch(err => {
6032
- var _err$response, _err$response$data, _err$response$data$Er, _err$response$data$Er2;
6033
- setShowToast({
6034
- isError: true,
6035
- 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")
6036
- });
6308
+ createWorkOrder(payload, {
6309
+ onSuccess: result => {
6310
+ setShowToast({
6311
+ isError: false,
6312
+ label: t("ES_COMMON_SAVE_SUCCESS")
6313
+ });
6314
+ },
6315
+ onError: err => {
6316
+ var _err$response, _err$response$data, _err$response$data$Er, _err$response$data$Er2;
6317
+ setShowToast({
6318
+ isError: true,
6319
+ 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")
6320
+ });
6321
+ }
6037
6322
  });
6323
+ console.log(payload, "iuyui");
6038
6324
  };
6039
6325
  const isMobile = window.Digit.Utils.browser.isMobile();
6040
6326
  return /*#__PURE__*/React.createElement("div", {
@@ -6062,61 +6348,15 @@ const VendorAssign = ({
6062
6348
  display: "flex",
6063
6349
  flexDirection: "column"
6064
6350
  }
6065
- }, /*#__PURE__*/React.createElement(CardLabel, null, `${t("COMMON_APPLICANT_NAME")}`, " ", /*#__PURE__*/React.createElement("span", {
6066
- className: "astericColor"
6067
- }, "*")), /*#__PURE__*/React.createElement(TextInput, {
6068
- t: t,
6069
- type: "text",
6070
- isMandatory: true,
6071
- name: "applicantName",
6072
- value: applicantName,
6073
- style: {
6074
- width: "100%"
6075
- },
6076
- onChange: e => setApplicantName(e.target.value)
6077
- })), /*#__PURE__*/React.createElement("div", {
6078
- style: {
6079
- display: "flex",
6080
- flexDirection: "column"
6081
- }
6082
- }, /*#__PURE__*/React.createElement(CardLabel, null, `${t("CORE_COMMON_APPLICANT_MOBILE_NUMBER")}`, " ", /*#__PURE__*/React.createElement("span", {
6083
- className: "astericColor"
6084
- }, "*")), /*#__PURE__*/React.createElement(MobileNumber, {
6085
- value: mobileNumber,
6086
- name: "mobileNumber",
6087
- onChange: value => setMobileNumber(value),
6088
- style: {
6089
- width: "100%"
6090
- }
6091
- })), /*#__PURE__*/React.createElement("div", {
6092
- style: {
6093
- display: "flex",
6094
- flexDirection: "column"
6095
- }
6096
- }, /*#__PURE__*/React.createElement(CardLabel, null, `${t("WT_VENDOR_ALT_MOBILE_NUMBER")}`), /*#__PURE__*/React.createElement(MobileNumber, {
6097
- value: alternateNumber,
6098
- name: "alternateNumber",
6099
- onChange: value => setAlternateNumber(value),
6100
- style: {
6101
- width: "100%"
6102
- }
6103
- })), /*#__PURE__*/React.createElement("div", {
6104
- style: {
6105
- display: "flex",
6106
- flexDirection: "column"
6107
- }
6108
- }, /*#__PURE__*/React.createElement(CardLabel, null, `${t("CORE_COMMON_APPLICANT_EMAIL_ID")}`, " ", /*#__PURE__*/React.createElement("span", {
6351
+ }, /*#__PURE__*/React.createElement(CardLabel, null, `${t("WT_VENDOR_NAME")}`, " ", /*#__PURE__*/React.createElement("span", {
6109
6352
  className: "astericColor"
6110
- }, "*")), /*#__PURE__*/React.createElement(TextInput, {
6353
+ }, "*")), /*#__PURE__*/React.createElement(Dropdown, {
6111
6354
  t: t,
6112
- type: "email",
6113
- isMandatory: true,
6114
- name: "emailId",
6115
- value: emailId,
6116
- style: {
6117
- width: "100%"
6118
- },
6119
- onChange: e => setEmailId(e.target.value)
6355
+ option: vendorOptions,
6356
+ optionKey: "name",
6357
+ select: setVendor,
6358
+ selected: vendor,
6359
+ placeholder: t("WT_SELECT_VENDOR")
6120
6360
  })), /*#__PURE__*/React.createElement("div", {
6121
6361
  style: {
6122
6362
  display: "flex",
@@ -6143,30 +6383,6 @@ const VendorAssign = ({
6143
6383
  style: {
6144
6384
  width: "100%"
6145
6385
  }
6146
- })), /*#__PURE__*/React.createElement("div", {
6147
- style: {
6148
- display: "flex",
6149
- flexDirection: "column"
6150
- }
6151
- }, /*#__PURE__*/React.createElement(CardLabel, null, `${t("COMMON_FILLING_POINT")}`, " ", /*#__PURE__*/React.createElement("span", {
6152
- className: "astericColor"
6153
- }, "*")), /*#__PURE__*/React.createElement(Dropdown, {
6154
- className: "form-field",
6155
- selected: fillingPoint,
6156
- disable: isFillingLoading,
6157
- select: setFillingPoint,
6158
- option: fillingPointOptions,
6159
- optionKey: "i18nKey",
6160
- optionCardStyles: {
6161
- overflowY: "auto",
6162
- maxHeight: "300px"
6163
- },
6164
- t: t,
6165
- name: "fillingPoint",
6166
- placeholder: t("WT_SELECT_FILLING_POINT") || "Select Filling Point",
6167
- style: {
6168
- width: "100%"
6169
- }
6170
6386
  })))), /*#__PURE__*/React.createElement("div", {
6171
6387
  style: {
6172
6388
  display: "flex",
@@ -21581,8 +21797,9 @@ const WTCitizenCard = () => {
21581
21797
  const {
21582
21798
  t
21583
21799
  } = useTranslation();
21800
+ const history = useHistory();
21584
21801
  const [total, setTotal] = useState("-");
21585
- const tenantId = Digit.ULBService.getCitizenCurrentTenant(true) || Digit.ULBService.getCurrentTenantId();
21802
+ const tenantId = Digit.ULBService.getCurrentTenantId() || Digit.ULBService.getCitizenCurrentTenant(true);
21586
21803
  const {
21587
21804
  data,
21588
21805
  isLoading,
@@ -21609,6 +21826,9 @@ const WTCitizenCard = () => {
21609
21826
  useEffect(() => {
21610
21827
  if (!isFetching && isSuccess) setTotal(data);
21611
21828
  }, [isFetching]);
21829
+ const handleDetailsClick = () => {
21830
+ history.push(`${APPLICATION_PATH}/citizen/wt/inbox`);
21831
+ };
21612
21832
  const links = [{
21613
21833
  label: t("ES_COMMON_INBOX"),
21614
21834
  link: `${APPLICATION_PATH}/citizen/wt/inbox`
@@ -21622,11 +21842,14 @@ const WTCitizenCard = () => {
21622
21842
  kpis: [{
21623
21843
  count: total === null || total === void 0 ? void 0 : total.totalCount,
21624
21844
  label: t("ES_TITLE_INBOX"),
21625
- link: `${APPLICATION_PATH}/employee/wt/inbox`
21845
+ link: `${APPLICATION_PATH}/citizen/wt/inbox`
21626
21846
  }],
21627
- links
21847
+ links,
21848
+ onDetailsClick: handleDetailsClick
21628
21849
  };
21629
- return /*#__PURE__*/React.createElement(EmployeeModuleCard, propsForModuleCard);
21850
+ return /*#__PURE__*/React.createElement("div", {
21851
+ className: "wt-citizen-card-premium"
21852
+ }, /*#__PURE__*/React.createElement(EmployeeModuleCard, propsForModuleCard));
21630
21853
  };
21631
21854
 
21632
21855
  const MTCard = () => {
@@ -23062,10 +23285,13 @@ const WTLinks = ({
23062
23285
  }, []);
23063
23286
  const links = [{
23064
23287
  link: `${matchPath}/wt`,
23065
- i18nKey: t("WT_REAQUEST_TANKER")
23288
+ i18nKey: t("WT_REQUEST_TANKER")
23066
23289
  }, {
23067
23290
  link: `${matchPath}/wt/status`,
23068
23291
  i18nKey: t("WT_VIEW_APPLICATIONS")
23292
+ }, {
23293
+ link: `${matchPath}/wt/wt-Vendor`,
23294
+ i18nKey: t("WT_VENDOR_LOGIN")
23069
23295
  }];
23070
23296
  return /*#__PURE__*/React.createElement(CitizenHomeCard, {
23071
23297
  header: t("WATER_TANKER_SERVICE"),
@@ -23101,6 +23327,7 @@ const componentsToRegister = {
23101
23327
  WFCaption,
23102
23328
  WTEmpInbox: Inbox,
23103
23329
  WTCitizenCard: WTCitizenCard,
23330
+ WTCard: WTCard,
23104
23331
  ServiceTypes,
23105
23332
  ToiletRequestDetails,
23106
23333
  TreePruningRequestDetails,