@bjsdistribution/dms-client-return 0.0.9 → 0.0.10
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/return-after-table/table-filters/ReturnFilterStore.d.ts +16 -0
- package/dist/components/order-daily-overview/return-after-table/table-filters/ReturnOrderFilter.d.ts +1 -0
- package/dist/components/store.d.ts +12 -2
- package/dist/components/types.d.ts +7 -0
- package/dist/dms-client-return.cjs.development.js +692 -425
- 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 +693 -426
- package/dist/dms-client-return.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/common/custom-switch/index.tsx +12 -4
- package/src/components/order-daily-overview/filters/FilterStyle.tsx +2 -13
- package/src/components/order-daily-overview/filters/Filters.tsx +7 -1
- package/src/components/order-daily-overview/header-filters/HeaderFilter.tsx +1 -1
- package/src/components/order-daily-overview/header-filters/SelectionFilter.tsx +46 -1
- package/src/components/order-daily-overview/return-after-table/ReturnAfterTable.tsx +6 -5
- package/src/components/order-daily-overview/return-after-table/table-filters/ReturnFilterStore.ts +130 -0
- package/src/components/order-daily-overview/return-after-table/table-filters/ReturnOrderFilter.tsx +143 -63
- package/src/components/order-daily-overview/return-order-table/return-orders-filters/ReturnFilter.tsx +3 -2
- package/src/components/order-daily-overview/return-order-table/return-orders-filters/ReturnOrderTable.tsx +123 -14
- package/src/components/order-daily-overview/return-order-table/return-orders-filters/returnstyles.ts +1 -1
- package/src/components/order-daily-overview/table/ReturnTable.tsx +12 -0
- package/src/components/order-view/hooks/useGetEventNotes.tsx +15 -2
- package/src/components/order-view/hooks/useGetSystemLogs.tsx +14 -2
- package/src/components/order-view/hooks/useUpdateOrder.ts +13 -2
- package/src/components/order-view/modalsPopup/CreateReturnModal.tsx +14 -17
- package/src/components/order-view/modalsPopup/ModalManager.tsx +90 -62
- package/src/components/order-view/notes/AddNote.tsx +7 -2
- package/src/components/order-view/order-actions/actions/change-customer-account/ChangeCustomerAccModal.tsx +6 -2
- package/src/components/order-view/order-actions/actions/escalation/Dropdowns.tsx +5 -0
- package/src/components/order-view/order-actions/actions/escalation/upgrade/index.tsx +7 -1
- package/src/components/order-view/order-actions/hooks/useAllReminderData.ts +13 -2
- package/src/components/order-view/order-actions/hooks/useAllTaskData.ts +15 -5
- package/src/components/order-view/order-actions/hooks/useCreateReminder.ts +20 -4
- package/src/components/order-view/order-actions/hooks/useCreateTask.ts +14 -3
- package/src/components/order-view/order-actions/hooks/useFetchSingleFlagData.ts +15 -3
- package/src/components/order-view/order-actions/hooks/useFetchSingleReminder.ts +13 -2
- package/src/components/order-view/order-actions/hooks/useUpdateFlag.ts +12 -2
- package/src/components/order-view/order-actions/hooks/useUpdateReminder.ts +12 -2
- package/src/components/order-view/products-info/expanded-content/index.tsx +6 -1
- package/src/components/order-view/return-client-products/product-table-footer/ProductDetailsFooter.tsx +6 -1
- package/src/components/order-view/system-event-logs/expanded-content/index.tsx +7 -1
- package/src/components/order-view/view-reminder/AssigneeDropdown.tsx +6 -1
- package/src/components/store.ts +30 -1
- package/src/components/types.ts +8 -0
- package/src/index.tsx +8 -4
package/package.json
CHANGED
|
@@ -2,6 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import styled from 'styled-components';
|
|
3
3
|
import { options } from '../../components/fakeData';
|
|
4
4
|
import SwitchSelector from 'react-switch-selector';
|
|
5
|
+
import { notification } from 'antd';
|
|
5
6
|
|
|
6
7
|
interface CustomSwitchSelectorProps {
|
|
7
8
|
onSwitchChange: (newValue: string) => void;
|
|
@@ -18,10 +19,17 @@ const CustomSwitchSelector: React.FC<CustomSwitchSelectorProps> = ({
|
|
|
18
19
|
if (typeof selectedOptionValue === 'string') {
|
|
19
20
|
onSwitchChange(selectedOptionValue);
|
|
20
21
|
} else {
|
|
21
|
-
console.error(
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
);
|
|
22
|
+
// console.error(
|
|
23
|
+
// 'Unexpected type for selectedOptionValue:',
|
|
24
|
+
// typeof selectedOptionValue
|
|
25
|
+
// );
|
|
26
|
+
|
|
27
|
+
notification.error({
|
|
28
|
+
message: 'Error',
|
|
29
|
+
description:
|
|
30
|
+
`${typeof selectedOptionValue}` ||
|
|
31
|
+
'Unexpected type for selectedOptionValue.',
|
|
32
|
+
});
|
|
25
33
|
}
|
|
26
34
|
};
|
|
27
35
|
|
|
@@ -44,9 +44,9 @@ export const LeftSideConatiner = styled.div`
|
|
|
44
44
|
padding: 6px 8px;
|
|
45
45
|
justify-content: center;
|
|
46
46
|
align-items: center;
|
|
47
|
-
gap:
|
|
47
|
+
gap: 2px;
|
|
48
48
|
border-radius: 20px;
|
|
49
|
-
border: 1px solid
|
|
49
|
+
border: 1px solid #edebe8;
|
|
50
50
|
|
|
51
51
|
.dateiconcontainer {
|
|
52
52
|
display: flex;
|
|
@@ -70,17 +70,6 @@ export const LeftSideConatiner = styled.div`
|
|
|
70
70
|
font-weight: 400;
|
|
71
71
|
line-height: 16px; /* 123.077% */
|
|
72
72
|
}
|
|
73
|
-
.roundbox {
|
|
74
|
-
display: flex;
|
|
75
|
-
width: 18px;
|
|
76
|
-
height: 18px;
|
|
77
|
-
flex-direction: column;
|
|
78
|
-
justify-content: center;
|
|
79
|
-
align-items: center;
|
|
80
|
-
border-radius: 18px;
|
|
81
|
-
background: #fff;
|
|
82
|
-
box-shadow: 0px 1px 4px 0px rgba(0, 0, 0, 0.1);
|
|
83
|
-
}
|
|
84
73
|
}
|
|
85
74
|
`;
|
|
86
75
|
|
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
useCountData,
|
|
15
15
|
useRoutesTable,
|
|
16
16
|
} from '../store/store';
|
|
17
|
+
import { notification } from 'antd';
|
|
17
18
|
// import { useAtom } from 'jotai';
|
|
18
19
|
|
|
19
20
|
const Filters = () => {
|
|
@@ -46,7 +47,12 @@ const Filters = () => {
|
|
|
46
47
|
setPaginationObject(rest);
|
|
47
48
|
setCount(count);
|
|
48
49
|
} else {
|
|
49
|
-
console.error('Pagination data is null');
|
|
50
|
+
// console.error('Pagination data is null');
|
|
51
|
+
|
|
52
|
+
notification.error({
|
|
53
|
+
message: 'Error',
|
|
54
|
+
description: 'Pagination data is null',
|
|
55
|
+
});
|
|
50
56
|
}
|
|
51
57
|
}
|
|
52
58
|
}, [apiLoading]);
|
|
@@ -9,7 +9,13 @@ import {
|
|
|
9
9
|
Wrapper,
|
|
10
10
|
} from './Styledfilters';
|
|
11
11
|
import { atom, useAtom } from 'jotai';
|
|
12
|
-
import {
|
|
12
|
+
import {
|
|
13
|
+
useActionType,
|
|
14
|
+
useCustomerData,
|
|
15
|
+
useLocationData,
|
|
16
|
+
useNewReturnPayload,
|
|
17
|
+
useReturnPayload,
|
|
18
|
+
} from '../../store';
|
|
13
19
|
import { filtersReducerAtom } from './filterStore';
|
|
14
20
|
import {
|
|
15
21
|
useSelectedAction,
|
|
@@ -39,6 +45,10 @@ function SelectionFilter() {
|
|
|
39
45
|
const [, setClientLabel] = useTableName();
|
|
40
46
|
const [, setName] = useState<any>();
|
|
41
47
|
const [isButtonEnabled, setIsButtonEnabled] = useState(false);
|
|
48
|
+
const [, setReturnPayload] = useReturnPayload();
|
|
49
|
+
const [storedAccNumber, setStoredAccNumber] = useState<any>();
|
|
50
|
+
const [storedCustomerId, setStoredCustomerId] = useState<any>();
|
|
51
|
+
const [, setNewPayload] = useNewReturnPayload();
|
|
42
52
|
|
|
43
53
|
//client options
|
|
44
54
|
const clientOptions = customers?.map((option: any) => ({
|
|
@@ -48,6 +58,8 @@ function SelectionFilter() {
|
|
|
48
58
|
value: `${option?.id}_${option?.uuid}`,
|
|
49
59
|
id: option?.id,
|
|
50
60
|
uuid: option?.uuid,
|
|
61
|
+
account_number: option?.account_number,
|
|
62
|
+
gsit_customer_id: option?.gsit_customer_id,
|
|
51
63
|
}));
|
|
52
64
|
|
|
53
65
|
const actionTypeOptions = actionType?.map((option: any) => ({
|
|
@@ -62,14 +74,27 @@ function SelectionFilter() {
|
|
|
62
74
|
|
|
63
75
|
//client change
|
|
64
76
|
const handleSelectChange = (value: unknown, option: DefaultOptionType) => {
|
|
77
|
+
setNewPayload([]);
|
|
65
78
|
console.log(value, 'value');
|
|
66
79
|
const selectedLabel = option?.label as string;
|
|
67
80
|
const selectedValue = option?.id as number;
|
|
68
81
|
const selectedUuids = option?.uuid as string;
|
|
82
|
+
const selectAccountNumber = option.account_number as string;
|
|
83
|
+
const selectedCustomerId = option.gsit_customer_id as number;
|
|
69
84
|
setSelectedClient(selectedValue);
|
|
70
85
|
setName(selectedLabel);
|
|
71
86
|
localStorage.setItem('clientName', selectedLabel);
|
|
72
87
|
localStorage.setItem('clientId', selectedValue.toString());
|
|
88
|
+
localStorage.setItem('account_number', selectAccountNumber);
|
|
89
|
+
localStorage.setItem('customer_id', selectedCustomerId.toString());
|
|
90
|
+
const storedAccNo = localStorage.getItem('account_number');
|
|
91
|
+
const storedCustomerId = localStorage.getItem('customer_id');
|
|
92
|
+
setReturnPayload((prevState: any) => ({
|
|
93
|
+
...prevState,
|
|
94
|
+
account_number: storedAccNo,
|
|
95
|
+
customer_id: storedCustomerId,
|
|
96
|
+
}));
|
|
97
|
+
console.log(selectedUuids, 'selectedUuids');
|
|
73
98
|
const filteredSubLocations = locationData
|
|
74
99
|
?.filter((subCat: any) => subCat?.customer_id === selectedUuids)
|
|
75
100
|
.map((subCat: any) => ({
|
|
@@ -81,6 +106,24 @@ function SelectionFilter() {
|
|
|
81
106
|
setUuid('');
|
|
82
107
|
};
|
|
83
108
|
|
|
109
|
+
useEffect(() => {
|
|
110
|
+
const accountNumberFromStorage = localStorage.getItem('account_number');
|
|
111
|
+
const customerIdFromStorage = localStorage.getItem('customer_id');
|
|
112
|
+
if (accountNumberFromStorage) {
|
|
113
|
+
setStoredAccNumber(accountNumberFromStorage);
|
|
114
|
+
}
|
|
115
|
+
if (customerIdFromStorage) {
|
|
116
|
+
setStoredCustomerId(customerIdFromStorage);
|
|
117
|
+
}
|
|
118
|
+
if (storedAccNumber && storedCustomerId) {
|
|
119
|
+
setReturnPayload((prevState: any) => ({
|
|
120
|
+
...prevState,
|
|
121
|
+
account_number: storedAccNumber,
|
|
122
|
+
customer_id: storedCustomerId,
|
|
123
|
+
}));
|
|
124
|
+
}
|
|
125
|
+
}, [storedAccNumber, storedCustomerId]);
|
|
126
|
+
|
|
84
127
|
useEffect(() => {}, [getUuid, filteredLocationOptions]);
|
|
85
128
|
|
|
86
129
|
//location change
|
|
@@ -153,6 +196,8 @@ function SelectionFilter() {
|
|
|
153
196
|
}
|
|
154
197
|
}, [storedName, selectedFilterValue, selectedLocationValue]);
|
|
155
198
|
|
|
199
|
+
console.log(filteredLocationOptions, 'filteredLocationOptions');
|
|
200
|
+
|
|
156
201
|
console.log('check', storedName, selectedFilterValue, selectedLocationValue);
|
|
157
202
|
return (
|
|
158
203
|
<Wrapper>
|
|
@@ -4,14 +4,17 @@ import RouterHeader from '../header/route-header/RouterHeader';
|
|
|
4
4
|
import HeaderFilter from '../header-filters/HeaderFilter';
|
|
5
5
|
import OrderTable from './table/OrderTable';
|
|
6
6
|
import ReturnOrderFilter from './table-filters/ReturnOrderFilter';
|
|
7
|
-
import { useReturnAfterOrderData } from '../../order-view/store';
|
|
7
|
+
import { useAtom, useReturnAfterOrderData } from '../../order-view/store';
|
|
8
8
|
import { useLoading } from '../store/store';
|
|
9
9
|
import { ApiResponse } from '../common/interface';
|
|
10
10
|
import { useApiHook } from '@bjsdistribution/dms-component-library';
|
|
11
|
+
import { filtersReducerAtom } from './table-filters/ReturnFilterStore';
|
|
11
12
|
|
|
12
13
|
const ReturnAfterTable = () => {
|
|
13
|
-
const [
|
|
14
|
+
const [, setReturnOrderData] = useReturnAfterOrderData();
|
|
14
15
|
const [, setLoading] = useLoading();
|
|
16
|
+
const [state] = useAtom(filtersReducerAtom);
|
|
17
|
+
const { 'x-filters': filters } = state;
|
|
15
18
|
|
|
16
19
|
const {
|
|
17
20
|
data: fetchedReturnOrderData,
|
|
@@ -19,6 +22,7 @@ const ReturnAfterTable = () => {
|
|
|
19
22
|
} = useApiHook<ApiResponse>({
|
|
20
23
|
endpoint: '/return_orders/?skip_filters=0',
|
|
21
24
|
method: 'GET',
|
|
25
|
+
filters: filters,
|
|
22
26
|
});
|
|
23
27
|
useEffect(() => {
|
|
24
28
|
setLoading(staticDataLoading);
|
|
@@ -26,9 +30,6 @@ const ReturnAfterTable = () => {
|
|
|
26
30
|
setReturnOrderData(fetchedReturnOrderData?.data);
|
|
27
31
|
}
|
|
28
32
|
}, [fetchedReturnOrderData, staticDataLoading]);
|
|
29
|
-
|
|
30
|
-
console.log('returnAfterOrder', returnAfterOrder);
|
|
31
|
-
|
|
32
33
|
return (
|
|
33
34
|
<div>
|
|
34
35
|
<DashBoardWrapper>
|
package/src/components/order-daily-overview/return-after-table/table-filters/ReturnFilterStore.ts
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { atom, useAtom } from 'jotai';
|
|
2
|
+
// import { formatDate } from '../shared/utlis';
|
|
3
|
+
import { format } from 'date-fns';
|
|
4
|
+
|
|
5
|
+
const date = atom(new Date());
|
|
6
|
+
export const usedate = () => {
|
|
7
|
+
return useAtom(date);
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
interface Filter {
|
|
11
|
+
field: string;
|
|
12
|
+
op: string;
|
|
13
|
+
value: any;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
interface Pagination {
|
|
17
|
+
page: number;
|
|
18
|
+
per_page: number;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
interface FilterState {
|
|
22
|
+
'x-filters': Filter[];
|
|
23
|
+
'x-pagination': Pagination;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const initialState: FilterState = {
|
|
27
|
+
'x-filters': [],
|
|
28
|
+
'x-pagination': { page: 1, per_page: 50 },
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const filterReducer = (state: FilterState, action: any): FilterState => {
|
|
32
|
+
switch (action.type) {
|
|
33
|
+
case 'SET_DATE_FILTER':
|
|
34
|
+
return {
|
|
35
|
+
...state,
|
|
36
|
+
'x-filters': [
|
|
37
|
+
...state['x-filters'].filter(f => f.field !== 'created_at'),
|
|
38
|
+
{
|
|
39
|
+
field: 'created_at',
|
|
40
|
+
op: '>=',
|
|
41
|
+
value: `${format(
|
|
42
|
+
new Date(action.payload),
|
|
43
|
+
'yyyy-MM-dd'
|
|
44
|
+
)}T00:00:00+00:00`,
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
field: 'created_at',
|
|
48
|
+
op: '<=',
|
|
49
|
+
value: `${format(
|
|
50
|
+
new Date(action.payload),
|
|
51
|
+
'yyyy-MM-dd'
|
|
52
|
+
)}T23:59:59+00:00`,
|
|
53
|
+
},
|
|
54
|
+
],
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
case 'SET_CLIENT_FILTER':
|
|
58
|
+
return {
|
|
59
|
+
...state,
|
|
60
|
+
'x-filters': [
|
|
61
|
+
...state['x-filters'].filter(f => f.field !== 'customer_id'),
|
|
62
|
+
{
|
|
63
|
+
field: 'customer_id',
|
|
64
|
+
op: '=',
|
|
65
|
+
value: action.payload,
|
|
66
|
+
},
|
|
67
|
+
],
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
// case 'SET_ACTIONS_FILTER':
|
|
71
|
+
// return {
|
|
72
|
+
// ...state,
|
|
73
|
+
// 'x-filters': [
|
|
74
|
+
// ...state['x-filters'].filter(
|
|
75
|
+
// f => f.field !== 'product_return_action_id'
|
|
76
|
+
// ),
|
|
77
|
+
// {
|
|
78
|
+
// field: 'product_return_action_id',
|
|
79
|
+
// op: '=',
|
|
80
|
+
// value: action.payload,
|
|
81
|
+
// },
|
|
82
|
+
// ],
|
|
83
|
+
// };
|
|
84
|
+
|
|
85
|
+
// case 'SET_LOCATION_FILTER':
|
|
86
|
+
// return {
|
|
87
|
+
// ...state,
|
|
88
|
+
// 'x-filters': [
|
|
89
|
+
// ...state['x-filters'].filter(f => f.field !== 'return_location'),
|
|
90
|
+
// {
|
|
91
|
+
// field: 'return_location',
|
|
92
|
+
// op: 'in',
|
|
93
|
+
// value: action.payload,
|
|
94
|
+
// },
|
|
95
|
+
// ],
|
|
96
|
+
// };
|
|
97
|
+
|
|
98
|
+
case 'SET_PAGE':
|
|
99
|
+
return {
|
|
100
|
+
...state,
|
|
101
|
+
'x-pagination': {
|
|
102
|
+
...state['x-pagination'],
|
|
103
|
+
page: action.payload,
|
|
104
|
+
},
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
case 'SET_PERPAGE':
|
|
108
|
+
return {
|
|
109
|
+
...state,
|
|
110
|
+
'x-pagination': {
|
|
111
|
+
...state['x-pagination'],
|
|
112
|
+
per_page: action.payload,
|
|
113
|
+
},
|
|
114
|
+
};
|
|
115
|
+
case 'CLEAR_FILTERS':
|
|
116
|
+
return {
|
|
117
|
+
...state,
|
|
118
|
+
};
|
|
119
|
+
default:
|
|
120
|
+
return state;
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
const filtersStateAtom = atom(initialState);
|
|
125
|
+
|
|
126
|
+
export const filtersReducerAtom = atom(
|
|
127
|
+
get => get(filtersStateAtom),
|
|
128
|
+
(get, set, action) =>
|
|
129
|
+
set(filtersStateAtom, filterReducer(get(filtersStateAtom), action))
|
|
130
|
+
);
|
package/src/components/order-daily-overview/return-after-table/table-filters/ReturnOrderFilter.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
2
2
|
import {
|
|
3
3
|
LeftSideConatiner,
|
|
4
4
|
StyledFIlterELements,
|
|
@@ -7,62 +7,59 @@ 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 DownArrowIcon from '../../../../assets/icons/DownArrowIcon';
|
|
11
10
|
import StatusIcon from '../../../../assets/icons/StatusIcon';
|
|
12
11
|
import ClientIcon from '../../../../assets/icons/ClientIcon';
|
|
13
12
|
import AssigneIcon from '../../../../assets/icons/AssigneIcon';
|
|
14
|
-
import { DatePicker,
|
|
15
|
-
import {
|
|
16
|
-
useOrderDetails,
|
|
17
|
-
usePrevOrderDetails,
|
|
18
|
-
} from '../../../order-view/store';
|
|
19
|
-
import dayjs from 'dayjs';
|
|
13
|
+
import { DatePicker, Select, Tooltip } from 'antd';
|
|
14
|
+
import { useAtom } from '../../../order-view/store';
|
|
20
15
|
import styled from 'styled-components';
|
|
16
|
+
import { filtersReducerAtom } from './ReturnFilterStore';
|
|
17
|
+
import dayjs from 'dayjs';
|
|
18
|
+
import { useCustomerData } from '../../../store';
|
|
21
19
|
|
|
22
20
|
const ReturnOrderFilter = () => {
|
|
23
|
-
const [
|
|
24
|
-
const [
|
|
21
|
+
const [, dispatch] = useAtom(filtersReducerAtom);
|
|
22
|
+
const [customers] = useCustomerData();
|
|
23
|
+
const [selectedDate, setSelectedDate] = useState();
|
|
24
|
+
const zoneOptions = [
|
|
25
|
+
{ label: 'Zone 1', value: 'zone1' },
|
|
26
|
+
{ label: 'Zone 2', value: 'zone2' },
|
|
27
|
+
{ label: 'Zone 3', value: 'zone3' },
|
|
28
|
+
{ label: 'Zone 4', value: 'zone4' },
|
|
29
|
+
{ label: 'Zone 5', value: 'zone5' },
|
|
30
|
+
];
|
|
25
31
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
: null;
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
prevOrderDetails.action_date !== undefined
|
|
38
|
-
) {
|
|
39
|
-
if (
|
|
40
|
-
new Date(selectedDate).toLocaleDateString() ===
|
|
41
|
-
new Date(prevOrderDetails.action_date!).toLocaleDateString()
|
|
42
|
-
) {
|
|
43
|
-
setOrderDetails(prev => {
|
|
44
|
-
return {
|
|
45
|
-
...prev,
|
|
46
|
-
action_date: prevOrderDetails.action_date,
|
|
47
|
-
};
|
|
48
|
-
});
|
|
49
|
-
} else {
|
|
50
|
-
setOrderDetails(prev => {
|
|
51
|
-
return {
|
|
52
|
-
...prev,
|
|
53
|
-
action_date: selectedDate,
|
|
54
|
-
};
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
} else {
|
|
58
|
-
setOrderDetails(prev => {
|
|
59
|
-
return {
|
|
60
|
-
...prev,
|
|
61
|
-
action_date: null,
|
|
62
|
-
};
|
|
32
|
+
// date change here
|
|
33
|
+
const handleDateChange = (date: any | null) => {
|
|
34
|
+
setSelectedDate(date ? date?.$d : null);
|
|
35
|
+
console.log(selectedDate, 'selected');
|
|
36
|
+
};
|
|
37
|
+
useEffect(() => {
|
|
38
|
+
if (selectedDate) {
|
|
39
|
+
console.log(selectedDate, 'selected');
|
|
40
|
+
dispatch({
|
|
41
|
+
type: 'SET_DATE_FILTER',
|
|
42
|
+
payload: selectedDate,
|
|
63
43
|
});
|
|
64
44
|
}
|
|
45
|
+
}, [selectedDate]);
|
|
46
|
+
|
|
47
|
+
//client options
|
|
48
|
+
const clientOptions = customers?.map((option: any) => ({
|
|
49
|
+
label:
|
|
50
|
+
option?.customer_name?.charAt(0)?.toUpperCase() +
|
|
51
|
+
option?.customer_name?.slice(1),
|
|
52
|
+
value: option?.id,
|
|
53
|
+
}));
|
|
54
|
+
|
|
55
|
+
const handleClientChange = (value: any) => {
|
|
56
|
+
console.log(value, 'value');
|
|
57
|
+
dispatch({
|
|
58
|
+
type: 'SET_CLIENT_FILTER',
|
|
59
|
+
payload: value,
|
|
60
|
+
});
|
|
65
61
|
};
|
|
62
|
+
|
|
66
63
|
return (
|
|
67
64
|
<>
|
|
68
65
|
<StyledFiter>
|
|
@@ -81,41 +78,90 @@ const ReturnOrderFilter = () => {
|
|
|
81
78
|
<StyledDatePicker>
|
|
82
79
|
<DatePicker
|
|
83
80
|
className="custom-datepicker"
|
|
84
|
-
onChange={
|
|
85
|
-
|
|
81
|
+
onChange={handleDateChange}
|
|
82
|
+
style={{ width: '100px' }}
|
|
83
|
+
value={selectedDate ? dayjs(selectedDate) : null}
|
|
86
84
|
format="DD/MM/YY"
|
|
87
85
|
placeholder="Date"
|
|
86
|
+
needConfirm
|
|
88
87
|
/>
|
|
89
88
|
</StyledDatePicker>
|
|
90
89
|
</div>
|
|
91
90
|
|
|
92
91
|
<div className="datefilter">
|
|
93
92
|
<div className="dateiconcontainer">
|
|
94
|
-
|
|
95
|
-
<StatusIcon />{' '}
|
|
96
|
-
</div>
|
|
97
|
-
<div className="datetext">Status of Order</div>
|
|
98
|
-
<div className="roundbox">
|
|
99
|
-
<DownArrowIcon />{' '}
|
|
93
|
+
<StatusIcon />
|
|
100
94
|
</div>
|
|
95
|
+
<StyledAntSelect>
|
|
96
|
+
<Select
|
|
97
|
+
options={zoneOptions}
|
|
98
|
+
className="custom-select"
|
|
99
|
+
placeholder="Status of Order"
|
|
100
|
+
onChange={() => {}}
|
|
101
|
+
style={{ minWidth: '115px' }}
|
|
102
|
+
maxTagCount={0}
|
|
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
|
+
)}
|
|
113
|
+
/>
|
|
114
|
+
</StyledAntSelect>
|
|
101
115
|
</div>
|
|
102
116
|
<div className="datefilter">
|
|
103
117
|
<div className="dateiconcontainer">
|
|
104
118
|
<ClientIcon />
|
|
105
119
|
</div>
|
|
106
|
-
<
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
120
|
+
<StyledAntSelect>
|
|
121
|
+
<Select
|
|
122
|
+
options={clientOptions}
|
|
123
|
+
className="custom-select"
|
|
124
|
+
placeholder="Client"
|
|
125
|
+
onChange={handleClientChange}
|
|
126
|
+
style={{ width: '125px' }}
|
|
127
|
+
maxTagCount={0}
|
|
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
|
+
)}
|
|
138
|
+
/>
|
|
139
|
+
</StyledAntSelect>
|
|
110
140
|
</div>
|
|
111
141
|
<div className="datefilter">
|
|
112
142
|
<div className="dateiconcontainer">
|
|
113
143
|
<AssigneIcon />
|
|
114
144
|
</div>
|
|
115
|
-
<
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
145
|
+
<StyledAntSelect>
|
|
146
|
+
<Select
|
|
147
|
+
options={zoneOptions}
|
|
148
|
+
className="custom-select"
|
|
149
|
+
placeholder="Asignee"
|
|
150
|
+
onChange={() => {}}
|
|
151
|
+
style={{ minWidth: '100px' }}
|
|
152
|
+
maxTagCount={0}
|
|
153
|
+
maxTagPlaceholder={(omittedValues: any) => (
|
|
154
|
+
<Tooltip
|
|
155
|
+
overlayStyle={{ pointerEvents: 'none' }}
|
|
156
|
+
title={omittedValues
|
|
157
|
+
.map(({ label }: any) => label)
|
|
158
|
+
.join(', ')}
|
|
159
|
+
>
|
|
160
|
+
<span>{`${omittedValues.length} selected`}</span>
|
|
161
|
+
</Tooltip>
|
|
162
|
+
)}
|
|
163
|
+
/>
|
|
164
|
+
</StyledAntSelect>
|
|
119
165
|
</div>
|
|
120
166
|
</LeftSideConatiner>
|
|
121
167
|
</StyledFIlterELements>
|
|
@@ -128,8 +174,42 @@ const ReturnOrderFilter = () => {
|
|
|
128
174
|
const StyledDatePicker = styled.div`
|
|
129
175
|
.custom-datepicker {
|
|
130
176
|
border: none;
|
|
177
|
+
}
|
|
178
|
+
`;
|
|
179
|
+
|
|
180
|
+
// const DropdownContainer = styled.div``;
|
|
181
|
+
|
|
182
|
+
export const StyledAntSelect = styled.div`
|
|
183
|
+
.custom-select {
|
|
184
|
+
border: none;
|
|
131
185
|
width: 80px;
|
|
132
186
|
}
|
|
187
|
+
:where(.css-dev-only-do-not-override-m4timi).ant-select-single:not(.ant-select-customize-input)
|
|
188
|
+
.ant-select-selector {
|
|
189
|
+
padding: 0 5px;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
:where(.css-dev-only-do-not-override-m4timi).ant-select-outlined:not(.ant-select-customize-input)
|
|
193
|
+
.ant-select-selector {
|
|
194
|
+
border: none;
|
|
195
|
+
}
|
|
196
|
+
.roundbox {
|
|
197
|
+
display: flex;
|
|
198
|
+
width: 18px;
|
|
199
|
+
height: 18px;
|
|
200
|
+
flex-direction: column;
|
|
201
|
+
justify-content: center;
|
|
202
|
+
align-items: center;
|
|
203
|
+
border-radius: 18px;
|
|
204
|
+
background: #fff;
|
|
205
|
+
box-shadow: 0px 1px 4px 0px rgba(0, 0, 0, 0.1);
|
|
206
|
+
left: 359px;
|
|
207
|
+
position: absolute;
|
|
208
|
+
border-radius: 18px;
|
|
209
|
+
background: #fff;
|
|
210
|
+
box-shadow: 0px 1px 4px 0px rgba(0, 0, 0, 0.1);
|
|
211
|
+
top: 16px;
|
|
212
|
+
}
|
|
133
213
|
`;
|
|
134
214
|
|
|
135
215
|
export default ReturnOrderFilter;
|
|
@@ -9,11 +9,12 @@ import RightFilters from './RightFilters';
|
|
|
9
9
|
import { useParams } from 'react-router-dom';
|
|
10
10
|
|
|
11
11
|
const ReturnFilter = () => {
|
|
12
|
-
const {
|
|
12
|
+
const { clientName } = useParams();
|
|
13
|
+
|
|
13
14
|
return (
|
|
14
15
|
<>
|
|
15
16
|
<StyledFiter>
|
|
16
|
-
<Text> {
|
|
17
|
+
<Text> {clientName}</Text>
|
|
17
18
|
<StyledFIlterELements>
|
|
18
19
|
<StyledTableFilter />
|
|
19
20
|
</StyledFIlterELements>
|