@bjsdistribution/dms-client-return 0.1.20-dev → 0.1.21-dev

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.
Files changed (156) hide show
  1. package/dist/components/client-portal/DateFilterStore.d.ts +15 -0
  2. package/dist/components/order-view/DynamicTable.d.ts +2 -1
  3. package/dist/components/order-view/general-information/Status.d.ts +1 -1
  4. package/dist/components/order-view/general-information/index.d.ts +1 -1
  5. package/dist/components/order-view/index.d.ts +1 -1
  6. package/dist/components/order-view/notes/AddNote.d.ts +1 -0
  7. package/dist/components/order-view/notes/order-dropdown/NewReturnDropdown.d.ts +3 -0
  8. package/dist/components/order-view/order-actions/actions/clear-booking-status/ClearBookingStatus.d.ts +4 -1
  9. package/dist/components/order-view/order-actions/actions/confirm-order/index.d.ts +4 -1
  10. package/dist/components/order-view/order-actions/actions/force-debrief/BaseChargeConfirmationModal.d.ts +7 -0
  11. package/dist/components/order-view/order-actions/actions/force-debrief/ForceDebriefModal.d.ts +11 -0
  12. package/dist/components/order-view/order-actions/actions/force-debrief/Selector.d.ts +11 -0
  13. package/dist/components/order-view/order-actions/actions/force-debrief/charges/adhoc/index.d.ts +3 -0
  14. package/dist/components/order-view/order-actions/actions/force-debrief/charges/base-charge/index.d.ts +8 -0
  15. package/dist/components/order-view/order-actions/actions/force-debrief/charges/collection-add-ons/index.d.ts +7 -0
  16. package/dist/components/order-view/order-actions/actions/force-debrief/charges/delivery-add-ons/index.d.ts +7 -0
  17. package/dist/components/order-view/order-actions/actions/force-debrief/charges/disposal-charges/index.d.ts +7 -0
  18. package/dist/components/order-view/order-actions/actions/force-debrief/charges/order-charges/index.d.ts +7 -0
  19. package/dist/components/order-view/order-actions/actions/force-debrief/escalation/EscalationCategory.d.ts +3 -0
  20. package/dist/components/order-view/order-actions/actions/force-debrief/escalation/EscalationLevel.d.ts +3 -0
  21. package/dist/components/order-view/order-actions/actions/force-debrief/escalation/EscalationReason.d.ts +3 -0
  22. package/dist/components/order-view/order-actions/actions/force-debrief/escalation/index.d.ts +3 -0
  23. package/dist/components/order-view/order-actions/actions/force-debrief/notifications/FlagsTemplate.d.ts +3 -0
  24. package/dist/components/order-view/order-actions/actions/force-debrief/notifications/OrderTemplate.d.ts +3 -0
  25. package/dist/components/order-view/order-actions/actions/force-debrief/notifications/Tabs.d.ts +3 -0
  26. package/dist/components/order-view/order-actions/actions/force-debrief/notifications/index.d.ts +3 -0
  27. package/dist/components/order-view/order-actions/actions/force-debrief/order-info/RadioButtons.d.ts +7 -0
  28. package/dist/components/order-view/order-actions/actions/force-debrief/order-info/dropdowns/CancellationReasonDropdown.d.ts +3 -0
  29. package/dist/components/order-view/order-actions/actions/force-debrief/order-info/dropdowns/FailureReasonDropdown.d.ts +3 -0
  30. package/dist/components/order-view/order-actions/actions/force-debrief/order-info/dropdowns/OrderHoldReasonDropdown.d.ts +3 -0
  31. package/dist/components/order-view/order-actions/actions/force-debrief/order-info/dropdowns/StatusDropdown.d.ts +3 -0
  32. package/dist/components/order-view/order-actions/actions/force-debrief/order-info/dropdowns/ZoneDropdown.d.ts +3 -0
  33. package/dist/components/order-view/order-actions/actions/force-debrief/order-info/failure-content/index.d.ts +3 -0
  34. package/dist/components/order-view/order-actions/actions/force-debrief/order-info/index.d.ts +4 -0
  35. package/dist/components/order-view/order-actions/actions/force-debrief/order-info/success-content/index.d.ts +3 -0
  36. package/dist/components/order-view/order-actions/actions/force-debrief/styles.d.ts +8 -0
  37. package/dist/components/order-view/order-actions/actions/hold-order/HoldOrderModal.d.ts +1 -0
  38. package/dist/components/order-view/order-actions/actions/remove-from-route/RemoveFromRoute.d.ts +1 -1
  39. package/dist/components/order-view/order-actions/actions/unhold-order/UnholdOrder.d.ts +1 -0
  40. package/dist/components/order-view/order-actions/types.d.ts +3 -3
  41. package/dist/components/order-view/order-details/expanded-content/index.d.ts +1 -1
  42. package/dist/components/order-view/order-details/index.d.ts +1 -1
  43. package/dist/components/order-view/order-resources/expanded-content/index.d.ts +1 -1
  44. package/dist/components/order-view/products-info/expanded-content/index.d.ts +6 -1
  45. package/dist/components/order-view/products-info/index.d.ts +1 -1
  46. package/dist/components/order-view/return-client-products/ProductTable.d.ts +6 -1
  47. package/dist/components/order-view/return-client-products/product-table/ReturnProductTable.d.ts +6 -1
  48. package/dist/components/order-view/store.d.ts +15 -3
  49. package/dist/components/order-view/system-event-logs/expanded-content/index.d.ts +1 -1
  50. package/dist/components/order-view/types.d.ts +49 -1
  51. package/dist/components/order-view/utils.d.ts +3 -0
  52. package/dist/components/order-view/view-reminder/ViewReminder.d.ts +2 -0
  53. package/dist/dms-client-return.cjs.development.js +4364 -1614
  54. package/dist/dms-client-return.cjs.development.js.map +1 -1
  55. package/dist/dms-client-return.cjs.production.min.js +1 -1
  56. package/dist/dms-client-return.cjs.production.min.js.map +1 -1
  57. package/dist/dms-client-return.esm.js +4429 -1679
  58. package/dist/dms-client-return.esm.js.map +1 -1
  59. package/package.json +6 -4
  60. package/src/assets/icons/ActionIcon.tsx +1 -1
  61. package/src/assets/icons/ArrowDownIcon.tsx +2 -2
  62. package/src/components/client-portal/DateFilterStore.ts +94 -0
  63. package/src/components/client-portal/OutstandingTable.tsx +15 -72
  64. package/src/components/client-portal/ReturnAfterSearchBar.tsx +41 -87
  65. package/src/components/client-portal/ReturnRTFilters.tsx +0 -2
  66. package/src/components/client-portal/ReturnSearchBar.tsx +41 -152
  67. package/src/components/client-portal/ReturnStatus.tsx +33 -84
  68. package/src/components/client-portal/return-confirm/ConfirmedMain.tsx +12 -23
  69. package/src/components/client-portal/return-confirm/ReturnConfirmedTable.tsx +8 -85
  70. package/src/components/order-daily-overview/header/route-header/RouterHeader.tsx +11 -18
  71. package/src/components/order-daily-overview/header-filters/SelectionFilter.tsx +43 -15
  72. package/src/components/order-daily-overview/index.tsx +23 -4
  73. package/src/components/order-daily-overview/return-after-table/ReturnAfterTable.tsx +6 -1
  74. package/src/components/order-daily-overview/return-after-table/table/OrderTable.tsx +3 -0
  75. package/src/components/order-daily-overview/return-after-table/table-filters/ReturnFilterStore.ts +36 -36
  76. package/src/components/order-daily-overview/return-after-table/table-filters/ReturnOrderFilter.tsx +12 -2
  77. package/src/components/order-daily-overview/return-order-table/ReturnTable.tsx +16 -0
  78. package/src/components/order-daily-overview/return-order-table/return-orders-filters/ReturnOrderTable.tsx +25 -11
  79. package/src/components/order-daily-overview/table/ReturnTable.tsx +8 -4
  80. package/src/components/order-view/DynamicTable.tsx +21 -8
  81. package/src/components/order-view/details-filters/left-side-filters/dropdowns/DropDowns.tsx +1 -1
  82. package/src/components/order-view/details-filters/left-side-filters/dropdowns/OptionsDropDown.tsx +9 -0
  83. package/src/components/order-view/details-filters/right-side-filters/Details.tsx +28 -3
  84. package/src/components/order-view/flags-action-modal/Dropdowns.tsx +2 -0
  85. package/src/components/order-view/general-information/Status.tsx +92 -18
  86. package/src/components/order-view/general-information/index.tsx +2 -2
  87. package/src/components/order-view/generic-table/AuditLogs.tsx +39 -12
  88. package/src/components/order-view/index.tsx +50 -8
  89. package/src/components/order-view/modalsPopup/ModalManager.tsx +1 -1
  90. package/src/components/order-view/notes/AddNote.tsx +95 -65
  91. package/src/components/order-view/notes/order-dropdown/NewReturnDropdown.tsx +8 -10
  92. package/src/components/order-view/notification/FlagTemplate.tsx +21 -10
  93. package/src/components/order-view/notification/OrderTemplate.tsx +192 -41
  94. package/src/components/order-view/notification/ReminderTemplate.tsx +28 -13
  95. package/src/components/order-view/notification/index.tsx +100 -55
  96. package/src/components/order-view/order-actions/actions/add-resources/DocFileUpload.tsx +92 -72
  97. package/src/components/order-view/order-actions/actions/add-resources/index.tsx +27 -10
  98. package/src/components/order-view/order-actions/actions/cancel-order/ReturnAction.tsx +25 -4
  99. package/src/components/order-view/order-actions/actions/cancel-order/ReturnReason.tsx +24 -4
  100. package/src/components/order-view/order-actions/actions/clear-booking-status/ClearBookingStatus.tsx +9 -2
  101. package/src/components/order-view/order-actions/actions/confirm-order/index.tsx +12 -6
  102. package/src/components/order-view/order-actions/actions/confirm-order/tables/NotesTable.tsx +1 -0
  103. package/src/components/order-view/order-actions/actions/create-task-reminder/CreateReminderModal.tsx +88 -30
  104. package/src/components/order-view/order-actions/actions/create-task-reminder/CreateTaskModal.tsx +5 -3
  105. package/src/components/order-view/order-actions/actions/create-task-reminder/TaskModal.tsx +2 -2
  106. package/src/components/order-view/order-actions/actions/force-debrief/BaseChargeConfirmationModal.tsx +94 -0
  107. package/src/components/order-view/order-actions/actions/force-debrief/ForceDebriefModal.tsx +620 -0
  108. package/src/components/order-view/order-actions/actions/force-debrief/Selector.tsx +65 -0
  109. package/src/components/order-view/order-actions/actions/force-debrief/charges/adhoc/index.tsx +94 -0
  110. package/src/components/order-view/order-actions/actions/force-debrief/charges/base-charge/index.tsx +106 -0
  111. package/src/components/order-view/order-actions/actions/force-debrief/charges/collection-add-ons/index.tsx +77 -0
  112. package/src/components/order-view/order-actions/actions/force-debrief/charges/delivery-add-ons/index.tsx +78 -0
  113. package/src/components/order-view/order-actions/actions/force-debrief/charges/disposal-charges/index.tsx +77 -0
  114. package/src/components/order-view/order-actions/actions/force-debrief/charges/order-charges/index.tsx +124 -0
  115. package/src/components/order-view/order-actions/actions/force-debrief/escalation/EscalationCategory.tsx +92 -0
  116. package/src/components/order-view/order-actions/actions/force-debrief/escalation/EscalationLevel.tsx +90 -0
  117. package/src/components/order-view/order-actions/actions/force-debrief/escalation/EscalationReason.tsx +122 -0
  118. package/src/components/order-view/order-actions/actions/force-debrief/escalation/index.tsx +16 -0
  119. package/src/components/order-view/order-actions/actions/force-debrief/notifications/FlagsTemplate.tsx +46 -0
  120. package/src/components/order-view/order-actions/actions/force-debrief/notifications/OrderTemplate.tsx +117 -0
  121. package/src/components/order-view/order-actions/actions/force-debrief/notifications/Tabs.tsx +32 -0
  122. package/src/components/order-view/order-actions/actions/force-debrief/notifications/index.tsx +180 -0
  123. package/src/components/order-view/order-actions/actions/force-debrief/order-info/RadioButtons.tsx +201 -0
  124. package/src/components/order-view/order-actions/actions/force-debrief/order-info/dropdowns/CancellationReasonDropdown.tsx +40 -0
  125. package/src/components/order-view/order-actions/actions/force-debrief/order-info/dropdowns/FailureReasonDropdown.tsx +108 -0
  126. package/src/components/order-view/order-actions/actions/force-debrief/order-info/dropdowns/OrderHoldReasonDropdown.tsx +37 -0
  127. package/src/components/order-view/order-actions/actions/force-debrief/order-info/dropdowns/StatusDropdown.tsx +48 -0
  128. package/src/components/order-view/order-actions/actions/force-debrief/order-info/dropdowns/ZoneDropdown.tsx +27 -0
  129. package/src/components/order-view/order-actions/actions/force-debrief/order-info/failure-content/index.tsx +187 -0
  130. package/src/components/order-view/order-actions/actions/force-debrief/order-info/index.tsx +55 -0
  131. package/src/components/order-view/order-actions/actions/force-debrief/order-info/success-content/index.tsx +221 -0
  132. package/src/components/order-view/order-actions/actions/force-debrief/styles.tsx +51 -0
  133. package/src/components/order-view/order-actions/actions/hold-order/HoldOrderModal.tsx +2 -0
  134. package/src/components/order-view/order-actions/actions/remove-from-route/RemoveFromRoute.tsx +7 -2
  135. package/src/components/order-view/order-actions/actions/unhold-order/UnholdOrder.tsx +2 -0
  136. package/src/components/order-view/order-actions/index.tsx +18 -5
  137. package/src/components/order-view/order-actions/store.ts +1 -1
  138. package/src/components/order-view/order-actions/types.ts +3 -3
  139. package/src/components/order-view/order-details/expanded-content/footer/index.tsx +7 -1
  140. package/src/components/order-view/order-details/expanded-content/index.tsx +37 -16
  141. package/src/components/order-view/order-details/expanded-content/instruction-section/index.tsx +1 -1
  142. package/src/components/order-view/order-details/expanded-content/services-section/ServiceLevel.tsx +3 -4
  143. package/src/components/order-view/order-details/index.tsx +5 -2
  144. package/src/components/order-view/order-resources/expanded-content/index.tsx +2 -2
  145. package/src/components/order-view/products-info/expanded-content/index.tsx +33 -11
  146. package/src/components/order-view/products-info/index.tsx +10 -6
  147. package/src/components/order-view/return-client-products/ProductTable.tsx +12 -2
  148. package/src/components/order-view/return-client-products/product-table/ReturnProductTable.tsx +73 -23
  149. package/src/components/order-view/store.ts +107 -1
  150. package/src/components/order-view/system-event-logs/expanded-content/index.tsx +6 -2
  151. package/src/components/order-view/types.ts +54 -1
  152. package/src/components/order-view/utils.ts +37 -0
  153. package/src/components/order-view/view-reminder/AssigneeDropdown.tsx +85 -26
  154. package/src/components/order-view/view-reminder/ViewReminder.tsx +33 -14
  155. package/src/components/store.ts +1 -1
  156. package/src/index.tsx +6 -3
