@bjsdistribution/dms-client-return 0.1.21-prod → 0.1.22-dev

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/dist/common/custom-input/CustomInput.d.ts +5 -0
  2. package/dist/components/order-view/order-actions/actions/send-sms/SendSmsModal.d.ts +1 -0
  3. package/dist/components/order-view/order-actions/actions/what3words/What3WordsModal.tsx.d.ts +3 -0
  4. package/dist/components/order-view/store.d.ts +1 -1
  5. package/dist/components/order-view/types.d.ts +5 -4
  6. package/dist/components/order-view/utils.d.ts +2 -1
  7. package/dist/components/store.d.ts +2 -1
  8. package/dist/dms-client-return.cjs.development.js +1278 -903
  9. package/dist/dms-client-return.cjs.development.js.map +1 -1
  10. package/dist/dms-client-return.cjs.production.min.js +1 -1
  11. package/dist/dms-client-return.cjs.production.min.js.map +1 -1
  12. package/dist/dms-client-return.esm.js +1280 -905
  13. package/dist/dms-client-return.esm.js.map +1 -1
  14. package/package.json +1 -1
  15. package/src/common/custom-input/CustomInput.tsx +24 -0
  16. package/src/components/client-portal/DateFilterStore.ts +57 -9
  17. package/src/components/client-portal/OutstandingTable.tsx +1 -1
  18. package/src/components/client-portal/ReturnStatus.tsx +84 -44
  19. package/src/components/client-portal/return-confirm/ConfirmedMain.tsx +5 -6
  20. package/src/components/client-portal/return-confirm/ReturnConfirmedTable.tsx +21 -2
  21. package/src/components/order-daily-overview/header/route-header/ClientRouterHeader.tsx +45 -23
  22. package/src/components/order-daily-overview/header-filters/HeaderFilter.tsx +3 -2
  23. package/src/components/order-daily-overview/header-filters/SelectionFilter.tsx +5 -3
  24. package/src/components/order-daily-overview/index.tsx +12 -5
  25. package/src/components/order-daily-overview/return-order-table/return-orders-filters/ReturnFilter.tsx +53 -4
  26. package/src/components/order-view/details-filters/left-side-filters/dropdowns/DropDowns.tsx +48 -12
  27. package/src/components/order-view/general-information/dropdowns/Print.tsx +13 -17
  28. package/src/components/order-view/modalsPopup/ModalManager.tsx +9 -1
  29. package/src/components/order-view/notes/logs/index.tsx +3 -1
  30. package/src/components/order-view/order-actions/actions/add-resources/DocFileUpload.tsx +4 -4
  31. package/src/components/order-view/order-actions/actions/charge-log/index.tsx +26 -1
  32. package/src/components/order-view/order-actions/actions/confirm-order/customer-info/DeliveryDate.tsx +1 -3
  33. package/src/components/order-view/order-actions/actions/create-task-reminder/CreateReminderModal.tsx +7 -4
  34. package/src/components/order-view/order-actions/actions/force-debrief/ForceDebriefModal.tsx +21 -20
  35. package/src/components/order-view/order-actions/actions/send-sms/SendSmsModal.tsx +104 -51
  36. package/src/components/order-view/order-actions/actions/what3words/What3WordsModal.tsx.tsx +306 -0
  37. package/src/components/order-view/order-actions/index.tsx +34 -13
  38. package/src/components/order-view/order-details/expanded-content/customer-section/contact-info/ContactHome.tsx +6 -3
  39. package/src/components/order-view/order-details/expanded-content/customer-section/contact-info/ContactMobile.tsx +6 -3
  40. package/src/components/order-view/order-details/expanded-content/customer-section/contact-info/ContactWork.tsx +9 -3
  41. package/src/components/order-view/order-details/expanded-content/customer-section/location-info/Latitude.tsx +5 -7
  42. package/src/components/order-view/order-details/expanded-content/customer-section/location-info/Longitude.tsx +1 -1
  43. package/src/components/order-view/order-details/expanded-content/customer-section/location-info/What3words.tsx +45 -13
  44. package/src/components/order-view/order-details/expanded-content/footer/index.tsx +63 -27
  45. package/src/components/order-view/order-details/expanded-content/orders-section/DeliveryDate.tsx +1 -1
  46. package/src/components/order-view/products-info/index.tsx +1 -0
  47. package/src/components/order-view/types.ts +6 -4
  48. package/src/components/store.ts +8 -1
  49. package/src/index.tsx +6 -4
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.1.21-prod",
2
+ "version": "0.1.22-dev",
3
3
  "license": "MIT",
