@bjsdistribution/dms-client-return 0.0.11 → 0.0.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/order-daily-overview/common/css/TableStyle.d.ts +13 -30
- package/dist/components/order-daily-overview/common/fakedata.d.ts +4 -0
- package/dist/components/order-daily-overview/return-order-table/return-orders-filters/ReturnOrderTable.d.ts +1 -1
- package/dist/components/order-view/details-filters/left-side-filters/dropdowns/{PrintDropDown.d.ts → PrintDropDownReturn.d.ts} +2 -2
- package/dist/components/order-view/store.d.ts +77 -28
- package/dist/components/order-view/types.d.ts +61 -11
- package/dist/components/order-view/utils.d.ts +4 -0
- package/dist/components/store.d.ts +6 -1
- package/dist/dms-client-return.cjs.development.js +1777 -1078
- 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 +1780 -1081
- package/dist/dms-client-return.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/common/expand-collapse/index.tsx +4 -4
- package/src/components/order-daily-overview/common/css/TableStyle.tsx +42 -342
- package/src/components/order-daily-overview/common/fakedata.tsx +4 -0
- package/src/components/order-daily-overview/header-filters/HeaderFilter.tsx +10 -1
- package/src/components/order-daily-overview/header-filters/SelectionFilter.tsx +15 -7
- package/src/components/order-daily-overview/index.tsx +3 -3
- package/src/components/order-daily-overview/return-after-table/ReturnAfterTable.tsx +2 -2
- package/src/components/order-daily-overview/return-after-table/table/OrderTable.tsx +4 -8
- package/src/components/order-daily-overview/return-after-table/table-filters/ReturnFilterStore.ts +12 -14
- package/src/components/order-daily-overview/return-after-table/table-filters/ReturnOrderFilter.tsx +32 -33
- package/src/components/order-daily-overview/return-order-table/ReturnTable.tsx +2 -2
- package/src/components/order-daily-overview/return-order-table/return-orders-filters/ReturnOrderTable.tsx +74 -30
- package/src/components/order-daily-overview/return-order-table/return-orders-filters/returnstyles.ts +5 -2
- package/src/components/order-daily-overview/table/table-data/styles.ts +1 -1
- package/src/components/order-daily-overview/table-view/Pagination.tsx +15 -14
- package/src/components/order-view/DynamicTable.tsx +12 -3
- package/src/components/order-view/details-filters/left-side-filters/dropdowns/{PrintDropDown.tsx → PrintDropDownReturn.tsx} +4 -4
- package/src/components/order-view/flags-action-modal/Actions.tsx +1 -2
- package/src/components/order-view/general-information/Status.tsx +13 -17
- package/src/components/order-view/generic-table/AuditLogs.tsx +81 -19
- package/src/components/order-view/index.tsx +192 -192
- package/src/components/order-view/modalsPopup/CreateReturnModal.tsx +74 -36
- package/src/components/order-view/modalsPopup/ModalManager.tsx +49 -14
- package/src/components/order-view/modalsPopup/ProductAction.tsx +1 -1
- package/src/components/order-view/notes/AddNote.tsx +2 -3
- package/src/components/order-view/notes/index.tsx +9 -22
- package/src/components/order-view/order-details/expanded-content/footer/index.tsx +90 -73
- package/src/components/order-view/order-details/expanded-content/instruction-section/DeliveryInstructions.tsx +2 -9
- package/src/components/order-view/order-details/expanded-content/orders-section/Droptime.tsx +2 -10
- package/src/components/order-view/order-details/expanded-content/orders-section/VehicleType.tsx +16 -15
- package/src/components/order-view/order-details/expanded-content/services-section/AssemblyType.tsx +88 -15
- package/src/components/order-view/order-details/expanded-content/services-section/DeliveryPoint.tsx +1 -13
- package/src/components/order-view/order-details/expanded-content/services-section/OrderServices.tsx +141 -16
- package/src/components/order-view/order-details/expanded-content/services-section/ServiceType.tsx +1 -13
- package/src/components/order-view/order-details/expanded-content/services-section/TimedService.tsx +19 -18
- package/src/components/order-view/products-info/expanded-content/products/index.tsx +2 -2
- package/src/components/order-view/return-client-products/ProductTable.tsx +1 -1
- package/src/components/order-view/return-client-products/product-table/ReturnProductTable.tsx +79 -70
- package/src/components/order-view/return-client-products/product-table-footer/ProductDetailsFooter.tsx +5 -5
- package/src/components/order-view/store.ts +215 -53
- package/src/components/order-view/system-event-logs/expanded-content/index.tsx +6 -10
- package/src/components/order-view/toolbox-resources/expanded-content/index.tsx +68 -6
- package/src/components/order-view/types.ts +89 -33
- package/src/components/order-view/utils.ts +20 -17
- package/src/components/store.ts +35 -0
- package/src/index.tsx +13 -9
|
@@ -7,21 +7,11 @@ import RouteIcon from '../../../assets/icons/RoutedIcon';
|
|
|
7
7
|
import SuccessIcon from '../../../assets/icons/SuccessIcon';
|
|
8
8
|
import DeliveredIcon from '../../../assets/icons/DeliveredIcon';
|
|
9
9
|
import ConfirmedIcon from '../../../assets/icons/ConfirmedIcon';
|
|
10
|
-
|
|
10
|
+
import { useStatusDetails } from '../store';
|
|
11
11
|
|
|
12
12
|
function Status() {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
{
|
|
16
|
-
released: true,
|
|
17
|
-
received: 'True',
|
|
18
|
-
routed: true,
|
|
19
|
-
scheduled: true,
|
|
20
|
-
confirmed: false,
|
|
21
|
-
delivered: true,
|
|
22
|
-
completed: false,
|
|
23
|
-
},
|
|
24
|
-
];
|
|
13
|
+
const [orderStatus] = useStatusDetails();
|
|
14
|
+
|
|
25
15
|
return (
|
|
26
16
|
<Container>
|
|
27
17
|
<BoxContainer>
|
|
@@ -46,6 +36,10 @@ const renderIcon = (value: any, orderStatus: any) => {
|
|
|
46
36
|
return null;
|
|
47
37
|
}
|
|
48
38
|
|
|
39
|
+
if (!status) {
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
42
|
+
|
|
49
43
|
switch (value) {
|
|
50
44
|
case 'released':
|
|
51
45
|
case 'scheduled':
|
|
@@ -55,7 +49,7 @@ const renderIcon = (value: any, orderStatus: any) => {
|
|
|
55
49
|
case 'received':
|
|
56
50
|
if (status.received === 'True') {
|
|
57
51
|
return <SuccessIcon />;
|
|
58
|
-
} else if (status.received === '
|
|
52
|
+
} else if (status.received === 'Partial') {
|
|
59
53
|
return <RouteIcon />;
|
|
60
54
|
} else {
|
|
61
55
|
return <ConfirmedIcon />;
|
|
@@ -65,9 +59,11 @@ const renderIcon = (value: any, orderStatus: any) => {
|
|
|
65
59
|
status.delivered &&
|
|
66
60
|
(status.completed === false || status.completed === null)
|
|
67
61
|
) {
|
|
68
|
-
return <DeliveredIcon />;
|
|
69
|
-
} else if (status.delivered && status.completed) {
|
|
62
|
+
return <DeliveredIcon />; //grey
|
|
63
|
+
} else if (status.delivered === true && status.completed === true) {
|
|
70
64
|
return <SuccessIcon />;
|
|
65
|
+
} else if (status.delivered === true && status.completed === false) {
|
|
66
|
+
return <RouteIcon />;
|
|
71
67
|
} else {
|
|
72
68
|
return <ConfirmedIcon />;
|
|
73
69
|
}
|
|
@@ -95,7 +91,7 @@ const Heading = styled.div`
|
|
|
95
91
|
`;
|
|
96
92
|
|
|
97
93
|
const Container = styled.div`
|
|
98
|
-
|
|
94
|
+
padding: 15px;
|
|
99
95
|
`;
|
|
100
96
|
|
|
101
97
|
const TextContainer = styled.div`
|
|
@@ -4,6 +4,12 @@ import { Skeleton } from 'antd';
|
|
|
4
4
|
import { formatDateTime } from '@bjsdistribution/dms-component-library';
|
|
5
5
|
import { usegetNotes, UseNotesLoading } from '../store';
|
|
6
6
|
import { NotesTableData } from '../notes/logs/fakeData';
|
|
7
|
+
import {
|
|
8
|
+
IconCover,
|
|
9
|
+
Td as BaseTd,
|
|
10
|
+
Th,
|
|
11
|
+
Table,
|
|
12
|
+
} from '../../order-daily-overview/common/css/TableStyle';
|
|
7
13
|
|
|
8
14
|
const GenericAuditLogsTable = () => {
|
|
9
15
|
const tableHeadData = NotesTableData[0].tableHead; // Assuming NotesTableData contains table header information
|
|
@@ -13,14 +19,20 @@ const GenericAuditLogsTable = () => {
|
|
|
13
19
|
return (
|
|
14
20
|
<ScrollableTableWrapper>
|
|
15
21
|
<AuditTableWrapper>
|
|
16
|
-
<
|
|
17
|
-
<
|
|
18
|
-
<
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
<StickyHeaderWrapper>
|
|
23
|
+
<StyledTable>
|
|
24
|
+
<thead>
|
|
25
|
+
<tr>
|
|
26
|
+
{tableHeadData.map(column => (
|
|
27
|
+
<Th key={column.key}>
|
|
28
|
+
<IconCover>{column.label}</IconCover>
|
|
29
|
+
</Th>
|
|
30
|
+
))}
|
|
31
|
+
</tr>
|
|
32
|
+
</thead>
|
|
33
|
+
</StyledTable>
|
|
34
|
+
</StickyHeaderWrapper>
|
|
35
|
+
<StyledTable>
|
|
24
36
|
<tbody>
|
|
25
37
|
{isLoading ? (
|
|
26
38
|
<tr>
|
|
@@ -30,30 +42,32 @@ const GenericAuditLogsTable = () => {
|
|
|
30
42
|
</tr>
|
|
31
43
|
) : getNotes && getNotes?.length > 0 ? (
|
|
32
44
|
getNotes?.map((note: any) => (
|
|
33
|
-
<
|
|
34
|
-
<
|
|
35
|
-
<
|
|
45
|
+
<StyledTr key={note?.id}>
|
|
46
|
+
<DateTd>
|
|
47
|
+
<CreatedBy title={note?.created_by}>
|
|
36
48
|
{note?.created_by}
|
|
37
|
-
</
|
|
49
|
+
</CreatedBy>
|
|
38
50
|
<div>{formatDateTime(note?.created_at)}</div>
|
|
39
|
-
</
|
|
40
|
-
<
|
|
41
|
-
|
|
51
|
+
</DateTd>
|
|
52
|
+
<StyledTd
|
|
53
|
+
dangerouslySetInnerHTML={{ __html: note?.description }}
|
|
54
|
+
></StyledTd>
|
|
55
|
+
</StyledTr>
|
|
42
56
|
))
|
|
43
57
|
) : (
|
|
44
58
|
<tr>
|
|
45
|
-
<
|
|
59
|
+
<NoDataFound colSpan={tableHeadData?.length}>
|
|
60
|
+
No data found
|
|
61
|
+
</NoDataFound>
|
|
46
62
|
</tr>
|
|
47
63
|
)}
|
|
48
64
|
</tbody>
|
|
49
|
-
</
|
|
65
|
+
</StyledTable>
|
|
50
66
|
</AuditTableWrapper>
|
|
51
67
|
</ScrollableTableWrapper>
|
|
52
68
|
);
|
|
53
69
|
};
|
|
54
70
|
|
|
55
|
-
const ScrollableTableWrapper = styled.div``;
|
|
56
|
-
|
|
57
71
|
export const AuditTableWrapper = styled.div`
|
|
58
72
|
height: 250px;
|
|
59
73
|
min-height: 200px;
|
|
@@ -93,4 +107,52 @@ export const AuditTableWrapper = styled.div`
|
|
|
93
107
|
}
|
|
94
108
|
`;
|
|
95
109
|
|
|
110
|
+
const DateTd = styled(BaseTd)`
|
|
111
|
+
color: #6d6d6d;
|
|
112
|
+
`;
|
|
113
|
+
|
|
114
|
+
const NoDataFound = styled(BaseTd)`
|
|
115
|
+
text-align: center;
|
|
116
|
+
padding: 16px;
|
|
117
|
+
font-size: 16px;
|
|
118
|
+
color: #999;
|
|
119
|
+
`;
|
|
120
|
+
|
|
121
|
+
const StyledTable = styled(Table)`
|
|
122
|
+
width: 100%;
|
|
123
|
+
table-layout: fixed;
|
|
124
|
+
td.noBoder {
|
|
125
|
+
background: none !important;
|
|
126
|
+
border: none !important;
|
|
127
|
+
padding: 0;
|
|
128
|
+
}
|
|
129
|
+
`;
|
|
130
|
+
|
|
131
|
+
const StyledTr = styled.tr`
|
|
132
|
+
&:nth-child(even) {
|
|
133
|
+
background-color: #f3fbff;
|
|
134
|
+
}
|
|
135
|
+
`;
|
|
136
|
+
|
|
137
|
+
const StyledTd = styled(BaseTd)`
|
|
138
|
+
padding: 10px;
|
|
139
|
+
`;
|
|
140
|
+
|
|
141
|
+
const CreatedBy = styled.div`
|
|
142
|
+
font-weight: bold;
|
|
143
|
+
`;
|
|
144
|
+
|
|
145
|
+
const ScrollableTableWrapper = styled.div`
|
|
146
|
+
height: 250px;
|
|
147
|
+
min-height: 200px;
|
|
148
|
+
overflow: auto;
|
|
149
|
+
`;
|
|
150
|
+
|
|
151
|
+
const StickyHeaderWrapper = styled.div`
|
|
152
|
+
position: sticky;
|
|
153
|
+
top: 0;
|
|
154
|
+
z-index: 1;
|
|
155
|
+
background-color: #fff;
|
|
156
|
+
`;
|
|
157
|
+
|
|
96
158
|
export default GenericAuditLogsTable;
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import React, { useEffect } from 'react';
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
2
2
|
// import Notification from './notification';
|
|
3
3
|
import styled from 'styled-components';
|
|
4
4
|
import OrderDetails from './order-details';
|
|
5
5
|
import Notes from './notes';
|
|
6
6
|
import Order from './order-resources/expanded-content';
|
|
7
|
-
|
|
7
|
+
import Toolbox from './toolbox-resources/expanded-content';
|
|
8
8
|
import SystemLogs from './system-event-logs/expanded-content';
|
|
9
9
|
import GeneralHeader from './general-information';
|
|
10
10
|
import ProductsInfo from './products-info';
|
|
11
|
-
|
|
11
|
+
import TomTomLogs from './tomtomlogs/expanded-content';
|
|
12
12
|
// import { OrderViewType } from '../types';
|
|
13
13
|
// import Modals from './modals';
|
|
14
14
|
import OrderActions from './order-actions';
|
|
15
|
-
import {
|
|
15
|
+
import { useApiHook } from '@bjsdistribution/dms-component-library';
|
|
16
16
|
|
|
17
17
|
import {
|
|
18
18
|
useOrderDetails,
|
|
@@ -21,17 +21,25 @@ import {
|
|
|
21
21
|
useOrderId,
|
|
22
22
|
useDepotOptions,
|
|
23
23
|
usePrevOrderDetails,
|
|
24
|
+
useOrderProductsResources,
|
|
25
|
+
useOrderProductsToolbox,
|
|
26
|
+
useCustomerInfo,
|
|
27
|
+
useLocationOptions,
|
|
24
28
|
useOrderProductSystemLogs,
|
|
29
|
+
useGsitCUstomerId,
|
|
30
|
+
useCUstomerId,
|
|
31
|
+
useRouteId,
|
|
32
|
+
useGsitOrderId,
|
|
33
|
+
useOrderProductId,
|
|
34
|
+
useApiCalling,
|
|
35
|
+
useLiveRecalling,
|
|
25
36
|
} from './store';
|
|
26
|
-
|
|
27
|
-
import { useLoading } from '../order-daily-overview/store/store';
|
|
37
|
+
import Loader from '../order-daily-overview/header/loader/Loader';
|
|
38
|
+
// import { useLoading } from '../order-daily-overview/store/store';
|
|
28
39
|
import { OrdersType } from './types';
|
|
29
40
|
import { useLocation } from 'react-router-dom';
|
|
30
|
-
import RouterHeader from '../order-daily-overview/header/route-header/RouterHeader';
|
|
31
|
-
// import HeaderFilter from '../order-daily-overview/Header-filters/HeaderFilter';
|
|
32
|
-
// import Filters from '../order-daily-overview/filters/Filters';
|
|
33
|
-
import DetailsFilters from './details-filters/DetailsFilters';
|
|
34
41
|
import useSystemLogs from './hooks/useGetSystemLogs';
|
|
42
|
+
import { notification } from 'antd';
|
|
35
43
|
|
|
36
44
|
interface ApiResponse {
|
|
37
45
|
message: string;
|
|
@@ -43,8 +51,11 @@ interface ApiResponse {
|
|
|
43
51
|
}
|
|
44
52
|
|
|
45
53
|
function OrderView() {
|
|
54
|
+
notification.config({
|
|
55
|
+
top: 150,
|
|
56
|
+
});
|
|
46
57
|
const [orderId, setOrderId] = useOrderId();
|
|
47
|
-
|
|
58
|
+
const [gsitOrderId, setGsitOrderId] = useGsitOrderId();
|
|
48
59
|
const splitPath = (str: any) => {
|
|
49
60
|
const parts = str?.split('/')?.filter((part: any) => part !== ''); // Filter out empty parts
|
|
50
61
|
return parts;
|
|
@@ -53,14 +64,30 @@ function OrderView() {
|
|
|
53
64
|
// For API Call
|
|
54
65
|
const [orderDetails, setOrderDetails] = useOrderDetails();
|
|
55
66
|
const [, setPrevOrderDetails] = usePrevOrderDetails();
|
|
56
|
-
const [, setLoading] =
|
|
67
|
+
const [, setLoading] = useState<boolean>(false);
|
|
57
68
|
const [, setOrderStaticData] = useOrderStaticData();
|
|
58
69
|
const [, setOrderStatus] = useStatusDetails();
|
|
59
70
|
const [, setDepotOptions] = useDepotOptions();
|
|
71
|
+
const [, setCustomerInfo] = useCustomerInfo();
|
|
60
72
|
const location = useLocation();
|
|
61
73
|
const paths = splitPath(location.pathname);
|
|
74
|
+
const [, setLocationOptions] = useLocationOptions();
|
|
75
|
+
const [apiCalling] = useApiCalling();
|
|
76
|
+
|
|
77
|
+
const [orderResources, setOrderResources] = useOrderProductsResources();
|
|
78
|
+
const [orderToolbox, setOrderToolbox] = useOrderProductsToolbox();
|
|
79
|
+
const [GsitCUstomerId, setGsitCUstomerId] = useGsitCUstomerId();
|
|
80
|
+
const [, setOrderProductId] = useOrderProductId();
|
|
81
|
+
const [, setCUstomerId] = useCUstomerId();
|
|
82
|
+
const [, setRouteId] = useRouteId();
|
|
83
|
+
const [liveRecalling] = useLiveRecalling();
|
|
84
|
+
const systemLogsData = useSystemLogs();
|
|
62
85
|
|
|
63
|
-
const {
|
|
86
|
+
const {
|
|
87
|
+
data: fetchedData,
|
|
88
|
+
loading,
|
|
89
|
+
setShouldPerformAction: orderUpdate,
|
|
90
|
+
} = useApiHook<{
|
|
64
91
|
data: OrdersType[];
|
|
65
92
|
}>({
|
|
66
93
|
endpoint: `orders/${orderId}`,
|
|
@@ -79,7 +106,7 @@ function OrderView() {
|
|
|
79
106
|
const {
|
|
80
107
|
data: fetchedStatusData,
|
|
81
108
|
loading: statusDataLoading,
|
|
82
|
-
setShouldPerformAction:
|
|
109
|
+
setShouldPerformAction: setLivePerformAction,
|
|
83
110
|
} = useApiHook<{
|
|
84
111
|
data: ApiResponse[];
|
|
85
112
|
}>({
|
|
@@ -87,25 +114,36 @@ function OrderView() {
|
|
|
87
114
|
method: 'GET',
|
|
88
115
|
performAction: false,
|
|
89
116
|
});
|
|
90
|
-
|
|
91
117
|
const { data: fetchedDepotData, loading: depotDataLoading } = useApiHook<{
|
|
92
118
|
data: ApiResponse[];
|
|
93
119
|
}>({
|
|
94
120
|
endpoint: `/depot/`,
|
|
95
121
|
method: 'GET',
|
|
122
|
+
filters: [{ field: 'visibility', op: '=', value: true }],
|
|
96
123
|
});
|
|
97
|
-
|
|
98
124
|
useEffect(() => {
|
|
99
125
|
if (orderId) {
|
|
100
|
-
|
|
101
|
-
|
|
126
|
+
orderUpdate(true);
|
|
127
|
+
liveRecalling ? setLivePerformAction(false) : setLivePerformAction(true);
|
|
128
|
+
}
|
|
129
|
+
}, [orderId, liveRecalling]);
|
|
130
|
+
|
|
131
|
+
useEffect(() => {
|
|
132
|
+
if (apiCalling) {
|
|
133
|
+
orderUpdate(true);
|
|
134
|
+
} else {
|
|
135
|
+
orderUpdate(false);
|
|
102
136
|
}
|
|
103
|
-
}, [
|
|
137
|
+
}, [apiCalling]);
|
|
104
138
|
|
|
105
139
|
useEffect(() => {
|
|
106
140
|
if (paths.length > 1) {
|
|
107
141
|
setOrderId(paths[1]);
|
|
108
142
|
}
|
|
143
|
+
// for local
|
|
144
|
+
// if (paths.length >= 0) {
|
|
145
|
+
// setOrderId(paths[0]);
|
|
146
|
+
// }
|
|
109
147
|
}, [paths]);
|
|
110
148
|
|
|
111
149
|
useEffect(() => {
|
|
@@ -121,6 +159,17 @@ function OrderView() {
|
|
|
121
159
|
if (fetchedData && fetchedData.data) {
|
|
122
160
|
const requiredData = fetchedData?.data;
|
|
123
161
|
setOrderDetails(requiredData[0]);
|
|
162
|
+
//@ts-ignore
|
|
163
|
+
setCUstomerId(requiredData[0]?.customer_id);
|
|
164
|
+
setRouteId(requiredData[0]?.order_routes?.route_id);
|
|
165
|
+
//@ts-ignore
|
|
166
|
+
setGsitOrderId(requiredData[0]?.gsit_order_id);
|
|
167
|
+
//@ts-ignore
|
|
168
|
+
setOrderProductId(requiredData[0]?.id);
|
|
169
|
+
setCustomerInfo({
|
|
170
|
+
recipient_name: requiredData[0]?.order_recipient?.recipient_name,
|
|
171
|
+
postcode: requiredData[0]?.order_recipient?.postcode,
|
|
172
|
+
});
|
|
124
173
|
setPrevOrderDetails(requiredData[0]);
|
|
125
174
|
}
|
|
126
175
|
}, [loading]);
|
|
@@ -129,13 +178,16 @@ function OrderView() {
|
|
|
129
178
|
setLoading(statusDataLoading);
|
|
130
179
|
if (fetchedStatusData && fetchedStatusData.data) {
|
|
131
180
|
const requiredData = fetchedStatusData?.data;
|
|
132
|
-
if (requiredData
|
|
181
|
+
if (requiredData) {
|
|
133
182
|
setOrderStatus(requiredData);
|
|
134
183
|
} else {
|
|
135
|
-
setOrderStatus(null);
|
|
184
|
+
// setOrderStatus(null);
|
|
136
185
|
}
|
|
137
186
|
}
|
|
138
|
-
|
|
187
|
+
return () => {
|
|
188
|
+
setOrderId(null);
|
|
189
|
+
};
|
|
190
|
+
}, [statusDataLoading, fetchedStatusData]);
|
|
139
191
|
|
|
140
192
|
useEffect(() => {
|
|
141
193
|
setLoading(depotDataLoading);
|
|
@@ -153,11 +205,104 @@ function OrderView() {
|
|
|
153
205
|
setDepotOptions([]);
|
|
154
206
|
}
|
|
155
207
|
}
|
|
208
|
+
return () => {
|
|
209
|
+
setOrderId(null);
|
|
210
|
+
};
|
|
156
211
|
}, [depotDataLoading]);
|
|
157
212
|
|
|
158
|
-
|
|
213
|
+
// Order resources
|
|
214
|
+
const {
|
|
215
|
+
data: fetchedResourcesData,
|
|
216
|
+
setShouldPerformAction: setActions,
|
|
217
|
+
} = useApiHook<{
|
|
218
|
+
data: ApiResponse[];
|
|
219
|
+
}>({
|
|
220
|
+
endpoint: `/orders/${orderId}/order_resources/`,
|
|
221
|
+
method: 'GET',
|
|
222
|
+
performAction: false,
|
|
223
|
+
});
|
|
159
224
|
|
|
160
|
-
|
|
225
|
+
useEffect(() => {
|
|
226
|
+
if (orderId) {
|
|
227
|
+
setActions(true);
|
|
228
|
+
}
|
|
229
|
+
}, [orderId, setActions]);
|
|
230
|
+
|
|
231
|
+
useEffect(() => {
|
|
232
|
+
if (orderId) {
|
|
233
|
+
setOrderResources(fetchedResourcesData);
|
|
234
|
+
}
|
|
235
|
+
return () => {
|
|
236
|
+
setOrderId(null);
|
|
237
|
+
};
|
|
238
|
+
}, [fetchedResourcesData, orderResources, setOrderResources]);
|
|
239
|
+
|
|
240
|
+
// Toolbox resources
|
|
241
|
+
const {
|
|
242
|
+
data: fetchedToolboxData,
|
|
243
|
+
setShouldPerformAction: setAction,
|
|
244
|
+
} = useApiHook<{
|
|
245
|
+
data: ApiResponse[];
|
|
246
|
+
}>({
|
|
247
|
+
endpoint: `/orders/${orderId}/toolbox_resources/`,
|
|
248
|
+
method: 'GET',
|
|
249
|
+
performAction: false,
|
|
250
|
+
});
|
|
251
|
+
|
|
252
|
+
useEffect(() => {
|
|
253
|
+
if (orderId) {
|
|
254
|
+
setAction(true);
|
|
255
|
+
}
|
|
256
|
+
}, [orderId, setAction]);
|
|
257
|
+
|
|
258
|
+
useEffect(() => {
|
|
259
|
+
if (orderId) {
|
|
260
|
+
setOrderToolbox(fetchedToolboxData);
|
|
261
|
+
}
|
|
262
|
+
return () => {
|
|
263
|
+
setOrderId(undefined);
|
|
264
|
+
};
|
|
265
|
+
}, [fetchedToolboxData, orderToolbox, setOrderToolbox]);
|
|
266
|
+
|
|
267
|
+
useEffect(() => {
|
|
268
|
+
if (GsitCUstomerId?.id) {
|
|
269
|
+
shouldFetch(true);
|
|
270
|
+
} else {
|
|
271
|
+
shouldFetch(false);
|
|
272
|
+
}
|
|
273
|
+
}, [GsitCUstomerId]);
|
|
274
|
+
|
|
275
|
+
useEffect(() => {
|
|
276
|
+
return () => {
|
|
277
|
+
setGsitCUstomerId((prev: any) => ({ ...prev, id: undefined }));
|
|
278
|
+
};
|
|
279
|
+
}, []);
|
|
280
|
+
|
|
281
|
+
const {
|
|
282
|
+
data: fetchedLocationData,
|
|
283
|
+
loading: dataLoading,
|
|
284
|
+
setShouldPerformAction: shouldFetch,
|
|
285
|
+
} = useApiHook<{
|
|
286
|
+
data: ApiResponse[];
|
|
287
|
+
}>({
|
|
288
|
+
endpoint: `/return_locations/?customer_id=${GsitCUstomerId?.id}`,
|
|
289
|
+
method: 'GET',
|
|
290
|
+
performAction: false,
|
|
291
|
+
});
|
|
292
|
+
|
|
293
|
+
useEffect(() => {
|
|
294
|
+
if (fetchedLocationData && fetchedLocationData?.data) {
|
|
295
|
+
const locationOptions = fetchedLocationData?.data?.map((item: any) => {
|
|
296
|
+
return {
|
|
297
|
+
label: item?.location_name + ', ' + item?.postcode,
|
|
298
|
+
value: item?.token,
|
|
299
|
+
is_default: item?.is_default === 'True' ? true : false,
|
|
300
|
+
};
|
|
301
|
+
});
|
|
302
|
+
setLocationOptions(locationOptions);
|
|
303
|
+
}
|
|
304
|
+
}, [dataLoading]);
|
|
305
|
+
let gsitId = orderDetails?.gsit_order_id;
|
|
161
306
|
const [, setSystemLogsEvents] = useOrderProductSystemLogs();
|
|
162
307
|
|
|
163
308
|
const fetchReminderData = async () => {
|
|
@@ -166,182 +311,37 @@ function OrderView() {
|
|
|
166
311
|
};
|
|
167
312
|
|
|
168
313
|
useEffect(() => {
|
|
169
|
-
if (
|
|
314
|
+
if (gsitOrderId) {
|
|
170
315
|
fetchReminderData();
|
|
171
|
-
|
|
172
|
-
console.log('Setting filters for gsitId:', gsitId);
|
|
173
316
|
}
|
|
317
|
+
return () => {
|
|
318
|
+
setGsitOrderId(undefined);
|
|
319
|
+
};
|
|
174
320
|
}, [gsitId]);
|
|
175
321
|
|
|
176
322
|
return (
|
|
177
|
-
|
|
178
|
-
<
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
</NotifyContainer>
|
|
197
|
-
<OrderDetails />
|
|
198
|
-
</Section>
|
|
199
|
-
|
|
200
|
-
<ProductsInfo />
|
|
201
|
-
<SplitLayout>
|
|
202
|
-
<NotesContainer>
|
|
203
|
-
<Notes />
|
|
204
|
-
</NotesContainer>
|
|
205
|
-
<TablesContainer>
|
|
206
|
-
<Order />
|
|
207
|
-
{/* <Toolbox /> */}
|
|
208
|
-
<SystemLogs />
|
|
209
|
-
{/* <TomTomLogs /> */}
|
|
210
|
-
</TablesContainer>
|
|
211
|
-
</SplitLayout>
|
|
212
|
-
<OrderActions />
|
|
213
|
-
</MainContainer>
|
|
214
|
-
</div>
|
|
215
|
-
</DashBoardWrapper>
|
|
216
|
-
</>
|
|
323
|
+
<MainContainer>
|
|
324
|
+
<Loader />
|
|
325
|
+
<GeneralHeader />
|
|
326
|
+
{/* <Notification /> */}
|
|
327
|
+
<OrderDetails />
|
|
328
|
+
<ProductsInfo />
|
|
329
|
+
<SplitLayout>
|
|
330
|
+
<NotesContainer>
|
|
331
|
+
<Notes />
|
|
332
|
+
</NotesContainer>
|
|
333
|
+
<TablesContainer>
|
|
334
|
+
<Order />
|
|
335
|
+
<Toolbox />
|
|
336
|
+
<SystemLogs />
|
|
337
|
+
<TomTomLogs />
|
|
338
|
+
</TablesContainer>
|
|
339
|
+
</SplitLayout>
|
|
340
|
+
<OrderActions />
|
|
341
|
+
</MainContainer>
|
|
217
342
|
);
|
|
218
343
|
}
|
|
219
344
|
|
|
220
|
-
const Section = styled.div`
|
|
221
|
-
display: flex;
|
|
222
|
-
background: #ffffff;
|
|
223
|
-
// padding: 15px;
|
|
224
|
-
flex-direction: column;
|
|
225
|
-
gap: 14px;
|
|
226
|
-
border-radius: 12px;
|
|
227
|
-
box-shadow: 0px 4px 30px 0px rgba(46, 45, 116, 0.05);
|
|
228
|
-
border: 1px solid #e0e0e0;
|
|
229
|
-
padding: 12px;
|
|
230
|
-
`;
|
|
231
|
-
/* // `; */
|
|
232
|
-
const DashBoardWrapper = styled.section`
|
|
233
|
-
.Tableconatiner {
|
|
234
|
-
border-radius: 12px;
|
|
235
|
-
/* background: #fff; */
|
|
236
|
-
/* box-shadow: -2px 0px 12px 0px rgba(56, 71, 109, 0.1); */
|
|
237
|
-
display: block;
|
|
238
|
-
padding: 15px 0px;
|
|
239
|
-
}
|
|
240
|
-
.headerWrap,
|
|
241
|
-
.tableData,
|
|
242
|
-
.styleCovered {
|
|
243
|
-
transition: all ease 0.5s;
|
|
244
|
-
}
|
|
245
|
-
&.stickyTableHead {
|
|
246
|
-
h2 {
|
|
247
|
-
font-size: 21px;
|
|
248
|
-
}
|
|
249
|
-
.headerWrap {
|
|
250
|
-
height: 84px;
|
|
251
|
-
padding: 10px;
|
|
252
|
-
border-radius: 0px 0px 15px 15px;
|
|
253
|
-
> div {
|
|
254
|
-
position: relative;
|
|
255
|
-
z-index: 10;
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
.styleCovered {
|
|
259
|
-
margin-top: -32px;
|
|
260
|
-
width: 67%;
|
|
261
|
-
float: right;
|
|
262
|
-
gap: 5px;
|
|
263
|
-
padding-right: 11px;
|
|
264
|
-
|
|
265
|
-
li {
|
|
266
|
-
padding: 4px 10px 5px 5px;
|
|
267
|
-
gap: 5px;
|
|
268
|
-
.svgCover {
|
|
269
|
-
width: 30px;
|
|
270
|
-
height: 30px;
|
|
271
|
-
svg {
|
|
272
|
-
height: auto;
|
|
273
|
-
width: 58%;
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
.countDigit {
|
|
277
|
-
font-size: 19px;
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
.countMess {
|
|
281
|
-
font-size: 13px;
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
.dmsBulkFilter {
|
|
285
|
-
min-height: unset;
|
|
286
|
-
gap: 4px;
|
|
287
|
-
> div {
|
|
288
|
-
padding: 4px 12px;
|
|
289
|
-
label {
|
|
290
|
-
font-size: 11px;
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
.StyledFilterList {
|
|
296
|
-
gap: 4px;
|
|
297
|
-
li {
|
|
298
|
-
height: 29px;
|
|
299
|
-
padding: 3px 8px;
|
|
300
|
-
gap: 4px;
|
|
301
|
-
.StyledFilterBtnIcon {
|
|
302
|
-
width: 20px;
|
|
303
|
-
height: 20px;
|
|
304
|
-
svh {
|
|
305
|
-
width: 10px;
|
|
306
|
-
height: auto;
|
|
307
|
-
}
|
|
308
|
-
}
|
|
309
|
-
.StyledFilterBtnLabel {
|
|
310
|
-
font-size: 13px;
|
|
311
|
-
}
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
.StyledFilterLabel {
|
|
315
|
-
padding-left: 10px;
|
|
316
|
-
span {
|
|
317
|
-
font-size: 13px;
|
|
318
|
-
}
|
|
319
|
-
}
|
|
320
|
-
.cardcontainer.tableData {
|
|
321
|
-
max-height: calc(100vh - 310px);
|
|
322
|
-
min-height: calc(100vh - 310px);
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
.tableData {
|
|
326
|
-
max-height: calc(100vh - 320px);
|
|
327
|
-
min-height: calc(100vh - 320px);
|
|
328
|
-
|
|
329
|
-
margin-top: 8px;
|
|
330
|
-
thead {
|
|
331
|
-
position: sticky;
|
|
332
|
-
top: 0;
|
|
333
|
-
z-index: 9;
|
|
334
|
-
th {
|
|
335
|
-
font-size: 13px;
|
|
336
|
-
padding: 2px 15px;
|
|
337
|
-
}
|
|
338
|
-
}
|
|
339
|
-
}
|
|
340
|
-
}
|
|
341
|
-
`;
|
|
342
|
-
const NotifyContainer = styled.div`
|
|
343
|
-
margin-left: 18px;
|
|
344
|
-
`;
|
|
345
345
|
const MainContainer = styled.div`
|
|
346
346
|
display: flex;
|
|
347
347
|
flex-direction: column;
|