@bjsdistribution/dms-client-return 0.1.16-prod → 0.1.17-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 (57) 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/order-actions/types.d.ts +2 -2
  7. package/dist/components/order-view/types.d.ts +6 -0
  8. package/dist/components/order-view/utils.d.ts +8 -2
  9. package/dist/components/order-view/view-reminder/ViewReminder.d.ts +2 -0
  10. package/dist/dms-client-return.cjs.development.js +1780 -2272
  11. package/dist/dms-client-return.cjs.development.js.map +1 -1
  12. package/dist/dms-client-return.cjs.production.min.js +1 -1
  13. package/dist/dms-client-return.cjs.production.min.js.map +1 -1
  14. package/dist/dms-client-return.esm.js +1838 -2330
  15. package/dist/dms-client-return.esm.js.map +1 -1
  16. package/package.json +2 -2
  17. package/src/components/client-portal/DateFilterStore.ts +139 -0
  18. package/src/components/client-portal/OutstandingTable.tsx +16 -72
  19. package/src/components/client-portal/ReturnAfterSearchBar.tsx +42 -87
  20. package/src/components/client-portal/ReturnOverview.tsx +11 -2
  21. package/src/components/client-portal/ReturnRTFilters.tsx +140 -43
  22. package/src/components/client-portal/ReturnSearchBar.tsx +42 -153
  23. package/src/components/client-portal/ReturnStatus.tsx +30 -66
  24. package/src/components/client-portal/return-confirm/ConfirmedMain.tsx +12 -23
  25. package/src/components/client-portal/return-confirm/ReturnConfirmedTable.tsx +9 -86
  26. package/src/components/order-daily-overview/header/route-header/ClientRouterHeader.tsx +166 -0
  27. package/src/components/order-daily-overview/header/route-header/RouterHeader.tsx +2 -86
  28. package/src/components/order-daily-overview/header-filters/SelectionFilter.tsx +5 -2
  29. package/src/components/order-daily-overview/index.tsx +16 -4
  30. package/src/components/order-daily-overview/return-after-table/table-filters/ReturnFilterStore.ts +36 -36
  31. package/src/components/order-view/notification/ReminderTemplate.tsx +13 -5
  32. package/src/components/order-view/order-actions/actions/confirm-order/index.tsx +0 -29
  33. package/src/components/order-view/order-actions/actions/create-task-reminder/CreateReminderModal.tsx +86 -28
  34. package/src/components/order-view/order-actions/actions/force-debrief/ForceDebriefModal.tsx +35 -20
  35. package/src/components/order-view/order-actions/actions/force-debrief/order-info/RadioButtons.tsx +11 -62
  36. package/src/components/order-view/order-actions/index.tsx +1 -5
  37. package/src/components/order-view/order-actions/types.ts +2 -2
  38. package/src/components/order-view/order-details/expanded-content/footer/index.tsx +55 -80
  39. package/src/components/order-view/order-details/expanded-content/services-section/AssemblyType.tsx +9 -91
  40. package/src/components/order-view/order-details/expanded-content/services-section/OrderServices.tsx +10 -182
  41. package/src/components/order-view/store.ts +6 -0
  42. package/src/components/order-view/types.ts +6 -0
  43. package/src/components/order-view/utils.ts +0 -33
  44. package/src/components/order-view/view-reminder/AssigneeDropdown.tsx +85 -26
  45. package/src/components/order-view/view-reminder/ViewReminder.tsx +33 -14
  46. package/src/components/store.ts +1 -1
  47. package/src/index.tsx +17 -2
  48. package/dist/components/order-view/order-actions/actions/log-service-refusal/DeliveryPoint.d.ts +0 -7
  49. package/dist/components/order-view/order-actions/actions/log-service-refusal/Notes.d.ts +0 -7
  50. package/dist/components/order-view/order-actions/actions/log-service-refusal/OrderServices.d.ts +0 -7
  51. package/dist/components/order-view/order-actions/actions/log-service-refusal/helper.d.ts +0 -3
  52. package/dist/components/order-view/order-actions/actions/log-service-refusal/index.d.ts +0 -3
  53. package/src/components/order-view/order-actions/actions/log-service-refusal/DeliveryPoint.tsx +0 -50
  54. package/src/components/order-view/order-actions/actions/log-service-refusal/Notes.tsx +0 -50
  55. package/src/components/order-view/order-actions/actions/log-service-refusal/OrderServices.tsx +0 -57
  56. package/src/components/order-view/order-actions/actions/log-service-refusal/helper.ts +0 -26
  57. 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';
@@ -47,8 +48,8 @@ function SelectionFilter() {
47
48
  const [actionTypeOptions, setActionTypeOptions] = useActionTypeOptions();
48
49
  const [locationOptions, setLocationOptions] = useLocationOptions();
49
50
  const [searchParams] = useSearchParams();
51
+ const [clientPortal] = useClientPortal();
50
52
  const navigate = useNavigate();
51
-
52
53
  //API for client data
53
54
  const { data: fetchedCustomerData, loading: loading, fetchData } = useAxios<
54
55
  ApiResponse
@@ -60,7 +61,9 @@ function SelectionFilter() {
60
61
  });
61
62
 
62
63
  useEffect(() => {
63
- fetchData();
64
+ if (!clientPortal) {
65
+ fetchData();
66
+ }
64
67
  }, []);
65
68
 
