@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
|
@@ -8,24 +8,26 @@ import {
|
|
|
8
8
|
usePrevOrderDetails,
|
|
9
9
|
errorAtom,
|
|
10
10
|
useCustomerInfo,
|
|
11
|
-
useUpdateApiCall,
|
|
12
|
-
useLiveRecalling,
|
|
13
11
|
useGlobalStateHitAuditLog,
|
|
12
|
+
useOrderStaticData,
|
|
14
13
|
useGlobalStateHitOrder,
|
|
15
14
|
} from '../../../store';
|
|
15
|
+
// import useUpdateOrder from '../../../hooks/useUpdateOrder';
|
|
16
16
|
import { compareOrderDetailsStates, filterObject } from '../../../utils';
|
|
17
17
|
import { ApiResponse, OrderServiceType } from '../../../types';
|
|
18
18
|
import { notification } from 'antd';
|
|
19
|
+
import { useClientPortal } from '../../../../store';
|
|
19
20
|
|
|
20
21
|
function OrderDetailsFooter() {
|
|
21
22
|
const [orderDetails, setOrderDetails] = useOrderDetails();
|
|
22
23
|
const [prevOrderDetails, setPrevOrderDetails] = usePrevOrderDetails();
|
|
23
24
|
const [, setCustomerInfo] = useCustomerInfo();
|
|
25
|
+
// const updateOrder = useUpdateOrder();
|
|
24
26
|
const [errorState] = useAtom(errorAtom);
|
|
25
|
-
const [, setCallApi] = useUpdateApiCall(); //single detail
|
|
26
|
-
const [, setRecalling] = useLiveRecalling();
|
|
27
27
|
const [, setRecallAuditLog] = useGlobalStateHitAuditLog();
|
|
28
|
+
const [orderStaticData] = useOrderStaticData();
|
|
28
29
|
const [, setRecallOrders] = useGlobalStateHitOrder();
|
|
30
|
+
const [isClientPortal] = useClientPortal();
|
|
29
31
|
|
|
30
32
|
//update order
|
|
31
33
|
const { fetchData: callUpdateOrderAPI } = useAxios<{
|
|
@@ -37,12 +39,12 @@ function OrderDetailsFooter() {
|
|
|
37
39
|
|
|
38
40
|
const errorFound = () => {
|
|
39
41
|
const isError =
|
|
40
|
-
errorState
|
|
41
|
-
errorState
|
|
42
|
-
errorState
|
|
43
|
-
errorState
|
|
44
|
-
errorState
|
|
45
|
-
errorState
|
|
42
|
+
errorState.w3wError.length > 0 ||
|
|
43
|
+
errorState.emailError.length > 0 ||
|
|
44
|
+
errorState.homeContactError.length > 0 ||
|
|
45
|
+
errorState.workCOntanctError.length > 0 ||
|
|
46
|
+
errorState.mobileError.length > 0 ||
|
|
47
|
+
errorState.postCodeError.length > 0;
|
|
46
48
|
|
|
47
49
|
return isError;
|
|
48
50
|
};
|
|
@@ -66,13 +68,13 @@ function OrderDetailsFooter() {
|
|
|
66
68
|
|
|
67
69
|
const newOrderServices =
|
|
68
70
|
orderDetails?.order_services?.length > 0 &&
|
|
69
|
-
orderDetails
|
|
71
|
+
orderDetails?.order_services?.sort(
|
|
70
72
|
(a: OrderServiceType, b: OrderServiceType) => a.id! - b.id!
|
|
71
73
|
);
|
|
72
74
|
|
|
73
75
|
const prevOrderServices =
|
|
74
76
|
prevOrderDetails?.order_services?.length > 0 &&
|
|
75
|
-
prevOrderDetails
|
|
77
|
+
prevOrderDetails?.order_services.sort(
|
|
76
78
|
(a: OrderServiceType, b: OrderServiceType) => a.id! - b.id!
|
|
77
79
|
);
|
|
78
80
|
|
|
@@ -90,42 +92,81 @@ function OrderDetailsFooter() {
|
|
|
90
92
|
setRecallAuditLog(false);
|
|
91
93
|
setRecallOrders(false);
|
|
92
94
|
const payload = compareOrderDetailsStates(prevOrderDetails, orderDetails);
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
95
|
+
const clone = [...orderDetails?.order_services];
|
|
96
|
+
|
|
97
|
+
// ASSEMBLE AND DISASSEMBLE SERVICES CHECK FOR ASSEMBLE TYPE
|
|
98
|
+
const assembleOrderService = orderStaticData?.order_service_list?.find(
|
|
99
|
+
(x: any) => x?.type?.toLowerCase() === 'assemble'
|
|
100
|
+
);
|
|
101
|
+
const disassembleOrderService = orderStaticData?.order_service_list?.find(
|
|
102
|
+
(x: any) => x?.type?.toLowerCase() === 'disassemble'
|
|
103
|
+
);
|
|
104
|
+
|
|
105
|
+
const assemblyTypeService = clone?.find(
|
|
106
|
+
(x: any) => x?.order_service_list_id === assembleOrderService?.id
|
|
107
|
+
);
|
|
108
|
+
|
|
109
|
+
const disassemblyTypeService = clone?.find(
|
|
110
|
+
(x: any) => x?.order_service_list_id === disassembleOrderService?.id
|
|
111
|
+
);
|
|
112
|
+
|
|
113
|
+
if (
|
|
114
|
+
assemblyTypeService !== undefined &&
|
|
115
|
+
assemblyTypeService?.is_deleted === false &&
|
|
116
|
+
(assemblyTypeService?.service_category_id === undefined ||
|
|
117
|
+
assemblyTypeService?.service_category_id === null)
|
|
118
|
+
) {
|
|
119
|
+
notification.info({
|
|
120
|
+
message: 'Info',
|
|
121
|
+
description: 'Assembly Type is required',
|
|
107
122
|
});
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
123
|
+
return;
|
|
124
|
+
} else if (
|
|
125
|
+
disassemblyTypeService !== undefined &&
|
|
126
|
+
disassemblyTypeService?.is_deleted === false &&
|
|
127
|
+
(disassemblyTypeService?.service_category_id === undefined ||
|
|
128
|
+
disassemblyTypeService?.service_category_id === null)
|
|
129
|
+
) {
|
|
130
|
+
notification.info({
|
|
131
|
+
message: 'Info',
|
|
132
|
+
description: 'Assembly Type is required',
|
|
113
133
|
});
|
|
114
|
-
|
|
115
|
-
setTimeout(() => {
|
|
116
|
-
setRecalling(false);
|
|
117
|
-
setRecallAuditLog(false);
|
|
118
|
-
}, 1000);
|
|
119
|
-
setCallApi(true);
|
|
134
|
+
return;
|
|
120
135
|
} else {
|
|
121
|
-
|
|
136
|
+
let response = (await callUpdateOrderAPI({
|
|
137
|
+
payload: [payload],
|
|
138
|
+
})) as {
|
|
139
|
+
code: number | null;
|
|
140
|
+
error?: string | null | undefined;
|
|
141
|
+
[key: string]: any;
|
|
142
|
+
};
|
|
143
|
+
// const response = await updateOrder([payload]);
|
|
144
|
+
setRecallOrders(true);
|
|
145
|
+
if (response.code == 200 && response?.data?.length > 0) {
|
|
146
|
+
notification.success({
|
|
147
|
+
message: 'Success',
|
|
148
|
+
description: `${response?.message}`,
|
|
149
|
+
});
|
|
150
|
+
setOrderDetails(response?.data[0]);
|
|
151
|
+
setPrevOrderDetails(response?.data[0]);
|
|
152
|
+
setCustomerInfo({
|
|
153
|
+
recipient_name: response?.data[0]?.order_recipient?.recipient_name,
|
|
154
|
+
postcode: response?.data[0]?.order_recipient?.postcode,
|
|
155
|
+
});
|
|
156
|
+
setRecallAuditLog(true);
|
|
157
|
+
} else {
|
|
158
|
+
setOrderDetails(prevOrderDetails);
|
|
159
|
+
}
|
|
122
160
|
}
|
|
123
161
|
};
|
|
124
162
|
|
|
125
163
|
return (
|
|
126
164
|
<Container>
|
|
127
165
|
<AllowTracking />
|
|
128
|
-
<Button
|
|
166
|
+
<Button
|
|
167
|
+
onClick={onSave}
|
|
168
|
+
disabled={isClientPortal ? true : !isDifferent() || errorFound()}
|
|
169
|
+
>
|
|
129
170
|
Save Details
|
|
130
171
|
</Button>
|
|
131
172
|
</Container>
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { Label, SelectDropdown } from '@bjsdistribution/dms-component-library';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import styled from 'styled-components';
|
|
4
|
-
import { useOrderDetails } from '../../../store';
|
|
4
|
+
import { useOrderDetails, useStatusDetails } from '../../../store';
|
|
5
5
|
import { useSubContracterData } from '../../../../store';
|
|
6
6
|
|
|
7
7
|
function Carrier() {
|
|
8
8
|
const [orderDetails, setOrderDetails] = useOrderDetails();
|
|
9
9
|
const [subContracterData] = useSubContracterData();
|
|
10
|
+
const [orderStatus] = useStatusDetails();
|
|
10
11
|
|
|
11
12
|
const carrierOptions = subContracterData?.map((carrier: any) => ({
|
|
12
13
|
label: carrier.name,
|
|
@@ -16,15 +17,13 @@ function Carrier() {
|
|
|
16
17
|
const onChange = (selectedOption: any) => {
|
|
17
18
|
setOrderDetails(prev => ({
|
|
18
19
|
...prev,
|
|
19
|
-
carrier_id: selectedOption
|
|
20
|
+
carrier_id: selectedOption.value,
|
|
20
21
|
}));
|
|
21
22
|
};
|
|
22
23
|
|
|
23
24
|
return (
|
|
24
|
-
<
|
|
25
|
-
<
|
|
26
|
-
<Label label="Carrier" htmlFor="carrier" />
|
|
27
|
-
</Wrapper>
|
|
25
|
+
<FormContainer>
|
|
26
|
+
<Label label="Carrier" htmlFor="CarrierDropdown" />
|
|
28
27
|
<SelectDropdown
|
|
29
28
|
placeholder="Select Carrier"
|
|
30
29
|
inputId="CarrierDropdown"
|
|
@@ -36,18 +35,15 @@ function Carrier() {
|
|
|
36
35
|
}
|
|
37
36
|
options={carrierOptions}
|
|
38
37
|
onChange={onChange}
|
|
38
|
+
isDisabled={
|
|
39
|
+
orderStatus?.length > 0 && orderStatus[0]?.confirmed === true
|
|
40
|
+
}
|
|
39
41
|
/>
|
|
40
|
-
</
|
|
42
|
+
</FormContainer>
|
|
41
43
|
);
|
|
42
44
|
}
|
|
43
45
|
|
|
44
|
-
const
|
|
45
|
-
display: flex;
|
|
46
|
-
align-items: center;
|
|
47
|
-
gap: 5px;
|
|
48
|
-
`;
|
|
49
|
-
|
|
50
|
-
const Container = styled.div`
|
|
46
|
+
const FormContainer = styled.div`
|
|
51
47
|
display: flex;
|
|
52
48
|
flex-direction: column;
|
|
53
49
|
gap: 6px;
|
package/src/components/order-view/order-details/expanded-content/orders-section/DeliveryDate.tsx
CHANGED
|
@@ -8,12 +8,15 @@ import {
|
|
|
8
8
|
useStatusDetails,
|
|
9
9
|
} from '../../../store';
|
|
10
10
|
import dayjs from 'dayjs';
|
|
11
|
+
import { useClientPortal } from '../../../../store';
|
|
11
12
|
|
|
12
13
|
function DeliveryDate() {
|
|
13
14
|
const [orderDetails, setOrderDetails] = useOrderDetails();
|
|
14
15
|
const [prevOrderDetails] = usePrevOrderDetails();
|
|
15
16
|
const [orderStatus] = useStatusDetails();
|
|
17
|
+
const [isClientPortal] = useClientPortal();
|
|
16
18
|
const routedStatus = orderStatus?.[0]?.routed;
|
|
19
|
+
const isOrderOnHold = orderDetails?.status === 'OO';
|
|
17
20
|
|
|
18
21
|
const actionDate = orderDetails?.action_date
|
|
19
22
|
? new Date(orderDetails?.action_date)
|
|
@@ -61,7 +64,13 @@ function DeliveryDate() {
|
|
|
61
64
|
format="DD/MM/YY"
|
|
62
65
|
disabledDate={current => current && current < dayjs().startOf('day')}
|
|
63
66
|
allowClear={false}
|
|
64
|
-
disabled={
|
|
67
|
+
disabled={
|
|
68
|
+
isClientPortal
|
|
69
|
+
? true
|
|
70
|
+
: routedStatus ||
|
|
71
|
+
orderStatus[0]?.confirmed === true ||
|
|
72
|
+
isOrderOnHold
|
|
73
|
+
}
|
|
65
74
|
/>
|
|
66
75
|
</MainContainer>
|
|
67
76
|
);
|
package/src/components/order-view/order-details/expanded-content/orders-section/ScheduleAfter.tsx
CHANGED
|
@@ -9,8 +9,9 @@ function ScheduleAfter() {
|
|
|
9
9
|
const [orderDetails, setOrderDetails] = useOrderDetails();
|
|
10
10
|
const [prevOrderDetails] = usePrevOrderDetails();
|
|
11
11
|
const scheduleDate = orderDetails?.schedule_after
|
|
12
|
-
? new Date(orderDetails
|
|
12
|
+
? new Date(orderDetails?.schedule_after)
|
|
13
13
|
: null;
|
|
14
|
+
|
|
14
15
|
const onChange: DatePickerProps['onChange'] = (date, _dateString) => {
|
|
15
16
|
const selectedDate = date?.format('YYYY-MM-DDTHH:mm:ss');
|
|
16
17
|
if (
|
|
@@ -8,9 +8,10 @@ import { Button, useApiHook } from '@bjsdistribution/dms-component-library';
|
|
|
8
8
|
import { useAtom } from 'jotai';
|
|
9
9
|
import { ApiResponse } from '../../types';
|
|
10
10
|
import { usePostLoading, useSelectedProducts } from '../../../store';
|
|
11
|
-
import { useOrderId } from '../../store';
|
|
11
|
+
// import { useOrderId } from '../../store';
|
|
12
12
|
import { useNavigate } from 'react-router-dom';
|
|
13
13
|
import { notification } from 'antd';
|
|
14
|
+
import { useOrderId } from '../../store';
|
|
14
15
|
|
|
15
16
|
function ExpandedContent() {
|
|
16
17
|
const [payload] = useAtom(payloadAtom);
|
|
@@ -27,7 +28,7 @@ function ExpandedContent() {
|
|
|
27
28
|
} = useApiHook<{
|
|
28
29
|
data: ApiResponse[];
|
|
29
30
|
}>({
|
|
30
|
-
endpoint:
|
|
31
|
+
endpoint: `/v1/return/product/move/?return_order_id=${orderId}`,
|
|
31
32
|
method: 'POST',
|
|
32
33
|
body: payload,
|
|
33
34
|
performAction: false,
|
|
@@ -4,7 +4,7 @@ import CollapsedContent from './collapsed-content';
|
|
|
4
4
|
import CollapsableForm from '../../../common/expand-collapse';
|
|
5
5
|
import { useOrderDetails, useProductDetails } from '../store';
|
|
6
6
|
import { useLoading } from '../../order-daily-overview/store/store';
|
|
7
|
-
import {
|
|
7
|
+
import { useAxios } from '@bjsdistribution/dms-component-library';
|
|
8
8
|
|
|
9
9
|
interface ApiResponse {
|
|
10
10
|
message: string;
|
|
@@ -17,36 +17,39 @@ interface ApiResponse {
|
|
|
17
17
|
|
|
18
18
|
function ProductsInfo() {
|
|
19
19
|
const [data] = useOrderDetails();
|
|
20
|
-
const
|
|
20
|
+
const returnOrder = data;
|
|
21
21
|
|
|
22
22
|
// For API Call
|
|
23
23
|
const [, setAPidata] = useProductDetails();
|
|
24
24
|
const [, setLoading] = useLoading();
|
|
25
|
-
const {
|
|
25
|
+
const {
|
|
26
|
+
data: returnOrdersData,
|
|
27
|
+
loading,
|
|
28
|
+
fetchData: callReturnProducts,
|
|
29
|
+
} = useAxios<{
|
|
26
30
|
data: ApiResponse[];
|
|
27
31
|
}>({
|
|
28
|
-
endpoint:
|
|
32
|
+
endpoint: `/v1/return/products/${returnOrder?.id}`,
|
|
29
33
|
method: 'GET',
|
|
30
|
-
performAction: false,
|
|
31
34
|
});
|
|
32
35
|
|
|
33
36
|
useEffect(() => {
|
|
34
|
-
if (
|
|
35
|
-
|
|
37
|
+
if (returnOrder?.id) {
|
|
38
|
+
callReturnProducts();
|
|
36
39
|
}
|
|
37
|
-
}, [
|
|
40
|
+
}, [returnOrder.id]);
|
|
38
41
|
|
|
39
42
|
useEffect(() => {
|
|
40
43
|
setLoading(loading);
|
|
41
|
-
if (
|
|
42
|
-
const requiredData =
|
|
44
|
+
if (returnOrdersData && returnOrdersData.data) {
|
|
45
|
+
const requiredData = returnOrdersData.data;
|
|
43
46
|
if (requiredData.length > 0) {
|
|
44
47
|
setAPidata(requiredData);
|
|
45
48
|
} else {
|
|
46
49
|
setAPidata(null);
|
|
47
50
|
}
|
|
48
51
|
}
|
|
49
|
-
}, [
|
|
52
|
+
}, [returnOrdersData, loading]);
|
|
50
53
|
|
|
51
54
|
return (
|
|
52
55
|
<CollapsableForm collapsedContent={<CollapsedContent />}>
|
package/src/components/order-view/return-client-products/product-table/ReturnProductTable.tsx
CHANGED
|
@@ -3,14 +3,18 @@ import {
|
|
|
3
3
|
StyledTable,
|
|
4
4
|
StyledTableWrapper,
|
|
5
5
|
} from '../../../order-daily-overview/return-order-table/return-orders-filters/returnstyles';
|
|
6
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
Checkbox,
|
|
8
|
+
displayValueOrNA,
|
|
9
|
+
useApiHook,
|
|
10
|
+
} from '@bjsdistribution/dms-component-library';
|
|
7
11
|
import ActionIcon from '../../../../assets/icons/ActionIcon';
|
|
8
|
-
|
|
9
|
-
import { useOrderId, useOrderStaticData, useProductDetails } from '../../store';
|
|
12
|
+
import { useOrderId, useProductDetails } from '../../store';
|
|
10
13
|
import { ApiResponse } from '../../types';
|
|
11
14
|
import { notification } from 'antd';
|
|
12
15
|
import { useNewReturnOrderData, useSelectedProducts } from '../../../store';
|
|
13
16
|
import styled from 'styled-components';
|
|
17
|
+
import { NavLink } from 'react-router-dom';
|
|
14
18
|
|
|
15
19
|
const ReturnProductTable = () => {
|
|
16
20
|
const [selectedProducts, setSelectedProducts] = useSelectedProducts();
|
|
@@ -74,22 +78,6 @@ const ReturnProductTable = () => {
|
|
|
74
78
|
);
|
|
75
79
|
};
|
|
76
80
|
|
|
77
|
-
const [orderStaticData] = useOrderStaticData();
|
|
78
|
-
|
|
79
|
-
const returnReasonsOptions = orderStaticData?.return_reasons?.map(
|
|
80
|
-
(option: any) => ({
|
|
81
|
-
label: option.reason,
|
|
82
|
-
value: option.id,
|
|
83
|
-
})
|
|
84
|
-
);
|
|
85
|
-
|
|
86
|
-
const getReturnReasonLabel = (returnReasonId: number) => {
|
|
87
|
-
const matchedReason = returnReasonsOptions?.find(
|
|
88
|
-
(option: any) => option.value === returnReasonId
|
|
89
|
-
);
|
|
90
|
-
return matchedReason ? matchedReason.label : 'N/A';
|
|
91
|
-
};
|
|
92
|
-
|
|
93
81
|
const disableCheckbox =
|
|
94
82
|
productData?.length == 0 || returnOrderData?.length == 0;
|
|
95
83
|
|
|
@@ -126,15 +114,29 @@ const ReturnProductTable = () => {
|
|
|
126
114
|
disabled={disableCheckbox}
|
|
127
115
|
/>
|
|
128
116
|
</td>
|
|
129
|
-
<td>{product?.
|
|
117
|
+
<td>{product?.location || 'N/A'}</td>
|
|
130
118
|
<td>
|
|
131
|
-
{
|
|
132
|
-
|
|
119
|
+
<ul style={{ listStyleType: 'none', padding: 0 }}>
|
|
120
|
+
<li
|
|
121
|
+
style={{
|
|
122
|
+
color: '#0099ff',
|
|
123
|
+
fontWeight: 600,
|
|
124
|
+
paddingLeft: 0,
|
|
125
|
+
}}
|
|
126
|
+
>
|
|
127
|
+
<NavLink to={`/orders/view/${product?.order_id}`}>
|
|
128
|
+
{displayValueOrNA(product?.recipient_name)}
|
|
129
|
+
</NavLink>
|
|
130
|
+
</li>
|
|
131
|
+
<li style={{ color: '#888075' }}>
|
|
132
|
+
{displayValueOrNA(product?.postcode)}
|
|
133
|
+
</li>
|
|
134
|
+
</ul>
|
|
133
135
|
</td>
|
|
134
136
|
<td>{product?.code}</td>
|
|
135
137
|
<td>{product?.description}</td>
|
|
136
|
-
<td>{
|
|
137
|
-
<td>
|
|
138
|
+
<td>{product?.return_reason}</td>
|
|
139
|
+
<td>{product?.part}</td>
|
|
138
140
|
<td>
|
|
139
141
|
<div
|
|
140
142
|
onClick={() => {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { atom, useAtom } from 'jotai';
|
|
2
2
|
import { atomWithReducer } from 'jotai/utils';
|
|
3
3
|
import {
|
|
4
|
+
CancelOrderProductsType,
|
|
4
5
|
CreateProduct,
|
|
5
6
|
OrderActionsType,
|
|
6
7
|
OrdersType,
|
|
@@ -185,6 +186,60 @@ export const useBulkUpdateSelectedRow = () => {
|
|
|
185
186
|
return useAtom(bulkUpdateSelectedRow);
|
|
186
187
|
};
|
|
187
188
|
|
|
189
|
+
export const initialConfirmOrderErrValues = {
|
|
190
|
+
homeContactError: '',
|
|
191
|
+
workContactError: '',
|
|
192
|
+
mobileError: '',
|
|
193
|
+
emailError: '',
|
|
194
|
+
};
|
|
195
|
+
|
|
196
|
+
const errorConfirmOrderAtom = atom(initialConfirmOrderErrValues);
|
|
197
|
+
|
|
198
|
+
function useErrorConfirmOrder() {
|
|
199
|
+
return useAtom(errorConfirmOrderAtom);
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
const OrderDetailsConfirmOrder = atom<OrdersType>(ordersInitialValue);
|
|
203
|
+
function useOrderDetailsConfirmOrder() {
|
|
204
|
+
return useAtom(OrderDetailsConfirmOrder);
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
const selectedAction = atom<string>('');
|
|
208
|
+
|
|
209
|
+
export function useSelectionAction() {
|
|
210
|
+
return useAtom(selectedAction);
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
// REFUSED SERVICES STATE STARTS
|
|
214
|
+
|
|
215
|
+
const confirmedDate = atom<{
|
|
216
|
+
previousDate: string | null;
|
|
217
|
+
currentDate: string | null;
|
|
218
|
+
}>({
|
|
219
|
+
previousDate: null,
|
|
220
|
+
currentDate: null,
|
|
221
|
+
});
|
|
222
|
+
|
|
223
|
+
export function useNotificationConfirmedDate() {
|
|
224
|
+
return useAtom(confirmedDate);
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
const cancelOrderProducts = atom<CancelOrderProductsType[]>([]);
|
|
228
|
+
export function useCancelOrderProducts() {
|
|
229
|
+
return useAtom(cancelOrderProducts);
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
// changes customer Account state
|
|
233
|
+
const customerData = atom<any[]>([]);
|
|
234
|
+
export const useCustomerData = () => {
|
|
235
|
+
return useAtom(customerData);
|
|
236
|
+
};
|
|
237
|
+
|
|
238
|
+
const orderAlertsData = atom<any>({});
|
|
239
|
+
export function useOrderAlertsData() {
|
|
240
|
+
return useAtom(orderAlertsData);
|
|
241
|
+
}
|
|
242
|
+
|
|
188
243
|
export {
|
|
189
244
|
useTabType,
|
|
190
245
|
useInfoType,
|
|
@@ -193,7 +248,10 @@ export {
|
|
|
193
248
|
useIsOnHoldOrder,
|
|
194
249
|
useOrderStaticData,
|
|
195
250
|
useEscalationIDs,
|
|
251
|
+
useErrorConfirmOrder,
|
|
252
|
+
useOrderDetailsConfirmOrder,
|
|
196
253
|
};
|
|
254
|
+
|
|
197
255
|
// Remainder count
|
|
198
256
|
const OrderDetails = atom<OrdersType>(ordersInitialValue);
|
|
199
257
|
function useOrderDetails() {
|
|
@@ -418,7 +476,7 @@ export function useCUstomerId() {
|
|
|
418
476
|
return useAtom(CUstomerId);
|
|
419
477
|
}
|
|
420
478
|
|
|
421
|
-
const RouteId = atom<
|
|
479
|
+
const RouteId = atom<any | null>(null);
|
|
422
480
|
|
|
423
481
|
export function useRouteId() {
|
|
424
482
|
return useAtom(RouteId);
|
|
@@ -483,7 +541,6 @@ export function useGlobalStateHitOrder() {
|
|
|
483
541
|
return useAtom(globalOrderGetApi);
|
|
484
542
|
}
|
|
485
543
|
|
|
486
|
-
|
|
487
544
|
// Popup state Manage
|
|
488
545
|
const initialState = null;
|
|
489
546
|
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import styled from 'styled-components';
|
|
3
|
-
import {
|
|
3
|
+
import { formatUtcToLocal } from '@bjsdistribution/dms-component-library';
|
|
4
4
|
|
|
5
5
|
function Date(props: any) {
|
|
6
6
|
const data = props?.row?.original.created_at;
|
|
7
7
|
return (
|
|
8
8
|
<RowContainer>
|
|
9
|
-
<Row>{
|
|
9
|
+
<Row>{`${formatUtcToLocal(data).date} ${
|
|
10
|
+
formatUtcToLocal(data).time
|
|
11
|
+
}`}</Row>
|
|
10
12
|
</RowContainer>
|
|
11
13
|
);
|
|
12
14
|
}
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import styled from 'styled-components';
|
|
3
|
-
import { useEventNotesData } from '../../store';
|
|
3
|
+
// import { useEventNotesData } from '../../store';
|
|
4
4
|
|
|
5
5
|
function Event(props: any) {
|
|
6
|
-
const data = props?.row?.original
|
|
7
|
-
const [notesData] = useEventNotesData();
|
|
6
|
+
const data = props?.row?.original?.event_description;
|
|
7
|
+
// const [notesData] = useEventNotesData();
|
|
8
8
|
|
|
9
|
-
const getDescription = (eventId: number | undefined) => {
|
|
10
|
-
|
|
9
|
+
// const getDescription = (eventId: number | undefined) => {
|
|
10
|
+
// if (eventId === undefined || notesData?.length === 0) return '';
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
};
|
|
12
|
+
// const eventData = notesData?.find((note: any) => note?.id === eventId);
|
|
13
|
+
// return eventData ? eventData?.description : 'N/A';
|
|
14
|
+
// };
|
|
15
15
|
return (
|
|
16
16
|
<RowContainer>
|
|
17
|
-
<Row>{
|
|
17
|
+
<Row>{data}</Row>
|
|
18
18
|
</RowContainer>
|
|
19
19
|
);
|
|
20
20
|
}
|
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import CollapsedContent from '../collapsed-content';
|
|
3
3
|
import styled from 'styled-components';
|
|
4
4
|
import CollapsableForm from '../../../../common/expand-collapse';
|
|
5
5
|
import DynamicTable from '../../DynamicTable';
|
|
6
|
-
import {
|
|
6
|
+
import { useOrderProductSystemLogs } from '../../store';
|
|
7
7
|
import { tableColumns } from '../helper';
|
|
8
|
-
import { useAxios } from '@bjsdistribution/dms-component-library';
|
|
9
|
-
import { ApiResponse } from '../../types';
|
|
8
|
+
// import { useAxios } from '@bjsdistribution/dms-component-library';
|
|
9
|
+
// import { ApiResponse } from '../../types';
|
|
10
10
|
|
|
11
11
|
function SystemLogs() {
|
|
12
12
|
const [systemLogs] = useOrderProductSystemLogs();
|
|
13
|
-
const [, setNotesData] = useEventNotesData();
|
|
13
|
+
// const [, setNotesData] = useEventNotesData();
|
|
14
14
|
|
|
15
|
-
//event API
|
|
16
|
-
const {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
} = useAxios<{
|
|
21
|
-
|
|
22
|
-
}>({
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
});
|
|
15
|
+
// event API
|
|
16
|
+
// const {
|
|
17
|
+
// data: systemLogsData,
|
|
18
|
+
// fetchData: callSystemLogAPI,
|
|
19
|
+
// loading,
|
|
20
|
+
// } = useAxios<{
|
|
21
|
+
// data: ApiResponse[];
|
|
22
|
+
// }>({
|
|
23
|
+
// endpoint: `/events/get/event/`,
|
|
24
|
+
// method: 'GET',
|
|
25
|
+
// pagination: { is_pagination: false },
|
|
26
|
+
// });
|
|
27
27
|
|
|
28
|
-
useEffect(() => {
|
|
29
|
-
|
|
30
|
-
}, []);
|
|
28
|
+
// useEffect(() => {
|
|
29
|
+
// callSystemLogAPI();
|
|
30
|
+
// }, []);
|
|
31
31
|
|
|
32
|
-
useEffect(() => {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}, [loading]);
|
|
32
|
+
// useEffect(() => {
|
|
33
|
+
// if (systemLogsData && systemLogsData?.data) {
|
|
34
|
+
// setNotesData(systemLogsData?.data);
|
|
35
|
+
// }
|
|
36
|
+
// }, [loading]);
|
|
37
37
|
|
|
38
38
|
return (
|
|
39
39
|
<Table>
|
|
@@ -256,3 +256,16 @@ export type CustomersType = {
|
|
|
256
256
|
exceptional_days: any[];
|
|
257
257
|
customer_users: any[];
|
|
258
258
|
};
|
|
259
|
+
|
|
260
|
+
export interface CancelOrderProductsType {
|
|
261
|
+
order_product_id?: number;
|
|
262
|
+
action?: string; // deliver/ return/ deallocate
|
|
263
|
+
return_action?: string;
|
|
264
|
+
return_reason?: string;
|
|
265
|
+
// redundant fields
|
|
266
|
+
code?: string;
|
|
267
|
+
description?: string;
|
|
268
|
+
sku?: string;
|
|
269
|
+
product_type?: string;
|
|
270
|
+
previous_product_type?: string;
|
|
271
|
+
}
|