@bjsdistribution/dms-client-return 0.0.40 → 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.
- package/dist/components/order-daily-overview/store/store.d.ts +1 -1
- package/dist/dms-client-return.cjs.development.js +302 -137
- 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 +303 -138
- package/dist/dms-client-return.esm.js.map +1 -1
- package/package.json +2 -2
- package/src/common/services-slider/ServiceSlider.tsx +1 -1
- package/src/components/order-daily-overview/header-filters/SelectionFilter.tsx +122 -79
- 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/modalsPopup/ModalManager.tsx +5 -4
- 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
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.0.
|
|
2
|
+
"version": "0.0.42",
|
|
3
3
|
"license": "MIT",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"typings": "dist/index.d.ts",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"testEnvironment": "jest-environment-jsdom-sixteen"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
|
-
"@bjsdistribution/dms-component-library": "0.1.
|
|
62
|
+
"@bjsdistribution/dms-component-library": "0.1.11",
|
|
63
63
|
"@size-limit/preset-small-lib": "^11.0.1",
|
|
64
64
|
"@tippyjs/react": "^4.2.6",
|
|
65
65
|
"@types/react": "^18.2.47",
|
|
@@ -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,49 +74,54 @@ 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
|
-
|
|
71
|
-
|
|
72
|
-
|
|
79
|
+
const filteredClient = clientOptions?.find(
|
|
80
|
+
(client: any) => client?.value == value
|
|
81
|
+
);
|
|
82
|
+
|
|
83
|
+
if (filteredClient) {
|
|
84
|
+
const mappedActions = Array.isArray(filteredClient?.actions)
|
|
85
|
+
? filteredClient?.actions?.map((action: any) => ({
|
|
86
|
+
label: action,
|
|
87
|
+
value: action,
|
|
88
|
+
}))
|
|
89
|
+
: [];
|
|
90
|
+
|
|
91
|
+
setActionTypeOptions(mappedActions);
|
|
92
|
+
|
|
93
|
+
const mappedLocations = Array.isArray(filteredClient?.return_locations)
|
|
94
|
+
? filteredClient?.return_locations?.map((location: any) => ({
|
|
95
|
+
label: location?.location_name,
|
|
96
|
+
value: location?.token,
|
|
97
|
+
}))
|
|
98
|
+
: [];
|
|
99
|
+
|
|
100
|
+
setLocationOptions(mappedLocations);
|
|
101
|
+
}
|
|
73
102
|
|
|
74
103
|
//set payload
|
|
75
104
|
setReturnPayload((prevState: any) => ({
|
|
76
105
|
...prevState,
|
|
77
106
|
account_number: option?.account_number,
|
|
78
|
-
customer_id: value,
|
|
107
|
+
customer_id: +value,
|
|
79
108
|
}));
|
|
80
109
|
};
|
|
81
110
|
|
|
82
|
-
const storedName = localStorage.getItem('clientName');
|
|
83
|
-
const storedClientId = localStorage.getItem('clientId');
|
|
84
|
-
const storedAccountNumber = localStorage.getItem('account_number');
|
|
85
|
-
|
|
86
|
-
useEffect(() => {
|
|
87
|
-
if (storedClientId !== selectedClient) {
|
|
88
|
-
localStorage.removeItem('clientDetails');
|
|
89
|
-
localStorage.removeItem('clientActions');
|
|
90
|
-
localStorage.removeItem('clientLocations');
|
|
91
|
-
}
|
|
92
|
-
}, [storedClientId]);
|
|
93
|
-
|
|
94
111
|
useEffect(() => {
|
|
95
|
-
if (
|
|
112
|
+
if (urlCustomerId && accountNumber) {
|
|
96
113
|
setReturnPayload((prevState: any) => ({
|
|
97
114
|
...prevState,
|
|
98
|
-
account_number:
|
|
99
|
-
customer_id:
|
|
115
|
+
account_number: accountNumber,
|
|
116
|
+
customer_id: +urlCustomerId,
|
|
100
117
|
}));
|
|
101
118
|
}
|
|
102
|
-
}, [
|
|
119
|
+
}, [accountNumber, urlCustomerId]);
|
|
103
120
|
|
|
104
121
|
useEffect(() => {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
if (storedClientId && clientOptions?.length > 0) {
|
|
122
|
+
if (urlCustomerId && clientOptions?.length > 0) {
|
|
108
123
|
const filteredClient = clientOptions?.find(
|
|
109
|
-
(client: any) => client?.value ==
|
|
124
|
+
(client: any) => client?.value == urlCustomerId
|
|
110
125
|
);
|
|
111
126
|
|
|
112
127
|
if (filteredClient) {
|
|
@@ -144,17 +159,18 @@ function SelectionFilter() {
|
|
|
144
159
|
//Apply filters
|
|
145
160
|
const applyFilters = () => {
|
|
146
161
|
if (selectedClient) {
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
162
|
+
const queryParams = new URLSearchParams({
|
|
163
|
+
customerId: selectedClient?.toString(),
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
navigate(`/filter?${queryParams.toString()}`);
|
|
151
167
|
}
|
|
168
|
+
|
|
152
169
|
const selectedClientValue = clientOptions?.find(
|
|
153
170
|
(client: any) => client?.value === selectedClient
|
|
154
171
|
);
|
|
155
172
|
|
|
156
173
|
const clientActions = selectedClientValue?.actions || [];
|
|
157
|
-
|
|
158
174
|
const clientLocations = selectedClientValue?.return_locations || [];
|
|
159
175
|
|
|
160
176
|
setActionTypeOptions(
|
|
@@ -176,10 +192,10 @@ function SelectionFilter() {
|
|
|
176
192
|
);
|
|
177
193
|
|
|
178
194
|
//client value
|
|
179
|
-
if (
|
|
195
|
+
if (urlCustomerId) {
|
|
180
196
|
dispatch({
|
|
181
197
|
type: 'SET_CLIENT_FILTER',
|
|
182
|
-
payload:
|
|
198
|
+
payload: urlCustomerId,
|
|
183
199
|
});
|
|
184
200
|
dispatch({
|
|
185
201
|
type: 'SET_PAGE',
|
|
@@ -215,24 +231,13 @@ function SelectionFilter() {
|
|
|
215
231
|
}
|
|
216
232
|
};
|
|
217
233
|
|
|
218
|
-
// const storedName = localStorage.getItem('clientName');
|
|
219
|
-
|
|
220
234
|
useEffect(() => {
|
|
221
|
-
if (
|
|
222
|
-
dispatch({
|
|
223
|
-
type: 'SET_CLIENT_FILTER',
|
|
224
|
-
payload: storedClientId,
|
|
225
|
-
});
|
|
226
|
-
}
|
|
227
|
-
}, []);
|
|
228
|
-
|
|
229
|
-
useEffect(() => {
|
|
230
|
-
if (storedClientId || selectedFilterValue || selectedLocationValue) {
|
|
235
|
+
if (selectedClient || selectedFilterValue || selectedLocationValue) {
|
|
231
236
|
setIsButtonEnabled(true);
|
|
232
237
|
} else {
|
|
233
238
|
setIsButtonEnabled(false);
|
|
234
239
|
}
|
|
235
|
-
}, [
|
|
240
|
+
}, [selectedClient, selectedFilterValue, selectedLocationValue]);
|
|
236
241
|
|
|
237
242
|
useEffect(() => {}, [location.pathname]);
|
|
238
243
|
|
|
@@ -251,7 +256,7 @@ function SelectionFilter() {
|
|
|
251
256
|
|
|
252
257
|
const handleClear = () => {
|
|
253
258
|
setClear(false);
|
|
254
|
-
|
|
259
|
+
dispatch({ type: 'CLEAR_CLIENT' });
|
|
255
260
|
setClear(true);
|
|
256
261
|
};
|
|
257
262
|
|
|
@@ -262,6 +267,46 @@ function SelectionFilter() {
|
|
|
262
267
|
}
|
|
263
268
|
}, [clearState]);
|
|
264
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
|
+
|
|
265
310
|
return (
|
|
266
311
|
<Wrapper>
|
|
267
312
|
<FilterRow>
|
|
@@ -272,40 +317,38 @@ function SelectionFilter() {
|
|
|
272
317
|
options={clientOptions}
|
|
273
318
|
placeholder="Select Client Name"
|
|
274
319
|
onChange={handleClientChange}
|
|
275
|
-
style={{ minWidth: '
|
|
276
|
-
value={
|
|
320
|
+
style={{ minWidth: '150px' }}
|
|
321
|
+
value={selectedClient}
|
|
277
322
|
allowClear
|
|
278
323
|
onClear={handleClear}
|
|
279
324
|
/>
|
|
280
325
|
</FilterColumn>
|
|
281
326
|
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
<
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
<
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
</FilterColumn>
|
|
308
|
-
</>
|
|
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>
|
|
309
352
|
</LeftColumn>
|
|
310
353
|
<RightColumn>
|
|
311
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
|
-
{
|
|
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
|
}
|