66
69
  useEffect(() => {
@@ -6,11 +6,11 @@ import {
6
6
  } from './store/store';
7
7
  import Filters from './filters/Filters';
8
8
  import styled from 'styled-components';
9
- import { useCustomerData, useStickyStatus } from '../store';
9
+ import { useClientPortal, useCustomerData, useStickyStatus } from '../store';
10
10
  import HeaderFilter from './header-filters/HeaderFilter';
11
11
  import {
12
12
  DocumentTitle,
13
- useApiHook,
13
+ useAxios,
14
14
  } from '@bjsdistribution/dms-component-library';
15
15
  import { useAtom, useClientData } from '../order-view/store';
16
16
  import { ClientData } from './common/interface';
@@ -36,6 +36,7 @@ function ReturnMainTable() {
36
36
  const [, setCustomers] = useCustomerData();
37
37
  // const [tableName] = useTableName();
38
38
  const queryParams = new URLSearchParams(location.search);
39
+ const [clientPortal] = useClientPortal();
39
40
 
40
41
  const customerId = queryParams.get('customerId');
41
42
 
@@ -47,7 +48,7 @@ function ReturnMainTable() {
47
48
  };
48
49
 
49
50
  //API for client data
50
- const { data: fetchedCustomerData, loading: loading } = useApiHook<
51
+ const { data: fetchedCustomerData, loading: loading, fetchData } = useAxios<
51
52
  ApiResponse
52
53
  >({
53
54
  endpoint: `/v1/return/product/customers/`,
@@ -56,6 +57,11 @@ function ReturnMainTable() {
56
57
  pagination: { is_pagination: false },
57
58
  showLoader: false,
58
59
  });
60
+ useEffect(() => {
61
+ if (!clientPortal) {
62
+ fetchData();
63
+ }
64
+ }, []);
59
65
 
60
66
  useEffect(() => {
61
67
  if (fetchedCustomerData && fetchedCustomerData?.data) {
@@ -67,7 +73,8 @@ function ReturnMainTable() {
67
73
  data: fetchedClientData,
68
74
  loading: statsDataLoading,
69
75
  paginationData,
70
- } = useApiHook<{
76
+ fetchData: fetchProductStats,
77
+ } = useAxios<{
71
78
  data: ClientData[];
72
79
  }>({
73
80
  endpoint: `/v1/return/product/stats/`,
@@ -77,6 +84,11 @@ function ReturnMainTable() {
77
84
  filters: filters,
78
85
  showLoader: false,
79
86
  });
87
+ useEffect(() => {
88
+ if (!clientPortal) {
89
+ fetchProductStats();
90
+ }
91
+ }, []);
80
92
 
81
93
  useEffect(() => {
82
94
  setLoading(statsDataLoading);
@@ -171,46 +171,46 @@ const filterReducer = (state: FilterState, action: any): FilterState => {
171
171
  }
172
172
 
173
173
  //client portal
174
- case 'SET_CP_DATE_FILTER': {
175
- let { startDate, endDate } = action.payload;
174
+ // case 'SET_CP_DATE_FILTER': {
175
+ // let { startDate, endDate } = action.payload;
176
176
 
177
- if (!startDate || !endDate) {
178
- const storedDates = JSON.parse(
179
- localStorage.getItem('returnDate') || '{}'
180
- );
181
- startDate = startDate ?? storedDates?.startDate;
182
- endDate = endDate ?? storedDates?.endDate ?? startDate;
183
- }
177
+ // if (!startDate || !endDate) {
178
+ // const storedDates = JSON.parse(
179
+ // localStorage.getItem('returnDate') || '{}'
180
+ // );
181
+ // startDate = startDate ?? storedDates?.startDate;
182
+ // endDate = endDate ?? storedDates?.endDate ?? startDate;
183
+ // }
184
184
 
185
- const filters = state['x-filters'].filter(f => f.field !== 'created_at');
185
+ // const filters = state['x-filters'].filter(f => f.field !== 'created_at');
186
186
 
187
- if (startDate === endDate) {
188
- filters.push({
189
- field: 'created_at',
190
- op: '=',
191
- value: format(new Date(startDate), 'yyyy-MM-dd'),
192
- });
193
- } else if (startDate && endDate) {
194
- filters.push(
195
- {
196
- field: 'created_at',
197
- op: '>=',
198
- value: format(new Date(startDate), 'yyyy-MM-dd'),
199
- },
200
- {
201
- field: 'created_at',
202
- op: '<=',
203
- value: format(new Date(endDate), 'yyyy-MM-dd'),
204
- }
205
- );
206
- }
187
+ // if (startDate === endDate) {
188
+ // filters.push({
189
+ // field: 'created_at',
190
+ // op: '=',
191
+ // value: format(new Date(startDate), 'yyyy-MM-dd'),
192
+ // });
193
+ // } else if (startDate && endDate) {
194
+ // filters.push(
195
+ // {
196
+ // field: 'created_at',
197
+ // op: '>=',
198
+ // value: format(new Date(startDate), 'yyyy-MM-dd'),
199
+ // },
200
+ // {
201
+ // field: 'created_at',
202
+ // op: '<=',
203
+ // value: format(new Date(endDate), 'yyyy-MM-dd'),
204
+ // }
205
+ // );
206
+ // }
207
207
 
208
- return {
209
- ...state,
210
- 'x-filters': filters,
211
- 'x-pagination': { ...state['x-pagination'], page: 1 },
212
- };
213
- }
208
+ // return {
209
+ // ...state,
210
+ // 'x-filters': filters,
211
+ // 'x-pagination': { ...state['x-pagination'], page: 1 },
212
+ // };
213
+ // }
214
214
  // case 'CLEAR_CLIENT':
215
215
  // return {
216
216
  // ...state,