@bjsdistribution/dms-client-return 0.1.12-prod → 0.1.13-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 +9 -18
- 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 +10 -19
- package/dist/dms-client-return.esm.js.map +1 -1
- package/package.json +2 -2
- package/src/components/client-portal/ReturnStatus.tsx +12 -25
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.1.
|
|
2
|
+
"version": "0.1.13-prod",
|
|
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.3.
|
|
62
|
+
"@bjsdistribution/dms-component-library": "0.3.47-staging",
|
|
63
63
|
"@size-limit/preset-small-lib": "^11.0.1",
|
|
64
64
|
"@tippyjs/react": "^4.2.6",
|
|
65
65
|
"@types/react": "^18.2.47",
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
device,
|
|
4
4
|
useAxios,
|
|
5
5
|
} from '@bjsdistribution/dms-component-library';
|
|
6
|
-
import React, { useEffect,
|
|
6
|
+
import React, { useEffect, useMemo, useRef } from 'react';
|
|
7
7
|
import styled from 'styled-components';
|
|
8
8
|
import {
|
|
9
9
|
useActiveCardId,
|
|
@@ -39,14 +39,13 @@ const ReturnStatus = () => {
|
|
|
39
39
|
const [startDate] = useStartDate();
|
|
40
40
|
const [endDate] = useEndDate();
|
|
41
41
|
const [clientPortal] = useClientPortal();
|
|
42
|
-
const [modifiedFilters, setModifiedFilters] = useState<any[]>([]);
|
|
43
42
|
const [debouncedSearchText] = useSearchText();
|
|
44
43
|
const [debouncedSearchAfterText] = useSearchAfterText();
|
|
45
44
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
45
|
+
//stats API
|
|
46
|
+
const filters = useMemo(() => {
|
|
47
|
+
if (!clientPortal) return [];
|
|
48
|
+
|
|
50
49
|
const stored = JSON.parse(localStorage.getItem('returnDate') || '{}');
|
|
51
50
|
|
|
52
51
|
const sDate = startDate?.isValid?.() ? startDate : dayjs(stored?.startDate);
|
|
@@ -58,7 +57,7 @@ const ReturnStatus = () => {
|
|
|
58
57
|
|
|
59
58
|
if (!sDate?.isValid?.()) return [];
|
|
60
59
|
|
|
61
|
-
let dateFilters = [];
|
|
60
|
+
let dateFilters: any[] = [];
|
|
62
61
|
|
|
63
62
|
if (eDate && eDate.isValid()) {
|
|
64
63
|
dateFilters = [
|
|
@@ -79,18 +78,8 @@ const ReturnStatus = () => {
|
|
|
79
78
|
];
|
|
80
79
|
}
|
|
81
80
|
|
|
82
|
-
return dateFilters;
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
useEffect(() => {
|
|
86
|
-
if (!clientPortal) return;
|
|
87
|
-
|
|
88
|
-
const dateFilters = getDateFilters(startDate, endDate);
|
|
89
|
-
setModifiedFilters(dateFilters);
|
|
90
|
-
}, [startDate, endDate]);
|
|
91
|
-
|
|
92
|
-
//stats API
|
|
93
|
-
|
|
81
|
+
return [...dateFilters];
|
|
82
|
+
}, [startDate, endDate, status]);
|
|
94
83
|
const { data: statsData, loading: apiLoading, fetchData } = useAxios<{
|
|
95
84
|
data: returnCountType[];
|
|
96
85
|
}>({
|
|
@@ -98,7 +87,7 @@ const ReturnStatus = () => {
|
|
|
98
87
|
method: 'GET',
|
|
99
88
|
//@ts-ignore
|
|
100
89
|
pagination: { is_pagination: false },
|
|
101
|
-
filters:
|
|
90
|
+
filters: filters,
|
|
102
91
|
});
|
|
103
92
|
|
|
104
93
|
const prevSearchTextRef = useRef('');
|
|
@@ -120,8 +109,6 @@ const ReturnStatus = () => {
|
|
|
120
109
|
prevSearchAfterTextRef.current = debouncedSearchAfterText;
|
|
121
110
|
}, [debouncedSearchAfterText, startDate, endDate]);
|
|
122
111
|
|
|
123
|
-
console.log(debouncedSearchText, 'debouncedSearchText');
|
|
124
|
-
console.log(debouncedSearchAfterText, 'debouncedSearchAfterText');
|
|
125
112
|
useEffect(() => {
|
|
126
113
|
fetchData();
|
|
127
114
|
}, [startDate, endDate]);
|
|
@@ -138,21 +125,21 @@ const ReturnStatus = () => {
|
|
|
138
125
|
id: 1,
|
|
139
126
|
icon: 'outstanding_return',
|
|
140
127
|
status: 'outstanding_return',
|
|
141
|
-
count: count?.outstanding_count
|
|
128
|
+
count: count?.outstanding_count,
|
|
142
129
|
label: 'Outstanding Return',
|
|
143
130
|
},
|
|
144
131
|
{
|
|
145
132
|
id: 2,
|
|
146
133
|
icon: 'scheduled_for_return',
|
|
147
134
|
status: 'scheduled_for_return',
|
|
148
|
-
count: count?.scheduled_count
|
|
135
|
+
count: count?.scheduled_count,
|
|
149
136
|
label: 'Scheduled For Return',
|
|
150
137
|
},
|
|
151
138
|
{
|
|
152
139
|
id: 3,
|
|
153
140
|
icon: 'return_completed',
|
|
154
141
|
status: 'return_completed',
|
|
155
|
-
count: count?.completed_count
|
|
142
|
+
count: count?.completed_count,
|
|
156
143
|
label: 'Return Completed',
|
|
157
144
|
},
|
|
158
145
|
];
|