@bjsdistribution/dms-client-return 0.1.18-dev → 0.1.18-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 (179) 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/OutstandingTable.d.ts +3 -0
  4. package/dist/components/client-portal/ReturnRTFilters.d.ts +3 -0
  5. package/dist/components/client-portal/ReturnStatus.d.ts +5 -0
  6. package/dist/components/client-portal/return-confirm/ConfirmedMain.d.ts +3 -0
  7. package/dist/components/client-portal/return-confirm/ReturnConfirmedTable.d.ts +3 -0
  8. package/dist/components/order-daily-overview/header/route-header/ClientRouterHeader.d.ts +11 -0
  9. package/dist/components/order-daily-overview/table-view/TableStyle.d.ts +4 -4
  10. package/dist/components/order-view/DynamicTable.d.ts +2 -1
  11. package/dist/components/order-view/general-information/Status.d.ts +1 -1
  12. package/dist/components/order-view/general-information/index.d.ts +1 -1
  13. package/dist/components/order-view/index.d.ts +1 -1
  14. package/dist/components/order-view/notes/AddNote.d.ts +1 -0
  15. package/dist/components/order-view/notes/order-dropdown/NewReturnDropdown.d.ts +3 -0
  16. package/dist/components/order-view/order-actions/actions/clear-booking-status/ClearBookingStatus.d.ts +4 -1
  17. package/dist/components/order-view/order-actions/actions/confirm-order/index.d.ts +4 -1
  18. package/dist/components/order-view/order-actions/actions/force-debrief/BaseChargeConfirmationModal.d.ts +7 -0
  19. package/dist/components/order-view/order-actions/actions/force-debrief/ForceDebriefModal.d.ts +11 -0
  20. package/dist/components/order-view/order-actions/actions/force-debrief/Selector.d.ts +11 -0
  21. package/dist/components/order-view/order-actions/actions/force-debrief/charges/adhoc/index.d.ts +3 -0
  22. package/dist/components/order-view/order-actions/actions/force-debrief/charges/base-charge/index.d.ts +8 -0
  23. package/dist/components/order-view/order-actions/actions/force-debrief/charges/collection-add-ons/index.d.ts +7 -0
  24. package/dist/components/order-view/order-actions/actions/force-debrief/charges/delivery-add-ons/index.d.ts +7 -0
  25. package/dist/components/order-view/order-actions/actions/force-debrief/charges/disposal-charges/index.d.ts +7 -0
  26. package/dist/components/order-view/order-actions/actions/force-debrief/charges/order-charges/index.d.ts +7 -0
  27. package/dist/components/order-view/order-actions/actions/force-debrief/escalation/EscalationCategory.d.ts +3 -0
  28. package/dist/components/order-view/order-actions/actions/force-debrief/escalation/EscalationLevel.d.ts +3 -0
  29. package/dist/components/order-view/order-actions/actions/force-debrief/escalation/EscalationReason.d.ts +3 -0
  30. package/dist/components/order-view/order-actions/actions/force-debrief/escalation/index.d.ts +3 -0
  31. package/dist/components/order-view/order-actions/actions/force-debrief/notifications/FlagsTemplate.d.ts +3 -0
  32. package/dist/components/order-view/order-actions/actions/force-debrief/notifications/OrderTemplate.d.ts +3 -0
  33. package/dist/components/order-view/order-actions/actions/force-debrief/notifications/Tabs.d.ts +3 -0
  34. package/dist/components/order-view/order-actions/actions/force-debrief/notifications/index.d.ts +3 -0
  35. package/dist/components/order-view/order-actions/actions/force-debrief/order-info/RadioButtons.d.ts +7 -0
  36. package/dist/components/order-view/order-actions/actions/force-debrief/order-info/dropdowns/CancellationReasonDropdown.d.ts +3 -0
  37. package/dist/components/order-view/order-actions/actions/force-debrief/order-info/dropdowns/FailureReasonDropdown.d.ts +3 -0
  38. package/dist/components/order-view/order-actions/actions/force-debrief/order-info/dropdowns/OrderHoldReasonDropdown.d.ts +3 -0
  39. package/dist/components/order-view/order-actions/actions/force-debrief/order-info/dropdowns/StatusDropdown.d.ts +3 -0
  40. package/dist/components/order-view/order-actions/actions/force-debrief/order-info/dropdowns/ZoneDropdown.d.ts +3 -0
  41. package/dist/components/order-view/order-actions/actions/force-debrief/order-info/failure-content/index.d.ts +3 -0
  42. package/dist/components/order-view/order-actions/actions/force-debrief/order-info/index.d.ts +4 -0
  43. package/dist/components/order-view/order-actions/actions/force-debrief/order-info/success-content/index.d.ts +3 -0
  44. package/dist/components/order-view/order-actions/actions/force-debrief/styles.d.ts +8 -0
  45. package/dist/components/order-view/order-actions/actions/hold-order/HoldOrderModal.d.ts +1 -0
  46. package/dist/components/order-view/order-actions/actions/remove-from-route/RemoveFromRoute.d.ts +1 -1
  47. package/dist/components/order-view/order-actions/actions/unhold-order/UnholdOrder.d.ts +1 -0
  48. package/dist/components/order-view/order-actions/types.d.ts +3 -3
  49. package/dist/components/order-view/order-details/expanded-content/index.d.ts +1 -1
  50. package/dist/components/order-view/order-details/index.d.ts +1 -1
  51. package/dist/components/order-view/order-resources/expanded-content/index.d.ts +1 -1
  52. package/dist/components/order-view/products-info/expanded-content/index.d.ts +6 -1
  53. package/dist/components/order-view/products-info/index.d.ts +1 -1
  54. package/dist/components/order-view/return-client-products/ProductTable.d.ts +6 -1
  55. package/dist/components/order-view/return-client-products/product-table/ReturnProductTable.d.ts +6 -1
  56. package/dist/components/order-view/store.d.ts +15 -3
  57. package/dist/components/order-view/system-event-logs/expanded-content/index.d.ts +1 -1
  58. package/dist/components/order-view/types.d.ts +55 -1
  59. package/dist/components/order-view/utils.d.ts +11 -2
  60. package/dist/components/order-view/view-reminder/ViewReminder.d.ts +2 -0
  61. package/dist/components/store.d.ts +5 -1
  62. package/dist/dms-client-return.cjs.development.js +8897 -5744
  63. package/dist/dms-client-return.cjs.development.js.map +1 -1
  64. package/dist/dms-client-return.cjs.production.min.js +1 -1
  65. package/dist/dms-client-return.cjs.production.min.js.map +1 -1
  66. package/dist/dms-client-return.esm.js +8917 -5764
  67. package/dist/dms-client-return.esm.js.map +1 -1
  68. package/package.json +6 -4
  69. package/src/assets/icons/ActionIcon.tsx +1 -1
  70. package/src/assets/icons/ArrowDownIcon.tsx +2 -2
  71. package/src/components/client-portal/DateFilterStore.ts +139 -0
  72. package/src/components/client-portal/OutstandingTable.tsx +356 -0
  73. package/src/components/client-portal/ReturnAfterSearchBar.tsx +77 -17
  74. package/src/components/client-portal/ReturnOverview.tsx +15 -6
  75. package/src/components/client-portal/ReturnRTFilters.tsx +196 -80
  76. package/src/components/client-portal/ReturnSearchBar.tsx +64 -94
  77. package/src/components/client-portal/ReturnStatus.tsx +50 -66
  78. package/src/components/client-portal/return-confirm/ConfirmedMain.tsx +224 -0
  79. package/src/components/client-portal/return-confirm/ReturnConfirmedTable.tsx +327 -0
  80. package/src/components/order-daily-overview/header/route-header/ClientRouterHeader.tsx +166 -0
  81. package/src/components/order-daily-overview/header/route-header/RouterHeader.tsx +2 -86
  82. package/src/components/order-daily-overview/header-filters/SelectionFilter.tsx +46 -15
  83. package/src/components/order-daily-overview/index.tsx +22 -4
  84. package/src/components/order-daily-overview/return-after-table/ReturnAfterTable.tsx +23 -38
  85. package/src/components/order-daily-overview/return-after-table/table/OrderTable.tsx +21 -24
  86. package/src/components/order-daily-overview/return-after-table/table-filters/ReturnFilterStore.ts +36 -36
  87. package/src/components/order-daily-overview/return-after-table/table-filters/ReturnOrderFilter.tsx +12 -2
  88. package/src/components/order-daily-overview/return-order-table/ReturnTable.tsx +16 -0
  89. package/src/components/order-daily-overview/return-order-table/return-orders-filters/ReturnOrderTable.tsx +58 -155
  90. package/src/components/order-daily-overview/table/ReturnTable.tsx +8 -4
  91. package/src/components/order-view/DynamicTable.tsx +21 -8
  92. package/src/components/order-view/details-filters/left-side-filters/dropdowns/DropDowns.tsx +1 -1
  93. package/src/components/order-view/details-filters/left-side-filters/dropdowns/OptionsDropDown.tsx +9 -0
  94. package/src/components/order-view/details-filters/right-side-filters/Details.tsx +28 -3
  95. package/src/components/order-view/flags-action-modal/Dropdowns.tsx +2 -0
  96. package/src/components/order-view/general-information/Status.tsx +92 -18
  97. package/src/components/order-view/general-information/index.tsx +2 -2
  98. package/src/components/order-view/generic-table/AuditLogs.tsx +39 -12
  99. package/src/components/order-view/index.tsx +50 -8
  100. package/src/components/order-view/modalsPopup/ModalManager.tsx +1 -1
  101. package/src/components/order-view/notes/AddNote.tsx +95 -65
  102. package/src/components/order-view/notes/order-dropdown/NewReturnDropdown.tsx +8 -10
  103. package/src/components/order-view/notification/FlagTemplate.tsx +21 -10
  104. package/src/components/order-view/notification/OrderTemplate.tsx +192 -41
  105. package/src/components/order-view/notification/ReminderTemplate.tsx +28 -13
  106. package/src/components/order-view/notification/index.tsx +100 -55
  107. package/src/components/order-view/order-actions/actions/add-resources/DocFileUpload.tsx +92 -72
  108. package/src/components/order-view/order-actions/actions/add-resources/index.tsx +27 -10
  109. package/src/components/order-view/order-actions/actions/cancel-order/ReturnAction.tsx +25 -4
  110. package/src/components/order-view/order-actions/actions/cancel-order/ReturnReason.tsx +24 -4
  111. package/src/components/order-view/order-actions/actions/clear-booking-status/ClearBookingStatus.tsx +9 -2
  112. package/src/components/order-view/order-actions/actions/confirm-order/index.tsx +12 -35
  113. package/src/components/order-view/order-actions/actions/confirm-order/tables/NotesTable.tsx +1 -0
  114. package/src/components/order-view/order-actions/actions/create-task-reminder/CreateReminderModal.tsx +88 -30
  115. package/src/components/order-view/order-actions/actions/create-task-reminder/CreateTaskModal.tsx +5 -3
  116. package/src/components/order-view/order-actions/actions/create-task-reminder/TaskModal.tsx +2 -2
  117. package/src/components/order-view/order-actions/actions/force-debrief/BaseChargeConfirmationModal.tsx +94 -0
  118. package/src/components/order-view/order-actions/actions/force-debrief/ForceDebriefModal.tsx +635 -0
  119. package/src/components/order-view/order-actions/actions/force-debrief/Selector.tsx +65 -0
  120. package/src/components/order-view/order-actions/actions/force-debrief/charges/adhoc/index.tsx +94 -0
  121. package/src/components/order-view/order-actions/actions/force-debrief/charges/base-charge/index.tsx +106 -0
  122. package/src/components/order-view/order-actions/actions/force-debrief/charges/collection-add-ons/index.tsx +77 -0
  123. package/src/components/order-view/order-actions/actions/force-debrief/charges/delivery-add-ons/index.tsx +78 -0
  124. package/src/components/order-view/order-actions/actions/force-debrief/charges/disposal-charges/index.tsx +77 -0
  125. package/src/components/order-view/order-actions/actions/force-debrief/charges/order-charges/index.tsx +124 -0
  126. package/src/components/order-view/order-actions/actions/force-debrief/escalation/EscalationCategory.tsx +92 -0
  127. package/src/components/order-view/order-actions/actions/force-debrief/escalation/EscalationLevel.tsx +90 -0
  128. package/src/components/order-view/order-actions/actions/force-debrief/escalation/EscalationReason.tsx +122 -0
  129. package/src/components/order-view/order-actions/actions/force-debrief/escalation/index.tsx +16 -0
  130. package/src/components/order-view/order-actions/actions/force-debrief/notifications/FlagsTemplate.tsx +46 -0
  131. package/src/components/order-view/order-actions/actions/force-debrief/notifications/OrderTemplate.tsx +117 -0
  132. package/src/components/order-view/order-actions/actions/force-debrief/notifications/Tabs.tsx +32 -0
  133. package/src/components/order-view/order-actions/actions/force-debrief/notifications/index.tsx +180 -0
  134. package/src/components/order-view/order-actions/actions/force-debrief/order-info/RadioButtons.tsx +150 -0
  135. package/src/components/order-view/order-actions/actions/force-debrief/order-info/dropdowns/CancellationReasonDropdown.tsx +40 -0
  136. package/src/components/order-view/order-actions/actions/force-debrief/order-info/dropdowns/FailureReasonDropdown.tsx +108 -0
  137. package/src/components/order-view/order-actions/actions/force-debrief/order-info/dropdowns/OrderHoldReasonDropdown.tsx +37 -0
  138. package/src/components/order-view/order-actions/actions/force-debrief/order-info/dropdowns/StatusDropdown.tsx +48 -0
  139. package/src/components/order-view/order-actions/actions/force-debrief/order-info/dropdowns/ZoneDropdown.tsx +27 -0
  140. package/src/components/order-view/order-actions/actions/force-debrief/order-info/failure-content/index.tsx +187 -0
  141. package/src/components/order-view/order-actions/actions/force-debrief/order-info/index.tsx +55 -0
  142. package/src/components/order-view/order-actions/actions/force-debrief/order-info/success-content/index.tsx +221 -0
  143. package/src/components/order-view/order-actions/actions/force-debrief/styles.tsx +51 -0
  144. package/src/components/order-view/order-actions/actions/hold-order/HoldOrderModal.tsx +2 -0
  145. package/src/components/order-view/order-actions/actions/remove-from-route/RemoveFromRoute.tsx +7 -2
  146. package/src/components/order-view/order-actions/actions/unhold-order/UnholdOrder.tsx +2 -0
  147. package/src/components/order-view/order-actions/index.tsx +19 -10
  148. package/src/components/order-view/order-actions/store.ts +1 -1
  149. package/src/components/order-view/order-actions/types.ts +3 -3
  150. package/src/components/order-view/order-details/expanded-content/footer/index.tsx +55 -80
  151. package/src/components/order-view/order-details/expanded-content/index.tsx +37 -16
  152. package/src/components/order-view/order-details/expanded-content/instruction-section/index.tsx +1 -1
  153. package/src/components/order-view/order-details/expanded-content/services-section/AssemblyType.tsx +9 -91
  154. package/src/components/order-view/order-details/expanded-content/services-section/OrderServices.tsx +10 -182
  155. package/src/components/order-view/order-details/expanded-content/services-section/ServiceLevel.tsx +3 -4
  156. package/src/components/order-view/order-details/index.tsx +5 -2
  157. package/src/components/order-view/order-resources/expanded-content/index.tsx +2 -2
  158. package/src/components/order-view/products-info/expanded-content/index.tsx +33 -11
  159. package/src/components/order-view/products-info/index.tsx +10 -6
  160. package/src/components/order-view/return-client-products/ProductTable.tsx +12 -2
  161. package/src/components/order-view/return-client-products/product-table/ReturnProductTable.tsx +73 -23
  162. package/src/components/order-view/store.ts +113 -1
  163. package/src/components/order-view/system-event-logs/expanded-content/index.tsx +6 -2
  164. package/src/components/order-view/types.ts +60 -1
  165. package/src/components/order-view/utils.ts +37 -33
  166. package/src/components/order-view/view-reminder/AssigneeDropdown.tsx +85 -26
  167. package/src/components/order-view/view-reminder/ViewReminder.tsx +33 -14
  168. package/src/components/store.ts +24 -1
  169. package/src/index.tsx +23 -5
  170. package/dist/components/order-view/order-actions/actions/log-service-refusal/DeliveryPoint.d.ts +0 -7
  171. package/dist/components/order-view/order-actions/actions/log-service-refusal/Notes.d.ts +0 -7
  172. package/dist/components/order-view/order-actions/actions/log-service-refusal/OrderServices.d.ts +0 -7
  173. package/dist/components/order-view/order-actions/actions/log-service-refusal/helper.d.ts +0 -3
  174. package/dist/components/order-view/order-actions/actions/log-service-refusal/index.d.ts +0 -3
  175. package/src/components/order-view/order-actions/actions/log-service-refusal/DeliveryPoint.tsx +0 -50
  176. package/src/components/order-view/order-actions/actions/log-service-refusal/Notes.tsx +0 -50
  177. package/src/components/order-view/order-actions/actions/log-service-refusal/OrderServices.tsx +0 -57
  178. package/src/components/order-view/order-actions/actions/log-service-refusal/helper.ts +0 -26
  179. package/src/components/order-view/order-actions/actions/log-service-refusal/index.tsx +0 -130
