@bjsdistribution/dms-client-return 0.1.9-prod → 0.1.10-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/components/client-portal/OutstandingTable.d.ts +3 -0
- package/dist/components/client-portal/ReturnAfterSearchBar.d.ts +4 -0
- package/dist/components/client-portal/ReturnOverview.d.ts +3 -0
- package/dist/components/client-portal/ReturnRTFilters.d.ts +5 -0
- package/dist/components/client-portal/ReturnSearchBar.d.ts +4 -0
- package/dist/components/client-portal/ReturnStatus.d.ts +8 -0
- package/dist/components/client-portal/return-confirm/ConfirmedMain.d.ts +3 -0
- package/dist/components/client-portal/return-confirm/ReturnConfirmedTable.d.ts +3 -0
- package/dist/components/order-daily-overview/common/fakedata.d.ts +1 -0
- package/dist/components/order-daily-overview/header/route-header/RouterHeader.d.ts +1 -0
- package/dist/components/order-view/notes/AddNote.d.ts +1 -0
- package/dist/components/order-view/notes/order-dropdown/NewReturnDropdown.d.ts +3 -0
- package/dist/components/order-view/order-actions/actions/clear-booking-status/ClearBookingStatus.d.ts +4 -1
- package/dist/components/order-view/order-actions/actions/confirm-order/index.d.ts +4 -1
- package/dist/components/order-view/order-actions/actions/force-debrief/BaseChargeConfirmationModal.d.ts +7 -0
- package/dist/components/order-view/order-actions/actions/force-debrief/ForceDebriefModal.d.ts +11 -0
- package/dist/components/order-view/order-actions/actions/force-debrief/Selector.d.ts +11 -0
- package/dist/components/order-view/order-actions/actions/force-debrief/charges/adhoc/index.d.ts +3 -0
- package/dist/components/order-view/order-actions/actions/force-debrief/charges/base-charge/index.d.ts +8 -0
- package/dist/components/order-view/order-actions/actions/force-debrief/charges/collection-add-ons/index.d.ts +7 -0
- package/dist/components/order-view/order-actions/actions/force-debrief/charges/delivery-add-ons/index.d.ts +7 -0
- package/dist/components/order-view/order-actions/actions/force-debrief/charges/disposal-charges/index.d.ts +7 -0
- package/dist/components/order-view/order-actions/actions/force-debrief/charges/order-charges/index.d.ts +7 -0
- package/dist/components/order-view/order-actions/actions/force-debrief/escalation/EscalationCategory.d.ts +3 -0
- package/dist/components/order-view/order-actions/actions/force-debrief/escalation/EscalationLevel.d.ts +3 -0
- package/dist/components/order-view/order-actions/actions/force-debrief/escalation/EscalationReason.d.ts +3 -0
- package/dist/components/order-view/order-actions/actions/force-debrief/escalation/index.d.ts +3 -0
- package/dist/components/order-view/order-actions/actions/force-debrief/notifications/FlagsTemplate.d.ts +3 -0
- package/dist/components/order-view/order-actions/actions/force-debrief/notifications/OrderTemplate.d.ts +3 -0
- package/dist/components/order-view/order-actions/actions/force-debrief/notifications/Tabs.d.ts +3 -0
- package/dist/components/order-view/order-actions/actions/force-debrief/notifications/index.d.ts +3 -0
- package/dist/components/order-view/order-actions/actions/force-debrief/order-info/RadioButtons.d.ts +7 -0
- package/dist/components/order-view/order-actions/actions/force-debrief/order-info/dropdowns/CancellationReasonDropdown.d.ts +3 -0
- package/dist/components/order-view/order-actions/actions/force-debrief/order-info/dropdowns/FailureReasonDropdown.d.ts +3 -0
- package/dist/components/order-view/order-actions/actions/force-debrief/order-info/dropdowns/OrderHoldReasonDropdown.d.ts +3 -0
- package/dist/components/order-view/order-actions/actions/force-debrief/order-info/dropdowns/StatusDropdown.d.ts +3 -0
- package/dist/components/order-view/order-actions/actions/force-debrief/order-info/dropdowns/ZoneDropdown.d.ts +3 -0
- package/dist/components/order-view/order-actions/actions/force-debrief/order-info/failure-content/index.d.ts +3 -0
- package/dist/components/order-view/order-actions/actions/force-debrief/order-info/index.d.ts +4 -0
- package/dist/components/order-view/order-actions/actions/force-debrief/order-info/success-content/index.d.ts +3 -0
- package/dist/components/order-view/order-actions/actions/force-debrief/styles.d.ts +8 -0
- package/dist/components/order-view/order-actions/actions/hold-order/HoldOrderModal.d.ts +1 -0
- package/dist/components/order-view/order-actions/actions/remove-from-route/RemoveFromRoute.d.ts +1 -1
- package/dist/components/order-view/order-actions/actions/unhold-order/UnholdOrder.d.ts +1 -0
- package/dist/components/order-view/products-info/expanded-content/index.d.ts +4 -1
- package/dist/components/order-view/return-client-products/ProductTable.d.ts +4 -1
- package/dist/components/order-view/return-client-products/product-table/ReturnProductTable.d.ts +4 -1
- package/dist/components/order-view/store.d.ts +14 -2
- package/dist/components/order-view/types.d.ts +49 -1
- package/dist/components/order-view/utils.d.ts +3 -0
- package/dist/components/store.d.ts +12 -1
- package/dist/components/utils.d.ts +1 -0
- package/dist/dms-client-return.cjs.development.js +7053 -2711
- 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 +7111 -2769
- package/dist/dms-client-return.esm.js.map +1 -1
- package/package.json +6 -4
- package/src/assets/icons/ActionIcon.tsx +1 -1
- package/src/assets/icons/ArrowDownIcon.tsx +2 -2
- package/src/components/client-portal/OutstandingTable.tsx +412 -0
- package/src/components/client-portal/ReturnAfterSearchBar.tsx +242 -0
- package/src/components/client-portal/ReturnOverview.tsx +185 -0
- package/src/components/client-portal/ReturnRTFilters.tsx +228 -0
- package/src/components/client-portal/ReturnSearchBar.tsx +294 -0
- package/src/components/client-portal/ReturnStatus.tsx +252 -0
- package/src/components/client-portal/return-confirm/ConfirmedMain.tsx +235 -0
- package/src/components/client-portal/return-confirm/ReturnConfirmedTable.tsx +404 -0
- package/src/components/order-daily-overview/common/fakedata.tsx +18 -0
- package/src/components/order-daily-overview/header/route-header/RouterHeader.tsx +130 -1
- package/src/components/order-daily-overview/header-filters/HeaderFilter.tsx +15 -3
- package/src/components/order-daily-overview/header-filters/SelectionFilter.tsx +100 -70
- package/src/components/order-daily-overview/return-after-table/table/OrderTable.tsx +4 -0
- package/src/components/order-daily-overview/return-after-table/table-filters/ReturnFilterStore.ts +86 -0
- package/src/components/order-daily-overview/return-after-table/table-filters/ReturnOrderFilter.tsx +12 -2
- package/src/components/order-daily-overview/return-after-table/table-filters/TableFilters.tsx +22 -1
- package/src/components/order-daily-overview/return-order-table/return-orders-filters/ReturnFilter.tsx +34 -6
- package/src/components/order-daily-overview/return-order-table/return-orders-filters/ReturnOrderTable.tsx +24 -11
- package/src/components/order-daily-overview/return-order-table/return-orders-filters/RightFilters.tsx +26 -6
- package/src/components/order-daily-overview/shared/elements/PrintDropDown.tsx +5 -3
- package/src/components/order-view/details-filters/left-side-filters/dropdowns/OptionsDropDown.tsx +5 -0
- package/src/components/order-view/details-filters/right-side-filters/Details.tsx +28 -3
- package/src/components/order-view/generic-table/AuditLogs.tsx +39 -12
- package/src/components/order-view/index.tsx +45 -0
- package/src/components/order-view/notes/AddNote.tsx +94 -65
- package/src/components/order-view/notes/order-dropdown/NewReturnDropdown.tsx +8 -10
- package/src/components/order-view/notification/OrderTemplate.tsx +192 -41
- package/src/components/order-view/order-actions/actions/cancel-order/ReturnAction.tsx +25 -4
- package/src/components/order-view/order-actions/actions/cancel-order/ReturnReason.tsx +24 -4
- package/src/components/order-view/order-actions/actions/clear-booking-status/ClearBookingStatus.tsx +9 -2
- package/src/components/order-view/order-actions/actions/confirm-order/index.tsx +12 -6
- package/src/components/order-view/order-actions/actions/create-task-reminder/CreateReminderModal.tsx +2 -2
- package/src/components/order-view/order-actions/actions/force-debrief/BaseChargeConfirmationModal.tsx +94 -0
- package/src/components/order-view/order-actions/actions/force-debrief/ForceDebriefModal.tsx +620 -0
- package/src/components/order-view/order-actions/actions/force-debrief/Selector.tsx +65 -0
- package/src/components/order-view/order-actions/actions/force-debrief/charges/adhoc/index.tsx +94 -0
- package/src/components/order-view/order-actions/actions/force-debrief/charges/base-charge/index.tsx +106 -0
- package/src/components/order-view/order-actions/actions/force-debrief/charges/collection-add-ons/index.tsx +77 -0
- package/src/components/order-view/order-actions/actions/force-debrief/charges/delivery-add-ons/index.tsx +78 -0
- package/src/components/order-view/order-actions/actions/force-debrief/charges/disposal-charges/index.tsx +77 -0
- package/src/components/order-view/order-actions/actions/force-debrief/charges/order-charges/index.tsx +124 -0
- package/src/components/order-view/order-actions/actions/force-debrief/escalation/EscalationCategory.tsx +92 -0
- package/src/components/order-view/order-actions/actions/force-debrief/escalation/EscalationLevel.tsx +90 -0
- package/src/components/order-view/order-actions/actions/force-debrief/escalation/EscalationReason.tsx +122 -0
- package/src/components/order-view/order-actions/actions/force-debrief/escalation/index.tsx +16 -0
- package/src/components/order-view/order-actions/actions/force-debrief/notifications/FlagsTemplate.tsx +46 -0
- package/src/components/order-view/order-actions/actions/force-debrief/notifications/OrderTemplate.tsx +117 -0
- package/src/components/order-view/order-actions/actions/force-debrief/notifications/Tabs.tsx +32 -0
- package/src/components/order-view/order-actions/actions/force-debrief/notifications/index.tsx +180 -0
- package/src/components/order-view/order-actions/actions/force-debrief/order-info/RadioButtons.tsx +201 -0
- package/src/components/order-view/order-actions/actions/force-debrief/order-info/dropdowns/CancellationReasonDropdown.tsx +40 -0
- package/src/components/order-view/order-actions/actions/force-debrief/order-info/dropdowns/FailureReasonDropdown.tsx +108 -0
- package/src/components/order-view/order-actions/actions/force-debrief/order-info/dropdowns/OrderHoldReasonDropdown.tsx +37 -0
- package/src/components/order-view/order-actions/actions/force-debrief/order-info/dropdowns/StatusDropdown.tsx +48 -0
- package/src/components/order-view/order-actions/actions/force-debrief/order-info/dropdowns/ZoneDropdown.tsx +27 -0
- package/src/components/order-view/order-actions/actions/force-debrief/order-info/failure-content/index.tsx +187 -0
- package/src/components/order-view/order-actions/actions/force-debrief/order-info/index.tsx +55 -0
- package/src/components/order-view/order-actions/actions/force-debrief/order-info/success-content/index.tsx +221 -0
- package/src/components/order-view/order-actions/actions/force-debrief/styles.tsx +51 -0
- package/src/components/order-view/order-actions/actions/hold-order/HoldOrderModal.tsx +2 -0
- package/src/components/order-view/order-actions/actions/remove-from-route/RemoveFromRoute.tsx +7 -2
- package/src/components/order-view/order-actions/actions/unhold-order/UnholdOrder.tsx +2 -0
- package/src/components/order-view/order-actions/index.tsx +15 -3
- package/src/components/order-view/order-details/expanded-content/instruction-section/index.tsx +1 -1
- package/src/components/order-view/products-info/expanded-content/index.tsx +27 -11
- package/src/components/order-view/products-info/index.tsx +4 -4
- package/src/components/order-view/return-client-products/ProductTable.tsx +6 -2
- package/src/components/order-view/return-client-products/product-table/ReturnProductTable.tsx +54 -15
- package/src/components/order-view/store.ts +106 -0
- package/src/components/order-view/types.ts +54 -1
- package/src/components/order-view/utils.ts +37 -0
- package/src/components/store.ts +62 -1
- package/src/components/utils.ts +13 -3
- package/src/index.tsx +26 -16
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
import {
|
|
2
|
+
CrossIcon,
|
|
3
|
+
SearchIcon,
|
|
4
|
+
useAxios,
|
|
5
|
+
} from '@bjsdistribution/dms-component-library';
|
|
6
|
+
import React, { useEffect, useState } from 'react';
|
|
7
|
+
import styled from 'styled-components';
|
|
8
|
+
import {
|
|
9
|
+
useAtom,
|
|
10
|
+
useClientPortal,
|
|
11
|
+
useEndDate,
|
|
12
|
+
useReturnConfirmedOrderData,
|
|
13
|
+
useSearchAfterText,
|
|
14
|
+
useStartDate,
|
|
15
|
+
useStatsCPCount,
|
|
16
|
+
} from '../store';
|
|
17
|
+
|
|
18
|
+
import { ApiResponse } from '../types';
|
|
19
|
+
import { javascriptStringDumpToJSON } from '../utils';
|
|
20
|
+
import { UsePaginationData } from '../order-daily-overview/store/store';
|
|
21
|
+
import { notification } from 'antd';
|
|
22
|
+
import { filtersReducerReturnAtom } from '../order-daily-overview/return-after-table/table-filters/ReturnFilterStore';
|
|
23
|
+
import dayjs from 'dayjs';
|
|
24
|
+
import { returnCountType } from './ReturnStatus';
|
|
25
|
+
import { useParams } from 'react-router-dom';
|
|
26
|
+
|
|
27
|
+
function ReturnAfterSearchBar() {
|
|
28
|
+
const [searchText, setSearchText] = useState('');
|
|
29
|
+
const [debouncedSearchText, setDebouncedSearchText] = useSearchAfterText();
|
|
30
|
+
const [, setReturnConfirmedData] = useReturnConfirmedOrderData();
|
|
31
|
+
//condition on client view
|
|
32
|
+
const [, setPaginationObject] = UsePaginationData();
|
|
33
|
+
const handleInputChange = (event: React.ChangeEvent<HTMLInputElement>) => {
|
|
34
|
+
setSearchText(event.target.value);
|
|
35
|
+
};
|
|
36
|
+
//CP
|
|
37
|
+
const [modifiedStatsFilters, setModifiedStatsFilters] = useState<any[]>([]);
|
|
38
|
+
const [startDate] = useStartDate();
|
|
39
|
+
const [endDate] = useEndDate();
|
|
40
|
+
const [state] = useAtom(filtersReducerReturnAtom);
|
|
41
|
+
const { 'x-filters': filters, 'x-pagination': pagination } = state;
|
|
42
|
+
const [count, setCount] = useStatsCPCount();
|
|
43
|
+
const [clientPortal] = useClientPortal();
|
|
44
|
+
const { status } = useParams();
|
|
45
|
+
|
|
46
|
+
const { paginationData, fetchData: returnAfterCall } = useAxios<ApiResponse>({
|
|
47
|
+
endpoint: '/v1/return/orders/',
|
|
48
|
+
method: 'GET',
|
|
49
|
+
filters: filters && filters?.length > 0 ? filters : undefined,
|
|
50
|
+
pagination: pagination,
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
useEffect(() => {
|
|
54
|
+
if (debouncedSearchText?.length > 1) {
|
|
55
|
+
returnAfterCall({
|
|
56
|
+
endPointQuery: `?search_term=${debouncedSearchText}`,
|
|
57
|
+
}).then((response: any) => {
|
|
58
|
+
if (paginationData) {
|
|
59
|
+
const formattedPagination = javascriptStringDumpToJSON(
|
|
60
|
+
paginationData
|
|
61
|
+
);
|
|
62
|
+
const { ...rest } = formattedPagination;
|
|
63
|
+
setPaginationObject(rest);
|
|
64
|
+
}
|
|
65
|
+
if (response?.data) {
|
|
66
|
+
setReturnConfirmedData(response?.data);
|
|
67
|
+
} else {
|
|
68
|
+
setReturnConfirmedData([]);
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
} else if (
|
|
72
|
+
debouncedSearchText?.length > 0 &&
|
|
73
|
+
debouncedSearchText?.length <= 2
|
|
74
|
+
) {
|
|
75
|
+
notification.warning({
|
|
76
|
+
message: 'Search Phrase cannot be less than 3 characters',
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
}, [debouncedSearchText]);
|
|
80
|
+
// Debouncing effect
|
|
81
|
+
useEffect(() => {
|
|
82
|
+
const handler = setTimeout(() => {
|
|
83
|
+
setDebouncedSearchText(searchText);
|
|
84
|
+
}, 1000);
|
|
85
|
+
return () => {
|
|
86
|
+
clearTimeout(handler);
|
|
87
|
+
};
|
|
88
|
+
}, [searchText]);
|
|
89
|
+
|
|
90
|
+
useEffect(() => {
|
|
91
|
+
if (debouncedSearchText?.length === 0) {
|
|
92
|
+
setSearchText('');
|
|
93
|
+
}
|
|
94
|
+
}, [debouncedSearchText]);
|
|
95
|
+
|
|
96
|
+
//
|
|
97
|
+
|
|
98
|
+
const getDateFilters = (
|
|
99
|
+
startDate: dayjs.Dayjs | null,
|
|
100
|
+
endDate: dayjs.Dayjs | null
|
|
101
|
+
) => {
|
|
102
|
+
const stored = JSON.parse(localStorage.getItem('returnDate') || '{}');
|
|
103
|
+
|
|
104
|
+
const sDate = startDate?.isValid?.() ? startDate : dayjs(stored?.startDate);
|
|
105
|
+
const eDate = endDate?.isValid?.()
|
|
106
|
+
? endDate
|
|
107
|
+
: stored?.endDate
|
|
108
|
+
? dayjs(stored?.endDate)
|
|
109
|
+
: null;
|
|
110
|
+
|
|
111
|
+
if (!sDate?.isValid?.()) return [];
|
|
112
|
+
|
|
113
|
+
let dateFilters = [];
|
|
114
|
+
|
|
115
|
+
if (eDate && eDate.isValid()) {
|
|
116
|
+
dateFilters = [
|
|
117
|
+
{ field: 'created_at', op: '>=', value: sDate.format('YYYY-MM-DD') },
|
|
118
|
+
{
|
|
119
|
+
field: 'created_at',
|
|
120
|
+
op: '<=',
|
|
121
|
+
value: eDate.add(1, 'day').format('YYYY-MM-DD'),
|
|
122
|
+
},
|
|
123
|
+
];
|
|
124
|
+
} else {
|
|
125
|
+
dateFilters = [
|
|
126
|
+
{
|
|
127
|
+
field: 'created_at',
|
|
128
|
+
op: '=',
|
|
129
|
+
value: sDate.format('YYYY-MM-DD'),
|
|
130
|
+
},
|
|
131
|
+
];
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
return dateFilters;
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
useEffect(() => {
|
|
138
|
+
if (!clientPortal) return;
|
|
139
|
+
|
|
140
|
+
const dateFilters = getDateFilters(startDate, endDate);
|
|
141
|
+
setModifiedStatsFilters(dateFilters);
|
|
142
|
+
}, [startDate, endDate]);
|
|
143
|
+
|
|
144
|
+
const { data: statsData, fetchData: fetchStatsData } = useAxios<{
|
|
145
|
+
data: returnCountType[];
|
|
146
|
+
}>({
|
|
147
|
+
endpoint: `v1/portal/return/stats/`,
|
|
148
|
+
method: 'GET',
|
|
149
|
+
pagination: { is_pagination: false },
|
|
150
|
+
filters: modifiedStatsFilters,
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
useEffect(() => {
|
|
154
|
+
const validStatuses = ['scheduled_for_return', 'return_completed'];
|
|
155
|
+
const isClientView = clientPortal && validStatuses.includes(status || '');
|
|
156
|
+
|
|
157
|
+
if (!isClientView || debouncedSearchText?.length < 3) return;
|
|
158
|
+
console.log('IN after view entered');
|
|
159
|
+
const statusTypeMap: Record<string, string> = {
|
|
160
|
+
scheduled_for_return: 'scheduled',
|
|
161
|
+
return_completed: 'complete',
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
const type = statusTypeMap[status as keyof typeof statusTypeMap];
|
|
165
|
+
|
|
166
|
+
const fetchStats = async () => {
|
|
167
|
+
const response = await fetchStatsData({
|
|
168
|
+
endPointQuery: `?search_term=${debouncedSearchText}&type=${type}`,
|
|
169
|
+
});
|
|
170
|
+
//@ts-ignore
|
|
171
|
+
if (response?.data) {
|
|
172
|
+
console.log('inside response', response);
|
|
173
|
+
// @ts-ignore
|
|
174
|
+
setCount(response?.data);
|
|
175
|
+
} else {
|
|
176
|
+
setCount(null);
|
|
177
|
+
}
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
fetchStats();
|
|
181
|
+
}, [debouncedSearchText, status, clientPortal]);
|
|
182
|
+
|
|
183
|
+
console.log(statsData, 'statsData');
|
|
184
|
+
|
|
185
|
+
console.log(count, 'new count');
|
|
186
|
+
|
|
187
|
+
const handleClear = () => {
|
|
188
|
+
setSearchText('');
|
|
189
|
+
};
|
|
190
|
+
return (
|
|
191
|
+
<Search>
|
|
192
|
+
<SearchIcon />
|
|
193
|
+
|
|
194
|
+
<SearchInput
|
|
195
|
+
type="text"
|
|
196
|
+
placeholder="Search"
|
|
197
|
+
value={searchText}
|
|
198
|
+
onChange={handleInputChange}
|
|
199
|
+
/>
|
|
200
|
+
{searchText ? (
|
|
201
|
+
<ClearButton className="clear" onClick={handleClear}>
|
|
202
|
+
<CrossIcon />
|
|
203
|
+
</ClearButton>
|
|
204
|
+
) : null}
|
|
205
|
+
</Search>
|
|
206
|
+
);
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
const ClearButton = styled.button`
|
|
210
|
+
border: none;
|
|
211
|
+
background: none;
|
|
212
|
+
position: relative;
|
|
213
|
+
border: none;
|
|
214
|
+
cursor: pointer;
|
|
215
|
+
padding: 0 4px;
|
|
216
|
+
font-size: 0;
|
|
217
|
+
&:hover {
|
|
218
|
+
color: #000;
|
|
219
|
+
}
|
|
220
|
+
`;
|
|
221
|
+
|
|
222
|
+
const Search = styled.div`
|
|
223
|
+
display: flex;
|
|
224
|
+
padding: 4px 12px;
|
|
225
|
+
align-items: center;
|
|
226
|
+
gap: 8px;
|
|
227
|
+
align-self: stretch;
|
|
228
|
+
border-radius: 20px;
|
|
229
|
+
border: 1px solid var(--Neutral-Gray-Gray-100, #e0e2e7);
|
|
230
|
+
background-color: var(--Flowkit-White, #fff);
|
|
231
|
+
height: 35px;
|
|
232
|
+
box-shadow: 0px 1px 2px 0px rgba(16, 24, 40, 0.05);
|
|
233
|
+
`;
|
|
234
|
+
const SearchInput = styled.input`
|
|
235
|
+
border: none;
|
|
236
|
+
outline: none;
|
|
237
|
+
flex-grow: 1;
|
|
238
|
+
width: 100%;
|
|
239
|
+
background: transparent;
|
|
240
|
+
`;
|
|
241
|
+
|
|
242
|
+
export default React.memo(ReturnAfterSearchBar);
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import HeaderFilter from '../order-daily-overview/header-filters/HeaderFilter';
|
|
3
|
+
import styled from 'styled-components';
|
|
4
|
+
import ReturnFilter from '../order-daily-overview/return-order-table/return-orders-filters/ReturnFilter';
|
|
5
|
+
import Pagination from '../order-daily-overview/table-view/Pagination';
|
|
6
|
+
import {
|
|
7
|
+
useItemsPerPage,
|
|
8
|
+
UsePaginationData,
|
|
9
|
+
} from '../order-daily-overview/store/store';
|
|
10
|
+
import { useClientPortal } from '../store';
|
|
11
|
+
import { useParams } from 'react-router-dom';
|
|
12
|
+
import RouterHeader from '../order-daily-overview/header/route-header/RouterHeader';
|
|
13
|
+
import OutstandingTable from './OutstandingTable';
|
|
14
|
+
import ConfirmedMain from './return-confirm/ConfirmedMain';
|
|
15
|
+
|
|
16
|
+
const ReturnOverview = () => {
|
|
17
|
+
const [paginationObj] = UsePaginationData();
|
|
18
|
+
const [, setCurrentPage] = useState(1);
|
|
19
|
+
const [itemsPerPage, setItemsPerPage] = useItemsPerPage();
|
|
20
|
+
const { page, total } = paginationObj;
|
|
21
|
+
const { status } = useParams();
|
|
22
|
+
const [clientPortal] = useClientPortal();
|
|
23
|
+
|
|
24
|
+
const handlePageChange = (page: number) => {
|
|
25
|
+
setCurrentPage(page);
|
|
26
|
+
};
|
|
27
|
+
const handleItemsPerPageChange = (itemsPerPage: number) => {
|
|
28
|
+
setItemsPerPage(itemsPerPage);
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
console.log(status, 'status');
|
|
32
|
+
const shouldShowReturnAfterTable =
|
|
33
|
+
(clientPortal && status === 'scheduled_for_return') ||
|
|
34
|
+
(clientPortal && status === 'return_completed');
|
|
35
|
+
return (
|
|
36
|
+
<>
|
|
37
|
+
<RouterHeader />
|
|
38
|
+
<div>
|
|
39
|
+
<DashBoardWrapper>
|
|
40
|
+
<div className="Tableconatiner">
|
|
41
|
+
<HeaderFilter />
|
|
42
|
+
<Container>
|
|
43
|
+
<ReturnFilter />
|
|
44
|
+
{clientPortal && status === 'outstanding_return' && (
|
|
45
|
+
<>
|
|
46
|
+
<OutstandingTable />
|
|
47
|
+
{total > 0 && (
|
|
48
|
+
<Pagination
|
|
49
|
+
currentPage={page}
|
|
50
|
+
totalItems={total}
|
|
51
|
+
itemsPerPage={itemsPerPage}
|
|
52
|
+
onPageChange={handlePageChange}
|
|
53
|
+
onItemsPerPageChange={handleItemsPerPageChange}
|
|
54
|
+
></Pagination>
|
|
55
|
+
)}
|
|
56
|
+
</>
|
|
57
|
+
)}
|
|
58
|
+
{shouldShowReturnAfterTable && (
|
|
59
|
+
<>
|
|
60
|
+
<ConfirmedMain />
|
|
61
|
+
</>
|
|
62
|
+
)}
|
|
63
|
+
</Container>
|
|
64
|
+
</div>
|
|
65
|
+
</DashBoardWrapper>
|
|
66
|
+
</div>
|
|
67
|
+
</>
|
|
68
|
+
);
|
|
69
|
+
};
|
|
70
|
+
const Container = styled.div`
|
|
71
|
+
position: relative;
|
|
72
|
+
top: -16px;
|
|
73
|
+
`;
|
|
74
|
+
|
|
75
|
+
const DashBoardWrapper = styled.section`
|
|
76
|
+
.Tableconatiner {
|
|
77
|
+
border-radius: 12px;
|
|
78
|
+
background: #fff;
|
|
79
|
+
box-shadow: -2px 0px 12px 0px rgba(56, 71, 109, 0.1);
|
|
80
|
+
display: block;
|
|
81
|
+
padding: 15px 20px;
|
|
82
|
+
}
|
|
83
|
+
.headerWrap,
|
|
84
|
+
.tableData,
|
|
85
|
+
.styleCovered {
|
|
86
|
+
transition: all ease 0.5s;
|
|
87
|
+
}
|
|
88
|
+
&.stickyTableHead {
|
|
89
|
+
h2 {
|
|
90
|
+
font-size: 21px;
|
|
91
|
+
}
|
|
92
|
+
.headerWrap {
|
|
93
|
+
height: 84px;
|
|
94
|
+
padding: 10px;
|
|
95
|
+
border-radius: 0px 0px 15px 15px;
|
|
96
|
+
> div {
|
|
97
|
+
position: relative;
|
|
98
|
+
z-index: 10;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
.styleCovered {
|
|
102
|
+
margin-top: -32px;
|
|
103
|
+
width: 67%;
|
|
104
|
+
float: right;
|
|
105
|
+
gap: 5px;
|
|
106
|
+
padding-right: 11px;
|
|
107
|
+
|
|
108
|
+
li {
|
|
109
|
+
padding: 4px 10px 5px 5px;
|
|
110
|
+
gap: 5px;
|
|
111
|
+
.svgCover {
|
|
112
|
+
width: 30px;
|
|
113
|
+
height: 30px;
|
|
114
|
+
svg {
|
|
115
|
+
height: auto;
|
|
116
|
+
width: 58%;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
.countDigit {
|
|
120
|
+
font-size: 19px;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
.countMess {
|
|
124
|
+
font-size: 13px;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
.dmsBulkFilter {
|
|
128
|
+
min-height: unset;
|
|
129
|
+
gap: 4px;
|
|
130
|
+
> div {
|
|
131
|
+
padding: 4px 12px;
|
|
132
|
+
label {
|
|
133
|
+
font-size: 11px;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.StyledFilterList {
|
|
139
|
+
gap: 4px;
|
|
140
|
+
li {
|
|
141
|
+
height: 29px;
|
|
142
|
+
padding: 3px 8px;
|
|
143
|
+
gap: 4px;
|
|
144
|
+
.StyledFilterBtnIcon {
|
|
145
|
+
width: 20px;
|
|
146
|
+
height: 20px;
|
|
147
|
+
svh {
|
|
148
|
+
width: 10px;
|
|
149
|
+
height: auto;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
.StyledFilterBtnLabel {
|
|
153
|
+
font-size: 13px;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
.StyledFilterLabel {
|
|
158
|
+
padding-left: 10px;
|
|
159
|
+
span {
|
|
160
|
+
font-size: 13px;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
.cardcontainer.tableData {
|
|
164
|
+
max-height: calc(100vh - 310px);
|
|
165
|
+
min-height: calc(100vh - 310px);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
.tableData {
|
|
169
|
+
max-height: calc(100vh - 320px);
|
|
170
|
+
min-height: calc(100vh - 320px);
|
|
171
|
+
|
|
172
|
+
margin-top: 8px;
|
|
173
|
+
thead {
|
|
174
|
+
position: sticky;
|
|
175
|
+
top: 0;
|
|
176
|
+
z-index: 9;
|
|
177
|
+
th {
|
|
178
|
+
font-size: 13px;
|
|
179
|
+
padding: 2px 15px;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
`;
|
|
185
|
+
export default ReturnOverview;
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
import {
|
|
4
|
+
useAtom,
|
|
5
|
+
useReturnAfterOrderData,
|
|
6
|
+
useReturnData,
|
|
7
|
+
} from '../order-view/store';
|
|
8
|
+
import { filtersReducerAtom } from '../order-daily-overview/header-filters/filterStore';
|
|
9
|
+
import { ExportButton, useAxios } from '@bjsdistribution/dms-component-library';
|
|
10
|
+
import { useParams } from 'react-router-dom';
|
|
11
|
+
import { filtersReducerReturnAtom } from '../order-daily-overview/return-after-table/table-filters/ReturnFilterStore';
|
|
12
|
+
import { notification } from 'antd';
|
|
13
|
+
import {
|
|
14
|
+
useSelectedClientAfterOrders,
|
|
15
|
+
useSelectedClientPortOrders,
|
|
16
|
+
// useSelectedClientPortOrders,
|
|
17
|
+
} from '../store';
|
|
18
|
+
|
|
19
|
+
const ReturnRTFilters = () => {
|
|
20
|
+
const [returnData] = useReturnData();
|
|
21
|
+
const [pendingState] = useAtom(filtersReducerAtom);
|
|
22
|
+
const [state] = useAtom(filtersReducerReturnAtom);
|
|
23
|
+
const [returnAfterOrder] = useReturnAfterOrderData();
|
|
24
|
+
// const [selectedReturnOrder] = useSelectedClientPortOrders();
|
|
25
|
+
const [
|
|
26
|
+
selectedOrderIds,
|
|
27
|
+
setSelectedOrderIds,
|
|
28
|
+
] = useSelectedClientAfterOrders();
|
|
29
|
+
const [
|
|
30
|
+
selectedPendingOrderIds,
|
|
31
|
+
setSelectedPendingOrderIds,
|
|
32
|
+
] = useSelectedClientPortOrders();
|
|
33
|
+
const { status } = useParams<{ status: any }>();
|
|
34
|
+
const { 'x-filters': pendingFilters } = pendingState;
|
|
35
|
+
|
|
36
|
+
let moduleInfo: any | null = null;
|
|
37
|
+
if (status === 'outstanding_return') {
|
|
38
|
+
moduleInfo = {
|
|
39
|
+
isExportedData: returnData?.length > 0,
|
|
40
|
+
moduleName: 'return',
|
|
41
|
+
filter: pendingFilters,
|
|
42
|
+
file_type: 'csv',
|
|
43
|
+
apiUrlEndPoint: `v1/return/product/pending/`,
|
|
44
|
+
reference: 'return_export',
|
|
45
|
+
feature_name: 'return',
|
|
46
|
+
};
|
|
47
|
+
} else if (['scheduled_for_return', 'return_completed'].includes(status)) {
|
|
48
|
+
const { 'x-filters': orderFilters } = state;
|
|
49
|
+
|
|
50
|
+
moduleInfo = {
|
|
51
|
+
isExportedData: returnAfterOrder?.length > 0,
|
|
52
|
+
moduleName: 'return',
|
|
53
|
+
filter: orderFilters,
|
|
54
|
+
file_type: 'csv',
|
|
55
|
+
apiUrlEndPoint: `v1/return/orders/`,
|
|
56
|
+
reference: 'return_overview_export',
|
|
57
|
+
feature_name: 'return',
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
//Export Manifest
|
|
61
|
+
const isExportEnabled =
|
|
62
|
+
status === 'outstanding_return'
|
|
63
|
+
? selectedPendingOrderIds?.length > 0
|
|
64
|
+
: status === 'scheduled_for_return' || status === 'return_completed'
|
|
65
|
+
? selectedOrderIds?.length > 0
|
|
66
|
+
: false;
|
|
67
|
+
const { fetchData: callExportApi } = useAxios<{
|
|
68
|
+
data: any[];
|
|
69
|
+
message: string;
|
|
70
|
+
}>({
|
|
71
|
+
endpoint: `/v1/orders/import/manifest/csv/`,
|
|
72
|
+
method: 'POST',
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
const handleExportManifest = async () => {
|
|
76
|
+
if (!isExportEnabled) return;
|
|
77
|
+
|
|
78
|
+
const exportOrderIds =
|
|
79
|
+
status === 'outstanding_return'
|
|
80
|
+
? selectedPendingOrderIds
|
|
81
|
+
: status === 'scheduled_for_return' || status === 'return_completed'
|
|
82
|
+
? selectedOrderIds
|
|
83
|
+
: [];
|
|
84
|
+
|
|
85
|
+
try {
|
|
86
|
+
const response = (await callExportApi({
|
|
87
|
+
payload: { order_ids: exportOrderIds },
|
|
88
|
+
})) as {
|
|
89
|
+
code: number | null;
|
|
90
|
+
error?: string | null;
|
|
91
|
+
data?: {
|
|
92
|
+
url?: string;
|
|
93
|
+
};
|
|
94
|
+
message?: string;
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
if (response?.data?.url) {
|
|
98
|
+
notification.success({
|
|
99
|
+
message: 'Success',
|
|
100
|
+
description: response?.message || 'Export completed.',
|
|
101
|
+
});
|
|
102
|
+
window.open(response?.data?.url, '_blank');
|
|
103
|
+
|
|
104
|
+
if (status === 'outstanding_return') {
|
|
105
|
+
setSelectedPendingOrderIds([]);
|
|
106
|
+
} else if (
|
|
107
|
+
status === 'scheduled_for_return' ||
|
|
108
|
+
status === 'return_completed'
|
|
109
|
+
) {
|
|
110
|
+
setSelectedOrderIds([]);
|
|
111
|
+
}
|
|
112
|
+
} else {
|
|
113
|
+
notification.error({
|
|
114
|
+
message: 'No File URL',
|
|
115
|
+
description: 'Export succeeded but no download URL was returned.',
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
} catch (error) {
|
|
119
|
+
console.error('Error during export or download:', error);
|
|
120
|
+
notification.error({
|
|
121
|
+
message: 'Export Failed',
|
|
122
|
+
description: 'Something went wrong during export.',
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
if (status === 'outstanding_return') {
|
|
126
|
+
setSelectedPendingOrderIds([]);
|
|
127
|
+
} else if (
|
|
128
|
+
status === 'scheduled_for_return' ||
|
|
129
|
+
status === 'return_completed'
|
|
130
|
+
) {
|
|
131
|
+
setSelectedOrderIds([]);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
return (
|
|
137
|
+
<StyledBulkFilterCover className="dmsBulkFilter">
|
|
138
|
+
<ExportButton moduleInfoModule={moduleInfo} />
|
|
139
|
+
<StyledBulkItem
|
|
140
|
+
onClick={handleExportManifest}
|
|
141
|
+
style={{
|
|
142
|
+
pointerEvents: isExportEnabled ? 'auto' : 'none',
|
|
143
|
+
opacity: isExportEnabled ? 1 : 0.5,
|
|
144
|
+
}}
|
|
145
|
+
>
|
|
146
|
+
<Text>Export Manifest</Text>
|
|
147
|
+
</StyledBulkItem>
|
|
148
|
+
</StyledBulkFilterCover>
|
|
149
|
+
);
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
const Text = styled.div`
|
|
153
|
+
color: #6a7378;
|
|
154
|
+
text-align: center;
|
|
155
|
+
font-size: 14px;
|
|
156
|
+
font-style: normal;
|
|
157
|
+
font-weight: 500;
|
|
158
|
+
line-height: 18px;
|
|
159
|
+
`;
|
|
160
|
+
export const StyledBulkFilterCover = styled.div`
|
|
161
|
+
border-radius: 100px;
|
|
162
|
+
border: 1px solid rgba(208, 213, 221, 0.5);
|
|
163
|
+
background: #fff;
|
|
164
|
+
display: flex;
|
|
165
|
+
min-height: 40px;
|
|
166
|
+
// gap: 8px;
|
|
167
|
+
`;
|
|
168
|
+
|
|
169
|
+
export const StyledBulkItem = styled.div`
|
|
170
|
+
padding: 6px 12px;
|
|
171
|
+
display: flex;
|
|
172
|
+
align-items: center;
|
|
173
|
+
border-right: 1px solid #d0d5dd;
|
|
174
|
+
gap: 8px;
|
|
175
|
+
position: relative;
|
|
176
|
+
a {
|
|
177
|
+
text-decoration: none;
|
|
178
|
+
}
|
|
179
|
+
&.disabled {
|
|
180
|
+
/* opacity: 0.5; */
|
|
181
|
+
width: 150px;
|
|
182
|
+
cursor: default;
|
|
183
|
+
a {
|
|
184
|
+
cursor: default;
|
|
185
|
+
|
|
186
|
+
label {
|
|
187
|
+
cursor: default;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
&:hover:not(:disabled) {
|
|
192
|
+
background: #f0f0f0;
|
|
193
|
+
cursor: pointer;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
@media screen and (max-width: 1030px) {
|
|
197
|
+
padding: 6px 4px;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
ul {
|
|
201
|
+
margin: 0;
|
|
202
|
+
padding: 0;
|
|
203
|
+
list-style: none;
|
|
204
|
+
box-sizing: border-box;
|
|
205
|
+
top: 54px;
|
|
206
|
+
}
|
|
207
|
+
&:last-child {
|
|
208
|
+
border-right: none;
|
|
209
|
+
}
|
|
210
|
+
&.active svg.arrowDown {
|
|
211
|
+
transform: rotate(180deg);
|
|
212
|
+
}
|
|
213
|
+
label {
|
|
214
|
+
color: #3a3630;
|
|
215
|
+
text-align: center;
|
|
216
|
+
font-family: 'Open Sans';
|
|
217
|
+
font-size: 14px;
|
|
218
|
+
font-style: normal;
|
|
219
|
+
font-weight: 400;
|
|
220
|
+
line-height: 18px;
|
|
221
|
+
cursor: pointer;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
&.noPadding {
|
|
225
|
+
padding: 0;
|
|
226
|
+
}
|
|
227
|
+
`;
|
|
228
|
+
export default ReturnRTFilters;
|