@bjsdistribution/dms-client-return 0.1.37-prod → 0.1.38-prod
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 +590 -733
- 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 +592 -735
- package/dist/dms-client-return.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/client-portal/DateFilterStore.ts +1 -1
- package/src/components/client-portal/ReturnStatus.tsx +11 -12
- package/src/components/order-daily-overview/header-filters/HeaderFilter.tsx +3 -2
- package/src/components/order-daily-overview/return-order-table/return-orders-filters/ReturnFilter.tsx +53 -4
- package/src/index.tsx +1 -1
package/package.json
CHANGED
|
@@ -70,10 +70,9 @@ const ReturnStatus = () => {
|
|
|
70
70
|
|
|
71
71
|
useEffect(() => {
|
|
72
72
|
if (
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
status == 'return_completed'
|
|
73
|
+
clientPortal &&
|
|
74
|
+
debouncedSearchAfterText === '' &&
|
|
75
|
+
(status == 'scheduled_for_return' || status == 'return_completed')
|
|
77
76
|
) {
|
|
78
77
|
fetchData();
|
|
79
78
|
}
|
|
@@ -87,13 +86,13 @@ const ReturnStatus = () => {
|
|
|
87
86
|
|
|
88
87
|
const returnCounts = useMemo(
|
|
89
88
|
() => [
|
|
90
|
-
{
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
},
|
|
89
|
+
// {
|
|
90
|
+
// id: 1,
|
|
91
|
+
// icon: 'outstanding_return',
|
|
92
|
+
// status: 'outstanding_return',
|
|
93
|
+
// count: count?.outstanding_count,
|
|
94
|
+
// label: 'Outstanding Return',
|
|
95
|
+
// },
|
|
97
96
|
// {
|
|
98
97
|
// id: 2,
|
|
99
98
|
// icon: 'scheduled_for_return',
|
|
@@ -102,7 +101,7 @@ const ReturnStatus = () => {
|
|
|
102
101
|
// label: 'Scheduled For Return',
|
|
103
102
|
// },
|
|
104
103
|
{
|
|
105
|
-
id:
|
|
104
|
+
id: 3,
|
|
106
105
|
icon: 'return_completed',
|
|
107
106
|
status: 'return_completed',
|
|
108
107
|
count: count?.completed_count,
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import { CoverPage } from './Styledfilters';
|
|
3
3
|
import SelectionFilter from './SelectionFilter';
|
|
4
4
|
import { useClientPortal } from '../../store';
|
|
5
|
-
import ReturnStatus from '../../client-portal/ReturnStatus';
|
|
5
|
+
// import ReturnStatus from '../../client-portal/ReturnStatus';
|
|
6
6
|
|
|
7
7
|
function HeaderFilter() {
|
|
8
8
|
const [clientPortal] = useClientPortal();
|
|
@@ -10,7 +10,8 @@ function HeaderFilter() {
|
|
|
10
10
|
return (
|
|
11
11
|
<>
|
|
12
12
|
{clientPortal ? (
|
|
13
|
-
<ReturnStatus />
|
|
13
|
+
// <ReturnStatus />
|
|
14
|
+
<></>
|
|
14
15
|
) : (
|
|
15
16
|
<>
|
|
16
17
|
<CoverPage>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useEffect } from 'react';
|
|
2
2
|
import {
|
|
3
3
|
StyledFIlterELements,
|
|
4
4
|
StyledFiter,
|
|
@@ -6,14 +6,32 @@ import {
|
|
|
6
6
|
Text,
|
|
7
7
|
} from '../../filters/FilterStyle';
|
|
8
8
|
import RightFilters from './RightFilters';
|
|
9
|
-
import {
|
|
9
|
+
import {
|
|
10
|
+
useAtom,
|
|
11
|
+
useClientPortal,
|
|
12
|
+
useCustomerData,
|
|
13
|
+
useSearchAfterText,
|
|
14
|
+
useSearchText,
|
|
15
|
+
useStatsCPCount,
|
|
16
|
+
} from '../../../store';
|
|
10
17
|
import { useParams } from 'react-router-dom';
|
|
11
18
|
import ReturnRTFilters from '../../../client-portal/ReturnRTFilters';
|
|
19
|
+
import { returnCountType } from '../../../client-portal/ReturnStatus';
|
|
20
|
+
import { useAxios } from '@bjsdistribution/dms-component-library';
|
|
21
|
+
import { dateFilterCPReducer } from '../../../client-portal/DateFilterStore';
|
|
12
22
|
|
|
13
23
|
const ReturnFilter = () => {
|
|
14
24
|
const [customers] = useCustomerData();
|
|
15
25
|
const [clientPortal] = useClientPortal();
|
|
16
26
|
const { status } = useParams();
|
|
27
|
+
const [count, setCount] = useStatsCPCount();
|
|
28
|
+
const [debouncedSearchAfterText] = useSearchAfterText();
|
|
29
|
+
const [debouncedSearchText] = useSearchText();
|
|
30
|
+
|
|
31
|
+
const [state] = useAtom(dateFilterCPReducer);
|
|
32
|
+
const { 'x-filters': filters } = state;
|
|
33
|
+
|
|
34
|
+
const cleanedFilters = filters.filter(f => f.field !== 'order_status');
|
|
17
35
|
|
|
18
36
|
const queryParams = new URLSearchParams(location.search);
|
|
19
37
|
const customerId = queryParams.get('customerId');
|
|
@@ -32,7 +50,8 @@ const ReturnFilter = () => {
|
|
|
32
50
|
case 'scheduled_for_return':
|
|
33
51
|
return 'All Scheduled Orders';
|
|
34
52
|
case 'return_completed':
|
|
35
|
-
return 'View Return Order';
|
|
53
|
+
// return 'View Return Order';
|
|
54
|
+
return 'Completed Return';
|
|
36
55
|
default:
|
|
37
56
|
return status
|
|
38
57
|
.replace(/_/g, ' ')
|
|
@@ -40,6 +59,31 @@ const ReturnFilter = () => {
|
|
|
40
59
|
}
|
|
41
60
|
};
|
|
42
61
|
|
|
62
|
+
const { data: statsData, loading: statsApiLoading, fetchData } = useAxios<{
|
|
63
|
+
data: returnCountType[];
|
|
64
|
+
}>({
|
|
65
|
+
endpoint: `v1/portal/return/stats/`,
|
|
66
|
+
method: 'GET',
|
|
67
|
+
pagination: { is_pagination: false },
|
|
68
|
+
filters: cleanedFilters,
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
useEffect(() => {
|
|
72
|
+
if (
|
|
73
|
+
clientPortal &&
|
|
74
|
+
debouncedSearchAfterText === '' &&
|
|
75
|
+
status == 'return_completed'
|
|
76
|
+
) {
|
|
77
|
+
fetchData();
|
|
78
|
+
}
|
|
79
|
+
}, [debouncedSearchAfterText, debouncedSearchText, JSON.stringify(filters)]);
|
|
80
|
+
|
|
81
|
+
useEffect(() => {
|
|
82
|
+
if (statsData?.data && typeof statsData?.data === 'object') {
|
|
83
|
+
setCount(statsData?.data);
|
|
84
|
+
}
|
|
85
|
+
}, [statsApiLoading]);
|
|
86
|
+
|
|
43
87
|
return (
|
|
44
88
|
<>
|
|
45
89
|
<StyledFiter>
|
|
@@ -53,7 +97,12 @@ const ReturnFilter = () => {
|
|
|
53
97
|
</>
|
|
54
98
|
) : (
|
|
55
99
|
<>
|
|
56
|
-
<Text>
|
|
100
|
+
<Text>
|
|
101
|
+
{status
|
|
102
|
+
? `${getStatusLabel(status)} (${count?.completed_count})`
|
|
103
|
+
: ''}
|
|
104
|
+
</Text>
|
|
105
|
+
|
|
57
106
|
<ReturnRTFilters />
|
|
58
107
|
</>
|
|
59
108
|
)}
|
package/src/index.tsx
CHANGED
|
@@ -136,7 +136,7 @@ function ReturnClient() {
|
|
|
136
136
|
<Suspense fallback={<LoadingMessage />}>
|
|
137
137
|
{clientPortal ? (
|
|
138
138
|
<Routes>
|
|
139
|
-
<Route path="" element={<Navigate to={'
|
|
139
|
+
<Route path="" element={<Navigate to={'return_completed'} />} />
|
|
140
140
|
<Route path=":status" element={<ReturnOverview />} />
|
|
141
141
|
<Route
|
|
142
142
|
path="view/:id"
|