@bjsdistribution/dms-client-return 0.0.32 → 0.0.34
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 +3 -0
- package/dist/components/order-view/notes/order-dropdown/NewReturnDropdown.d.ts +3 -0
- package/dist/components/store.d.ts +12 -2
- package/dist/components/types.d.ts +4 -0
- package/dist/dms-client-return.cjs.development.js +973 -2192
- 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 +981 -2200
- package/dist/dms-client-return.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/order-daily-overview/header-filters/SelectionFilter.tsx +118 -139
- package/src/components/order-daily-overview/header-filters/filterStore.ts +4 -4
- package/src/components/order-daily-overview/index.tsx +29 -25
- package/src/components/order-daily-overview/return-after-table/ReturnAfterTable.tsx +14 -10
- package/src/components/order-daily-overview/return-after-table/table/OrderTable.tsx +88 -32
- package/src/components/order-daily-overview/return-after-table/table-filters/ReturnFilterStore.ts +18 -2
- package/src/components/order-daily-overview/return-after-table/table-filters/ReturnOrderFilter.tsx +18 -7
- package/src/components/order-daily-overview/return-order-table/return-orders-filters/ReturnFilter.tsx +2 -3
- package/src/components/order-daily-overview/return-order-table/return-orders-filters/ReturnOrderTable.tsx +6 -4
- package/src/components/order-daily-overview/return-order-table/return-orders-filters/returnstyles.ts +4 -3
- package/src/components/order-daily-overview/store/store.ts +15 -0
- package/src/components/order-daily-overview/table/ReturnTable.tsx +16 -11
- package/src/components/order-daily-overview/table/table-data/styles.ts +2 -2
- package/src/components/order-view/details-filters/left-side-filters/dropdowns/MenuDropDown.tsx +5 -9
- package/src/components/order-view/details-filters/left-side-filters/dropdowns/OptionsDropDown.tsx +3 -3
- package/src/components/order-view/details-filters/left-side-filters/dropdowns/PrintDropDownReturn.tsx +1 -1
- package/src/components/order-view/general-information/Status.tsx +1 -1
- package/src/components/order-view/general-information/dropdowns/Print.tsx +1 -1
- package/src/components/order-view/modalsPopup/ModalManager.tsx +4 -151
- package/src/components/order-view/notes/order-dropdown/NewReturnDropdown.tsx +88 -13
- package/src/components/order-view/order-actions/actions/split-order/SplitOrderTable.tsx +2 -2
- package/src/components/order-view/order-actions/index.tsx +0 -9
- package/src/components/order-view/order-details/expanded-content/footer/index.tsx +1 -0
- package/src/components/order-view/products-info/expanded-content/index.tsx +91 -16
- package/src/components/order-view/products-info/index.tsx +1 -1
- package/src/components/order-view/return-client-products/product-table/ReturnProductTable.tsx +47 -42
- package/src/components/order-view/store.ts +6 -1
- package/src/components/store.ts +51 -1
- package/src/components/types.ts +5 -0
- package/src/index.tsx +25 -16
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import React, { useEffect, useRef } from 'react';
|
|
1
|
+
import { Empty, notification, Select } from 'antd';
|
|
2
|
+
import React, { useEffect, useRef, useState } from 'react';
|
|
4
3
|
import { Skeleton } from 'antd';
|
|
5
4
|
// import { useSelectedOrders } from '../../../store';
|
|
6
5
|
import { useOrderId, useReturnAfterOrderData } from '../../../order-view/store';
|
|
@@ -17,18 +16,28 @@ import { usePrintOptionTOggle } from '../../store/store';
|
|
|
17
16
|
import { NavLink } from 'react-router-dom';
|
|
18
17
|
import { displayValueOrNA, formatDate } from '../../shared/utlis';
|
|
19
18
|
import PrintDropDown from '../../shared/elements/PrintDropDown';
|
|
19
|
+
import {
|
|
20
|
+
useAssignData,
|
|
21
|
+
useAssignPayload,
|
|
22
|
+
useCallApiAgain,
|
|
23
|
+
} from '../../../store';
|
|
24
|
+
import styled from 'styled-components';
|
|
25
|
+
import { useApiHook } from '@bjsdistribution/dms-component-library';
|
|
26
|
+
import { ApiResponse } from '../../common/interface';
|
|
27
|
+
import Loader from '../../header/loader/Loader';
|
|
20
28
|
|
|
21
29
|
const OrderTable = ({ loadingskeleton }: any) => {
|
|
22
30
|
// const [, setSelectedReturnOrder] = useSelectedOrders();
|
|
23
31
|
// const [selectAll, setSelectAll] = useState(false);
|
|
24
|
-
// const defaultSelectStyle = { width: '100%' };
|
|
25
|
-
const defaultPopupClassName = 'dropDownStyle';
|
|
26
|
-
const defaultSelectWrapperClass = 'rounded';
|
|
27
32
|
const dropdownRefParent = useRef<HTMLDivElement>(null);
|
|
28
33
|
const dropdownRef = useRef<HTMLDivElement>(null);
|
|
29
34
|
const [printToogle, setPrintToggle] = usePrintOptionTOggle();
|
|
30
|
-
|
|
35
|
+
const [assignData] = useAssignData();
|
|
36
|
+
const [, setOrderId] = useOrderId();
|
|
31
37
|
const [returnAfterOrder] = useReturnAfterOrderData();
|
|
38
|
+
const [assignPayload, setAssignPayload] = useAssignPayload();
|
|
39
|
+
const [, setAssign] = useState<boolean>(false);
|
|
40
|
+
const [, setCallAPi] = useCallApiAgain();
|
|
32
41
|
|
|
33
42
|
const OpenDropDown = (index: number) => {
|
|
34
43
|
setPrintToggle(prevIndex => (prevIndex === index ? null : index));
|
|
@@ -77,18 +86,6 @@ const OrderTable = ({ loadingskeleton }: any) => {
|
|
|
77
86
|
// }
|
|
78
87
|
// });
|
|
79
88
|
// };
|
|
80
|
-
// console.log('', returnAfterOrder);
|
|
81
|
-
|
|
82
|
-
const assigneOptions = [
|
|
83
|
-
{
|
|
84
|
-
label: 'BJS Distribution',
|
|
85
|
-
value: 'bjs-dist',
|
|
86
|
-
},
|
|
87
|
-
{
|
|
88
|
-
label: 'Haulage',
|
|
89
|
-
value: 'haulage',
|
|
90
|
-
},
|
|
91
|
-
];
|
|
92
89
|
|
|
93
90
|
const getStatusClass = (status: string) => {
|
|
94
91
|
switch (status) {
|
|
@@ -111,10 +108,60 @@ const OrderTable = ({ loadingskeleton }: any) => {
|
|
|
111
108
|
}
|
|
112
109
|
};
|
|
113
110
|
|
|
114
|
-
|
|
115
|
-
|
|
111
|
+
// API for Assign
|
|
112
|
+
const {
|
|
113
|
+
data: actionResponse,
|
|
114
|
+
setShouldPerformAction: setAssignAction,
|
|
115
|
+
loading: AssignLoading,
|
|
116
|
+
error: apiError,
|
|
117
|
+
} = useApiHook<{
|
|
118
|
+
data: ApiResponse[];
|
|
119
|
+
}>({
|
|
120
|
+
endpoint: `return_orders/update/assign/`,
|
|
121
|
+
method: 'PUT',
|
|
122
|
+
body: [assignPayload],
|
|
123
|
+
performAction: false,
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
//client options
|
|
127
|
+
const assignOptions = assignData?.map((option: any) => ({
|
|
128
|
+
label: option?.type?.charAt(0)?.toUpperCase() + option?.type?.slice(1),
|
|
129
|
+
value: option?.bjs_delivery,
|
|
130
|
+
}));
|
|
131
|
+
|
|
132
|
+
const handleAssignPayload = (Id: number, value: boolean) => {
|
|
133
|
+
setCallAPi(false);
|
|
134
|
+
setAssign(value);
|
|
135
|
+
setAssignPayload({
|
|
136
|
+
...assignPayload,
|
|
137
|
+
return_order_id: Id,
|
|
138
|
+
bjs_delivery: value,
|
|
139
|
+
});
|
|
140
|
+
setAssignAction(true);
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
useEffect(() => {
|
|
144
|
+
//@ts-ignore
|
|
145
|
+
if (actionResponse?.code === 200) {
|
|
146
|
+
setCallAPi(true);
|
|
147
|
+
notification.success({
|
|
148
|
+
message: 'Success',
|
|
149
|
+
// @ts-ignore
|
|
150
|
+
description: `${actionResponse?.message}`,
|
|
151
|
+
});
|
|
152
|
+
// @ts-ignore
|
|
153
|
+
} else if (apiError?.detail) {
|
|
154
|
+
notification.error({
|
|
155
|
+
message: 'Failure',
|
|
156
|
+
// @ts-ignore
|
|
157
|
+
description: `${apiError?.detail[0]?.msg}`,
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
}, [actionResponse, apiError]);
|
|
161
|
+
|
|
116
162
|
return (
|
|
117
163
|
<>
|
|
164
|
+
{AssignLoading && <Loader />}
|
|
118
165
|
<StyledTableWrapper className="fortables">
|
|
119
166
|
<StyledTable>
|
|
120
167
|
<thead>
|
|
@@ -122,7 +169,7 @@ const OrderTable = ({ loadingskeleton }: any) => {
|
|
|
122
169
|
{/* <th className="emailInvoiceCheckbox">
|
|
123
170
|
<Checkbox checked={false} />
|
|
124
171
|
</th> */}
|
|
125
|
-
<th
|
|
172
|
+
<th>Created</th>
|
|
126
173
|
<th>Return Location</th>
|
|
127
174
|
<th>Pick Up Location</th>
|
|
128
175
|
<th>Recipient</th>
|
|
@@ -215,17 +262,15 @@ const OrderTable = ({ loadingskeleton }: any) => {
|
|
|
215
262
|
{item?.weight && item?.weight !== null ? 'KG' : ''}
|
|
216
263
|
</td>
|
|
217
264
|
<td>{displayValueOrNA(item?.cube)}</td>
|
|
218
|
-
<td>
|
|
219
|
-
<
|
|
220
|
-
options={
|
|
265
|
+
<td key={item.id}>
|
|
266
|
+
<StyledAntSelect
|
|
267
|
+
options={assignOptions}
|
|
221
268
|
placeholder="Select"
|
|
222
|
-
onChange={() =>
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
popupClassName={defaultPopupClassName}
|
|
228
|
-
selectWrapperClass={defaultSelectWrapperClass}
|
|
269
|
+
onChange={(value: any) =>
|
|
270
|
+
handleAssignPayload(item?.id, value)
|
|
271
|
+
}
|
|
272
|
+
style={{ width: '150px' }}
|
|
273
|
+
value={item?.bjs_delivery}
|
|
229
274
|
/>
|
|
230
275
|
</td>
|
|
231
276
|
<td>
|
|
@@ -287,4 +332,15 @@ const OrderTable = ({ loadingskeleton }: any) => {
|
|
|
287
332
|
);
|
|
288
333
|
};
|
|
289
334
|
|
|
335
|
+
const StyledAntSelect = styled(Select)`
|
|
336
|
+
.ant-select-selector {
|
|
337
|
+
/* width: 22vw; */
|
|
338
|
+
border-radius: 22px;
|
|
339
|
+
}
|
|
340
|
+
.ant-select-clear {
|
|
341
|
+
top: 40% !important;
|
|
342
|
+
font-size: 18px !important;
|
|
343
|
+
}
|
|
344
|
+
`;
|
|
345
|
+
|
|
290
346
|
export default OrderTable;
|
package/src/components/order-daily-overview/return-after-table/table-filters/ReturnFilterStore.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { atom, useAtom } from 'jotai';
|
|
2
|
-
// import { formatDate } from '../shared/utlis';
|
|
3
2
|
import { format } from 'date-fns';
|
|
4
3
|
|
|
5
4
|
const date = atom(new Date());
|
|
@@ -29,7 +28,6 @@ const initialState: FilterState = {
|
|
|
29
28
|
};
|
|
30
29
|
|
|
31
30
|
const filterReducer = (state: FilterState, action: any): FilterState => {
|
|
32
|
-
console.log(action,'action')
|
|
33
31
|
switch (action.type) {
|
|
34
32
|
case 'SET_DATE_FILTER':
|
|
35
33
|
return {
|
|
@@ -81,6 +79,24 @@ const filterReducer = (state: FilterState, action: any): FilterState => {
|
|
|
81
79
|
],
|
|
82
80
|
};
|
|
83
81
|
|
|
82
|
+
// case 'CLEAR_CLIENT':
|
|
83
|
+
// return {
|
|
84
|
+
// ...state,
|
|
85
|
+
// 'x-filters': state['x-filters'].filter(f => f.field !== 'customer_id'),
|
|
86
|
+
// };
|
|
87
|
+
|
|
88
|
+
// case 'CLEAR_STATUS_ORDER':
|
|
89
|
+
// return {
|
|
90
|
+
// ...state,
|
|
91
|
+
// 'x-filters': state['x-filters'].filter(f => f.field !== 'status_id'),
|
|
92
|
+
// };
|
|
93
|
+
|
|
94
|
+
case 'CLEAR_DATE':
|
|
95
|
+
return {
|
|
96
|
+
...state,
|
|
97
|
+
'x-filters': state['x-filters'].filter(f => f.field !== 'created_at'),
|
|
98
|
+
};
|
|
99
|
+
|
|
84
100
|
case 'SET_PAGE':
|
|
85
101
|
return {
|
|
86
102
|
...state,
|
package/src/components/order-daily-overview/return-after-table/table-filters/ReturnOrderFilter.tsx
CHANGED
|
@@ -30,7 +30,7 @@ const ReturnOrderFilter = () => {
|
|
|
30
30
|
const [statusOfOrder] = useStatusOrderData();
|
|
31
31
|
const [selectedClient, setSelectedClient] = useState<any | null>();
|
|
32
32
|
const [statusOrder, setStatusOfOrder] = useState<any | null>();
|
|
33
|
-
|
|
33
|
+
|
|
34
34
|
const zoneOptions = [
|
|
35
35
|
{ label: 'Zone 1', value: 'zone1' },
|
|
36
36
|
{ label: 'Zone 2', value: 'zone2' },
|
|
@@ -41,11 +41,9 @@ const ReturnOrderFilter = () => {
|
|
|
41
41
|
// date change here
|
|
42
42
|
const handleDateChange = (date: any | null) => {
|
|
43
43
|
setSelectedDate(date ? date?.$d : null);
|
|
44
|
-
console.log(selectedDate, 'selected');
|
|
45
44
|
};
|
|
46
45
|
useEffect(() => {
|
|
47
46
|
if (selectedDate) {
|
|
48
|
-
console.log(selectedDate, 'selected');
|
|
49
47
|
dispatch({
|
|
50
48
|
type: 'SET_DATE_FILTER',
|
|
51
49
|
payload: selectedDate,
|
|
@@ -62,9 +60,8 @@ const ReturnOrderFilter = () => {
|
|
|
62
60
|
label:
|
|
63
61
|
option?.customer_name?.charAt(0)?.toUpperCase() +
|
|
64
62
|
option?.customer_name?.slice(1),
|
|
65
|
-
value: option?.
|
|
63
|
+
value: option?.customer_id,
|
|
66
64
|
}));
|
|
67
|
-
console.log(clientOptions, 'clientOptions');
|
|
68
65
|
//status of order
|
|
69
66
|
const orderOptions = statusOfOrder?.map((option: any) => ({
|
|
70
67
|
label:
|
|
@@ -74,7 +71,6 @@ const ReturnOrderFilter = () => {
|
|
|
74
71
|
}));
|
|
75
72
|
const handleClientChange = (value: any) => {
|
|
76
73
|
if (value === selectedClient) return;
|
|
77
|
-
console.log(value, 'value');
|
|
78
74
|
setSelectedClient(value);
|
|
79
75
|
dispatch({
|
|
80
76
|
type: 'SET_CLIENT_FILTER',
|
|
@@ -88,7 +84,6 @@ const ReturnOrderFilter = () => {
|
|
|
88
84
|
};
|
|
89
85
|
const handleStatusOfOrder = (value: any) => {
|
|
90
86
|
if (value === statusOfOrder) return;
|
|
91
|
-
console.log(value, 'value');
|
|
92
87
|
setStatusOfOrder(value);
|
|
93
88
|
dispatch({
|
|
94
89
|
type: 'SET_STATUS_ORDER_FILTER',
|
|
@@ -106,6 +101,14 @@ const ReturnOrderFilter = () => {
|
|
|
106
101
|
setStatusOfOrder(null);
|
|
107
102
|
dispatch({ type: 'CLEAR_ALL_FILTER' });
|
|
108
103
|
};
|
|
104
|
+
|
|
105
|
+
//clearing filters
|
|
106
|
+
useEffect(() => {
|
|
107
|
+
if (selectedDate === null) {
|
|
108
|
+
dispatch({ type: 'CLEAR_DATE' });
|
|
109
|
+
}
|
|
110
|
+
}, [selectedDate]);
|
|
111
|
+
|
|
109
112
|
return (
|
|
110
113
|
<>
|
|
111
114
|
<StyledFiter>
|
|
@@ -130,6 +133,7 @@ const ReturnOrderFilter = () => {
|
|
|
130
133
|
format="DD/MM/YY"
|
|
131
134
|
placeholder="Date"
|
|
132
135
|
needConfirm
|
|
136
|
+
allowClear
|
|
133
137
|
/>
|
|
134
138
|
</StyledDatePicker>
|
|
135
139
|
</div>
|
|
@@ -145,6 +149,8 @@ const ReturnOrderFilter = () => {
|
|
|
145
149
|
onChange={handleStatusOfOrder}
|
|
146
150
|
style={{ minWidth: '130px' }}
|
|
147
151
|
value={statusOrder}
|
|
152
|
+
// allowClear
|
|
153
|
+
// onClear={handleClearStatus}
|
|
148
154
|
/>
|
|
149
155
|
</StyledAntSelect>
|
|
150
156
|
</div>
|
|
@@ -160,6 +166,7 @@ const ReturnOrderFilter = () => {
|
|
|
160
166
|
onChange={handleClientChange}
|
|
161
167
|
value={selectedClient}
|
|
162
168
|
style={{ width: '125px', border: 'none' }}
|
|
169
|
+
// allowClear
|
|
163
170
|
/>
|
|
164
171
|
</StyledAntSelect>
|
|
165
172
|
</div>
|
|
@@ -237,5 +244,9 @@ export const StyledAntSelect = styled.div`
|
|
|
237
244
|
box-shadow: 0px 1px 4px 0px rgba(0, 0, 0, 0.1);
|
|
238
245
|
top: 16px;
|
|
239
246
|
}
|
|
247
|
+
.ant-select-clear {
|
|
248
|
+
top: 40% !important;
|
|
249
|
+
font-size: 18px !important;
|
|
250
|
+
}
|
|
240
251
|
`;
|
|
241
252
|
export default ReturnOrderFilter;
|
|
@@ -6,15 +6,14 @@ import {
|
|
|
6
6
|
Text,
|
|
7
7
|
} from '../../filters/FilterStyle';
|
|
8
8
|
import RightFilters from './RightFilters';
|
|
9
|
-
import { useParams } from 'react-router-dom';
|
|
10
9
|
|
|
11
10
|
const ReturnFilter = () => {
|
|
12
|
-
const
|
|
11
|
+
const storedName = localStorage.getItem('clientName');
|
|
13
12
|
|
|
14
13
|
return (
|
|
15
14
|
<>
|
|
16
15
|
<StyledFiter>
|
|
17
|
-
<Text>
|
|
16
|
+
<Text>{storedName}</Text>
|
|
18
17
|
<StyledFIlterELements>
|
|
19
18
|
<StyledTableFilter />
|
|
20
19
|
</StyledFIlterELements>
|
|
@@ -194,7 +194,9 @@ const ReturnOrderTable = () => {
|
|
|
194
194
|
account_number: createReturn?.account_number,
|
|
195
195
|
customer_id: +createReturn?.customer_id,
|
|
196
196
|
products: [legacy_product_id],
|
|
197
|
-
return_action:
|
|
197
|
+
return_action: order_product_return_action?.type
|
|
198
|
+
? [order_product_return_action.type]
|
|
199
|
+
: null,
|
|
198
200
|
return_location_token: return_location || null,
|
|
199
201
|
};
|
|
200
202
|
|
|
@@ -279,7 +281,7 @@ const ReturnOrderTable = () => {
|
|
|
279
281
|
<th>Product Location</th>
|
|
280
282
|
<th>Return Location</th>
|
|
281
283
|
<th>Recipient</th>
|
|
282
|
-
|
|
284
|
+
<th>Return Action</th>
|
|
283
285
|
<th>Code</th>
|
|
284
286
|
<th>Description</th>
|
|
285
287
|
<th>Part</th>
|
|
@@ -366,9 +368,9 @@ const ReturnOrderTable = () => {
|
|
|
366
368
|
</li>
|
|
367
369
|
</ul>
|
|
368
370
|
</td>
|
|
369
|
-
|
|
371
|
+
<td>
|
|
370
372
|
{displayValueOrNA(item?.order_product_return_action?.type)}
|
|
371
|
-
</td>
|
|
373
|
+
</td>
|
|
372
374
|
<td>{displayValueOrNA(item?.code)}</td>
|
|
373
375
|
<td>{displayValueOrNA(item?.description)}</td>
|
|
374
376
|
<td>{displayValueOrNA(item?.parts_count)}</td>
|
package/src/components/order-daily-overview/return-order-table/return-orders-filters/returnstyles.ts
CHANGED
|
@@ -515,15 +515,16 @@ export const StyledTable = styled.table`
|
|
|
515
515
|
|
|
516
516
|
// Styled components
|
|
517
517
|
export const StyledTableWrapper = styled.div`
|
|
518
|
-
overflow-x: auto;
|
|
519
518
|
max-height: 60vh;
|
|
519
|
+
overflow-x: auto;
|
|
520
520
|
scrollbar-width: none;
|
|
521
|
+
min-height: 50vh;
|
|
521
522
|
|
|
522
523
|
.fortables {
|
|
523
|
-
overflow-x: auto;
|
|
524
524
|
max-height: 60vh;
|
|
525
|
+
overflow-x: auto;
|
|
525
526
|
scrollbar-width: none;
|
|
526
|
-
min-height:
|
|
527
|
+
min-height: 50vh;
|
|
527
528
|
}
|
|
528
529
|
/* height: 600px; */
|
|
529
530
|
/* box-shadow: 0px 0px 30px 6px rgba(46, 45, 116, 0.05); */
|
|
@@ -56,6 +56,11 @@ export function useSelectedClient() {
|
|
|
56
56
|
return useAtom(selectedClient);
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
+
const clientTableId = atom<number | null>(null);
|
|
60
|
+
export function useIdForTableName() {
|
|
61
|
+
return useAtom(clientTableId);
|
|
62
|
+
}
|
|
63
|
+
|
|
59
64
|
const clientTableName = atom<string | null>(null);
|
|
60
65
|
export function useTableName() {
|
|
61
66
|
return useAtom(clientTableName);
|
|
@@ -92,6 +97,16 @@ export const useItemsPerReturnPage = () => {
|
|
|
92
97
|
return useAtom(atomItemsPerReturnPage);
|
|
93
98
|
};
|
|
94
99
|
|
|
100
|
+
//stats data overview
|
|
101
|
+
export const UsePaginationOverviewData = () => {
|
|
102
|
+
return useAtom(atomPaginationData);
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
const atomItemsPerOverviewPage = atom<number>(50);
|
|
106
|
+
export const useItemsPerOverviewPage = () => {
|
|
107
|
+
return useAtom(atomItemsPerOverviewPage);
|
|
108
|
+
};
|
|
109
|
+
|
|
95
110
|
const countStatus = atom<any>([]);
|
|
96
111
|
export const useCountData = () => {
|
|
97
112
|
return useAtom(countStatus);
|
|
@@ -26,10 +26,10 @@ interface ApiResponse {
|
|
|
26
26
|
data: [];
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
const ReturnTable: React.FC = (
|
|
29
|
+
const ReturnTable: React.FC = () => {
|
|
30
30
|
const [clientData] = useClientData();
|
|
31
31
|
const [updatedData, setUpdatedData] = useState<any>([]);
|
|
32
|
-
const [, setLoading] = useLoading();
|
|
32
|
+
const [statsLoading, setLoading] = useLoading();
|
|
33
33
|
const [, setOrderStaticData] = useOrderStaticData();
|
|
34
34
|
const [, dispatch] = useAtom(filtersReducerAtom);
|
|
35
35
|
const navigate = useNavigate();
|
|
@@ -54,11 +54,13 @@ const ReturnTable: React.FC = ({ loadingskeleton }: any) => {
|
|
|
54
54
|
useEffect(() => {
|
|
55
55
|
const updatedClientData = clientData?.map(client => {
|
|
56
56
|
const matchingCustomer = customers?.find(
|
|
57
|
-
(customer: any) => customer?.
|
|
57
|
+
(customer: any) => customer?.customer_id === client?.customer_id
|
|
58
58
|
);
|
|
59
59
|
return {
|
|
60
60
|
...client,
|
|
61
|
-
|
|
61
|
+
account_number: matchingCustomer
|
|
62
|
+
? matchingCustomer?.account_number
|
|
63
|
+
: null,
|
|
62
64
|
};
|
|
63
65
|
});
|
|
64
66
|
setUpdatedData(updatedClientData);
|
|
@@ -68,11 +70,11 @@ const ReturnTable: React.FC = ({ loadingskeleton }: any) => {
|
|
|
68
70
|
const handleRedirect = (
|
|
69
71
|
customerName: string,
|
|
70
72
|
customerId: number,
|
|
71
|
-
|
|
73
|
+
account_number: string
|
|
72
74
|
) => {
|
|
73
75
|
localStorage.setItem('clientName', customerName);
|
|
74
76
|
localStorage.setItem('clientId', customerId?.toString());
|
|
75
|
-
localStorage.setItem('
|
|
77
|
+
localStorage.setItem('account_number', account_number);
|
|
76
78
|
|
|
77
79
|
if (customerId) {
|
|
78
80
|
dispatch({
|
|
@@ -89,8 +91,10 @@ const ReturnTable: React.FC = ({ loadingskeleton }: any) => {
|
|
|
89
91
|
payload: [],
|
|
90
92
|
});
|
|
91
93
|
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
+
navigate(`filter/${customerId}`);
|
|
95
|
+
|
|
96
|
+
//forlocal
|
|
97
|
+
// navigate(`/filter/${customerId}`);
|
|
94
98
|
};
|
|
95
99
|
|
|
96
100
|
return (
|
|
@@ -113,7 +117,7 @@ const ReturnTable: React.FC = ({ loadingskeleton }: any) => {
|
|
|
113
117
|
</tr>
|
|
114
118
|
</thead>
|
|
115
119
|
<tbody>
|
|
116
|
-
{
|
|
120
|
+
{statsLoading ? (
|
|
117
121
|
<tr>
|
|
118
122
|
<td colSpan={11}>
|
|
119
123
|
<Skeleton active />
|
|
@@ -138,7 +142,7 @@ const ReturnTable: React.FC = ({ loadingskeleton }: any) => {
|
|
|
138
142
|
handleRedirect(
|
|
139
143
|
key?.customer_name,
|
|
140
144
|
key?.customer_id,
|
|
141
|
-
key?.
|
|
145
|
+
key?.account_number
|
|
142
146
|
)
|
|
143
147
|
}
|
|
144
148
|
style={{
|
|
@@ -153,7 +157,7 @@ const ReturnTable: React.FC = ({ loadingskeleton }: any) => {
|
|
|
153
157
|
<td>
|
|
154
158
|
<ColumStyle>
|
|
155
159
|
<GreyBox>
|
|
156
|
-
{key?.
|
|
160
|
+
{key?.orders}
|
|
157
161
|
{/* </div> */}
|
|
158
162
|
</GreyBox>
|
|
159
163
|
</ColumStyle>
|
|
@@ -169,6 +173,7 @@ const ReturnTable: React.FC = ({ loadingskeleton }: any) => {
|
|
|
169
173
|
<GreyBox>{key?.RTS}</GreyBox>
|
|
170
174
|
</ColumStyle>
|
|
171
175
|
</td>
|
|
176
|
+
|
|
172
177
|
<td>
|
|
173
178
|
<ColumStyle>
|
|
174
179
|
<GreyBox>{key?.PENDING}</GreyBox>
|
|
@@ -59,7 +59,7 @@ export const StyledTable = styled.table`
|
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
61
|
.emailInvoiceNo {
|
|
62
|
-
padding-left:
|
|
62
|
+
padding-left: 12px;
|
|
63
63
|
}
|
|
64
64
|
.emailInvoiceShare {
|
|
65
65
|
width: 100px;
|
|
@@ -604,7 +604,7 @@ export const StyledFilterBtnIcon = styled.div`
|
|
|
604
604
|
align-items: center;
|
|
605
605
|
border-radius: 20px;
|
|
606
606
|
border: 1px solid #e2e0db;
|
|
607
|
-
background: #
|
|
607
|
+
background: #b2b3b3;
|
|
608
608
|
.cross {
|
|
609
609
|
position: relative;
|
|
610
610
|
&:after {
|
package/src/components/order-view/details-filters/left-side-filters/dropdowns/MenuDropDown.tsx
CHANGED
|
@@ -1,29 +1,25 @@
|
|
|
1
1
|
import React, { useState, useEffect, useRef } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import { countReducerAtom } from '../../../store';
|
|
2
|
+
import { useCurrentAction } from '../../../store';
|
|
4
3
|
import DropDownItem from './DropDownItem';
|
|
5
4
|
import DropDownMenu from './DropDownMenu';
|
|
6
5
|
import { DropDownContainer } from './DropdownStyles';
|
|
7
6
|
import DropDownLarge from '../../../../../assets/icons/DropDownLarge';
|
|
8
|
-
// import { countReducerAtom } from '../../../store/store';
|
|
9
7
|
|
|
10
8
|
const Options = [
|
|
11
|
-
{ label: 'Add Order Resource ', value: 'add-order-resources' },
|
|
9
|
+
// { label: 'Add Order Resource ', value: 'add-order-resources' },
|
|
12
10
|
{ label: 'Split Order ', value: 'split-order' },
|
|
13
11
|
];
|
|
14
12
|
|
|
15
13
|
const MenuDropDown: React.FC = () => {
|
|
16
14
|
const [isOpen, setIsOpen] = useState(false);
|
|
17
|
-
const [, dispatch] = useAtom(countReducerAtom);
|
|
18
15
|
const dropdownRef = useRef<HTMLDivElement>(null);
|
|
19
|
-
|
|
16
|
+
const [, setCurrentAction] = useCurrentAction();
|
|
20
17
|
const handleClick = () => {
|
|
21
18
|
setIsOpen(prev => !prev);
|
|
22
19
|
};
|
|
23
20
|
|
|
24
|
-
const handleSelect = (
|
|
25
|
-
|
|
26
|
-
dispatch({ type: value });
|
|
21
|
+
const handleSelect = (selectedOption: any) => {
|
|
22
|
+
setCurrentAction(selectedOption);
|
|
27
23
|
setIsOpen(false);
|
|
28
24
|
};
|
|
29
25
|
|
package/src/components/order-view/details-filters/left-side-filters/dropdowns/OptionsDropDown.tsx
CHANGED
|
@@ -21,9 +21,10 @@ const Options = [
|
|
|
21
21
|
const OptionsDropDown: React.FC = () => {
|
|
22
22
|
const [isOpen, setIsOpen] = useState(false);
|
|
23
23
|
const dropdownRef = useRef<HTMLDivElement>(null);
|
|
24
|
-
const [
|
|
24
|
+
const [, setCurrentAction] = useCurrentAction();
|
|
25
25
|
const [hold] = useIsOnHoldOrder();
|
|
26
|
-
|
|
26
|
+
|
|
27
|
+
// console.log(action, 'action');
|
|
27
28
|
const handleClick = () => {
|
|
28
29
|
setIsOpen(prev => !prev);
|
|
29
30
|
};
|
|
@@ -36,7 +37,6 @@ const OptionsDropDown: React.FC = () => {
|
|
|
36
37
|
}
|
|
37
38
|
});
|
|
38
39
|
const handleSelect = (selectedOption: any) => {
|
|
39
|
-
console.log(selectedOption);
|
|
40
40
|
setCurrentAction(selectedOption);
|
|
41
41
|
setIsOpen(false);
|
|
42
42
|
};
|
|
@@ -14,7 +14,7 @@ const PrintDropDownReturn = ({
|
|
|
14
14
|
console.log(legacyProductId, 'legacyProductId');
|
|
15
15
|
|
|
16
16
|
const downloadFiles = () => {
|
|
17
|
-
const url = `https://toolbox.bjshomedelivery.com/offload/return_label?gsit_products_id=${legacyProductId}`;
|
|
17
|
+
const url = `https://us.toolbox.bjshomedelivery.com/offload/return_label?gsit_products_id=${legacyProductId}`;
|
|
18
18
|
window.open(url, '_blank'); // Opens the URL in a new tab
|
|
19
19
|
};
|
|
20
20
|
|
|
@@ -63,7 +63,7 @@ const renderIcon = (value: any, orderStatus: any) => {
|
|
|
63
63
|
} else if (status.delivered === true && status.completed === true) {
|
|
64
64
|
return <SuccessIcon />;
|
|
65
65
|
} else if (status.delivered === true && status.completed === false) {
|
|
66
|
-
return <RouteIcon />;
|
|
66
|
+
return <RouteIcon />; //orange
|
|
67
67
|
} else {
|
|
68
68
|
return <ConfirmedIcon />;
|
|
69
69
|
}
|
|
@@ -10,7 +10,7 @@ function Print() {
|
|
|
10
10
|
const [orderDetails] = useOrderDetails();
|
|
11
11
|
const gsitId = orderDetails?.gsit_order_id;
|
|
12
12
|
const dropdownRef = useRef<HTMLDivElement>(null);
|
|
13
|
-
console.log(gsitId, 'gsitId');
|
|
13
|
+
// console.log(gsitId, 'gsitId');
|
|
14
14
|
const [isOpen, setIsOpen] = useState(false);
|
|
15
15
|
|
|
16
16
|
const handleClick = () => {
|