4
4
  "main": "dist/index.js",
5
5
  "typings": "dist/index.d.ts",
@@ -0,0 +1,24 @@
1
+ import { Input } from '@bjsdistribution/dms-component-library';
2
+ import React, { InputHTMLAttributes } from 'react';
3
+ import styled from 'styled-components';
4
+
5
+ function GenericInput(
6
+ props: InputHTMLAttributes<HTMLInputElement> & { hasError?: boolean }
7
+ ) {
8
+ return <StyledInput {...props} />;
9
+ }
10
+
11
+ const StyledInput = styled(Input)<{ hasError?: boolean }>`
12
+ height: 30px;
13
+ border: 1px solid ${({ hasError }) => (hasError ? 'red' : '#ccc')};
14
+ &:hover {
15
+ background: #ffffff;
16
+ outline: none;
17
+ border-color: #7b7874;
18
+ }
19
+ &:focus {
20
+ border-color: ${({ hasError }) => (hasError ? 'red' : '#888')};
21
+ }
22
+ `;
23
+
24
+ export default GenericInput;
@@ -1,3 +1,4 @@
1
+ import dayjs from 'dayjs';
1
2
  import { atom } from 'jotai';
2
3
 
3
4
  interface Filter {
@@ -17,7 +18,7 @@ interface FilterState {
17
18
  }
18
19
 
19
20
  const initialState: FilterState = {
20
- 'x-filters': [],
21
+ 'x-filters': [{ field: 'order_status', op: '=', value: 'complete' }],
21
22
  'x-pagination': { page: 1, per_page: 50 },
22
23
  };
23
24
 
@@ -27,35 +28,82 @@ const overviewFilterReducer = (
27
28
  ): FilterState => {
28
29
  switch (action.type) {
29
30
  case 'SET_CP_DATE_FILTER': {
30
- const { startDate, endDate } = action.payload;
31
+ const { startDate, endDate, status } = action.payload;
32
+
33
+ let fieldName = 'created_at';
34
+ if (status === 'return_completed') {
35
+ fieldName = 'action_date';
36
+ }
31
37
 
32
38
  const filters: Filter[] = [];
33
39
 
34
- if (startDate) {
40
+ if (startDate && endDate && startDate === endDate) {
35
41
  filters.push({
36
- field: 'created_at',
42
+ field: fieldName,
37
43
  op: '>=',
38
44
  value: `${startDate}T00:00:00+00:00`,
39
45
  });
40
- }
46
+ filters.push({
47
+ field: fieldName,
48
+ op: '<=',
49
+ value: `${startDate}T23:59:59+00:00`,
50
+ });
51
+ } else if (startDate && !endDate) {
52
+ const nextDay = dayjs(startDate)
53
+ .add(1, 'day')
54
+ .format('YYYY-MM-DD');
41
55
 
42
- if (endDate) {
43
56
  filters.push({
44
- field: 'created_at',
57
+ field: fieldName,
58
+ op: '>=',
59
+ value: `${startDate}T00:00:00+00:00`,
60
+ });
61
+ filters.push({
62
+ field: fieldName,
45
63
  op: '<=',
46
- value: `${endDate}T23:59:59+00:00`,
64
+ value: `${nextDay}T00:00:00+00:00`,
47
65
  });
66
+ } else {
67
+ if (startDate) {
68
+ filters.push({
69
+ field: fieldName,
70
+ op: '>=',
71
+ value: `${startDate}T00:00:00+00:00`,
72
+ });
73
+ }
74
+
75
+ if (endDate) {
76
+ filters.push({
77
+ field: fieldName,
78
+ op: '<=',
79
+ value: `${endDate}T23:59:59+00:00`,
80
+ });
81
+ }
48
82
  }
49
83
 
50
84
  return {
51
85
  ...state,
52
86
  'x-filters': [
53
- ...state['x-filters'].filter(f => f.field !== 'created_at'),
87
+ ...state['x-filters'].filter(
88
+ f => f.field !== 'created_at' && f.field !== 'action_date'
89
+ ),
54
90
  ...filters,
55
91
  ],
56
92
  };
57
93
  }
58
94
 
95
+ case 'CLEAR_CP_DATE_FILTER': {
96
+ console.log('Before clearing:', state['x-filters']);
97
+ const updatedFilters = state['x-filters'].filter(
98
+ f => f.field !== 'created_at' && f.field !== 'action_date'
99
+ );
100
+
101
+ return {
102
+ ...state,
103
+ 'x-filters': updatedFilters,
104
+ };
105
+ }
106
+
59
107
  //client portal
60
108
  case 'SET_SCHEDULED_RETURN_FILTER':
61
109
  if (action.payload) {
@@ -146,7 +146,7 @@ const OutstandingTable = () => {
146
146
  if (clientPortal && debouncedSearchText === '') {
147
147
  fetchData();
148
148
  }
149
- }, [JSON.stringify(modifiedFilters), debouncedSearchText]);
149
+ }, [JSON.stringify(modifiedFilters), debouncedSearchText, pagination]);
150
150
 
151
151
  useEffect(() => {
152
152
  setLoading(returnDataLoad);
@@ -3,18 +3,21 @@ import {
3
3
  device,
4
4
  useAxios,
5
5
  } from '@bjsdistribution/dms-component-library';
6
- import React, { useEffect } from 'react';
6
+ import React, { useEffect, useMemo, useState } from 'react';
7
7
  import styled from 'styled-components';
8
8
  import {
9
9
  useActiveCardId,
10
10
  useAtom,
11
11
  useClientPortal,
12
+ useEndDate,
12
13
  useSearchAfterText,
13
14
  useSearchText,
15
+ useStartDate,
14
16
  useStatsCPCount,
15
17
  } from '../store';
16
18
  import { useNavigate, useParams } from 'react-router-dom';
17
19
  import { dateFilterCPReducer } from './DateFilterStore';
20
+ import dayjs from 'dayjs';
18
21
  // import dayjs from 'dayjs';
19
22
  export type returnCountType = {
20
23
  outstanding_count: number | null;
@@ -37,14 +40,15 @@ const ReturnStatus = () => {
37
40
  const [count, setCount] = useStatsCPCount();
38
41
  const [clientPortal] = useClientPortal();
39
42
  const [debouncedSearchText, setOutstandingSearch] = useSearchText();
40
-
41
43
  const cleanedFilters = filters.filter(f => f.field !== 'order_status');
42
-
44
+ const [startDate, setStartDate] = useStartDate();
45
+ const [endDate, setEndDate] = useEndDate();
46
+ const [previousStatus, setPreviousStatus] = useState<string | null>(null);
43
47
  const [
44
48
  debouncedSearchAfterText,
45
49
  setDebouncedSearchText,
46
50
  ] = useSearchAfterText();
47
- const { data: statsData, loading: apiLoading, fetchData } = useAxios<{
51
+ const { data: statsData, fetchData } = useAxios<{
48
52
  data: returnCountType[];
49
53
  }>({
50
54
  endpoint: `v1/portal/return/stats/`,
@@ -66,50 +70,65 @@ const ReturnStatus = () => {
66
70
 
67
71
  useEffect(() => {
68
72
  if (
69
- (clientPortal &&
70
- debouncedSearchAfterText === '' &&
71
- status == 'scheduled_for_return') ||
72
- status == 'return_completed'
73
+ clientPortal &&
74
+ debouncedSearchAfterText === '' &&
75
+ (status == 'scheduled_for_return' || status == 'return_completed')
73
76
  ) {
74
77
  fetchData();
75
78
  }
76
79
  }, [debouncedSearchAfterText, debouncedSearchText, JSON.stringify(filters)]);
77
80
 
78
81
  useEffect(() => {
79
- if (statsData && statsData?.data) {
80
- const data = statsData?.data;
81
- setCount(data);
82
+ if (statsData?.data && typeof statsData?.data === 'object') {
83
+ setCount(statsData?.data);
82
84
  }
83
- }, [apiLoading]);
84
-
85
- const returnCounts = [
86
- {
87
- id: 1,
88
- icon: 'outstanding_return',
89
- status: 'outstanding_return',
90
- count: count?.outstanding_count,
91
- label: 'Outstanding Return',
92
- },
93
- {
94
- id: 2,
95
- icon: 'scheduled_for_return',
96
- status: 'scheduled_for_return',
97
- count: count?.scheduled_count,
98
- label: 'Scheduled For Return',
99
- },
100
- {
101
- id: 3,
102
- icon: 'return_completed',
103
- status: 'return_completed',
104
- count: count?.completed_count,
105
- label: 'Return Completed',
106
- },
107
- ];
85
+ }, [statsData]);
108
86
 
87
+ const returnCounts = useMemo(
88
+ () => [
89
+ // {
90
+ // id: 1,
91
+ // icon: 'outstanding_return',
92
+ // status: 'outstanding_return',
93
+ // count: count?.outstanding_count,
94
+ // label: 'Outstanding Return',
95
+ // },
96
+ // {
97
+ // id: 2,
98
+ // icon: 'scheduled_for_return',
99
+ // status: 'scheduled_for_return',
100
+ // count: count?.scheduled_count,
101
+ // label: 'Scheduled For Return',
102
+ // },
103
+ {
104
+ id: 3,
105
+ icon: 'return_completed',
106
+ status: 'return_completed',
107
+ count: count?.completed_count,
108
+ label: 'Return Completed',
109
+ },
110
+ ],
111
+ [count]
112
+ );
113
+
114
+ //handling status change
109
115
  const handleCardClick = (item: any) => {
110
116
  if (activeCardId === item?.id) {
111
117
  return;
112
118
  }
119
+
120
+ const newStatus = item?.status;
121
+
122
+ if (
123
+ previousStatus === 'return_completed' &&
124
+ newStatus !== 'return_completed'
125
+ ) {
126
+ dispatch({ type: 'CLEAR_CP_DATE_FILTER' });
127
+ setStartDate(null);
128
+ setEndDate(null);
129
+ }
130
+ setPreviousStatus(newStatus);
131
+
113
132
  setActiveCardId(item?.id);
114
133
  //for dev
115
134
  navigate(`/return/${item?.status}`);
@@ -117,26 +136,47 @@ const ReturnStatus = () => {
117
136
  //navigate(`/${item?.status}`);
118
137
  setOutstandingSearch('');
119
138
  setDebouncedSearchText('');
120
- if (item?.status == 'scheduled_for_return') {
139
+
140
+ let formattedStart = startDate?.format('YYYY-MM-DD');
141
+ let formattedEnd = endDate ? endDate?.format('YYYY-MM-DD') : null;
142
+
143
+ if (newStatus === 'scheduled_for_return') {
121
144
  dispatch({
122
145
  type: 'SET_SCHEDULED_RETURN_FILTER',
123
146
  payload:
124
147
  'awaiting confirmation,awaiting route,routed,confirmed,on hold,subcontracted',
125
148
  });
126
- dispatch({
127
- type: 'SET_PAGE',
128
- payload: 1,
129
- });
130
149
  }
131
- if (item?.status == 'return_completed') {
150
+
151
+ if (newStatus === 'return_completed') {
132
152
  dispatch({
133
153
  type: 'SET_RETURN_COMPLETED_FILTER',
134
154
  payload: 'complete',
135
155
  });
156
+
157
+ const today = dayjs().format('YYYY-MM-DD');
158
+ const oneWeekAgo = dayjs()
159
+ .subtract(7, 'day')
160
+ .format('YYYY-MM-DD');
161
+
162
+ formattedStart = oneWeekAgo;
163
+ formattedEnd = today;
164
+
165
+ setStartDate(dayjs().subtract(7, 'day'));
166
+ setEndDate(dayjs());
167
+
168
+ dispatch({ type: 'CLEAR_CP_DATE_FILTER' });
169
+
136
170
  dispatch({
137
- type: 'SET_PAGE',
138
- payload: 1,
171
+ type: 'SET_CP_DATE_FILTER',
172
+ payload: {
173
+ startDate: formattedStart,
174
+ endDate: formattedEnd,
175
+ status: newStatus, // using action date
176
+ },
139
177
  });
178
+
179
+ dispatch({ type: 'SET_PAGE', payload: 1 });
140
180
  }
141
181
  };
142
182
 
@@ -11,7 +11,7 @@ import ReturnConfirmedTable from './ReturnConfirmedTable';
11
11
  import {
12
12
  useItemsPerReturnPage,
13
13
  useLoading,
14
- UsePaginationData,
14
+ // UsePaginationData,
15
15
  UsePaginationReturnData,
16
16
  } from '../../order-daily-overview/store/store';
17
17
  import { filtersReducerReturnAtom } from '../../order-daily-overview/return-after-table/table-filters/ReturnFilterStore';
@@ -30,10 +30,10 @@ const ConfirmedMain = () => {
30
30
  const { 'x-pagination': pagination } = statePagination;
31
31
  const [state] = useAtom(dateFilterCPReducer);
32
32
  const { 'x-filters': filters } = state;
33
- const [paginationObj] = UsePaginationReturnData();
33
+ const [paginationObj, setReturnPaginationObject] = UsePaginationReturnData();
34
34
  const [, setCurrentPage] = useState(1);
35
35
  const [itemsPerPage, setItemsPerPage] = useItemsPerReturnPage();
36
- const [, setPaginationObject] = UsePaginationData();
36
+ // const [, setPaginationObject] = UsePaginationData();
37
37
  const { page, total } = paginationObj;
38
38
  const [debouncedSearchText] = useSearchAfterText();
39
39
  const handlePageChange = (page: number) => {
@@ -61,18 +61,17 @@ const ConfirmedMain = () => {
61
61
  if (clientPortal && debouncedSearchText === '') {
62
62
  fetchData();
63
63
  }
64
- }, [JSON.stringify(filters), debouncedSearchText]);
64
+ }, [JSON.stringify(filters), debouncedSearchText, pagination]);
65
65
 
66
66
  useEffect(() => {
67
67
  setLoading(loading);
68
68
 
69
69
  if (fetchedReturnOrderData?.data) {
70
70
  setReturnConfirmedData(fetchedReturnOrderData?.data);
71
-
72
71
  if (paginationData) {
73
72
  try {
74
73
  const { count, ...rest } = JSON.parse(paginationData);
75
- setPaginationObject(rest);
74
+ setReturnPaginationObject(rest);
76
75
  } catch (error) {
77
76
  notification.error({
78
77
  message: 'Error',
@@ -27,6 +27,7 @@ import PrinterIcon from '../../../assets/icons/PrinterIcon';
27
27
  import DownIcon from '../../../assets/icons/DownIcon';
28
28
  import PrintDropDown from '../../order-daily-overview/shared/elements/PrintDropDown';
29
29
  import { formatDate } from '../../order-daily-overview/shared/utlis';
30
+ import dayjs from 'dayjs';
30
31
 
31
32
  const ReturnConfirmedTable = () => {
32
33
  const dropdownRefParent = useRef<HTMLDivElement>(null);
@@ -171,6 +172,11 @@ const ReturnConfirmedTable = () => {
171
172
  Created {renderSortIcon('created_at')}
172
173
  </div>
173
174
  </th>
175
+ {/* <th onClick={() => handleSort('return_location_name')}>
176
+ <div className="sortIconClass">
177
+ Delivery Date {renderSortIcon('return_location_name')}
178
+ </div>
179
+ </th> */}
174
180
  <th onClick={() => handleSort('return_location_name')}>
175
181
  <div className="sortIconClass">
176
182
  Return Location {renderSortIcon('return_location_name')}
@@ -181,7 +187,13 @@ const ReturnConfirmedTable = () => {
181
187
  Recipient {renderSortIcon('recipient_name')}
182
188
  </div>
183
189
  </th>
184
- <th> Client</th>
190
+ {/* <th onClick={() => handleSort('recipient_reference')}> */}
191
+ <th>
192
+ {/* <div className="sortIconClass"> */}
193
+ Recipient Reference{renderSortIcon('recipient_reference')}
194
+ {/* </div> */}
195
+ </th>
196
+ <th>Sender</th>
185
197
  <th>Consignment</th>
186
198
  <th>Return Order No</th>
187
199
  <th> Total Parts</th>
@@ -242,6 +254,7 @@ const ReturnConfirmedTable = () => {
242
254
  />
243
255
  </td>
244
256
  <td>{formatDate(new Date(item?.created_at))}</td>
257
+ {/* <td>{formatDate(new Date(item?.action_date))}</td> */}
245
258
  <td>{displayValueOrNA(item?.return_location_name)}</td>
246
259
  <td onClick={() => setOrderId(item.id)}>
247
260
  <ul style={{ listStyleType: 'none', padding: 0 }}>
@@ -261,6 +274,7 @@ const ReturnConfirmedTable = () => {
261
274
  </li>
262
275
  </ul>
263
276
  </td>
277
+ <td>{displayValueOrNA(item?.recipient_reference)}</td>
264
278
 
265
279
  <td>{displayValueOrNA(item?.customer_name)}</td>
266
280
 
@@ -287,7 +301,12 @@ const ReturnConfirmedTable = () => {
287
301
  className="statustext"
288
302
  style={{ color: statusClass.color }}
289
303
  >
290
- {status}
304
+ {status}{' '}
305
+ {status === 'Completed' && item?.action_date
306
+ ? ` - ${dayjs(item?.action_date).format(
307
+ 'DD/MM/YYYY'
308
+ )}`
309
+ : ''}
291
310
  </li>
292
311
  </ul>
293
312
  </td>
@@ -37,28 +37,50 @@ const ClientRouterHeader: React.FC<RouterHeaderProps> = ({
37
37
  const { status } = useParams();
38
38
 
39
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
- }
40
+ if (!clientPortal) return;
41
+
42
+ const isReturnCompleted = status === 'return_completed';
43
+ const hasNoDate = !startDate && !endDate;
44
+
45
+ // if (isReturnCompleted && hasNoDate) {
46
+ // const today = dayjs();
47
+
48
+ // setStartDate(today);
49
+ // setEndDate(today);
50
+
51
+ // return;
52
+ // }
53
+
54
+ const formattedStart = startDate?.format('YYYY-MM-DD');
55
+ const formattedEnd = endDate?.format('YYYY-MM-DD') ?? null;
56
+
57
+ if (hasNoDate && !isReturnCompleted) {
58
+ dispatch({ type: 'CLEAR_CP_DATE_FILTER' });
59
+ return;
57
60
  }
58
- }, [startDate, endDate]);
61
+
62
+ if (formattedStart || formattedEnd) {
63
+ dispatch({
64
+ type: 'SET_CP_DATE_FILTER',
65
+ payload: {
66
+ startDate: formattedStart,
67
+ endDate: formattedEnd,
68
+ status,
69
+ },
70
+ });
71
+ }
72
+ }, [clientPortal, status, startDate, endDate]);
59
73
 
60
74
  const handleStartDateChange: DatePickerProps['onChange'] = date => {
61
- setStartDate(date ?? null);
75
+ if (!date) {
76
+ setStartDate(null);
77
+ setEndDate(null);
78
+ dispatch({
79
+ type: 'CLEAR_CP_DATE_FILTER',
80
+ });
81
+ } else {
82
+ setStartDate(date);
83
+ }
62
84
  };
63
85
 
64
86
  const handleEndDateChange: DatePickerProps['onChange'] = date => {
@@ -99,10 +121,10 @@ const ClientRouterHeader: React.FC<RouterHeaderProps> = ({
99
121
  value={startDate ? dayjs(startDate) : null}
100
122
  onChange={handleStartDateChange}
101
123
  format={'MMMM D, YYYY'}
102
- allowClear={false}
103
- disabledDate={current =>
104
- !!endDate && current.isAfter(dayjs(endDate), 'day')
105
- }
124
+ allowClear
125
+ // disabledDate={current =>
126
+ // !!endDate && current.isAfter(dayjs(endDate), 'day')
127
+ // }
106
128
  />
107
129
  <DatePicker
108
130
  value={endDate ? dayjs(endDate) : null}
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import { CoverPage } from './Styledfilters';
3
3
  import SelectionFilter from './SelectionFilter';
4
4
  import { useClientPortal } from '../../store';
5
- import ReturnStatus from '../../client-portal/ReturnStatus';
5
+ // import ReturnStatus from '../../client-portal/ReturnStatus';
6
6
 
7
7
  function HeaderFilter() {
8
8
  const [clientPortal] = useClientPortal();
@@ -10,7 +10,8 @@ function HeaderFilter() {
10
10
  return (
11
11
  <>
12
12
  {clientPortal ? (
13
- <ReturnStatus />
13
+ // <ReturnStatus />
14
+ <></>
14
15
  ) : (
15
16
  <>
16
17
  <CoverPage>
@@ -12,6 +12,7 @@ import { atom, useAtom } from 'jotai';
12
12
  import {
13
13
  useActionTypeOptions,
14
14
  useClearState,
15
+ useClientLoading,
15
16
  useClientPortal,
16
17
  useCustomerData,
17
18
  useReturnPayload,
@@ -50,6 +51,7 @@ function SelectionFilter() {
50
51
  const [searchParams] = useSearchParams();
51
52
  const [clientPortal] = useClientPortal();
52
53
  const navigate = useNavigate();
54
+ const [clientLoading] = useClientLoading();
53
55
  //API for client data
54
56
  const { data: fetchedCustomerData, loading: loading, fetchData } = useAxios<
55
57
  ApiResponse
@@ -59,12 +61,12 @@ function SelectionFilter() {
59
61
  //@ts-ignore
60
62
  pagination: { is_pagination: false },
61
63
  });
62
-
64
+ //need to fix
63
65
  useEffect(() => {
64
- if (!clientPortal && clientPortal !== undefined) {
66
+ if (!clientPortal && !clientLoading) {
65
67
  fetchData();
66
68
  }
67
- }, []);
69
+ }, [clientLoading]);
68
70
 
69
71
  useEffect(() => {
70
72
  if (fetchedCustomerData && fetchedCustomerData?.data) {
@@ -6,7 +6,12 @@ import {
6
6
  } from './store/store';
7
7
  import Filters from './filters/Filters';
8
8
  import styled from 'styled-components';
9
- import { useClientPortal, useCustomerData, useStickyStatus } from '../store';
9
+ import {
10
+ useClientLoading,
11
+ useClientPortal,
12
+ useCustomerData,
13
+ useStickyStatus,
14
+ } from '../store';
10
15
  import HeaderFilter from './header-filters/HeaderFilter';
11
16
  import {
12
17
  DocumentTitle,
@@ -37,6 +42,7 @@ function ReturnMainTable() {
37
42
  // const [tableName] = useTableName();
38
43
  const queryParams = new URLSearchParams(location.search);
39
44
  const [clientPortal] = useClientPortal();
45
+ const [clientLoading] = useClientLoading();
40
46
 
41
47
  const customerId = queryParams.get('customerId');
42
48
 
@@ -59,10 +65,10 @@ function ReturnMainTable() {
59
65
  });
60
66
 
61
67
  useEffect(() => {
62
- if (!clientPortal && clientPortal !== undefined) {
68
+ if (!clientPortal && !clientLoading) {
63
69
  fetchData();
64
70
  }
65
- }, []);
71
+ }, [clientLoading]);
66
72
 
67
73
  useEffect(() => {
68
74
  if (fetchedCustomerData && fetchedCustomerData?.data) {
@@ -85,11 +91,12 @@ function ReturnMainTable() {
85
91
  filters: filters,
86
92
  showLoader: false,
87
93
  });
94
+
88
95
  useEffect(() => {
89
- if (!clientPortal && clientPortal !== undefined) {
96
+ if (!clientPortal && !clientLoading) {
90
97
  fetchProductStats();
91
98
  }
92
- }, []);
99
+ }, [clientLoading]);
93
100
 
94
101
  useEffect(() => {
95
102
  setLoading(statsDataLoading);