@bjsdistribution/dms-client-return 0.0.33 → 0.0.35

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 (34) hide show
  1. package/dist/components/order-daily-overview/store/store.d.ts +3 -0
  2. package/dist/components/order-view/notes/order-dropdown/NewReturnDropdown.d.ts +3 -0
  3. package/dist/components/store.d.ts +12 -2
  4. package/dist/components/types.d.ts +4 -0
  5. package/dist/dms-client-return.cjs.development.js +594 -337
  6. package/dist/dms-client-return.cjs.development.js.map +1 -1
  7. package/dist/dms-client-return.cjs.production.min.js +1 -1
  8. package/dist/dms-client-return.cjs.production.min.js.map +1 -1
  9. package/dist/dms-client-return.esm.js +598 -341
  10. package/dist/dms-client-return.esm.js.map +1 -1
  11. package/package.json +1 -1
  12. package/src/components/order-daily-overview/header-filters/SelectionFilter.tsx +119 -140
  13. package/src/components/order-daily-overview/header-filters/filterStore.ts +4 -4
  14. package/src/components/order-daily-overview/index.tsx +18 -14
  15. package/src/components/order-daily-overview/return-after-table/ReturnAfterTable.tsx +14 -10
  16. package/src/components/order-daily-overview/return-after-table/table/OrderTable.tsx +88 -32
  17. package/src/components/order-daily-overview/return-after-table/table-filters/ReturnFilterStore.ts +18 -2
  18. package/src/components/order-daily-overview/return-after-table/table-filters/ReturnOrderFilter.tsx +18 -7
  19. package/src/components/order-daily-overview/return-order-table/return-orders-filters/ReturnFilter.tsx +2 -3
  20. package/src/components/order-daily-overview/return-order-table/return-orders-filters/ReturnOrderTable.tsx +6 -4
  21. package/src/components/order-daily-overview/store/store.ts +15 -0
  22. package/src/components/order-daily-overview/table/ReturnTable.tsx +16 -11
  23. package/src/components/order-daily-overview/table/table-data/styles.ts +1 -1
  24. package/src/components/order-view/details-filters/left-side-filters/dropdowns/OptionsDropDown.tsx +3 -3
  25. package/src/components/order-view/details-filters/left-side-filters/dropdowns/PrintDropDownReturn.tsx +1 -1
  26. package/src/components/order-view/general-information/dropdowns/Print.tsx +1 -1
  27. package/src/components/order-view/modalsPopup/ModalManager.tsx +3 -9
  28. package/src/components/order-view/notes/order-dropdown/NewReturnDropdown.tsx +88 -13
  29. package/src/components/order-view/products-info/expanded-content/index.tsx +91 -16
  30. package/src/components/order-view/products-info/index.tsx +1 -1
  31. package/src/components/order-view/return-client-products/product-table/ReturnProductTable.tsx +47 -42
  32. package/src/components/store.ts +51 -1
  33. package/src/components/types.ts +5 -0
  34. package/src/index.tsx +25 -16
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.0.33",
2
+ "version": "0.0.35",
3
3
  "license": "MIT",
4
4
  "main": "dist/index.js",
5
5
  "typings": "dist/index.d.ts",
@@ -10,158 +10,120 @@ import {
10
10
  } from './Styledfilters';
11
11
  import { atom, useAtom } from 'jotai';
12
12
  import {
13
- useActionType,
13
+ useActionTypeOptions,
14
14
  useClearState,
15
15
  useCustomerData,
16
- useGroupedPayload,
17
- useLocationData,
18
- useNewReturnPayload,
19
16
  useReturnPayload,
20
- useSelectAll,
21
- useSelectedConfirmLoc,
22
- useSelectedOrders,
23
17
  } from '../../store';
24
18
  import { filtersReducerAtom } from './filterStore';
25
19
  import {
26
20
  useSelectedAction,
27
21
  useSelectedClient,
28
22
  useSelectedLocation,
23
+ useIdForTableName,
24
+ useLoading,
29
25
  useTableName,
30
26
  } from '../store/store';
31
27
  import styled from 'styled-components';
32
28
  import { Select } from 'antd';
33
- import { DefaultOptionType } from 'antd/es/select';
29
+ import { useLocationOptions } from '../../order-view/store';
34
30
 
35
31
  export const clickedState = atom<boolean>(false);
36
32
 
