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

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 (177) hide show
  1. package/dist/common/date-picker/header/ClearDate.d.ts +1 -1
  2. package/dist/components/client-portal/DateFilterStore.d.ts +15 -0
  3. package/dist/components/client-portal/ReturnRTFilters.d.ts +3 -0
  4. package/dist/components/order-daily-overview/header/route-header/ClientRouterHeader.d.ts +11 -0
  5. package/dist/components/order-daily-overview/table-view/TableStyle.d.ts +4 -4
  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 +55 -1
  55. package/dist/components/order-view/utils.d.ts +11 -2
  56. package/dist/components/store.d.ts +1 -1
  57. package/dist/dms-client-return.cjs.development.js +7157 -4661
  58. package/dist/dms-client-return.cjs.development.js.map +1 -1
  59. package/dist/dms-client-return.cjs.production.min.js +1 -1
  60. package/dist/dms-client-return.cjs.production.min.js.map +1 -1
  61. package/dist/dms-client-return.esm.js +7173 -4677
  62. package/dist/dms-client-return.esm.js.map +1 -1
  63. package/package.json +6 -4
  64. package/src/assets/icons/ActionIcon.tsx +1 -1
  65. package/src/assets/icons/ArrowDownIcon.tsx +2 -2
  66. package/src/components/client-portal/DateFilterStore.ts +139 -0
  67. package/src/components/client-portal/OutstandingTable.tsx +16 -72
  68. package/src/components/client-portal/ReturnAfterSearchBar.tsx +42 -87
  69. package/src/components/client-portal/ReturnOverview.tsx +11 -2
  70. package/src/components/client-portal/ReturnRTFilters.tsx +140 -43
  71. package/src/components/client-portal/ReturnSearchBar.tsx +42 -153
  72. package/src/components/client-portal/ReturnStatus.tsx +33 -82
  73. package/src/components/client-portal/return-confirm/ConfirmedMain.tsx +12 -23
  74. package/src/components/client-portal/return-confirm/ReturnConfirmedTable.tsx +9 -86
  75. package/src/components/order-daily-overview/header/route-header/ClientRouterHeader.tsx +166 -0
  76. package/src/components/order-daily-overview/header/route-header/RouterHeader.tsx +2 -86
  77. package/src/components/order-daily-overview/header-filters/SelectionFilter.tsx +46 -15
  78. package/src/components/order-daily-overview/index.tsx +23 -4
  79. package/src/components/order-daily-overview/return-after-table/ReturnAfterTable.tsx +6 -1
  80. package/src/components/order-daily-overview/return-after-table/table/OrderTable.tsx +3 -0
  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 +25 -11
  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 -35
  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 +635 -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 +150 -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 +19 -10
  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/customer-section/contact-info/ContactHome.tsx +102 -45
  146. package/src/components/order-view/order-details/expanded-content/customer-section/contact-info/ContactMobile.tsx +93 -34
  147. package/src/components/order-view/order-details/expanded-content/customer-section/contact-info/ContactWork.tsx +88 -31
  148. package/src/components/order-view/order-details/expanded-content/footer/index.tsx +55 -80
  149. package/src/components/order-view/order-details/expanded-content/index.tsx +37 -16
  150. package/src/components/order-view/order-details/expanded-content/instruction-section/index.tsx +1 -1
  151. package/src/components/order-view/order-details/expanded-content/services-section/AssemblyType.tsx +9 -91
  152. package/src/components/order-view/order-details/expanded-content/services-section/OrderServices.tsx +10 -182
  153. package/src/components/order-view/order-details/expanded-content/services-section/ServiceLevel.tsx +3 -4
  154. package/src/components/order-view/order-details/index.tsx +5 -2
  155. package/src/components/order-view/order-resources/expanded-content/index.tsx +2 -2
  156. package/src/components/order-view/products-info/expanded-content/index.tsx +33 -11
  157. package/src/components/order-view/products-info/index.tsx +10 -6
  158. package/src/components/order-view/return-client-products/ProductTable.tsx +12 -2
  159. package/src/components/order-view/return-client-products/product-table/ReturnProductTable.tsx +73 -23
  160. package/src/components/order-view/store.ts +113 -1
  161. package/src/components/order-view/system-event-logs/expanded-content/index.tsx +6 -2
  162. package/src/components/order-view/types.ts +60 -1
  163. package/src/components/order-view/utils.ts +49 -33
  164. package/src/components/order-view/view-reminder/AssigneeDropdown.tsx +85 -26
  165. package/src/components/order-view/view-reminder/ViewReminder.tsx +31 -14
  166. package/src/components/store.ts +2 -2
  167. package/src/index.tsx +23 -5
  168. package/dist/components/order-view/order-actions/actions/log-service-refusal/DeliveryPoint.d.ts +0 -7
  169. package/dist/components/order-view/order-actions/actions/log-service-refusal/Notes.d.ts +0 -7
  170. package/dist/components/order-view/order-actions/actions/log-service-refusal/OrderServices.d.ts +0 -7
  171. package/dist/components/order-view/order-actions/actions/log-service-refusal/helper.d.ts +0 -3
  172. package/dist/components/order-view/order-actions/actions/log-service-refusal/index.d.ts +0 -3
  173. package/src/components/order-view/order-actions/actions/log-service-refusal/DeliveryPoint.tsx +0 -50
  174. package/src/components/order-view/order-actions/actions/log-service-refusal/Notes.tsx +0 -50
  175. package/src/components/order-view/order-actions/actions/log-service-refusal/OrderServices.tsx +0 -57
  176. package/src/components/order-view/order-actions/actions/log-service-refusal/helper.ts +0 -26
  177. package/src/components/order-view/order-actions/actions/log-service-refusal/index.tsx +0 -130
