@bjsdistribution/dms-client-return 0.0.41 → 0.0.42

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 (24) hide show
  1. package/dist/common/date-picker/header/ClearDate.d.ts +1 -1
  2. package/dist/components/order-daily-overview/store/store.d.ts +1 -1
  3. package/dist/components/order-daily-overview/table/table-data/styles.d.ts +3 -3
  4. package/dist/components/order-daily-overview/table-view/TableStyle.d.ts +4 -4
  5. package/dist/components/order-view/view-reminder/reminder-styles.d.ts +2 -2
  6. package/dist/dms-client-return.cjs.development.js +300 -156
  7. package/dist/dms-client-return.cjs.development.js.map +1 -1
  8. package/dist/dms-client-return.cjs.production.min.js +1 -1
  9. package/dist/dms-client-return.cjs.production.min.js.map +1 -1
  10. package/dist/dms-client-return.esm.js +301 -157
  11. package/dist/dms-client-return.esm.js.map +1 -1
  12. package/package.json +1 -1
  13. package/src/common/services-slider/ServiceSlider.tsx +1 -1
  14. package/src/components/order-daily-overview/header-filters/SelectionFilter.tsx +100 -82
  15. package/src/components/order-daily-overview/index.tsx +6 -4
  16. package/src/components/order-daily-overview/return-after-table/table-filters/ReturnFilterStore.ts +60 -16
  17. package/src/components/order-daily-overview/return-after-table/table-filters/ReturnOrderFilter.tsx +70 -20
  18. package/src/components/order-daily-overview/return-order-table/ReturnTable.tsx +8 -1
  19. package/src/components/order-daily-overview/return-order-table/return-orders-filters/ReturnFilter.tsx +13 -2
  20. package/src/components/order-daily-overview/store/store.ts +1 -1
  21. package/src/components/order-daily-overview/table/ReturnTable.tsx +55 -22
  22. package/src/components/order-view/hooks/useGetEventNotes.tsx +1 -1
  23. package/src/components/order-view/order-details/expanded-content/services-section/ServiceLevel.tsx +1 -2
  24. package/src/index.tsx +15 -18
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.0.41",
2
+ "version": "0.0.42",
3
3
  "license": "MIT",
4
4
  "main": "dist/index.js",
5
5
  "typings": "dist/index.d.ts",
@@ -52,7 +52,7 @@ const Container = styled.div`
52
52
  display: flex;
53
53
  gap: 10px;
54
54
  align-items: center;
55
- cursor: not-allowed;
55
+ /* cursor: not-allowed; */
56
56
  flex: 1;
57
57
  `;
58
58
 
@@ -20,13 +20,12 @@ import {
20
20
  useSelectedAction,
21
21
  useSelectedClient,
22
22
  useSelectedLocation,
23
- useIdForTableName,
24
23
  useLoading,
25
- useTableName,
26
24
  } from '../store/store';
27
25
  import styled from 'styled-components';
28
26
  import { Select } from 'antd';
29
27
  import { useLocationOptions } from '../../order-view/store';
28
+ import { useNavigate, useSearchParams } from 'react-router-dom';
30
29
 
31
30
  export const clickedState = atom<boolean>(false);
32
31
 
@@ -39,15 +38,26 @@ function SelectionFilter() {
39
38
  setSelectedLocationValue,
40
39
  ] = useSelectedLocation();
41
40
  const [selectedClient, setSelectedClient] = useSelectedClient();
42
- const [, setClientIdForTable] = useIdForTableName();
43
41
  const [isButtonEnabled, setIsButtonEnabled] = useState(false);
44
42
  const [, setReturnPayload] = useReturnPayload();
45
43
  const [load] = useLoading();
46
- const [, setTableName] = useTableName();
47
44
  const [clearState, setClear] = useClearState();
48
45
  const [actionTypeOptions, setActionTypeOptions] = useActionTypeOptions();
49
46
  const [locationOptions, setLocationOptions] = useLocationOptions();
47
+ const [searchParams] = useSearchParams();
48
+ const navigate = useNavigate();
50
49
 
50
+ //new codee
51
+ const urlCustomerId = searchParams.get('customerId');
52
+ const urlActiontype = searchParams.get('type');
53
+
54
+ const selectedCustomer = customers?.find(
55
+ (customer: any) => customer?.customer_id.toString() === urlCustomerId
56
+ );
57
+
58
+ const accountNumber = selectedCustomer?.account_number;
59
+
60
+ //customer name
51
61
  const clientOptions = customers
