@bjsdistribution/dms-client-return 0.0.94-prod → 0.0.95-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/assets/icons/ArrowDownIcon.d.ts +6 -0
- package/dist/assets/icons/DeliverProductIcon.d.ts +3 -0
- package/dist/assets/icons/ReturnProductIcon.d.ts +3 -0
- package/dist/common/checkbox/index.d.ts +2 -0
- package/dist/common/modals/order-action-modal/OrderActionModal.d.ts +3 -1
- package/dist/components/order-view/details-filters/left-side-filters/dropdowns/DropDowns.d.ts +1 -0
- package/dist/components/order-view/details-filters/left-side-filters/dropdowns/MenuDropDown.d.ts +2 -2
- package/dist/components/order-view/flags-action-modal/Actions.d.ts +6 -2
- package/dist/components/order-view/flags-action-modal/Dropdowns.d.ts +1 -0
- package/dist/components/order-view/flags-action-modal/Header.d.ts +1 -1
- package/dist/components/order-view/notification/FlagTemplate.d.ts +1 -1
- package/dist/components/order-view/notification/OrderTemplate.d.ts +1 -1
- package/dist/components/order-view/notification/Tabs.d.ts +1 -1
- package/dist/components/order-view/order-actions/actions/cancel-order/CancelOrderTable.d.ts +5 -0
- package/dist/components/order-view/order-actions/actions/cancel-order/index.d.ts +7 -1
- package/dist/components/order-view/order-actions/actions/change-customer-account/ChangeCustomerAccModal.d.ts +4 -1
- package/dist/components/order-view/order-actions/actions/charge-log/index.d.ts +11 -0
- package/dist/components/order-view/order-actions/actions/create-task-reminder/CreateReminderModal.d.ts +1 -13
- package/dist/components/order-view/order-actions/actions/create-task-reminder/TaskModal.d.ts +5 -1
- package/dist/components/order-view/order-actions/actions/create-task-reminder/index.d.ts +6 -2
- package/dist/components/order-view/order-actions/actions/hold-order/HoldOrderModal.d.ts +6 -1
- package/dist/components/order-view/order-actions/actions/log-service-refusal/DeliveryPoint.d.ts +5 -1
- package/dist/components/order-view/order-actions/actions/log-service-refusal/Notes.d.ts +5 -3
- package/dist/components/order-view/order-actions/actions/log-service-refusal/OrderServices.d.ts +5 -1
- package/dist/components/order-view/order-actions/actions/log-service-refusal/index.d.ts +1 -1
- package/dist/components/order-view/order-actions/actions/uncancel-order/UncancelOrder.d.ts +7 -1
- package/dist/components/order-view/order-actions/actions/uncancel-order/UncancelOrderTable.d.ts +5 -0
- package/dist/components/order-view/order-actions/actions/unhold-order/UnholdOrder.d.ts +6 -1
- package/dist/components/order-view/order-actions/store.d.ts +10 -8
- package/dist/components/order-view/order-actions/types.d.ts +38 -60
- package/dist/components/order-view/order-actions/utils.d.ts +2 -1
- package/dist/components/order-view/store.d.ts +48 -3
- package/dist/components/order-view/types.d.ts +11 -0
- package/dist/components/order-view/utils.d.ts +1 -0
- package/dist/components/order-view/view-reminder/ViewReminder.d.ts +5 -1
- package/dist/components/order-view/view-reminder/reminder-styles.d.ts +3 -1
- package/dist/components/store.d.ts +2 -1
- package/dist/dms-client-return.cjs.development.js +4812 -3095
- 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 +4815 -3098
- package/dist/dms-client-return.esm.js.map +1 -1
- package/package.json +2 -2
- package/src/assets/icons/ArrowDownIcon.tsx +28 -0
- package/src/assets/icons/DeliverProductIcon.tsx +42 -0
- package/src/assets/icons/ReturnProductIcon.tsx +23 -0
- package/src/common/checkbox/index.tsx +60 -17
- package/src/common/modals/order-action-modal/OrderActionModal.tsx +13 -7
- package/src/common/radio-group/RadioButtonGroup.tsx +3 -4
- package/src/components/order-daily-overview/header-filters/SelectionFilter.tsx +29 -26
- package/src/components/order-daily-overview/header-filters/filterStore.ts +6 -8
- package/src/components/order-daily-overview/index.tsx +20 -7
- 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 +19 -19
- package/src/components/order-daily-overview/return-after-table/table-filters/ReturnFilterStore.ts +11 -9
- package/src/components/order-daily-overview/return-after-table/table-filters/ReturnOrderFilter.tsx +19 -4
- package/src/components/order-daily-overview/return-order-table/return-orders-filters/ReturnOrderTable.tsx +41 -59
- package/src/components/order-daily-overview/table/ReturnTable.tsx +1 -30
- package/src/components/order-view/details-filters/left-side-filters/dropdowns/DropDowns.tsx +52 -2
- package/src/components/order-view/details-filters/left-side-filters/dropdowns/MenuDropDown.tsx +37 -43
- package/src/components/order-view/details-filters/left-side-filters/dropdowns/OptionsDropDown.tsx +75 -44
- package/src/components/order-view/fakedata.ts +7 -6
- package/src/components/order-view/flags-action-modal/Actions.tsx +51 -25
- package/src/components/order-view/flags-action-modal/DetailSection.tsx +5 -5
- package/src/components/order-view/flags-action-modal/Dropdowns.tsx +75 -89
- package/src/components/order-view/flags-action-modal/Header.tsx +32 -23
- package/src/components/order-view/flags-action-modal/TextSection.tsx +9 -6
- package/src/components/order-view/flags-action-modal/index.tsx +54 -67
- package/src/components/order-view/general-information/dropdowns/Print.tsx +136 -70
- package/src/components/order-view/generic-table/AuditLogs.tsx +5 -4
- package/src/components/order-view/index.tsx +9 -42
- package/src/components/order-view/modalsPopup/CreateReturnModal.tsx +20 -18
- package/src/components/order-view/modalsPopup/ModalManager.tsx +4 -10
- package/src/components/order-view/notes/logs/index.tsx +1 -1
- package/src/components/order-view/notes/order-dropdown/NewReturnDropdown.tsx +5 -7
- package/src/components/order-view/notification/FlagTemplate.tsx +8 -8
- package/src/components/order-view/notification/OrderTemplate.tsx +169 -175
- package/src/components/order-view/notification/ReminderTemplate.tsx +23 -14
- package/src/components/order-view/notification/Tabs.tsx +15 -14
- package/src/components/order-view/notification/index.tsx +164 -92
- package/src/components/order-view/order-actions/actions/add-resources/index.tsx +19 -29
- package/src/components/order-view/order-actions/actions/cancel-order/CancelOrderTable.tsx +345 -0
- package/src/components/order-view/order-actions/actions/cancel-order/index.tsx +146 -71
- package/src/components/order-view/order-actions/actions/change-customer-account/ChangeCustomerAccModal.tsx +95 -32
- package/src/components/order-view/order-actions/actions/charge-log/index.tsx +395 -0
- package/src/components/order-view/order-actions/actions/clear-booking-status/ClearBookingStatus.tsx +1 -1
- package/src/components/order-view/order-actions/actions/confirm-order/customer-info/ActionDropdown.tsx +34 -17
- package/src/components/order-view/order-actions/actions/confirm-order/customer-info/ContactMobile.tsx +2 -3
- package/src/components/order-view/order-actions/actions/confirm-order/customer-info/ContactPhone.tsx +2 -3
- package/src/components/order-view/order-actions/actions/confirm-order/customer-info/ContactWork.tsx +2 -3
- package/src/components/order-view/order-actions/actions/confirm-order/customer-info/DeliveryDate.tsx +39 -25
- package/src/components/order-view/order-actions/actions/confirm-order/customer-info/EmailAddress.tsx +1 -1
- package/src/components/order-view/order-actions/actions/confirm-order/customer-info/TimedServiceDropdown.tsx +4 -2
- package/src/components/order-view/order-actions/actions/confirm-order/customer-info/index.tsx +1 -1
- package/src/components/order-view/order-actions/actions/confirm-order/index.tsx +254 -66
- package/src/components/order-view/order-actions/actions/confirm-order/slot-and-instructions/index.tsx +1 -1
- package/src/components/order-view/order-actions/actions/confirm-order/tables/NotesTable.tsx +13 -9
- package/src/components/order-view/order-actions/actions/confirm-order/tables/ProductTable.tsx +1 -1
- package/src/components/order-view/order-actions/actions/create-task-reminder/CreateReminderModal.tsx +213 -117
- package/src/components/order-view/order-actions/actions/create-task-reminder/CreateTaskModal.tsx +97 -152
- package/src/components/order-view/order-actions/actions/create-task-reminder/TaskModal.tsx +30 -87
- package/src/components/order-view/order-actions/actions/create-task-reminder/index.tsx +77 -83
- package/src/components/order-view/order-actions/actions/hold-order/HoldOrderModal.tsx +57 -65
- package/src/components/order-view/order-actions/actions/log-service-refusal/DeliveryPoint.tsx +10 -16
- package/src/components/order-view/order-actions/actions/log-service-refusal/Notes.tsx +21 -4
- package/src/components/order-view/order-actions/actions/log-service-refusal/OrderServices.tsx +39 -11
- package/src/components/order-view/order-actions/actions/log-service-refusal/index.tsx +79 -8
- package/src/components/order-view/order-actions/actions/send-email/SendEmailModal.tsx +114 -17
- package/src/components/order-view/order-actions/actions/send-sms/SendSmsModal.tsx +115 -7
- package/src/components/order-view/order-actions/actions/split-order/index.tsx +14 -4
- package/src/components/order-view/order-actions/actions/uncancel-order/UncancelOrder.tsx +176 -87
- package/src/components/order-view/order-actions/actions/uncancel-order/UncancelOrderTable.tsx +352 -0
- package/src/components/order-view/order-actions/actions/unhold-order/UnholdOrder.tsx +35 -59
- package/src/components/order-view/order-actions/index.tsx +237 -22
- package/src/components/order-view/order-actions/store.ts +50 -48
- package/src/components/order-view/order-actions/types.ts +40 -65
- package/src/components/order-view/order-actions/utils.ts +15 -8
- package/src/components/order-view/order-details/expanded-content/customer-section/contact-info/ContactEmail.tsx +2 -1
- package/src/components/order-view/order-details/expanded-content/footer/index.tsx +80 -39
- package/src/components/order-view/order-details/expanded-content/orders-section/Carrier.tsx +10 -14
- package/src/components/order-view/order-details/expanded-content/orders-section/DeliveryDate.tsx +10 -1
- package/src/components/order-view/order-details/expanded-content/orders-section/ScheduleAfter.tsx +2 -1
- package/src/components/order-view/products-info/expanded-content/index.tsx +3 -2
- package/src/components/order-view/products-info/index.tsx +14 -11
- package/src/components/order-view/return-client-products/product-table/ReturnProductTable.tsx +26 -24
- package/src/components/order-view/store.ts +59 -2
- package/src/components/order-view/system-event-logs/columns/Date.tsx +4 -2
- package/src/components/order-view/system-event-logs/columns/Event.tsx +9 -9
- package/src/components/order-view/system-event-logs/columns/Note.tsx +1 -1
- package/src/components/order-view/system-event-logs/expanded-content/index.tsx +25 -25
- package/src/components/order-view/types.ts +13 -0
- package/src/components/order-view/utils.ts +4 -0
- package/src/components/order-view/view-reminder/AssigneeDropdown.tsx +183 -12
- package/src/components/order-view/view-reminder/ViewReminder.tsx +234 -143
- package/src/components/order-view/view-reminder/reminder-styles.tsx +14 -8
- package/src/components/store.ts +6 -0
- package/src/index.tsx +28 -18
package/src/components/order-view/order-actions/actions/confirm-order/customer-info/DeliveryDate.tsx
CHANGED
|
@@ -1,48 +1,63 @@
|
|
|
1
1
|
import { DatePicker } from 'antd';
|
|
2
2
|
import React, { useEffect } from 'react';
|
|
3
3
|
import styled from 'styled-components';
|
|
4
|
-
import dayjs from 'dayjs';
|
|
5
4
|
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
} from '
|
|
9
|
-
import {
|
|
5
|
+
useNotificationConfirmedDate,
|
|
6
|
+
useOrderDetails,
|
|
7
|
+
} from '../../../../store';
|
|
8
|
+
import dayjs, { Dayjs } from 'dayjs';
|
|
9
|
+
import { isValid } from 'date-fns';
|
|
10
10
|
|
|
11
11
|
function DeliveryDate() {
|
|
12
|
-
const [
|
|
13
|
-
const [
|
|
12
|
+
const [dateOrderDetails] = useOrderDetails();
|
|
13
|
+
const [confirmedDate, setConfirmedDate] = useNotificationConfirmedDate();
|
|
14
14
|
|
|
15
|
-
const actionDate =
|
|
16
|
-
? dayjs(
|
|
15
|
+
const actionDate = dateOrderDetails?.action_date
|
|
16
|
+
? dayjs(dateOrderDetails.action_date).format('YYYY-MM-DD')
|
|
17
17
|
: null;
|
|
18
18
|
|
|
19
19
|
useEffect(() => {
|
|
20
20
|
if (actionDate) {
|
|
21
|
-
|
|
21
|
+
setConfirmedDate(_prev => ({
|
|
22
|
+
previousDate: actionDate,
|
|
23
|
+
currentDate: actionDate,
|
|
24
|
+
}));
|
|
22
25
|
} else {
|
|
23
|
-
|
|
26
|
+
setConfirmedDate({
|
|
27
|
+
previousDate: null,
|
|
28
|
+
currentDate: null,
|
|
29
|
+
});
|
|
24
30
|
}
|
|
25
|
-
}, [
|
|
31
|
+
}, [actionDate, setConfirmedDate]);
|
|
26
32
|
|
|
27
|
-
const handleDateChange = (date:
|
|
28
|
-
if (date && isValid(date
|
|
29
|
-
const formattedDate =
|
|
30
|
-
|
|
33
|
+
const handleDateChange = (date: Dayjs | null) => {
|
|
34
|
+
if (date && isValid(date.toDate())) {
|
|
35
|
+
const formattedDate = dayjs(date).format('YYYY-MM-DD');
|
|
36
|
+
|
|
37
|
+
setConfirmedDate(prev => ({
|
|
38
|
+
previousDate: prev?.currentDate || null,
|
|
39
|
+
currentDate: formattedDate,
|
|
40
|
+
}));
|
|
31
41
|
}
|
|
32
42
|
};
|
|
33
|
-
|
|
34
|
-
const tomorrow = new Date(today);
|
|
35
|
-
tomorrow.setDate(today.getDate() + 1);
|
|
36
|
-
//confirm popouop
|
|
43
|
+
|
|
37
44
|
return (
|
|
38
45
|
<Container>
|
|
39
46
|
<Label>Delivery Date</Label>
|
|
40
47
|
<DatePicker
|
|
41
48
|
onChange={handleDateChange}
|
|
42
|
-
format="DD
|
|
43
|
-
value={
|
|
44
|
-
|
|
45
|
-
|
|
49
|
+
format="YYYY-MM-DD"
|
|
50
|
+
value={
|
|
51
|
+
confirmedDate?.currentDate
|
|
52
|
+
? dayjs(confirmedDate.currentDate)
|
|
53
|
+
: actionDate
|
|
54
|
+
? dayjs(actionDate)
|
|
55
|
+
: null
|
|
56
|
+
}
|
|
57
|
+
style={{ borderRadius: '15px', minWidth: '60px' }}
|
|
58
|
+
disabledDate={current =>
|
|
59
|
+
current && current.isBefore(dayjs().startOf('day'))
|
|
60
|
+
}
|
|
46
61
|
allowClear={false}
|
|
47
62
|
/>
|
|
48
63
|
</Container>
|
|
@@ -53,7 +68,6 @@ const Label = styled.label`
|
|
|
53
68
|
color: #6a7378;
|
|
54
69
|
font-family: 'Lato', sans-serif;
|
|
55
70
|
font-size: 14px;
|
|
56
|
-
font-style: normal;
|
|
57
71
|
font-weight: 500;
|
|
58
72
|
`;
|
|
59
73
|
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import OrderActionsDropdown from '../../../Dropdown';
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
useOrderDetailsConfirmOrder,
|
|
5
|
+
useOrderStaticData,
|
|
6
|
+
} from '../../../../store';
|
|
4
7
|
import { capitalize } from '../../../../utils';
|
|
5
|
-
import { useOrderDetailsConfirmOrder } from '../../../store';
|
|
6
8
|
|
|
7
9
|
function convertTo12HourFormat(time24: any) {
|
|
8
10
|
const [hours, minutes] = time24?.split(':')?.map(Number);
|
package/src/components/order-view/order-actions/actions/confirm-order/customer-info/index.tsx
CHANGED
|
@@ -8,7 +8,7 @@ import ContactTypeDropdown from './ContactTypeDropdown';
|
|
|
8
8
|
import ActionDropdown from './ActionDropdown';
|
|
9
9
|
import DeliveryDate from './DeliveryDate';
|
|
10
10
|
import TimedServiceDropdown from './TimedServiceDropdown';
|
|
11
|
-
import { useOrderDetailsConfirmOrder } from '
|
|
11
|
+
import { useOrderDetailsConfirmOrder } from '../../../../store';
|
|
12
12
|
|
|
13
13
|
function CustomerInformation() {
|
|
14
14
|
const [orderDetails] = useOrderDetailsConfirmOrder();
|
|
@@ -5,25 +5,26 @@ import CustomerInformation from './customer-info';
|
|
|
5
5
|
import ProductTable from './tables/ProductTable';
|
|
6
6
|
import NotesTable from './tables/NotesTable';
|
|
7
7
|
import SlotAndInstructions from './slot-and-instructions';
|
|
8
|
-
import {
|
|
8
|
+
import { Alert, useAxios } from '@bjsdistribution/dms-component-library';
|
|
9
|
+
import { notification } from 'antd';
|
|
9
10
|
import {
|
|
10
11
|
useCurrentAction,
|
|
11
12
|
useCustomerInfo,
|
|
13
|
+
useErrorConfirmOrder,
|
|
12
14
|
useGlobalStateHitOrder,
|
|
13
|
-
|
|
15
|
+
useNotificationConfirmedDate,
|
|
14
16
|
useOrderDetails,
|
|
17
|
+
useOrderDetailsConfirmOrder,
|
|
15
18
|
useOrderId,
|
|
16
19
|
usePrevOrderDetails,
|
|
20
|
+
useSelectionAction,
|
|
21
|
+
useStatusDetails,
|
|
17
22
|
} from '../../../store';
|
|
18
|
-
|
|
19
|
-
useConfirmOrderDate,
|
|
20
|
-
useErrorConfirmOrder,
|
|
21
|
-
useOrderDetailsConfirmOrder,
|
|
22
|
-
} from '../../store';
|
|
23
|
+
|
|
23
24
|
import { ApiResponse } from '../../../types';
|
|
24
|
-
import { notification } from 'antd';
|
|
25
25
|
import { compareOrderDetailsStates, filterObject } from '../../../utils';
|
|
26
26
|
import { format } from 'date-fns';
|
|
27
|
+
import { useConfirmOrderDate } from '../../store';
|
|
27
28
|
|
|
28
29
|
function ConfirmOrder() {
|
|
29
30
|
const [, setCurrentAction] = useCurrentAction();
|
|
@@ -36,17 +37,19 @@ function ConfirmOrder() {
|
|
|
36
37
|
const [customerInfo] = useCustomerInfo();
|
|
37
38
|
const infoText = `${customerInfo?.recipient_name}, ${customerInfo?.postcode}`;
|
|
38
39
|
const [deliveryDate, setDeliveryDate] = useConfirmOrderDate();
|
|
39
|
-
const [, setRecalling] = useLiveRecalling();
|
|
40
40
|
const [orderId] = useOrderId();
|
|
41
41
|
const [errorState] = useErrorConfirmOrder();
|
|
42
|
-
// const updateOrder = useUpdateOrder();
|
|
43
42
|
const [, setRecallOrders] = useGlobalStateHitOrder();
|
|
43
|
+
const [confirmedDate] = useNotificationConfirmedDate();
|
|
44
|
+
const [selectedAction] = useSelectionAction();
|
|
45
|
+
const [, setOrderStatus] = useStatusDetails();
|
|
44
46
|
|
|
45
|
-
const
|
|
46
|
-
|
|
47
|
-
|
|
47
|
+
const contactHome = orderDetailsConfirmOrder?.order_recipient?.contact_home;
|
|
48
|
+
const contactMobile =
|
|
49
|
+
orderDetailsConfirmOrder?.order_recipient?.contact_mobile;
|
|
50
|
+
const contactWork = orderDetailsConfirmOrder?.order_recipient?.contact_work;
|
|
48
51
|
|
|
49
|
-
//update Order API
|
|
52
|
+
// update Order API
|
|
50
53
|
const { fetchData: callUpdateOrderAPI } = useAxios<{
|
|
51
54
|
data: ApiResponse[];
|
|
52
55
|
}>({
|
|
@@ -54,61 +57,199 @@ function ConfirmOrder() {
|
|
|
54
57
|
method: 'PUT',
|
|
55
58
|
});
|
|
56
59
|
|
|
60
|
+
// send notifications
|
|
61
|
+
const { fetchData: notificationCall } = useAxios<{
|
|
62
|
+
data: ApiResponse[];
|
|
63
|
+
}>({
|
|
64
|
+
endpoint: `orders/${orderId}/send-comms/?notification_type={Confirm - Accepted} `,
|
|
65
|
+
method: 'POST',
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
const { fetchData: declineDate } = useAxios<{
|
|
69
|
+
data: ApiResponse[];
|
|
70
|
+
}>({
|
|
71
|
+
endpoint: `orders/${orderId}/decline-date/?date=${confirmedDate?.previousDate}`,
|
|
72
|
+
method: 'POST',
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
const { fetchData: confirmDeliveryDate } = useAxios<{
|
|
76
|
+
data: ApiResponse[];
|
|
77
|
+
}>({
|
|
78
|
+
endpoint: `orders/${orderId}/confirm-date/?date=${confirmedDate?.currentDate}`,
|
|
79
|
+
method: 'POST',
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
const { fetchData: sendComs } = useAxios<{
|
|
83
|
+
data: ApiResponse[];
|
|
84
|
+
}>({
|
|
85
|
+
endpoint: `orders/${orderId}/send-comms/?notification_type=Precall`,
|
|
86
|
+
method: 'POST',
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
const { fetchData: noResponseApi } = useAxios<{
|
|
90
|
+
data: ApiResponse[];
|
|
91
|
+
}>({
|
|
92
|
+
endpoint: `orders/${orderId}/no-response-date/?date=${confirmedDate?.currentDate}`,
|
|
93
|
+
method: 'POST',
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
const { fetchData: proposeDate } = useAxios<{
|
|
97
|
+
data: ApiResponse[];
|
|
98
|
+
}>({
|
|
99
|
+
endpoint: `orders/${orderId}/propose-date/?date=${confirmedDate?.currentDate}`,
|
|
100
|
+
method: 'POST',
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
//Order status api
|
|
104
|
+
const {
|
|
105
|
+
fetchData: fetchStatusData,
|
|
106
|
+
data: statusData,
|
|
107
|
+
loading: statusDataLoading,
|
|
108
|
+
} = useAxios<{
|
|
109
|
+
data: ApiResponse[];
|
|
110
|
+
}>({
|
|
111
|
+
endpoint: `/orders/get_live_status/${orderId}`,
|
|
112
|
+
method: 'GET',
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
const onClose = () => {
|
|
116
|
+
setCurrentAction(undefined);
|
|
117
|
+
};
|
|
118
|
+
|
|
57
119
|
useEffect(() => {
|
|
58
120
|
const clone = JSON.parse(JSON.stringify(orderDetails));
|
|
59
121
|
setOrderDetailsConfirmOrder(clone);
|
|
60
|
-
|
|
61
122
|
return () => {
|
|
62
123
|
setOrderDetailsConfirmOrder(clone);
|
|
63
124
|
};
|
|
64
125
|
}, []);
|
|
65
126
|
|
|
66
|
-
const {
|
|
67
|
-
loading: loadingForConfirm,
|
|
68
|
-
data: response,
|
|
69
|
-
setShouldPerformAction: setPerformAction,
|
|
70
|
-
} = useApiHook<{
|
|
71
|
-
data: ApiResponse[];
|
|
72
|
-
}>({
|
|
73
|
-
endpoint: `orders/${orderId}/confirm-date/?date=${deliveryDate}`,
|
|
74
|
-
method: 'POST',
|
|
75
|
-
performAction: false,
|
|
76
|
-
});
|
|
77
|
-
|
|
78
127
|
useEffect(() => {
|
|
79
|
-
if (
|
|
80
|
-
|
|
81
|
-
if (response?.data && response?.code === 200) {
|
|
82
|
-
notification.success({
|
|
83
|
-
message: 'Success',
|
|
84
|
-
// @ts-ignore
|
|
85
|
-
description: response?.message || 'Order confirmed successfully',
|
|
86
|
-
});
|
|
87
|
-
setRecalling(true);
|
|
88
|
-
setTimeout(() => {
|
|
89
|
-
setRecalling(false);
|
|
90
|
-
}, 2000);
|
|
91
|
-
} else {
|
|
92
|
-
notification.error({
|
|
93
|
-
message: 'Error',
|
|
94
|
-
description:
|
|
95
|
-
//@ts-ignore
|
|
96
|
-
response?.error_traceback ||
|
|
97
|
-
'An error has occurred. Please try again later.',
|
|
98
|
-
});
|
|
99
|
-
setCurrentAction(undefined);
|
|
100
|
-
}
|
|
128
|
+
if (statusData && statusData?.data) {
|
|
129
|
+
setOrderStatus(statusData?.data);
|
|
101
130
|
}
|
|
102
|
-
}, [
|
|
131
|
+
}, [statusDataLoading]);
|
|
132
|
+
|
|
133
|
+
// THIS HAS BEEN REMOVED AS WE HAVE NEW APIS
|
|
134
|
+
// const {
|
|
135
|
+
// loading: loadingForConfirm,
|
|
136
|
+
// data: response,
|
|
137
|
+
// setShouldPerformAction: setPerformAction,
|
|
138
|
+
// } = useApiHook<{
|
|
139
|
+
// data: ApiResponse[];
|
|
140
|
+
// }>({
|
|
141
|
+
// endpoint: `orders/${orderId}/confirm-date/?date=${deliveryDate}`,
|
|
142
|
+
// method: 'POST',
|
|
143
|
+
// performAction: false,
|
|
144
|
+
// });
|
|
103
145
|
|
|
104
146
|
function hasOnlyIdKey(obj: any) {
|
|
105
147
|
return Object.keys(obj).length === 1 && obj.hasOwnProperty('id');
|
|
106
148
|
}
|
|
107
149
|
|
|
108
|
-
const
|
|
109
|
-
|
|
150
|
+
const executeActions = async () => {
|
|
151
|
+
switch (selectedAction) {
|
|
152
|
+
case 'decline_and_propose_new_date':
|
|
153
|
+
// call propose date api
|
|
154
|
+
if (confirmedDate?.previousDate !== null) {
|
|
155
|
+
await declineDate();
|
|
156
|
+
}
|
|
157
|
+
await proposeDate();
|
|
158
|
+
await fetchStatusData();
|
|
159
|
+
break;
|
|
160
|
+
|
|
161
|
+
case 'decline_and_confirm_new_date':
|
|
162
|
+
if (confirmedDate?.previousDate !== null) {
|
|
163
|
+
await declineDate();
|
|
164
|
+
}
|
|
165
|
+
await confirmDeliveryDate();
|
|
166
|
+
await fetchStatusData();
|
|
167
|
+
break;
|
|
168
|
+
|
|
169
|
+
case 'declined_proposed_date(outstanding)':
|
|
170
|
+
if (confirmedDate?.previousDate !== null) {
|
|
171
|
+
await declineDate();
|
|
172
|
+
}
|
|
173
|
+
await fetchStatusData();
|
|
174
|
+
break;
|
|
175
|
+
|
|
176
|
+
case 'no_response_propose_new_date':
|
|
177
|
+
if (confirmedDate?.previousDate !== null) {
|
|
178
|
+
await declineDate();
|
|
179
|
+
}
|
|
180
|
+
await noResponseApi();
|
|
181
|
+
await fetchStatusData();
|
|
182
|
+
break;
|
|
183
|
+
|
|
184
|
+
case 'confirmed':
|
|
185
|
+
if (confirmedDate?.previousDate !== null) {
|
|
186
|
+
await declineDate();
|
|
187
|
+
}
|
|
188
|
+
await confirmDeliveryDate();
|
|
189
|
+
await fetchStatusData();
|
|
190
|
+
break;
|
|
191
|
+
|
|
192
|
+
default:
|
|
193
|
+
break;
|
|
194
|
+
}
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
const executeSendComs = async () => {
|
|
198
|
+
switch (selectedAction) {
|
|
199
|
+
case 'left_message':
|
|
200
|
+
case 'contact_made':
|
|
201
|
+
case 'no_contact':
|
|
202
|
+
// await confirmDeliveryDate();
|
|
203
|
+
notificationCall();
|
|
204
|
+
break;
|
|
205
|
+
|
|
206
|
+
case 'precall':
|
|
207
|
+
if (confirmedDate?.previousDate !== null) {
|
|
208
|
+
await declineDate();
|
|
209
|
+
}
|
|
210
|
+
// await confirmDeliveryDate();
|
|
211
|
+
sendComs();
|
|
212
|
+
break;
|
|
213
|
+
default:
|
|
214
|
+
break;
|
|
215
|
+
}
|
|
216
|
+
};
|
|
217
|
+
|
|
218
|
+
const confirmOrder = async () => {
|
|
110
219
|
setRecallOrders(false);
|
|
111
220
|
|
|
221
|
+
if (
|
|
222
|
+
selectedAction === 'left_message' ||
|
|
223
|
+
selectedAction === 'contact_made' ||
|
|
224
|
+
selectedAction === 'no_contact' ||
|
|
225
|
+
selectedAction === 'precall'
|
|
226
|
+
) {
|
|
227
|
+
if (
|
|
228
|
+
contactHome?.length === 0 &&
|
|
229
|
+
contactMobile?.length === 0 &&
|
|
230
|
+
contactWork?.length === 0
|
|
231
|
+
) {
|
|
232
|
+
notification.info({
|
|
233
|
+
message: 'Info',
|
|
234
|
+
description: 'Please add contact information',
|
|
235
|
+
});
|
|
236
|
+
return;
|
|
237
|
+
}
|
|
238
|
+
if (
|
|
239
|
+
confirmedDate?.previousDate === null &&
|
|
240
|
+
confirmedDate?.currentDate === null
|
|
241
|
+
) {
|
|
242
|
+
notification.info({
|
|
243
|
+
message: 'Info',
|
|
244
|
+
description: 'Please add delivery date',
|
|
245
|
+
});
|
|
246
|
+
return;
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
// Execute actions first
|
|
251
|
+
await executeActions();
|
|
252
|
+
|
|
112
253
|
const keysToRemovefromOrders = [
|
|
113
254
|
'order_locked',
|
|
114
255
|
'order_communications',
|
|
@@ -118,68 +259,115 @@ function ConfirmOrder() {
|
|
|
118
259
|
'order_delivery_declined_dates',
|
|
119
260
|
'order_eta_updates',
|
|
120
261
|
];
|
|
262
|
+
|
|
121
263
|
const filteredOrderDetails = filterObject(
|
|
122
264
|
orderDetailsConfirmOrder,
|
|
123
265
|
keysToRemovefromOrders
|
|
124
266
|
);
|
|
125
|
-
|
|
126
267
|
const filteredPrevOrderDetails = filterObject(
|
|
127
268
|
prevOrderDetails,
|
|
128
269
|
keysToRemovefromOrders
|
|
129
270
|
);
|
|
130
|
-
|
|
131
271
|
const payload = compareOrderDetailsStates(
|
|
132
272
|
filteredPrevOrderDetails,
|
|
133
273
|
filteredOrderDetails
|
|
134
274
|
);
|
|
135
|
-
|
|
136
275
|
const notUpdateOrder = hasOnlyIdKey(payload);
|
|
276
|
+
|
|
137
277
|
if (!notUpdateOrder) {
|
|
138
|
-
|
|
139
|
-
payload
|
|
278
|
+
const updatedPayload = {
|
|
279
|
+
...payload,
|
|
280
|
+
action_date: confirmedDate?.currentDate,
|
|
281
|
+
};
|
|
282
|
+
|
|
283
|
+
const response = (await callUpdateOrderAPI({
|
|
284
|
+
payload: [updatedPayload],
|
|
140
285
|
})) as {
|
|
141
286
|
code: number | null;
|
|
142
287
|
error?: string | null | undefined;
|
|
143
288
|
[key: string]: any;
|
|
144
289
|
};
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
290
|
+
|
|
291
|
+
await executeSendComs();
|
|
292
|
+
|
|
293
|
+
if (response?.data?.length > 0) {
|
|
294
|
+
const updatedOrder = response?.data[0];
|
|
295
|
+
setOrderDetails(updatedOrder);
|
|
296
|
+
setPrevOrderDetails(updatedOrder);
|
|
148
297
|
setRecallOrders(true);
|
|
149
298
|
} else {
|
|
150
299
|
setOrderDetails(prevOrderDetails);
|
|
151
300
|
}
|
|
152
301
|
}
|
|
302
|
+
|
|
153
303
|
if (orderId && deliveryDate) {
|
|
154
|
-
//call order update api then call confirm order if required
|
|
155
304
|
const formattedDate = format(new Date(deliveryDate), 'yyyy-MM-dd');
|
|
156
|
-
|
|
157
305
|
setDeliveryDate(formattedDate);
|
|
158
|
-
setPerformAction(true);
|
|
159
306
|
}
|
|
307
|
+
|
|
308
|
+
setCurrentAction(undefined);
|
|
160
309
|
};
|
|
161
310
|
|
|
311
|
+
// const isDifferent = () => {
|
|
312
|
+
// const keysToRemovefromOrders = [
|
|
313
|
+
// 'order_locked',
|
|
314
|
+
// 'order_communications',
|
|
315
|
+
// 'updated_at',
|
|
316
|
+
// 'updated_by',
|
|
317
|
+
// 'order_services',
|
|
318
|
+
// ];
|
|
319
|
+
// const filteredOrderDetails = filterObject(
|
|
320
|
+
// orderDetailsConfirmOrder,
|
|
321
|
+
// keysToRemovefromOrders
|
|
322
|
+
// );
|
|
323
|
+
// const filteredPrevOrderDetails = filterObject(
|
|
324
|
+
// prevOrderDetails,
|
|
325
|
+
// keysToRemovefromOrders
|
|
326
|
+
// );
|
|
327
|
+
//
|
|
328
|
+
// const orderDetailsSorted = JSON.stringify(filteredOrderDetails);
|
|
329
|
+
// const prevOrderDetailsSorted = JSON.stringify(filteredPrevOrderDetails);
|
|
330
|
+
// const isSame = orderDetailsSorted === prevOrderDetailsSorted;
|
|
331
|
+
//
|
|
332
|
+
// console.log(orderDetailsSorted, 'orderDetailsSorted');
|
|
333
|
+
// console.log(prevOrderDetailsSorted, 'prevOrderDetailsSorted');
|
|
334
|
+
// console.log(isSame, 'isSameisSame');
|
|
335
|
+
//
|
|
336
|
+
// newOrderServicesSorted === prevOrderServicesSorted;
|
|
337
|
+
// return !isSame;
|
|
338
|
+
// };
|
|
339
|
+
|
|
162
340
|
const errorFound = () => {
|
|
163
341
|
const isError =
|
|
164
342
|
errorState.emailError.length > 0 ||
|
|
165
343
|
errorState.homeContactError.length > 0 ||
|
|
166
344
|
errorState.workContactError.length > 0 ||
|
|
167
345
|
errorState.mobileError.length > 0;
|
|
168
|
-
|
|
169
346
|
return isError;
|
|
170
347
|
};
|
|
171
348
|
|
|
349
|
+
const disabledButton = confirmedDate?.currentDate === null;
|
|
350
|
+
|
|
172
351
|
return (
|
|
173
352
|
<OrderActionModal
|
|
174
353
|
headerTitle="Confirm Order"
|
|
354
|
+
minWidth="28vw"
|
|
175
355
|
showAdditionalInfo
|
|
176
356
|
infoText={infoText}
|
|
177
357
|
onCloseHeader={onClose}
|
|
178
|
-
onSubmit={
|
|
358
|
+
onSubmit={confirmOrder}
|
|
179
359
|
submitBtnTitle="Save Details"
|
|
180
|
-
isSubmitDisabled={errorFound()}
|
|
360
|
+
isSubmitDisabled={errorFound() && disabledButton}
|
|
181
361
|
>
|
|
182
362
|
<ContentContainer>
|
|
363
|
+
<Alert
|
|
364
|
+
description=""
|
|
365
|
+
onClose={() => {}}
|
|
366
|
+
type="info"
|
|
367
|
+
title="There is Orders with identical postcodes that are yet to be delivered.View Orders"
|
|
368
|
+
showOkButton={false}
|
|
369
|
+
showCloseIcon={false}
|
|
370
|
+
/>
|
|
183
371
|
<Wrapper>
|
|
184
372
|
<CustomerInformation />
|
|
185
373
|
<SlotAndInstructions />
|
|
@@ -3,7 +3,7 @@ import React from 'react';
|
|
|
3
3
|
import ConfirmationNotes from './ConfirmationNotes';
|
|
4
4
|
import DeliveryInstructions from './DeliveryInstructions';
|
|
5
5
|
import ContactWith from '../customer-info/ContactWith';
|
|
6
|
-
import { useOrderDetailsConfirmOrder } from '
|
|
6
|
+
import { useOrderDetailsConfirmOrder } from '../../../../store';
|
|
7
7
|
|
|
8
8
|
function SlotAndInstructions() {
|
|
9
9
|
const [orderDetails] = useOrderDetailsConfirmOrder();
|
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
formatUtcToLocal,
|
|
3
|
+
useApiHook,
|
|
4
|
+
} from '@bjsdistribution/dms-component-library';
|
|
2
5
|
import React, { useEffect, useState } from 'react';
|
|
3
6
|
import styled from 'styled-components';
|
|
4
7
|
import { useOrderId } from '../../../../store';
|
|
5
|
-
|
|
6
|
-
import { Empty, Skeleton } from 'antd';
|
|
7
|
-
import { format } from 'date-fns';
|
|
8
|
-
import CustomScrollBar from '../../../../../../common/scrollbar';
|
|
9
8
|
import {
|
|
10
9
|
EmptyDataContainer,
|
|
11
10
|
StyledTable,
|
|
12
11
|
StyledTableWrapper,
|
|
13
12
|
} from './ReminderStyles';
|
|
13
|
+
import CustomScrollBar from '../../../../../../common/scrollbar';
|
|
14
|
+
import { Empty, Skeleton } from 'antd';
|
|
14
15
|
|
|
15
16
|
function NotesTable() {
|
|
16
17
|
const [moduleIds, setModuleIds] = useState<{
|
|
@@ -30,8 +31,8 @@ function NotesTable() {
|
|
|
30
31
|
useEffect(() => {
|
|
31
32
|
if (!apiLoading && fetchedData?.data) {
|
|
32
33
|
const modules = fetchedData?.data
|
|
33
|
-
|
|
34
|
-
|
|
34
|
+
?.filter((item: any) => item?.name === 'ORDER')
|
|
35
|
+
?.map((item: any) => {
|
|
35
36
|
const orderProductId = item?.static_child_mappings.find(
|
|
36
37
|
(i: any) => i?.child_module?.name === 'ORDER-PRODUCT'
|
|
37
38
|
)?.child_module?.id;
|
|
@@ -114,10 +115,13 @@ function NotesTable() {
|
|
|
114
115
|
{order?.created_by}
|
|
115
116
|
</div>
|
|
116
117
|
<div>
|
|
117
|
-
{format(
|
|
118
|
+
{/* {format(
|
|
118
119
|
new Date(order?.created_at),
|
|
119
120
|
"dd/MM/yyyy '@' HH:mm"
|
|
120
|
-
)}
|
|
121
|
+
)} */}
|
|
122
|
+
{`${formatUtcToLocal(order?.created_at).date} @ ${
|
|
123
|
+
formatUtcToLocal(order?.created_at).time
|
|
124
|
+
}`}
|
|
121
125
|
</div>
|
|
122
126
|
</td>
|
|
123
127
|
<td
|
package/src/components/order-view/order-actions/actions/confirm-order/tables/ProductTable.tsx
CHANGED
|
@@ -50,7 +50,7 @@ function ProductTable() {
|
|
|
50
50
|
) : (
|
|
51
51
|
orderProductDetails?.map((order: any) => (
|
|
52
52
|
<tr key={order.id}>
|
|
53
|
-
<td>{order?.order_product_type?.type}</td>
|
|
53
|
+
<td>{order?.order_product_type?.type}</td>{' '}
|
|
54
54
|
<td>{order?.code}</td>
|
|
55
55
|
<td>{order?.description}</td>
|
|
56
56
|
<td>{order?.sku}</td>
|