@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
|
@@ -1,34 +1,37 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import styled from 'styled-components';
|
|
3
3
|
import { Label, TextArea } from '@bjsdistribution/dms-component-library';
|
|
4
|
-
import {
|
|
4
|
+
import { useUpdateTask } from '../order-actions/store';
|
|
5
5
|
|
|
6
6
|
function TextSection() {
|
|
7
|
-
const [
|
|
7
|
+
const [taskPayload, setTaskPayload] = useUpdateTask();
|
|
8
8
|
|
|
9
9
|
const onChangeDetails = (event: React.ChangeEvent<HTMLTextAreaElement>) => {
|
|
10
|
-
|
|
11
|
-
...
|
|
10
|
+
setTaskPayload({
|
|
11
|
+
...taskPayload,
|
|
12
12
|
description: event.target.value,
|
|
13
13
|
});
|
|
14
14
|
};
|
|
15
15
|
|
|
16
16
|
return (
|
|
17
17
|
<Text>
|
|
18
|
-
<Label label="Details"
|
|
18
|
+
<Label label="Details" />
|
|
19
19
|
<TextField
|
|
20
20
|
placeholder="Type here...."
|
|
21
|
-
value={
|
|
21
|
+
value={taskPayload?.description || ''}
|
|
22
22
|
onChange={onChangeDetails}
|
|
23
23
|
/>
|
|
24
24
|
</Text>
|
|
25
25
|
);
|
|
26
26
|
}
|
|
27
|
+
|
|
27
28
|
const TextField = styled(TextArea)`
|
|
28
29
|
width: 97% !important;
|
|
29
30
|
`;
|
|
31
|
+
|
|
30
32
|
const Text = styled.div`
|
|
31
33
|
display: grid;
|
|
32
34
|
margin-top: 2%;
|
|
33
35
|
`;
|
|
36
|
+
|
|
34
37
|
export default TextSection;
|
|
@@ -8,20 +8,18 @@ import {
|
|
|
8
8
|
import HeaderSection from './Header';
|
|
9
9
|
import TextSection from './TextSection';
|
|
10
10
|
import ButtonsSection from './Dropdowns';
|
|
11
|
-
import {
|
|
11
|
+
import { RadioButtonsSection, SaveDetails } from './Actions';
|
|
12
12
|
import {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
// useTasksData,
|
|
14
|
+
useStaticData,
|
|
15
|
+
useFlagById,
|
|
16
16
|
useFlagRefId,
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
useTaskPriority,
|
|
20
|
-
useTaskTypeData,
|
|
21
|
-
useTaskTypeExtended,
|
|
17
|
+
useTasksData,
|
|
18
|
+
useUpdateTask,
|
|
22
19
|
} from '../order-actions/store';
|
|
23
20
|
import DetailSection from './DetailSection';
|
|
24
21
|
import { allTypes } from '../order-actions/types';
|
|
22
|
+
import { useOrderId } from '../store';
|
|
25
23
|
|
|
26
24
|
interface ApiResponse {
|
|
27
25
|
message: string;
|
|
@@ -32,101 +30,90 @@ interface ApiResponse {
|
|
|
32
30
|
}
|
|
33
31
|
|
|
34
32
|
function ViewFlag() {
|
|
35
|
-
const [
|
|
36
|
-
const [
|
|
37
|
-
const [
|
|
38
|
-
|
|
39
|
-
const [
|
|
40
|
-
const [,
|
|
41
|
-
const [, setTaskCategory] = useCategoryData();
|
|
42
|
-
const [, setTaskTypes] = useTaskTypeData();
|
|
43
|
-
const [, setTaskTypeExtended] = useTaskTypeExtended();
|
|
44
|
-
const [, setDepartmentData] = useDepartmentData();
|
|
33
|
+
const [, setStaticData] = useStaticData();
|
|
34
|
+
const [flagById, setFlagById] = useFlagById();
|
|
35
|
+
const [taskPayload, setTaskPayload] = useUpdateTask();
|
|
36
|
+
const [selectedFlagId] = useFlagRefId();
|
|
37
|
+
const [orderId] = useOrderId();
|
|
38
|
+
const [, setTasksData] = useTasksData();
|
|
45
39
|
|
|
46
40
|
//single flag data
|
|
47
|
-
const {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
} = useAxios<ApiResponse>({
|
|
52
|
-
endpoint: `/tasks/${flagRefId}`,
|
|
41
|
+
const { data: flagDataById, fetchData: fetchedFlagById, loading } = useAxios<
|
|
42
|
+
ApiResponse
|
|
43
|
+
>({
|
|
44
|
+
endpoint: `/v1/task/${selectedFlagId}`,
|
|
53
45
|
method: 'GET',
|
|
54
46
|
});
|
|
55
47
|
|
|
56
|
-
//Unresolved API
|
|
57
|
-
const { fetchData: callUnresolvedTaskApi } = useAxios<{
|
|
58
|
-
data: ApiResponse[];
|
|
59
|
-
}>({
|
|
60
|
-
endpoint: `/tasks/`,
|
|
61
|
-
method: 'GET',
|
|
62
|
-
pagination: { is_pagination: false },
|
|
63
|
-
});
|
|
64
|
-
|
|
65
48
|
// API Call
|
|
66
49
|
const { data: fetchedStaticData } = useApiHook<ApiResponse>({
|
|
67
|
-
endpoint: `/
|
|
50
|
+
endpoint: `/v1/task/getStaticData/all/`,
|
|
68
51
|
method: 'GET',
|
|
69
52
|
});
|
|
70
53
|
|
|
71
54
|
useEffect(() => {
|
|
72
55
|
if (fetchedStaticData) {
|
|
73
|
-
setStaticData(fetchedStaticData
|
|
56
|
+
setStaticData(fetchedStaticData?.data);
|
|
74
57
|
}
|
|
75
58
|
}, [fetchedStaticData]);
|
|
76
59
|
|
|
77
|
-
//
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
setDepartmentData(staticData?.map(data => data.department).flat());
|
|
87
|
-
}
|
|
88
|
-
}, [staticData]);
|
|
60
|
+
//Unresolved API
|
|
61
|
+
const { fetchData: callUnresolvedTaskApi } = useAxios<{
|
|
62
|
+
data: ApiResponse[];
|
|
63
|
+
}>({
|
|
64
|
+
endpoint: `/v1/task/`,
|
|
65
|
+
method: 'GET',
|
|
66
|
+
pagination: { is_pagination: false },
|
|
67
|
+
filters: [{ field: 'order_id', op: '=', value: orderId }],
|
|
68
|
+
});
|
|
89
69
|
|
|
90
70
|
useEffect(() => {
|
|
91
|
-
if (
|
|
92
|
-
|
|
71
|
+
if (selectedFlagId) {
|
|
72
|
+
fetchedFlagById();
|
|
93
73
|
}
|
|
94
|
-
}, [
|
|
74
|
+
}, [selectedFlagId]);
|
|
95
75
|
|
|
96
76
|
useEffect(() => {
|
|
97
|
-
if (
|
|
98
|
-
|
|
77
|
+
if (flagDataById && flagDataById?.data) {
|
|
78
|
+
setFlagById(flagDataById?.data[0]);
|
|
99
79
|
}
|
|
100
80
|
}, [loading]);
|
|
101
81
|
|
|
102
82
|
useEffect(() => {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
83
|
+
if (flagById) {
|
|
84
|
+
setTaskPayload({
|
|
85
|
+
...taskPayload,
|
|
86
|
+
flag_type: flagById?.task_type_id,
|
|
87
|
+
description: flagById?.description,
|
|
88
|
+
priority: flagById?.task_priority_id,
|
|
89
|
+
id: flagById?.id,
|
|
90
|
+
is_private: flagById?.is_private,
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
}, [flagById]);
|
|
113
94
|
|
|
114
95
|
return (
|
|
115
96
|
<>
|
|
116
|
-
{
|
|
97
|
+
{
|
|
117
98
|
<BackgroundModals>
|
|
118
99
|
<MainContainer>
|
|
119
|
-
<HeaderSection
|
|
100
|
+
<HeaderSection
|
|
101
|
+
callUnresolvedTaskApi={callUnresolvedTaskApi}
|
|
102
|
+
setTasksData={setTasksData}
|
|
103
|
+
/>
|
|
120
104
|
<DetailSection />
|
|
121
105
|
<TextSection />
|
|
122
106
|
<ButtonsSection />
|
|
123
107
|
<SectionsContainer>
|
|
124
|
-
<
|
|
108
|
+
<SaveDetails
|
|
109
|
+
callUnresolvedTaskApi={callUnresolvedTaskApi}
|
|
110
|
+
setTasksData={setTasksData}
|
|
111
|
+
/>
|
|
125
112
|
<RadioButtonsSection />
|
|
126
113
|
</SectionsContainer>
|
|
127
114
|
</MainContainer>
|
|
128
115
|
</BackgroundModals>
|
|
129
|
-
|
|
116
|
+
}
|
|
130
117
|
</>
|
|
131
118
|
);
|
|
132
119
|
}
|
|
@@ -1,110 +1,176 @@
|
|
|
1
|
-
import {
|
|
2
|
-
SelectDropdown,
|
|
3
|
-
dropdownStyles,
|
|
4
|
-
filterDropdownStyles,
|
|
5
|
-
} from '@bjsdistribution/dms-component-library';
|
|
6
|
-
import React from 'react';
|
|
1
|
+
import React, { useMemo } from 'react';
|
|
7
2
|
import styled from 'styled-components';
|
|
8
3
|
import { PrintMenu } from '../../fakedata';
|
|
9
|
-
import { useOrderDetails } from '../../store';
|
|
4
|
+
import { useOrderDetails, useOrderStaticData } from '../../store';
|
|
5
|
+
import { Dropdown, Space } from 'antd';
|
|
6
|
+
import ArrowDownIcon from '../../../../assets/icons/ArrowDownIcon';
|
|
7
|
+
import { getBaseEndpoint } from '@bjsdistribution/dms-component-library';
|
|
10
8
|
|
|
11
9
|
function Print() {
|
|
12
10
|
const [orderDetails] = useOrderDetails();
|
|
13
11
|
const gsitId = orderDetails?.gsit_order_id;
|
|
14
12
|
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
13
|
+
const orderId = useMemo(() => {
|
|
14
|
+
return orderDetails?.id;
|
|
15
|
+
}, [orderDetails]);
|
|
16
|
+
//new
|
|
17
|
+
const [orderStaticData] = useOrderStaticData();
|
|
18
|
+
const orderTypeID = useMemo(() => {
|
|
19
|
+
return orderDetails?.order_type_id;
|
|
20
|
+
}, [orderDetails]);
|
|
21
|
+
|
|
22
|
+
const getEnvironment = ():
|
|
23
|
+
| 'development'
|
|
24
|
+
| 'release_us'
|
|
25
|
+
| 'release_uk'
|
|
26
|
+
| 'staging' => {
|
|
27
|
+
const projectEnv = process.env.REACT_APP_PROJECT_ENV;
|
|
28
|
+
const apiPath = process.env.REACT_APP_API_PATH;
|
|
29
|
+
|
|
30
|
+
if (apiPath === 'https://us.dms.api.bjshomedelivery.com') {
|
|
31
|
+
return 'release_us';
|
|
32
|
+
}
|
|
33
|
+
if (apiPath === 'https://development.dms.api.bjshomedelivery.com') {
|
|
34
|
+
return 'development';
|
|
35
|
+
}
|
|
36
|
+
if (apiPath === 'https://staging.dms.api.bjshomedelivery.com') {
|
|
37
|
+
return 'staging';
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
if (projectEnv === 'release_uk') {
|
|
41
|
+
return 'release_uk';
|
|
42
|
+
}
|
|
43
|
+
if (projectEnv === 'release_us') {
|
|
44
|
+
return 'release_us';
|
|
45
|
+
}
|
|
46
|
+
if (projectEnv === 'staging') {
|
|
47
|
+
return 'staging';
|
|
48
|
+
}
|
|
49
|
+
return 'development';
|
|
21
50
|
};
|
|
22
51
|
|
|
23
52
|
const getBaseUrl = (): string => {
|
|
24
53
|
const environment = getEnvironment();
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
54
|
+
switch (environment) {
|
|
55
|
+
case 'release_uk':
|
|
56
|
+
case 'release_us':
|
|
57
|
+
return 'https://us.toolbox.bjshomedelivery.com/api/v1/gsit';
|
|
58
|
+
case 'staging':
|
|
59
|
+
return 'https://staging.toolbox.bjshomedelivery.com/api/v1/gsit';
|
|
60
|
+
default:
|
|
61
|
+
return 'https://development.toolbox.bjshomedelivery.com/api/v1/gsit';
|
|
62
|
+
}
|
|
28
63
|
};
|
|
29
64
|
|
|
30
65
|
const getUrl = (option: string) => {
|
|
31
66
|
const val = option?.toLowerCase()?.replaceAll(' ', '');
|
|
32
67
|
const baseUrl = getBaseUrl();
|
|
33
68
|
|
|
34
|
-
if (
|
|
35
|
-
|
|
36
|
-
}
|
|
37
|
-
if (val === 'proofofdelivery(doc)') {
|
|
69
|
+
if (!gsitId) {
|
|
70
|
+
console.error('Missing orderId. Cannot generate Return Labels URL.');
|
|
38
71
|
return '';
|
|
39
72
|
}
|
|
40
|
-
if (val === '
|
|
41
|
-
return `${baseUrl}/generate_labels?pdf=true&product_type=Deliver&order_id=${gsitId}`;
|
|
42
|
-
}
|
|
43
|
-
if (val === 'ordercollectionlabels') {
|
|
44
|
-
return `${baseUrl}/generate_labels?pdf=true&product_type=Collect&order_id=${gsitId}`;
|
|
45
|
-
}
|
|
46
|
-
if (val === 'orderreturnlabels') {
|
|
73
|
+
if (val === 'returnlabels') {
|
|
47
74
|
return `${baseUrl}/generate_labels?pdf=true&product_type=Return&order_id=${gsitId}`;
|
|
48
|
-
}
|
|
49
|
-
if (val === 'returnscovernote') {
|
|
50
|
-
return '';
|
|
51
75
|
} else {
|
|
52
76
|
return '';
|
|
53
77
|
}
|
|
54
78
|
};
|
|
55
79
|
|
|
56
80
|
const handleSelectChange = (selectedOption: any) => {
|
|
57
|
-
console.log(selectedOption);
|
|
58
81
|
const selectedValue = selectedOption?.value;
|
|
82
|
+
const baseEndpoint = getBaseEndpoint();
|
|
59
83
|
if (selectedValue) {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
84
|
+
//return
|
|
85
|
+
if (selectedValue === 'returncovernote') {
|
|
86
|
+
window.open(
|
|
87
|
+
`${baseEndpoint}/orders/return_cover_notes/?order_id=${orderId}`,
|
|
88
|
+
'_blank'
|
|
89
|
+
);
|
|
90
|
+
//proof
|
|
91
|
+
} else if (selectedValue === 'proofofdelivery') {
|
|
92
|
+
window.open(
|
|
93
|
+
`${baseEndpoint}/orders/generate_note/?order_id=${orderId}&output_format=pdf`,
|
|
94
|
+
'_blank'
|
|
95
|
+
);
|
|
96
|
+
} else {
|
|
97
|
+
const url = getUrl(selectedValue);
|
|
98
|
+
window.open(url, '_blank');
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
const isOptionDisabled = (optionValue: any) => {
|
|
104
|
+
const orderType = orderStaticData?.order_type?.find(
|
|
105
|
+
(type: any) => type?.id === orderTypeID
|
|
106
|
+
);
|
|
107
|
+
if (optionValue === 'ordercovernote') {
|
|
108
|
+
if (orderType?.type === 'return') {
|
|
109
|
+
return false;
|
|
110
|
+
}
|
|
111
|
+
return true;
|
|
65
112
|
}
|
|
113
|
+
return false;
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
const filteredOptions = PrintMenu?.map((option: any) => ({
|
|
117
|
+
key: option.value,
|
|
118
|
+
label: option.label,
|
|
119
|
+
value: option.value,
|
|
120
|
+
}));
|
|
121
|
+
|
|
122
|
+
const menuItems = {
|
|
123
|
+
items: filteredOptions?.map((option: any) => {
|
|
124
|
+
const disabled = isOptionDisabled(option.value);
|
|
125
|
+
|
|
126
|
+
return {
|
|
127
|
+
key: option.value,
|
|
128
|
+
label: (
|
|
129
|
+
<div
|
|
130
|
+
onClick={e => {
|
|
131
|
+
e.stopPropagation();
|
|
132
|
+
if (!disabled) {
|
|
133
|
+
handleSelectChange(option);
|
|
134
|
+
}
|
|
135
|
+
}}
|
|
136
|
+
style={{
|
|
137
|
+
color: disabled ? '#bfbfbf' : undefined,
|
|
138
|
+
cursor: disabled ? 'not-allowed' : 'pointer',
|
|
139
|
+
}}
|
|
140
|
+
>
|
|
141
|
+
{option.label}
|
|
142
|
+
</div>
|
|
143
|
+
),
|
|
144
|
+
disabled,
|
|
145
|
+
};
|
|
146
|
+
}),
|
|
66
147
|
};
|
|
67
148
|
|
|
68
149
|
return (
|
|
69
150
|
<Container>
|
|
70
|
-
<
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
...filterDropdownStyles,
|
|
79
|
-
container: styles => ({
|
|
80
|
-
...styles,
|
|
81
|
-
cursor: 'pointer',
|
|
82
|
-
}),
|
|
83
|
-
menu: styles => ({
|
|
84
|
-
...styles,
|
|
85
|
-
top: '113%',
|
|
86
|
-
borderRadius: '5px',
|
|
87
|
-
width: 'max-content',
|
|
88
|
-
cursor: 'pointer',
|
|
89
|
-
}),
|
|
90
|
-
control: styles => ({
|
|
91
|
-
...styles,
|
|
92
|
-
width: '90px',
|
|
93
|
-
boxShadow: 'none',
|
|
94
|
-
borderColor: 'transparent',
|
|
95
|
-
cursor: 'pointer',
|
|
96
|
-
backgroundColor: 'transparent',
|
|
97
|
-
'&:hover': {
|
|
98
|
-
boxShadow: 'none',
|
|
99
|
-
borderColor: 'transparent',
|
|
100
|
-
},
|
|
101
|
-
}),
|
|
102
|
-
}}
|
|
103
|
-
/>
|
|
151
|
+
<Dropdown menu={menuItems} trigger={['hover']}>
|
|
152
|
+
<a onClick={e => e.preventDefault()} style={{ cursor: 'pointer' }}>
|
|
153
|
+
<StyledSpace>
|
|
154
|
+
PRINT
|
|
155
|
+
<ArrowDownIcon fill={'#f0f2f2'} />
|
|
156
|
+
</StyledSpace>
|
|
157
|
+
</a>
|
|
158
|
+
</Dropdown>
|
|
104
159
|
</Container>
|
|
105
160
|
);
|
|
106
161
|
}
|
|
107
162
|
|
|
108
163
|
const Container = styled.div``;
|
|
109
164
|
|
|
165
|
+
const StyledSpace = styled(Space)`
|
|
166
|
+
.ant-space-item {
|
|
167
|
+
color: #6a7378;
|
|
168
|
+
text-align: center;
|
|
169
|
+
font-family: Lato;
|
|
170
|
+
font-size: 14px;
|
|
171
|
+
font-style: normal;
|
|
172
|
+
font-weight: 500;
|
|
173
|
+
}
|
|
174
|
+
`;
|
|
175
|
+
|
|
110
176
|
export default Print;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import styled from 'styled-components';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { Skeleton } from 'antd';
|
|
4
|
-
import {
|
|
4
|
+
import { formatUtcToLocal } from '@bjsdistribution/dms-component-library';
|
|
5
5
|
import { useAuditLogLoadingState, usegetNotes } from '../store';
|
|
6
6
|
import { NotesTableData } from '../notes/logs/fakeData';
|
|
7
7
|
|
|
@@ -35,7 +35,9 @@ const GenericAuditLogsTable = () => {
|
|
|
35
35
|
<div className="bold" title={note?.created_by}>
|
|
36
36
|
{note?.created_by}
|
|
37
37
|
</div>
|
|
38
|
-
<div>{
|
|
38
|
+
<div>{`${formatUtcToLocal(note?.created_at).date} ${
|
|
39
|
+
formatUtcToLocal(note?.created_at).time
|
|
40
|
+
}`}</div>
|
|
39
41
|
</td>
|
|
40
42
|
<td
|
|
41
43
|
dangerouslySetInnerHTML={{ __html: note?.description }}
|
|
@@ -94,8 +96,7 @@ export const AuditTableWrapper = styled.div`
|
|
|
94
96
|
`;
|
|
95
97
|
|
|
96
98
|
const ScrollableTableWrapper = styled.div`
|
|
97
|
-
height:
|
|
98
|
-
min-height: 200px;
|
|
99
|
+
height: 550px;
|
|
99
100
|
overflow: auto;
|
|
100
101
|
`;
|
|
101
102
|
|
|
@@ -9,7 +9,7 @@ import OrderActions from './order-actions';
|
|
|
9
9
|
import { useApiHook, useAxios } from '@bjsdistribution/dms-component-library';
|
|
10
10
|
import {
|
|
11
11
|
useOrderDetails,
|
|
12
|
-
useOrderStaticData,
|
|
12
|
+
// useOrderStaticData,
|
|
13
13
|
useStatusDetails,
|
|
14
14
|
useOrderId,
|
|
15
15
|
useDepotOptions,
|
|
@@ -31,7 +31,7 @@ import { OrdersType } from './types';
|
|
|
31
31
|
import { useLocation } from 'react-router-dom';
|
|
32
32
|
import { notification } from 'antd';
|
|
33
33
|
import DetailsFilters from './details-filters/DetailsFilters';
|
|
34
|
-
import { useSubContracterData
|
|
34
|
+
import { useSubContracterData } from '../store';
|
|
35
35
|
import Notification from './notification';
|
|
36
36
|
import Order from './order-resources/expanded-content';
|
|
37
37
|
import { setResourcesCall, useAllOrderStatus } from './order-actions/store';
|
|
@@ -55,7 +55,6 @@ function OrderView() {
|
|
|
55
55
|
const [orderDetails, setOrderDetails] = useOrderDetails();
|
|
56
56
|
const [, setPrevOrderDetails] = usePrevOrderDetails();
|
|
57
57
|
const [, setLoading] = useState<boolean>(false);
|
|
58
|
-
const [, setOrderStaticData] = useOrderStaticData();
|
|
59
58
|
const [, setOrderStatus] = useStatusDetails();
|
|
60
59
|
const [, setDepotOptions] = useDepotOptions();
|
|
61
60
|
const [, setCustomerInfo] = useCustomerInfo();
|
|
@@ -66,11 +65,10 @@ function OrderView() {
|
|
|
66
65
|
const [, setCUstomerId] = useCUstomerId();
|
|
67
66
|
const [, setRouteId] = useRouteId();
|
|
68
67
|
const [liveRecalling] = useLiveRecalling();
|
|
69
|
-
const [, setVisibilityData] = useVisibilityData();
|
|
70
68
|
const [, setSubContracterData] = useSubContracterData();
|
|
71
69
|
const [recallOrders] = useGlobalStateHitOrder();
|
|
72
70
|
const [, setStatusVal] = useAllOrderStatus();
|
|
73
|
-
const
|
|
71
|
+
const order_id = orderDetails?.id;
|
|
74
72
|
|
|
75
73
|
useEffect(() => {
|
|
76
74
|
setStatusVal(orderDetails?.status_value);
|
|
@@ -89,9 +87,9 @@ function OrderView() {
|
|
|
89
87
|
pagination: { page: 1, per_page: 100 },
|
|
90
88
|
filters: [
|
|
91
89
|
{
|
|
92
|
-
field: '
|
|
90
|
+
field: 'order_id',
|
|
93
91
|
op: '=',
|
|
94
|
-
value: `${
|
|
92
|
+
value: `${order_id}`,
|
|
95
93
|
},
|
|
96
94
|
],
|
|
97
95
|
});
|
|
@@ -146,7 +144,7 @@ function OrderView() {
|
|
|
146
144
|
}
|
|
147
145
|
} else {
|
|
148
146
|
const paths = location.pathname.split('/');
|
|
149
|
-
setOrderId(paths[paths
|
|
147
|
+
setOrderId(paths[paths?.length - 1]);
|
|
150
148
|
}
|
|
151
149
|
}, [location.search, loadingExternal]);
|
|
152
150
|
|
|
@@ -162,13 +160,6 @@ function OrderView() {
|
|
|
162
160
|
performAction: false,
|
|
163
161
|
});
|
|
164
162
|
|
|
165
|
-
const { data: fetchedStaticData, loading: staticDataLoading } = useApiHook<{
|
|
166
|
-
data: ApiResponse[];
|
|
167
|
-
}>({
|
|
168
|
-
endpoint: `/orders/getStaticData/all/`,
|
|
169
|
-
method: 'GET',
|
|
170
|
-
});
|
|
171
|
-
|
|
172
163
|
//Order status api
|
|
173
164
|
const {
|
|
174
165
|
data: fetchedStatusData,
|
|
@@ -187,6 +178,8 @@ function OrderView() {
|
|
|
187
178
|
endpoint: `/depot/`,
|
|
188
179
|
method: 'GET',
|
|
189
180
|
filters: [{ field: 'visibility', op: '=', value: true }],
|
|
181
|
+
//@ts-ignore
|
|
182
|
+
pagination: { is_pagination: false },
|
|
190
183
|
});
|
|
191
184
|
useEffect(() => {
|
|
192
185
|
if (orderId) {
|
|
@@ -195,19 +188,6 @@ function OrderView() {
|
|
|
195
188
|
}
|
|
196
189
|
}, [orderId, liveRecalling, recallOrders]);
|
|
197
190
|
|
|
198
|
-
useEffect(() => {
|
|
199
|
-
setLoading(staticDataLoading);
|
|
200
|
-
if (fetchedStaticData && fetchedStaticData.data) {
|
|
201
|
-
const result = fetchedStaticData?.data;
|
|
202
|
-
setOrderStaticData(result[0]);
|
|
203
|
-
setVisibilityData(
|
|
204
|
-
fetchedStaticData?.data?.flatMap(
|
|
205
|
-
(i: any) => i?.resource_visibility_type
|
|
206
|
-
)
|
|
207
|
-
);
|
|
208
|
-
}
|
|
209
|
-
}, [staticDataLoading]);
|
|
210
|
-
|
|
211
191
|
useEffect(() => {
|
|
212
192
|
setLoading(loading);
|
|
213
193
|
if (fetchedData && fetchedData.data) {
|
|
@@ -240,9 +220,6 @@ function OrderView() {
|
|
|
240
220
|
// setOrderStatus(null);
|
|
241
221
|
}
|
|
242
222
|
}
|
|
243
|
-
return () => {
|
|
244
|
-
// setOrderId(null);
|
|
245
|
-
};
|
|
246
223
|
}, [statusDataLoading, fetchedStatusData]);
|
|
247
224
|
|
|
248
225
|
const [getResources] = useAtom(setResourcesCall);
|
|
@@ -263,9 +240,6 @@ function OrderView() {
|
|
|
263
240
|
setDepotOptions([]);
|
|
264
241
|
}
|
|
265
242
|
}
|
|
266
|
-
return () => {
|
|
267
|
-
// setOrderId(null);
|
|
268
|
-
};
|
|
269
243
|
}, [depotDataLoading]);
|
|
270
244
|
|
|
271
245
|
// Order resources
|
|
@@ -303,9 +277,6 @@ function OrderView() {
|
|
|
303
277
|
if (orderId) {
|
|
304
278
|
setOrderResources(fetchedResourcesData);
|
|
305
279
|
}
|
|
306
|
-
return () => {
|
|
307
|
-
// setOrderId(null);
|
|
308
|
-
};
|
|
309
280
|
}, [fetchedResourcesData, orderResources, setOrderResources]);
|
|
310
281
|
|
|
311
282
|
// // Toolbox resources
|
|
@@ -330,9 +301,6 @@ function OrderView() {
|
|
|
330
301
|
// if (orderId) {
|
|
331
302
|
// setOrderToolbox(fetchedToolboxData);
|
|
332
303
|
// }
|
|
333
|
-
// return () => {
|
|
334
|
-
// // setOrderId(undefined);
|
|
335
|
-
// };
|
|
336
304
|
// }, [fetchedToolboxData, orderToolbox, setOrderToolbox]);
|
|
337
305
|
|
|
338
306
|
useEffect(() => {
|
|
@@ -388,7 +356,7 @@ function OrderView() {
|
|
|
388
356
|
return () => {
|
|
389
357
|
setGsitOrderId(undefined);
|
|
390
358
|
};
|
|
391
|
-
}, [
|
|
359
|
+
}, [order_id]);
|
|
392
360
|
|
|
393
361
|
const { data: fetchedSubcontractotData, loading: apiLoading } = useApiHook<{
|
|
394
362
|
data: ApiResponse[];
|
|
@@ -408,7 +376,6 @@ function OrderView() {
|
|
|
408
376
|
setSubContracterData(formattedData);
|
|
409
377
|
}
|
|
410
378
|
}, [fetchedSubcontractotData, fetchedSubcontractotData, apiLoading]);
|
|
411
|
-
|
|
412
379
|
return (
|
|
413
380
|
<MainContainer>
|
|
414
381
|
<GeneralHeader />
|