@bjsdistribution/dms-client-return 0.0.63 → 0.0.65
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-view/store.d.ts +5 -13
- package/dist/dms-client-return.cjs.development.js +42 -42
- 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 +42 -42
- package/dist/dms-client-return.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/order-view/details-filters/right-side-filters/Details.tsx +5 -4
- package/src/components/order-view/index.tsx +32 -30
- package/src/components/order-view/order-actions/actions/confirm-order/index.tsx +5 -1
- package/src/components/order-view/store.ts +10 -4
package/package.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import styled from 'styled-components';
|
|
3
|
-
import {
|
|
3
|
+
import { useCustomerInfo } from '../../store';
|
|
4
4
|
|
|
5
5
|
const Details = () => {
|
|
6
|
-
const [orderDetails] = useOrderDetails();
|
|
7
|
-
const
|
|
8
|
-
const
|
|
6
|
+
// const [orderDetails] = useOrderDetails();
|
|
7
|
+
const [customerInfo] = useCustomerInfo();
|
|
8
|
+
const recipient = customerInfo?.recipient_name || '';
|
|
9
|
+
const postcodeShow = customerInfo?.postcode || '';
|
|
9
10
|
|
|
10
11
|
return (
|
|
11
12
|
<DetailsContainer>
|
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
useDepotOptions,
|
|
17
17
|
usePrevOrderDetails,
|
|
18
18
|
useOrderProductsResources,
|
|
19
|
-
useOrderProductsToolbox,
|
|
19
|
+
// useOrderProductsToolbox,
|
|
20
20
|
useCustomerInfo,
|
|
21
21
|
useLocationOptions,
|
|
22
22
|
useOrderProductSystemLogs,
|
|
@@ -59,7 +59,7 @@ function OrderView() {
|
|
|
59
59
|
const [, setCustomerInfo] = useCustomerInfo();
|
|
60
60
|
const [, setLocationOptions] = useLocationOptions();
|
|
61
61
|
const [orderResources, setOrderResources] = useOrderProductsResources();
|
|
62
|
-
const [orderToolbox, setOrderToolbox] = useOrderProductsToolbox();
|
|
62
|
+
// const [orderToolbox, setOrderToolbox] = useOrderProductsToolbox();
|
|
63
63
|
const [GsitCUstomerId, setGsitCUstomerId] = useGsitCUstomerId();
|
|
64
64
|
const [, setOrderProductId] = useOrderProductId();
|
|
65
65
|
const [, setCUstomerId] = useCUstomerId();
|
|
@@ -194,9 +194,11 @@ function OrderView() {
|
|
|
194
194
|
//@ts-ignore
|
|
195
195
|
setOrderProductId(requiredData[0]?.id);
|
|
196
196
|
setCustomerInfo({
|
|
197
|
-
recipient_name:
|
|
198
|
-
|
|
197
|
+
recipient_name:
|
|
198
|
+
requiredData[0]?.order_recipient?.recipient_name ?? null,
|
|
199
|
+
postcode: requiredData[0]?.order_recipient?.postcode ?? null,
|
|
199
200
|
});
|
|
201
|
+
|
|
200
202
|
setPrevOrderDetails(requiredData[0]);
|
|
201
203
|
}
|
|
202
204
|
}, [loading]);
|
|
@@ -264,32 +266,32 @@ function OrderView() {
|
|
|
264
266
|
};
|
|
265
267
|
}, [fetchedResourcesData, orderResources, setOrderResources]);
|
|
266
268
|
|
|
267
|
-
// Toolbox resources
|
|
268
|
-
const {
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
} = useApiHook<{
|
|
272
|
-
|
|
273
|
-
}>({
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
});
|
|
278
|
-
|
|
279
|
-
useEffect(() => {
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
}, [orderId, setAction]);
|
|
284
|
-
|
|
285
|
-
useEffect(() => {
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
}, [fetchedToolboxData, orderToolbox, setOrderToolbox]);
|
|
269
|
+
// // Toolbox resources
|
|
270
|
+
// const {
|
|
271
|
+
// data: fetchedToolboxData,
|
|
272
|
+
// setShouldPerformAction: setAction,
|
|
273
|
+
// } = useApiHook<{
|
|
274
|
+
// data: ApiResponse[];
|
|
275
|
+
// }>({
|
|
276
|
+
// endpoint: `/orders/${orderId}/toolbox_resources/`,
|
|
277
|
+
// method: 'GET',
|
|
278
|
+
// performAction: false,
|
|
279
|
+
// });
|
|
280
|
+
|
|
281
|
+
// useEffect(() => {
|
|
282
|
+
// if (orderId) {
|
|
283
|
+
// setAction(true);
|
|
284
|
+
// }
|
|
285
|
+
// }, [orderId, setAction]);
|
|
286
|
+
|
|
287
|
+
// useEffect(() => {
|
|
288
|
+
// if (orderId) {
|
|
289
|
+
// setOrderToolbox(fetchedToolboxData);
|
|
290
|
+
// }
|
|
291
|
+
// return () => {
|
|
292
|
+
// // setOrderId(undefined);
|
|
293
|
+
// };
|
|
294
|
+
// }, [fetchedToolboxData, orderToolbox, setOrderToolbox]);
|
|
293
295
|
|
|
294
296
|
useEffect(() => {
|
|
295
297
|
return () => {
|
|
@@ -24,6 +24,7 @@ import { useLoading } from '../../../../order-daily-overview/store/store';
|
|
|
24
24
|
import { notification } from 'antd';
|
|
25
25
|
import { compareOrderDetailsStates, filterObject } from '../../../utils';
|
|
26
26
|
import useUpdateOrder from '../../../hooks/useUpdateOrder';
|
|
27
|
+
import { format } from 'date-fns';
|
|
27
28
|
// import { filterObject } from '../../../utils';
|
|
28
29
|
|
|
29
30
|
function ConfirmOrder() {
|
|
@@ -37,7 +38,7 @@ function ConfirmOrder() {
|
|
|
37
38
|
const [, setLoading] = useLoading();
|
|
38
39
|
const [customerInfo] = useCustomerInfo();
|
|
39
40
|
const infoText = `${customerInfo?.recipient_name}, ${customerInfo?.postcode}`;
|
|
40
|
-
const [deliveryDate] = useConfirmOrderDate();
|
|
41
|
+
const [deliveryDate, setDeliveryDate] = useConfirmOrderDate();
|
|
41
42
|
const [liveRecalling, setRecalling] = useLiveRecalling();
|
|
42
43
|
const [orderId] = useOrderId();
|
|
43
44
|
const [errorState] = useErrorConfirmOrder();
|
|
@@ -164,6 +165,9 @@ function ConfirmOrder() {
|
|
|
164
165
|
}
|
|
165
166
|
if (orderId && deliveryDate) {
|
|
166
167
|
//call order update api then call confirm order if required
|
|
168
|
+
const formattedDate = format(new Date(deliveryDate), 'yyyy-MM-dd');
|
|
169
|
+
|
|
170
|
+
setDeliveryDate(formattedDate);
|
|
167
171
|
setPerformAction(true);
|
|
168
172
|
}
|
|
169
173
|
};
|
|
@@ -18,10 +18,16 @@ const date = atom(new Date());
|
|
|
18
18
|
|
|
19
19
|
const orderStaticDataAtom = atom<any>({});
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
recipient_name: string | null
|
|
23
|
-
postcode: string | null
|
|
24
|
-
}
|
|
21
|
+
interface OrderRecipient {
|
|
22
|
+
recipient_name: string | null;
|
|
23
|
+
postcode: string | null;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const customerInfoAtom = atom<OrderRecipient>({
|
|
27
|
+
recipient_name: '',
|
|
28
|
+
postcode: '',
|
|
29
|
+
});
|
|
30
|
+
|
|
25
31
|
|
|
26
32
|
export const ordersInitialValue: OrdersType = {
|
|
27
33
|
depot_id: null,
|