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

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.
@@ -3142,26 +3142,26 @@ const AddTripModal = ({
3142
3142
  defaultValues: initialValues || {}
3143
3143
  });
3144
3144
  const dayOptions = [{
3145
- label: t("MON"),
3146
- value: "Mon"
3145
+ label: t("MONDAY"),
3146
+ value: "MONDAY"
3147
3147
  }, {
3148
- label: t("TUE"),
3149
- value: "Tue"
3148
+ label: t("TUESDAY"),
3149
+ value: "TUESDAY"
3150
3150
  }, {
3151
- label: t("WED"),
3152
- value: "Wed"
3151
+ label: t("WEDNESDAY"),
3152
+ value: "WEDNESDAY"
3153
3153
  }, {
3154
- label: t("THU"),
3155
- value: "Thu"
3154
+ label: t("THURSDAY"),
3155
+ value: "THURSDAY"
3156
3156
  }, {
3157
- label: t("FRI"),
3158
- value: "Fri"
3157
+ label: t("FRIDAY"),
3158
+ value: "FRIDAY"
3159
3159
  }, {
3160
- label: t("SAT"),
3161
- value: "Sat"
3160
+ label: t("SATURDAY"),
3161
+ value: "SATURDAY"
3162
3162
  }, {
3163
- label: t("SUN"),
3164
- value: "Sun"
3163
+ label: t("SUNDAY"),
3164
+ value: "SUNDAY"
3165
3165
  }];