@@ -0,0 +1,327 @@
1
+ import { Empty } from 'antd';
2
+ import React, { useEffect, useMemo, useRef, useState } from 'react';
3
+ import { Skeleton } from 'antd';
4
+ import { NavLink } from 'react-router-dom';
5
+ import {
6
+ Checkbox,
7
+ displayValueOrNA,
8
+ } from '@bjsdistribution/dms-component-library';
9
+ import {
10
+ useLoading,
11
+ usePrintOptionTOggle,
12
+ } from '../../order-daily-overview/store/store';
13
+ import {
14
+ useReturnConfirmedOrderData,
15
+ useSelectedClientAfterOrders,
16
+ } from '../../store';
17
+ import { useOrderId } from '../../order-view/store';
18
+ import SortIcon from '../../../common/SortIcon';
19
+ import CaretDownFilledIcon from '../../../common/CaretDownFilledIcon';
20
+ import {
21
+ CustomDrop,
22
+ EmptyDataContainer,
23
+ StyledTable,
24
+ StyledTableWrapper,
25
+ } from '../../order-daily-overview/return-order-table/return-orders-filters/returnstyles';
26
+ import PrinterIcon from '../../../assets/icons/PrinterIcon';
27
+ import DownIcon from '../../../assets/icons/DownIcon';
28
+ import PrintDropDown from '../../order-daily-overview/shared/elements/PrintDropDown';
29
+ import { formatDate } from '../../order-daily-overview/shared/utlis';
30
+
31
+ const ReturnConfirmedTable = () => {
32
+ const dropdownRefParent = useRef<HTMLDivElement>(null);
33
+ const dropdownRef = useRef<HTMLDivElement>(null);
34
+ const [printToogle, setPrintToggle] = usePrintOptionTOggle();
35
+ const [, setOrderId] = useOrderId();
36
+ const [returnConfirmedTable] = useReturnConfirmedOrderData();
37
+ const [loading] = useLoading();
38
+ const [selectClientAll, setSelectClientAll] = useState(false);
39
+ const [
40
+ selectedOrderIds,
41
+ setSelectedOrderIds,
42
+ ] = useSelectedClientAfterOrders();
43
+ //sorting
44
+ const [sortConfig, setSortConfig] = useState<{
45
+ key: string;
46
+ direction: 'asc' | 'desc';
47
+ } | null>(null);
48
+
49
+ const handleSort = (key: string) => {
50
+ setSortConfig((prev: any) => {
51
+ if (prev?.key === key && prev.direction === 'asc') {
52
+ return { key, direction: 'desc' };
53
+ }
54
+ return { key, direction: 'asc' };
55
+ });
56
+ };
57
+
58
+ const sortedData = useMemo(() => {
59
+ if (!returnConfirmedTable || !sortConfig) return returnConfirmedTable;
60
+
61
+ const { key, direction } = sortConfig;
62
+ return [...returnConfirmedTable].sort((a, b) => {
63
+ const valueA = a[key];
64
+ const valueB = b[key];
65
+
66
+ if (typeof valueA === 'number' && typeof valueB === 'number') {
67
+ return direction === 'asc' ? valueA - valueB : valueB - valueA;
68
+ }
69
+ if (typeof valueA === 'string' && typeof valueB === 'string') {
70
+ return direction === 'asc'
71
+ ? valueA.localeCompare(valueB)
72
+ : valueB.localeCompare(valueA);
73
+ }
74
+ return 0;
75
+ });
76
+ }, [returnConfirmedTable, sortConfig]);
77
+
78
+ const renderSortIcon = (columnKey: string) => {
79
+ if (!sortConfig || sortConfig.key !== columnKey) {
80
+ return <SortIcon />;
81
+ }
82
+ return sortConfig.direction === 'asc' ? (
83
+ <CaretDownFilledIcon />
84
+ ) : (
85
+ <CaretDownFilledIcon />
86
+ );
87
+ };
88
+
89
+ const OpenDropDown = (index: number) => {
90
+ setPrintToggle((prevIndex: any) => (prevIndex === index ? null : index));
91
+ };
92
+
93
+ // Close dropdown outside click
94
+ useEffect(() => {
95
+ document.addEventListener('mousedown', handleClickOutside);
96
+ return () => {
97
+ document.removeEventListener('mousedown', handleClickOutside);
98
+ };
99
+ }, []);
100
+ const handleClickOutside = (event: MouseEvent) => {
101
+ if (
102
+ dropdownRef.current &&
103
+ !dropdownRef.current.contains(event.target as Node)
104
+ ) {
105
+ setPrintToggle(null);
106
+ }
107
+ };
108
+
109
+ const getStatusClass = (status: string) => {
110
+ switch (status) {
111
+ case 'Cancelled':
112
+ case 'Failed':
113
+ return { color: '#E95252', background: 'rgba(233, 82, 82, 0.15)' };
114
+ case 'On Hold':
115
+ return { color: '#F4A503', background: '#FFF1D6' };
116
+ case 'Sub-Contracted':
117
+ case 'SC':
118
+ return { color: '#F4A503', background: '#FFF1D6' };
119
+ case 'Awaiting route':
120
+ case 'Awaiting Confirmation':
121
+ return { color: '#845ADF', background: 'rgba(132, 90, 223, 0.15)' };
122
+ case 'Completed':
123
+ return {
124
+ color: '#1F9254',
125
+ background: 'rgba(41, 204, 106, 0.15)',
126
+ };
127
+ case 'Outstanding':
128
+ return { color: '#FF9900', background: 'rgba(255, 153, 0, 0.15)' };
129
+ case 'Routed':
130
+ return { color: '#6396E5', background: 'rgba(99, 150, 229, 0.15)' };
131
+ default:
132
+ return { color: '#000', background: '#fff' };
133
+ }
134
+ };
135
+
136
+ const handleSelectOrderId = (id: string | number) => {
137
+ setSelectedOrderIds(prev =>
138
+ prev.includes(id) ? prev.filter(orderId => orderId !== id) : [...prev, id]
139
+ );
140
+ };
141
+ const handleClientSelectAll = (e: React.ChangeEvent<HTMLInputElement>) => {
142
+ const isChecked = e.target.checked;
143
+ setSelectClientAll(isChecked);
144
+
145
+ if (isChecked) {
146
+ setSelectedOrderIds(
147
+ returnConfirmedTable?.map((item: any) => item?.id) || []
148
+ );
149
+ } else {
150
+ setSelectedOrderIds([]);
151
+ }
152
+ };
153
+
154
+ return (
155
+ <>
156
+ <StyledTableWrapper className="fortables">
157
+ <StyledTable>
158
+ <thead>
159
+ <tr>
160
+ {/* <th className="emailInvoiceCheckbox">
161
+ <Checkbox checked={false} />
162
+ </th> */}
163
+ <th className="emailInvoiceCheckbox">
164
+ <Checkbox
165
+ checked={selectClientAll}
166
+ onChange={handleClientSelectAll}
167
+ />
168
+ </th>
169
+ <th onClick={() => handleSort('created_at')}>
170
+ <div className="sortIconClass">
171
+ Created {renderSortIcon('created_at')}
172
+ </div>
173
+ </th>
174
+ <th onClick={() => handleSort('return_location_name')}>
175
+ <div className="sortIconClass">
176
+ Return Location {renderSortIcon('return_location_name')}
177
+ </div>
178
+ </th>
179
+ <th onClick={() => handleSort('recipient_name')}>
180
+ <div className="sortIconClass">
181
+ Recipient {renderSortIcon('recipient_name')}
182
+ </div>
183
+ </th>
184
+ <th> Client</th>
185
+ <th>Consignment</th>
186
+ <th>Return Order No</th>
187
+ <th> Total Parts</th>
188
+ <th onClick={() => handleSort('weight')}>
189
+ <div className="sortIconClass">
190
+ Total Weight {renderSortIcon('weight')}
191
+ </div>
192
+ </th>
193
+ <th onClick={() => handleSort('cube')}>
194
+ <div className="sortIconClass">
195
+ Total CBM {renderSortIcon('cube')}
196
+ </div>
197
+ </th>
198
+ <th>Status</th>
199
+ <th className="emailInvoiceShare">Labels</th>
200
+ </tr>
201
+ </thead>
202
+ <tbody>
203
+ {loading ? (
204
+ <tr>
205
+ <td colSpan={16}>
206
+ <Skeleton active />
207
+ </td>
208
+ <td colSpan={16}></td>
209
+ </tr>
210
+ ) : sortedData?.length === 0 ? (
211
+ <tr>
212
+ <td colSpan={16}>
213
+ <EmptyDataContainer>
214
+ <Empty />
215
+ </EmptyDataContainer>
216
+ </td>
217
+ </tr>
218
+ ) : (
219
+ sortedData?.map((item: any, index: any) => {
220
+ const statusMapping: any = {
221
+ cancelled: 'Cancelled',
222
+ 'on hold': 'On Hold',
223
+ subcontracted: 'Sub-Contracted',
224
+ SC: 'Sub-Contracted',
225
+ 'awaiting route': 'Awaiting route',
226
+ 'awaiting confirmation': 'Awaiting Confirmation',
227
+ complete: 'Completed',
228
+ outstanding: 'Outstanding',
229
+ routed: 'Routed',
230
+ failed: 'Failed',
231
+ confirmed: 'Confirmed',
232
+ };
233
+ const status = statusMapping[item?.status_value] || 'Unknown';
234
+ const statusClass = getStatusClass(status);
235
+
236
+ return (
237
+ <tr key={item.id}>
238
+ <td>
239
+ <Checkbox
240
+ checked={selectedOrderIds.includes(item?.id)}
241
+ onChange={() => handleSelectOrderId(item?.id)}
242
+ />
243
+ </td>
244
+ <td>{formatDate(new Date(item?.created_at))}</td>
245
+ <td>{displayValueOrNA(item?.return_location_name)}</td>
246
+ <td onClick={() => setOrderId(item.id)}>
247
+ <ul style={{ listStyleType: 'none', padding: 0 }}>
248
+ <li
249
+ style={{
250
+ color: '#0099ff',
251
+ fontWeight: 600,
252
+ paddingLeft: 0,
253
+ }}
254
+ >
255
+ <NavLink to={`/return/view/${item.id}`}>
256
+ {displayValueOrNA(item?.recipient_name)}
257
+ </NavLink>
258
+ </li>
259
+ <li style={{ color: '#888075' }}>
260
+ {displayValueOrNA(item?.postcode)}
261
+ </li>
262
+ </ul>
263
+ </td>
264
+
265
+ <td>{displayValueOrNA(item?.customer_name)}</td>
266
+
267
+ <td>{displayValueOrNA(item?.consignment)}</td>
268
+ <td>{displayValueOrNA(item?.order_number)}</td>
269
+
270
+ <td>{displayValueOrNA(item?.total_products)}</td>
271
+ <td>
272
+ {displayValueOrNA(item?.weight)}{' '}
273
+ {item?.weight && item?.weight > 0 ? 'KG' : ''}
274
+ </td>
275
+
276
+ <td>{displayValueOrNA(item?.cube)}</td>
277
+
278
+ <td>
279
+ <ul
280
+ className="statuscontainer"
281
+ style={{
282
+ listStyleType: 'none',
283
+ background: statusClass.background,
284
+ }}
285
+ >
286
+ <li
287
+ className="statustext"
288
+ style={{ color: statusClass.color }}
289
+ >
290
+ {status}
291
+ </li>
292
+ </ul>
293
+ </td>
294
+ <td>
295
+ <ul className="actionbox">
296
+ <CustomDrop
297
+ ref={dropdownRefParent}
298
+ className={printToogle === index ? 'active' : ''}
299
+ >
300
+ <li
301
+ className="shareIconContainer"
302
+ onClick={() => OpenDropDown(index)}
303
+ >
304
+ <PrinterIcon />
305
+ <DownIcon />
306
+
307
+ {printToogle === index && (
308
+ <div ref={dropdownRef}>
309
+ <PrintDropDown legacyProductId={item} />
310
+ </div>
311
+ )}
312
+ </li>
313
+ </CustomDrop>
314
+ </ul>
315
+ </td>
316
+ </tr>
317
+ );
318
+ })
319
+ )}
320
+ </tbody>
321
+ </StyledTable>
322
+ </StyledTableWrapper>
323
+ </>
324
+ );
325
+ };
326
+
327
+ export default ReturnConfirmedTable;
@@ -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;