@bjsdistribution/dms-client-return 0.0.64 → 0.0.66
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 +59 -57
- 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 +59 -57
- package/dist/dms-client-return.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/order-daily-overview/return-after-table/table-filters/ReturnOrderFilter.tsx +8 -6
- package/src/components/order-view/details-filters/right-side-filters/Details.tsx +5 -4
- package/src/components/order-view/index.tsx +41 -38
- 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
package/src/components/order-daily-overview/return-after-table/table-filters/ReturnOrderFilter.tsx
CHANGED
|
@@ -95,6 +95,11 @@ const ReturnOrderFilter = () => {
|
|
|
95
95
|
});
|
|
96
96
|
};
|
|
97
97
|
|
|
98
|
+
const assigneeOptions = assignData?.map(client => ({
|
|
99
|
+
label: client.type,
|
|
100
|
+
value: client.id,
|
|
101
|
+
}));
|
|
102
|
+
|
|
98
103
|
const handleAssigneeChange = (value: any) => {
|
|
99
104
|
const bjsDeliveryValue = assignData.find(client => client.id === value)
|
|
100
105
|
?.bjs_delivery;
|
|
@@ -189,7 +194,7 @@ const ReturnOrderFilter = () => {
|
|
|
189
194
|
className="custom-select"
|
|
190
195
|
placeholder="Status of Order"
|
|
191
196
|
onChange={handleStatusOfOrder}
|
|
192
|
-
style={{
|
|
197
|
+
style={{ width: '145px' }}
|
|
193
198
|
value={statusOrder}
|
|
194
199
|
onClear={handleClear}
|
|
195
200
|
allowClear
|
|
@@ -220,15 +225,12 @@ const ReturnOrderFilter = () => {
|
|
|
220
225
|
</div>
|
|
221
226
|
<StyledAntSelect>
|
|
222
227
|
<Select
|
|
223
|
-
options={
|
|
224
|
-
label: client.type,
|
|
225
|
-
value: client.id,
|
|
226
|
-
}))}
|
|
228
|
+
options={assigneeOptions}
|
|
227
229
|
className="custom-select"
|
|
228
230
|
placeholder="Assignee"
|
|
229
231
|
onChange={handleAssigneeChange}
|
|
230
232
|
value={selectedAssignee}
|
|
231
|
-
style={{ minWidth: '
|
|
233
|
+
style={{ minWidth: '140px' }}
|
|
232
234
|
allowClear
|
|
233
235
|
onClear={handleClearAssignee}
|
|
234
236
|
/>
|
|
@@ -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,
|
|
@@ -31,7 +31,7 @@ import { OrdersType } from './types';
|
|
|
31
31
|
import { useLocation } from 'react-router-dom';
|
|
32
32
|
import useSystemLogs from './hooks/useGetSystemLogs';
|
|
33
33
|
import { notification } from 'antd';
|
|
34
|
-
import { useAssignData } from '../store';
|
|
34
|
+
// import { useAssignData } from '../store';
|
|
35
35
|
import DetailsFilters from './details-filters/DetailsFilters';
|
|
36
36
|
|
|
37
37
|
interface ApiResponse {
|
|
@@ -59,14 +59,14 @@ 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();
|
|
66
66
|
const [, setRouteId] = useRouteId();
|
|
67
67
|
const [liveRecalling] = useLiveRecalling();
|
|
68
68
|
const systemLogsData = useSystemLogs();
|
|
69
|
-
const [, setAssignData] = useAssignData();
|
|
69
|
+
// const [, setAssignData] = useAssignData();
|
|
70
70
|
|
|
71
71
|
// query param
|
|
72
72
|
const location = useLocation();
|
|
@@ -173,11 +173,11 @@ function OrderView() {
|
|
|
173
173
|
if (fetchedStaticData && fetchedStaticData.data) {
|
|
174
174
|
const result = fetchedStaticData?.data;
|
|
175
175
|
setOrderStaticData(result[0]);
|
|
176
|
-
setAssignData(
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
);
|
|
176
|
+
// setAssignData(
|
|
177
|
+
// fetchedStaticData?.data?.flatMap(
|
|
178
|
+
// (i: any) => i?.resource_visibility_type
|
|
179
|
+
// )
|
|
180
|
+
// );
|
|
181
181
|
}
|
|
182
182
|
}, [staticDataLoading]);
|
|
183
183
|
|
|
@@ -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]);
|
|
@@ -219,9 +221,10 @@ function OrderView() {
|
|
|
219
221
|
useEffect(() => {
|
|
220
222
|
setLoading(depotDataLoading);
|
|
221
223
|
if (fetchedDepotData && fetchedDepotData.data) {
|
|
224
|
+
console.log(fetchedDepotData, 'fetchedDepotData');
|
|
222
225
|
const requiredData = fetchedDepotData?.data;
|
|
223
226
|
if (requiredData.length > 0) {
|
|
224
|
-
const options = requiredData
|
|
227
|
+
const options = requiredData?.map((x: any) => {
|
|
225
228
|
return {
|
|
226
229
|
label: x.name,
|
|
227
230
|
value: x.id,
|
|
@@ -264,32 +267,32 @@ function OrderView() {
|
|
|
264
267
|
};
|
|
265
268
|
}, [fetchedResourcesData, orderResources, setOrderResources]);
|
|
266
269
|
|
|
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]);
|
|
270
|
+
// // Toolbox resources
|
|
271
|
+
// const {
|
|
272
|
+
// data: fetchedToolboxData,
|
|
273
|
+
// setShouldPerformAction: setAction,
|
|
274
|
+
// } = useApiHook<{
|
|
275
|
+
// data: ApiResponse[];
|
|
276
|
+
// }>({
|
|
277
|
+
// endpoint: `/orders/${orderId}/toolbox_resources/`,
|
|
278
|
+
// method: 'GET',
|
|
279
|
+
// performAction: false,
|
|
280
|
+
// });
|
|
281
|
+
|
|
282
|
+
// useEffect(() => {
|
|
283
|
+
// if (orderId) {
|
|
284
|
+
// setAction(true);
|
|
285
|
+
// }
|
|
286
|
+
// }, [orderId, setAction]);
|
|
287
|
+
|
|
288
|
+
// useEffect(() => {
|
|
289
|
+
// if (orderId) {
|
|
290
|
+
// setOrderToolbox(fetchedToolboxData);
|
|
291
|
+
// }
|
|
292
|
+
// return () => {
|
|
293
|
+
// // setOrderId(undefined);
|
|
294
|
+
// };
|
|
295
|
+
// }, [fetchedToolboxData, orderToolbox, setOrderToolbox]);
|
|
293
296
|
|
|
294
297
|
useEffect(() => {
|
|
295
298
|
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,
|