@bjsdistribution/dms-client-return 0.1.19-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 (162) hide show
  1. package/dist/components/client-portal/DateFilterStore.d.ts +15 -0
  2. package/dist/components/client-portal/OutstandingTable.d.ts +3 -0
  3. package/dist/components/client-portal/ReturnStatus.d.ts +5 -0
  4. package/dist/components/client-portal/return-confirm/ConfirmedMain.d.ts +3 -0
  5. package/dist/components/client-portal/return-confirm/ReturnConfirmedTable.d.ts +3 -0
  6. package/dist/components/order-view/DynamicTable.d.ts +2 -1
  7. package/dist/components/order-view/general-information/Status.d.ts +1 -1
  8. package/dist/components/order-view/general-information/index.d.ts +1 -1
  9. package/dist/components/order-view/index.d.ts +1 -1
  10. package/dist/components/order-view/notes/AddNote.d.ts +1 -0
  11. package/dist/components/order-view/notes/order-dropdown/NewReturnDropdown.d.ts +3 -0
  12. package/dist/components/order-view/order-actions/actions/clear-booking-status/ClearBookingStatus.d.ts +4 -1
  13. package/dist/components/order-view/order-actions/actions/confirm-order/index.d.ts +4 -1
  14. package/dist/components/order-view/order-actions/actions/force-debrief/BaseChargeConfirmationModal.d.ts +7 -0
  15. package/dist/components/order-view/order-actions/actions/force-debrief/ForceDebriefModal.d.ts +11 -0
  16. package/dist/components/order-view/order-actions/actions/force-debrief/Selector.d.ts +11 -0
  17. package/dist/components/order-view/order-actions/actions/force-debrief/charges/adhoc/index.d.ts +3 -0
  18. package/dist/components/order-view/order-actions/actions/force-debrief/charges/base-charge/index.d.ts +8 -0
  19. package/dist/components/order-view/order-actions/actions/force-debrief/charges/collection-add-ons/index.d.ts +7 -0
  20. package/dist/components/order-view/order-actions/actions/force-debrief/charges/delivery-add-ons/index.d.ts +7 -0
  21. package/dist/components/order-view/order-actions/actions/force-debrief/charges/disposal-charges/index.d.ts +7 -0
  22. package/dist/components/order-view/order-actions/actions/force-debrief/charges/order-charges/index.d.ts +7 -0
  23. package/dist/components/order-view/order-actions/actions/force-debrief/escalation/EscalationCategory.d.ts +3 -0
  24. package/dist/components/order-view/order-actions/actions/force-debrief/escalation/EscalationLevel.d.ts +3 -0
  25. package/dist/components/order-view/order-actions/actions/force-debrief/escalation/EscalationReason.d.ts +3 -0
  26. package/dist/components/order-view/order-actions/actions/force-debrief/escalation/index.d.ts +3 -0
  27. package/dist/components/order-view/order-actions/actions/force-debrief/notifications/FlagsTemplate.d.ts +3 -0
  28. package/dist/components/order-view/order-actions/actions/force-debrief/notifications/OrderTemplate.d.ts +3 -0
  29. package/dist/components/order-view/order-actions/actions/force-debrief/notifications/Tabs.d.ts +3 -0
  30. package/dist/components/order-view/order-actions/actions/force-debrief/notifications/index.d.ts +3 -0
  31. package/dist/components/order-view/order-actions/actions/force-debrief/order-info/RadioButtons.d.ts +7 -0
  32. package/dist/components/order-view/order-actions/actions/force-debrief/order-info/dropdowns/CancellationReasonDropdown.d.ts +3 -0
  33. package/dist/components/order-view/order-actions/actions/force-debrief/order-info/dropdowns/FailureReasonDropdown.d.ts +3 -0
  34. package/dist/components/order-view/order-actions/actions/force-debrief/order-info/dropdowns/OrderHoldReasonDropdown.d.ts +3 -0
  35. package/dist/components/order-view/order-actions/actions/force-debrief/order-info/dropdowns/StatusDropdown.d.ts +3 -0
  36. package/dist/components/order-view/order-actions/actions/force-debrief/order-info/dropdowns/ZoneDropdown.d.ts +3 -0
  37. package/dist/components/order-view/order-actions/actions/force-debrief/order-info/failure-content/index.d.ts +3 -0
  38. package/dist/components/order-view/order-actions/actions/force-debrief/order-info/index.d.ts +4 -0
  39. package/dist/components/order-view/order-actions/actions/force-debrief/order-info/success-content/index.d.ts +3 -0
  40. package/dist/components/order-view/order-actions/actions/force-debrief/styles.d.ts +8 -0
  41. package/dist/components/order-view/order-actions/actions/hold-order/HoldOrderModal.d.ts +1 -0
  42. package/dist/components/order-view/order-actions/actions/remove-from-route/RemoveFromRoute.d.ts +1 -1
  43. package/dist/components/order-view/order-actions/actions/unhold-order/UnholdOrder.d.ts +1 -0
  44. package/dist/components/order-view/order-actions/types.d.ts +3 -3
  45. package/dist/components/order-view/order-details/expanded-content/index.d.ts +1 -1
  46. package/dist/components/order-view/order-details/index.d.ts +1 -1
  47. package/dist/components/order-view/order-resources/expanded-content/index.d.ts +1 -1
  48. package/dist/components/order-view/products-info/expanded-content/index.d.ts +6 -1
  49. package/dist/components/order-view/products-info/index.d.ts +1 -1
  50. package/dist/components/order-view/return-client-products/ProductTable.d.ts +6 -1
  51. package/dist/components/order-view/return-client-products/product-table/ReturnProductTable.d.ts +6 -1
  52. package/dist/components/order-view/store.d.ts +15 -3
  53. package/dist/components/order-view/system-event-logs/expanded-content/index.d.ts +1 -1
  54. package/dist/components/order-view/types.d.ts +49 -1
  55. package/dist/components/order-view/utils.d.ts +3 -0
  56. package/dist/components/order-view/view-reminder/ViewReminder.d.ts +2 -0
  57. package/dist/components/store.d.ts +5 -1
  58. package/dist/dms-client-return.cjs.development.js +7035 -3476
  59. package/dist/dms-client-return.cjs.development.js.map +1 -1
  60. package/dist/dms-client-return.cjs.production.min.js +1 -1
  61. package/dist/dms-client-return.cjs.production.min.js.map +1 -1
  62. package/dist/dms-client-return.esm.js +7099 -3540
  63. package/dist/dms-client-return.esm.js.map +1 -1
  64. package/package.json +6 -4
  65. package/src/assets/icons/ActionIcon.tsx +1 -1
  66. package/src/assets/icons/ArrowDownIcon.tsx +2 -2
  67. package/src/components/client-portal/DateFilterStore.ts +94 -0
  68. package/src/components/client-portal/OutstandingTable.tsx +355 -0
  69. package/src/components/client-portal/ReturnAfterSearchBar.tsx +76 -17
  70. package/src/components/client-portal/ReturnOverview.tsx +4 -4
  71. package/src/components/client-portal/ReturnRTFilters.tsx +57 -40
  72. package/src/components/client-portal/ReturnSearchBar.tsx +64 -94
  73. package/src/components/client-portal/ReturnStatus.tsx +50 -68
  74. package/src/components/client-portal/return-confirm/ConfirmedMain.tsx +224 -0
  75. package/src/components/client-portal/return-confirm/ReturnConfirmedTable.tsx +327 -0
  76. package/src/components/order-daily-overview/header/route-header/RouterHeader.tsx +11 -18
  77. package/src/components/order-daily-overview/header-filters/SelectionFilter.tsx +43 -15
  78. package/src/components/order-daily-overview/index.tsx +23 -4
  79. package/src/components/order-daily-overview/return-after-table/ReturnAfterTable.tsx +23 -38
  80. package/src/components/order-daily-overview/return-after-table/table/OrderTable.tsx +21 -24
  81. package/src/components/order-daily-overview/return-after-table/table-filters/ReturnFilterStore.ts +36 -36
  82. package/src/components/order-daily-overview/return-after-table/table-filters/ReturnOrderFilter.tsx +12 -2
  83. package/src/components/order-daily-overview/return-order-table/ReturnTable.tsx +16 -0
  84. package/src/components/order-daily-overview/return-order-table/return-orders-filters/ReturnOrderTable.tsx +58 -155
  85. package/src/components/order-daily-overview/table/ReturnTable.tsx +8 -4
  86. package/src/components/order-view/DynamicTable.tsx +21 -8
  87. package/src/components/order-view/details-filters/left-side-filters/dropdowns/DropDowns.tsx +1 -1
  88. package/src/components/order-view/details-filters/left-side-filters/dropdowns/OptionsDropDown.tsx +9 -0
  89. package/src/components/order-view/details-filters/right-side-filters/Details.tsx +28 -3
  90. package/src/components/order-view/flags-action-modal/Dropdowns.tsx +2 -0
  91. package/src/components/order-view/general-information/Status.tsx +92 -18
  92. package/src/components/order-view/general-information/index.tsx +2 -2
  93. package/src/components/order-view/generic-table/AuditLogs.tsx +39 -12
  94. package/src/components/order-view/index.tsx +50 -8
  95. package/src/components/order-view/modalsPopup/ModalManager.tsx +1 -1
  96. package/src/components/order-view/notes/AddNote.tsx +95 -65
  97. package/src/components/order-view/notes/order-dropdown/NewReturnDropdown.tsx +8 -10
  98. package/src/components/order-view/notification/FlagTemplate.tsx +21 -10
  99. package/src/components/order-view/notification/OrderTemplate.tsx +192 -41
  100. package/src/components/order-view/notification/ReminderTemplate.tsx +28 -13
  101. package/src/components/order-view/notification/index.tsx +100 -55
  102. package/src/components/order-view/order-actions/actions/add-resources/DocFileUpload.tsx +92 -72
  103. package/src/components/order-view/order-actions/actions/add-resources/index.tsx +27 -10
  104. package/src/components/order-view/order-actions/actions/cancel-order/ReturnAction.tsx +25 -4
  105. package/src/components/order-view/order-actions/actions/cancel-order/ReturnReason.tsx +24 -4
  106. package/src/components/order-view/order-actions/actions/clear-booking-status/ClearBookingStatus.tsx +9 -2
  107. package/src/components/order-view/order-actions/actions/confirm-order/index.tsx +12 -6
  108. package/src/components/order-view/order-actions/actions/confirm-order/tables/NotesTable.tsx +1 -0
  109. package/src/components/order-view/order-actions/actions/create-task-reminder/CreateReminderModal.tsx +88 -30
  110. package/src/components/order-view/order-actions/actions/create-task-reminder/CreateTaskModal.tsx +5 -3
  111. package/src/components/order-view/order-actions/actions/create-task-reminder/TaskModal.tsx +2 -2
  112. package/src/components/order-view/order-actions/actions/force-debrief/BaseChargeConfirmationModal.tsx +94 -0
  113. package/src/components/order-view/order-actions/actions/force-debrief/ForceDebriefModal.tsx +620 -0
  114. package/src/components/order-view/order-actions/actions/force-debrief/Selector.tsx +65 -0
  115. package/src/components/order-view/order-actions/actions/force-debrief/charges/adhoc/index.tsx +94 -0
  116. package/src/components/order-view/order-actions/actions/force-debrief/charges/base-charge/index.tsx +106 -0
  117. package/src/components/order-view/order-actions/actions/force-debrief/charges/collection-add-ons/index.tsx +77 -0
  118. package/src/components/order-view/order-actions/actions/force-debrief/charges/delivery-add-ons/index.tsx +78 -0
  119. package/src/components/order-view/order-actions/actions/force-debrief/charges/disposal-charges/index.tsx +77 -0
  120. package/src/components/order-view/order-actions/actions/force-debrief/charges/order-charges/index.tsx +124 -0
  121. package/src/components/order-view/order-actions/actions/force-debrief/escalation/EscalationCategory.tsx +92 -0
  122. package/src/components/order-view/order-actions/actions/force-debrief/escalation/EscalationLevel.tsx +90 -0
  123. package/src/components/order-view/order-actions/actions/force-debrief/escalation/EscalationReason.tsx +122 -0
  124. package/src/components/order-view/order-actions/actions/force-debrief/escalation/index.tsx +16 -0
  125. package/src/components/order-view/order-actions/actions/force-debrief/notifications/FlagsTemplate.tsx +46 -0
  126. package/src/components/order-view/order-actions/actions/force-debrief/notifications/OrderTemplate.tsx +117 -0
  127. package/src/components/order-view/order-actions/actions/force-debrief/notifications/Tabs.tsx +32 -0
  128. package/src/components/order-view/order-actions/actions/force-debrief/notifications/index.tsx +180 -0
  129. package/src/components/order-view/order-actions/actions/force-debrief/order-info/RadioButtons.tsx +201 -0
  130. package/src/components/order-view/order-actions/actions/force-debrief/order-info/dropdowns/CancellationReasonDropdown.tsx +40 -0
  131. package/src/components/order-view/order-actions/actions/force-debrief/order-info/dropdowns/FailureReasonDropdown.tsx +108 -0
  132. package/src/components/order-view/order-actions/actions/force-debrief/order-info/dropdowns/OrderHoldReasonDropdown.tsx +37 -0
  133. package/src/components/order-view/order-actions/actions/force-debrief/order-info/dropdowns/StatusDropdown.tsx +48 -0
  134. package/src/components/order-view/order-actions/actions/force-debrief/order-info/dropdowns/ZoneDropdown.tsx +27 -0
  135. package/src/components/order-view/order-actions/actions/force-debrief/order-info/failure-content/index.tsx +187 -0
  136. package/src/components/order-view/order-actions/actions/force-debrief/order-info/index.tsx +55 -0
  137. package/src/components/order-view/order-actions/actions/force-debrief/order-info/success-content/index.tsx +221 -0
  138. package/src/components/order-view/order-actions/actions/force-debrief/styles.tsx +51 -0
  139. package/src/components/order-view/order-actions/actions/hold-order/HoldOrderModal.tsx +2 -0
  140. package/src/components/order-view/order-actions/actions/remove-from-route/RemoveFromRoute.tsx +7 -2
  141. package/src/components/order-view/order-actions/actions/unhold-order/UnholdOrder.tsx +2 -0
  142. package/src/components/order-view/order-actions/index.tsx +18 -5
  143. package/src/components/order-view/order-actions/store.ts +1 -1
  144. package/src/components/order-view/order-actions/types.ts +3 -3
  145. package/src/components/order-view/order-details/expanded-content/footer/index.tsx +7 -1
  146. package/src/components/order-view/order-details/expanded-content/index.tsx +37 -16
  147. package/src/components/order-view/order-details/expanded-content/instruction-section/index.tsx +1 -1
  148. package/src/components/order-view/order-details/expanded-content/services-section/ServiceLevel.tsx +3 -4
  149. package/src/components/order-view/order-details/index.tsx +5 -2
  150. package/src/components/order-view/order-resources/expanded-content/index.tsx +2 -2
  151. package/src/components/order-view/products-info/expanded-content/index.tsx +33 -11
  152. package/src/components/order-view/products-info/index.tsx +10 -6
  153. package/src/components/order-view/return-client-products/ProductTable.tsx +12 -2
  154. package/src/components/order-view/return-client-products/product-table/ReturnProductTable.tsx +73 -23
  155. package/src/components/order-view/store.ts +107 -1
  156. package/src/components/order-view/system-event-logs/expanded-content/index.tsx +6 -2
  157. package/src/components/order-view/types.ts +54 -1
  158. package/src/components/order-view/utils.ts +37 -0
  159. package/src/components/order-view/view-reminder/AssigneeDropdown.tsx +85 -26
  160. package/src/components/order-view/view-reminder/ViewReminder.tsx +33 -14
  161. package/src/components/store.ts +24 -1
  162. package/src/index.tsx +6 -3