@@ -12,10 +12,10 @@ import {
12
12
  useEndDate,
13
13
  useStartDate,
14
14
  } from '../../../store';
15
- import { filtersReducerReturnAtom } from '../../return-after-table/table-filters/ReturnFilterStore';
16
15
  import ReturnSearchBar from '../../../client-portal/ReturnSearchBar';
17
16
  import { useParams } from 'react-router-dom';
18
17
  import ReturnAfterSearchBar from '../../../client-portal/ReturnAfterSearchBar';
18
+ import { dateFilterCPReducer } from '../../../client-portal/DateFilterStore';
19
19
 
20
20
  interface RouterHeaderProps {
21
21
  breadcrumbTitle?: string;
@@ -30,44 +30,37 @@ const RouterHeader: React.FC<RouterHeaderProps> = ({
30
30
  breadcrumbSubPart, // Optional
31
31
  }) => {
32
32
  const [clientPortal] = useClientPortal();
33
- const [, dispatch] = useAtom(filtersReducerReturnAtom);
33
+ const [, dispatch] = useAtom(dateFilterCPReducer);
34
34
  //CP
35
35
  const [startDate, setStartDate] = useStartDate();
36
36
  const [endDate, setEndDate] = useEndDate();
37
37
  const { status } = useParams();
38
38
 
39
- useEffect(() => {
40
- const storedDates = JSON.parse(localStorage.getItem('returnDate') || '{}');
41
- const initialStart = storedDates?.startDate
42
- ? dayjs(storedDates.startDate)
43
- : null;
44
- const initialEnd = storedDates?.endDate ? dayjs(storedDates.endDate) : null;
45
-
46
- if (initialStart) setStartDate(initialStart);
47
- if (initialEnd) setEndDate(initialEnd);
48
- }, []);
49
-
50
39
  useEffect(() => {
51
40
  if (clientPortal) {
52
41
  const formattedStart = startDate?.format('YYYY-MM-DD');
53
42
  const formattedEnd = endDate ? endDate?.format('YYYY-MM-DD') : null;
54
-
43
+ console.log(formattedStart, 'syart', formattedEnd, 'end');
55
44
  const payload = {
56
45
  startDate: formattedStart,
57
46
  endDate: formattedEnd,
58
47
  };
59
- localStorage.setItem('returnDate', JSON.stringify(payload));
48
+
49
+ console.log(payload, 'PAYLOAD');
60
50
  if (formattedStart || formattedEnd) {
61
51
  dispatch({
62
52
  type: 'SET_CP_DATE_FILTER',
63
- payload,
53
+ payload: {
54
+ startDate: formattedStart,
55
+ endDate: formattedEnd,
56
+ },
64
57
  });
65
58
  }
66
59
  }
67
60
  }, [startDate, endDate]);
68
61
 
69
62
  const handleStartDateChange: DatePickerProps['onChange'] = date => {
70
- setStartDate(date ?? dayjs());
63
+ setStartDate(date ?? null);
71
64
  };
72
65
 
73
66
  const handleEndDateChange: DatePickerProps['onChange'] = date => {
@@ -127,7 +120,7 @@ export const DatePickerWrap = styled.div`
127
120
  align-self: stretch;
128
121
  border-radius: 20px;
129
122
  border: 1px solid #e0e2e7;
130
- background: var(--Neutral-White, #fff);
123
+ background: #fff;
131
124
  box-shadow: 0px 1px 2px 0px rgba(16, 24, 40, 0.05);
132
125
  min-width: 22vw;
133
126
  height: 35px;
@@ -26,11 +26,13 @@ import styled from 'styled-components';
26
26
  import { Select } from 'antd';
27
27
  import { useLocationOptions } from '../../order-view/store';
28
28
  import { useNavigate, useSearchParams } from 'react-router-dom';
29
+ import { useAxios } from '@bjsdistribution/dms-component-library';
30
+ import { ApiResponse } from '../common/interface';
29
31
 
30
32
  export const clickedState = atom<boolean>(false);
31
33
 
32
34
  function SelectionFilter() {
33
- const [customers] = useCustomerData();
35
+ const [customers, setCustomers] = useCustomerData();
34
36
  const [selectedFilterValue, setSelectedFilterValue] = useSelectedAction();
35
37
  const [, dispatch] = useAtom(filtersReducerAtom);
36
38
  const [
@@ -47,6 +49,25 @@ function SelectionFilter() {
47
49
  const [searchParams] = useSearchParams();
48
50
  const navigate = useNavigate();
49
51
 
52
+ //API for client data
53
+ const { data: fetchedCustomerData, loading: loading, fetchData } = useAxios<
54
+ ApiResponse
55
+ >({
56
+ endpoint: `/v1/return/product/customers/`,
57
+ method: 'GET',
58
+ //@ts-ignore
59
+ pagination: { is_pagination: false },
60
+ });
61
+
62
+ useEffect(() => {
63
+ fetchData();
64
+ }, []);
65
+
66
+ useEffect(() => {
67
+ if (fetchedCustomerData && fetchedCustomerData?.data) {
68
+ setCustomers(fetchedCustomerData?.data);
69
+ }
70
+ }, [loading]);
50
71
  //new codee
51
72
  const urlCustomerId = searchParams.get('customerId');
52
73
  const urlActiontype = searchParams.get('type');
@@ -54,7 +75,6 @@ function SelectionFilter() {
54
75
  const selectedCustomer = customers?.find(
55
76
  (customer: any) => customer?.customer_id?.toString() === urlCustomerId
56
77
  );
57
-
58
78
  const accountNumber = selectedCustomer?.account_number;
59
79
 
60
80
  //customer name
@@ -91,10 +111,14 @@ function SelectionFilter() {
91
111
  setActionTypeOptions(mappedActions);
92
112
 
93
113
  const mappedLocations = Array.isArray(filteredClient?.return_locations)
94
- ? filteredClient?.return_locations?.map((location: any) => ({
95
- label: location?.location_name,
96
- value: location?.token,
97
- }))
114
+ ? filteredClient.return_locations
115
+ .filter(
116
+ (location: any) => location?.location_name && location?.token
117
+ )
118
+ .map((location: any) => ({
119
+ label: location.location_name,
120
+ value: location.token,
121
+ }))
98
122
  : [];
99
123
 
100
124
  setLocationOptions(mappedLocations);
@@ -135,10 +159,16 @@ function SelectionFilter() {
135
159
  setActionTypeOptions(mappedActions);
136
160
 
137
161
  const mappedLocations = Array.isArray(filteredClient?.return_locations)
138
- ? filteredClient?.return_locations?.map((location: any) => ({
139
- label: location?.location_name,
140
- value: location?.token,
141
- }))
162
+ ? filteredClient.return_locations
163
+ .filter((location: any) => {
164
+ const name = location?.location_name;
165
+ const token = location?.token;
166
+ return name && name !== 'null' && token && token !== 'null';
167
+ })
168
+ .map((location: any) => ({
169
+ label: location?.location_name,
170
+ value: location?.token,
171
+ }))
142
172
  : [];
143
173
 
144
174
  setLocationOptions(mappedLocations);
@@ -166,9 +196,7 @@ function SelectionFilter() {
166
196
  console.log(currentSearch, 'currentSearch');
167
197
 
168
198
  if (!currentSearch.includes('filter')) {
169
- console.log('inside include');
170
199
  // for dev
171
- //navigate(`filter?${queryParams.toString()}`);
172
200
  navigate(`/orders/view/return/filter?${queryParams.toString()}`);
173
201
 
174
202
  // for local
@@ -328,7 +356,7 @@ function SelectionFilter() {
328
356
  options={clientOptions}
329
357
  placeholder="Select Client Name"
330
358
  onChange={handleClientChange}
331
- style={{ minWidth: '150px' }}
359
+ style={{ minWidth: '250px' }}
332
360
  value={selectedClient}
333
361
  allowClear
334
362
  onClear={handleClear}
@@ -349,7 +377,7 @@ function SelectionFilter() {
349
377
  placeholder="Select Action Type"
350
378
  value={selectedFilterValue}
351
379
  onChange={handleActionClick}
352
- style={{ minWidth: '150px' }}
380
+ style={{ minWidth: '200px' }}
353
381
  allowClear
354
382
  onClear={handleClearAction}
355
383
  />
@@ -362,7 +390,7 @@ function SelectionFilter() {
362
390
  value={selectedLocationValue}
363
391
  placeholder="Select Location"
364
392
  onChange={handleLocationChange}
365
- style={{ minWidth: '150px' }}
393
+ style={{ minWidth: '200px' }}
366
394
  allowClear
367
395
  mode="multiple"
368
396
  />
@@ -6,9 +6,12 @@ import {
6
6
  } from './store/store';
7
7
  import Filters from './filters/Filters';
8
8
  import styled from 'styled-components';
9
- import { useCustomerData, useStickyStatus } from '../store';
9
+ import { useClientPortal, useCustomerData, useStickyStatus } from '../store';
10
10
  import HeaderFilter from './header-filters/HeaderFilter';
11
- import { useApiHook } from '@bjsdistribution/dms-component-library';
11
+ import {
12
+ DocumentTitle,
13
+ useAxios,
14
+ } from '@bjsdistribution/dms-component-library';
12
15
  import { useAtom, useClientData } from '../order-view/store';
13
16
  import { ClientData } from './common/interface';
14
17
  import ReturnFilter from './return-order-table/return-orders-filters/ReturnFilter';
@@ -33,6 +36,7 @@ function ReturnMainTable() {
33
36
  const [, setCustomers] = useCustomerData();
34
37
  // const [tableName] = useTableName();
35
38
  const queryParams = new URLSearchParams(location.search);
39
+ const [clientPortal] = useClientPortal();
36
40
 
37
41
  const customerId = queryParams.get('customerId');
38
42
 
@@ -44,14 +48,20 @@ function ReturnMainTable() {
44
48
  };
45
49
 
46
50
  //API for client data
47
- const { data: fetchedCustomerData, loading: loading } = useApiHook<
51
+ const { data: fetchedCustomerData, loading: loading, fetchData } = useAxios<
48
52
  ApiResponse
49
53
  >({
50
54
  endpoint: `/v1/return/product/customers/`,
51
55
  method: 'GET',
52
56
  //@ts-ignore
53
57
  pagination: { is_pagination: false },
58
+ showLoader: false,
54
59
  });
60
+ useEffect(() => {
61
+ if (!clientPortal) {
62
+ fetchData();
63
+ }
64
+ }, []);
55
65
 
56
66
  useEffect(() => {
57
67
  if (fetchedCustomerData && fetchedCustomerData?.data) {
@@ -63,7 +73,8 @@ function ReturnMainTable() {
63
73
  data: fetchedClientData,
64
74
  loading: statsDataLoading,
65
75
  paginationData,
66
- } = useApiHook<{
76
+ fetchData: fetchProductStats,
77
+ } = useAxios<{
67
78
  data: ClientData[];
68
79
  }>({
69
80
  endpoint: `/v1/return/product/stats/`,
@@ -71,8 +82,15 @@ function ReturnMainTable() {
71
82
  //@ts-ignore
72
83
  pagination: pagination,
73
84
  filters: filters,
85
+ showLoader: false,
74
86
  });
75
87
 
88
+ useEffect(() => {
89
+ if (!clientPortal) {
90
+ fetchProductStats();
91
+ }
92
+ }, []);
93
+
76
94
  useEffect(() => {
77
95
  setLoading(statsDataLoading);
78
96
  if (fetchedClientData && fetchedClientData.data) {
@@ -95,6 +113,7 @@ function ReturnMainTable() {
95
113
 
96
114
  return (
97
115
  <>
116
+ <DocumentTitle title="Client Return Products" />
98
117
  <DashBoardWrapper className={` ${isScrolled ? 'stickyTableHead' : ''}`}>
99
118
  {/* <RouterHeader /> */}
100
119
  <div className="Tableconatiner">
@@ -10,7 +10,10 @@ import {
10
10
  UsePaginationReturnData,
11
11
  } from '../store/store';
12
12
  import { ApiResponse } from '../common/interface';
13
- import { useApiHook } from '@bjsdistribution/dms-component-library';
13
+ import {
14
+ DocumentTitle,
15
+ useApiHook,
16
+ } from '@bjsdistribution/dms-component-library';
14
17
  import { filtersReducerReturnAtom } from './table-filters/ReturnFilterStore';
15
18
  import { notification } from 'antd';
16
19
  import ReturnPagination from '../table-view/ReturnPagination';
@@ -47,6 +50,7 @@ const ReturnAfterTable = () => {
47
50
  filters: filters && filters?.length > 0 ? filters : undefined,
48
51
  pagination: pagination,
49
52
  performAction: false,
53
+ showLoader: false,
50
54
  });
51
55
 
52
56
  useEffect(() => {
@@ -79,6 +83,7 @@ const ReturnAfterTable = () => {
79
83
 
80
84
  return (
81
85
  <div>
86
+ <DocumentTitle title="Return Order List" />
82
87
  <DashBoardWrapper>
83
88
  {/* <RouterHeader /> */}
84
89
  <div className="Tableconatiner">
@@ -239,6 +239,7 @@ const OrderTable = () => {
239
239
  <th>Consignment</th>
240
240
  <th>Return Order No</th>
241
241
  <th> Total Parts</th>
242
+ <th> Total Orders</th>
242
243
  <th onClick={() => handleSort('weight')}>
243
244
  <div className="sortIconClass">
244
245
  Total Weight {renderSortIcon('weight')}
@@ -328,6 +329,8 @@ const OrderTable = () => {
328
329
  <td>{displayValueOrNA(item?.order_number)}</td>
329
330
 
330
331
  <td>{displayValueOrNA(item?.total_products)}</td>
332
+ <td>{displayValueOrNA(item?.total_orders)}</td>
333
+
331
334
  <td>
332
335
  {displayValueOrNA(item?.weight)}{' '}
333
336
  {item?.weight && item?.weight > 0 ? 'KG' : ''}
@@ -171,46 +171,46 @@ const filterReducer = (state: FilterState, action: any): FilterState => {
171
171
  }
172
172
 
173
173
  //client portal
174
- case 'SET_CP_DATE_FILTER': {
175
- let { startDate, endDate } = action.payload;
174
+ // case 'SET_CP_DATE_FILTER': {
175
+ // let { startDate, endDate } = action.payload;
176
176
 
177
- if (!startDate || !endDate) {
178
- const storedDates = JSON.parse(
179
- localStorage.getItem('returnDate') || '{}'
180
- );
181
- startDate = startDate ?? storedDates?.startDate;
182
- endDate = endDate ?? storedDates?.endDate ?? startDate;
183
- }
177
+ // if (!startDate || !endDate) {
178
+ // const storedDates = JSON.parse(
179
+ // localStorage.getItem('returnDate') || '{}'
180
+ // );
181
+ // startDate = startDate ?? storedDates?.startDate;
182
+ // endDate = endDate ?? storedDates?.endDate ?? startDate;
183
+ // }
184
184
 
185
- const filters = state['x-filters'].filter(f => f.field !== 'created_at');
185
+ // const filters = state['x-filters'].filter(f => f.field !== 'created_at');
186
186
 
187
- if (startDate === endDate) {
188
- filters.push({
189
- field: 'created_at',
190
- op: '=',
191
- value: format(new Date(startDate), 'yyyy-MM-dd'),
192
- });
193
- } else if (startDate && endDate) {
194
- filters.push(
195
- {
196
- field: 'created_at',
197
- op: '>=',
198
- value: format(new Date(startDate), 'yyyy-MM-dd'),
199
- },
200
- {
201
- field: 'created_at',
202
- op: '<=',
203
- value: format(new Date(endDate), 'yyyy-MM-dd'),
204
- }
205
- );
206
- }
187
+ // if (startDate === endDate) {
188
+ // filters.push({
189
+ // field: 'created_at',
190
+ // op: '=',
191
+ // value: format(new Date(startDate), 'yyyy-MM-dd'),
192
+ // });
193
+ // } else if (startDate && endDate) {
194
+ // filters.push(
195
+ // {
196
+ // field: 'created_at',
197
+ // op: '>=',
198
+ // value: format(new Date(startDate), 'yyyy-MM-dd'),
199
+ // },
200
+ // {
201
+ // field: 'created_at',
202
+ // op: '<=',
203
+ // value: format(new Date(endDate), 'yyyy-MM-dd'),
204
+ // }
205
+ // );
206
+ // }
207
207
 
208
- return {
209
- ...state,
210
- 'x-filters': filters,
211
- 'x-pagination': { ...state['x-pagination'], page: 1 },
212
- };
213
- }
208
+ // return {
209
+ // ...state,
210
+ // 'x-filters': filters,
211
+ // 'x-pagination': { ...state['x-pagination'], page: 1 },
212
+ // };
213
+ // }
214
214
  // case 'CLEAR_CLIENT':
215
215
  // return {
216
216
  // ...state,
@@ -209,7 +209,7 @@ const ReturnOrderFilter = () => {
209
209
  className="custom-select"
210
210
  placeholder="Status of Order"
211
211
  onChange={handleStatusOfOrder}
212
- style={{ minWidth: '150px', width: 'auto' }}
212
+ style={{ minWidth: '250px', maxWidth: '300px' }}
213
213
  value={statusOrder}
214
214
  onClear={handleClear}
215
215
  allowClear
@@ -227,9 +227,19 @@ const ReturnOrderFilter = () => {
227
227
  placeholder="Clients"
228
228
  onChange={handleClientChange}
229
229
  value={selectedClient}
230
- style={{ minWidth: '150px', width: 'auto' }}
230
+ style={{
231
+ minWidth: '150px',
232
+ width: 'auto',
233
+ cursor: 'pointer',
234
+ }}
231
235
  allowClear
232
236
  onClear={handleClearClient}
237
+ filterOption={(input: any, option: any) =>
238
+ (option?.label ?? '')
239
+ .toLowerCase()
240
+ .includes(input.toLowerCase())
241
+ }
242
+ showSearch
233
243
  />
234
244
  </StyledAntSelect>
235
245
  </div>
@@ -8,12 +8,15 @@ import ReturnOrderTable from './return-orders-filters/ReturnOrderTable';
8
8
  import ModalManager from '../../order-view/modalsPopup/ModalManager';
9
9
  import { useItemsPerPage, UsePaginationData } from '../store/store';
10
10
  import Pagination from '../table-view/Pagination';
11
+ import { useCustomerData } from '../../store';
12
+ import { DocumentTitle } from '@bjsdistribution/dms-component-library';
11
13
  // import { useLocation } from 'react-router-dom';
12
14
 
13
15
  const ReturnTable = () => {
14
16
  const [paginationObj] = UsePaginationData();
15
17
  const [, setCurrentPage] = useState(1);
16
18
  const [itemsPerPage, setItemsPerPage] = useItemsPerPage();
19
+ const [customers] = useCustomerData();
17
20
  // const location = useLocation();
18
21
  const { page, total } = paginationObj;
19
22
 
@@ -30,10 +33,23 @@ const ReturnTable = () => {
30
33
  // const clientId = queryParams.get('customerId');
31
34
  // }, [location]);
32
35
 
36
+ const queryParams = new URLSearchParams(location.search);
37
+
38
+ const customerId = queryParams.get('customerId');
39
+
40
+ const selectedCustomer = customers?.find(
41
+ (customer: any) => customer?.customer_id?.toString() === customerId
42
+ );
43
+
44
+ const customerName = selectedCustomer?.customer_name;
45
+
46
+ const docTitle = `${customerName}: Return Product`;
47
+
33
48
  return (
34
49
  <div>
35
50
  <DashBoardWrapper>
36
51
  {/* <RouterHeader /> */}
52
+ <DocumentTitle title={docTitle} />
37
53
  <div className="Tableconatiner">
38
54
  <HeaderFilter />
39
55
  <Container>
@@ -10,6 +10,7 @@ import SortIcon from '../../../../common/SortIcon';
10
10
  import PrintDropDownReturn from '../../../order-view/details-filters/left-side-filters/dropdowns/PrintDropDownReturn';
11
11
  import { usefetchAgain, useReturnData } from '../../../order-view/store';
12
12
  import {
13
+ useCustomerData,
13
14
  useGroupedPayload,
14
15
  useLocationData,
15
16
  useNewReturnPayload,
@@ -27,7 +28,7 @@ import {
27
28
  } from '../../store/store';
28
29
  import { EmptyDataContainer } from '../../table/table-data/styles';
29
30
  import { CustomDrop, StyledTable, StyledTableWrapper } from './returnstyles';
30
- import { NavLink } from 'react-router-dom';
31
+ import { NavLink, useSearchParams } from 'react-router-dom';
31
32
 
32
33
  const ReturnOrderTable = () => {
33
34
  const [state] = useAtom(filtersReducerAtom);
@@ -39,13 +40,14 @@ const ReturnOrderTable = () => {
39
40
  const dropdownRefParent = useRef<HTMLDivElement>(null);
40
41
  const dropdownRef = useRef<HTMLDivElement>(null);
41
42
  const [printToogle, setPrintToggle] = usePrintOptionTOggle();
42
- const [createReturn, setReturnPayload] = useReturnPayload();
43
+ const [, setReturnPayload] = useReturnPayload();
43
44
  const [newpayload, setNewPayload] = useNewReturnPayload();
44
45
  const [, setGrouped] = useGroupedPayload();
45
46
  const [locationData] = useLocationData();
46
47
  const [, setPaginationObject] = UsePaginationData();
47
48
  const [callForFetch] = usefetchAgain();
48
-
49
+ const [searchParams] = useSearchParams();
50
+ const urlCustomerId = searchParams.get('customerId');
49
51
  //sorting
50
52
  const [sortConfig, setSortConfig] = useState<{
51
53
  key: string;
@@ -122,6 +124,7 @@ const ReturnOrderTable = () => {
122
124
  filters: filters,
123
125
  pagination: pagination,
124
126
  performAction: false,
127
+ showLoader: false,
125
128
  });
126
129
 
127
130
  useEffect(() => {
@@ -168,7 +171,15 @@ const ReturnOrderTable = () => {
168
171
  }
169
172
  // setShouldPerformAction(false);
170
173
  }, [fetchedOrderData, returnDataLoad, locationData, state, callForFetch]);
174
+ const [customers] = useCustomerData();
175
+
176
+ const selectedCustomer = customers?.find((customer: any) => {
177
+ const customerId = customer?.customer_id?.toString();
178
+ return customerId && customerId === urlCustomerId;
179
+ });
171
180
 
181
+ const accountNumber = selectedCustomer?.account_number;
182
+ console.log(selectedCustomer, 'selectedCustomer');
172
183
  const handleSelectAll = (e: any) => {
173
184
  const isChecked = e.target.checked;
174
185
  setSelectAll(isChecked);
@@ -187,8 +198,8 @@ const ReturnOrderTable = () => {
187
198
  }));
188
199
  const newPayload = filteredData.map((loc: any) => ({
189
200
  id: loc.id,
190
- account_number: createReturn?.account_number,
191
- customer_id: +createReturn?.customer_id,
201
+ account_number: accountNumber,
202
+ customer_id: Number(urlCustomerId),
192
203
  products: [loc?.legacy_product_id],
193
204
  return_action: loc?.product_return_action,
194
205
  return_location_token: loc?.return_location || null,
@@ -214,7 +225,6 @@ const ReturnOrderTable = () => {
214
225
  const isSelected = prevSelectedLocations?.some(
215
226
  (loc: any) => loc.id === id
216
227
  );
217
-
218
228
  if (isSelected) {
219
229
  const updatedSelectedLocations = prevSelectedLocations.filter(
220
230
  (loc: any) => loc.id !== id
@@ -237,8 +247,8 @@ const ReturnOrderTable = () => {
237
247
  } else {
238
248
  const newReturnPayload = {
239
249
  id,
240
- account_number: createReturn?.account_number,
241
- customer_id: +createReturn?.customer_id,
250
+ account_number: accountNumber,
251
+ customer_id: Number(urlCustomerId),
242
252
  products: [legacy_product_id],
243
253
  return_action: product_return_action || null,
244
254
  return_location_token: return_location || null,
@@ -299,7 +309,6 @@ const ReturnOrderTable = () => {
299
309
  const mergedPayload = Object.values(groupedPayload);
300
310
  setGrouped(mergedPayload);
301
311
  }, [newpayload]);
302
-
303
312
  return (
304
313
  <>
305
314
  <StyledTableWrapper className="fortables">
@@ -310,7 +319,10 @@ const ReturnOrderTable = () => {
310
319
  <Checkbox checked={selectAll} onChange={handleSelectAll} />
311
320
  </th> */}
312
321
  {returnData?.some(
313
- (item: any) => item?.product_return_action === 'RTS'
322
+ (item: any) =>
323
+ item?.product_return_action === 'RTS' &&
324
+ item?.return_location !== 'null' &&
325
+ item?.return_location !== null
314
326
  ) ? (
315
327
  <th className="emailInvoiceCheckbox">
316
328
  <Checkbox checked={selectAll} onChange={handleSelectAll} />
@@ -376,7 +388,9 @@ const ReturnOrderTable = () => {
376
388
  sortedData?.map((item: any, index: any) => (
377
389
  <tr key={item.id}>
378
390
  <td>
379
- {item?.product_return_action === 'RTS' ? (
391
+ {item?.product_return_action === 'RTS' &&
392
+ item?.return_location !== 'null' &&
393
+ item?.return_location !== null ? (
380
394
  <Checkbox
381
395
  className="custom-check"
382
396
  checked={selectedReturnOrder.some(
@@ -108,7 +108,6 @@ const ReturnTable: React.FC = () => {
108
108
  customerId: customerId?.toString(),
109
109
  });
110
110
  //for dev
111
- //navigate(`filter?${queryParams.toString()}`);
112
111
  navigate(`/orders/view/return/filter?${queryParams.toString()}`);
113
112
 
114
113
  //for local
@@ -138,7 +137,6 @@ const ReturnTable: React.FC = () => {
138
137
  type: RTS,
139
138
  });
140
139
  //for dev
141
- //navigate(`filter?${queryParams.toString()}`);
142
140
  navigate(`/orders/view/return/filter?${queryParams.toString()}`);
143
141
 
144
142
  //for local
@@ -158,6 +156,7 @@ const ReturnTable: React.FC = () => {
158
156
  { label: 'Products', key: 'return_order_products' },
159
157
  { label: 'RTS', key: 'RTS' },
160
158
  { label: 'Pending', key: 'PENDING' },
159
+ { label: 'Claims Paid', key: 'CLAIMS PAID' },
161
160
  { label: 'Dispose', key: 'DISPOSE' },
162
161
  { label: 'Re-allocate', key: 'RE-ALLOCATE' },
163
162
  { label: 'Re-Del', key: 'RE-DEL' },
@@ -175,13 +174,13 @@ const ReturnTable: React.FC = () => {
175
174
  <tbody>
176
175
  {statsLoading ? (
177
176
  <tr>
178
- <td colSpan={11}>
177
+ <td colSpan={12}>
179
178
  <Skeleton active />
180
179
  </td>
181
180
  </tr>
182
181
  ) : sortedData?.length === 0 ? (
183
182
  <tr>
184
- <td colSpan={11}>
183
+ <td colSpan={12}>
185
184
  <EmptyDataContainer>
186
185
  <Empty />
187
186
  </EmptyDataContainer>
@@ -249,6 +248,11 @@ const ReturnTable: React.FC = () => {
249
248
  <GreyBox>{key?.PENDING}</GreyBox>
250
249
  </ColumStyle>
251
250
  </td>
251
+ <td>
252
+ <ColumStyle>
253
+ <GreyBox>{key?.['CLAIMS PAID']}</GreyBox>
254
+ </ColumStyle>
255
+ </td>
252
256
  <td>
253
257
  <ColumStyle>
254
258
  <GreyBox>{key?.DISPOSE}</GreyBox>