@bjsdistribution/dms-client-return 0.1.9-prod → 0.1.10-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 (135) hide show
  1. package/dist/components/client-portal/OutstandingTable.d.ts +3 -0
  2. package/dist/components/client-portal/ReturnAfterSearchBar.d.ts +4 -0
  3. package/dist/components/client-portal/ReturnOverview.d.ts +3 -0
  4. package/dist/components/client-portal/ReturnRTFilters.d.ts +5 -0
  5. package/dist/components/client-portal/ReturnSearchBar.d.ts +4 -0
  6. package/dist/components/client-portal/ReturnStatus.d.ts +8 -0
  7. package/dist/components/client-portal/return-confirm/ConfirmedMain.d.ts +3 -0
  8. package/dist/components/client-portal/return-confirm/ReturnConfirmedTable.d.ts +3 -0
  9. package/dist/components/order-daily-overview/common/fakedata.d.ts +1 -0
  10. package/dist/components/order-daily-overview/header/route-header/RouterHeader.d.ts +1 -0
  11. package/dist/components/order-view/notes/AddNote.d.ts +1 -0
  12. package/dist/components/order-view/notes/order-dropdown/NewReturnDropdown.d.ts +3 -0
  13. package/dist/components/order-view/order-actions/actions/clear-booking-status/ClearBookingStatus.d.ts +4 -1
  14. package/dist/components/order-view/order-actions/actions/confirm-order/index.d.ts +4 -1
  15. package/dist/components/order-view/order-actions/actions/force-debrief/BaseChargeConfirmationModal.d.ts +7 -0
  16. package/dist/components/order-view/order-actions/actions/force-debrief/ForceDebriefModal.d.ts +11 -0
  17. package/dist/components/order-view/order-actions/actions/force-debrief/Selector.d.ts +11 -0
  18. package/dist/components/order-view/order-actions/actions/force-debrief/charges/adhoc/index.d.ts +3 -0
  19. package/dist/components/order-view/order-actions/actions/force-debrief/charges/base-charge/index.d.ts +8 -0
  20. package/dist/components/order-view/order-actions/actions/force-debrief/charges/collection-add-ons/index.d.ts +7 -0
  21. package/dist/components/order-view/order-actions/actions/force-debrief/charges/delivery-add-ons/index.d.ts +7 -0
  22. package/dist/components/order-view/order-actions/actions/force-debrief/charges/disposal-charges/index.d.ts +7 -0
  23. package/dist/components/order-view/order-actions/actions/force-debrief/charges/order-charges/index.d.ts +7 -0
  24. package/dist/components/order-view/order-actions/actions/force-debrief/escalation/EscalationCategory.d.ts +3 -0
  25. package/dist/components/order-view/order-actions/actions/force-debrief/escalation/EscalationLevel.d.ts +3 -0
  26. package/dist/components/order-view/order-actions/actions/force-debrief/escalation/EscalationReason.d.ts +3 -0
  27. package/dist/components/order-view/order-actions/actions/force-debrief/escalation/index.d.ts +3 -0
  28. package/dist/components/order-view/order-actions/actions/force-debrief/notifications/FlagsTemplate.d.ts +3 -0
  29. package/dist/components/order-view/order-actions/actions/force-debrief/notifications/OrderTemplate.d.ts +3 -0
  30. package/dist/components/order-view/order-actions/actions/force-debrief/notifications/Tabs.d.ts +3 -0
  31. package/dist/components/order-view/order-actions/actions/force-debrief/notifications/index.d.ts +3 -0
  32. package/dist/components/order-view/order-actions/actions/force-debrief/order-info/RadioButtons.d.ts +7 -0
  33. package/dist/components/order-view/order-actions/actions/force-debrief/order-info/dropdowns/CancellationReasonDropdown.d.ts +3 -0
  34. package/dist/components/order-view/order-actions/actions/force-debrief/order-info/dropdowns/FailureReasonDropdown.d.ts +3 -0
  35. package/dist/components/order-view/order-actions/actions/force-debrief/order-info/dropdowns/OrderHoldReasonDropdown.d.ts +3 -0
  36. package/dist/components/order-view/order-actions/actions/force-debrief/order-info/dropdowns/StatusDropdown.d.ts +3 -0
  37. package/dist/components/order-view/order-actions/actions/force-debrief/order-info/dropdowns/ZoneDropdown.d.ts +3 -0
  38. package/dist/components/order-view/order-actions/actions/force-debrief/order-info/failure-content/index.d.ts +3 -0
  39. package/dist/components/order-view/order-actions/actions/force-debrief/order-info/index.d.ts +4 -0
  40. package/dist/components/order-view/order-actions/actions/force-debrief/order-info/success-content/index.d.ts +3 -0
  41. package/dist/components/order-view/order-actions/actions/force-debrief/styles.d.ts +8 -0
  42. package/dist/components/order-view/order-actions/actions/hold-order/HoldOrderModal.d.ts +1 -0
  43. package/dist/components/order-view/order-actions/actions/remove-from-route/RemoveFromRoute.d.ts +1 -1
  44. package/dist/components/order-view/order-actions/actions/unhold-order/UnholdOrder.d.ts +1 -0
  45. package/dist/components/order-view/products-info/expanded-content/index.d.ts +4 -1
  46. package/dist/components/order-view/return-client-products/ProductTable.d.ts +4 -1
  47. package/dist/components/order-view/return-client-products/product-table/ReturnProductTable.d.ts +4 -1
  48. package/dist/components/order-view/store.d.ts +14 -2
  49. package/dist/components/order-view/types.d.ts +49 -1
  50. package/dist/components/order-view/utils.d.ts +3 -0
  51. package/dist/components/store.d.ts +12 -1
  52. package/dist/components/utils.d.ts +1 -0
  53. package/dist/dms-client-return.cjs.development.js +7053 -2711
  54. package/dist/dms-client-return.cjs.development.js.map +1 -1
  55. package/dist/dms-client-return.cjs.production.min.js +1 -1
  56. package/dist/dms-client-return.cjs.production.min.js.map +1 -1
  57. package/dist/dms-client-return.esm.js +7111 -2769
  58. package/dist/dms-client-return.esm.js.map +1 -1
  59. package/package.json +6 -4
  60. package/src/assets/icons/ActionIcon.tsx +1 -1
  61. package/src/assets/icons/ArrowDownIcon.tsx +2 -2
  62. package/src/components/client-portal/OutstandingTable.tsx +412 -0
  63. package/src/components/client-portal/ReturnAfterSearchBar.tsx +242 -0
  64. package/src/components/client-portal/ReturnOverview.tsx +185 -0
  65. package/src/components/client-portal/ReturnRTFilters.tsx +228 -0
  66. package/src/components/client-portal/ReturnSearchBar.tsx +294 -0
  67. package/src/components/client-portal/ReturnStatus.tsx +252 -0
  68. package/src/components/client-portal/return-confirm/ConfirmedMain.tsx +235 -0
  69. package/src/components/client-portal/return-confirm/ReturnConfirmedTable.tsx +404 -0
  70. package/src/components/order-daily-overview/common/fakedata.tsx +18 -0
  71. package/src/components/order-daily-overview/header/route-header/RouterHeader.tsx +130 -1
  72. package/src/components/order-daily-overview/header-filters/HeaderFilter.tsx +15 -3
  73. package/src/components/order-daily-overview/header-filters/SelectionFilter.tsx +100 -70
  74. package/src/components/order-daily-overview/return-after-table/table/OrderTable.tsx +4 -0
  75. package/src/components/order-daily-overview/return-after-table/table-filters/ReturnFilterStore.ts +86 -0
  76. package/src/components/order-daily-overview/return-after-table/table-filters/ReturnOrderFilter.tsx +12 -2
  77. package/src/components/order-daily-overview/return-after-table/table-filters/TableFilters.tsx +22 -1
  78. package/src/components/order-daily-overview/return-order-table/return-orders-filters/ReturnFilter.tsx +34 -6
  79. package/src/components/order-daily-overview/return-order-table/return-orders-filters/ReturnOrderTable.tsx +24 -11
  80. package/src/components/order-daily-overview/return-order-table/return-orders-filters/RightFilters.tsx +26 -6
  81. package/src/components/order-daily-overview/shared/elements/PrintDropDown.tsx +5 -3
  82. package/src/components/order-view/details-filters/left-side-filters/dropdowns/OptionsDropDown.tsx +5 -0
  83. package/src/components/order-view/details-filters/right-side-filters/Details.tsx +28 -3
  84. package/src/components/order-view/generic-table/AuditLogs.tsx +39 -12
  85. package/src/components/order-view/index.tsx +45 -0
  86. package/src/components/order-view/notes/AddNote.tsx +94 -65
  87. package/src/components/order-view/notes/order-dropdown/NewReturnDropdown.tsx +8 -10
  88. package/src/components/order-view/notification/OrderTemplate.tsx +192 -41
  89. package/src/components/order-view/order-actions/actions/cancel-order/ReturnAction.tsx +25 -4
  90. package/src/components/order-view/order-actions/actions/cancel-order/ReturnReason.tsx +24 -4
  91. package/src/components/order-view/order-actions/actions/clear-booking-status/ClearBookingStatus.tsx +9 -2
  92. package/src/components/order-view/order-actions/actions/confirm-order/index.tsx +12 -6
  93. package/src/components/order-view/order-actions/actions/create-task-reminder/CreateReminderModal.tsx +2 -2
  94. package/src/components/order-view/order-actions/actions/force-debrief/BaseChargeConfirmationModal.tsx +94 -0
  95. package/src/components/order-view/order-actions/actions/force-debrief/ForceDebriefModal.tsx +620 -0
  96. package/src/components/order-view/order-actions/actions/force-debrief/Selector.tsx +65 -0
  97. package/src/components/order-view/order-actions/actions/force-debrief/charges/adhoc/index.tsx +94 -0
  98. package/src/components/order-view/order-actions/actions/force-debrief/charges/base-charge/index.tsx +106 -0
  99. package/src/components/order-view/order-actions/actions/force-debrief/charges/collection-add-ons/index.tsx +77 -0
  100. package/src/components/order-view/order-actions/actions/force-debrief/charges/delivery-add-ons/index.tsx +78 -0
  101. package/src/components/order-view/order-actions/actions/force-debrief/charges/disposal-charges/index.tsx +77 -0
  102. package/src/components/order-view/order-actions/actions/force-debrief/charges/order-charges/index.tsx +124 -0
  103. package/src/components/order-view/order-actions/actions/force-debrief/escalation/EscalationCategory.tsx +92 -0
  104. package/src/components/order-view/order-actions/actions/force-debrief/escalation/EscalationLevel.tsx +90 -0
  105. package/src/components/order-view/order-actions/actions/force-debrief/escalation/EscalationReason.tsx +122 -0
  106. package/src/components/order-view/order-actions/actions/force-debrief/escalation/index.tsx +16 -0
  107. package/src/components/order-view/order-actions/actions/force-debrief/notifications/FlagsTemplate.tsx +46 -0
  108. package/src/components/order-view/order-actions/actions/force-debrief/notifications/OrderTemplate.tsx +117 -0
  109. package/src/components/order-view/order-actions/actions/force-debrief/notifications/Tabs.tsx +32 -0
  110. package/src/components/order-view/order-actions/actions/force-debrief/notifications/index.tsx +180 -0
  111. package/src/components/order-view/order-actions/actions/force-debrief/order-info/RadioButtons.tsx +201 -0
  112. package/src/components/order-view/order-actions/actions/force-debrief/order-info/dropdowns/CancellationReasonDropdown.tsx +40 -0
  113. package/src/components/order-view/order-actions/actions/force-debrief/order-info/dropdowns/FailureReasonDropdown.tsx +108 -0
  114. package/src/components/order-view/order-actions/actions/force-debrief/order-info/dropdowns/OrderHoldReasonDropdown.tsx +37 -0
  115. package/src/components/order-view/order-actions/actions/force-debrief/order-info/dropdowns/StatusDropdown.tsx +48 -0
  116. package/src/components/order-view/order-actions/actions/force-debrief/order-info/dropdowns/ZoneDropdown.tsx +27 -0
  117. package/src/components/order-view/order-actions/actions/force-debrief/order-info/failure-content/index.tsx +187 -0
  118. package/src/components/order-view/order-actions/actions/force-debrief/order-info/index.tsx +55 -0
  119. package/src/components/order-view/order-actions/actions/force-debrief/order-info/success-content/index.tsx +221 -0
  120. package/src/components/order-view/order-actions/actions/force-debrief/styles.tsx +51 -0
  121. package/src/components/order-view/order-actions/actions/hold-order/HoldOrderModal.tsx +2 -0
  122. package/src/components/order-view/order-actions/actions/remove-from-route/RemoveFromRoute.tsx +7 -2
  123. package/src/components/order-view/order-actions/actions/unhold-order/UnholdOrder.tsx +2 -0
  124. package/src/components/order-view/order-actions/index.tsx +15 -3
  125. package/src/components/order-view/order-details/expanded-content/instruction-section/index.tsx +1 -1
  126. package/src/components/order-view/products-info/expanded-content/index.tsx +27 -11
  127. package/src/components/order-view/products-info/index.tsx +4 -4
  128. package/src/components/order-view/return-client-products/ProductTable.tsx +6 -2
  129. package/src/components/order-view/return-client-products/product-table/ReturnProductTable.tsx +54 -15
  130. package/src/components/order-view/store.ts +106 -0
  131. package/src/components/order-view/types.ts +54 -1
  132. package/src/components/order-view/utils.ts +37 -0
  133. package/src/components/store.ts +62 -1
  134. package/src/components/utils.ts +13 -3
  135. package/src/index.tsx +26 -16