@@ -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,19 +10,17 @@ import {
10
10
  UsePaginationReturnData,
11
11
  } from '../store/store';
12
12
  import { ApiResponse } from '../common/interface';
13
- import { useAxios } 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';
17
- import {
18
- useCallApiAgain,
19
- useClientPortal,
20
- useSearchAfterText,
21
- } from '../../store';
22
- import { useParams } from 'react-router-dom';
20
+ import { useCallApiAgain } from '../../store';
23
21
 
24
22
  const ReturnAfterTable = () => {
25
- const [, setReturnOrderData] = useReturnAfterOrderData();
23
+ const [returnAfterOrder, setReturnOrderData] = useReturnAfterOrderData();
26
24
  const [, setLoading] = useLoading();
27
25
  const [state] = useAtom(filtersReducerReturnAtom);
28
26
  const [callApi] = useCallApiAgain();
@@ -33,78 +31,65 @@ const ReturnAfterTable = () => {
33
31
  const [itemsPerPage, setItemsPerPage] = useItemsPerReturnPage();
34
32
  const [, setPaginationObject] = UsePaginationData();
35
33
  const { page, total } = paginationObj;
36
- const [clientPortal] = useClientPortal();
37
- const [debouncedSearchText] = useSearchAfterText();
34
+
38
35
  const handlePageChange = (page: number) => {
39
36
  setCurrentPage(page);
40
37
  };
41
38
  const handleItemsPerPageChange = (itemsPerPage: number) => {
42
39
  setItemsPerPage(itemsPerPage);
43
40
  };
44
- const { status } = useParams();
45
41
 
46
42
  const {
47
43
  data: fetchedReturnOrderData,
48
44
  loading,
45
+ setShouldPerformAction,
49
46
  paginationData,
50
- fetchData,
51
- } = useAxios<ApiResponse>({
47
+ } = useApiHook<ApiResponse>({
52
48
  endpoint: '/v1/return/orders/',
53
49
  method: 'GET',
54
50
  filters: filters && filters?.length > 0 ? filters : undefined,
55
51
  pagination: pagination,
52
+ performAction: false,
53
+ showLoader: false,
56
54
  });
57
55
 
58
56
  useEffect(() => {
59
- if (callApi) {
60
- fetchData();
61
- }
57
+ callApi ? setShouldPerformAction(true) : setShouldPerformAction(false);
62
58
  }, [callApi]);
63
59
 
64
- useEffect(() => {
65
- if (!clientPortal) {
66
- fetchData();
67
- }
68
- }, []);
69
-
70
- //CP
71
- useEffect(() => {
72
- if (clientPortal && debouncedSearchText.trim().length === 0) {
73
- fetchData();
74
- }
75
- }, [debouncedSearchText, clientPortal, status]);
76
-
77
60
  useEffect(() => {
78
61
  setLoading(loading);
79
-
80
- if (
81
- fetchedReturnOrderData?.data &&
82
- (!clientPortal || debouncedSearchText.trim().length === 0)
83
- ) {
84
- setReturnOrderData(fetchedReturnOrderData.data);
85
-
62
+ if (fetchedReturnOrderData && fetchedReturnOrderData?.data) {
63
+ setReturnOrderData(fetchedReturnOrderData?.data);
86
64
  if (paginationData) {
87
65
  try {
88
66
  const { count, ...rest } = JSON.parse(paginationData);
89
67
  setPaginationObject(rest);
90
68
  } catch (error) {
69
+ console.error('Error parsing paginationData:', error);
91
70
  notification.error({
92
71
  message: 'Error',
93
72
  description: 'Failed to parse pagination data',
94
73
  });
95
74
  }
75
+ } else {
76
+ notification.error({
77
+ message: 'Error',
78
+ description: 'Pagination data is null or undefined',
79
+ });
96
80
  }
97
81
  }
98
- }, [fetchedReturnOrderData, loading]);
82
+ }, [fetchedReturnOrderData, loading, returnAfterOrder]);
99
83
 
100
84
  return (
101
85
  <div>
86
+ <DocumentTitle title="Return Order List" />
102
87
  <DashBoardWrapper>
103
88
  {/* <RouterHeader /> */}
104
89
  <div className="Tableconatiner">
105
90
  {/* <HeaderFilter /> */}
106
91
  <Container>
107
- {!clientPortal && <ReturnOrderFilter />}
92
+ <ReturnOrderFilter />
108
93
  <OrderTable />
109
94
  {total > 0 && (
110
95
  <ReturnPagination
@@ -19,7 +19,6 @@ import {
19
19
  useAssignData,
20
20
  useAssignPayload,
21
21
  useCallApiAgain,
22
- useClientPortal,
23
22
  } from '../../../store';
24
23
  import styled from 'styled-components';
25
24
  import { useApiHook } from '@bjsdistribution/dms-component-library';
@@ -40,7 +39,6 @@ const OrderTable = () => {
40
39
  const [, setAssign] = useState<boolean>(false);
41
40
  const [, setCallAPi] = useCallApiAgain();
42
41
  const [loading] = useLoading();
43
- const [clientPortal] = useClientPortal();
44
42
 
45
43
  //sorting
46
44
  const [sortConfig, setSortConfig] = useState<{
@@ -231,7 +229,7 @@ const OrderTable = () => {
231
229
  Return Location {renderSortIcon('return_location_name')}
232
230
  </div>
233
231
  </th>
234
- {!clientPortal && <th>Pick Up Location</th>}
232
+ <th>Pick Up Location</th>
235
233
  <th onClick={() => handleSort('recipient_name')}>
236
234
  <div className="sortIconClass">
237
235
  Recipient {renderSortIcon('recipient_name')}
@@ -241,6 +239,7 @@ const OrderTable = () => {
241
239
  <th>Consignment</th>
242
240
  <th>Return Order No</th>
243
241
  <th> Total Parts</th>
242
+ <th> Total Orders</th>
244
243
  <th onClick={() => handleSort('weight')}>
245
244
  <div className="sortIconClass">
246
245
  Total Weight {renderSortIcon('weight')}
@@ -251,7 +250,7 @@ const OrderTable = () => {
251
250
  Total CBM {renderSortIcon('cube')}
252
251
  </div>
253
252
  </th>
254
- {!clientPortal && <th>Assign</th>}
253
+ <th>Assign</th>
255
254
  <th>Status</th>
256
255
  <th className="emailInvoiceShare">Labels</th>
257
256
  </tr>
@@ -299,13 +298,11 @@ const OrderTable = () => {
299
298
  <td>{formatDate(new Date(item?.created_at))}</td>
300
299
  <td>{displayValueOrNA(item?.return_location_name)}</td>
301
300
 
302
- {!clientPortal && (
303
- <td>
304
- {item?.locations?.length
305
- ? item?.locations.join(', ')
306
- : 'N/A'}
307
- </td>
308
- )}
301
+ <td>
302
+ {item?.locations?.length
303
+ ? item?.locations.join(', ')
304
+ : 'N/A'}
305
+ </td>
309
306
 
310
307
  <td onClick={() => setOrderId(item.id)}>
311
308
  <ul style={{ listStyleType: 'none', padding: 0 }}>
@@ -332,6 +329,8 @@ const OrderTable = () => {
332
329
  <td>{displayValueOrNA(item?.order_number)}</td>
333
330
 
334
331
  <td>{displayValueOrNA(item?.total_products)}</td>
332
+ <td>{displayValueOrNA(item?.total_orders)}</td>
333
+
335
334
  <td>
336
335
  {displayValueOrNA(item?.weight)}{' '}
337
336
  {item?.weight && item?.weight > 0 ? 'KG' : ''}
@@ -339,19 +338,17 @@ const OrderTable = () => {
339
338
 
340
339
  <td>{displayValueOrNA(item?.cube)}</td>
341
340
 
342
- {!clientPortal && (
343
- <td key={item.id}>
344
- <StyledAntSelect
345
- options={assignOptions}
346
- placeholder="Select"
347
- onChange={(value: any) =>
348
- handleAssignPayload(item?.id, value)
349
- }
350
- style={{ width: '150px' }}
351
- value={item?.bjs_delivery}
352
- />
353
- </td>
354
- )}
341
+ <td key={item.id}>
342
+ <StyledAntSelect
343
+ options={assignOptions}
344
+ placeholder="Select"
345
+ onChange={(value: any) =>
346
+ handleAssignPayload(item?.id, value)
347
+ }
348
+ style={{ width: '150px' }}
349
+ value={item?.bjs_delivery}
350
+ />
351
+ </td>
355
352
 
356
353
  <td>
357
354
  <ul
@@ -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>