37
33
  function SelectionFilter() {
38
34
  const [customers] = useCustomerData();
39
- const [actionType] = useActionType();
40
- const [locationData] = useLocationData();
41
- const [filteredLocationOptions, setFilteredLocationOptions] = useState([]);
42
- const [, setUuid] = useState<any>();
43
35
  const [selectedFilterValue, setSelectedFilterValue] = useSelectedAction();
44
36
  const [, dispatch] = useAtom(filtersReducerAtom);
45
37
  const [
46
38
  selectedLocationValue,
47
39
  setSelectedLocationValue,
48
40
  ] = useSelectedLocation();
49
- const [, setSelectedClient] = useSelectedClient();
50
- const [, setClientLabel] = useTableName();
51
- const [, setName] = useState<any>();
41
+ const [selectedClient, setSelectedClient] = useSelectedClient();
42
+ const [, setClientIdForTable] = useIdForTableName();
52
43
  const [isButtonEnabled, setIsButtonEnabled] = useState(false);
53
44
  const [, setReturnPayload] = useReturnPayload();
54
- const [storedAccNumber, setStoredAccNumber] = useState<any>();
55
- const [storedCustomerId, setStoredCustomerId] = useState<any>();
56
- const [, setNewPayload] = useNewReturnPayload();
57
- const [, setGrouped] = useGroupedPayload();
58
- const [, setSelectedReturnOrder] = useSelectedOrders();
59
- const [, setSelectAll] = useSelectAll();
60
- const [, setCheck] = useSelectedConfirmLoc();
45
+ const [load] = useLoading();
46
+ const [, setTableName] = useTableName();
61
47
  const [clearState, setClear] = useClearState();
48
+ const [actionTypeOptions, setActionTypeOptions] = useActionTypeOptions();
49
+ const [locationOptions, setLocationOptions] = useLocationOptions();
62
50
 
63
- //client options
64
51
  const clientOptions = customers?.map((option: any) => ({
65
52
  label:
66
53
  option?.customer_name?.charAt(0)?.toUpperCase() +
67
54
  option?.customer_name?.slice(1),
68
- value: `${option?.id}_${option?.uuid}`,
69
- id: option?.id,
70
- uuid: option?.uuid,
55
+ value: option?.customer_id,
56
+ actions: option?.actions,
57
+ return_locations: option?.return_locations,
71
58
  account_number: option?.account_number,
72
- gsit_customer_id: option?.gsit_customer_id,
73
- }));
74
-
75
- const actionTypeOptions = actionType?.map((option: any) => ({
76
- label: option?.type?.charAt(0)?.toUpperCase() + option?.type?.slice(1),
77
- value: option?.id,
78
- }));
79
-
80
- const LocationOptions = locationData?.map((option: any) => ({
81
- label: option?.location_name,
82
- value: option?.token,
83
59
  }));
84
60
 
85
61
  //client change
86
- const handleSelectChange = (_value: unknown, option: DefaultOptionType) => {
87
- setNewPayload([]);
88
- const selectedLabel = option?.label as string;
89
- const selectedValue = option?.id as number;
90
- const selectedUuids = option?.uuid as string;
91
- const selectAccountNumber = option?.account_number as string;
92
- const selectedCustomerId = option?.gsit_customer_id as number;
93
- setSelectedClient(selectedValue);
94
- setName(selectedLabel);
95
- // storedName(selectedLabel);
96
- //set items in local storage
97
- localStorage.setItem('clientName', selectedLabel);
98
- localStorage.setItem('clientId', selectedValue?.toString());
99
- localStorage.setItem('account_number', selectAccountNumber);
100
- localStorage.setItem('uuid', selectedUuids);
101
- localStorage.setItem('customer_id', selectedCustomerId?.toString());
102
- const storedAccNo = localStorage.getItem('account_number');
103
- const storedCustomerId = localStorage.getItem('customer_id');
104
- const storedUuid = localStorage.getItem('uuid');
105
- setUuid(storedUuid);
62
+ const handleClientChange = (value: any, option: any) => {
63
+ // console.log(value, 'value');
64
+ setSelectedClient(value);
65
+
66
+ localStorage.setItem('clientName', option?.label);
67
+ localStorage.setItem('clientId', value?.toString());
68
+ localStorage.setItem('account_number', option?.account_number);
106
69
 
107
70
  //set payload
108
71
  setReturnPayload((prevState: any) => ({
109
72
  ...prevState,
110
- account_number: storedAccNo,
111
- customer_id: storedCustomerId,
73
+ account_number: option?.account_number,
74
+ customer_id: value,
112
75
  }));
113
-
114
- //filtering locations
115
- const filteredSubLocations = locationData
116
- ?.filter((subCat: any) => subCat?.customer_id === storedUuid)
117
- .map((subCat: any) => ({
118
- label: subCat?.location_name,
119
- value: subCat?.token,
120
- }));
121
-
122
- setFilteredLocationOptions(filteredSubLocations);
123
-
124
- //clearing states
125
- setUuid('');
126
- setSelectedReturnOrder([]);
127
- setNewPayload([]);
128
- setGrouped([]);
129
- setSelectAll(false);
130
- setCheck([]);
131
76
  };
132
77
 
78
+ const storedName = localStorage.getItem('clientName');
79
+ const storedClientId = localStorage.getItem('clientId');
80
+ const storedAccountNumber = localStorage.getItem('account_number');
81
+
133
82
  useEffect(() => {
134
- const accountNumberFromStorage = localStorage.getItem('account_number');
135
- const customerIdFromStorage = localStorage.getItem('customer_id');
136
- if (accountNumberFromStorage) {
137
- setStoredAccNumber(accountNumberFromStorage);
138
- }
139
- if (customerIdFromStorage) {
140
- setStoredCustomerId(customerIdFromStorage);
83
+ if (storedClientId !== selectedClient) {
84
+ localStorage.removeItem('clientDetails');
85
+ localStorage.removeItem('clientActions');
86
+ localStorage.removeItem('clientLocations');
141
87
  }
142
- if (storedAccNumber && storedCustomerId) {
88
+ }, [storedClientId]);
89
+
90
+ useEffect(() => {
91
+ if (storedClientId && storedAccountNumber) {
143
92
  setReturnPayload((prevState: any) => ({
144
93
  ...prevState,
145
- account_number: storedAccNumber,
146
- customer_id: storedCustomerId,
94
+ account_number: storedAccountNumber,
95
+ customer_id: storedClientId,
147
96
  }));
148
97
  }
149
- }, [storedAccNumber, storedCustomerId]);
150
-
151
- const storedUuid = localStorage.getItem('uuid');
98
+ }, [storedClientId, storedAccountNumber]);
152
99
 
153
100
  useEffect(() => {
154
- if (storedUuid && locationData) {
155
- const filteredSubLocations = locationData
156
- .filter((subCat: any) => subCat?.customer_id === storedUuid)
157
- .map((subCat: any) => ({
158
- label: subCat?.location_name,
159
- value: subCat?.token,
101
+ const storedClientId = localStorage.getItem('clientId');
102
+
103
+ if (storedClientId && clientOptions?.length > 0) {
104
+ const filteredClient = clientOptions?.find(
105
+ (client: any) => client?.value == storedClientId
106
+ );
107
+
108
+ if (filteredClient) {
109
+ const mappedActions = filteredClient?.actions?.map((action: any) => ({
110
+ label: action,
111
+ value: action,
160
112
  }));
161
113
 
162
- setFilteredLocationOptions(filteredSubLocations);
114
+ setActionTypeOptions(mappedActions);
115
+
116
+ const mappedLocations = filteredClient?.return_locations?.map(
117
+ (location: any) => ({
118
+ label: location,
119
+ value: location,
120
+ })
121
+ );
122
+
123
+ setLocationOptions(mappedLocations);
124
+ }
163
125
  }
164
- }, [storedUuid, locationData]);
126
+ }, [load]);
165
127
 
166
128
  //location change
167
129
  const handleLocationChange = (value: any) => {
@@ -175,9 +137,33 @@ function SelectionFilter() {
175
137
 
176
138
  //Apply filters
177
139
  const applyFilters = () => {
140
+ if (selectedClient) {
141
+ setClientIdForTable(selectedClient);
142
+ }
178
143
  if (storedName) {
179
- setClientLabel(storedName);
144
+ setTableName(storedName);
180
145
  }
146
+ const selectedClientValue = clientOptions?.find(
147
+ (client: any) => client?.value === selectedClient
148
+ );
149
+
150
+ const clientActions = selectedClientValue?.actions || [];
151
+
152
+ const clientLocations = selectedClientValue?.return_locations || [];
153
+
154
+ setActionTypeOptions(
155
+ clientActions?.map((action: any) => ({
156
+ label: action,
157
+ value: action,
158
+ }))
159
+ );
160
+
161
+ setLocationOptions(
162
+ clientLocations?.map((action: any) => ({
163
+ label: action,
164
+ value: action,
165
+ }))
166
+ );
181
167
  //client value
182
168
  if (storedClientId) {
183
169
  dispatch({
@@ -218,8 +204,7 @@ function SelectionFilter() {
218
204
  }
219
205
  };
220
206
 
221
- const storedName = localStorage.getItem('clientName');
222
- const storedClientId = localStorage.getItem('clientId');
207
+ // const storedName = localStorage.getItem('clientName');
223
208
 
224
209
  useEffect(() => {
225
210
  if (storedClientId) {
@@ -231,12 +216,12 @@ function SelectionFilter() {
231
216
  }, []);
232
217
 
233
218
  useEffect(() => {
234
- if (storedName || selectedFilterValue || selectedLocationValue) {
219
+ if (storedClientId || selectedFilterValue || selectedLocationValue) {
235
220
  setIsButtonEnabled(true);
236
221
  } else {
237
222
  setIsButtonEnabled(false);
238
223
  }
239
- }, [storedName, selectedFilterValue, selectedLocationValue]);
224
+ }, [storedClientId, selectedFilterValue, selectedLocationValue]);
240
225
 
241
226
  useEffect(() => {}, [location.pathname]);
242
227
 
@@ -255,16 +240,14 @@ function SelectionFilter() {
255
240
 
256
241
  const handleClear = () => {
257
242
  setClear(false);
258
- localStorage.removeItem('clientName');
259
- localStorage.removeItem('clientId');
243
+ localStorage.removeItem('clientDetails');
260
244
  setClear(true);
261
245
  };
262
246
 
263
247
  useEffect(() => {
264
248
  if (clearState) {
265
249
  dispatch({ type: 'CLEAR_CLIENT' });
266
- // window.location.href = '/returnclient';
267
- window.location.replace('/returnclient');
250
+ window.location.href = '/returnclient';
268
251
  }
269
252
  }, [clearState]);
270
253
 
@@ -277,7 +260,7 @@ function SelectionFilter() {
277
260
  <StyledAntSelect
278
261
  options={clientOptions}
279
262
  placeholder="Select Client Name"
280
- onChange={handleSelectChange}
263
+ onChange={handleClientChange}
281
264
  style={{ minWidth: '14vw' }}
282
265
  value={storedName}
283
266
  allowClear
@@ -285,38 +268,34 @@ function SelectionFilter() {
285
268
  />
286
269
  </FilterColumn>
287
270
 
288
- {storedName && location.pathname.includes(`filter/`) ? (
289
- <>
290
- <FilterColumn>
291
- <Label>Action Type</Label>
292
- <StyledAntSelect
293
- options={actionTypeOptions}
294
- placeholder="Select Action Type"
295
- value={selectedFilterValue}
296
- onChange={handleActionClick}
297
- style={{ minWidth: '14vw' }}
298
- allowClear
299
- />
300
- </FilterColumn>
301
-
302
- <FilterColumn>
303
- <Label>Location </Label>
304
- <StyledAntSelect
305
- options={
306
- filteredLocationOptions?.length > 0
307
- ? filteredLocationOptions
308
- : LocationOptions
309
- }
310
- value={selectedLocationValue}
311
- placeholder="Select Location"
312
- onChange={handleLocationChange}
313
- style={{ minWidth: '14vw' }}
314
- allowClear
315
- mode="multiple"
316
- />
317
- </FilterColumn>
318
- </>
319
- ) : null}
271
+ {/* {storedName && location.pathname.includes(`filter/`) ? ( */}
272
+ <>
273
+ <FilterColumn>
274
+ <Label>Action Type</Label>
275
+ <StyledAntSelect
276
+ options={actionTypeOptions}
277
+ placeholder="Select Action Type"
278
+ value={selectedFilterValue}
279
+ onChange={handleActionClick}
280
+ style={{ minWidth: '14vw' }}
281
+ allowClear
282
+ />
283
+ </FilterColumn>
284
+
285
+ <FilterColumn>
286
+ <Label>Location </Label>
287
+ <StyledAntSelect
288
+ options={locationOptions}
289
+ value={selectedLocationValue}
290
+ placeholder="Select Location"
291
+ onChange={handleLocationChange}
292
+ style={{ minWidth: '14vw' }}
293
+ allowClear
294
+ mode="multiple"
295
+ />
296
+ </FilterColumn>
297
+ </>
298
+ {/* ) : null} */}
320
299
  </LeftColumn>
321
300
  <RightColumn>
322
301
  <ApplyButton onClick={applyFilters} disabled={!isButtonEnabled}>
@@ -24,7 +24,7 @@ interface FilterState {
24
24
  }
25
25
  // let todayDate = new Date();
26
26
  const initialState: FilterState = {
27
- 'x-filters': [],
27
+ 'x-filters': [{ field: 'isdeleted', op: '=', value: 0 }],
28
28
  'x-pagination': { page: 1, per_page: 50 },
29
29
  };
30
30
 
@@ -75,10 +75,10 @@ const filterReducer = (state: FilterState, action: any): FilterState => {
75
75
  ...state,
76
76
  'x-filters': [
77
77
  ...state['x-filters'].filter(
78
- f => f.field !== 'product_return_action_id'
78
+ f => f.field !== 'order_product_return_action.type'
79
79
  ),
80
80
  {
81
- field: 'product_return_action_id',
81
+ field: 'order_product_return_action.type',
82
82
  op: '=',
83
83
  value: action.payload,
84
84
  },
@@ -110,7 +110,7 @@ const filterReducer = (state: FilterState, action: any): FilterState => {
110
110
  return {
111
111
  ...state,
112
112
  'x-filters': state['x-filters'].filter(
113
- f => f.field !== 'product_return_action_id'
113
+ f => f.field !== 'order_product_return_action.type'
114
114
  ),
115
115
  };
116
116
 
@@ -1,7 +1,10 @@
1
1
  import React, { useEffect } from 'react';
2
2
  import {
3
+ // useItemsPerOverviewPage,
3
4
  //useItemsPerPage,
4
5
  useLoading,
6
+ // UsePaginationOverviewData,
7
+ useTableName,
5
8
  //UsePaginationData,
6
9
  } from './store/store';
7
10
  import Filters from './filters/Filters';
@@ -9,26 +12,29 @@ import styled from 'styled-components';
9
12
  import { useStickyStatus } from '../store';
10
13
  import HeaderFilter from './header-filters/HeaderFilter';
11
14
  import { useApiHook } from '@bjsdistribution/dms-component-library';
12
- import { useClientData } from '../order-view/store';
15
+ import { useAtom, useClientData } from '../order-view/store';
13
16
  import { ClientData } from './common/interface';
14
17
  import ReturnFilter from './return-order-table/return-orders-filters/ReturnFilter';
15
18
  import { Text } from './filters/FilterStyle';
16
19
  import ReturnTable from './table/ReturnTable';
20
+ import { overviewfiltersReducerAtom } from './header-filters/overViewFilter';
21
+ // import { notification } from 'antd';
22
+ // import Pagination from './table-view/Pagination';
17
23
  // import Pagination from './table-view/Pagination';
18
24
  // import { overviewfiltersReducerAtom } from './header-filters/overViewFilter';
19
25
 
20
26
  function ReturnMainTable() {
21
- // const [state] = useAtom(overviewfiltersReducerAtom);
22
- // const [paginationObj] = UsePaginationData();
27
+ const [state] = useAtom(overviewfiltersReducerAtom);
28
+ // const [paginationObj] = UsePaginationOverviewData();
23
29
  // const [, setCurrentPage] = useState(1);
24
- // const [itemsPerPage, setItemsPerPage] = useItemsPerPage();
25
- // const { 'x-pagination': pagination } = state;
30
+ // const [itemsPerPage, setItemsPerPage] = useItemsPerOverviewPage();
31
+ const { 'x-pagination': pagination } = state;
26
32
  // const { page, total } = paginationObj;
27
33
  // const [selectedClient] = useTableName();
28
- // const [, setPaginationObject] = UsePaginationData();
29
34
  const [isScrolled] = useStickyStatus();
30
35
  const [, setLoading] = useLoading();
31
36
  const [, setClientData] = useClientData();
37
+ const [tableName] = useTableName();
32
38
 
33
39
  // const handlePageChange = (page: number) => {
34
40
  // setCurrentPage(page);
@@ -39,19 +45,19 @@ function ReturnMainTable() {
39
45
 
40
46
  const {
41
47
  data: fetchedClientData,
42
- loading: staticDataLoading,
48
+ loading: statsDataLoading,
43
49
  // paginationData,
44
50
  } = useApiHook<{
45
51
  data: ClientData[];
46
52
  }>({
47
- endpoint: `/return_orders/get/client-returns/`,
53
+ endpoint: `/return_orders/stats/`,
48
54
  method: 'GET',
49
55
  //@ts-ignore
50
- pagination: { page: 1, per_page: 200, is_pagination: false },
56
+ pagination: pagination,
51
57
  });
52
58
 
53
59
  useEffect(() => {
54
- setLoading(staticDataLoading);
60
+ setLoading(statsDataLoading);
55
61
  if (fetchedClientData && fetchedClientData.data) {
56
62
  const result = fetchedClientData?.data;
57
63
  setClientData(result);
@@ -65,9 +71,7 @@ function ReturnMainTable() {
65
71
  // });
66
72
  // }
67
73
  }
68
- }, [staticDataLoading]);
69
-
70
- const getClient = localStorage.getItem('clientName');
74
+ }, [statsDataLoading]);
71
75
 
72
76
  return (
73
77
  <>
@@ -78,7 +82,7 @@ function ReturnMainTable() {
78
82
  <Container>
79
83
  <Row>
80
84
  <Text>Client Return</Text>
81
- {getClient ? <ReturnFilter /> : <Filters />}
85
+ {tableName ? <ReturnFilter /> : <Filters />}
82
86
  </Row>
83
87
  <ReturnTable />
84
88
  </Container>
@@ -14,22 +14,19 @@ import { useApiHook } from '@bjsdistribution/dms-component-library';
14
14
  import { filtersReducerReturnAtom } from './table-filters/ReturnFilterStore';
15
15
  import { notification } from 'antd';
16
16
  import ReturnPagination from '../table-view/ReturnPagination';
17
+ import { useCallApiAgain } from '../../store';
17
18
 
18
19
  const ReturnAfterTable = () => {
19
- const [, setReturnOrderData] = useReturnAfterOrderData();
20
+ const [returnAfterOrder, setReturnOrderData] = useReturnAfterOrderData();
20
21
  const [, setLoading] = useLoading();
21
22
  const [state] = useAtom(filtersReducerReturnAtom);
23
+ const [callApi] = useCallApiAgain();
24
+
22
25
  const { 'x-filters': filters, 'x-pagination': pagination } = state;
23
- const splitPath = (str: any) => {
24
- const parts = str?.split('/')?.filter((part: any) => part !== ''); // Filter out empty parts
25
- return parts;
26
- };
27
- const paths = splitPath(location.pathname);
28
26
  const [paginationObj] = UsePaginationReturnData();
29
27
  const [, setCurrentPage] = useState(1);
30
28
  const [itemsPerPage, setItemsPerPage] = useItemsPerReturnPage();
31
29
  const [, setPaginationObject] = UsePaginationData();
32
- console.log(paths, 'paths');
33
30
  const { page, total } = paginationObj;
34
31
 
35
32
  const handlePageChange = (page: number) => {
@@ -41,17 +38,23 @@ const ReturnAfterTable = () => {
41
38
 
42
39
  const {
43
40
  data: fetchedReturnOrderData,
44
- loading: staticDataLoading,
41
+ loading,
42
+ setShouldPerformAction,
45
43
  paginationData,
46
44
  } = useApiHook<ApiResponse>({
47
45
  endpoint: '/return_orders/?skip_filters=0',
48
46
  method: 'GET',
49
47
  filters: filters,
50
48
  pagination: pagination,
49
+ performAction: false,
51
50
  });
52
51
 
53
52
  useEffect(() => {
54
- setLoading(staticDataLoading);
53
+ callApi ? setShouldPerformAction(true) : setShouldPerformAction(false);
54
+ }, [callApi]);
55
+
56
+ useEffect(() => {
57
+ setLoading(loading);
55
58
  if (fetchedReturnOrderData && fetchedReturnOrderData?.data) {
56
59
  setReturnOrderData(fetchedReturnOrderData?.data);
57
60
  if (paginationData !== null) {
@@ -64,7 +67,8 @@ const ReturnAfterTable = () => {
64
67
  });
65
68
  }
66
69
  }
67
- }, [fetchedReturnOrderData, staticDataLoading]);
70
+ }, [fetchedReturnOrderData, loading, returnAfterOrder]);
71
+
68
72
  return (
69
73
  <div>
70
74
  <DashBoardWrapper>