@@ -1,8 +1,21 @@
1
- import React from 'react';
1
+ import React, { useEffect } 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
+ 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';
6
19
 
7
20
  interface RouterHeaderProps {
8
21
  breadcrumbTitle?: string;
@@ -16,6 +29,50 @@ const RouterHeader: React.FC<RouterHeaderProps> = ({
16
29
  breadcrumbSubtitle = ' Return', // Default value
17
30
  breadcrumbSubPart, // Optional
18
31
  }) => {
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
+ };
19
76
  return (
20
77
  <>
21
78
  <HeaderWrapper className="headerWrap">
@@ -29,9 +86,81 @@ const RouterHeader: React.FC<RouterHeaderProps> = ({
29
86
  />
30
87
  </div>
31
88
  </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
+ )}
32
117
  </HeaderWrapper>
33
118
  </>
34
119
  );
35
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: var(--Neutral-White, #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
+ }
36
156
 
157
+ /* .ant-picker {
158
+ .ant-picker-input {
159
+ width: 150px;
160
+ }
161
+ } */
162
+ .ant-btn {
163
+ background-color: #3348ff !important;
164
+ }
165
+ `;
37
166
  export default RouterHeader;
@@ -1,12 +1,24 @@
1
1
  import React from 'react';
2
2
  import { CoverPage } from './Styledfilters';
3
3
  import SelectionFilter from './SelectionFilter';
4
+ import { useClientPortal } from '../../store';
5
+ import ReturnStatus from '../../client-portal/ReturnStatus';
4
6
 
5
7
  function HeaderFilter() {
8
+ const [clientPortal] = useClientPortal();
9
+
6
10
  return (
7
- <CoverPage>
8
- <SelectionFilter />
9
- </CoverPage>
11
+ <>
12
+ {clientPortal ? (
13
+ <ReturnStatus />
14
+ ) : (
15
+ <>
16
+ <CoverPage>
17
+ <SelectionFilter />
18
+ </CoverPage>
19
+ </>
20
+ )}
21
+ </>
10
22
  );
11
23
  }
12
24
  export default HeaderFilter;
@@ -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
@@ -318,64 +346,66 @@ function SelectionFilter() {
318
346
  };
319
347
 
320
348
  return (
321
- <Wrapper>
322
- <FilterRow>
323
- <LeftColumn>
324
- <FilterColumn>
325
- <Label>Clients</Label>
326
- <StyledAntSelect
327
- options={clientOptions}
328
- placeholder="Select Client Name"
329
- onChange={handleClientChange}
330
- style={{ minWidth: '150px' }}
331
- value={selectedClient}
332
- allowClear
333
- onClear={handleClear}
334
- filterOption={(input: any, option: any) =>
335
- (option?.label ?? '')
336
- .toLowerCase()
337
- .includes(input.toLowerCase())
338
- }
339
- showSearch
340
- />
341
- </FilterColumn>
342
- {selectedClient && (
343
- <>
344
- <FilterColumn>
345
- <Label>Action Type</Label>
346
- <StyledAntSelect
347
- options={actionTypeOptions}
348
- placeholder="Select Action Type"
349
- value={selectedFilterValue}
350
- onChange={handleActionClick}
351
- style={{ minWidth: '150px' }}
352
- allowClear
353
- onClear={handleClearAction}
354
- />
355
- </FilterColumn>
356
-
357
- <FilterColumn>
358
- <Label>Location </Label>
359
- <StyledAntSelect
360
- options={locationOptions}
361
- value={selectedLocationValue}
362
- placeholder="Select Location"
363
- onChange={handleLocationChange}
364
- style={{ minWidth: '150px' }}
365
- allowClear
366
- mode="multiple"
367
- />
368
- </FilterColumn>
369
- </>
370
- )}
371
- </LeftColumn>
372
- <RightColumn>
373
- <ApplyButton onClick={applyFilters} disabled={!isButtonEnabled}>
374
- Apply
375
- </ApplyButton>
376
- </RightColumn>
377
- </FilterRow>
378
- </Wrapper>
349
+ <>
350
+ <Wrapper>
351
+ <FilterRow>
352
+ <LeftColumn>
353
+ <FilterColumn>
354
+ <Label>Clients</Label>
355
+ <StyledAntSelect
356
+ options={clientOptions}
357
+ placeholder="Select Client Name"
358
+ onChange={handleClientChange}
359
+ style={{ minWidth: '250px' }}
360
+ value={selectedClient}
361
+ allowClear
362
+ onClear={handleClear}
363
+ filterOption={(input: any, option: any) =>
364
+ (option?.label ?? '')
365
+ .toLowerCase()
366
+ .includes(input.toLowerCase())
367
+ }
368
+ showSearch
369
+ />
370
+ </FilterColumn>
371
+ {selectedClient && (
372
+ <>
373
+ <FilterColumn>
374
+ <Label>Action Type</Label>
375
+ <StyledAntSelect
376
+ options={actionTypeOptions}
377
+ placeholder="Select Action Type"
378
+ value={selectedFilterValue}
379
+ onChange={handleActionClick}
380
+ style={{ minWidth: '200px' }}
381
+ allowClear
382
+ onClear={handleClearAction}
383
+ />
384
+ </FilterColumn>
385
+
386
+ <FilterColumn>
387
+ <Label>Location </Label>
388
+ <StyledAntSelect
389
+ options={locationOptions}
390
+ value={selectedLocationValue}
391
+ placeholder="Select Location"
392
+ onChange={handleLocationChange}
393
+ style={{ minWidth: '200px' }}
394
+ allowClear
395
+ mode="multiple"
396
+ />
397
+ </FilterColumn>
398
+ </>
399
+ )}
400
+ </LeftColumn>
401
+ <RightColumn>
402
+ <ApplyButton onClick={applyFilters} disabled={!isButtonEnabled}>
403
+ Apply
404
+ </ApplyButton>
405
+ </RightColumn>
406
+ </FilterRow>
407
+ </Wrapper>
408
+ </>
379
409
  );
380
410
  }
381
411
 
@@ -285,6 +285,7 @@ const OrderTable = () => {
285
285
  };
286
286
  const status = statusMapping[item?.status_value] || 'Unknown';
287
287
  const statusClass = getStatusClass(status);
288
+
288
289
  return (
289
290
  <tr key={item.id}>
290
291
  {/* <td>
@@ -295,6 +296,7 @@ const OrderTable = () => {
295
296
  </td> */}
296
297
  <td>{formatDate(new Date(item?.created_at))}</td>
297
298
  <td>{displayValueOrNA(item?.return_location_name)}</td>
299
+
298
300
  <td>
299
301
  {item?.locations?.length
300
302
  ? item?.locations.join(', ')
@@ -332,6 +334,7 @@ const OrderTable = () => {
332
334
  </td>
333
335
 
334
336
  <td>{displayValueOrNA(item?.cube)}</td>
337
+
335
338
  <td key={item.id}>
336
339
  <StyledAntSelect
337
340
  options={assignOptions}
@@ -343,6 +346,7 @@ const OrderTable = () => {
343
346
  value={item?.bjs_delivery}
344
347
  />
345
348
  </td>
349
+
346
350
  <td>
347
351
  <ul
348
352
  className="statuscontainer"
@@ -125,6 +125,92 @@ const filterReducer = (state: FilterState, action: any): FilterState => {
125
125
  'x-filters': state['x-filters'].filter(f => f.field !== 'status_id'),
126
126
  };
127
127
 
128
+ //client portal
129
+ case 'SET_SCHEDULED_RETURN_FILTER':
130
+ if (action.payload) {
131
+ return {
132
+ ...state,
133
+ 'x-filters': [
134
+ ...state['x-filters'].filter(f => f.field !== 'order_status'),
135
+ {
136
+ field: 'order_status',
137
+ op: '=',
138
+ value: action.payload,
139
+ },
140
+ ],
141
+ };
142
+ } else {
143
+ return {
144
+ ...state,
145
+ 'x-filters': state['x-filters'].filter(
146
+ f => f.field !== 'order_status'
147
+ ),
148
+ };
149
+ }
150
+
151
+ case 'SET_RETURN_COMPLETED_FILTER':
152
+ if (action.payload) {
153
+ return {
154
+ ...state,
155
+ 'x-filters': [
156
+ ...state['x-filters'].filter(f => f.field !== 'order_status'),
157
+ {
158
+ field: 'order_status',
159
+ op: '=',
160
+ value: action.payload,
161
+ },
162
+ ],
163
+ };
164
+ } else {
165
+ return {
166
+ ...state,
167
+ 'x-filters': state['x-filters'].filter(
168
+ f => f.field !== 'order_status'
169
+ ),
170
+ };
171
+ }
172
+
173
+ //client portal
174
+ case 'SET_CP_DATE_FILTER': {
175
+ let { startDate, endDate } = action.payload;
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
+ }
184
+
185
+ const filters = state['x-filters'].filter(f => f.field !== 'created_at');
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
+ }
207
+
208
+ return {
209
+ ...state,
210
+ 'x-filters': filters,
211
+ 'x-pagination': { ...state['x-pagination'], page: 1 },
212
+ };
213
+ }
128
214
  // case 'CLEAR_CLIENT':
129
215
  // return {
130
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>
@@ -1,8 +1,29 @@
1
+ import { ExportButton } from '@bjsdistribution/dms-component-library';
1
2
  import React from 'react';
2
3
  import styled from 'styled-components';
4
+ import { useAtom, useReturnAfterOrderData } from '../../../order-view/store';
5
+ import { filtersReducerReturnAtom } from './ReturnFilterStore';
3
6
 
4
7
  const TableFilters = () => {
5
- return <Container></Container>;
8
+ const [state] = useAtom(filtersReducerReturnAtom);
9
+ const [returnAfterOrder] = useReturnAfterOrderData();
10
+
11
+ const { 'x-filters': filters } = state;
12
+ const moduleInfo = {
13
+ isExportedData: returnAfterOrder?.length <= 0 ? false : true,
14
+ moduleName: 'return',
15
+ filter: filters,
16
+ file_type: 'csv',
17
+ apiUrlEndPoint: `v1/return/orders/`,
18
+ reference: 'return_overview_export',
19
+ feature_name: 'return',
20
+ };
21
+ return (
22
+ <Container>
23
+ {' '}
24
+ <ExportButton moduleInfoModule={moduleInfo} />
25
+ </Container>
26
+ );
6
27
  };
7
28
  const Container = styled.div`
8
29
  display: flex;
@@ -6,10 +6,14 @@ import {
6
6
  Text,
7
7
  } from '../../filters/FilterStyle';
8
8
  import RightFilters from './RightFilters';
9
- import { useCustomerData } from '../../../store';
9
+ import { useClientPortal, useCustomerData } from '../../../store';
10
+ import { useParams } from 'react-router-dom';
11
+ import ReturnRTFilters from '../../../client-portal/ReturnRTFilters';
10
12
 
11
13
  const ReturnFilter = () => {
12
14
  const [customers] = useCustomerData();
15
+ const [clientPortal] = useClientPortal();
16
+ const { status } = useParams();
13
17
 
14
18
  const queryParams = new URLSearchParams(location.search);
15
19
  const customerId = queryParams.get('customerId');
@@ -21,14 +25,38 @@ const ReturnFilter = () => {
21
25
  const customerName = selectedCustomer?.customer_name;
22
26
  // const accountNumber = selectedCustomer?.account_number;
23
27
 
28
+ const getStatusLabel = (status: string) => {
29
+ switch (status) {
30
+ case 'outstanding_return':
31
+ return 'Outstanding Return';
32
+ case 'scheduled_for_return':
33
+ return 'All Scheduled Orders';
34
+ case 'return_completed':
35
+ return 'View Return Order';
36
+ default:
37
+ return status
38
+ .replace(/_/g, ' ')
39
+ .replace(/\b\w/g, char => char.toUpperCase());
40
+ }
41
+ };
42
+
24
43
  return (
25
44
  <>
26
45
  <StyledFiter>
27
- <Text>{customerName}</Text>
28
- <StyledFIlterELements>
29
- <StyledTableFilter />
30
- </StyledFIlterELements>
31
- <RightFilters />
46
+ {!clientPortal ? (
47
+ <>
48
+ <Text>{customerName}</Text>
49
+ <StyledFIlterELements>
50
+ <StyledTableFilter />
51
+ </StyledFIlterELements>
52
+ <RightFilters />
53
+ </>
54
+ ) : (
55
+ <>
56
+ <Text>{status ? getStatusLabel(status) : ''}</Text>
57
+ <ReturnRTFilters />
58
+ </>
59
+ )}
32
60
  </StyledFiter>
33
61
  </>
34
62
  );