@bjsdistribution/dms-client-return 0.0.10 → 0.0.12
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/common/fakedata.d.ts +4 -0
- package/dist/components/order-daily-overview/return-order-table/return-orders-filters/ReturnOrderTable.d.ts +1 -1
- package/dist/components/order-view/details-filters/left-side-filters/dropdowns/{PrintDropDown.d.ts → PrintDropDownReturn.d.ts} +2 -2
- package/dist/components/store.d.ts +6 -1
- package/dist/dms-client-return.cjs.development.js +289 -210
- 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 +290 -211
- package/dist/dms-client-return.esm.js.map +1 -1
- package/package.json +2 -2
- package/src/components/order-daily-overview/common/fakedata.tsx +4 -0
- package/src/components/order-daily-overview/header-filters/HeaderFilter.tsx +10 -1
- package/src/components/order-daily-overview/header-filters/SelectionFilter.tsx +15 -7
- package/src/components/order-daily-overview/index.tsx +1 -1
- package/src/components/order-daily-overview/return-after-table/table/OrderTable.tsx +4 -8
- package/src/components/order-daily-overview/return-after-table/table-filters/ReturnFilterStore.ts +12 -14
- package/src/components/order-daily-overview/return-after-table/table-filters/ReturnOrderFilter.tsx +41 -39
- package/src/components/order-daily-overview/return-order-table/return-orders-filters/ReturnOrderTable.tsx +80 -37
- package/src/components/order-daily-overview/return-order-table/return-orders-filters/returnstyles.ts +17 -0
- package/src/components/order-daily-overview/shared/utlis.ts +7 -1
- package/src/components/order-daily-overview/table-view/Pagination.tsx +15 -14
- package/src/components/order-view/details-filters/left-side-filters/dropdowns/{PrintDropDown.tsx → PrintDropDownReturn.tsx} +4 -4
- package/src/components/order-view/modalsPopup/CreateReturnModal.tsx +74 -36
- package/src/components/order-view/modalsPopup/ModalManager.tsx +47 -12
- package/src/components/store.ts +35 -0
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.0.
|
|
2
|
+
"version": "0.0.12",
|
|
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": "
|
|
62
|
+
"@bjsdistribution/dms-component-library": "0.1.3",
|
|
63
63
|
"@size-limit/preset-small-lib": "^11.0.1",
|
|
64
64
|
"@tippyjs/react": "^4.2.6",
|
|
65
65
|
"@types/react": "^18.2.47",
|
|
@@ -101,6 +101,10 @@ export const optionsPrint = [
|
|
|
101
101
|
{ icon: 'collectionLables', label: 'Print Collection Labels' },
|
|
102
102
|
];
|
|
103
103
|
|
|
104
|
+
export const optionsForReturnPrint = [
|
|
105
|
+
{ icon: 'deliveryLables', label: 'Print Return Labels' },
|
|
106
|
+
];
|
|
107
|
+
|
|
104
108
|
export const Depots = [
|
|
105
109
|
{ value: 'bjsCouriers', label: 'BJS COURIERS' },
|
|
106
110
|
{ value: 'bjsSales', label: 'BJS SALES' },
|
|
@@ -3,12 +3,18 @@ import { CoverPage } from './Styledfilters';
|
|
|
3
3
|
import SelectionFilter from './SelectionFilter';
|
|
4
4
|
import { ApiResponse } from '../../types';
|
|
5
5
|
import { useApiHook } from '@bjsdistribution/dms-component-library';
|
|
6
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
useActionType,
|
|
8
|
+
useCustomerData,
|
|
9
|
+
useLocationData,
|
|
10
|
+
useStatusOrderData,
|
|
11
|
+
} from '../../store';
|
|
7
12
|
|
|
8
13
|
function HeaderFilter() {
|
|
9
14
|
const [, setCustomers] = useCustomerData();
|
|
10
15
|
const [, setActionType] = useActionType();
|
|
11
16
|
const [, setLocationData] = useLocationData();
|
|
17
|
+
const [, setStatusOfOrders] = useStatusOrderData();
|
|
12
18
|
|
|
13
19
|
//API for client data
|
|
14
20
|
const { data: fetchedCustomerData, loading: loading } = useApiHook<
|
|
@@ -50,6 +56,9 @@ function HeaderFilter() {
|
|
|
50
56
|
(i: any) => i?.order_product_return_action
|
|
51
57
|
)
|
|
52
58
|
);
|
|
59
|
+
setStatusOfOrders(
|
|
60
|
+
fetchedStaticData?.data?.flatMap((i: any) => i?.order_stock_alias)
|
|
61
|
+
);
|
|
53
62
|
}
|
|
54
63
|
}, [actionLoading, fetchedStaticData]);
|
|
55
64
|
|
|
@@ -12,9 +12,12 @@ import { atom, useAtom } from 'jotai';
|
|
|
12
12
|
import {
|
|
13
13
|
useActionType,
|
|
14
14
|
useCustomerData,
|
|
15
|
+
useGroupedPayload,
|
|
15
16
|
useLocationData,
|
|
16
17
|
useNewReturnPayload,
|
|
17
18
|
useReturnPayload,
|
|
19
|
+
useSelectAll,
|
|
20
|
+
useSelectedOrders,
|
|
18
21
|
} from '../../store';
|
|
19
22
|
import { filtersReducerAtom } from './filterStore';
|
|
20
23
|
import {
|
|
@@ -49,6 +52,9 @@ function SelectionFilter() {
|
|
|
49
52
|
const [storedAccNumber, setStoredAccNumber] = useState<any>();
|
|
50
53
|
const [storedCustomerId, setStoredCustomerId] = useState<any>();
|
|
51
54
|
const [, setNewPayload] = useNewReturnPayload();
|
|
55
|
+
const [, setGrouped] = useGroupedPayload();
|
|
56
|
+
const [, setSelectedReturnOrder] = useSelectedOrders();
|
|
57
|
+
const [, setSelectAll] = useSelectAll();
|
|
52
58
|
|
|
53
59
|
//client options
|
|
54
60
|
const clientOptions = customers?.map((option: any) => ({
|
|
@@ -69,7 +75,7 @@ function SelectionFilter() {
|
|
|
69
75
|
|
|
70
76
|
const LocationOptions = locationData?.map((option: any) => ({
|
|
71
77
|
label: option?.location_name,
|
|
72
|
-
value: option?.
|
|
78
|
+
value: option?.token,
|
|
73
79
|
}));
|
|
74
80
|
|
|
75
81
|
//client change
|
|
@@ -94,7 +100,6 @@ function SelectionFilter() {
|
|
|
94
100
|
account_number: storedAccNo,
|
|
95
101
|
customer_id: storedCustomerId,
|
|
96
102
|
}));
|
|
97
|
-
console.log(selectedUuids, 'selectedUuids');
|
|
98
103
|
const filteredSubLocations = locationData
|
|
99
104
|
?.filter((subCat: any) => subCat?.customer_id === selectedUuids)
|
|
100
105
|
.map((subCat: any) => ({
|
|
@@ -104,6 +109,10 @@ function SelectionFilter() {
|
|
|
104
109
|
|
|
105
110
|
setFilteredLocationOptions(filteredSubLocations);
|
|
106
111
|
setUuid('');
|
|
112
|
+
setSelectedReturnOrder([]);
|
|
113
|
+
setNewPayload([]);
|
|
114
|
+
setGrouped([]);
|
|
115
|
+
setSelectAll(false);
|
|
107
116
|
};
|
|
108
117
|
|
|
109
118
|
useEffect(() => {
|
|
@@ -127,10 +136,9 @@ function SelectionFilter() {
|
|
|
127
136
|
useEffect(() => {}, [getUuid, filteredLocationOptions]);
|
|
128
137
|
|
|
129
138
|
//location change
|
|
130
|
-
const handleLocationChange = (value:
|
|
139
|
+
const handleLocationChange = (value: any, option: DefaultOptionType) => {
|
|
131
140
|
const selectedLabel = option?.label as string;
|
|
132
|
-
|
|
133
|
-
setSelectedLocationValue(selectedLabel);
|
|
141
|
+
setSelectedLocationValue(value);
|
|
134
142
|
|
|
135
143
|
if (selectedLocationValue === selectedLabel) {
|
|
136
144
|
dispatch({
|
|
@@ -196,9 +204,9 @@ function SelectionFilter() {
|
|
|
196
204
|
}
|
|
197
205
|
}, [storedName, selectedFilterValue, selectedLocationValue]);
|
|
198
206
|
|
|
199
|
-
console.log(filteredLocationOptions, 'filteredLocationOptions');
|
|
207
|
+
// console.log(filteredLocationOptions, 'filteredLocationOptions');
|
|
200
208
|
|
|
201
|
-
console.log('check', storedName, selectedFilterValue, selectedLocationValue);
|
|
209
|
+
// console.log('check', storedName, selectedFilterValue, selectedLocationValue);
|
|
202
210
|
return (
|
|
203
211
|
<Wrapper>
|
|
204
212
|
<FilterRow>
|
|
@@ -62,7 +62,7 @@ function ReturnMainTable() {
|
|
|
62
62
|
endpoint: `/return_orders/get/client-returns/`,
|
|
63
63
|
method: 'GET',
|
|
64
64
|
});
|
|
65
|
-
console.log('fetchedClientData', fetchedClientData?.data);
|
|
65
|
+
// console.log('fetchedClientData', fetchedClientData?.data);
|
|
66
66
|
|
|
67
67
|
useEffect(() => {
|
|
68
68
|
setLoading(staticDataLoading);
|
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
AntSelect,
|
|
3
|
-
Checkbox,
|
|
4
|
-
displayValueOrNA,
|
|
5
|
-
} from '@bjsdistribution/dms-component-library';
|
|
1
|
+
import { AntSelect, Checkbox } from '@bjsdistribution/dms-component-library';
|
|
6
2
|
import { Empty } from 'antd';
|
|
7
3
|
import React, { useEffect, useRef, useState } from 'react';
|
|
8
4
|
import { Skeleton } from 'antd';
|
|
@@ -18,9 +14,9 @@ import {
|
|
|
18
14
|
} from '../../return-order-table/return-orders-filters/returnstyles';
|
|
19
15
|
import LoadIcon from '../../../../assets/icons/LoadIcon';
|
|
20
16
|
import { usePrintOptionTOggle } from '../../store/store';
|
|
21
|
-
import PrintDropDown from '../../../order-view/details-filters/left-side-filters/dropdowns/
|
|
17
|
+
import PrintDropDown from '../../../order-view/details-filters/left-side-filters/dropdowns/PrintDropDownReturn';
|
|
22
18
|
import { NavLink } from 'react-router-dom';
|
|
23
|
-
import { formatDate } from '../../shared/utlis';
|
|
19
|
+
import { displayValueOrNA, formatDate } from '../../shared/utlis';
|
|
24
20
|
|
|
25
21
|
const OrderTable = ({ loadingskeleton }: any) => {
|
|
26
22
|
const [selectedOrders, setSelectedReturnOrder] = useSelectedOrders();
|
|
@@ -207,7 +203,7 @@ const OrderTable = ({ loadingskeleton }: any) => {
|
|
|
207
203
|
<td>{displayValueOrNA(item?.order_number)}</td>
|
|
208
204
|
|
|
209
205
|
<td>{displayValueOrNA(item?.box_count)}</td>
|
|
210
|
-
<td>{displayValueOrNA(item?.weight)}KG</td>
|
|
206
|
+
<td>{displayValueOrNA(item?.weight)} KG</td>
|
|
211
207
|
<td>{displayValueOrNA(item?.cube)}</td>
|
|
212
208
|
<td>
|
|
213
209
|
<AntSelect
|
package/src/components/order-daily-overview/return-after-table/table-filters/ReturnFilterStore.ts
CHANGED
|
@@ -67,20 +67,18 @@ const filterReducer = (state: FilterState, action: any): FilterState => {
|
|
|
67
67
|
],
|
|
68
68
|
};
|
|
69
69
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
// ],
|
|
83
|
-
// };
|
|
70
|
+
case 'SET_STATUS_ORDER_FILTER':
|
|
71
|
+
return {
|
|
72
|
+
...state,
|
|
73
|
+
'x-filters': [
|
|
74
|
+
...state['x-filters'].filter(f => f.field !== 'status_id'),
|
|
75
|
+
{
|
|
76
|
+
field: 'status_id',
|
|
77
|
+
op: '=',
|
|
78
|
+
value: action.payload,
|
|
79
|
+
},
|
|
80
|
+
],
|
|
81
|
+
};
|
|
84
82
|
|
|
85
83
|
// case 'SET_LOCATION_FILTER':
|
|
86
84
|
// return {
|
package/src/components/order-daily-overview/return-after-table/table-filters/ReturnOrderFilter.tsx
CHANGED
|
@@ -7,27 +7,30 @@ import {
|
|
|
7
7
|
import TableFilters from './TableFilters';
|
|
8
8
|
import FilterIcon from '../../../../assets/icons/FilterIcon';
|
|
9
9
|
import DateIcon from '../../../../assets/icons/DateIcon';
|
|
10
|
-
import StatusIcon from '../../../../assets/icons/StatusIcon';
|
|
10
|
+
// import StatusIcon from '../../../../assets/icons/StatusIcon';
|
|
11
11
|
import ClientIcon from '../../../../assets/icons/ClientIcon';
|
|
12
|
-
import AssigneIcon from '../../../../assets/icons/AssigneIcon';
|
|
13
|
-
import { DatePicker, Select
|
|
12
|
+
// import AssigneIcon from '../../../../assets/icons/AssigneIcon';
|
|
13
|
+
import { DatePicker, Select } from 'antd';
|
|
14
14
|
import { useAtom } from '../../../order-view/store';
|
|
15
15
|
import styled from 'styled-components';
|
|
16
16
|
import { filtersReducerAtom } from './ReturnFilterStore';
|
|
17
17
|
import dayjs from 'dayjs';
|
|
18
|
-
import { useCustomerData } from '../../../store';
|
|
18
|
+
import { useCustomerData, useStatusOrderData } from '../../../store';
|
|
19
|
+
import StatusIcon from '../../../../assets/icons/StatusIcon';
|
|
20
|
+
import AssigneIcon from '../../../../assets/icons/AssigneIcon';
|
|
19
21
|
|
|
20
22
|
const ReturnOrderFilter = () => {
|
|
21
23
|
const [, dispatch] = useAtom(filtersReducerAtom);
|
|
22
24
|
const [customers] = useCustomerData();
|
|
23
25
|
const [selectedDate, setSelectedDate] = useState();
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
26
|
+
const [statusOfOrder] = useStatusOrderData();
|
|
27
|
+
// const zoneOptions = [
|
|
28
|
+
// { label: 'Zone 1', value: 'zone1' },
|
|
29
|
+
// { label: 'Zone 2', value: 'zone2' },
|
|
30
|
+
// { label: 'Zone 3', value: 'zone3' },
|
|
31
|
+
// { label: 'Zone 4', value: 'zone4' },
|
|
32
|
+
// { label: 'Zone 5', value: 'zone5' },
|
|
33
|
+
// ];
|
|
31
34
|
|
|
32
35
|
// date change here
|
|
33
36
|
const handleDateChange = (date: any | null) => {
|
|
@@ -52,6 +55,14 @@ const ReturnOrderFilter = () => {
|
|
|
52
55
|
value: option?.id,
|
|
53
56
|
}));
|
|
54
57
|
|
|
58
|
+
//status of order
|
|
59
|
+
const orderOptions = statusOfOrder?.map((option: any) => ({
|
|
60
|
+
label:
|
|
61
|
+
option?.status_type?.charAt(0)?.toUpperCase() +
|
|
62
|
+
option?.status_type?.slice(1),
|
|
63
|
+
value: option?.id,
|
|
64
|
+
}));
|
|
65
|
+
|
|
55
66
|
const handleClientChange = (value: any) => {
|
|
56
67
|
console.log(value, 'value');
|
|
57
68
|
dispatch({
|
|
@@ -60,6 +71,14 @@ const ReturnOrderFilter = () => {
|
|
|
60
71
|
});
|
|
61
72
|
};
|
|
62
73
|
|
|
74
|
+
const handleStatusOfOrder = (value: any) => {
|
|
75
|
+
console.log(value, 'value');
|
|
76
|
+
dispatch({
|
|
77
|
+
type: 'SET_STATUS_ORDER_FILTER',
|
|
78
|
+
payload: value,
|
|
79
|
+
});
|
|
80
|
+
};
|
|
81
|
+
|
|
63
82
|
return (
|
|
64
83
|
<>
|
|
65
84
|
<StyledFiter>
|
|
@@ -94,22 +113,12 @@ const ReturnOrderFilter = () => {
|
|
|
94
113
|
</div>
|
|
95
114
|
<StyledAntSelect>
|
|
96
115
|
<Select
|
|
97
|
-
options={
|
|
116
|
+
options={orderOptions}
|
|
98
117
|
className="custom-select"
|
|
99
118
|
placeholder="Status of Order"
|
|
100
|
-
onChange={
|
|
101
|
-
style={{ minWidth: '
|
|
102
|
-
|
|
103
|
-
maxTagPlaceholder={(omittedValues: any) => (
|
|
104
|
-
<Tooltip
|
|
105
|
-
overlayStyle={{ pointerEvents: 'none' }}
|
|
106
|
-
title={omittedValues
|
|
107
|
-
.map(({ label }: any) => label)
|
|
108
|
-
.join(', ')}
|
|
109
|
-
>
|
|
110
|
-
<span>{`${omittedValues.length} selected`}</span>
|
|
111
|
-
</Tooltip>
|
|
112
|
-
)}
|
|
119
|
+
onChange={handleStatusOfOrder}
|
|
120
|
+
style={{ minWidth: '130px' }}
|
|
121
|
+
allowClear
|
|
113
122
|
/>
|
|
114
123
|
</StyledAntSelect>
|
|
115
124
|
</div>
|
|
@@ -123,18 +132,8 @@ const ReturnOrderFilter = () => {
|
|
|
123
132
|
className="custom-select"
|
|
124
133
|
placeholder="Client"
|
|
125
134
|
onChange={handleClientChange}
|
|
126
|
-
style={{ width: '125px' }}
|
|
127
|
-
|
|
128
|
-
maxTagPlaceholder={(omittedValues: any) => (
|
|
129
|
-
<Tooltip
|
|
130
|
-
overlayStyle={{ pointerEvents: 'none' }}
|
|
131
|
-
title={omittedValues
|
|
132
|
-
.map(({ label }: any) => label)
|
|
133
|
-
.join(', ')}
|
|
134
|
-
>
|
|
135
|
-
<span>{`${omittedValues.length} selected`}</span>
|
|
136
|
-
</Tooltip>
|
|
137
|
-
)}
|
|
135
|
+
style={{ width: '125px', border: 'none' }}
|
|
136
|
+
allowClear
|
|
138
137
|
/>
|
|
139
138
|
</StyledAntSelect>
|
|
140
139
|
</div>
|
|
@@ -142,7 +141,7 @@ const ReturnOrderFilter = () => {
|
|
|
142
141
|
<div className="dateiconcontainer">
|
|
143
142
|
<AssigneIcon />
|
|
144
143
|
</div>
|
|
145
|
-
<StyledAntSelect>
|
|
144
|
+
{/* <StyledAntSelect>
|
|
146
145
|
<Select
|
|
147
146
|
options={zoneOptions}
|
|
148
147
|
className="custom-select"
|
|
@@ -161,7 +160,7 @@ const ReturnOrderFilter = () => {
|
|
|
161
160
|
</Tooltip>
|
|
162
161
|
)}
|
|
163
162
|
/>
|
|
164
|
-
</StyledAntSelect>
|
|
163
|
+
</StyledAntSelect> */}
|
|
165
164
|
</div>
|
|
166
165
|
</LeftSideConatiner>
|
|
167
166
|
</StyledFIlterELements>
|
|
@@ -184,6 +183,9 @@ export const StyledAntSelect = styled.div`
|
|
|
184
183
|
border: none;
|
|
185
184
|
width: 80px;
|
|
186
185
|
}
|
|
186
|
+
.ant-select-selector {
|
|
187
|
+
border: 1px solid #ffffff !important;
|
|
188
|
+
}
|
|
187
189
|
:where(.css-dev-only-do-not-override-m4timi).ant-select-single:not(.ant-select-customize-input)
|
|
188
190
|
.ant-select-selector {
|
|
189
191
|
padding: 0 5px;
|
|
@@ -1,16 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Checkbox,
|
|
3
|
-
displayValueOrNA,
|
|
4
|
-
useApiHook,
|
|
5
|
-
} from '@bjsdistribution/dms-component-library';
|
|
1
|
+
import { Checkbox, useApiHook } from '@bjsdistribution/dms-component-library';
|
|
6
2
|
import { Empty } from 'antd';
|
|
7
3
|
import { useAtom } from 'jotai';
|
|
8
|
-
import React, { useEffect, useRef
|
|
4
|
+
import React, { useEffect, useRef } from 'react';
|
|
9
5
|
import { Skeleton } from 'antd';
|
|
10
6
|
import {
|
|
11
7
|
useGroupedPayload,
|
|
8
|
+
useLocationData,
|
|
12
9
|
useNewReturnPayload,
|
|
13
10
|
useReturnPayload,
|
|
11
|
+
useSelectAll,
|
|
14
12
|
useSelectedOrders,
|
|
15
13
|
} from '../../../store';
|
|
16
14
|
import { useReturnData } from '../../../order-view/store';
|
|
@@ -21,21 +19,23 @@ import DownIcon from '../../../../assets/icons/DownIcon';
|
|
|
21
19
|
import { useLoading, usePrintOptionTOggle } from '../../store/store';
|
|
22
20
|
import { ApiResponse } from '../../../types';
|
|
23
21
|
import { filtersReducerAtom } from '../../header-filters/filterStore';
|
|
24
|
-
import
|
|
25
|
-
|
|
22
|
+
import { displayValueOrNA } from '../../shared/utlis';
|
|
23
|
+
import PrintDropDownReturn from '../../../order-view/details-filters/left-side-filters/dropdowns/PrintDropDownReturn';
|
|
24
|
+
const ReturnOrderTable = () => {
|
|
26
25
|
const [state] = useAtom(filtersReducerAtom);
|
|
27
26
|
|
|
28
27
|
const [selectedReturnOrder, setSelectedReturnOrder] = useSelectedOrders();
|
|
29
|
-
const [selectAll, setSelectAll] =
|
|
28
|
+
const [selectAll, setSelectAll] = useSelectAll();
|
|
30
29
|
const { 'x-filters': filters, 'x-pagination': pagination } = state;
|
|
31
30
|
const [returnData, setReturnData] = useReturnData();
|
|
32
|
-
const [, setLoading] = useLoading();
|
|
31
|
+
const [load, setLoading] = useLoading();
|
|
33
32
|
const dropdownRefParent = useRef<HTMLDivElement>(null);
|
|
34
33
|
const dropdownRef = useRef<HTMLDivElement>(null);
|
|
35
34
|
const [printToogle, setPrintToggle] = usePrintOptionTOggle();
|
|
36
35
|
const [createReturn, setReturnPayload] = useReturnPayload();
|
|
37
36
|
const [newpayload, setNewPayload] = useNewReturnPayload();
|
|
38
37
|
const [, setGrouped] = useGroupedPayload();
|
|
38
|
+
const [locationData] = useLocationData();
|
|
39
39
|
|
|
40
40
|
const OpenDropDown = (index: number) => {
|
|
41
41
|
setPrintToggle(prevIndex => (prevIndex === index ? null : index));
|
|
@@ -57,7 +57,7 @@ const ReturnOrderTable = ({ loadingskeleton }: any) => {
|
|
|
57
57
|
}
|
|
58
58
|
};
|
|
59
59
|
|
|
60
|
-
const { data: fetchedOrderData, loading:
|
|
60
|
+
const { data: fetchedOrderData, loading: returnDataLoad } = useApiHook<
|
|
61
61
|
ApiResponse
|
|
62
62
|
>({
|
|
63
63
|
endpoint: '/return_order_products/',
|
|
@@ -67,11 +67,31 @@ const ReturnOrderTable = ({ loadingskeleton }: any) => {
|
|
|
67
67
|
});
|
|
68
68
|
|
|
69
69
|
useEffect(() => {
|
|
70
|
-
setLoading(
|
|
70
|
+
setLoading(returnDataLoad);
|
|
71
71
|
if (fetchedOrderData && fetchedOrderData?.data) {
|
|
72
72
|
setReturnData(fetchedOrderData?.data);
|
|
73
73
|
}
|
|
74
|
-
}, [fetchedOrderData,
|
|
74
|
+
}, [fetchedOrderData, returnDataLoad]);
|
|
75
|
+
|
|
76
|
+
useEffect(() => {
|
|
77
|
+
setLoading(returnDataLoad);
|
|
78
|
+
|
|
79
|
+
if (fetchedOrderData && fetchedOrderData?.data && locationData) {
|
|
80
|
+
const updatedReturnData = fetchedOrderData.data.map(returnItem => {
|
|
81
|
+
const matchingLocation = locationData.find(
|
|
82
|
+
(location: any) => location?.token === returnItem?.return_location
|
|
83
|
+
);
|
|
84
|
+
return {
|
|
85
|
+
...returnItem,
|
|
86
|
+
new_location: matchingLocation
|
|
87
|
+
? matchingLocation.location_name
|
|
88
|
+
: null,
|
|
89
|
+
};
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
setReturnData(updatedReturnData);
|
|
93
|
+
}
|
|
94
|
+
}, [fetchedOrderData, returnDataLoad, locationData]);
|
|
75
95
|
|
|
76
96
|
const handleSelectAll = (e: any) => {
|
|
77
97
|
setSelectAll(e.target.checked);
|
|
@@ -81,23 +101,27 @@ const ReturnOrderTable = ({ loadingskeleton }: any) => {
|
|
|
81
101
|
id: loc.id,
|
|
82
102
|
return_locations: loc?.return_locations,
|
|
83
103
|
return_location: loc?.return_location,
|
|
84
|
-
products: loc
|
|
104
|
+
products: loc?.legacy_product_id,
|
|
85
105
|
order_product_return_action: loc?.order_product_return_action,
|
|
86
|
-
return_location_token: loc?.
|
|
106
|
+
return_location_token: loc?.return_location,
|
|
107
|
+
new_location: loc?.new_location,
|
|
87
108
|
}))
|
|
88
109
|
);
|
|
89
110
|
setNewPayload(
|
|
90
111
|
returnData?.map((loc: any) => ({
|
|
91
112
|
id: loc.id,
|
|
92
113
|
account_number: createReturn?.account_number,
|
|
93
|
-
customer_id: createReturn?.customer_id,
|
|
94
|
-
products: loc
|
|
95
|
-
return_action: loc?.order_product_return_action?.type || null,
|
|
96
|
-
return_location_token: loc?.
|
|
114
|
+
customer_id: +createReturn?.customer_id,
|
|
115
|
+
products: [loc?.legacy_product_id],
|
|
116
|
+
return_action: [loc?.order_product_return_action?.type] || null,
|
|
117
|
+
return_location_token: loc?.return_location || null,
|
|
118
|
+
new_location: loc?.new_location,
|
|
97
119
|
}))
|
|
98
120
|
);
|
|
99
121
|
} else {
|
|
100
122
|
setSelectedReturnOrder([]);
|
|
123
|
+
setNewPayload([]);
|
|
124
|
+
setGrouped([]);
|
|
101
125
|
}
|
|
102
126
|
};
|
|
103
127
|
|
|
@@ -105,13 +129,17 @@ const ReturnOrderTable = ({ loadingskeleton }: any) => {
|
|
|
105
129
|
id: any,
|
|
106
130
|
return_location: any,
|
|
107
131
|
return_locations: any,
|
|
108
|
-
order_product_return_action: any
|
|
132
|
+
order_product_return_action: any,
|
|
133
|
+
new_location: any,
|
|
134
|
+
legacy_product_id: any
|
|
109
135
|
) => {
|
|
110
136
|
setSelectedReturnOrder((prevSelectedLocations: any) => {
|
|
111
137
|
const isSelected = prevSelectedLocations?.some(
|
|
112
138
|
(loc: any) => loc.id === id
|
|
113
139
|
);
|
|
114
140
|
|
|
141
|
+
console.log(new_location, 'new_location');
|
|
142
|
+
|
|
115
143
|
if (isSelected) {
|
|
116
144
|
const updatedSelectedLocations = prevSelectedLocations.filter(
|
|
117
145
|
(loc: any) => loc.id !== id
|
|
@@ -119,9 +147,10 @@ const ReturnOrderTable = ({ loadingskeleton }: any) => {
|
|
|
119
147
|
|
|
120
148
|
setReturnPayload(prevState => ({
|
|
121
149
|
...prevState,
|
|
122
|
-
products:
|
|
150
|
+
products: legacy_product_id,
|
|
123
151
|
return_action: order_product_return_action?.type || null,
|
|
124
|
-
return_location_token:
|
|
152
|
+
return_location_token: return_location || null,
|
|
153
|
+
new_location: new_location,
|
|
125
154
|
}));
|
|
126
155
|
|
|
127
156
|
setNewPayload((prevPayload: any) =>
|
|
@@ -133,19 +162,20 @@ const ReturnOrderTable = ({ loadingskeleton }: any) => {
|
|
|
133
162
|
const newReturnPayload = {
|
|
134
163
|
id,
|
|
135
164
|
account_number: createReturn?.account_number,
|
|
136
|
-
customer_id: createReturn?.customer_id,
|
|
137
|
-
products:
|
|
138
|
-
return_action: order_product_return_action?.type || null,
|
|
139
|
-
return_location_token:
|
|
165
|
+
customer_id: +createReturn?.customer_id,
|
|
166
|
+
products: [legacy_product_id],
|
|
167
|
+
return_action: [order_product_return_action?.type] || null,
|
|
168
|
+
return_location_token: return_location || null,
|
|
140
169
|
};
|
|
141
170
|
|
|
142
171
|
setNewPayload((prevPayload: any) => [...prevPayload, newReturnPayload]);
|
|
143
172
|
|
|
144
173
|
setReturnPayload(prevState => ({
|
|
145
174
|
...prevState,
|
|
146
|
-
products:
|
|
175
|
+
products: legacy_product_id,
|
|
147
176
|
return_action: order_product_return_action?.type || null,
|
|
148
|
-
return_location_token:
|
|
177
|
+
return_location_token: return_location || null,
|
|
178
|
+
new_location: new_location,
|
|
149
179
|
}));
|
|
150
180
|
|
|
151
181
|
return [
|
|
@@ -155,6 +185,7 @@ const ReturnOrderTable = ({ loadingskeleton }: any) => {
|
|
|
155
185
|
return_location,
|
|
156
186
|
return_locations,
|
|
157
187
|
order_product_return_action,
|
|
188
|
+
new_location,
|
|
158
189
|
},
|
|
159
190
|
];
|
|
160
191
|
}
|
|
@@ -209,10 +240,10 @@ const ReturnOrderTable = ({ loadingskeleton }: any) => {
|
|
|
209
240
|
<th>Return Location</th>
|
|
210
241
|
<th>Recipient</th>
|
|
211
242
|
<th>Code</th>
|
|
212
|
-
<th>
|
|
243
|
+
<th>Description</th>
|
|
213
244
|
<th>Part</th>
|
|
214
245
|
<th>Weight</th>
|
|
215
|
-
<th>
|
|
246
|
+
<th>CBM</th>
|
|
216
247
|
<th>Return Reason</th>
|
|
217
248
|
<th>Collected</th>
|
|
218
249
|
<th>Collection Reason</th>
|
|
@@ -220,7 +251,7 @@ const ReturnOrderTable = ({ loadingskeleton }: any) => {
|
|
|
220
251
|
</tr>
|
|
221
252
|
</thead>
|
|
222
253
|
<tbody>
|
|
223
|
-
{
|
|
254
|
+
{load ? (
|
|
224
255
|
<tr>
|
|
225
256
|
<td colSpan={6}>
|
|
226
257
|
<Skeleton active />
|
|
@@ -240,6 +271,7 @@ const ReturnOrderTable = ({ loadingskeleton }: any) => {
|
|
|
240
271
|
<tr key={item.id}>
|
|
241
272
|
<td>
|
|
242
273
|
<Checkbox
|
|
274
|
+
className="custom-check"
|
|
243
275
|
checked={selectedReturnOrder?.some(
|
|
244
276
|
(selectedInvoice: any) =>
|
|
245
277
|
selectedInvoice?.id === item.id
|
|
@@ -249,17 +281,24 @@ const ReturnOrderTable = ({ loadingskeleton }: any) => {
|
|
|
249
281
|
item.id,
|
|
250
282
|
item.return_location,
|
|
251
283
|
item.return_locations,
|
|
252
|
-
item.order_product_return_action
|
|
284
|
+
item.order_product_return_action,
|
|
285
|
+
item.new_location,
|
|
286
|
+
item.legacy_product_id
|
|
253
287
|
)
|
|
254
288
|
}
|
|
255
289
|
/>
|
|
256
290
|
</td>
|
|
257
291
|
|
|
258
292
|
<td>
|
|
259
|
-
{
|
|
293
|
+
{item?.orders_products_stock?.location !== null &&
|
|
294
|
+
item?.orders_products_stock?.location !== undefined ? (
|
|
295
|
+
item.orders_products_stock.location
|
|
296
|
+
) : (
|
|
297
|
+
<div className="awaiting">Awaiting</div>
|
|
298
|
+
)}
|
|
260
299
|
</td>
|
|
261
300
|
|
|
262
|
-
<td> {displayValueOrNA(item?.
|
|
301
|
+
<td> {displayValueOrNA(item?.new_location)}</td>
|
|
263
302
|
|
|
264
303
|
<td>
|
|
265
304
|
<ul style={{ listStyleType: 'none', padding: 0 }}>
|
|
@@ -283,11 +322,15 @@ const ReturnOrderTable = ({ loadingskeleton }: any) => {
|
|
|
283
322
|
</td>
|
|
284
323
|
<td>{displayValueOrNA(item?.code)}</td>
|
|
285
324
|
<td>{displayValueOrNA(item?.description)}</td>
|
|
286
|
-
<td>
|
|
325
|
+
<td>{displayValueOrNA(item?.parts_count)}</td>
|
|
287
326
|
<td>{displayValueOrNA(item?.weight)}KG</td>
|
|
288
327
|
<td>{displayValueOrNA(item?.cube)}</td>
|
|
289
328
|
<td>{displayValueOrNA(item?.return_reasons?.reason)}</td>
|
|
290
|
-
<td>
|
|
329
|
+
<td>
|
|
330
|
+
{displayValueOrNA(
|
|
331
|
+
item?.order_product_returns?.collected_at
|
|
332
|
+
)}
|
|
333
|
+
</td>
|
|
291
334
|
<td>{displayValueOrNA(item?.collection_reasons?.reason)}</td>
|
|
292
335
|
<td>
|
|
293
336
|
<ul className="actionbox">
|
|
@@ -303,7 +346,7 @@ const ReturnOrderTable = ({ loadingskeleton }: any) => {
|
|
|
303
346
|
<DownIcon />
|
|
304
347
|
{printToogle == index && (
|
|
305
348
|
<div ref={dropdownRef}>
|
|
306
|
-
<
|
|
349
|
+
<PrintDropDownReturn />
|
|
307
350
|
</div>
|
|
308
351
|
)}
|
|
309
352
|
</li>
|
package/src/components/order-daily-overview/return-order-table/return-orders-filters/returnstyles.ts
CHANGED
|
@@ -245,6 +245,9 @@ export const StyledTable = styled.table`
|
|
|
245
245
|
width: fit-content;
|
|
246
246
|
}
|
|
247
247
|
}
|
|
248
|
+
.custom-check {
|
|
249
|
+
position: relative;
|
|
250
|
+
}
|
|
248
251
|
.emailInvoiceNo {
|
|
249
252
|
padding-left: 0px;
|
|
250
253
|
}
|
|
@@ -386,6 +389,20 @@ export const StyledTable = styled.table`
|
|
|
386
389
|
border-radius: 22px;
|
|
387
390
|
background: rgba(41, 204, 106, 0.15);
|
|
388
391
|
}
|
|
392
|
+
.awaiting {
|
|
393
|
+
display: flex;
|
|
394
|
+
min-width: 85px;
|
|
395
|
+
padding: 6px 10px;
|
|
396
|
+
justify-content: center;
|
|
397
|
+
align-items: center;
|
|
398
|
+
gap: 5px;
|
|
399
|
+
border-radius: 22px;
|
|
400
|
+
background: rgba(233, 82, 82, 0.15);
|
|
401
|
+
color: #e95252;
|
|
402
|
+
font-family: 'Open Sans';
|
|
403
|
+
font-size: 12px;
|
|
404
|
+
font-weight: 600;
|
|
405
|
+
}
|
|
389
406
|
ul > li > a {
|
|
390
407
|
text-decoration: none !important;
|
|
391
408
|
color: #0099ff;
|
|
@@ -74,5 +74,11 @@ export const formatDate = (date: any) => {
|
|
|
74
74
|
|
|
75
75
|
export const displayValueOrNA = (value: any) => {
|
|
76
76
|
const isBlankArray = Array.isArray(value) && value.length === 0;
|
|
77
|
-
|
|
77
|
+
if (value === 0) {
|
|
78
|
+
return 0;
|
|
79
|
+
}
|
|
80
|
+
if (value === 'NA' || value === undefined || value === null || isBlankArray) {
|
|
81
|
+
return 'NA';
|
|
82
|
+
}
|
|
83
|
+
return value;
|
|
78
84
|
};
|