@bjsdistribution/dms-client-return 0.1.19-dev → 0.1.21-dev
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/DateFilterStore.d.ts +15 -0
- package/dist/components/client-portal/OutstandingTable.d.ts +3 -0
- package/dist/components/client-portal/ReturnStatus.d.ts +5 -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-view/DynamicTable.d.ts +2 -1
- package/dist/components/order-view/general-information/Status.d.ts +1 -1
- package/dist/components/order-view/general-information/index.d.ts +1 -1
- package/dist/components/order-view/index.d.ts +1 -1
- 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/order-actions/types.d.ts +3 -3
- package/dist/components/order-view/order-details/expanded-content/index.d.ts +1 -1
- package/dist/components/order-view/order-details/index.d.ts +1 -1
- package/dist/components/order-view/order-resources/expanded-content/index.d.ts +1 -1
- package/dist/components/order-view/products-info/expanded-content/index.d.ts +6 -1
- package/dist/components/order-view/products-info/index.d.ts +1 -1
- package/dist/components/order-view/return-client-products/ProductTable.d.ts +6 -1
- package/dist/components/order-view/return-client-products/product-table/ReturnProductTable.d.ts +6 -1
- package/dist/components/order-view/store.d.ts +15 -3
- package/dist/components/order-view/system-event-logs/expanded-content/index.d.ts +1 -1
- package/dist/components/order-view/types.d.ts +49 -1
- package/dist/components/order-view/utils.d.ts +3 -0
- package/dist/components/order-view/view-reminder/ViewReminder.d.ts +2 -0
- package/dist/components/store.d.ts +5 -1
- package/dist/dms-client-return.cjs.development.js +7035 -3476
- 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 +7099 -3540
- 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/DateFilterStore.ts +94 -0
- package/src/components/client-portal/OutstandingTable.tsx +355 -0
- package/src/components/client-portal/ReturnAfterSearchBar.tsx +76 -17
- package/src/components/client-portal/ReturnOverview.tsx +4 -4
- package/src/components/client-portal/ReturnRTFilters.tsx +57 -40
- package/src/components/client-portal/ReturnSearchBar.tsx +64 -94
- package/src/components/client-portal/ReturnStatus.tsx +50 -68
- package/src/components/client-portal/return-confirm/ConfirmedMain.tsx +224 -0
- package/src/components/client-portal/return-confirm/ReturnConfirmedTable.tsx +327 -0
- package/src/components/order-daily-overview/header/route-header/RouterHeader.tsx +11 -18
- package/src/components/order-daily-overview/header-filters/SelectionFilter.tsx +43 -15
- package/src/components/order-daily-overview/index.tsx +23 -4
- package/src/components/order-daily-overview/return-after-table/ReturnAfterTable.tsx +23 -38
- package/src/components/order-daily-overview/return-after-table/table/OrderTable.tsx +21 -24
- package/src/components/order-daily-overview/return-after-table/table-filters/ReturnFilterStore.ts +36 -36
- package/src/components/order-daily-overview/return-after-table/table-filters/ReturnOrderFilter.tsx +12 -2
- package/src/components/order-daily-overview/return-order-table/ReturnTable.tsx +16 -0
- package/src/components/order-daily-overview/return-order-table/return-orders-filters/ReturnOrderTable.tsx +58 -155
- package/src/components/order-daily-overview/table/ReturnTable.tsx +8 -4
- package/src/components/order-view/DynamicTable.tsx +21 -8
- package/src/components/order-view/details-filters/left-side-filters/dropdowns/DropDowns.tsx +1 -1
- package/src/components/order-view/details-filters/left-side-filters/dropdowns/OptionsDropDown.tsx +9 -0
- package/src/components/order-view/details-filters/right-side-filters/Details.tsx +28 -3
- package/src/components/order-view/flags-action-modal/Dropdowns.tsx +2 -0
- package/src/components/order-view/general-information/Status.tsx +92 -18
- package/src/components/order-view/general-information/index.tsx +2 -2
- package/src/components/order-view/generic-table/AuditLogs.tsx +39 -12
- package/src/components/order-view/index.tsx +50 -8
- package/src/components/order-view/modalsPopup/ModalManager.tsx +1 -1
- package/src/components/order-view/notes/AddNote.tsx +95 -65
- package/src/components/order-view/notes/order-dropdown/NewReturnDropdown.tsx +8 -10
- package/src/components/order-view/notification/FlagTemplate.tsx +21 -10
- package/src/components/order-view/notification/OrderTemplate.tsx +192 -41
- package/src/components/order-view/notification/ReminderTemplate.tsx +28 -13
- package/src/components/order-view/notification/index.tsx +100 -55
- package/src/components/order-view/order-actions/actions/add-resources/DocFileUpload.tsx +92 -72
- package/src/components/order-view/order-actions/actions/add-resources/index.tsx +27 -10
- 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/confirm-order/tables/NotesTable.tsx +1 -0
- package/src/components/order-view/order-actions/actions/create-task-reminder/CreateReminderModal.tsx +88 -30
- package/src/components/order-view/order-actions/actions/create-task-reminder/CreateTaskModal.tsx +5 -3
- package/src/components/order-view/order-actions/actions/create-task-reminder/TaskModal.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 +18 -5
- package/src/components/order-view/order-actions/store.ts +1 -1
- package/src/components/order-view/order-actions/types.ts +3 -3
- package/src/components/order-view/order-details/expanded-content/footer/index.tsx +7 -1
- package/src/components/order-view/order-details/expanded-content/index.tsx +37 -16
- package/src/components/order-view/order-details/expanded-content/instruction-section/index.tsx +1 -1
- package/src/components/order-view/order-details/expanded-content/services-section/ServiceLevel.tsx +3 -4
- package/src/components/order-view/order-details/index.tsx +5 -2
- package/src/components/order-view/order-resources/expanded-content/index.tsx +2 -2
- package/src/components/order-view/products-info/expanded-content/index.tsx +33 -11
- package/src/components/order-view/products-info/index.tsx +10 -6
- package/src/components/order-view/return-client-products/ProductTable.tsx +12 -2
- package/src/components/order-view/return-client-products/product-table/ReturnProductTable.tsx +73 -23
- package/src/components/order-view/store.ts +107 -1
- package/src/components/order-view/system-event-logs/expanded-content/index.tsx +6 -2
- package/src/components/order-view/types.ts +54 -1
- package/src/components/order-view/utils.ts +37 -0
- package/src/components/order-view/view-reminder/AssigneeDropdown.tsx +85 -26
- package/src/components/order-view/view-reminder/ViewReminder.tsx +33 -14
- package/src/components/store.ts +24 -1
- package/src/index.tsx +6 -3
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
import {
|
|
4
|
+
useAtom,
|
|
5
|
+
useClientPortal,
|
|
6
|
+
// useCallApiAgain,
|
|
7
|
+
useReturnConfirmedOrderData,
|
|
8
|
+
useSearchAfterText,
|
|
9
|
+
} from '../../store';
|
|
10
|
+
import ReturnConfirmedTable from './ReturnConfirmedTable';
|
|
11
|
+
import {
|
|
12
|
+
useItemsPerReturnPage,
|
|
13
|
+
useLoading,
|
|
14
|
+
UsePaginationData,
|
|
15
|
+
UsePaginationReturnData,
|
|
16
|
+
} from '../../order-daily-overview/store/store';
|
|
17
|
+
import { filtersReducerReturnAtom } from '../../order-daily-overview/return-after-table/table-filters/ReturnFilterStore';
|
|
18
|
+
import { useAxios } from '@bjsdistribution/dms-component-library';
|
|
19
|
+
import { ApiResponse } from '../../types';
|
|
20
|
+
import { notification } from 'antd';
|
|
21
|
+
import ReturnPagination from '../../order-daily-overview/table-view/ReturnPagination';
|
|
22
|
+
// import { useParams } from 'react-router-dom';
|
|
23
|
+
import { dateFilterCPReducer } from '../DateFilterStore';
|
|
24
|
+
|
|
25
|
+
const ConfirmedMain = () => {
|
|
26
|
+
const [, setReturnConfirmedData] = useReturnConfirmedOrderData();
|
|
27
|
+
const [, setLoading] = useLoading();
|
|
28
|
+
const [statePagination] = useAtom(filtersReducerReturnAtom);
|
|
29
|
+
// const [callApi] = useCallApiAgain();
|
|
30
|
+
const { 'x-pagination': pagination } = statePagination;
|
|
31
|
+
const [state] = useAtom(dateFilterCPReducer);
|
|
32
|
+
const { 'x-filters': filters } = state;
|
|
33
|
+
const [paginationObj] = UsePaginationReturnData();
|
|
34
|
+
const [, setCurrentPage] = useState(1);
|
|
35
|
+
const [itemsPerPage, setItemsPerPage] = useItemsPerReturnPage();
|
|
36
|
+
const [, setPaginationObject] = UsePaginationData();
|
|
37
|
+
const { page, total } = paginationObj;
|
|
38
|
+
const [debouncedSearchText] = useSearchAfterText();
|
|
39
|
+
const handlePageChange = (page: number) => {
|
|
40
|
+
setCurrentPage(page);
|
|
41
|
+
};
|
|
42
|
+
const handleItemsPerPageChange = (itemsPerPage: number) => {
|
|
43
|
+
setItemsPerPage(itemsPerPage);
|
|
44
|
+
};
|
|
45
|
+
// const { status } = useParams();
|
|
46
|
+
const [clientPortal] = useClientPortal();
|
|
47
|
+
|
|
48
|
+
const {
|
|
49
|
+
data: fetchedReturnOrderData,
|
|
50
|
+
loading,
|
|
51
|
+
paginationData,
|
|
52
|
+
fetchData,
|
|
53
|
+
} = useAxios<ApiResponse>({
|
|
54
|
+
endpoint: '/v1/return/orders/',
|
|
55
|
+
method: 'GET',
|
|
56
|
+
filters: filters,
|
|
57
|
+
pagination: pagination,
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
useEffect(() => {
|
|
61
|
+
if (clientPortal && debouncedSearchText === '') {
|
|
62
|
+
fetchData();
|
|
63
|
+
}
|
|
64
|
+
}, [JSON.stringify(filters), debouncedSearchText]);
|
|
65
|
+
|
|
66
|
+
useEffect(() => {
|
|
67
|
+
setLoading(loading);
|
|
68
|
+
|
|
69
|
+
if (fetchedReturnOrderData?.data) {
|
|
70
|
+
setReturnConfirmedData(fetchedReturnOrderData?.data);
|
|
71
|
+
|
|
72
|
+
if (paginationData) {
|
|
73
|
+
try {
|
|
74
|
+
const { count, ...rest } = JSON.parse(paginationData);
|
|
75
|
+
setPaginationObject(rest);
|
|
76
|
+
} catch (error) {
|
|
77
|
+
notification.error({
|
|
78
|
+
message: 'Error',
|
|
79
|
+
description: 'Failed to parse pagination data',
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}, [fetchedReturnOrderData, loading]);
|
|
85
|
+
|
|
86
|
+
return (
|
|
87
|
+
<div>
|
|
88
|
+
<DashBoardWrapper>
|
|
89
|
+
{/* <RouterHeader /> */}
|
|
90
|
+
<div className="Tableconatiner">
|
|
91
|
+
{/* <HeaderFilter /> */}
|
|
92
|
+
<Container>
|
|
93
|
+
<ReturnConfirmedTable />
|
|
94
|
+
{total > 0 && (
|
|
95
|
+
<ReturnPagination
|
|
96
|
+
currentPage={page}
|
|
97
|
+
totalItems={total}
|
|
98
|
+
itemsPerPage={itemsPerPage}
|
|
99
|
+
onPageChange={handlePageChange}
|
|
100
|
+
onItemsPerPageChange={handleItemsPerPageChange}
|
|
101
|
+
></ReturnPagination>
|
|
102
|
+
)}
|
|
103
|
+
</Container>
|
|
104
|
+
</div>
|
|
105
|
+
</DashBoardWrapper>
|
|
106
|
+
</div>
|
|
107
|
+
);
|
|
108
|
+
};
|
|
109
|
+
const Container = styled.div`
|
|
110
|
+
position: relative;
|
|
111
|
+
/* top: -30px; */
|
|
112
|
+
`;
|
|
113
|
+
const DashBoardWrapper = styled.section`
|
|
114
|
+
.Tableconatiner {
|
|
115
|
+
border-radius: 12px;
|
|
116
|
+
background: #fff;
|
|
117
|
+
box-shadow: -2px 0px 12px 0px rgba(56, 71, 109, 0.1);
|
|
118
|
+
display: block;
|
|
119
|
+
padding: 15px 20px;
|
|
120
|
+
}
|
|
121
|
+
.headerWrap,
|
|
122
|
+
.tableData,
|
|
123
|
+
.styleCovered {
|
|
124
|
+
transition: all ease 0.5s;
|
|
125
|
+
}
|
|
126
|
+
&.stickyTableHead {
|
|
127
|
+
h2 {
|
|
128
|
+
font-size: 21px;
|
|
129
|
+
}
|
|
130
|
+
.headerWrap {
|
|
131
|
+
height: 84px;
|
|
132
|
+
padding: 10px;
|
|
133
|
+
border-radius: 0px 0px 15px 15px;
|
|
134
|
+
> div {
|
|
135
|
+
position: relative;
|
|
136
|
+
z-index: 10;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
.styleCovered {
|
|
140
|
+
margin-top: -32px;
|
|
141
|
+
width: 67%;
|
|
142
|
+
float: right;
|
|
143
|
+
gap: 5px;
|
|
144
|
+
padding-right: 11px;
|
|
145
|
+
|
|
146
|
+
li {
|
|
147
|
+
padding: 4px 10px 5px 5px;
|
|
148
|
+
gap: 5px;
|
|
149
|
+
.svgCover {
|
|
150
|
+
width: 30px;
|
|
151
|
+
height: 30px;
|
|
152
|
+
svg {
|
|
153
|
+
height: auto;
|
|
154
|
+
width: 58%;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
.countDigit {
|
|
158
|
+
font-size: 19px;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
.countMess {
|
|
162
|
+
font-size: 13px;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
.dmsBulkFilter {
|
|
166
|
+
min-height: unset;
|
|
167
|
+
gap: 4px;
|
|
168
|
+
> div {
|
|
169
|
+
padding: 4px 12px;
|
|
170
|
+
label {
|
|
171
|
+
font-size: 11px;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
.StyledFilterList {
|
|
177
|
+
gap: 4px;
|
|
178
|
+
li {
|
|
179
|
+
height: 29px;
|
|
180
|
+
padding: 3px 8px;
|
|
181
|
+
gap: 4px;
|
|
182
|
+
.StyledFilterBtnIcon {
|
|
183
|
+
width: 20px;
|
|
184
|
+
height: 20px;
|
|
185
|
+
svh {
|
|
186
|
+
width: 10px;
|
|
187
|
+
height: auto;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
.StyledFilterBtnLabel {
|
|
191
|
+
font-size: 13px;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
.StyledFilterLabel {
|
|
196
|
+
padding-left: 10px;
|
|
197
|
+
span {
|
|
198
|
+
font-size: 13px;
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
.cardcontainer.tableData {
|
|
202
|
+
max-height: calc(100vh - 310px);
|
|
203
|
+
min-height: calc(100vh - 310px);
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
.tableData {
|
|
207
|
+
max-height: calc(100vh - 320px);
|
|
208
|
+
min-height: calc(100vh - 320px);
|
|
209
|
+
|
|
210
|
+
margin-top: 8px;
|
|
211
|
+
thead {
|
|
212
|
+
position: sticky;
|
|
213
|
+
top: 0;
|
|
214
|
+
z-index: 9;
|
|
215
|
+
th {
|
|
216
|
+
font-size: 13px;
|
|
217
|
+
padding: 2px 15px;
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
`;
|
|
223
|
+
|
|
224
|
+
export default ConfirmedMain;
|
|
@@ -0,0 +1,327 @@
|
|
|
1
|
+
import { Empty } from 'antd';
|
|
2
|
+
import React, { useEffect, useMemo, useRef, useState } from 'react';
|
|
3
|
+
import { Skeleton } from 'antd';
|
|
4
|
+
import { NavLink } from 'react-router-dom';
|
|
5
|
+
import {
|
|
6
|
+
Checkbox,
|
|
7
|
+
displayValueOrNA,
|
|
8
|
+
} from '@bjsdistribution/dms-component-library';
|
|
9
|
+
import {
|
|
10
|
+
useLoading,
|
|
11
|
+
usePrintOptionTOggle,
|
|
12
|
+
} from '../../order-daily-overview/store/store';
|
|
13
|
+
import {
|
|
14
|
+
useReturnConfirmedOrderData,
|
|
15
|
+
useSelectedClientAfterOrders,
|
|
16
|
+
} from '../../store';
|
|
17
|
+
import { useOrderId } from '../../order-view/store';
|
|
18
|
+
import SortIcon from '../../../common/SortIcon';
|
|
19
|
+
import CaretDownFilledIcon from '../../../common/CaretDownFilledIcon';
|
|
20
|
+
import {
|
|
21
|
+
CustomDrop,
|
|
22
|
+
EmptyDataContainer,
|
|
23
|
+
StyledTable,
|
|
24
|
+
StyledTableWrapper,
|
|
25
|
+
} from '../../order-daily-overview/return-order-table/return-orders-filters/returnstyles';
|
|
26
|
+
import PrinterIcon from '../../../assets/icons/PrinterIcon';
|
|
27
|
+
import DownIcon from '../../../assets/icons/DownIcon';
|
|
28
|
+
import PrintDropDown from '../../order-daily-overview/shared/elements/PrintDropDown';
|
|
29
|
+
import { formatDate } from '../../order-daily-overview/shared/utlis';
|
|
30
|
+
|
|
31
|
+
const ReturnConfirmedTable = () => {
|
|
32
|
+
const dropdownRefParent = useRef<HTMLDivElement>(null);
|
|
33
|
+
const dropdownRef = useRef<HTMLDivElement>(null);
|
|
34
|
+
const [printToogle, setPrintToggle] = usePrintOptionTOggle();
|
|
35
|
+
const [, setOrderId] = useOrderId();
|
|
36
|
+
const [returnConfirmedTable] = useReturnConfirmedOrderData();
|
|
37
|
+
const [loading] = useLoading();
|
|
38
|
+
const [selectClientAll, setSelectClientAll] = useState(false);
|
|
39
|
+
const [
|
|
40
|
+
selectedOrderIds,
|
|
41
|
+
setSelectedOrderIds,
|
|
42
|
+
] = useSelectedClientAfterOrders();
|
|
43
|
+
//sorting
|
|
44
|
+
const [sortConfig, setSortConfig] = useState<{
|
|
45
|
+
key: string;
|
|
46
|
+
direction: 'asc' | 'desc';
|
|
47
|
+
} | null>(null);
|
|
48
|
+
|
|
49
|
+
const handleSort = (key: string) => {
|
|
50
|
+
setSortConfig((prev: any) => {
|
|
51
|
+
if (prev?.key === key && prev.direction === 'asc') {
|
|
52
|
+
return { key, direction: 'desc' };
|
|
53
|
+
}
|
|
54
|
+
return { key, direction: 'asc' };
|
|
55
|
+
});
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
const sortedData = useMemo(() => {
|
|
59
|
+
if (!returnConfirmedTable || !sortConfig) return returnConfirmedTable;
|
|
60
|
+
|
|
61
|
+
const { key, direction } = sortConfig;
|
|
62
|
+
return [...returnConfirmedTable].sort((a, b) => {
|
|
63
|
+
const valueA = a[key];
|
|
64
|
+
const valueB = b[key];
|
|
65
|
+
|
|
66
|
+
if (typeof valueA === 'number' && typeof valueB === 'number') {
|
|
67
|
+
return direction === 'asc' ? valueA - valueB : valueB - valueA;
|
|
68
|
+
}
|
|
69
|
+
if (typeof valueA === 'string' && typeof valueB === 'string') {
|
|
70
|
+
return direction === 'asc'
|
|
71
|
+
? valueA.localeCompare(valueB)
|
|
72
|
+
: valueB.localeCompare(valueA);
|
|
73
|
+
}
|
|
74
|
+
return 0;
|
|
75
|
+
});
|
|
76
|
+
}, [returnConfirmedTable, sortConfig]);
|
|
77
|
+
|
|
78
|
+
const renderSortIcon = (columnKey: string) => {
|
|
79
|
+
if (!sortConfig || sortConfig.key !== columnKey) {
|
|
80
|
+
return <SortIcon />;
|
|
81
|
+
}
|
|
82
|
+
return sortConfig.direction === 'asc' ? (
|
|
83
|
+
<CaretDownFilledIcon />
|
|
84
|
+
) : (
|
|
85
|
+
<CaretDownFilledIcon />
|
|
86
|
+
);
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
const OpenDropDown = (index: number) => {
|
|
90
|
+
setPrintToggle((prevIndex: any) => (prevIndex === index ? null : index));
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
// Close dropdown outside click
|
|
94
|
+
useEffect(() => {
|
|
95
|
+
document.addEventListener('mousedown', handleClickOutside);
|
|
96
|
+
return () => {
|
|
97
|
+
document.removeEventListener('mousedown', handleClickOutside);
|
|
98
|
+
};
|
|
99
|
+
}, []);
|
|
100
|
+
const handleClickOutside = (event: MouseEvent) => {
|
|
101
|
+
if (
|
|
102
|
+
dropdownRef.current &&
|
|
103
|
+
!dropdownRef.current.contains(event.target as Node)
|
|
104
|
+
) {
|
|
105
|
+
setPrintToggle(null);
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
const getStatusClass = (status: string) => {
|
|
110
|
+
switch (status) {
|
|
111
|
+
case 'Cancelled':
|
|
112
|
+
case 'Failed':
|
|
113
|
+
return { color: '#E95252', background: 'rgba(233, 82, 82, 0.15)' };
|
|
114
|
+
case 'On Hold':
|
|
115
|
+
return { color: '#F4A503', background: '#FFF1D6' };
|
|
116
|
+
case 'Sub-Contracted':
|
|
117
|
+
case 'SC':
|
|
118
|
+
return { color: '#F4A503', background: '#FFF1D6' };
|
|
119
|
+
case 'Awaiting route':
|
|
120
|
+
case 'Awaiting Confirmation':
|
|
121
|
+
return { color: '#845ADF', background: 'rgba(132, 90, 223, 0.15)' };
|
|
122
|
+
case 'Completed':
|
|
123
|
+
return {
|
|
124
|
+
color: '#1F9254',
|
|
125
|
+
background: 'rgba(41, 204, 106, 0.15)',
|
|
126
|
+
};
|
|
127
|
+
case 'Outstanding':
|
|
128
|
+
return { color: '#FF9900', background: 'rgba(255, 153, 0, 0.15)' };
|
|
129
|
+
case 'Routed':
|
|
130
|
+
return { color: '#6396E5', background: 'rgba(99, 150, 229, 0.15)' };
|
|
131
|
+
default:
|
|
132
|
+
return { color: '#000', background: '#fff' };
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
const handleSelectOrderId = (id: string | number) => {
|
|
137
|
+
setSelectedOrderIds(prev =>
|
|
138
|
+
prev.includes(id) ? prev.filter(orderId => orderId !== id) : [...prev, id]
|
|
139
|
+
);
|
|
140
|
+
};
|
|
141
|
+
const handleClientSelectAll = (e: React.ChangeEvent<HTMLInputElement>) => {
|
|
142
|
+
const isChecked = e.target.checked;
|
|
143
|
+
setSelectClientAll(isChecked);
|
|
144
|
+
|
|
145
|
+
if (isChecked) {
|
|
146
|
+
setSelectedOrderIds(
|
|
147
|
+
returnConfirmedTable?.map((item: any) => item?.id) || []
|
|
148
|
+
);
|
|
149
|
+
} else {
|
|
150
|
+
setSelectedOrderIds([]);
|
|
151
|
+
}
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
return (
|
|
155
|
+
<>
|
|
156
|
+
<StyledTableWrapper className="fortables">
|
|
157
|
+
<StyledTable>
|
|
158
|
+
<thead>
|
|
159
|
+
<tr>
|
|
160
|
+
{/* <th className="emailInvoiceCheckbox">
|
|
161
|
+
<Checkbox checked={false} />
|
|
162
|
+
</th> */}
|
|
163
|
+
<th className="emailInvoiceCheckbox">
|
|
164
|
+
<Checkbox
|
|
165
|
+
checked={selectClientAll}
|
|
166
|
+
onChange={handleClientSelectAll}
|
|
167
|
+
/>
|
|
168
|
+
</th>
|
|
169
|
+
<th onClick={() => handleSort('created_at')}>
|
|
170
|
+
<div className="sortIconClass">
|
|
171
|
+
Created {renderSortIcon('created_at')}
|
|
172
|
+
</div>
|
|
173
|
+
</th>
|
|
174
|
+
<th onClick={() => handleSort('return_location_name')}>
|
|
175
|
+
<div className="sortIconClass">
|
|
176
|
+
Return Location {renderSortIcon('return_location_name')}
|
|
177
|
+
</div>
|
|
178
|
+
</th>
|
|
179
|
+
<th onClick={() => handleSort('recipient_name')}>
|
|
180
|
+
<div className="sortIconClass">
|
|
181
|
+
Recipient {renderSortIcon('recipient_name')}
|
|
182
|
+
</div>
|
|
183
|
+
</th>
|
|
184
|
+
<th> Client</th>
|
|
185
|
+
<th>Consignment</th>
|
|
186
|
+
<th>Return Order No</th>
|
|
187
|
+
<th> Total Parts</th>
|
|
188
|
+
<th onClick={() => handleSort('weight')}>
|
|
189
|
+
<div className="sortIconClass">
|
|
190
|
+
Total Weight {renderSortIcon('weight')}
|
|
191
|
+
</div>
|
|
192
|
+
</th>
|
|
193
|
+
<th onClick={() => handleSort('cube')}>
|
|
194
|
+
<div className="sortIconClass">
|
|
195
|
+
Total CBM {renderSortIcon('cube')}
|
|
196
|
+
</div>
|
|
197
|
+
</th>
|
|
198
|
+
<th>Status</th>
|
|
199
|
+
<th className="emailInvoiceShare">Labels</th>
|
|
200
|
+
</tr>
|
|
201
|
+
</thead>
|
|
202
|
+
<tbody>
|
|
203
|
+
{loading ? (
|
|
204
|
+
<tr>
|
|
205
|
+
<td colSpan={16}>
|
|
206
|
+
<Skeleton active />
|
|
207
|
+
</td>
|
|
208
|
+
<td colSpan={16}></td>
|
|
209
|
+
</tr>
|
|
210
|
+
) : sortedData?.length === 0 ? (
|
|
211
|
+
<tr>
|
|
212
|
+
<td colSpan={16}>
|
|
213
|
+
<EmptyDataContainer>
|
|
214
|
+
<Empty />
|
|
215
|
+
</EmptyDataContainer>
|
|
216
|
+
</td>
|
|
217
|
+
</tr>
|
|
218
|
+
) : (
|
|
219
|
+
sortedData?.map((item: any, index: any) => {
|
|
220
|
+
const statusMapping: any = {
|
|
221
|
+
cancelled: 'Cancelled',
|
|
222
|
+
'on hold': 'On Hold',
|
|
223
|
+
subcontracted: 'Sub-Contracted',
|
|
224
|
+
SC: 'Sub-Contracted',
|
|
225
|
+
'awaiting route': 'Awaiting route',
|
|
226
|
+
'awaiting confirmation': 'Awaiting Confirmation',
|
|
227
|
+
complete: 'Completed',
|
|
228
|
+
outstanding: 'Outstanding',
|
|
229
|
+
routed: 'Routed',
|
|
230
|
+
failed: 'Failed',
|
|
231
|
+
confirmed: 'Confirmed',
|
|
232
|
+
};
|
|
233
|
+
const status = statusMapping[item?.status_value] || 'Unknown';
|
|
234
|
+
const statusClass = getStatusClass(status);
|
|
235
|
+
|
|
236
|
+
return (
|
|
237
|
+
<tr key={item.id}>
|
|
238
|
+
<td>
|
|
239
|
+
<Checkbox
|
|
240
|
+
checked={selectedOrderIds.includes(item?.id)}
|
|
241
|
+
onChange={() => handleSelectOrderId(item?.id)}
|
|
242
|
+
/>
|
|
243
|
+
</td>
|
|
244
|
+
<td>{formatDate(new Date(item?.created_at))}</td>
|
|
245
|
+
<td>{displayValueOrNA(item?.return_location_name)}</td>
|
|
246
|
+
<td onClick={() => setOrderId(item.id)}>
|
|
247
|
+
<ul style={{ listStyleType: 'none', padding: 0 }}>
|
|
248
|
+
<li
|
|
249
|
+
style={{
|
|
250
|
+
color: '#0099ff',
|
|
251
|
+
fontWeight: 600,
|
|
252
|
+
paddingLeft: 0,
|
|
253
|
+
}}
|
|
254
|
+
>
|
|
255
|
+
<NavLink to={`../${item.id}`}>
|
|
256
|
+
{displayValueOrNA(item?.recipient_name)}
|
|
257
|
+
</NavLink>
|
|
258
|
+
</li>
|
|
259
|
+
<li style={{ color: '#888075' }}>
|
|
260
|
+
{displayValueOrNA(item?.postcode)}
|
|
261
|
+
</li>
|
|
262
|
+
</ul>
|
|
263
|
+
</td>
|
|
264
|
+
|
|
265
|
+
<td>{displayValueOrNA(item?.customer_name)}</td>
|
|
266
|
+
|
|
267
|
+
<td>{displayValueOrNA(item?.consignment)}</td>
|
|
268
|
+
<td>{displayValueOrNA(item?.order_number)}</td>
|
|
269
|
+
|
|
270
|
+
<td>{displayValueOrNA(item?.total_products)}</td>
|
|
271
|
+
<td>
|
|
272
|
+
{displayValueOrNA(item?.weight)}{' '}
|
|
273
|
+
{item?.weight && item?.weight > 0 ? 'KG' : ''}
|
|
274
|
+
</td>
|
|
275
|
+
|
|
276
|
+
<td>{displayValueOrNA(item?.cube)}</td>
|
|
277
|
+
|
|
278
|
+
<td>
|
|
279
|
+
<ul
|
|
280
|
+
className="statuscontainer"
|
|
281
|
+
style={{
|
|
282
|
+
listStyleType: 'none',
|
|
283
|
+
background: statusClass.background,
|
|
284
|
+
}}
|
|
285
|
+
>
|
|
286
|
+
<li
|
|
287
|
+
className="statustext"
|
|
288
|
+
style={{ color: statusClass.color }}
|
|
289
|
+
>
|
|
290
|
+
{status}
|
|
291
|
+
</li>
|
|
292
|
+
</ul>
|
|
293
|
+
</td>
|
|
294
|
+
<td>
|
|
295
|
+
<ul className="actionbox">
|
|
296
|
+
<CustomDrop
|
|
297
|
+
ref={dropdownRefParent}
|
|
298
|
+
className={printToogle === index ? 'active' : ''}
|
|
299
|
+
>
|
|
300
|
+
<li
|
|
301
|
+
className="shareIconContainer"
|
|
302
|
+
onClick={() => OpenDropDown(index)}
|
|
303
|
+
>
|
|
304
|
+
<PrinterIcon />
|
|
305
|
+
<DownIcon />
|
|
306
|
+
|
|
307
|
+
{printToogle === index && (
|
|
308
|
+
<div ref={dropdownRef}>
|
|
309
|
+
<PrintDropDown legacyProductId={item} />
|
|
310
|
+
</div>
|
|
311
|
+
)}
|
|
312
|
+
</li>
|
|
313
|
+
</CustomDrop>
|
|
314
|
+
</ul>
|
|
315
|
+
</td>
|
|
316
|
+
</tr>
|
|
317
|
+
);
|
|
318
|
+
})
|
|
319
|
+
)}
|
|
320
|
+
</tbody>
|
|
321
|
+
</StyledTable>
|
|
322
|
+
</StyledTableWrapper>
|
|
323
|
+
</>
|
|
324
|
+
);
|
|
325
|
+
};
|
|
326
|
+
|
|
327
|
+
export default ReturnConfirmedTable;
|
|
@@ -12,10 +12,10 @@ import {
|
|
|
12
12
|
useEndDate,
|
|
13
13
|
useStartDate,
|
|
14
14
|
} from '../../../store';
|
|
15
|
-
import { filtersReducerReturnAtom } from '../../return-after-table/table-filters/ReturnFilterStore';
|
|
16
15
|
import ReturnSearchBar from '../../../client-portal/ReturnSearchBar';
|
|
17
16
|
import { useParams } from 'react-router-dom';
|
|
18
17
|
import ReturnAfterSearchBar from '../../../client-portal/ReturnAfterSearchBar';
|
|
18
|
+
import { dateFilterCPReducer } from '../../../client-portal/DateFilterStore';
|
|
19
19
|
|
|
20
20
|
interface RouterHeaderProps {
|
|
21
21
|
breadcrumbTitle?: string;
|
|
@@ -30,44 +30,37 @@ const RouterHeader: React.FC<RouterHeaderProps> = ({
|
|
|
30
30
|
breadcrumbSubPart, // Optional
|
|
31
31
|
}) => {
|
|
32
32
|
const [clientPortal] = useClientPortal();
|
|
33
|
-
const [, dispatch] = useAtom(
|
|
33
|
+
const [, dispatch] = useAtom(dateFilterCPReducer);
|
|
34
34
|
//CP
|
|
35
35
|
const [startDate, setStartDate] = useStartDate();
|
|
36
36
|
const [endDate, setEndDate] = useEndDate();
|
|
37
37
|
const { status } = useParams();
|
|
38
38
|
|
|
39
|
-
useEffect(() => {
|
|
40
|
-
const storedDates = JSON.parse(localStorage.getItem('returnDate') || '{}');
|
|
41
|
-
const initialStart = storedDates?.startDate
|
|
42
|
-
? dayjs(storedDates.startDate)
|
|
43
|
-
: null;
|
|
44
|
-
const initialEnd = storedDates?.endDate ? dayjs(storedDates.endDate) : null;
|
|
45
|
-
|
|
46
|
-
if (initialStart) setStartDate(initialStart);
|
|
47
|
-
if (initialEnd) setEndDate(initialEnd);
|
|
48
|
-
}, []);
|
|
49
|
-
|
|
50
39
|
useEffect(() => {
|
|
51
40
|
if (clientPortal) {
|
|
52
41
|
const formattedStart = startDate?.format('YYYY-MM-DD');
|
|
53
42
|
const formattedEnd = endDate ? endDate?.format('YYYY-MM-DD') : null;
|
|
54
|
-
|
|
43
|
+
console.log(formattedStart, 'syart', formattedEnd, 'end');
|
|
55
44
|
const payload = {
|
|
56
45
|
startDate: formattedStart,
|
|
57
46
|
endDate: formattedEnd,
|
|
58
47
|
};
|
|
59
|
-
|
|
48
|
+
|
|
49
|
+
console.log(payload, 'PAYLOAD');
|
|
60
50
|
if (formattedStart || formattedEnd) {
|
|
61
51
|
dispatch({
|
|
62
52
|
type: 'SET_CP_DATE_FILTER',
|
|
63
|
-
payload
|
|
53
|
+
payload: {
|
|
54
|
+
startDate: formattedStart,
|
|
55
|
+
endDate: formattedEnd,
|
|
56
|
+
},
|
|
64
57
|
});
|
|
65
58
|
}
|
|
66
59
|
}
|
|
67
60
|
}, [startDate, endDate]);
|
|
68
61
|
|
|
69
62
|
const handleStartDateChange: DatePickerProps['onChange'] = date => {
|
|
70
|
-
setStartDate(date ??
|
|
63
|
+
setStartDate(date ?? null);
|
|
71
64
|
};
|
|
72
65
|
|
|
73
66
|
const handleEndDateChange: DatePickerProps['onChange'] = date => {
|
|
@@ -127,7 +120,7 @@ export const DatePickerWrap = styled.div`
|
|
|
127
120
|
align-self: stretch;
|
|
128
121
|
border-radius: 20px;
|
|
129
122
|
border: 1px solid #e0e2e7;
|
|
130
|
-
background:
|
|
123
|
+
background: #fff;
|
|
131
124
|
box-shadow: 0px 1px 2px 0px rgba(16, 24, 40, 0.05);
|
|
132
125
|
min-width: 22vw;
|
|
133
126
|
height: 35px;
|