52
62
  ?.filter(
53
63
  (option: any) => 'customer_id' in option && option.customer_id != null
@@ -64,16 +74,10 @@ function SelectionFilter() {
64
74
 
65
75
  //client change
66
76
  const handleClientChange = (value: any, option: any) => {
67
- // console.log(value, 'value');
68
77
  setSelectedClient(value);
69
78
 
70
- localStorage.setItem('clientName', option?.label);
71
- localStorage.setItem('clientId', value?.toString());
72
- localStorage.setItem('account_number', option?.account_number);
73
- const storedClientId = localStorage.getItem('clientId');
74
-
75
79
  const filteredClient = clientOptions?.find(
76
- (client: any) => client?.value == storedClientId
80
+ (client: any) => client?.value == value
77
81
  );
78
82
 
79
83
  if (filteredClient) {
@@ -100,38 +104,24 @@ function SelectionFilter() {
100
104
  setReturnPayload((prevState: any) => ({
101
105
  ...prevState,
102
106
  account_number: option?.account_number,
103
- customer_id: value,
107
+ customer_id: +value,
104
108
  }));
105
109
  };
106
110
 
107
- const storedName = localStorage.getItem('clientName');
108
- const storedClientId = localStorage.getItem('clientId');
109
- const storedAccountNumber = localStorage.getItem('account_number');
110
-
111
- useEffect(() => {
112
- if (storedClientId !== selectedClient) {
113
- localStorage.removeItem('clientDetails');
114
- localStorage.removeItem('clientActions');
115
- localStorage.removeItem('clientLocations');
116
- }
117
- }, [storedClientId]);
118
-
119
111
  useEffect(() => {
120
- if (storedClientId && storedAccountNumber) {
112
+ if (urlCustomerId && accountNumber) {
121
113
  setReturnPayload((prevState: any) => ({
122
114
  ...prevState,
123
- account_number: storedAccountNumber,
124
- customer_id: storedClientId,
115
+ account_number: accountNumber,
116
+ customer_id: +urlCustomerId,
125
117
  }));
126
118
  }
127
- }, [storedClientId, storedAccountNumber]);
119
+ }, [accountNumber, urlCustomerId]);
128
120
 
129
121
  useEffect(() => {
130
- const storedClientId = localStorage.getItem('clientId');
131
-
132
- if (storedClientId && clientOptions?.length > 0) {
122
+ if (urlCustomerId && clientOptions?.length > 0) {
133
123
  const filteredClient = clientOptions?.find(
134
- (client: any) => client?.value == storedClientId
124
+ (client: any) => client?.value == urlCustomerId
135
125
  );
136
126
 
137
127
  if (filteredClient) {
@@ -169,17 +159,18 @@ function SelectionFilter() {
169
159
  //Apply filters
170
160
  const applyFilters = () => {
171
161
  if (selectedClient) {
172
- setClientIdForTable(selectedClient);
173
- }
174
- if (storedName) {
175
- setTableName(storedName);
162
+ const queryParams = new URLSearchParams({
163
+ customerId: selectedClient?.toString(),
164
+ });
165
+
166
+ navigate(`/filter?${queryParams.toString()}`);
176
167
  }
168
+
177
169
  const selectedClientValue = clientOptions?.find(
178
170
  (client: any) => client?.value === selectedClient
179
171
  );
180
172
 
181
173
  const clientActions = selectedClientValue?.actions || [];
182
-
183
174
  const clientLocations = selectedClientValue?.return_locations || [];
184
175
 
185
176
  setActionTypeOptions(
@@ -201,10 +192,10 @@ function SelectionFilter() {
201
192
  );
202
193
 
203
194
  //client value
204
- if (storedClientId) {
195
+ if (urlCustomerId) {
205
196
  dispatch({
206
197
  type: 'SET_CLIENT_FILTER',
207
- payload: storedClientId,
198
+ payload: urlCustomerId,
208
199
  });
209
200
  dispatch({
210
201
  type: 'SET_PAGE',
@@ -240,24 +231,13 @@ function SelectionFilter() {
240
231
  }
241
232
  };
242
233
 
243
- // const storedName = localStorage.getItem('clientName');
244
-
245
234
  useEffect(() => {
246
- if (storedClientId) {
247
- dispatch({
248
- type: 'SET_CLIENT_FILTER',
249
- payload: storedClientId,
250
- });
251
- }
252
- }, []);
253
-
254
- useEffect(() => {
255
- if (storedClientId || selectedFilterValue || selectedLocationValue) {
235
+ if (selectedClient || selectedFilterValue || selectedLocationValue) {
256
236
  setIsButtonEnabled(true);
257
237
  } else {
258
238
  setIsButtonEnabled(false);
259
239
  }
260
- }, [storedClientId, selectedFilterValue, selectedLocationValue]);
240
+ }, [selectedClient, selectedFilterValue, selectedLocationValue]);
261
241
 
262
242
  useEffect(() => {}, [location.pathname]);
263
243
 
@@ -276,7 +256,7 @@ function SelectionFilter() {
276
256
 
277
257
  const handleClear = () => {
278
258
  setClear(false);
279
- localStorage.removeItem('clientDetails');
259
+ dispatch({ type: 'CLEAR_CLIENT' });
280
260
  setClear(true);
281
261
  };
282
262
 
@@ -287,6 +267,46 @@ function SelectionFilter() {
287
267
  }
288
268
  }, [clearState]);
289
269
 
270
+ useEffect(() => {
271
+ if (urlCustomerId && urlActiontype) {
272
+ dispatch({
273
+ type: 'SET_CLIENT_FILTER',
274
+ payload: urlCustomerId,
275
+ });
276
+ setSelectedClient(+urlCustomerId);
277
+
278
+ dispatch({
279
+ type: 'SET_ACTIONS_FILTER',
280
+ payload: urlActiontype,
281
+ });
282
+ setSelectedFilterValue(urlActiontype);
283
+
284
+ dispatch({
285
+ type: 'SET_PAGE',
286
+ payload: 1,
287
+ });
288
+ } else if (urlCustomerId) {
289
+ dispatch({
290
+ type: 'SET_CLIENT_FILTER',
291
+ payload: urlCustomerId,
292
+ });
293
+ setSelectedClient(+urlCustomerId);
294
+ dispatch({
295
+ type: 'SET_PAGE',
296
+ payload: 1,
297
+ });
298
+ }
299
+ }, [urlCustomerId]);
300
+
301
+ const handleClearAction = () => {
302
+ dispatch({ type: 'CLEAR_ACTION' });
303
+
304
+ const searchParams = new URLSearchParams(window.location.search);
305
+ searchParams.delete('type');
306
+
307
+ navigate(`?${searchParams.toString()}`, { replace: true });
308
+ };
309
+
290
310
  return (
291
311
  <Wrapper>
292
312
  <FilterRow>
@@ -297,40 +317,38 @@ function SelectionFilter() {
297
317
  options={clientOptions}
298
318
  placeholder="Select Client Name"
299
319
  onChange={handleClientChange}
300
- style={{ minWidth: '14vw' }}
301
- value={storedName}
320
+ style={{ minWidth: '150px' }}
321
+ value={selectedClient}
302
322
  allowClear
303
323
  onClear={handleClear}
304
324
  />
305
325
  </FilterColumn>
306
326
 
307
- {/* {storedName && location.pathname.includes(`filter/`) ? ( */}
308
- <>
309
- <FilterColumn>
310
- <Label>Action Type</Label>
311
- <StyledAntSelect
312
- options={actionTypeOptions}
313
- placeholder="Select Action Type"
314
- value={selectedFilterValue}
315
- onChange={handleActionClick}
316
- style={{ minWidth: '14vw' }}
317
- allowClear
318
- />
319
- </FilterColumn>
320
-
321
- <FilterColumn>
322
- <Label>Location </Label>
323
- <StyledAntSelect
324
- options={locationOptions}
325
- value={selectedLocationValue}
326
- placeholder="Select Location"
327
- onChange={handleLocationChange}
328
- style={{ minWidth: '14vw' }}
329
- allowClear
330
- mode="multiple"
331
- />
332
- </FilterColumn>
333
- </>
327
+ <FilterColumn>
328
+ <Label>Action Type</Label>
329
+ <StyledAntSelect
330
+ options={actionTypeOptions}
331
+ placeholder="Select Action Type"
332
+ value={selectedFilterValue}
333
+ onChange={handleActionClick}
334
+ style={{ minWidth: '150px' }}
335
+ allowClear
336
+ onClear={handleClearAction}
337
+ />
338
+ </FilterColumn>
339
+
340
+ <FilterColumn>
341
+ <Label>Location </Label>
342
+ <StyledAntSelect
343
+ options={locationOptions}
344
+ value={selectedLocationValue}
345
+ placeholder="Select Location"
346
+ onChange={handleLocationChange}
347
+ style={{ minWidth: '14vw' }}
348
+ allowClear
349
+ mode="multiple"
350
+ />
351
+ </FilterColumn>
334
352
  </LeftColumn>
335
353
  <RightColumn>
336
354
  <ApplyButton onClick={applyFilters} disabled={!isButtonEnabled}>
@@ -3,7 +3,6 @@ import {
3
3
  useItemsPerOverviewPage,
4
4
  useStatsLoading,
5
5
  UsePaginationOverviewData,
6
- useTableName,
7
6
  } from './store/store';
8
7
  import Filters from './filters/Filters';
9
8
  import styled from 'styled-components';
@@ -15,9 +14,9 @@ import { ClientData } from './common/interface';
15
14
  import ReturnFilter from './return-order-table/return-orders-filters/ReturnFilter';
16
15
  import { Text } from './filters/FilterStyle';
17
16
  import ReturnTable from './table/ReturnTable';
18
- import { notification } from 'antd';
19
17
  import { overviewfiltersReducerAtom } from './header-filters/overViewFilter';
20
18
  import Pagination from './table-view/Pagination';
19
+ import { notification } from 'antd';
21
20
 
22
21
  function ReturnMainTable() {
23
22
  const [state] = useAtom(overviewfiltersReducerAtom);
@@ -30,7 +29,10 @@ function ReturnMainTable() {
30
29
  const [isScrolled] = useStickyStatus();
31
30
  const [, setLoading] = useStatsLoading();
32
31
  const [, setClientData] = useClientData();
33
- const [tableName] = useTableName();
32
+ // const [tableName] = useTableName();
33
+ const queryParams = new URLSearchParams(location.search);
34
+
35
+ const customerId = queryParams.get('customerId');
34
36
 
35
37
  const handlePageChange = (page: number) => {
36
38
  setCurrentPage(page);
@@ -78,7 +80,7 @@ function ReturnMainTable() {
78
80
  <Container>
79
81
  <Row>
80
82
  <Text>Client Return</Text>
81
- {tableName ? <ReturnFilter /> : <Filters />}
83
+ {customerId ? <ReturnFilter /> : <Filters />}
82
84
  </Row>
83
85
  <ReturnTable />
84
86
  </Container>
@@ -54,29 +54,73 @@ const filterReducer = (state: FilterState, action: any): FilterState => {
54
54
  };
55
55
 
56
56
  case 'SET_CLIENT_FILTER':
57
+ if (action.payload) {
58
+ return {
59
+ ...state,
60
+ 'x-filters': [
61
+ ...state['x-filters'].filter(f => f.field !== 'customer_id'),
62
+ {
63
+ field: 'customer_id',
64
+ op: '=',
65
+ value: action.payload,
66
+ },
67
+ ],
68
+ };
69
+ } else {
70
+ return {
71
+ ...state,
72
+ 'x-filters': state['x-filters'].filter(
73
+ f => f.field !== 'customer_id'
74
+ ),
75
+ };
76
+ }
77
+
78
+ case 'CLEAR_CLIENT_FILTER':
57
79
  return {
58
80
  ...state,
59
- 'x-filters': [
60
- ...state['x-filters'].filter(f => f.field !== 'customer_id'),
61
- {
62
- field: 'customer_id',
63
- op: '=',
64
- value: action.payload,
65
- },
66
- ],
81
+ 'x-filters': state['x-filters'].filter(f => f.field !== 'customer_id'),
67
82
  };
68
83
 
69
84
  case 'SET_STATUS_ORDER_FILTER':
85
+ if (action.payload) {
86
+ return {
87
+ ...state,
88
+ 'x-filters': [
89
+ ...state['x-filters'].filter(f => f.field !== 'status_id'),
90
+ {
91
+ field: 'status_id',
92
+ op: '=',
93
+ value: action.payload,
94
+ },
95
+ ],
96
+ };
97
+ } else {
98
+ return {
99
+ ...state,
100
+ 'x-filters': state['x-filters'].filter(f => f.field !== 'status_id'),
101
+ };
102
+ }
103
+
104
+ case 'SET_ASSIGNEE_FILTER':
105
+ return {
106
+ ...state,
107
+ 'x-filters': action.payload !== null
108
+ ? [
109
+ ...state['x-filters'].filter(f => f.field !== 'bjs_delivery'),
110
+ {
111
+ field: 'bjs_delivery',
112
+ op: '=',
113
+ value: action.payload,
114
+ },
115
+ ]
116
+ : state['x-filters'].filter(f => f.field !== 'bjs_delivery'),
117
+ };
118
+
119
+
120
+ case 'CLEAR_STATUS_ORDER_FILTER':
70
121
  return {
71
122
  ...state,
72
- 'x-filters': [
73
- ...state['x-filters'].filter(f => f.field !== 'status_id'),
74
- {
75
- field: 'status_id',
76
- op: '=',
77
- value: action.payload,
78
- },
79
- ],
123
+ 'x-filters': state['x-filters'].filter(f => f.field !== 'status_id'),
80
124
  };
81
125
 
82
126
  // case 'CLEAR_CLIENT':
@@ -14,7 +14,11 @@ import { DatePicker, Select } from 'antd';
14
14
  import { useAtom } from '../../../order-view/store';
15
15
  import styled from 'styled-components';
16
16
  import dayjs from 'dayjs';
17
- import { useCustomerData, useStatusOrderData } from '../../../store';
17
+ import {
18
+ useAssignData,
19
+ useCustomerData,
20
+ useStatusOrderData,
21
+ } from '../../../store';
18
22
  import StatusIcon from '../../../../assets/icons/StatusIcon';
19
23
  import AssigneIcon from '../../../../assets/icons/AssigneIcon';
20
24
  import {
@@ -30,14 +34,9 @@ const ReturnOrderFilter = () => {
30
34
  const [statusOfOrder] = useStatusOrderData();
31
35
  const [selectedClient, setSelectedClient] = useState<any | null>();
32
36
  const [statusOrder, setStatusOfOrder] = useState<any | null>();
37
+ const [selectedAssignee, setSelectedAssignee] = useState<any | null>();
38
+ const [assignData] = useAssignData();
33
39
 
34
- const zoneOptions = [
35
- { label: 'Zone 1', value: 'zone1' },
36
- { label: 'Zone 2', value: 'zone2' },
37
- { label: 'Zone 3', value: 'zone3' },
38
- { label: 'Zone 4', value: 'zone4' },
39
- { label: 'Zone 5', value: 'zone5' },
40
- ];
41
40
  // date change here
42
41
  const handleDateChange = (date: any | null) => {
43
42
  setSelectedDate(date ? date?.$d : null);
@@ -95,13 +94,56 @@ const ReturnOrderFilter = () => {
95
94
  payload: 1,
96
95
  });
97
96
  };
97
+
98
+ const handleAssigneeChange = (value: any) => {
99
+ const bjsDeliveryValue = assignData.find(client => client.id === value)
100
+ ?.bjs_delivery;
101
+ if (bjsDeliveryValue === undefined) return;
102
+ setSelectedAssignee(value);
103
+ dispatch({
104
+ type: 'SET_ASSIGNEE_FILTER',
105
+ payload: bjsDeliveryValue,
106
+ });
107
+ dispatch({
108
+ type: 'SET_PAGE',
109
+ payload: 1,
110
+ });
111
+ };
112
+
113
+ const handleClearAssignee = () => {
114
+ setSelectedAssignee(null);
115
+ dispatch({
116
+ type: 'SET_ASSIGNEE_FILTER',
117
+ payload: null,
118
+ });
119
+ dispatch({
120
+ type: 'SET_PAGE',
121
+ payload: 1,
122
+ });
123
+ };
124
+
98
125
  const handleClearAll = () => {
99
126
  setSelectedDate(null);
100
127
  setSelectedClient(null);
101
128
  setStatusOfOrder(null);
129
+ setSelectedAssignee(null);
102
130
  dispatch({ type: 'CLEAR_ALL_FILTER' });
103
131
  };
104
132
 
133
+ const handleClear = () => {
134
+ dispatch({
135
+ type: 'CLEAR_STATUS_ORDER_FILTER',
136
+ });
137
+
138
+ setStatusOfOrder(null);
139
+ };
140
+
141
+ const handleClearClient = () => {
142
+ dispatch({
143
+ type: 'CLEAR_CLIENT_FILTER',
144
+ });
145
+ setSelectedClient(null);
146
+ };
105
147
  //clearing filters
106
148
  useEffect(() => {
107
149
  if (selectedDate === null) {
@@ -149,8 +191,8 @@ const ReturnOrderFilter = () => {
149
191
  onChange={handleStatusOfOrder}
150
192
  style={{ minWidth: '130px' }}
151
193
  value={statusOrder}
152
- // allowClear
153
- // onClear={handleClearStatus}
194
+ onClear={handleClear}
195
+ allowClear
154
196
  />
155
197
  </StyledAntSelect>
156
198
  </div>
@@ -166,29 +208,37 @@ const ReturnOrderFilter = () => {
166
208
  onChange={handleClientChange}
167
209
  value={selectedClient}
168
210
  style={{ width: '125px', border: 'none' }}
169
- // allowClear
211
+ allowClear
212
+ onClear={handleClearClient}
170
213
  />
171
214
  </StyledAntSelect>
172
215
  </div>
173
- <div
174
- className="datefilter"
175
- style={{ pointerEvents: 'none', opacity: 0.5 }}
176
- >
216
+
217
+ <div className="datefilter">
177
218
  <div className="dateiconcontainer">
178
219
  <AssigneIcon />
179
220
  </div>
180
221
  <StyledAntSelect>
181
222
  <Select
182
- options={zoneOptions}
223
+ options={assignData?.map(client => ({
224
+ label: client.type,
225
+ value: client.id,
226
+ }))}
183
227
  className="custom-select"
184
- placeholder="Asignee"
185
- onChange={() => {}}
228
+ placeholder="Assignee"
229
+ onChange={handleAssigneeChange}
230
+ value={selectedAssignee}
186
231
  style={{ minWidth: '100px' }}
187
- disabled
232
+ allowClear
233
+ onClear={handleClearAssignee}
188
234
  />
189
235
  </StyledAntSelect>
190
236
  </div>
191
- {selectedDate || statusOrder || selectedClient ? (
237
+
238
+ {selectedDate ||
239
+ statusOrder ||
240
+ selectedClient ||
241
+ selectedAssignee ? (
192
242
  <>
193
243
  <ClearAll onClick={handleClearAll}>
194
244
  <StyledFilterBtnIcon>
@@ -8,12 +8,13 @@ import ReturnOrderTable from './return-orders-filters/ReturnOrderTable';
8
8
  import ModalManager from '../../order-view/modalsPopup/ModalManager';
9
9
  import { useItemsPerPage, UsePaginationData } from '../store/store';
10
10
  import Pagination from '../table-view/Pagination';
11
+ // import { useLocation } from 'react-router-dom';
11
12
 
12
13
  const ReturnTable = () => {
13
14
  const [paginationObj] = UsePaginationData();
14
15
  const [, setCurrentPage] = useState(1);
15
16
  const [itemsPerPage, setItemsPerPage] = useItemsPerPage();
16
-
17
+ // const location = useLocation();
17
18
  const { page, total } = paginationObj;
18
19
 
19
20
  const handlePageChange = (page: number) => {
@@ -23,6 +24,12 @@ const ReturnTable = () => {
23
24
  setItemsPerPage(itemsPerPage);
24
25
  };
25
26
 
27
+ // useEffect(() => {
28
+ // const queryParams = new URLSearchParams(location.search);
29
+
30
+ // const clientId = queryParams.get('customerId');
31
+ // }, [location]);
32
+
26
33
  return (
27
34
  <div>
28
35
  <DashBoardWrapper>
@@ -6,14 +6,25 @@ import {
6
6
  Text,
7
7
  } from '../../filters/FilterStyle';
8
8
  import RightFilters from './RightFilters';
9
+ import { useCustomerData } from '../../../store';
9
10
 
10
11
  const ReturnFilter = () => {
11
- const storedName = localStorage.getItem('clientName');
12
+ const [customers] = useCustomerData();
13
+
14
+ const queryParams = new URLSearchParams(location.search);
15
+ const customerId = queryParams.get('customerId');
16
+
17
+ const selectedCustomer = customers?.find(
18
+ (customer: any) => customer?.customer_id?.toString() === customerId
19
+ );
20
+
21
+ const customerName = selectedCustomer?.customer_name;
22
+ // const accountNumber = selectedCustomer?.account_number;
12
23
 
13
24
  return (
14
25
  <>
15
26
  <StyledFiter>
16
- <Text>{storedName}</Text>
27
+ <Text>{customerName}</Text>
17
28
  <StyledFIlterELements>
18
29
  <StyledTableFilter />
19
30
  </StyledFIlterELements>
@@ -47,7 +47,7 @@ export const useLoading = () => {
47
47
  return useAtom(loadingState);
48
48
  };
49
49
 
50
- const selectedAction = atom<number | null>(null);
50
+ const selectedAction = atom<string | null>(null);
51
51
  export function useSelectedAction() {
52
52
  return useAtom(selectedAction);
53
53
  }