@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/details-filters/left-side-filters/dropdowns/OptionsDropDown.tsx
CHANGED
|
@@ -1,25 +1,50 @@
|
|
|
1
|
-
import {
|
|
2
|
-
SelectDropdown,
|
|
3
|
-
dropdownStyles,
|
|
4
|
-
filterDropdownStyles,
|
|
5
|
-
} from '@bjsdistribution/dms-component-library';
|
|
6
1
|
import React from 'react';
|
|
7
2
|
import styled from 'styled-components';
|
|
3
|
+
import {
|
|
4
|
+
useCurrentAction,
|
|
5
|
+
useOrderDetails,
|
|
6
|
+
useOrderId,
|
|
7
|
+
// useOrderId,
|
|
8
|
+
useStatusDetails,
|
|
9
|
+
} from '../../../store';
|
|
8
10
|
import { optionsMenu } from '../../../fakedata';
|
|
9
|
-
import {
|
|
11
|
+
import {
|
|
12
|
+
useCreateReminderPayload,
|
|
13
|
+
useCreateTaskPayload,
|
|
14
|
+
} from '../../../order-actions/store';
|
|
15
|
+
import { Dropdown, Space } from 'antd';
|
|
16
|
+
import ArrowDownIcon from '../../../../../assets/icons/ArrowDownIcon';
|
|
10
17
|
|
|
11
18
|
function Options() {
|
|
12
19
|
const [, setCurrentAction] = useCurrentAction();
|
|
20
|
+
const [orderId] = useOrderId();
|
|
21
|
+
const [, setReminderPayload] = useCreateReminderPayload();
|
|
22
|
+
const [, setTaskPayload] = useCreateTaskPayload();
|
|
23
|
+
const [orderStatus] = useStatusDetails();
|
|
24
|
+
const [orderDetails] = useOrderDetails();
|
|
13
25
|
|
|
14
26
|
const handleSelectChange = (selectedOption: any) => {
|
|
15
|
-
setCurrentAction(selectedOption
|
|
27
|
+
setCurrentAction(selectedOption);
|
|
28
|
+
|
|
29
|
+
if (selectedOption === 'create-reminder') {
|
|
30
|
+
setReminderPayload((prevState: any) => ({
|
|
31
|
+
...prevState,
|
|
32
|
+
order_id: orderId,
|
|
33
|
+
}));
|
|
34
|
+
} else if (selectedOption === 'create-task') {
|
|
35
|
+
setTaskPayload((prevState: any) => ({
|
|
36
|
+
...prevState,
|
|
37
|
+
order_id: orderId,
|
|
38
|
+
}));
|
|
39
|
+
}
|
|
16
40
|
};
|
|
17
41
|
|
|
18
|
-
const
|
|
42
|
+
const isReleased = orderStatus[0]?.released;
|
|
43
|
+
const isRouted = orderStatus[0]?.routed && orderDetails?.order_routes?.id;
|
|
19
44
|
const isOrderOnHold = orderDetails?.status === 'OO';
|
|
20
45
|
const isOrderCancelled = orderDetails?.status === 'CO';
|
|
21
46
|
|
|
22
|
-
const filteredOptions = optionsMenu
|
|
47
|
+
const filteredOptions = optionsMenu?.filter(option => {
|
|
23
48
|
let shouldExclude = false;
|
|
24
49
|
|
|
25
50
|
if (isOrderOnHold && option.value === 'hold-order') {
|
|
@@ -33,53 +58,59 @@ function Options() {
|
|
|
33
58
|
shouldExclude = true;
|
|
34
59
|
}
|
|
35
60
|
}
|
|
61
|
+
if (!isReleased && option.value === 'unrelease-order') {
|
|
62
|
+
shouldExclude = true;
|
|
63
|
+
}
|
|
36
64
|
if (!isOrderOnHold && option.value === 'unhold-order') {
|
|
37
65
|
shouldExclude = true;
|
|
38
66
|
}
|
|
39
67
|
|
|
68
|
+
if (isOrderOnHold && option.value === 'confirm-order') {
|
|
69
|
+
shouldExclude = true;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
if (!isRouted && option.value === 'log-service-refusal') {
|
|
73
|
+
shouldExclude = true;
|
|
74
|
+
}
|
|
75
|
+
|
|
40
76
|
return !shouldExclude;
|
|
41
77
|
});
|
|
42
78
|
|
|
79
|
+
const menuItems = {
|
|
80
|
+
items: filteredOptions?.map(option => ({
|
|
81
|
+
key: option.value,
|
|
82
|
+
label: (
|
|
83
|
+
<div onClick={() => handleSelectChange(option.value)}>
|
|
84
|
+
{option.label}
|
|
85
|
+
</div>
|
|
86
|
+
),
|
|
87
|
+
})),
|
|
88
|
+
};
|
|
89
|
+
|
|
43
90
|
return (
|
|
44
91
|
<Option>
|
|
45
|
-
<
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
...filterDropdownStyles,
|
|
54
|
-
container: styles => ({
|
|
55
|
-
...styles,
|
|
56
|
-
cursor: 'pointer',
|
|
57
|
-
}),
|
|
58
|
-
menu: styles => ({
|
|
59
|
-
...styles,
|
|
60
|
-
top: '113%',
|
|
61
|
-
borderRadius: '5px',
|
|
62
|
-
width: 'max-content',
|
|
63
|
-
cursor: 'pointer',
|
|
64
|
-
}),
|
|
65
|
-
control: styles => ({
|
|
66
|
-
...styles,
|
|
67
|
-
width: '105px',
|
|
68
|
-
boxShadow: 'none',
|
|
69
|
-
borderColor: 'transparent',
|
|
70
|
-
cursor: 'pointer',
|
|
71
|
-
backgroundColor: 'transparent',
|
|
72
|
-
'&:hover': {
|
|
73
|
-
boxShadow: 'none',
|
|
74
|
-
borderColor: 'transparent',
|
|
75
|
-
},
|
|
76
|
-
}),
|
|
77
|
-
}}
|
|
78
|
-
value="OPTIONS"
|
|
79
|
-
/>
|
|
92
|
+
<Dropdown menu={menuItems} trigger={['hover']}>
|
|
93
|
+
<a onClick={e => e.preventDefault()} style={{ cursor: 'pointer' }}>
|
|
94
|
+
<StyledSpace>
|
|
95
|
+
OPTIONS
|
|
96
|
+
<ArrowDownIcon fill={'#f0f2f2'} />
|
|
97
|
+
</StyledSpace>
|
|
98
|
+
</a>
|
|
99
|
+
</Dropdown>
|
|
80
100
|
</Option>
|
|
81
101
|
);
|
|
82
102
|
}
|
|
83
103
|
const Option = styled.div``;
|
|
84
104
|
|
|
105
|
+
const StyledSpace = styled(Space)`
|
|
106
|
+
.ant-space-item {
|
|
107
|
+
color: #6a7378;
|
|
108
|
+
text-align: center;
|
|
109
|
+
font-family: Lato;
|
|
110
|
+
font-size: 14px;
|
|
111
|
+
font-style: normal;
|
|
112
|
+
font-weight: 500;
|
|
113
|
+
}
|
|
114
|
+
`;
|
|
115
|
+
|
|
85
116
|
export default Options;
|
|
@@ -30,21 +30,22 @@ export const optionsMenu = [
|
|
|
30
30
|
label: 'Clear Booking Status',
|
|
31
31
|
value: 'clear-date',
|
|
32
32
|
},
|
|
33
|
-
|
|
33
|
+
{ label: 'Charge Log', value: 'charge-log' },
|
|
34
|
+
{ label: 'Force Debrief', value: 'force-debrief' },
|
|
34
35
|
];
|
|
35
36
|
|
|
36
37
|
export const PrintMenu = [
|
|
37
38
|
{
|
|
38
|
-
label: '
|
|
39
|
-
value: '
|
|
39
|
+
label: 'Proof of Delivery',
|
|
40
|
+
value: 'proofofdelivery',
|
|
40
41
|
},
|
|
41
42
|
{
|
|
42
|
-
label: '
|
|
43
|
-
value: '
|
|
43
|
+
label: 'Return Labels',
|
|
44
|
+
value: 'returnlabels',
|
|
44
45
|
},
|
|
45
46
|
{
|
|
46
47
|
label: 'Return Cover Notes',
|
|
47
|
-
value: '
|
|
48
|
+
value: 'returncovernote',
|
|
48
49
|
},
|
|
49
50
|
];
|
|
50
51
|
|
|
@@ -1,46 +1,67 @@
|
|
|
1
1
|
import React, { useEffect, useState } from 'react';
|
|
2
2
|
import styled from 'styled-components';
|
|
3
|
+
import { useFlagById, useUpdateTask } from '../order-actions/store';
|
|
4
|
+
import { useCurrentAction } from '../store';
|
|
5
|
+
import Tippy from '@tippyjs/react';
|
|
3
6
|
import {
|
|
4
7
|
Button,
|
|
5
8
|
RadioButtonGroup,
|
|
6
9
|
useAxios,
|
|
7
10
|
} from '@bjsdistribution/dms-component-library';
|
|
8
|
-
import { useSingleFlagData, useSinglePayload } from '../order-actions/store';
|
|
9
|
-
import { useCurrentAction } from '../store';
|
|
10
|
-
import Tippy from '@tippyjs/react';
|
|
11
|
-
import { notification } from 'antd';
|
|
12
11
|
import { ApiResponse } from '../types';
|
|
12
|
+
import { notification } from 'antd';
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
export const FlagsFilter = [
|
|
15
|
+
{
|
|
16
|
+
label: 'Private',
|
|
17
|
+
value: 'private',
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
label: 'Public',
|
|
21
|
+
value: 'public',
|
|
22
|
+
},
|
|
23
|
+
];
|
|
24
|
+
|
|
25
|
+
function SaveDetails({ callUnresolvedTaskApi, setTasksData }: any) {
|
|
15
26
|
const [, setCurrentAction] = useCurrentAction();
|
|
16
|
-
const [
|
|
17
|
-
|
|
27
|
+
const [taskPayload] = useUpdateTask();
|
|
28
|
+
|
|
29
|
+
const [flagById] = useFlagById();
|
|
18
30
|
|
|
19
31
|
//flag PUT API
|
|
20
32
|
const { fetchData: callFlagUpdateAPI } = useAxios<{
|
|
21
33
|
data: ApiResponse[];
|
|
22
34
|
}>({
|
|
23
|
-
endpoint: `/
|
|
35
|
+
endpoint: `/v1/task/update/`,
|
|
24
36
|
method: 'PUT',
|
|
25
37
|
});
|
|
26
38
|
|
|
27
39
|
const onSubmit = async () => {
|
|
28
|
-
|
|
29
|
-
payload: [
|
|
40
|
+
const response = (await callFlagUpdateAPI({
|
|
41
|
+
payload: [taskPayload],
|
|
30
42
|
})) as {
|
|
31
43
|
code: number | null;
|
|
32
|
-
error?: string | null
|
|
44
|
+
error?: string | null;
|
|
45
|
+
message?: string;
|
|
46
|
+
data?: any;
|
|
33
47
|
[key: string]: any;
|
|
34
48
|
};
|
|
35
|
-
|
|
49
|
+
|
|
50
|
+
if (response.code === 200 && response?.data) {
|
|
36
51
|
notification.success({
|
|
37
52
|
message: 'Success',
|
|
38
53
|
description: `${response.message}`,
|
|
39
54
|
});
|
|
55
|
+
|
|
40
56
|
setCurrentAction(undefined);
|
|
41
|
-
|
|
57
|
+
|
|
58
|
+
const unresolvedResponse = await callUnresolvedTaskApi();
|
|
59
|
+
if (unresolvedResponse && unresolvedResponse?.data) {
|
|
60
|
+
setTasksData(unresolvedResponse?.data);
|
|
61
|
+
}
|
|
42
62
|
}
|
|
43
|
-
|
|
63
|
+
|
|
64
|
+
if (response?.code == null && response?.error) {
|
|
44
65
|
return notification.error({
|
|
45
66
|
message: 'Failure',
|
|
46
67
|
description: `${response.error}`,
|
|
@@ -52,7 +73,8 @@ function ActionSection({ callUnresolvedTaskApi }: any) {
|
|
|
52
73
|
setCurrentAction(undefined);
|
|
53
74
|
};
|
|
54
75
|
|
|
55
|
-
const isDisabled =
|
|
76
|
+
const isDisabled = flagById?.status === 'SD';
|
|
77
|
+
|
|
56
78
|
return (
|
|
57
79
|
<Wrapper>
|
|
58
80
|
<Tippy
|
|
@@ -79,17 +101,17 @@ function ActionSection({ callUnresolvedTaskApi }: any) {
|
|
|
79
101
|
}
|
|
80
102
|
|
|
81
103
|
function RadioButtonsSection() {
|
|
82
|
-
const [
|
|
83
|
-
const [
|
|
104
|
+
const [flagById] = useFlagById();
|
|
105
|
+
const [taskPayload, setPayload] = useUpdateTask();
|
|
84
106
|
const [, setNewValue] = useState<boolean | string>(false);
|
|
85
107
|
|
|
86
108
|
useEffect(() => {
|
|
87
|
-
const defaultSelectedValue =
|
|
109
|
+
const defaultSelectedValue = flagById?.is_private ? false : true;
|
|
88
110
|
setPayload({
|
|
89
|
-
...
|
|
111
|
+
...taskPayload,
|
|
90
112
|
is_private: defaultSelectedValue,
|
|
91
113
|
});
|
|
92
|
-
}, [
|
|
114
|
+
}, [flagById?.is_private]);
|
|
93
115
|
|
|
94
116
|
const handleRadioButtonChange = (event: any) => {
|
|
95
117
|
const value = event.target.value;
|
|
@@ -103,7 +125,7 @@ function RadioButtonsSection() {
|
|
|
103
125
|
|
|
104
126
|
setNewValue(value);
|
|
105
127
|
setPayload({
|
|
106
|
-
...
|
|
128
|
+
...taskPayload,
|
|
107
129
|
is_private: booleanValue,
|
|
108
130
|
});
|
|
109
131
|
};
|
|
@@ -111,8 +133,8 @@ function RadioButtonsSection() {
|
|
|
111
133
|
return (
|
|
112
134
|
<DropDowns>
|
|
113
135
|
<RadioButtonGroup
|
|
114
|
-
selectedValue={
|
|
115
|
-
options={
|
|
136
|
+
selectedValue={taskPayload?.is_private == false ? 'public' : 'private'}
|
|
137
|
+
options={FlagsFilter}
|
|
116
138
|
onChange={handleRadioButtonChange}
|
|
117
139
|
heading={''}
|
|
118
140
|
required={false}
|
|
@@ -124,11 +146,15 @@ function RadioButtonsSection() {
|
|
|
124
146
|
const ButtonWrapper = styled.div`
|
|
125
147
|
display: flex;
|
|
126
148
|
gap: 15px;
|
|
149
|
+
margin-right: 15px;
|
|
127
150
|
`;
|
|
128
151
|
|
|
129
152
|
const SaveButton = styled(Button)``;
|
|
130
153
|
|
|
131
|
-
const CancelButton = styled(Button)
|
|
154
|
+
const CancelButton = styled(Button)`
|
|
155
|
+
background-color: white;
|
|
156
|
+
color: #3a3630;
|
|
157
|
+
`;
|
|
132
158
|
|
|
133
159
|
const DropDowns = styled.div`
|
|
134
160
|
display: flex;
|
|
@@ -144,4 +170,4 @@ const TooltipContent = styled.div`
|
|
|
144
170
|
|
|
145
171
|
const Wrapper = styled.div``;
|
|
146
172
|
|
|
147
|
-
export {
|
|
173
|
+
export { SaveDetails, RadioButtonsSection };
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import styled from 'styled-components';
|
|
3
3
|
import { Label } from '@bjsdistribution/dms-component-library';
|
|
4
|
-
import {
|
|
4
|
+
import { useFlagById } from '../order-actions/store';
|
|
5
5
|
|
|
6
6
|
function DetailSection() {
|
|
7
|
-
const [
|
|
7
|
+
const [flagById] = useFlagById();
|
|
8
8
|
|
|
9
9
|
let orderColumnData =
|
|
10
|
-
|
|
10
|
+
flagById?.order_data?.order_recipient?.recipient_name?.toUpperCase() +
|
|
11
11
|
', ' +
|
|
12
|
-
|
|
12
|
+
flagById?.order_data?.order_recipient?.postcode;
|
|
13
13
|
|
|
14
14
|
return (
|
|
15
15
|
<Detail>
|
|
16
16
|
<Flex>
|
|
17
17
|
<StyledLabel label="Reference" />
|
|
18
|
-
<Ref>{
|
|
18
|
+
<Ref>{flagById?.id}</Ref>
|
|
19
19
|
</Flex>
|
|
20
20
|
<Flex>
|
|
21
21
|
<StyledLabel label="Order" />
|
|
@@ -1,122 +1,108 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Label,
|
|
3
|
-
SelectDropdown,
|
|
4
|
-
dropdownStyles,
|
|
5
|
-
filterDropdownStyles,
|
|
6
|
-
} from '@bjsdistribution/dms-component-library';
|
|
7
|
-
import React from 'react';
|
|
1
|
+
import React, { useMemo } from 'react';
|
|
8
2
|
import styled from 'styled-components';
|
|
3
|
+
import { Label } from '@bjsdistribution/dms-component-library';
|
|
4
|
+
import StatusIndicator from './StatusIndicator';
|
|
9
5
|
import {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
useTaskTypeData,
|
|
6
|
+
useFlagById,
|
|
7
|
+
useStaticData,
|
|
8
|
+
useUpdateTask,
|
|
14
9
|
} from '../order-actions/store';
|
|
15
|
-
import { formatDate,
|
|
16
|
-
import
|
|
10
|
+
import { formatDate, priorityData } from '../order-actions/utils';
|
|
11
|
+
import { Select } from 'antd';
|
|
17
12
|
|
|
18
13
|
function ButtonsSection() {
|
|
19
|
-
const [
|
|
20
|
-
const [
|
|
21
|
-
const [
|
|
22
|
-
const [taskTypes] = useTaskTypeData();
|
|
14
|
+
const [staticData] = useStaticData();
|
|
15
|
+
const [flagById] = useFlagById();
|
|
16
|
+
const [taskPayload, setTaskPayload] = useUpdateTask();
|
|
23
17
|
|
|
24
|
-
|
|
25
|
-
const selectTaskTypeOptions = taskTypes?.map((option: any) =>
|
|
26
|
-
transformOption(option, 'type')
|
|
27
|
-
);
|
|
18
|
+
const orderFlagTypes = staticData?.[0]?.order_flag_types || [];
|
|
28
19
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
20
|
+
const taskTypeOptions = useMemo(
|
|
21
|
+
() =>
|
|
22
|
+
orderFlagTypes?.map((item: any) => ({
|
|
23
|
+
label: item?.type,
|
|
24
|
+
value: item?.id,
|
|
25
|
+
})),
|
|
26
|
+
[orderFlagTypes]
|
|
32
27
|
);
|
|
33
28
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
29
|
+
const getPriorityOptions = (staticData: any) => {
|
|
30
|
+
return staticData?.[0]?.priorities?.map((option: any) => {
|
|
31
|
+
const colorMatch = priorityData?.find(p => p.id === option.id);
|
|
32
|
+
return {
|
|
33
|
+
label: option.name,
|
|
34
|
+
value: option.id,
|
|
35
|
+
color: colorMatch?.color || '#ccc',
|
|
36
|
+
};
|
|
37
|
+
});
|
|
38
|
+
};
|
|
39
|
+
const priorityOptions = getPriorityOptions(staticData);
|
|
40
|
+
|
|
41
|
+
const handleTaskTypeChange = (value: number) => {
|
|
42
|
+
const selectedType =
|
|
43
|
+
orderFlagTypes.find((type: any) => type.id === value)?.type || '';
|
|
44
|
+
setTaskPayload(prev => ({ ...prev, flag_type: selectedType }));
|
|
37
45
|
};
|
|
38
46
|
|
|
39
|
-
const
|
|
40
|
-
|
|
47
|
+
const handlePriorityChange = (value: number) => {
|
|
48
|
+
setTaskPayload((prev: any) => ({
|
|
49
|
+
...prev,
|
|
50
|
+
priority: value,
|
|
51
|
+
}));
|
|
41
52
|
};
|
|
42
53
|
|
|
43
|
-
const
|
|
54
|
+
const selectedTypeId = useMemo(
|
|
55
|
+
() =>
|
|
56
|
+
orderFlagTypes.find((type: any) => type.type === taskPayload?.flag_type)
|
|
57
|
+
?.id ||
|
|
58
|
+
flagById?.flag_type ||
|
|
59
|
+
null,
|
|
60
|
+
[orderFlagTypes, taskPayload, flagById]
|
|
61
|
+
);
|
|
62
|
+
|
|
63
|
+
const isResolved = flagById?.status !== 'AD';
|
|
64
|
+
|
|
65
|
+
const resolvedText = `Resolved on ${formatDate(
|
|
66
|
+
flagById?.resolved_at || 'N/A'
|
|
67
|
+
)} by ${flagById?.resolved_by || 'N/A'}`;
|
|
44
68
|
|
|
45
69
|
return (
|
|
46
70
|
<Buttons>
|
|
47
71
|
<Flex>
|
|
48
72
|
<Label label="Type" />
|
|
49
|
-
<
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
...styles,
|
|
55
|
-
cursor: 'pointer',
|
|
56
|
-
padding: '0px',
|
|
57
|
-
width: '170px',
|
|
58
|
-
minHeight: '40px',
|
|
59
|
-
}),
|
|
60
|
-
container: styles => ({
|
|
61
|
-
...styles,
|
|
62
|
-
padding: '0px',
|
|
63
|
-
}),
|
|
64
|
-
}}
|
|
65
|
-
placeholder="Flag Type"
|
|
66
|
-
options={selectTaskTypeOptions}
|
|
67
|
-
value={selectTaskTypeOptions.filter(
|
|
68
|
-
(f: any) => f.value === payload.task_type_id
|
|
69
|
-
)}
|
|
70
|
-
onChange={onFlagtypeChange}
|
|
73
|
+
<StyledAntSelect
|
|
74
|
+
options={taskTypeOptions}
|
|
75
|
+
placeholder="Select Type"
|
|
76
|
+
onChange={handleTaskTypeChange}
|
|
77
|
+
value={selectedTypeId}
|
|
71
78
|
/>
|
|
72
79
|
</Flex>
|
|
73
80
|
<Flex>
|
|
74
81
|
<Label label="Priority" />
|
|
75
|
-
<
|
|
76
|
-
styles={{
|
|
77
|
-
...dropdownStyles,
|
|
78
|
-
...filterDropdownStyles,
|
|
79
|
-
control: styles => ({
|
|
80
|
-
...styles,
|
|
81
|
-
cursor: 'pointer',
|
|
82
|
-
padding: '0px',
|
|
83
|
-
width: '170px',
|
|
84
|
-
minHeight: '40px',
|
|
85
|
-
}),
|
|
86
|
-
container: styles => ({
|
|
87
|
-
...styles,
|
|
88
|
-
padding: '0px',
|
|
89
|
-
}),
|
|
90
|
-
}}
|
|
91
|
-
placeholder="Priority"
|
|
82
|
+
<StyledAntSelect
|
|
92
83
|
options={priorityOptions}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
onChange={onPriorityChange}
|
|
84
|
+
placeholder="Select Type"
|
|
85
|
+
onChange={handlePriorityChange}
|
|
86
|
+
value={taskPayload?.priority || flagById?.priority}
|
|
97
87
|
/>
|
|
98
88
|
</Flex>
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
<StatusIndicator text="Unresolved" status="AD" />
|
|
104
|
-
</Flex>
|
|
89
|
+
<Flex>
|
|
90
|
+
<Label label="Status" />
|
|
91
|
+
{isResolved ? (
|
|
92
|
+
<StatusIndicator text={resolvedText} status="SD" />
|
|
105
93
|
) : (
|
|
106
|
-
<
|
|
107
|
-
<Label label="Status" />
|
|
108
|
-
<StatusIndicator
|
|
109
|
-
text={`Resolved on ${formatDate(dataArray?.resolved_at)} by ${
|
|
110
|
-
dataArray?.resolved_by
|
|
111
|
-
}`}
|
|
112
|
-
status="SD"
|
|
113
|
-
/>
|
|
114
|
-
</Flex>
|
|
94
|
+
<StatusIndicator text="Unresolved" status="AD" />
|
|
115
95
|
)}
|
|
116
|
-
|
|
96
|
+
</Flex>
|
|
117
97
|
</Buttons>
|
|
118
98
|
);
|
|
119
99
|
}
|
|
100
|
+
export const StyledAntSelect: any = styled(Select)`
|
|
101
|
+
.ant-select-selector {
|
|
102
|
+
/* width: 22vw; */
|
|
103
|
+
border-radius: 22px;
|
|
104
|
+
}
|
|
105
|
+
`;
|
|
120
106
|
|
|
121
107
|
const Buttons = styled.div`
|
|
122
108
|
display: flex;
|
|
@@ -6,13 +6,13 @@ import {
|
|
|
6
6
|
CrossIcon,
|
|
7
7
|
useAxios,
|
|
8
8
|
} from '@bjsdistribution/dms-component-library';
|
|
9
|
-
import { useResolvedPayload,
|
|
9
|
+
import { useResolvedPayload, useFlagById } from '../order-actions/store';
|
|
10
10
|
import { useCurrentAction } from '../store';
|
|
11
|
-
import { notification } from 'antd';
|
|
12
11
|
import { ApiResponse } from '../types';
|
|
12
|
+
import { notification } from 'antd';
|
|
13
13
|
|
|
14
|
-
function HeaderSection({ callUnresolvedTaskApi }: any) {
|
|
15
|
-
const [
|
|
14
|
+
function HeaderSection({ callUnresolvedTaskApi, setTasksData }: any) {
|
|
15
|
+
const [flagById] = useFlagById();
|
|
16
16
|
const [forResolvedPayload, setPayload] = useResolvedPayload();
|
|
17
17
|
const [, setCurrentAction] = useCurrentAction();
|
|
18
18
|
const [isModalOpen, setIsModalOpen] = useState(false);
|
|
@@ -21,19 +21,17 @@ function HeaderSection({ callUnresolvedTaskApi }: any) {
|
|
|
21
21
|
const { fetchData: callFlagUpdateAPI } = useAxios<{
|
|
22
22
|
data: ApiResponse[];
|
|
23
23
|
}>({
|
|
24
|
-
endpoint: `/
|
|
24
|
+
endpoint: `/v1/task/resolve/`,
|
|
25
25
|
method: 'PUT',
|
|
26
26
|
});
|
|
27
27
|
|
|
28
28
|
useEffect(() => {
|
|
29
|
-
if (
|
|
29
|
+
if (flagById) {
|
|
30
30
|
setPayload({
|
|
31
|
-
|
|
32
|
-
is_resolved: true,
|
|
33
|
-
id: dataArray.id,
|
|
31
|
+
task_ids: [flagById?.id],
|
|
34
32
|
});
|
|
35
33
|
}
|
|
36
|
-
}, [
|
|
34
|
+
}, [flagById]);
|
|
37
35
|
|
|
38
36
|
const openModal = () => {
|
|
39
37
|
setIsModalOpen(true);
|
|
@@ -44,23 +42,33 @@ function HeaderSection({ callUnresolvedTaskApi }: any) {
|
|
|
44
42
|
};
|
|
45
43
|
|
|
46
44
|
const saveButton = async () => {
|
|
47
|
-
|
|
48
|
-
payload:
|
|
45
|
+
const response = (await callFlagUpdateAPI({
|
|
46
|
+
payload: forResolvedPayload,
|
|
49
47
|
})) as {
|
|
50
48
|
code: number | null;
|
|
51
|
-
error?: string | null
|
|
49
|
+
error?: string | null;
|
|
50
|
+
message?: string;
|
|
51
|
+
data?: any;
|
|
52
52
|
[key: string]: any;
|
|
53
53
|
};
|
|
54
|
-
|
|
54
|
+
|
|
55
|
+
if (response.code === 200 && response?.data) {
|
|
55
56
|
notification.success({
|
|
56
57
|
message: 'Success',
|
|
57
58
|
description: `${response?.message}`,
|
|
58
59
|
});
|
|
59
|
-
|
|
60
|
+
|
|
61
|
+
setIsModalOpen(false);
|
|
60
62
|
setCurrentAction(undefined);
|
|
61
|
-
|
|
63
|
+
|
|
64
|
+
// fetch tasks and update state
|
|
65
|
+
const unresolvedResponse = await callUnresolvedTaskApi();
|
|
66
|
+
if (unresolvedResponse && unresolvedResponse?.data) {
|
|
67
|
+
setTasksData(unresolvedResponse?.data);
|
|
68
|
+
}
|
|
62
69
|
}
|
|
63
|
-
|
|
70
|
+
|
|
71
|
+
if (response?.code == null && response?.error) {
|
|
64
72
|
return notification.error({
|
|
65
73
|
message: 'Failure',
|
|
66
74
|
description: `${response?.error}`,
|
|
@@ -72,10 +80,10 @@ function HeaderSection({ callUnresolvedTaskApi }: any) {
|
|
|
72
80
|
setCurrentAction(undefined);
|
|
73
81
|
};
|
|
74
82
|
|
|
75
|
-
const isShow =
|
|
83
|
+
const isShow = flagById?.status !== 'AD';
|
|
76
84
|
return (
|
|
77
85
|
<Header>
|
|
78
|
-
<Title>VIEW
|
|
86
|
+
<Title>VIEW TASK</Title>
|
|
79
87
|
{!isShow ? (
|
|
80
88
|
<ResolveButton onClick={openModal}>MARK AS RESOLVED</ResolveButton>
|
|
81
89
|
) : (
|
|
@@ -116,11 +124,12 @@ const CustomCancelAndCompleteAction = styled(CancelAndCompleteAction)`
|
|
|
116
124
|
|
|
117
125
|
const ResolveButton = styled.button`
|
|
118
126
|
color: #3a3630;
|
|
119
|
-
|
|
127
|
+
background: #feba30;
|
|
128
|
+
padding: 6px;
|
|
129
|
+
border-radius: 6px;
|
|
120
130
|
font-weight: 600;
|
|
121
|
-
|
|
122
|
-
border:
|
|
123
|
-
cursor: pointer;
|
|
131
|
+
font-size: 13px;
|
|
132
|
+
border: 1px solid #feba30;
|
|
124
133
|
`;
|
|
125
134
|
|
|
126
135
|
const Title = styled.span`
|