@bjsdistribution/dms-client-return 0.0.43 → 0.0.45
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/dms-client-return.cjs.development.js +79 -9
- 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 +79 -9
- 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 +4 -4
- package/src/components/order-daily-overview/return-after-table/table/OrderTable.tsx +77 -8
- package/src/components/order-daily-overview/table/ReturnTable.tsx +5 -1
package/package.json
CHANGED
|
@@ -119,7 +119,7 @@ function SelectionFilter() {
|
|
|
119
119
|
}, [accountNumber, urlCustomerId]);
|
|
120
120
|
|
|
121
121
|
useEffect(() => {
|
|
122
|
-
if (urlCustomerId
|
|
122
|
+
if (urlCustomerId) {
|
|
123
123
|
const filteredClient = clientOptions?.find(
|
|
124
124
|
(client: any) => client?.value == urlCustomerId
|
|
125
125
|
);
|
|
@@ -188,8 +188,8 @@ function SelectionFilter() {
|
|
|
188
188
|
setLocationOptions(
|
|
189
189
|
Array.isArray(clientLocations)
|
|
190
190
|
? clientLocations?.map(location => ({
|
|
191
|
-
label: location,
|
|
192
|
-
value: location,
|
|
191
|
+
label: location?.location_name,
|
|
192
|
+
value: location?.token,
|
|
193
193
|
}))
|
|
194
194
|
: []
|
|
195
195
|
);
|
|
@@ -347,7 +347,7 @@ function SelectionFilter() {
|
|
|
347
347
|
value={selectedLocationValue}
|
|
348
348
|
placeholder="Select Location"
|
|
349
349
|
onChange={handleLocationChange}
|
|
350
|
-
style={{ minWidth: '
|
|
350
|
+
style={{ minWidth: '150px' }}
|
|
351
351
|
allowClear
|
|
352
352
|
mode="multiple"
|
|
353
353
|
/>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Empty, notification, Select } from 'antd';
|
|
2
|
-
import React, { useEffect, useRef, useState } from 'react';
|
|
2
|
+
import React, { useEffect, useMemo, useRef, useState } from 'react';
|
|
3
3
|
import { Skeleton } from 'antd';
|
|
4
4
|
// import { useSelectedOrders } from '../../../store';
|
|
5
5
|
import { useOrderId, useReturnAfterOrderData } from '../../../order-view/store';
|
|
@@ -25,6 +25,8 @@ import styled from 'styled-components';
|
|
|
25
25
|
import { useApiHook } from '@bjsdistribution/dms-component-library';
|
|
26
26
|
import { ApiResponse } from '../../common/interface';
|
|
27
27
|
import Loader from '../../header/loader/Loader';
|
|
28
|
+
import CaretDownFilledIcon from '../../../../common/CaretDownFilledIcon';
|
|
29
|
+
import SortIcon from '../../../../common/SortIcon';
|
|
28
30
|
|
|
29
31
|
const OrderTable = ({ loadingskeleton }: any) => {
|
|
30
32
|
// const [, setSelectedReturnOrder] = useSelectedOrders();
|
|
@@ -39,6 +41,52 @@ const OrderTable = ({ loadingskeleton }: any) => {
|
|
|
39
41
|
const [, setAssign] = useState<boolean>(false);
|
|
40
42
|
const [, setCallAPi] = useCallApiAgain();
|
|
41
43
|
|
|
44
|
+
//sorting
|
|
45
|
+
const [sortConfig, setSortConfig] = useState<{
|
|
46
|
+
key: string;
|
|
47
|
+
direction: 'asc' | 'desc';
|
|
48
|
+
} | null>(null);
|
|
49
|
+
|
|
50
|
+
const handleSort = (key: string) => {
|
|
51
|
+
setSortConfig((prev: any) => {
|
|
52
|
+
if (prev?.key === key && prev.direction === 'asc') {
|
|
53
|
+
return { key, direction: 'desc' };
|
|
54
|
+
}
|
|
55
|
+
return { key, direction: 'asc' };
|
|
56
|
+
});
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
const sortedData = useMemo(() => {
|
|
60
|
+
if (!returnAfterOrder || !sortConfig) return returnAfterOrder;
|
|
61
|
+
|
|
62
|
+
const { key, direction } = sortConfig;
|
|
63
|
+
return [...returnAfterOrder].sort((a, b) => {
|
|
64
|
+
const valueA = a[key];
|
|
65
|
+
const valueB = b[key];
|
|
66
|
+
|
|
67
|
+
if (typeof valueA === 'number' && typeof valueB === 'number') {
|
|
68
|
+
return direction === 'asc' ? valueA - valueB : valueB - valueA;
|
|
69
|
+
}
|
|
70
|
+
if (typeof valueA === 'string' && typeof valueB === 'string') {
|
|
71
|
+
return direction === 'asc'
|
|
72
|
+
? valueA.localeCompare(valueB)
|
|
73
|
+
: valueB.localeCompare(valueA);
|
|
74
|
+
}
|
|
75
|
+
return 0;
|
|
76
|
+
});
|
|
77
|
+
}, [returnAfterOrder, sortConfig]);
|
|
78
|
+
|
|
79
|
+
const renderSortIcon = (columnKey: string) => {
|
|
80
|
+
if (!sortConfig || sortConfig.key !== columnKey) {
|
|
81
|
+
return <SortIcon />;
|
|
82
|
+
}
|
|
83
|
+
return sortConfig.direction === 'asc' ? (
|
|
84
|
+
<CaretDownFilledIcon />
|
|
85
|
+
) : (
|
|
86
|
+
<CaretDownFilledIcon />
|
|
87
|
+
);
|
|
88
|
+
};
|
|
89
|
+
|
|
42
90
|
const OpenDropDown = (index: number) => {
|
|
43
91
|
setPrintToggle(prevIndex => (prevIndex === index ? null : index));
|
|
44
92
|
};
|
|
@@ -169,16 +217,37 @@ const OrderTable = ({ loadingskeleton }: any) => {
|
|
|
169
217
|
{/* <th className="emailInvoiceCheckbox">
|
|
170
218
|
<Checkbox checked={false} />
|
|
171
219
|
</th> */}
|
|
172
|
-
<th>
|
|
173
|
-
|
|
220
|
+
<th onClick={() => handleSort('created_at')}>
|
|
221
|
+
<div className="sortIconClass">
|
|
222
|
+
Created {renderSortIcon('created_at')}
|
|
223
|
+
</div>
|
|
224
|
+
</th>
|
|
225
|
+
<th onClick={() => handleSort('return_locations.location_name')}>
|
|
226
|
+
<div className="sortIconClass">
|
|
227
|
+
Return Location{' '}
|
|
228
|
+
{renderSortIcon('return_locations.location_name')}
|
|
229
|
+
</div>
|
|
230
|
+
</th>
|
|
174
231
|
<th>Pick Up Location</th>
|
|
175
|
-
<th>
|
|
232
|
+
<th onClick={() => handleSort('order_recipient.recipient_name')}>
|
|
233
|
+
<div className="sortIconClass">
|
|
234
|
+
Recipient {renderSortIcon('order_recipient.recipient_name')}
|
|
235
|
+
</div>
|
|
236
|
+
</th>
|
|
176
237
|
<th> Client</th>
|
|
177
238
|
<th>Consignment</th>
|
|
178
239
|
<th>Return Order No</th>
|
|
179
240
|
<th> Total Parts</th>
|
|
180
|
-
<th
|
|
181
|
-
|
|
241
|
+
<th onClick={() => handleSort('weight')}>
|
|
242
|
+
<div className="sortIconClass">
|
|
243
|
+
Total Weight {renderSortIcon('weight')}
|
|
244
|
+
</div>
|
|
245
|
+
</th>
|
|
246
|
+
<th onClick={() => handleSort('cube')}>
|
|
247
|
+
<div className="sortIconClass">
|
|
248
|
+
Total CBM {renderSortIcon('cube')}
|
|
249
|
+
</div>
|
|
250
|
+
</th>
|
|
182
251
|
<th>Assign</th>
|
|
183
252
|
<th>Status</th>
|
|
184
253
|
<th className="emailInvoiceShare">Labels</th>
|
|
@@ -192,7 +261,7 @@ const OrderTable = ({ loadingskeleton }: any) => {
|
|
|
192
261
|
</td>
|
|
193
262
|
<td colSpan={16}></td>
|
|
194
263
|
</tr>
|
|
195
|
-
) :
|
|
264
|
+
) : sortedData?.length === 0 ? (
|
|
196
265
|
<tr>
|
|
197
266
|
<td colSpan={16}>
|
|
198
267
|
<EmptyDataContainer>
|
|
@@ -201,7 +270,7 @@ const OrderTable = ({ loadingskeleton }: any) => {
|
|
|
201
270
|
</td>
|
|
202
271
|
</tr>
|
|
203
272
|
) : (
|
|
204
|
-
|
|
273
|
+
sortedData?.map((item: any, index: any) => {
|
|
205
274
|
const statusMapping: any = {
|
|
206
275
|
cancelled: 'Cancelled',
|
|
207
276
|
OO: 'On Hold',
|
|
@@ -253,7 +253,11 @@ const ReturnTable: React.FC = () => {
|
|
|
253
253
|
fontWeight: key?.RTS > 0 ? 600 : 'normal',
|
|
254
254
|
cursor: key?.RTS > 0 ? 'pointer' : 'default',
|
|
255
255
|
}}
|
|
256
|
-
onClick={
|
|
256
|
+
onClick={
|
|
257
|
+
key?.RTS > 0
|
|
258
|
+
? () => handleRedirectRTS(key?.customer_id, 'RTS')
|
|
259
|
+
: undefined
|
|
260
|
+
}
|
|
257
261
|
>
|
|
258
262
|
<ColumStyle>
|
|
259
263
|
<GreyBox
|