3166
3166
  const activeOptions = [{
3167
3167
  label: t("YES"),
@@ -3245,16 +3245,6 @@ const AddTripModal = ({
3245
3245
  marginBottom: "8px",
3246
3246
  fontWeight: "500"
3247
3247
  }
3248
- }, t("WT_SCHEDULE_ID")), /*#__PURE__*/React.createElement(TextInput, {
3249
- name: "scheduleId",
3250
- inputRef: register()
3251
- })), /*#__PURE__*/React.createElement("div", {
3252
- className: "field-group"
3253
- }, /*#__PURE__*/React.createElement(CardLabel, {
3254
- style: {
3255
- marginBottom: "8px",
3256
- fontWeight: "500"
3257
- }
3258
3248
  }, t("WT_FIXED_POINT_CODE")), /*#__PURE__*/React.createElement(TextInput, {
3259
3249
  name: "fixedPointCode",
3260
3250
  inputRef: register()
@@ -3427,7 +3417,9 @@ const FixedPointScheduleManagement = () => {
3427
3417
  const {
3428
3418
  t
3429
3419
  } = useTranslation();
3420
+ const tenantId = Digit.ULBService.getCurrentTenantId();
3430
3421
  const [showModal, setShowModal] = useState(false);
3422
+ const [toast, setToast] = useState(null);
3431
3423
  const [selectedDay, setSelectedDay] = useState("Mon");
3432
3424
  const [year, setYear] = useState({
3433
3425
  label: "Year 2026",
@@ -3450,6 +3442,18 @@ const FixedPointScheduleManagement = () => {
3450
3442
  value: "DL1LAG7729"
3451
3443
  });
3452
3444
  const [editingRowIndex, setEditingRowIndex] = useState(null);
3445
+ const [filters, setFilters] = useState({});
3446
+ const {
3447
+ isLoading,
3448
+ data: scheduleData,
3449
+ refetch: reSearch
3450
+ } = Digit.Hooks.wt.useFixedPointScheduleSearch(tenantId, filters);
3451
+ const {
3452
+ mutate: createSchedule
3453
+ } = Digit.Hooks.wt.useCreateFixedPointSchedule(tenantId);
3454
+ const closeToast = () => {
3455
+ setToast(null);
3456
+ };
3453
3457
  const handleDelete = index => {
3454
3458
  const updatedData = data.filter((_, i) => i !== index);
3455
3459
  setData(updatedData);
@@ -3460,14 +3464,16 @@ const FixedPointScheduleManagement = () => {
3460
3464
  window.Digit.Download.Excel(data, filename);
3461
3465
  } else {
3462
3466
  const csvRows = [];
3463
- const headers = Object.keys(data[0]);
3464
- csvRows.push(headers.join(","));
3465
- for (const row of data) {
3466
- const values = headers.map(header => {
3467
- const escaped = ("" + row[header]).replace(/"/g, '\\"');
3468
- return `"${escaped}"`;
3469
- });
3470
- csvRows.push(values.join(","));
3467
+ if (data.length > 0) {
3468
+ const headers = Object.keys(data[0]);
3469
+ csvRows.push(headers.join(","));
3470
+ for (const row of data) {
3471
+ const values = headers.map(header => {
3472
+ const escaped = ("" + row[header]).replace(/"/g, '\\"');
3473
+ return `"${escaped}"`;
3474
+ });
3475
+ csvRows.push(values.join(","));
3476
+ }
3471
3477
  }
3472
3478
  const blob = new Blob([csvRows.join("\n")], {
3473
3479
  type: "text/csv"
@@ -3482,76 +3488,34 @@ const FixedPointScheduleManagement = () => {
3482
3488
  document.body.removeChild(a);
3483
3489
  }
3484
3490
  };
3485
- const [data, setData] = useState([{
3486
- scheduleId: "SASID-0001",
3487
- fixedPoint: "FP01",
3488
- day: "Mon",
3489
- freq: "1",
3490
- arrToFpl: "06:00",
3491
- depFromFpl: "06:10",
3492
- arrAtFixedPoint: "06:40",
3493
- depAtFixedPoint: "06:55",
3494
- returnToFpl: "07:20",
3495
- volume: "3 KL",
3496
- vehicle: "DL1LAG7729",
3497
- active: "Y"
3498
- }, {
3499
- scheduleId: "SASID-0002",
3500
- fixedPoint: "FP01",
3501
- day: "Mon",
3502
- freq: "2",
3503
- arrToFpl: "07:20",
3504
- depFromFpl: "07:30",
3505
- arrAtFixedPoint: "08:00",
3506
- depAtFixedPoint: "08:15",
3507
- returnToFpl: "08:40",
3508
- volume: "3 KL",
3509
- vehicle: "DL1LAG7729",
3510
- active: "Y"
3511
- }, {
3512
- scheduleId: "SASID-0003",
3513
- fixedPoint: "FP02",
3514
- day: "Tue",
3515
- freq: "3",
3516
- arrToFpl: "08:40",
3517
- depFromFpl: "08:50",
3518
- arrAtFixedPoint: "09:20",
3519
- depAtFixedPoint: "09:35",
3520
- returnToFpl: "10:00",
3521
- volume: "3 KL",
3522
- vehicle: "DL1LAG7730",
3523
- active: "Y"
3524
- }, {
3525
- scheduleId: "SASID-0004",
3526
- fixedPoint: "FP03",
3527
- day: "Wed",
3528
- freq: "1",
3529
- arrToFpl: "09:00",
3530
- depFromFpl: "09:10",
3531
- arrAtFixedPoint: "09:40",
3532
- depAtFixedPoint: "09:55",
3533
- returnToFpl: "10:20",
3534
- volume: "5 KL",
3535
- vehicle: "DL1LAG7731",
3536
- active: "N"
3537
- }]);
3538
- const [masterData] = useState(data);
3539
- const handleSearch = () => {
3540
- let filteredData = [...masterData];
3541
- if (fixedPoint !== null && fixedPoint !== void 0 && fixedPoint.value && fixedPoint.value !== "all") {
3542
- filteredData = filteredData.filter(item => item.fixedPoint === fixedPoint.value);
3543
- }
3544
- if (day !== null && day !== void 0 && day.value && day.value !== "all") {
3545
- filteredData = filteredData.filter(item => item.day === day.value);
3546
- }
3547
- if (status !== null && status !== void 0 && status.value && status.value !== "all") {
3548
- const activeStatus = status.value === "Active" ? "Y" : "N";
3549
- filteredData = filteredData.filter(item => item.active === activeStatus);
3550
- }
3551
- if (vehicle !== null && vehicle !== void 0 && vehicle.value && vehicle.value !== "all") {
3552
- filteredData = filteredData.filter(item => item.vehicle === vehicle.value);
3491
+ const [data, setData] = useState([]);
3492
+ React.useEffect(() => {
3493
+ if (scheduleData !== null && scheduleData !== void 0 && scheduleData.fixedPointTimeTableDetails) {
3494
+ const mappedData = scheduleData.fixedPointTimeTableDetails.map(item => ({
3495
+ scheduleId: item.systemAssignedScheduleId,
3496
+ fixedPoint: item.fixedPointCode,
3497
+ day: item.day,
3498
+ freq: item.tripNo,
3499
+ arrToFpl: item.arrivalTimeToFpl,
3500
+ depFromFpl: item.departureTimeFromFpl,
3501
+ arrAtFixedPoint: item.arrivalTimeDeliveryPoint,
3502
+ depAtFixedPoint: item.departureTimeDeliveryPoint,
3503
+ returnToFpl: item.timeOfArrivingBackFplAfterDelivery,
3504
+ volume: item.volumeWaterTobeDelivery,
3505
+ vehicle: item.vehicleId,
3506
+ active: item.isEnable ? "Y" : "N"
3507
+ }));
3508
+ setData(mappedData);
3553
3509
  }
3554
- setData(filteredData);
3510
+ }, [scheduleData]);
3511
+ const handleSearch = () => {
3512
+ var _day$value;
3513
+ setFilters({
3514
+ fixedPointCode: (fixedPoint === null || fixedPoint === void 0 ? void 0 : fixedPoint.value) === "all" ? "" : fixedPoint === null || fixedPoint === void 0 ? void 0 : fixedPoint.value,
3515
+ 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
+ status: (status === null || status === void 0 ? void 0 : status.value) === "all" ? "" : status === null || status === void 0 ? void 0 : status.value,
3517
+ vehicleId: (vehicle === null || vehicle === void 0 ? void 0 : vehicle.value) === "all" ? "" : vehicle === null || vehicle === void 0 ? void 0 : vehicle.value
3518
+ });
3555
3519
  };
3556
3520
  const columns = React.useMemo(() => [{
3557
3521
  Header: t("WT_SCHEDULE_ID"),
@@ -3809,7 +3773,8 @@ const FixedPointScheduleManagement = () => {
3809
3773
  },
3810
3774
  inboxStyles: {
3811
3775
  overflowX: "auto"
3812
- }
3776
+ },
3777
+ isLoading: isLoading
3813
3778
  }), /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement("button", {
3814
3779
  onClick: () => {
3815
3780
  setEditingRowIndex(null);
@@ -3837,7 +3802,7 @@ const FixedPointScheduleManagement = () => {
3837
3802
  scheduleId: data[editingRowIndex].scheduleId,
3838
3803
  fixedPointCode: data[editingRowIndex].fixedPoint,
3839
3804
  day: {
3840
- label: t(data[editingRowIndex].day.toUpperCase()),
3805
+ label: t(data[editingRowIndex].day),
3841
3806
  value: data[editingRowIndex].day
3842
3807
  },
3843
3808
  frequencyNo: data[editingRowIndex].freq,
@@ -3854,31 +3819,49 @@ const FixedPointScheduleManagement = () => {
3854
3819
  }
3855
3820
  } : null,
3856
3821
  onSubmit: formData => {
3857
- var _formData$day, _formData$active;
3858
- const rowData = {
3859
- scheduleId: formData.scheduleId || `SASID-000${data.length + 1}`,
3860
- fixedPoint: formData.fixedPointCode || "FP01",
3861
- day: ((_formData$day = formData.day) === null || _formData$day === void 0 ? void 0 : _formData$day.value) || "Mon",
3862
- freq: formData.frequencyNo || "1",
3863
- arrToFpl: formData.arrivalTimeFpl || "--:--",
3864
- depFromFpl: formData.departureTimeFpl || "--:--",
3865
- arrAtFixedPoint: formData.arrivalFixedPoint || "--:--",
3866
- depAtFixedPoint: formData.departureFixedPoint || "--:--",
3867
- returnToFpl: formData.returnFpl || "--:--",
3868
- volume: formData.volume || "0 KL",
3869
- vehicle: formData.vehicleId || "NA",
3870
- active: ((_formData$active = formData.active) === null || _formData$active === void 0 ? void 0 : _formData$active.value) === "Yes" ? "Y" : "N"
3822
+ var _formData$day, _formData$day$value, _formData$active, _formData$active2;
3823
+ 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
+ }
3871
3840
  };
3872
- if (editingRowIndex !== null) {
3873
- const updatedData = [...data];
3874
- updatedData[editingRowIndex] = rowData;
3875
- setData(updatedData);
3876
- } else {
3877
- setData([...data, rowData]);
3878
- }
3879
- setShowModal(false);
3880
- setEditingRowIndex(null);
3841
+ createSchedule(payload, {
3842
+ onError: (error, variables) => {
3843
+ var _error$response, _error$response$data, _error$response$data$, _error$response$data$2;
3844
+ setToast({
3845
+ key: "error",
3846
+ label: (error === null || error === void 0 ? void 0 : (_error$response = error.response) === null || _error$response === void 0 ? void 0 : (_error$response$data = _error$response.data) === null || _error$response$data === void 0 ? void 0 : (_error$response$data$ = _error$response$data.Errors) === null || _error$response$data$ === void 0 ? void 0 : (_error$response$data$2 = _error$response$data$[0]) === null || _error$response$data$2 === void 0 ? void 0 : _error$response$data$2.message) || "ERROR_WHILE_CREATING_SCHEDULE"
3847
+ });
3848
+ setTimeout(closeToast, 5000);
3849
+ },
3850
+ onSuccess: (data, variables) => {
3851
+ setToast({
3852
+ label: t("WT_SCHEDULE_CREATE_SUCCESS")
3853
+ });
3854
+ setTimeout(closeToast, 5000);
3855
+ setShowModal(false);
3856
+ setEditingRowIndex(null);
3857
+ reSearch();
3858
+ }
3859
+ });
3881
3860
  }
3861
+ }), toast && /*#__PURE__*/React.createElement(Toast, {
3862
+ error: toast.key === "error",
3863
+ label: toast.label,
3864
+ onClose: closeToast
3882
3865
  }));
3883
3866
  };
3884
3867
 
@@ -5034,13 +5017,6 @@ const AddFillingPointMetaData = ({
5034
5017
  }) => {
5035
5018
  const sectionKey = (_config === null || _config === void 0 ? void 0 : _config.key) || "metaData";
5036
5019
  const inputs = [{
5037
- label: "WT_FILLING_POINT_NAME",
5038
- name: "fillingPointName",
5039
- isMandatory: true
5040
- }, {
5041
- label: "WT_EMERGENCY_NAME",
5042
- name: "emergencyName"
5043
- }, {
5044
5020
  label: "WT_AE_NAME",
5045
5021
  name: "aeName",
5046
5022
  validation: {
@@ -5216,7 +5192,6 @@ const AddFixFillAddress = ({
5216
5192
  }
5217
5193
  if (formData !== null && formData !== void 0 && formData.address && !isInitialized.current && allCities) {
5218
5194
  const addressData = formData.address;
5219
- console.log("AddFixFillAddress: Initialization Phase 1 - Setting basic fields", addressData);
5220
5195
  const cityObj = allCities.find(c => c.code === addressData.cityCode || c.code === addressData.city || c.name === addressData.city) || addressData.city;
5221
5196
  if (cityObj && (!city || city.code !== cityObj.code && city !== cityObj)) {
5222
5197
  setCity(cityObj || null);
@@ -5440,16 +5415,13 @@ const AddFillingPointAddress = () => {
5440
5415
  const {
5441
5416
  mutate: createFillingPoint
5442
5417
  } = Digit.Hooks.wt.useCreateFillPoint(tenantId);
5443
- const {
5444
- mutate: updateFillingPoint
5445
- } = Digit.Hooks.wt.useUpdateFillPoint(tenantId);
5446
5418
  const handleSubmit = e => {
5447
5419
  if (e && e.preventDefault) e.preventDefault();
5448
5420
  const payload = fillingPointPayload({
5449
5421
  ...formData,
5450
5422
  tenantId
5451
5423
  });
5452
- const mutation = editId ? updateFillingPoint : createFillingPoint;
5424
+ const mutation = createFillingPoint;
5453
5425
  mutation(payload, {
5454
5426
  onSuccess: () => {
5455
5427
  setShowToast({
@@ -5472,7 +5444,6 @@ const AddFillingPointAddress = () => {
5472
5444
  return /*#__PURE__*/React.createElement("div", {
5473
5445
  style: {
5474
5446
  display: "flex",
5475
- gap: "24px",
5476
5447
  flexDirection: isMobile ? "column" : "row"
5477
5448
  }
5478
5449
  }, /*#__PURE__*/React.createElement(Timeline, {
@@ -5640,7 +5611,7 @@ const AddFixPointAddress = () => {
5640
5611
  display: "flex",
5641
5612
  flexDirection: "column"
5642
5613
  }
5643
- }, /*#__PURE__*/React.createElement(CardLabel, null, `${t("WT_AE_NAME")}`, " ", /*#__PURE__*/React.createElement("span", {
5614
+ }, /*#__PURE__*/React.createElement(CardLabel, null, `${t("COMMON_APPLICANT_NAME")}`, " ", /*#__PURE__*/React.createElement("span", {
5644
5615
  className: "astericColor"
5645
5616
  }, "*")), /*#__PURE__*/React.createElement(TextInput, {
5646
5617
  t: t,
@@ -5659,7 +5630,7 @@ const AddFixPointAddress = () => {
5659
5630
  display: "flex",
5660
5631
  flexDirection: "column"
5661
5632
  }
5662
- }, /*#__PURE__*/React.createElement(CardLabel, null, `${t("WT_AE_MOBILE_NUMBER")}`, " ", /*#__PURE__*/React.createElement("span", {
5633
+ }, /*#__PURE__*/React.createElement(CardLabel, null, `${t("COMMON_MOBILE_NUMBER")}`, " ", /*#__PURE__*/React.createElement("span", {
5663
5634
  className: "astericColor"
5664
5635
  }, "*")), /*#__PURE__*/React.createElement(MobileNumber, {
5665
5636
  value: formData === null || formData === void 0 ? void 0 : (_formData$owner2 = formData.owner) === null || _formData$owner2 === void 0 ? void 0 : _formData$owner2.mobileNumber,
@@ -5675,7 +5646,7 @@ const AddFixPointAddress = () => {
5675
5646
  display: "flex",
5676
5647
  flexDirection: "column"
5677
5648
  }
5678
- }, /*#__PURE__*/React.createElement(CardLabel, null, `${t("WT_AE_EMAIL_ID")}`, " ", /*#__PURE__*/React.createElement("span", {
5649
+ }, /*#__PURE__*/React.createElement(CardLabel, null, `${t("COMMON_EMAIL_ID")}`, " ", /*#__PURE__*/React.createElement("span", {
5679
5650
  className: "astericColor"
5680
5651
  }, "*")), /*#__PURE__*/React.createElement(TextInput, {
5681
5652
  t: t,
@@ -5694,7 +5665,7 @@ const AddFixPointAddress = () => {
5694
5665
  display: "flex",
5695
5666
  flexDirection: "column"
5696
5667
  }
5697
- }, /*#__PURE__*/React.createElement(CardLabel, null, `${t("WT_EE_ALT_MOBILE_NUMBER")}`), /*#__PURE__*/React.createElement(MobileNumber, {
5668
+ }, /*#__PURE__*/React.createElement(CardLabel, null, `${t("COMMON_ALT_MOBILE_NUMBER")}`), /*#__PURE__*/React.createElement(MobileNumber, {
5698
5669
  value: formData === null || formData === void 0 ? void 0 : (_formData$owner4 = formData.owner) === null || _formData$owner4 === void 0 ? void 0 : _formData$owner4.alternateNumber,
5699
5670
  name: "alternateNumber",
5700
5671
  onChange: value => handleSelect("owner", {
@@ -5751,14 +5722,14 @@ const SearchFillingPointAddress = () => {
5751
5722
  isLoading: isFillingLoading,
5752
5723
  data: fillingPointData,
5753
5724
  refetch: refetchFilling
5754
- } = Digit.Hooks.wt.useTankerSearchAPI({
5725
+ } = Digit.Hooks.wt.useFillPointSearch({
5755
5726
  tenantId,
5756
5727
  filters: searchParams
5757
5728
  }, {
5758
5729
  enabled: selectedTab === "FILLING_POINT"
5759
5730
  });
5760
5731
  const isLoading = selectedTab === "FIXED_POINT" ? isFixedLoading : isFillingLoading;
5761
- const tableData = (selectedTab === "FIXED_POINT" ? fixedPointData === null || fixedPointData === void 0 ? void 0 : fixedPointData.waterTankerBookingDetail : fillingPointData === null || fillingPointData === void 0 ? void 0 : fillingPointData.waterTankerBookingDetail) || [];
5732
+ const tableData = (selectedTab === "FIXED_POINT" ? fixedPointData === null || fixedPointData === void 0 ? void 0 : fixedPointData.waterTankerBookingDetail : fillingPointData === null || fillingPointData === void 0 ? void 0 : fillingPointData.fillingPoints) || [];
5762
5733
  const searchConfig = {
5763
5734
  FIXED_POINT: {
5764
5735
  label: "WT_FIXED_POINT_NAME",
@@ -5798,6 +5769,7 @@ const SearchFillingPointAddress = () => {
5798
5769
  const onTabChange = tab => {
5799
5770
  setSelectedTab(tab);
5800
5771
  clearSearch();
5772
+ setSearchParams({});
5801
5773
  };
5802
5774
  const onAddClick = () => {
5803
5775
  setShowAddMenu(prev => !prev);
@@ -5811,11 +5783,16 @@ const SearchFillingPointAddress = () => {
5811
5783
  setShowAddMenu(false);
5812
5784
  };
5813
5785
  const onSearch = () => {
5814
- setSearchParams({
5786
+ const filters = {
5815
5787
  name: searchValue,
5816
- mobileNumber: mobileNumber,
5788
+ ...(selectedTab === "FILLING_POINT" ? {
5789
+ mobileNo: mobileNumber
5790
+ } : {
5791
+ mobileNumber: mobileNumber
5792
+ }),
5817
5793
  status: status === null || status === void 0 ? void 0 : status.code
5818
- });
5794
+ };
5795
+ setSearchParams(filters);
5819
5796
  };
5820
5797
  const columns = React.useMemo(() => {
5821
5798
  if (selectedTab === "FIXED_POINT") {
@@ -5854,27 +5831,18 @@ const SearchFillingPointAddress = () => {
5854
5831
  } else {
5855
5832
  return [{
5856
5833
  Header: t("WT_FILLING_POINT_NAME"),
5857
- accessor: row => {
5858
- var _row$fillingpointmeta;
5859
- return (row === null || row === void 0 ? void 0 : (_row$fillingpointmeta = row.fillingpointmetadata) === null || _row$fillingpointmeta === void 0 ? void 0 : _row$fillingpointmeta.name) || "NA";
5860
- },
5834
+ accessor: row => (row === null || row === void 0 ? void 0 : row.fillingPointName) || "NA",
5861
5835
  id: "fillingPointName",
5862
5836
  Cell: ({
5863
5837
  row
5864
- }) => {
5865
- var _row$original$filling;
5866
- return /*#__PURE__*/React.createElement("span", {
5867
- className: "link"
5868
- }, /*#__PURE__*/React.createElement(Link, {
5869
- to: `/digit-ui/employee/wt/add-filling-point-address?id=${row.original.bookingId}`
5870
- }, ((_row$original$filling = row.original.fillingpointmetadata) === null || _row$original$filling === void 0 ? void 0 : _row$original$filling.name) || "NA"));
5871
- }
5838
+ }) => /*#__PURE__*/React.createElement("span", {
5839
+ className: "link"
5840
+ }, /*#__PURE__*/React.createElement(Link, {
5841
+ to: `/digit-ui/employee/wt/add-filling-point-address?id=${row.original.id}`
5842
+ }, row.original.fillingPointName || "NA"))
5872
5843
  }, {
5873
5844
  Header: t("WT_JE_NAME"),
5874
- accessor: row => {
5875
- var _row$fillingpointmeta2;
5876
- return (row === null || row === void 0 ? void 0 : (_row$fillingpointmeta2 = row.fillingpointmetadata) === null || _row$fillingpointmeta2 === void 0 ? void 0 : _row$fillingpointmeta2.jeName) || "NA";
5877
- },
5845
+ accessor: row => (row === null || row === void 0 ? void 0 : row.jeName) || "NA",
5878
5846
  id: "jeName"
5879
5847
  }, {
5880
5848
  Header: t("WT_LOCALITY"),
@@ -17303,7 +17271,7 @@ const configWTApproverApplication = ({
17303
17271
  required: true
17304
17272
  }
17305
17273
  }
17306
- }, (action === null || action === void 0 ? void 0 : action.state) === "PENDING_FOR_VEHICLE_DRIVER_ASSIGN" ? {
17274
+ }, (action === null || action === void 0 ? void 0 : action.state) === "PENDING_FOR_VEHICLE_DRIVER_ASSIGN" && (action === null || action === void 0 ? void 0 : action.action) !== "ASSIGN_VEHICLE_DRIVER" ? {
17307
17275
  label: t("RS_ASSIGN"),
17308
17276
  type: "dropdown",
17309
17277
  populators: /*#__PURE__*/React.createElement(Dropdown, {
@@ -17313,7 +17281,7 @@ const configWTApproverApplication = ({
17313
17281
  select: setSelectedVendor,
17314
17282
  selected: selectedVendor
17315
17283
  })
17316
- } : "null", (action === null || action === void 0 ? void 0 : action.state) === "DELIVERY_PENDING" ? {
17284
+ } : "null", (action === null || action === void 0 ? void 0 : action.state) === "DELIVERY_PENDING" || (action === null || action === void 0 ? void 0 : action.action) === "ASSIGN_VEHICLE_DRIVER" ? {
17317
17285
  label: t("RS_REGISTRATION_NUMBER"),
17318
17286
  type: "dropdown",
17319
17287
  populators: /*#__PURE__*/React.createElement(Dropdown, {
@@ -17376,7 +17344,7 @@ const ActionModal$b = ({
17376
17344
  cardFormClassName,
17377
17345
  formClassName
17378
17346
  }) => {
17379
- var _action$assigneeRoles, _action$assigneeRoles2, _dsoData$vendor, _vehicleData$vehicle;
17347
+ var _action$assigneeRoles, _action$assigneeRoles2, _dsoData$vendor, _vehicleData$vehicle, _vehicleData$vehicle$;
17380
17348
  const {
17381
17349
  data: approverData,
17382
17350
  isLoading: PTALoading
@@ -17397,7 +17365,7 @@ const ActionModal$b = ({
17397
17365
  } = Digit.Hooks.fsm.useVendorSearch({
17398
17366
  tenantId,
17399
17367
  config: {
17400
- enabled: (action === null || action === void 0 ? void 0 : action.state) === "PENDING_FOR_VEHICLE_DRIVER_ASSIGN"
17368
+ enabled: (action === null || action === void 0 ? void 0 : action.state) === "PENDING_FOR_VEHICLE_DRIVER_ASSIGN" || (action === null || action === void 0 ? void 0 : action.action) === "ASSIGN_VEHICLE_DRIVER"
17401
17369
  }
17402
17370
  });
17403
17371
  let vendorDescription = [];
@@ -17420,17 +17388,22 @@ const ActionModal$b = ({
17420
17388
  } = Digit.Hooks.fsm.useVehiclesSearch({
17421
17389
  tenantId,
17422
17390
  config: {
17423
- enabled: (action === null || action === void 0 ? void 0 : action.state) === "DELIVERY_PENDING"
17391
+ enabled: (action === null || action === void 0 ? void 0 : action.state) === "DELIVERY_PENDING" || (action === null || action === void 0 ? void 0 : action.action) === "ASSIGN_VEHICLE_DRIVER"
17424
17392
  }
17425
17393
  });
17426
17394
  let vehicleDescription = [];
17427
- vehicleData === null || vehicleData === void 0 ? void 0 : (_vehicleData$vehicle = vehicleData.vehicle) === null || _vehicleData$vehicle === void 0 ? void 0 : _vehicleData$vehicle.map(item => {
17395
+ vehicleData === null || vehicleData === void 0 ? void 0 : (_vehicleData$vehicle = vehicleData.vehicle) === null || _vehicleData$vehicle === void 0 ? void 0 : (_vehicleData$vehicle$ = _vehicleData$vehicle.filter(item => {
17396
+ var _item$driverData, _item$driver;
17397
+ return (item === null || item === void 0 ? void 0 : (_item$driverData = item.driverData) === null || _item$driverData === void 0 ? void 0 : _item$driverData.id) || (item === null || item === void 0 ? void 0 : (_item$driver = item.driver) === null || _item$driver === void 0 ? void 0 : _item$driver.id);
17398
+ })) === null || _vehicleData$vehicle$ === void 0 ? void 0 : _vehicleData$vehicle$.map(item => {
17399
+ var _item$driverData2, _item$driver2;
17428
17400
  vehicleDescription.push({
17429
17401
  code: item === null || item === void 0 ? void 0 : item.registrationNumber,
17430
17402
  name: item === null || item === void 0 ? void 0 : item.registrationNumber,
17431
17403
  i18nKey: item === null || item === void 0 ? void 0 : item.registrationNumber,
17432
17404
  tankerCapacity: item === null || item === void 0 ? void 0 : item.tankCapacity,
17433
- vehicleId: item === null || item === void 0 ? void 0 : item.id
17405
+ vehicleId: item === null || item === void 0 ? void 0 : item.id,
17406
+ driverId: (item === null || item === void 0 ? void 0 : (_item$driverData2 = item.driverData) === null || _item$driverData2 === void 0 ? void 0 : _item$driverData2.ownerId) || (item === null || item === void 0 ? void 0 : (_item$driver2 = item.driver) === null || _item$driver2 === void 0 ? void 0 : _item$driver2.ownerId)
17434
17407
  });
17435
17408
  });
17436
17409
  const [config, setConfig] = useState({});
@@ -17495,6 +17468,10 @@ const ActionModal$b = ({
17495
17468
  if ((action === null || action === void 0 ? void 0 : action.state) === "DELIVERY_PENDING") {
17496
17469
  applicationData.vehicleId = selectVehicle === null || selectVehicle === void 0 ? void 0 : selectVehicle.vehicleId;
17497
17470
  }
17471
+ if ((action === null || action === void 0 ? void 0 : action.action) === "ASSIGN_VEHICLE_DRIVER") {
17472
+ applicationData.vehicleId = selectVehicle === null || selectVehicle === void 0 ? void 0 : selectVehicle.vehicleId;
17473
+ applicationData.driverId = selectVehicle === null || selectVehicle === void 0 ? void 0 : selectVehicle.driverId;
17474
+ }
17498
17475
  let requestPayload = businessService === "watertanker" ? {
17499
17476
  waterTankerBookingDetail: {
17500
17477
  ...applicationData,
@@ -17519,7 +17496,7 @@ const ActionModal$b = ({
17519
17496
  selectedVendor,
17520
17497
  setSelectedVendor,
17521
17498
  vendorDescription: dsoData ? vendorDescription : undefined,
17522
- vehicleDescription: vehicleData ? vehicleDescription : undefined,
17499
+ vehicleDescription: vehicleData || (action === null || action === void 0 ? void 0 : action.action) === "ASSIGN_VEHICLE_DRIVER" ? vehicleDescription : undefined,
17523
17500
  selectVehicle,
17524
17501
  setSelectVehicle
17525
17502
  }));