@bjsdistribution/dms-client-return 0.0.41 → 0.0.43
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.
- package/dist/common/date-picker/header/ClearDate.d.ts +1 -1
- package/dist/components/order-daily-overview/store/store.d.ts +1 -1
- package/dist/components/order-daily-overview/table/table-data/styles.d.ts +3 -3
- package/dist/components/order-daily-overview/table-view/TableStyle.d.ts +4 -4
- package/dist/components/order-view/view-reminder/reminder-styles.d.ts +2 -2
- package/dist/dms-client-return.cjs.development.js +303 -156
- package/dist/dms-client-return.cjs.development.js.map +1 -1
- package/dist/dms-client-return.cjs.production.min.js +1 -1
- package/dist/dms-client-return.cjs.production.min.js.map +1 -1
- package/dist/dms-client-return.esm.js +304 -157
- package/dist/dms-client-return.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/common/services-slider/ServiceSlider.tsx +1 -1
- package/src/components/order-daily-overview/header-filters/SelectionFilter.tsx +103 -82
- package/src/components/order-daily-overview/index.tsx +6 -4
- package/src/components/order-daily-overview/return-after-table/table-filters/ReturnFilterStore.ts +60 -16
- package/src/components/order-daily-overview/return-after-table/table-filters/ReturnOrderFilter.tsx +70 -20
- package/src/components/order-daily-overview/return-order-table/ReturnTable.tsx +8 -1
- package/src/components/order-daily-overview/return-order-table/return-orders-filters/ReturnFilter.tsx +13 -2
- package/src/components/order-daily-overview/store/store.ts +1 -1
- package/src/components/order-daily-overview/table/ReturnTable.tsx +55 -22
- package/src/components/order-view/hooks/useGetEventNotes.tsx +1 -1
- package/src/components/order-view/order-details/expanded-content/services-section/ServiceLevel.tsx +1 -2
- package/src/index.tsx +15 -18
package/package.json
CHANGED
|
@@ -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 ==
|
|
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 (
|
|
112
|
+
if (urlCustomerId && accountNumber) {
|
|
121
113
|
setReturnPayload((prevState: any) => ({
|
|
122
114
|
...prevState,
|
|
123
|
-
account_number:
|
|
124
|
-
customer_id:
|
|
115
|
+
account_number: accountNumber,
|
|
116
|
+
customer_id: +urlCustomerId,
|
|
125
117
|
}));
|
|
126
118
|
}
|
|
127
|
-
}, [
|
|
119
|
+
}, [accountNumber, urlCustomerId]);
|
|
128
120
|
|
|
129
121
|
useEffect(() => {
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
if (storedClientId && clientOptions?.length > 0) {
|
|
122
|
+
if (urlCustomerId && clientOptions?.length > 0) {
|
|
133
123
|
const filteredClient = clientOptions?.find(
|
|
134
|
-
(client: any) => client?.value ==
|
|
124
|
+
(client: any) => client?.value == urlCustomerId
|
|
135
125
|
);
|
|
136
126
|
|
|
137
127
|
if (filteredClient) {
|
|
@@ -169,17 +159,21 @@ function SelectionFilter() {
|
|
|
169
159
|
//Apply filters
|
|
170
160
|
const applyFilters = () => {
|
|
171
161
|
if (selectedClient) {
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
162
|
+
const queryParams = new URLSearchParams({
|
|
163
|
+
customerId: selectedClient?.toString(),
|
|
164
|
+
});
|
|
165
|
+
//for dev
|
|
166
|
+
navigate(`filter?${queryParams.toString()}`);
|
|
167
|
+
|
|
168
|
+
//for local
|
|
169
|
+
//navigate(`/filter?${queryParams.toString()}`);
|
|
176
170
|
}
|
|
171
|
+
|
|
177
172
|
const selectedClientValue = clientOptions?.find(
|
|
178
173
|
(client: any) => client?.value === selectedClient
|
|
179
174
|
);
|
|
180
175
|
|
|
181
176
|
const clientActions = selectedClientValue?.actions || [];
|
|
182
|
-
|
|
183
177
|
const clientLocations = selectedClientValue?.return_locations || [];
|
|
184
178
|
|
|
185
179
|
setActionTypeOptions(
|
|
@@ -201,10 +195,10 @@ function SelectionFilter() {
|
|
|
201
195
|
);
|
|
202
196
|
|
|
203
197
|
//client value
|
|
204
|
-
if (
|
|
198
|
+
if (urlCustomerId) {
|
|
205
199
|
dispatch({
|
|
206
200
|
type: 'SET_CLIENT_FILTER',
|
|
207
|
-
payload:
|
|
201
|
+
payload: urlCustomerId,
|
|
208
202
|
});
|
|
209
203
|
dispatch({
|
|
210
204
|
type: 'SET_PAGE',
|
|
@@ -240,24 +234,13 @@ function SelectionFilter() {
|
|
|
240
234
|
}
|
|
241
235
|
};
|
|
242
236
|
|
|
243
|
-
// const storedName = localStorage.getItem('clientName');
|
|
244
|
-
|
|
245
237
|
useEffect(() => {
|
|
246
|
-
if (
|
|
247
|
-
dispatch({
|
|
248
|
-
type: 'SET_CLIENT_FILTER',
|
|
249
|
-
payload: storedClientId,
|
|
250
|
-
});
|
|
251
|
-
}
|
|
252
|
-
}, []);
|
|
253
|
-
|
|
254
|
-
useEffect(() => {
|
|
255
|
-
if (storedClientId || selectedFilterValue || selectedLocationValue) {
|
|
238
|
+
if (selectedClient || selectedFilterValue || selectedLocationValue) {
|
|
256
239
|
setIsButtonEnabled(true);
|
|
257
240
|
} else {
|
|
258
241
|
setIsButtonEnabled(false);
|
|
259
242
|
}
|
|
260
|
-
}, [
|
|
243
|
+
}, [selectedClient, selectedFilterValue, selectedLocationValue]);
|
|
261
244
|
|
|
262
245
|
useEffect(() => {}, [location.pathname]);
|
|
263
246
|
|
|
@@ -276,7 +259,7 @@ function SelectionFilter() {
|
|
|
276
259
|
|
|
277
260
|
const handleClear = () => {
|
|
278
261
|
setClear(false);
|
|
279
|
-
|
|
262
|
+
dispatch({ type: 'CLEAR_CLIENT' });
|
|
280
263
|
setClear(true);
|
|
281
264
|
};
|
|
282
265
|
|
|
@@ -287,6 +270,46 @@ function SelectionFilter() {
|
|
|
287
270
|
}
|
|
288
271
|
}, [clearState]);
|
|
289
272
|
|
|
273
|
+
useEffect(() => {
|
|
274
|
+
if (urlCustomerId && urlActiontype) {
|
|
275
|
+
dispatch({
|
|
276
|
+
type: 'SET_CLIENT_FILTER',
|
|
277
|
+
payload: urlCustomerId,
|
|
278
|
+
});
|
|
279
|
+
setSelectedClient(+urlCustomerId);
|
|
280
|
+
|
|
281
|
+
dispatch({
|
|
282
|
+
type: 'SET_ACTIONS_FILTER',
|
|
283
|
+
payload: urlActiontype,
|
|
284
|
+
});
|
|
285
|
+
setSelectedFilterValue(urlActiontype);
|
|
286
|
+
|
|
287
|
+
dispatch({
|
|
288
|
+
type: 'SET_PAGE',
|
|
289
|
+
payload: 1,
|
|
290
|
+
});
|
|
291
|
+
} else if (urlCustomerId) {
|
|
292
|
+
dispatch({
|
|
293
|
+
type: 'SET_CLIENT_FILTER',
|
|
294
|
+
payload: urlCustomerId,
|
|
295
|
+
});
|
|
296
|
+
setSelectedClient(+urlCustomerId);
|
|
297
|
+
dispatch({
|
|
298
|
+
type: 'SET_PAGE',
|
|
299
|
+
payload: 1,
|
|
300
|
+
});
|
|
301
|
+
}
|
|
302
|
+
}, [urlCustomerId]);
|
|
303
|
+
|
|
304
|
+
const handleClearAction = () => {
|
|
305
|
+
dispatch({ type: 'CLEAR_ACTION' });
|
|
306
|
+
|
|
307
|
+
const searchParams = new URLSearchParams(window.location.search);
|
|
308
|
+
searchParams.delete('type');
|
|
309
|
+
|
|
310
|
+
navigate(`?${searchParams.toString()}`, { replace: true });
|
|
311
|
+
};
|
|
312
|
+
|
|
290
313
|
return (
|
|
291
314
|
<Wrapper>
|
|
292
315
|
<FilterRow>
|
|
@@ -297,40 +320,38 @@ function SelectionFilter() {
|
|
|
297
320
|
options={clientOptions}
|
|
298
321
|
placeholder="Select Client Name"
|
|
299
322
|
onChange={handleClientChange}
|
|
300
|
-
style={{ minWidth: '
|
|
301
|
-
value={
|
|
323
|
+
style={{ minWidth: '150px' }}
|
|
324
|
+
value={selectedClient}
|
|
302
325
|
allowClear
|
|
303
326
|
onClear={handleClear}
|
|
304
327
|
/>
|
|
305
328
|
</FilterColumn>
|
|
306
329
|
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
<
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
<
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
</FilterColumn>
|
|
333
|
-
</>
|
|
330
|
+
<FilterColumn>
|
|
331
|
+
<Label>Action Type</Label>
|
|
332
|
+
<StyledAntSelect
|
|
333
|
+
options={actionTypeOptions}
|
|
334
|
+
placeholder="Select Action Type"
|
|
335
|
+
value={selectedFilterValue}
|
|
336
|
+
onChange={handleActionClick}
|
|
337
|
+
style={{ minWidth: '150px' }}
|
|
338
|
+
allowClear
|
|
339
|
+
onClear={handleClearAction}
|
|
340
|
+
/>
|
|
341
|
+
</FilterColumn>
|
|
342
|
+
|
|
343
|
+
<FilterColumn>
|
|
344
|
+
<Label>Location </Label>
|
|
345
|
+
<StyledAntSelect
|
|
346
|
+
options={locationOptions}
|
|
347
|
+
value={selectedLocationValue}
|
|
348
|
+
placeholder="Select Location"
|
|
349
|
+
onChange={handleLocationChange}
|
|
350
|
+
style={{ minWidth: '14vw' }}
|
|
351
|
+
allowClear
|
|
352
|
+
mode="multiple"
|
|
353
|
+
/>
|
|
354
|
+
</FilterColumn>
|
|
334
355
|
</LeftColumn>
|
|
335
356
|
<RightColumn>
|
|
336
357
|
<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
|
-
{
|
|
83
|
+
{customerId ? <ReturnFilter /> : <Filters />}
|
|
82
84
|
</Row>
|
|
83
85
|
<ReturnTable />
|
|
84
86
|
</Container>
|
package/src/components/order-daily-overview/return-after-table/table-filters/ReturnFilterStore.ts
CHANGED
|
@@ -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':
|
package/src/components/order-daily-overview/return-after-table/table-filters/ReturnOrderFilter.tsx
CHANGED
|
@@ -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 {
|
|
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
|
-
|
|
153
|
-
|
|
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
|
-
|
|
211
|
+
allowClear
|
|
212
|
+
onClear={handleClearClient}
|
|
170
213
|
/>
|
|
171
214
|
</StyledAntSelect>
|
|
172
215
|
</div>
|
|
173
|
-
|
|
174
|
-
|
|
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={
|
|
223
|
+
options={assignData?.map(client => ({
|
|
224
|
+
label: client.type,
|
|
225
|
+
value: client.id,
|
|
226
|
+
}))}
|
|
183
227
|
className="custom-select"
|
|
184
|
-
placeholder="
|
|
185
|
-
onChange={
|
|
228
|
+
placeholder="Assignee"
|
|
229
|
+
onChange={handleAssigneeChange}
|
|
230
|
+
value={selectedAssignee}
|
|
186
231
|
style={{ minWidth: '100px' }}
|
|
187
|
-
|
|
232
|
+
allowClear
|
|
233
|
+
onClear={handleClearAssignee}
|
|
188
234
|
/>
|
|
189
235
|
</StyledAntSelect>
|
|
190
236
|
</div>
|
|
191
|
-
|
|
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
|
|
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>{
|
|
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<
|
|
50
|
+
const selectedAction = atom<string | null>(null);
|
|
51
51
|
export function useSelectedAction() {
|
|
52
52
|
return useAtom(selectedAction);
|
|
53
53
|
}
|