@bjsdistribution/dms-client-return 0.0.36 → 0.0.38
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/CaretDownFilledIcon.d.ts +3 -0
- package/dist/common/CaretUpFilledIcon.d.ts +3 -0
- package/dist/common/SortIcon.d.ts +3 -0
- package/dist/components/order-daily-overview/store/store.d.ts +1 -0
- package/dist/dms-client-return.cjs.development.js +296 -97
- 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 +296 -97
- package/dist/dms-client-return.esm.js.map +1 -1
- package/package.json +2 -2
- package/src/common/CaretDownFilledIcon.tsx +27 -0
- package/src/common/CaretUpFilledIcon.tsx +27 -0
- package/src/common/SortIcon.tsx +23 -0
- package/src/components/order-daily-overview/header-filters/SelectionFilter.tsx +12 -11
- package/src/components/order-daily-overview/index.tsx +29 -33
- package/src/components/order-daily-overview/return-order-table/return-orders-filters/ReturnOrderTable.tsx +102 -21
- package/src/components/order-daily-overview/return-order-table/return-orders-filters/returnstyles.ts +4 -0
- package/src/components/order-daily-overview/store/store.ts +8 -2
- package/src/components/order-daily-overview/table/ReturnTable.tsx +77 -18
- package/src/components/order-view/modalsPopup/ModalManager.tsx +5 -34
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.0.
|
|
2
|
+
"version": "0.0.38",
|
|
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.10",
|
|
63
63
|
"@size-limit/preset-small-lib": "^11.0.1",
|
|
64
64
|
"@tippyjs/react": "^4.2.6",
|
|
65
65
|
"@types/react": "^18.2.47",
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
function CaretDownFilledIcon(props: any) {
|
|
3
|
+
return (
|
|
4
|
+
<svg
|
|
5
|
+
width="16"
|
|
6
|
+
height="16"
|
|
7
|
+
viewBox="0 0 18 18"
|
|
8
|
+
fill="none"
|
|
9
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
10
|
+
{...props}
|
|
11
|
+
>
|
|
12
|
+
<g clip-path="url(#clip0_2034_435)">
|
|
13
|
+
<path
|
|
14
|
+
d="M13.5 6.75C14.139 6.75 14.4727 7.4895 14.0872 7.96725L14.0302 8.03025L9.53021 12.5303C9.40107 12.6594 9.22924 12.737 9.04698 12.7484C8.86471 12.7599 8.68452 12.7044 8.54021 12.5925L8.46971 12.5303L3.96972 8.03025L3.90746 7.95975L3.86697 7.902L3.82647 7.83L3.81371 7.803L3.79347 7.75275L3.76946 7.67175L3.76196 7.632L3.75446 7.587L3.75146 7.54425V7.45575L3.75521 7.41225L3.76196 7.36725L3.76946 7.32825L3.79347 7.24725L3.81371 7.197L3.86622 7.098L3.91496 7.0305L3.96972 6.96975L4.04021 6.9075L4.09797 6.867L4.16996 6.8265L4.19697 6.81375L4.24721 6.7935L4.32821 6.7695L4.36796 6.762L4.41296 6.7545L4.45571 6.7515L13.5 6.75Z"
|
|
15
|
+
fill="#9E9E9E"
|
|
16
|
+
/>
|
|
17
|
+
</g>
|
|
18
|
+
<defs>
|
|
19
|
+
<clipPath id="clip0_2034_435">
|
|
20
|
+
<rect width="16" height="16" fill="white" />
|
|
21
|
+
</clipPath>
|
|
22
|
+
</defs>
|
|
23
|
+
</svg>
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export default CaretDownFilledIcon;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
function CaretDownFilledIcon(props: any) {
|
|
3
|
+
return (
|
|
4
|
+
<svg
|
|
5
|
+
width="16"
|
|
6
|
+
height="16"
|
|
7
|
+
viewBox="0 0 18 18"
|
|
8
|
+
fill="none"
|
|
9
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
10
|
+
{...props}
|
|
11
|
+
>
|
|
12
|
+
<g clip-path="url(#clip0_2034_435)">
|
|
13
|
+
<path
|
|
14
|
+
d="M13.5 6.75C14.139 6.75 14.4727 7.4895 14.0872 7.96725L14.0302 8.03025L9.53021 12.5303C9.40107 12.6594 9.22924 12.737 9.04698 12.7484C8.86471 12.7599 8.68452 12.7044 8.54021 12.5925L8.46971 12.5303L3.96972 8.03025L3.90746 7.95975L3.86697 7.902L3.82647 7.83L3.81371 7.803L3.79347 7.75275L3.76946 7.67175L3.76196 7.632L3.75446 7.587L3.75146 7.54425V7.45575L3.75521 7.41225L3.76196 7.36725L3.76946 7.32825L3.79347 7.24725L3.81371 7.197L3.86622 7.098L3.91496 7.0305L3.96972 6.96975L4.04021 6.9075L4.09797 6.867L4.16996 6.8265L4.19697 6.81375L4.24721 6.7935L4.32821 6.7695L4.36796 6.762L4.41296 6.7545L4.45571 6.7515L13.5 6.75Z"
|
|
15
|
+
fill="#9E9E9E"
|
|
16
|
+
/>
|
|
17
|
+
</g>
|
|
18
|
+
<defs>
|
|
19
|
+
<clipPath id="clip0_2034_435">
|
|
20
|
+
<rect width="16" height="16" fill="white" />
|
|
21
|
+
</clipPath>
|
|
22
|
+
</defs>
|
|
23
|
+
</svg>
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export default CaretDownFilledIcon;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
const SortIcon = () => {
|
|
4
|
+
return (
|
|
5
|
+
<svg
|
|
6
|
+
width="16"
|
|
7
|
+
height="17"
|
|
8
|
+
viewBox="0 0 16 17"
|
|
9
|
+
fill="none"
|
|
10
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
11
|
+
>
|
|
12
|
+
<g id="bxs:sort-alt">
|
|
13
|
+
<path
|
|
14
|
+
id="Vector"
|
|
15
|
+
d="M4.15138 7.83335H11.8494C12.424 7.83335 12.7294 7.15335 12.3474 6.72335L8.49871 2.39335C8.43628 2.32288 8.35961 2.26647 8.27377 2.22783C8.18792 2.1892 8.09485 2.16922 8.00071 2.16922C7.90657 2.16922 7.8135 2.1892 7.72766 2.22783C7.64181 2.26647 7.56514 2.32288 7.50271 2.39335L3.65271 6.72335C3.27071 7.15335 3.57604 7.83335 4.15138 7.83335ZM7.50204 14.606C7.56447 14.6765 7.64114 14.7329 7.72699 14.7715C7.81284 14.8102 7.9059 14.8301 8.00004 14.8301C8.09418 14.8301 8.18725 14.8102 8.2731 14.7715C8.35895 14.7329 8.43562 14.6765 8.49804 14.606L12.3467 10.276C12.7294 9.84668 12.424 9.16668 11.8487 9.16668H4.15138C3.57671 9.16668 3.27138 9.84668 3.65338 10.2767L7.50204 14.606Z"
|
|
16
|
+
fill="#9E9E9E"
|
|
17
|
+
/>
|
|
18
|
+
</g>
|
|
19
|
+
</svg>
|
|
20
|
+
);
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export default SortIcon;
|
|
@@ -106,19 +106,21 @@ function SelectionFilter() {
|
|
|
106
106
|
);
|
|
107
107
|
|
|
108
108
|
if (filteredClient) {
|
|
109
|
-
const mappedActions = filteredClient?.actions
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
109
|
+
const mappedActions = Array.isArray(filteredClient?.actions)
|
|
110
|
+
? filteredClient?.actions?.map((action: any) => ({
|
|
111
|
+
label: action,
|
|
112
|
+
value: action,
|
|
113
|
+
}))
|
|
114
|
+
: [];
|
|
113
115
|
|
|
114
116
|
setActionTypeOptions(mappedActions);
|
|
115
117
|
|
|
116
|
-
const mappedLocations = filteredClient?.return_locations
|
|
117
|
-
(location: any) => ({
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
118
|
+
const mappedLocations = Array.isArray(filteredClient?.return_locations)
|
|
119
|
+
? filteredClient?.return_locations?.map((location: any) => ({
|
|
120
|
+
label: location?.location_name,
|
|
121
|
+
value: location?.token,
|
|
122
|
+
}))
|
|
123
|
+
: [];
|
|
122
124
|
|
|
123
125
|
setLocationOptions(mappedLocations);
|
|
124
126
|
}
|
|
@@ -300,7 +302,6 @@ function SelectionFilter() {
|
|
|
300
302
|
/>
|
|
301
303
|
</FilterColumn>
|
|
302
304
|
</>
|
|
303
|
-
{/* ) : null} */}
|
|
304
305
|
</LeftColumn>
|
|
305
306
|
<RightColumn>
|
|
306
307
|
<ApplyButton onClick={applyFilters} disabled={!isButtonEnabled}>
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import React, { useEffect } from 'react';
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
// UsePaginationOverviewData,
|
|
3
|
+
useItemsPerOverviewPage,
|
|
4
|
+
useStatsLoading,
|
|
5
|
+
UsePaginationOverviewData,
|
|
7
6
|
useTableName,
|
|
8
|
-
//UsePaginationData,
|
|
9
7
|
} from './store/store';
|
|
10
8
|
import Filters from './filters/Filters';
|
|
11
9
|
import styled from 'styled-components';
|
|
@@ -17,36 +15,34 @@ import { ClientData } from './common/interface';
|
|
|
17
15
|
import ReturnFilter from './return-order-table/return-orders-filters/ReturnFilter';
|
|
18
16
|
import { Text } from './filters/FilterStyle';
|
|
19
17
|
import ReturnTable from './table/ReturnTable';
|
|
18
|
+
import { notification } from 'antd';
|
|
20
19
|
import { overviewfiltersReducerAtom } from './header-filters/overViewFilter';
|
|
21
|
-
|
|
22
|
-
// import Pagination from './table-view/Pagination';
|
|
23
|
-
// import Pagination from './table-view/Pagination';
|
|
24
|
-
// import { overviewfiltersReducerAtom } from './header-filters/overViewFilter';
|
|
20
|
+
import Pagination from './table-view/Pagination';
|
|
25
21
|
|
|
26
22
|
function ReturnMainTable() {
|
|
27
23
|
const [state] = useAtom(overviewfiltersReducerAtom);
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
24
|
+
const [paginationObj, setPaginationObject] = UsePaginationOverviewData();
|
|
25
|
+
const [, setCurrentPage] = useState(1);
|
|
26
|
+
const [itemsPerPage, setItemsPerPage] = useItemsPerOverviewPage();
|
|
31
27
|
const { 'x-pagination': pagination } = state;
|
|
32
|
-
|
|
28
|
+
const { page, total } = paginationObj;
|
|
33
29
|
// const [selectedClient] = useTableName();
|
|
34
30
|
const [isScrolled] = useStickyStatus();
|
|
35
|
-
const [, setLoading] =
|
|
31
|
+
const [, setLoading] = useStatsLoading();
|
|
36
32
|
const [, setClientData] = useClientData();
|
|
37
33
|
const [tableName] = useTableName();
|
|
38
34
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
35
|
+
const handlePageChange = (page: number) => {
|
|
36
|
+
setCurrentPage(page);
|
|
37
|
+
};
|
|
38
|
+
const handleItemsPerPageChange = (itemsPerPage: number) => {
|
|
39
|
+
setItemsPerPage(itemsPerPage);
|
|
40
|
+
};
|
|
45
41
|
|
|
46
42
|
const {
|
|
47
43
|
data: fetchedClientData,
|
|
48
44
|
loading: statsDataLoading,
|
|
49
|
-
|
|
45
|
+
paginationData,
|
|
50
46
|
} = useApiHook<{
|
|
51
47
|
data: ClientData[];
|
|
52
48
|
}>({
|
|
@@ -61,15 +57,15 @@ function ReturnMainTable() {
|
|
|
61
57
|
if (fetchedClientData && fetchedClientData.data) {
|
|
62
58
|
const result = fetchedClientData?.data;
|
|
63
59
|
setClientData(result);
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
60
|
+
if (paginationData !== null) {
|
|
61
|
+
const { count, ...rest } = JSON.parse(paginationData);
|
|
62
|
+
setPaginationObject(rest);
|
|
63
|
+
} else {
|
|
64
|
+
notification.error({
|
|
65
|
+
message: 'Error',
|
|
66
|
+
description: 'Pagination data is null',
|
|
67
|
+
});
|
|
68
|
+
}
|
|
73
69
|
}
|
|
74
70
|
}, [statsDataLoading]);
|
|
75
71
|
|
|
@@ -86,7 +82,7 @@ function ReturnMainTable() {
|
|
|
86
82
|
</Row>
|
|
87
83
|
<ReturnTable />
|
|
88
84
|
</Container>
|
|
89
|
-
{
|
|
85
|
+
{total > 0 && (
|
|
90
86
|
<Pagination
|
|
91
87
|
currentPage={page}
|
|
92
88
|
totalItems={total}
|
|
@@ -94,7 +90,7 @@ function ReturnMainTable() {
|
|
|
94
90
|
onPageChange={handlePageChange}
|
|
95
91
|
onItemsPerPageChange={handleItemsPerPageChange}
|
|
96
92
|
></Pagination>
|
|
97
|
-
)}
|
|
93
|
+
)}
|
|
98
94
|
</div>
|
|
99
95
|
</DashBoardWrapper>
|
|
100
96
|
</>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Checkbox, useApiHook } from '@bjsdistribution/dms-component-library';
|
|
2
2
|
import { Empty, notification } from 'antd';
|
|
3
3
|
import { useAtom } from 'jotai';
|
|
4
|
-
import React, { useEffect, useRef } from 'react';
|
|
4
|
+
import React, { useEffect, useMemo, useRef, useState } from 'react';
|
|
5
5
|
import { Skeleton } from 'antd';
|
|
6
6
|
import {
|
|
7
7
|
useGroupedPayload,
|
|
@@ -28,6 +28,8 @@ import { displayValueOrNA } from '../../shared/utlis';
|
|
|
28
28
|
import PrintDropDownReturn from '../../../order-view/details-filters/left-side-filters/dropdowns/PrintDropDownReturn';
|
|
29
29
|
import { format } from 'date-fns';
|
|
30
30
|
import Loader from '../../header/loader/Loader';
|
|
31
|
+
import CaretDownFilledIcon from '../../../../common/CaretDownFilledIcon';
|
|
32
|
+
import SortIcon from '../../../../common/SortIcon';
|
|
31
33
|
const ReturnOrderTable = () => {
|
|
32
34
|
const [state] = useAtom(filtersReducerAtom);
|
|
33
35
|
|
|
@@ -46,6 +48,53 @@ const ReturnOrderTable = () => {
|
|
|
46
48
|
const [locationData] = useLocationData();
|
|
47
49
|
const [, setPaginationObject] = UsePaginationData();
|
|
48
50
|
const [callForFetch] = usefetchAgain();
|
|
51
|
+
|
|
52
|
+
//sorting
|
|
53
|
+
const [sortConfig, setSortConfig] = useState<{
|
|
54
|
+
key: string;
|
|
55
|
+
direction: 'asc' | 'desc';
|
|
56
|
+
} | null>(null);
|
|
57
|
+
|
|
58
|
+
const handleSort = (key: string) => {
|
|
59
|
+
setSortConfig((prev: any) => {
|
|
60
|
+
if (prev?.key === key && prev.direction === 'asc') {
|
|
61
|
+
return { key, direction: 'desc' };
|
|
62
|
+
}
|
|
63
|
+
return { key, direction: 'asc' };
|
|
64
|
+
});
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
const sortedData = useMemo(() => {
|
|
68
|
+
if (!returnData || !sortConfig) return returnData;
|
|
69
|
+
|
|
70
|
+
const { key, direction } = sortConfig;
|
|
71
|
+
return [...returnData].sort((a, b) => {
|
|
72
|
+
const valueA = a[key];
|
|
73
|
+
const valueB = b[key];
|
|
74
|
+
|
|
75
|
+
if (typeof valueA === 'number' && typeof valueB === 'number') {
|
|
76
|
+
return direction === 'asc' ? valueA - valueB : valueB - valueA;
|
|
77
|
+
}
|
|
78
|
+
if (typeof valueA === 'string' && typeof valueB === 'string') {
|
|
79
|
+
return direction === 'asc'
|
|
80
|
+
? valueA.localeCompare(valueB)
|
|
81
|
+
: valueB.localeCompare(valueA);
|
|
82
|
+
}
|
|
83
|
+
return 0;
|
|
84
|
+
});
|
|
85
|
+
}, [returnData, sortConfig]);
|
|
86
|
+
|
|
87
|
+
const renderSortIcon = (columnKey: string) => {
|
|
88
|
+
if (!sortConfig || sortConfig.key !== columnKey) {
|
|
89
|
+
return <SortIcon />;
|
|
90
|
+
}
|
|
91
|
+
return sortConfig.direction === 'asc' ? (
|
|
92
|
+
<CaretDownFilledIcon />
|
|
93
|
+
) : (
|
|
94
|
+
<CaretDownFilledIcon />
|
|
95
|
+
);
|
|
96
|
+
};
|
|
97
|
+
|
|
49
98
|
const OpenDropDown = (index: number) => {
|
|
50
99
|
setPrintToggle(prevIndex => (prevIndex === index ? null : index));
|
|
51
100
|
};
|
|
@@ -105,7 +154,7 @@ const ReturnOrderTable = () => {
|
|
|
105
154
|
return {
|
|
106
155
|
...returnItem,
|
|
107
156
|
new_location: matchingLocation
|
|
108
|
-
? matchingLocation
|
|
157
|
+
? matchingLocation?.location_name
|
|
109
158
|
: null,
|
|
110
159
|
};
|
|
111
160
|
});
|
|
@@ -131,7 +180,7 @@ const ReturnOrderTable = () => {
|
|
|
131
180
|
products: loc?.legacy_product_id,
|
|
132
181
|
order_product_return_action: loc?.order_product_return_action,
|
|
133
182
|
return_location_token: loc?.return_location,
|
|
134
|
-
new_location: loc?.new_location,
|
|
183
|
+
// new_location: loc?.new_location,
|
|
135
184
|
}))
|
|
136
185
|
);
|
|
137
186
|
|
|
@@ -147,7 +196,7 @@ const ReturnOrderTable = () => {
|
|
|
147
196
|
products: [loc?.legacy_product_id],
|
|
148
197
|
return_action: loc?.order_product_return_action?.type,
|
|
149
198
|
return_location_token: loc?.return_location || null,
|
|
150
|
-
new_location: loc?.new_location,
|
|
199
|
+
// new_location: loc?.new_location,
|
|
151
200
|
}))
|
|
152
201
|
);
|
|
153
202
|
} else {
|
|
@@ -162,7 +211,7 @@ const ReturnOrderTable = () => {
|
|
|
162
211
|
return_location: any,
|
|
163
212
|
return_locations: any,
|
|
164
213
|
order_product_return_action: any,
|
|
165
|
-
new_location: any,
|
|
214
|
+
// new_location: any,
|
|
166
215
|
legacy_product_id: any
|
|
167
216
|
) => {
|
|
168
217
|
setSelectedReturnOrder((prevSelectedLocations: any) => {
|
|
@@ -180,7 +229,7 @@ const ReturnOrderTable = () => {
|
|
|
180
229
|
products: legacy_product_id,
|
|
181
230
|
return_action: order_product_return_action?.type || null,
|
|
182
231
|
return_location_token: return_location || null,
|
|
183
|
-
new_location: new_location,
|
|
232
|
+
// new_location: new_location,
|
|
184
233
|
}));
|
|
185
234
|
|
|
186
235
|
setNewPayload((prevPayload: any) =>
|
|
@@ -207,7 +256,7 @@ const ReturnOrderTable = () => {
|
|
|
207
256
|
products: legacy_product_id,
|
|
208
257
|
return_action: order_product_return_action?.type || null,
|
|
209
258
|
return_location_token: return_location || null,
|
|
210
|
-
new_location: new_location,
|
|
259
|
+
// new_location: new_location,
|
|
211
260
|
}));
|
|
212
261
|
|
|
213
262
|
return [
|
|
@@ -217,7 +266,7 @@ const ReturnOrderTable = () => {
|
|
|
217
266
|
return_location,
|
|
218
267
|
return_locations,
|
|
219
268
|
order_product_return_action,
|
|
220
|
-
new_location,
|
|
269
|
+
// new_location,
|
|
221
270
|
},
|
|
222
271
|
];
|
|
223
272
|
}
|
|
@@ -257,6 +306,7 @@ const ReturnOrderTable = () => {
|
|
|
257
306
|
|
|
258
307
|
const mergedPayload = Object.values(groupedPayload);
|
|
259
308
|
setGrouped(mergedPayload);
|
|
309
|
+
console.log(mergedPayload, 'mergedPayload');
|
|
260
310
|
}, [newpayload]);
|
|
261
311
|
|
|
262
312
|
return (
|
|
@@ -278,29 +328,60 @@ const ReturnOrderTable = () => {
|
|
|
278
328
|
) : (
|
|
279
329
|
<th></th>
|
|
280
330
|
)}
|
|
281
|
-
<th
|
|
282
|
-
|
|
283
|
-
|
|
331
|
+
<th onClick={() => handleSort('orders_products_stock.location')}>
|
|
332
|
+
<div className="sortIconClass">
|
|
333
|
+
Product Location{' '}
|
|
334
|
+
{renderSortIcon('orders_products_stock.location')}
|
|
335
|
+
</div>
|
|
336
|
+
</th>
|
|
337
|
+
<th onClick={() => handleSort('new_location')}>
|
|
338
|
+
<div className="sortIconClass">
|
|
339
|
+
Return Location {renderSortIcon('new_location')}
|
|
340
|
+
</div>
|
|
341
|
+
</th>
|
|
342
|
+
<th
|
|
343
|
+
onClick={() =>
|
|
344
|
+
handleSort('order_data.order_recipient.recipient_name')
|
|
345
|
+
}
|
|
346
|
+
>
|
|
347
|
+
<div className="sortIconClass">
|
|
348
|
+
Recipient{' '}
|
|
349
|
+
{renderSortIcon('order_data.order_recipient.recipient_name')}
|
|
350
|
+
</div>
|
|
351
|
+
</th>
|
|
284
352
|
<th>Return Action</th>
|
|
285
353
|
<th>Code</th>
|
|
286
354
|
<th>Description</th>
|
|
287
355
|
<th>Part</th>
|
|
288
|
-
<th>
|
|
356
|
+
<th onClick={() => handleSort('weight')}>
|
|
357
|
+
<div className="sortIconClass">
|
|
358
|
+
Weight {renderSortIcon('weight')}
|
|
359
|
+
</div>
|
|
360
|
+
</th>
|
|
289
361
|
<th>CBM</th>
|
|
290
|
-
<th
|
|
362
|
+
<th onClick={() => handleSort('return_reasons.reason')}>
|
|
363
|
+
<div className="sortIconClass">
|
|
364
|
+
Return Reason {renderSortIcon('return_reasons.reason')}
|
|
365
|
+
</div>
|
|
366
|
+
</th>
|
|
291
367
|
<th>Collected</th>
|
|
292
|
-
<th
|
|
368
|
+
<th onClick={() => handleSort('collection_reasons.reason')}>
|
|
369
|
+
<div className="sortIconClass">
|
|
370
|
+
Collection Reason{' '}
|
|
371
|
+
{renderSortIcon('collection_reasons.reason')}
|
|
372
|
+
</div>
|
|
373
|
+
</th>
|
|
293
374
|
<th className="emailInvoiceShare">Labels</th>
|
|
294
375
|
</tr>
|
|
295
376
|
</thead>
|
|
296
377
|
<tbody>
|
|
297
378
|
{load ? (
|
|
298
379
|
<tr>
|
|
299
|
-
<td colSpan={
|
|
380
|
+
<td colSpan={14}>
|
|
300
381
|
<Skeleton active />
|
|
301
382
|
</td>
|
|
302
383
|
</tr>
|
|
303
|
-
) :
|
|
384
|
+
) : sortedData?.length === 0 ? (
|
|
304
385
|
<tr>
|
|
305
386
|
<td colSpan={14}>
|
|
306
387
|
<EmptyDataContainer>
|
|
@@ -309,7 +390,7 @@ const ReturnOrderTable = () => {
|
|
|
309
390
|
</td>
|
|
310
391
|
</tr>
|
|
311
392
|
) : (
|
|
312
|
-
|
|
393
|
+
sortedData?.map((item: any, index: any) => (
|
|
313
394
|
<tr key={item.id}>
|
|
314
395
|
<td>
|
|
315
396
|
{item?.order_product_return_action?.type == 'RTS' ? (
|
|
@@ -326,7 +407,7 @@ const ReturnOrderTable = () => {
|
|
|
326
407
|
item.return_location,
|
|
327
408
|
item.return_locations,
|
|
328
409
|
item.order_product_return_action,
|
|
329
|
-
item.new_location,
|
|
410
|
+
// item.new_location,
|
|
330
411
|
item.legacy_product_id
|
|
331
412
|
)
|
|
332
413
|
}
|
|
@@ -382,9 +463,9 @@ const ReturnOrderTable = () => {
|
|
|
382
463
|
<td>{displayValueOrNA(item?.return_reasons?.reason)}</td>
|
|
383
464
|
<td>
|
|
384
465
|
{item?.order_product_returns?.length > 0
|
|
385
|
-
? item
|
|
466
|
+
? item?.order_product_returns?.map((ret: any) =>
|
|
386
467
|
ret?.collected_at
|
|
387
|
-
? format(new Date(ret
|
|
468
|
+
? format(new Date(ret?.collected_at), 'dd/MM/yyyy')
|
|
388
469
|
: 'UNKNOWN'
|
|
389
470
|
)
|
|
390
471
|
: 'UNKNOWN'}
|
|
@@ -405,7 +486,7 @@ const ReturnOrderTable = () => {
|
|
|
405
486
|
{printToogle == index && (
|
|
406
487
|
<div ref={dropdownRef}>
|
|
407
488
|
<PrintDropDownReturn
|
|
408
|
-
legacyProductId={item
|
|
489
|
+
legacyProductId={item?.legacy_product_id}
|
|
409
490
|
/>
|
|
410
491
|
</div>
|
|
411
492
|
)}
|
|
@@ -35,12 +35,18 @@ const atomRoutesTable = atom<TableRowType[]>([]);
|
|
|
35
35
|
export const useRoutesTable = () => {
|
|
36
36
|
return useAtom(atomRoutesTable);
|
|
37
37
|
};
|
|
38
|
-
|
|
38
|
+
//this
|
|
39
39
|
const loading = atom<boolean>(false);
|
|
40
|
-
export const
|
|
40
|
+
export const useStatsLoading = () => {
|
|
41
41
|
return useAtom(loading);
|
|
42
42
|
};
|
|
43
43
|
|
|
44
|
+
//this
|
|
45
|
+
const loadingState = atom<boolean>(false);
|
|
46
|
+
export const useLoading = () => {
|
|
47
|
+
return useAtom(loadingState);
|
|
48
|
+
};
|
|
49
|
+
|
|
44
50
|
const selectedAction = atom<number | null>(null);
|
|
45
51
|
export function useSelectedAction() {
|
|
46
52
|
return useAtom(selectedAction);
|