@@ -1,21 +1,8 @@
1
1
  import React, { useEffect, useState } from 'react';
2
2
  import styled from 'styled-components';
3
- // import OrderTable from './table/OrderTable';
4
- // import ReturnOrderFilter from './table-filters/ReturnOrderFilter';
5
- // import { useAtom, useReturnAfterOrderData } from '../../order-view/store';
6
- // import {
7
- // useItemsPerReturnPage,
8
- // useLoading,
9
- // UsePaginationData,
10
- // UsePaginationReturnData,
11
- // } from '../store/store';
12
- // import { ApiResponse } from '../common/interface';
13
- // import { useAxios } from '@bjsdistribution/dms-component-library';
14
- // import { filtersReducerReturnAtom } from './table-filters/ReturnFilterStore';
15
- // import { notification } from 'antd';
16
- // import ReturnPagination from '../table-view/ReturnPagination';
17
3
  import {
18
4
  useAtom,
5
+ useClientPortal,
19
6
  // useCallApiAgain,
20
7
  useReturnConfirmedOrderData,
21
8
  useSearchAfterText,
@@ -32,14 +19,17 @@ import { useAxios } from '@bjsdistribution/dms-component-library';
32
19
  import { ApiResponse } from '../../types';
33
20
  import { notification } from 'antd';
34
21
  import ReturnPagination from '../../order-daily-overview/table-view/ReturnPagination';
35
- import { useParams } from 'react-router-dom';
22
+ // import { useParams } from 'react-router-dom';
23
+ import { dateFilterCPReducer } from '../DateFilterStore';
36
24
 
37
25
  const ConfirmedMain = () => {
38
26
  const [, setReturnConfirmedData] = useReturnConfirmedOrderData();
39
27
  const [, setLoading] = useLoading();
40
- const [state] = useAtom(filtersReducerReturnAtom);
28
+ const [statePagination] = useAtom(filtersReducerReturnAtom);
41
29
  // const [callApi] = useCallApiAgain();
42
- const { 'x-filters': filters, 'x-pagination': pagination } = state;
30
+ const { 'x-pagination': pagination } = statePagination;
31
+ const [state] = useAtom(dateFilterCPReducer);
32
+ const { 'x-filters': filters } = state;
43
33
  const [paginationObj] = UsePaginationReturnData();
44
34
  const [, setCurrentPage] = useState(1);
45
35
  const [itemsPerPage, setItemsPerPage] = useItemsPerReturnPage();
@@ -52,7 +42,8 @@ const ConfirmedMain = () => {
52
42
  const handleItemsPerPageChange = (itemsPerPage: number) => {
53
43
  setItemsPerPage(itemsPerPage);
54
44
  };
55
- const { status } = useParams();
45
+ // const { status } = useParams();
46
+ const [clientPortal] = useClientPortal();
56
47
 
57
48
  const {
58
49
  data: fetchedReturnOrderData,
@@ -62,17 +53,15 @@ const ConfirmedMain = () => {
62
53
  } = useAxios<ApiResponse>({
63
54
  endpoint: '/v1/return/orders/',
64
55
  method: 'GET',
65
- filters: filters && filters?.length > 0 ? filters : undefined,
56
+ filters: filters,
66
57
  pagination: pagination,
67
58
  });
68
59
 
69
60
  useEffect(() => {
70
- const shouldFetch = debouncedSearchText === '' && filters?.length > 0;
71
-
72
- if (shouldFetch) {
61
+ if (clientPortal && debouncedSearchText === '') {
73
62
  fetchData();
74
63
  }
75
- }, [debouncedSearchText, status, JSON.stringify(filters)]);
64
+ }, [JSON.stringify(filters), debouncedSearchText]);
76
65
 
77
66
  useEffect(() => {
78
67
  setLoading(loading);
@@ -5,7 +5,6 @@ import { NavLink } from 'react-router-dom';
5
5
  import {
6
6
  Checkbox,
7
7
  displayValueOrNA,
8
- // useApiHook,
9
8
  } from '@bjsdistribution/dms-component-library';
10
9
  import {
11
10
  useLoading,
@@ -107,45 +106,18 @@ const ReturnConfirmedTable = () => {
107
106
  }
108
107
  };
109
108
 
110
- // const handleSelectAll = (e: any) => {
111
- // setSelectAll(e.target.checked);
112
- // if (e.target.checked) {
113
- // setSelectedReturnOrder(
114
- // returnAfterOrder.map((e: any) => ({
115
- // id: e.id,
116
- // status_id: 3,
117
- // }))
118
- // );
119
- // } else {
120
- // setSelectedReturnOrder([]);
121
- // }
122
- // };
123
-
124
- // const handleSelectInvoice = (id: any) => {
125
- // setSelectedReturnOrder((prevSelectedInvoices: any) => {
126
- // const isSelected = prevSelectedInvoices?.some(
127
- // (item: any) => item.id === id
128
- // );
129
-
130
- // if (isSelected) {
131
- // return prevSelectedInvoices.filter((items: any) => items.id !== id);
132
- // } else {
133
- // return [...prevSelectedInvoices, { id, status_id: 3 }];
134
- // }
135
- // });
136
- // };
137
-
138
109
  const getStatusClass = (status: string) => {
139
110
  switch (status) {
140
111
  case 'Cancelled':
112
+ case 'Failed':
141
113
  return { color: '#E95252', background: 'rgba(233, 82, 82, 0.15)' };
142
114
  case 'On Hold':
143
115
  return { color: '#F4A503', background: '#FFF1D6' };
144
116
  case 'Sub-Contracted':
117
+ case 'SC':
145
118
  return { color: '#F4A503', background: '#FFF1D6' };
146
119
  case 'Awaiting route':
147
- return { color: '#845ADF', background: 'rgba(132, 90, 223, 0.15)' };
148
- case 'Awaiting':
120
+ case 'Awaiting Confirmation':
149
121
  return { color: '#845ADF', background: 'rgba(132, 90, 223, 0.15)' };
150
122
  case 'Completed':
151
123
  return {
@@ -161,56 +133,6 @@ const ReturnConfirmedTable = () => {
161
133
  }
162
134
  };
163
135
 
164
- // API for Assign
165
- // const {
166
- // data: actionResponse,
167
- // setShouldPerformAction: setAssignAction,
168
- // error: apiError,
169
- // } = useApiHook<{
170
- // data: ApiResponse[];
171
- // }>({
172
- // endpoint: `return_orders/update/assign/`,
173
- // method: 'PUT',
174
- // body: [assignPayload],
175
- // performAction: false,
176
- // });
177
-
178
- //client options
179
- // const assignOptions = assignData?.map((option: any) => ({
180
- // label: option?.type?.charAt(0)?.toUpperCase() + option?.type?.slice(1),
181
- // value: option?.bjs_delivery,
182
- // }));
183
-
184
- // const handleAssignPayload = (Id: number, value: boolean) => {
185
- // setCallAPi(false);
186
- // setAssign(value);
187
- // setAssignPayload({
188
- // ...assignPayload,
189
- // return_order_id: Id,
190
- // bjs_delivery: value,
191
- // });
192
- // setAssignAction(true);
193
- // };
194
-
195
- // useEffect(() => {
196
- // //@ts-ignore
197
- // if (actionResponse?.code === 200) {
198
- // setCallAPi(true);
199
- // notification.success({
200
- // message: 'Success',
201
- // // @ts-ignore
202
- // description: `${actionResponse?.message}`,
203
- // });
204
- // // @ts-ignore
205
- // } else if (apiError?.detail) {
206
- // notification.error({
207
- // message: 'Failure',
208
- // // @ts-ignore
209
- // description: `${apiError?.detail[0]?.msg}`,
210
- // });
211
- // }
212
- // }, [actionResponse, apiError]);
213
-
214
136
  const handleSelectOrderId = (id: string | number) => {
215
137
  setSelectedOrderIds(prev =>
216
138
  prev.includes(id) ? prev.filter(orderId => orderId !== id) : [...prev, id]
@@ -228,8 +150,7 @@ const ReturnConfirmedTable = () => {
228
150
  setSelectedOrderIds([]);
229
151
  }
230
152
  };
231
- console.log('selectedOrderIds===>', selectedOrderIds);
232
- console.log('returnConfirmedTable=====>', returnConfirmedTable);
153
+
233
154
  return (
234
155
  <>
235
156
  <StyledTableWrapper className="fortables">
@@ -299,13 +220,15 @@ const ReturnConfirmedTable = () => {
299
220
  const statusMapping: any = {
300
221
  cancelled: 'Cancelled',
301
222
  'on hold': 'On Hold',
223
+ subcontracted: 'Sub-Contracted',
302
224
  SC: 'Sub-Contracted',
303
- 'awaiting route': 'Awaiting',
304
- 'awaiting confirmation': 'Awaiting',
225
+ 'awaiting route': 'Awaiting route',
226
+ 'awaiting confirmation': 'Awaiting Confirmation',
305
227
  complete: 'Completed',
306
228
  outstanding: 'Outstanding',
307
229
  routed: 'Routed',
308
230
  failed: 'Failed',
231
+ confirmed: 'Confirmed',
309
232
  };
310
233
  const status = statusMapping[item?.status_value] || 'Unknown';
311
234
  const statusClass = getStatusClass(status);
@@ -329,7 +252,7 @@ const ReturnConfirmedTable = () => {
329
252
  paddingLeft: 0,
330
253
  }}
331
254
  >
332
- <NavLink to={`../${item.id}`}>
255
+ <NavLink to={`/return/view/${item.id}`}>
333
256
  {displayValueOrNA(item?.recipient_name)}
334
257
  </NavLink>
335
258
  </li>
@@ -0,0 +1,166 @@
1
+ import React, { useEffect } from 'react';
2
+ import 'react-datepicker/dist/react-datepicker.css';
3
+ import { HeaderWrapper, StyledFlex } from './RouterHeaderStyle';
4
+ import HeaderTitle from './title/HeaderTitle';
5
+ import Breadcrumb from './breadCrumb/BreadCrumb';
6
+ import styled from 'styled-components';
7
+ import dayjs from 'dayjs';
8
+ import { DatePicker, DatePickerProps } from 'antd';
9
+ import {
10
+ useAtom,
11
+ useClientPortal,
12
+ useEndDate,
13
+ useStartDate,
14
+ } from '../../../store';
15
+ import ReturnSearchBar from '../../../client-portal/ReturnSearchBar';
16
+ import { useParams } from 'react-router-dom';
17
+ import ReturnAfterSearchBar from '../../../client-portal/ReturnAfterSearchBar';
18
+ import { dateFilterCPReducer } from '../../../client-portal/DateFilterStore';
19
+
20
+ interface RouterHeaderProps {
21
+ breadcrumbTitle?: string;
22
+ breadcrumbSubtitle?: string;
23
+ breadcrumbSubPart?: string;
24
+ showDateFilter?: boolean;
25
+ }
26
+
27
+ const ClientRouterHeader: React.FC<RouterHeaderProps> = ({
28
+ breadcrumbTitle = 'Clients >', // Default value
29
+ breadcrumbSubtitle = ' Return', // Default value
30
+ breadcrumbSubPart, // Optional
31
+ }) => {
32
+ const [clientPortal] = useClientPortal();
33
+ const [, dispatch] = useAtom(dateFilterCPReducer);
34
+ //CP
35
+ const [startDate, setStartDate] = useStartDate();
36
+ const [endDate, setEndDate] = useEndDate();
37
+ const { status } = useParams();
38
+
39
+ useEffect(() => {
40
+ if (clientPortal) {
41
+ const formattedStart = startDate?.format('YYYY-MM-DD');
42
+ const formattedEnd = endDate ? endDate?.format('YYYY-MM-DD') : null;
43
+ // const payload = {
44
+ // startDate: formattedStart,
45
+ // endDate: formattedEnd,
46
+ // };
47
+
48
+ if (formattedStart || formattedEnd) {
49
+ dispatch({
50
+ type: 'SET_CP_DATE_FILTER',
51
+ payload: {
52
+ startDate: formattedStart,
53
+ endDate: formattedEnd,
54
+ },
55
+ });
56
+ }
57
+ }
58
+ }, [startDate, endDate]);
59
+
60
+ const handleStartDateChange: DatePickerProps['onChange'] = date => {
61
+ setStartDate(date ?? null);
62
+ };
63
+
64
+ const handleEndDateChange: DatePickerProps['onChange'] = date => {
65
+ setEndDate(date);
66
+ };
67
+
68
+ const validStatuses = [
69
+ 'outstanding_return',
70
+ 'scheduled_for_return',
71
+ 'return_completed',
72
+ ];
73
+
74
+ return (
75
+ <>
76
+ <HeaderWrapper className="headerWrap">
77
+ <StyledFlex>
78
+ <div>
79
+ <HeaderTitle title={'Return'} />
80
+ <Breadcrumb
81
+ title={breadcrumbTitle}
82
+ subtitle={breadcrumbSubtitle}
83
+ subPart={breadcrumbSubPart}
84
+ />
85
+ </div>
86
+ </StyledFlex>
87
+
88
+ {clientPortal && status === 'outstanding_return' && <ReturnSearchBar />}
89
+
90
+ {clientPortal &&
91
+ (status === 'scheduled_for_return' ||
92
+ status === 'return_completed') && <ReturnAfterSearchBar />}
93
+
94
+ {clientPortal &&
95
+ typeof status === 'string' &&
96
+ validStatuses.includes(status) && (
97
+ <DatePickerWrap>
98
+ <DatePicker
99
+ value={startDate ? dayjs(startDate) : null}
100
+ onChange={handleStartDateChange}
101
+ format={'MMMM D, YYYY'}
102
+ allowClear={false}
103
+ disabledDate={current =>
104
+ !!endDate && current.isAfter(dayjs(endDate), 'day')
105
+ }
106
+ />
107
+ <DatePicker
108
+ value={endDate ? dayjs(endDate) : null}
109
+ onChange={handleEndDateChange}
110
+ format={'MMMM D, YYYY'}
111
+ disabledDate={current =>
112
+ !!startDate && current.isBefore(dayjs(startDate), 'day')
113
+ }
114
+ />
115
+ </DatePickerWrap>
116
+ )}
117
+ </HeaderWrapper>
118
+ </>
119
+ );
120
+ };
121
+ export const DatePickerWrap = styled.div`
122
+ display: flex;
123
+ padding-right: 10px;
124
+ padding-left: 7px;
125
+ justify-content: space-between;
126
+ align-items: center;
127
+ align-self: stretch;
128
+ border-radius: 20px;
129
+ border: 1px solid #e0e2e7;
130
+ background: #fff;
131
+ box-shadow: 0px 1px 2px 0px rgba(16, 24, 40, 0.05);
132
+ min-width: 22vw;
133
+ height: 35px;
134
+ input[type='text'] {
135
+ border-radius: 20px;
136
+ background: var(--Flowkit-White, #fff);
137
+ border: none;
138
+ color: #6a7378;
139
+ font-size: 13px;
140
+ font-weight: 400;
141
+ line-height: 18px;
142
+ padding: 8px 0;
143
+ padding-left: 10px;
144
+ &:focus-visible {
145
+ outline: none;
146
+ }
147
+ }
148
+
149
+ .ant-picker-outlined {
150
+ border-style: none !important;
151
+ }
152
+
153
+ .ant-picker-focused {
154
+ box-shadow: none;
155
+ }
156
+
157
+ /* .ant-picker {
158
+ .ant-picker-input {
159
+ width: 150px;
160
+ }
161
+ } */
162
+ .ant-btn {
163
+ background-color: #3348ff !important;
164
+ }
165
+ `;
166
+ export default ClientRouterHeader;
@@ -1,21 +1,9 @@
1
- import React, { useEffect } from 'react';
1
+ import React from 'react';
2
2
  import 'react-datepicker/dist/react-datepicker.css';
3
3
  import { HeaderWrapper, StyledFlex } from './RouterHeaderStyle';
4
4
  import HeaderTitle from './title/HeaderTitle';
5
5
  import Breadcrumb from './breadCrumb/BreadCrumb';
6
6
  import styled from 'styled-components';
7
- import dayjs from 'dayjs';
8
- import { DatePicker, DatePickerProps } from 'antd';
9
- import {
10
- useAtom,
11
- useClientPortal,
12
- useEndDate,
13
- useStartDate,
14
- } from '../../../store';
15
- import { filtersReducerReturnAtom } from '../../return-after-table/table-filters/ReturnFilterStore';
16
- import ReturnSearchBar from '../../../client-portal/ReturnSearchBar';
17
- import { useParams } from 'react-router-dom';
18
- import ReturnAfterSearchBar from '../../../client-portal/ReturnAfterSearchBar';
19
7
 
20
8
  interface RouterHeaderProps {
21
9
  breadcrumbTitle?: string;
@@ -29,50 +17,6 @@ const RouterHeader: React.FC<RouterHeaderProps> = ({
29
17
  breadcrumbSubtitle = ' Return', // Default value
30
18
  breadcrumbSubPart, // Optional
31
19
  }) => {
32
- const [clientPortal] = useClientPortal();
33
- const [, dispatch] = useAtom(filtersReducerReturnAtom);
34
- //CP
35
- const [startDate, setStartDate] = useStartDate();
36
- const [endDate, setEndDate] = useEndDate();
37
- const { status } = useParams();
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
- useEffect(() => {
51
- if (clientPortal) {
52
- const formattedStart = startDate?.format('YYYY-MM-DD');
53
- const formattedEnd = endDate ? endDate?.format('YYYY-MM-DD') : null;
54
-
55
- const payload = {
56
- startDate: formattedStart,
57
- endDate: formattedEnd,
58
- };
59
- localStorage.setItem('returnDate', JSON.stringify(payload));
60
- if (formattedStart || formattedEnd) {
61
- dispatch({
62
- type: 'SET_CP_DATE_FILTER',
63
- payload,
64
- });
65
- }
66
- }
67
- }, [startDate, endDate]);
68
-
69
- const handleStartDateChange: DatePickerProps['onChange'] = date => {
70
- setStartDate(date ?? dayjs());
71
- };
72
-
73
- const handleEndDateChange: DatePickerProps['onChange'] = date => {
74
- setEndDate(date);
75
- };
76
20
  return (
77
21
  <>
78
22
  <HeaderWrapper className="headerWrap">
@@ -86,34 +30,6 @@ const RouterHeader: React.FC<RouterHeaderProps> = ({
86
30
  />
87
31
  </div>
88
32
  </StyledFlex>
89
-
90
- {clientPortal && status === 'outstanding_return' && <ReturnSearchBar />}
91
-
92
- {clientPortal &&
93
- (status === 'scheduled_for_return' ||
94
- status === 'return_completed') && <ReturnAfterSearchBar />}
95
-
96
- {clientPortal && (
97
- <DatePickerWrap>
98
- <DatePicker
99
- value={startDate ? dayjs(startDate) : null}
100
- onChange={handleStartDateChange}
101
- format={'MMMM D, YYYY'}
102
- allowClear={false}
103
- disabledDate={current =>
104
- !!endDate && current.isAfter(dayjs(endDate), 'day')
105
- }
106
- />
107
- <DatePicker
108
- value={endDate ? dayjs(endDate) : null}
109
- onChange={handleEndDateChange}
110
- format={'MMMM D, YYYY'}
111
- disabledDate={current =>
112
- !!startDate && current.isBefore(dayjs(startDate), 'day')
113
- }
114
- />
115
- </DatePickerWrap>
116
- )}
117
33
  </HeaderWrapper>
118
34
  </>
119
35
  );
@@ -127,7 +43,7 @@ export const DatePickerWrap = styled.div`
127
43
  align-self: stretch;
128
44
  border-radius: 20px;
129
45
  border: 1px solid #e0e2e7;
130
- background: var(--Neutral-White, #fff);
46
+ background: #fff;
131
47
  box-shadow: 0px 1px 2px 0px rgba(16, 24, 40, 0.05);
132
48
  min-width: 22vw;
133
49
  height: 35px;
@@ -12,6 +12,7 @@ import { atom, useAtom } from 'jotai';
12
12
  import {
13
13
  useActionTypeOptions,
14
14
  useClearState,
15
+ useClientPortal,
15
16
  useCustomerData,
16
17
  useReturnPayload,
17
18
  } from '../../store';
@@ -26,11 +27,13 @@ import styled from 'styled-components';
26
27
  import { Select } from 'antd';
27
28
  import { useLocationOptions } from '../../order-view/store';
28
29
  import { useNavigate, useSearchParams } from 'react-router-dom';
30
+ import { useAxios } from '@bjsdistribution/dms-component-library';
31
+ import { ApiResponse } from '../common/interface';
29
32
 
30
33
  export const clickedState = atom<boolean>(false);
31
34
 
32
35
  function SelectionFilter() {
33
- const [customers] = useCustomerData();
36
+ const [customers, setCustomers] = useCustomerData();
34
37
  const [selectedFilterValue, setSelectedFilterValue] = useSelectedAction();
35
38
  const [, dispatch] = useAtom(filtersReducerAtom);
36
39
  const [
@@ -45,8 +48,29 @@ function SelectionFilter() {
45
48
  const [actionTypeOptions, setActionTypeOptions] = useActionTypeOptions();
46
49
  const [locationOptions, setLocationOptions] = useLocationOptions();
47
50
  const [searchParams] = useSearchParams();
51
+ const [clientPortal] = useClientPortal();
48
52
  const navigate = useNavigate();
53
+ //API for client data
54
+ const { data: fetchedCustomerData, loading: loading, fetchData } = useAxios<
55
+ ApiResponse
56
+ >({
57
+ endpoint: `/v1/return/product/customers/`,
58
+ method: 'GET',
59
+ //@ts-ignore
60
+ pagination: { is_pagination: false },
61
+ });
49
62
 
63
+ useEffect(() => {
64
+ if (!clientPortal && clientPortal !== undefined) {
65
+ fetchData();
66
+ }
67
+ }, []);
68
+
69
+ useEffect(() => {
70
+ if (fetchedCustomerData && fetchedCustomerData?.data) {
71
+ setCustomers(fetchedCustomerData?.data);
72
+ }
73
+ }, [loading]);
50
74
  //new codee
51
75
  const urlCustomerId = searchParams.get('customerId');
52
76
  const urlActiontype = searchParams.get('type');
@@ -54,7 +78,6 @@ function SelectionFilter() {
54
78
  const selectedCustomer = customers?.find(
55
79
  (customer: any) => customer?.customer_id?.toString() === urlCustomerId
56
80
  );
57
-
58
81
  const accountNumber = selectedCustomer?.account_number;
59
82
 
60
83
  //customer name
@@ -91,10 +114,14 @@ function SelectionFilter() {
91
114
  setActionTypeOptions(mappedActions);
92
115
 
93
116
  const mappedLocations = Array.isArray(filteredClient?.return_locations)
94
- ? filteredClient?.return_locations?.map((location: any) => ({
95
- label: location?.location_name,
96
- value: location?.token,
97
- }))
117
+ ? filteredClient.return_locations
118
+ .filter(
119
+ (location: any) => location?.location_name && location?.token
120
+ )
121
+ .map((location: any) => ({
122
+ label: location.location_name,
123
+ value: location.token,
124
+ }))
98
125
  : [];
99
126
 
100
127
  setLocationOptions(mappedLocations);
@@ -135,10 +162,16 @@ function SelectionFilter() {
135
162
  setActionTypeOptions(mappedActions);
136
163
 
137
164
  const mappedLocations = Array.isArray(filteredClient?.return_locations)
138
- ? filteredClient?.return_locations?.map((location: any) => ({
139
- label: location?.location_name,
140
- value: location?.token,
141
- }))
165
+ ? filteredClient.return_locations
166
+ .filter((location: any) => {
167
+ const name = location?.location_name;
168
+ const token = location?.token;
169
+ return name && name !== 'null' && token && token !== 'null';
170
+ })
171
+ .map((location: any) => ({
172
+ label: location?.location_name,
173
+ value: location?.token,
174
+ }))
142
175
  : [];
143
176
 
144
177
  setLocationOptions(mappedLocations);
@@ -166,9 +199,7 @@ function SelectionFilter() {
166
199
  console.log(currentSearch, 'currentSearch');
167
200
 
168
201
  if (!currentSearch.includes('filter')) {
169
- console.log('inside include');
170
202
  // for dev
171
- //navigate(`filter?${queryParams.toString()}`);
172
203
  navigate(`/orders/view/return/filter?${queryParams.toString()}`);
173
204
 
174
205
  // for local
@@ -328,7 +359,7 @@ function SelectionFilter() {
328
359
  options={clientOptions}
329
360
  placeholder="Select Client Name"
330
361
  onChange={handleClientChange}
331
- style={{ minWidth: '150px' }}
362
+ style={{ minWidth: '250px' }}
332
363
  value={selectedClient}
333
364
  allowClear
334
365
  onClear={handleClear}
@@ -349,7 +380,7 @@ function SelectionFilter() {
349
380
  placeholder="Select Action Type"
350
381
  value={selectedFilterValue}
351
382
  onChange={handleActionClick}
352
- style={{ minWidth: '150px' }}
383
+ style={{ minWidth: '200px' }}
353
384
  allowClear
354
385
  onClear={handleClearAction}
355
386
  />
@@ -362,7 +393,7 @@ function SelectionFilter() {
362
393
  value={selectedLocationValue}
363
394
  placeholder="Select Location"
364
395
  onChange={handleLocationChange}
365
- style={{ minWidth: '150px' }}
396
+ style={{ minWidth: '200px' }}
366
397
  allowClear
367
398
  mode="multiple"
368
399
  />