@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,222 +1,276 @@
|
|
|
1
|
-
import React, { useEffect
|
|
1
|
+
import React, { useEffect } from 'react';
|
|
2
2
|
import OrderActionModal from '../../../common/modals/order-action-modal/OrderActionModal';
|
|
3
|
+
import AssigneeDropdown from './AssigneeDropdown';
|
|
3
4
|
import { useCurrentAction } from '../store';
|
|
4
|
-
import { DatePickerWrap
|
|
5
|
-
import {
|
|
6
|
-
useReminderRefId,
|
|
7
|
-
useSingleReminderData,
|
|
8
|
-
useUpdateReminderData,
|
|
9
|
-
} from '../order-actions/store';
|
|
10
|
-
import StatusIndicator from '../flags-action-modal/StatusIndicator';
|
|
11
|
-
import styled from 'styled-components';
|
|
12
|
-
import { format, isValid } from 'date-fns';
|
|
13
|
-
import { DatePicker, notification } from 'antd';
|
|
14
|
-
import dayjs from 'dayjs';
|
|
5
|
+
import { DatePickerWrap } from '../order-actions/actions/modalstyle';
|
|
15
6
|
import {
|
|
16
7
|
ReferenceContainer,
|
|
17
|
-
StyledText,
|
|
18
|
-
StyledTime,
|
|
19
8
|
InnerContainer,
|
|
20
9
|
ContentsContainer,
|
|
21
10
|
Left,
|
|
22
|
-
Right,
|
|
23
11
|
DateTimeContainer,
|
|
24
12
|
Row,
|
|
25
13
|
DetailedContainer,
|
|
26
14
|
MiniContainer,
|
|
27
|
-
TimeWrapper,
|
|
28
15
|
} from './reminder-styles';
|
|
29
|
-
import
|
|
30
|
-
|
|
16
|
+
import {
|
|
17
|
+
useReminderRefId,
|
|
18
|
+
useReminderById,
|
|
19
|
+
useUpdateReminderData,
|
|
20
|
+
useReminderNotiData,
|
|
21
|
+
} from '../order-actions/store';
|
|
22
|
+
import StatusIndicator from '../flags-action-modal/StatusIndicator';
|
|
23
|
+
import styled from 'styled-components';
|
|
24
|
+
// import { isValid } from 'date-fns';
|
|
25
|
+
import { DatePicker, notification } from 'antd';
|
|
26
|
+
import dayjs from 'dayjs';
|
|
31
27
|
import { ApiResponse } from '../types';
|
|
28
|
+
import { Label, useAxios } from '@bjsdistribution/dms-component-library';
|
|
29
|
+
import { useReminderData } from '../../store';
|
|
32
30
|
|
|
33
|
-
|
|
31
|
+
export interface IProps {
|
|
32
|
+
callReminderApi: any;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const ViewReminderModal = (props: IProps) => {
|
|
34
36
|
const [, setCurrentAction] = useCurrentAction();
|
|
35
|
-
const [,
|
|
36
|
-
const [
|
|
37
|
+
const [reminderDataById, setReminderByIdData] = useReminderById();
|
|
38
|
+
const [reminderPayload, setReminderPayload] = useUpdateReminderData();
|
|
37
39
|
const [reminderRefId] = useReminderRefId();
|
|
38
|
-
const [
|
|
40
|
+
const [, setReminderUpdatedData] = useReminderNotiData();
|
|
41
|
+
const [, setReminderData] = useReminderData();
|
|
39
42
|
|
|
40
|
-
//reminder get
|
|
41
43
|
const {
|
|
42
|
-
data:
|
|
43
|
-
|
|
44
|
-
|
|
44
|
+
data: fetchedReminderInitialData,
|
|
45
|
+
fetchData: callReminderApiInitial,
|
|
46
|
+
loading,
|
|
45
47
|
} = useAxios<{
|
|
46
|
-
data:
|
|
48
|
+
data: any;
|
|
47
49
|
}>({
|
|
48
|
-
endpoint: `/
|
|
50
|
+
endpoint: `/v1/task/reminder/${reminderRefId}`,
|
|
49
51
|
method: 'GET',
|
|
50
52
|
pagination: { is_pagination: false },
|
|
51
|
-
filters: [{ field: 'order_id', op: '=', value: reminderRefId }],
|
|
53
|
+
// filters: [{ field: 'order_id', op: '=', value: reminderRefId }],
|
|
52
54
|
});
|
|
53
55
|
|
|
54
|
-
//use Axios Reminder
|
|
55
|
-
const { fetchData: callReminderEditAPI } = useAxios<{
|
|
56
|
-
data: ApiResponse[];
|
|
57
|
-
}>({
|
|
58
|
-
endpoint: `/tasks/reminder/update/`,
|
|
59
|
-
method: 'PUT',
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
const closeModal = () => {
|
|
63
|
-
setCurrentAction(undefined);
|
|
64
|
-
};
|
|
65
|
-
|
|
66
56
|
useEffect(() => {
|
|
67
|
-
if (
|
|
68
|
-
|
|
57
|
+
if (fetchedReminderInitialData && fetchedReminderInitialData?.data) {
|
|
58
|
+
const data = fetchedReminderInitialData?.data[0];
|
|
59
|
+
setReminderByIdData(data);
|
|
60
|
+
setReminderPayload(data);
|
|
69
61
|
}
|
|
70
|
-
}, [
|
|
62
|
+
}, [fetchedReminderInitialData, loading]);
|
|
71
63
|
|
|
72
64
|
useEffect(() => {
|
|
73
65
|
if (reminderRefId) {
|
|
74
|
-
|
|
66
|
+
callReminderApiInitial();
|
|
75
67
|
}
|
|
76
68
|
}, [reminderRefId]);
|
|
77
69
|
|
|
78
|
-
|
|
79
|
-
if (
|
|
80
|
-
|
|
70
|
+
const handleDateChange = (date: any | null) => {
|
|
71
|
+
if (date && date.isValid()) {
|
|
72
|
+
const selectedDate = date.toISOString();
|
|
73
|
+
|
|
74
|
+
setReminderPayload({
|
|
81
75
|
...reminderPayload,
|
|
82
|
-
|
|
83
|
-
id: reminderData?.id,
|
|
84
|
-
assigned_to: reminderData?.assigned_to,
|
|
85
|
-
due_date: reminderData?.due_date,
|
|
86
|
-
due_time: reminderData?.due_time,
|
|
87
|
-
status_id: reminderData?.status_id,
|
|
76
|
+
due_datetime: selectedDate,
|
|
88
77
|
});
|
|
89
|
-
setDueDate(reminderData?.due_date);
|
|
90
|
-
}
|
|
91
|
-
}, [reminderData]);
|
|
92
|
-
|
|
93
|
-
const handleDateChange = (date: any | null) => {
|
|
94
|
-
if (date && isValid(date.$d)) {
|
|
95
|
-
setDueDate(date);
|
|
96
|
-
const formattedDate = format(new Date(date.$d), 'yyyy-MM-dd');
|
|
97
|
-
|
|
98
|
-
setPayload((prevState: any) => ({
|
|
99
|
-
...prevState,
|
|
100
|
-
due_date: formattedDate,
|
|
101
|
-
}));
|
|
102
78
|
} else {
|
|
103
|
-
setDueDate(null);
|
|
104
|
-
setPayload((prevState: any) => ({
|
|
105
|
-
...prevState,
|
|
106
|
-
due_date: undefined,
|
|
107
|
-
}));
|
|
108
79
|
}
|
|
109
80
|
};
|
|
110
81
|
|
|
111
|
-
const
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
82
|
+
const { fetchData: callReminderEditAPI } = useAxios<{
|
|
83
|
+
data: ApiResponse[];
|
|
84
|
+
}>({
|
|
85
|
+
endpoint: `/v1/task/reminder/update/`,
|
|
86
|
+
method: 'PUT',
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
const closeModal = () => {
|
|
90
|
+
setCurrentAction(undefined);
|
|
116
91
|
};
|
|
117
92
|
|
|
118
93
|
const onChangeDetails = (event: React.ChangeEvent<HTMLTextAreaElement>) => {
|
|
119
|
-
|
|
94
|
+
const newDescription = event.target.value;
|
|
95
|
+
|
|
96
|
+
setReminderPayload({
|
|
120
97
|
...reminderPayload,
|
|
121
|
-
|
|
98
|
+
description: newDescription,
|
|
122
99
|
});
|
|
123
100
|
};
|
|
124
101
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
102
|
+
const handleStatusChange = (event: React.ChangeEvent<HTMLInputElement>) => {
|
|
103
|
+
const isChecked = event.target.checked;
|
|
104
|
+
setReminderPayload({
|
|
128
105
|
...reminderPayload,
|
|
129
|
-
|
|
106
|
+
status: isChecked,
|
|
130
107
|
});
|
|
131
108
|
};
|
|
132
109
|
|
|
133
110
|
const handleEditReminder = async () => {
|
|
134
111
|
try {
|
|
112
|
+
if (reminderDataById?.status === true) {
|
|
113
|
+
notification.info({
|
|
114
|
+
message: 'Info',
|
|
115
|
+
description:
|
|
116
|
+
'This flag has been set as resolved - changes are no longer permitted.',
|
|
117
|
+
});
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
// Destructure to remove unwanted fields
|
|
122
|
+
const {
|
|
123
|
+
is_deleted,
|
|
124
|
+
legacy_reminder_id,
|
|
125
|
+
order_data,
|
|
126
|
+
priority,
|
|
127
|
+
reference,
|
|
128
|
+
completed_at,
|
|
129
|
+
completed_by,
|
|
130
|
+
...cleanedPayload
|
|
131
|
+
} = reminderPayload;
|
|
132
|
+
|
|
133
|
+
cleanedPayload.id = reminderRefId;
|
|
134
|
+
cleanedPayload.order_id = reminderDataById?.order_id;
|
|
135
|
+
|
|
135
136
|
const apiResponse = (await callReminderEditAPI({
|
|
136
|
-
payload: [
|
|
137
|
+
payload: [cleanedPayload],
|
|
137
138
|
})) as {
|
|
138
139
|
code: number | null;
|
|
139
140
|
error?: string | null | undefined;
|
|
141
|
+
data?: any;
|
|
140
142
|
[key: string]: any;
|
|
141
143
|
};
|
|
142
|
-
|
|
144
|
+
|
|
145
|
+
if (apiResponse?.code === 200) {
|
|
146
|
+
if (apiResponse && apiResponse?.data) {
|
|
147
|
+
setReminderUpdatedData(apiResponse?.data);
|
|
148
|
+
setReminderData(apiResponse?.data);
|
|
149
|
+
props?.callReminderApi();
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
closeModal();
|
|
143
153
|
notification.success({
|
|
144
154
|
message: 'Success',
|
|
145
155
|
description: apiResponse.message,
|
|
146
156
|
});
|
|
147
|
-
callReminderApi();
|
|
148
|
-
closeModal();
|
|
149
157
|
} else {
|
|
150
158
|
notification.error({
|
|
151
159
|
message: 'Failure',
|
|
152
|
-
description:
|
|
160
|
+
description:
|
|
161
|
+
apiResponse?.error ||
|
|
162
|
+
'An error occurred while updating the reminder.',
|
|
153
163
|
});
|
|
154
164
|
}
|
|
155
165
|
} catch (error) {
|
|
166
|
+
const err = error as any;
|
|
167
|
+
const errMsg =
|
|
168
|
+
err?.response?.data?.error ||
|
|
169
|
+
err?.response?.data?.message ||
|
|
170
|
+
err?.message ||
|
|
171
|
+
'An unexpected error occurred.';
|
|
172
|
+
|
|
156
173
|
notification.error({
|
|
157
|
-
message: '
|
|
158
|
-
description:
|
|
174
|
+
message: 'Request Failed',
|
|
175
|
+
description: errMsg,
|
|
159
176
|
});
|
|
160
177
|
}
|
|
161
178
|
};
|
|
162
179
|
|
|
163
|
-
const
|
|
180
|
+
const hasReminderChanged = () => {
|
|
181
|
+
if (!reminderDataById || !reminderPayload) return false;
|
|
182
|
+
|
|
183
|
+
const original = {
|
|
184
|
+
due_datetime: reminderDataById?.due_datetime,
|
|
185
|
+
assigned_to: reminderDataById?.assigned_to,
|
|
186
|
+
description: reminderDataById?.description?.trim(),
|
|
187
|
+
department: reminderDataById?.department,
|
|
188
|
+
status: reminderDataById?.status,
|
|
189
|
+
};
|
|
190
|
+
|
|
191
|
+
const updated = {
|
|
192
|
+
due_datetime: reminderPayload?.due_datetime,
|
|
193
|
+
assigned_to: reminderPayload?.assigned_to,
|
|
194
|
+
description: reminderPayload?.description?.trim(),
|
|
195
|
+
department: reminderPayload?.department,
|
|
196
|
+
status: reminderPayload?.status,
|
|
197
|
+
};
|
|
198
|
+
|
|
199
|
+
const baseChanged =
|
|
200
|
+
original?.due_datetime !== updated?.due_datetime ||
|
|
201
|
+
original?.assigned_to !== updated?.assigned_to ||
|
|
202
|
+
original?.description !== updated?.description ||
|
|
203
|
+
original?.status !== updated?.status;
|
|
204
|
+
|
|
205
|
+
const shouldCompareDept =
|
|
206
|
+
original.department !== undefined && updated?.department !== undefined;
|
|
207
|
+
|
|
208
|
+
const departmentChanged = shouldCompareDept
|
|
209
|
+
? original.department !== updated?.department
|
|
210
|
+
: false;
|
|
211
|
+
|
|
212
|
+
return baseChanged || departmentChanged;
|
|
213
|
+
};
|
|
214
|
+
|
|
215
|
+
const isDisabled =
|
|
216
|
+
!reminderPayload?.assigned_to?.length ||
|
|
217
|
+
!reminderPayload?.description?.trim() ||
|
|
218
|
+
!reminderPayload?.due_datetime ||
|
|
219
|
+
!hasReminderChanged() ||
|
|
220
|
+
reminderDataById?.status === true;
|
|
164
221
|
|
|
165
222
|
const additional =
|
|
166
|
-
|
|
223
|
+
reminderDataById?.order_data?.order_recipient?.recipient_name +
|
|
167
224
|
' ' +
|
|
168
|
-
|
|
225
|
+
reminderDataById?.order_data?.order_recipient?.postcode;
|
|
226
|
+
|
|
227
|
+
const disabled = reminderDataById?.status === true;
|
|
169
228
|
|
|
170
229
|
return (
|
|
171
230
|
<>
|
|
172
|
-
{
|
|
231
|
+
{reminderDataById && (
|
|
173
232
|
<OrderActionModal
|
|
174
233
|
headerTitle="View Reminder"
|
|
175
234
|
onCloseHeader={closeModal}
|
|
176
235
|
onSubmit={handleEditReminder}
|
|
177
236
|
submitBtnTitle="Save Details"
|
|
178
|
-
isSubmitDisabled={isDisabled}
|
|
179
|
-
showAdditionalInfo
|
|
180
237
|
infoText={additional || 'NA'}
|
|
238
|
+
isSubmitDisabled={isDisabled || disabled}
|
|
181
239
|
headerActions={
|
|
182
240
|
<OuterDiv>
|
|
183
|
-
{
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
) : null}
|
|
241
|
+
{reminderDataById?.status === false && (
|
|
242
|
+
<StyledWrapper>
|
|
243
|
+
<StyledLabel>
|
|
244
|
+
<StyledCheckbox>
|
|
245
|
+
<input
|
|
246
|
+
type="checkbox"
|
|
247
|
+
onChange={handleStatusChange}
|
|
248
|
+
checked={reminderPayload?.status || false}
|
|
249
|
+
disabled={disabled}
|
|
250
|
+
/>
|
|
251
|
+
<RoundCheckbox />
|
|
252
|
+
</StyledCheckbox>
|
|
253
|
+
<StyledSpan>Mark As Complete</StyledSpan>
|
|
254
|
+
</StyledLabel>
|
|
255
|
+
</StyledWrapper>
|
|
256
|
+
)}
|
|
200
257
|
</OuterDiv>
|
|
201
258
|
}
|
|
202
259
|
>
|
|
203
|
-
<ReferenceContainer
|
|
260
|
+
<ReferenceContainer>
|
|
204
261
|
<InnerContainer>
|
|
205
262
|
<MiniContainer>
|
|
206
|
-
|
|
207
|
-
<
|
|
208
|
-
<LabelText>{reminderData?.reference || 'N/A'}</LabelText>
|
|
263
|
+
<Label label="Reference" required />
|
|
264
|
+
<LabelText>{reminderDataById?.reference || 'N/A'}</LabelText>
|
|
209
265
|
</MiniContainer>
|
|
210
266
|
<MiniContainer>
|
|
211
|
-
|
|
212
|
-
<Label>Status </Label>
|
|
267
|
+
<Label label="Status" />
|
|
213
268
|
<LabelText>
|
|
214
|
-
{
|
|
215
|
-
reminderData?.reminder_status?.name_alias === 'unresolved' ? (
|
|
269
|
+
{reminderDataById?.status === false ? (
|
|
216
270
|
<StatusIndicator text="Incomplete" status="AD" />
|
|
217
271
|
) : (
|
|
218
272
|
<StatusIndicator
|
|
219
|
-
text={`Completed on ${
|
|
273
|
+
text={`Completed on ${reminderDataById?.completed_at} by ${reminderDataById?.completed_by}`}
|
|
220
274
|
status="SD"
|
|
221
275
|
/>
|
|
222
276
|
)}
|
|
@@ -224,46 +278,53 @@ const ViewReminderModal = () => {
|
|
|
224
278
|
</MiniContainer>
|
|
225
279
|
</InnerContainer>
|
|
226
280
|
</ReferenceContainer>
|
|
281
|
+
|
|
227
282
|
<ContentsContainer>
|
|
228
283
|
<Left>
|
|
229
284
|
<AssigneeDropdown />
|
|
230
285
|
<DateTimeContainer>
|
|
231
|
-
<Label
|
|
286
|
+
<Label label="Due Date & Time" required />
|
|
232
287
|
<Row>
|
|
233
288
|
<StyleContainer>
|
|
234
289
|
<DatePickerWrap>
|
|
235
290
|
<DatePicker
|
|
236
|
-
format="DD/MM/YYYY"
|
|
291
|
+
format="DD/MM/YYYY HH:mm A"
|
|
237
292
|
value={
|
|
238
|
-
reminderPayload?.
|
|
239
|
-
? dayjs(reminderPayload?.
|
|
293
|
+
reminderPayload?.due_datetime
|
|
294
|
+
? dayjs(reminderPayload?.due_datetime)
|
|
295
|
+
: reminderDataById?.due_datetime
|
|
296
|
+
? dayjs(reminderDataById?.due_datetime)
|
|
240
297
|
: null
|
|
241
298
|
}
|
|
242
299
|
onChange={handleDateChange}
|
|
300
|
+
placeholder="Select Date & Time"
|
|
301
|
+
showTime={{ defaultValue: dayjs('00:00', 'HH:mm') }}
|
|
302
|
+
disabledDate={current =>
|
|
303
|
+
current && current < dayjs().startOf('day')
|
|
304
|
+
}
|
|
305
|
+
disabledTime={date => getDisabledTime(date)}
|
|
306
|
+
disabled={disabled}
|
|
243
307
|
/>
|
|
244
308
|
</DatePickerWrap>
|
|
245
309
|
</StyleContainer>
|
|
246
|
-
|
|
247
|
-
<TimeWrapper>
|
|
248
|
-
<StyledTime
|
|
249
|
-
onChange={handleTime}
|
|
250
|
-
value={reminderPayload?.due_time}
|
|
251
|
-
type="time"
|
|
252
|
-
/>
|
|
253
|
-
</TimeWrapper>
|
|
254
310
|
</Row>
|
|
255
311
|
</DateTimeContainer>
|
|
256
312
|
</Left>
|
|
313
|
+
|
|
257
314
|
<Right>
|
|
258
|
-
<
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
315
|
+
<Label label="Details" required />
|
|
316
|
+
<DetailedContainer
|
|
317
|
+
placeholder="Enter Description..."
|
|
318
|
+
name="text"
|
|
319
|
+
required
|
|
320
|
+
value={
|
|
321
|
+
reminderPayload?.description ||
|
|
322
|
+
reminderDataById?.description ||
|
|
323
|
+
''
|
|
324
|
+
}
|
|
325
|
+
disabled={disabled}
|
|
326
|
+
onChange={onChangeDetails}
|
|
327
|
+
></DetailedContainer>
|
|
267
328
|
</Right>
|
|
268
329
|
</ContentsContainer>
|
|
269
330
|
</OrderActionModal>
|
|
@@ -272,6 +333,35 @@ const ViewReminderModal = () => {
|
|
|
272
333
|
);
|
|
273
334
|
};
|
|
274
335
|
|
|
336
|
+
const getDisabledTime = (date: any) => {
|
|
337
|
+
if (date && date.isSame(dayjs(), 'day')) {
|
|
338
|
+
const currentHour = dayjs().hour();
|
|
339
|
+
const currentMinute = dayjs().minute();
|
|
340
|
+
return {
|
|
341
|
+
disabledHours: () =>
|
|
342
|
+
Array.from({ length: 24 }, (_, i) => i).filter(
|
|
343
|
+
hour => hour < currentHour
|
|
344
|
+
),
|
|
345
|
+
disabledMinutes: (selectedHour: number) => {
|
|
346
|
+
if (selectedHour === currentHour) {
|
|
347
|
+
return Array.from({ length: 60 }, (_, i) => i).filter(
|
|
348
|
+
minute => minute < currentMinute
|
|
349
|
+
);
|
|
350
|
+
}
|
|
351
|
+
return [];
|
|
352
|
+
},
|
|
353
|
+
};
|
|
354
|
+
}
|
|
355
|
+
return {};
|
|
356
|
+
};
|
|
357
|
+
|
|
358
|
+
export const Right = styled.div`
|
|
359
|
+
display: flex;
|
|
360
|
+
height: 100%;
|
|
361
|
+
gap: 15px;
|
|
362
|
+
flex-direction: column;
|
|
363
|
+
padding: 10px;
|
|
364
|
+
`;
|
|
275
365
|
const StyleContainer = styled.div`
|
|
276
366
|
border-radius: 20px;
|
|
277
367
|
background: #fff;
|
|
@@ -350,4 +440,5 @@ const LabelText = styled.span`
|
|
|
350
440
|
font-weight: 400;
|
|
351
441
|
line-height: 16px;
|
|
352
442
|
`;
|
|
443
|
+
|
|
353
444
|
export default ViewReminderModal;
|
|
@@ -2,19 +2,17 @@ import { TextArea, Input } from '@bjsdistribution/dms-component-library';
|
|
|
2
2
|
import styled from 'styled-components';
|
|
3
3
|
export const ReferenceContainer = styled.div`
|
|
4
4
|
display: flex;
|
|
5
|
-
height: 52px;
|
|
6
5
|
width: 770px;
|
|
7
|
-
padding: 10px 15px;
|
|
8
6
|
align-items: center;
|
|
9
7
|
flex: 1 0 0;
|
|
10
8
|
border-radius: 40px;
|
|
11
9
|
border: 1px solid rgba(0, 0, 0, 0.1);
|
|
12
10
|
background: #fff;
|
|
11
|
+
margin-top: 15px;
|
|
13
12
|
`;
|
|
14
13
|
export const InnerContainer = styled.div`
|
|
15
14
|
display: flex;
|
|
16
|
-
|
|
17
|
-
padding: 10px 15px;
|
|
15
|
+
padding: 5px 15px;
|
|
18
16
|
align-items: center;
|
|
19
17
|
gap: 20px;
|
|
20
18
|
flex: 1 0 0;
|
|
@@ -133,7 +131,7 @@ export const DateTimeContainer = styled.div`
|
|
|
133
131
|
display: flex;
|
|
134
132
|
flex-direction: column;
|
|
135
133
|
align-items: flex-start;
|
|
136
|
-
gap:
|
|
134
|
+
gap: 5px;
|
|
137
135
|
align-self: stretch;
|
|
138
136
|
`;
|
|
139
137
|
export const AssigneeContainer = styled.div`
|
|
@@ -147,17 +145,25 @@ export const AssigneeContainer = styled.div`
|
|
|
147
145
|
border-radius: 15px;
|
|
148
146
|
background: #f8fafc;
|
|
149
147
|
`;
|
|
150
|
-
export const DetailedContainer = styled.
|
|
148
|
+
export const DetailedContainer = styled.textarea<{ disabled?: boolean }>`
|
|
151
149
|
display: flex;
|
|
152
150
|
width: 416px;
|
|
153
151
|
padding: 15px 12px;
|
|
154
152
|
flex-direction: column;
|
|
155
153
|
justify-content: center;
|
|
156
154
|
align-items: flex-start;
|
|
157
|
-
gap:
|
|
155
|
+
gap: 5px;
|
|
158
156
|
flex: 1 0 0;
|
|
159
|
-
border-radius:
|
|
157
|
+
border-radius: 14px;
|
|
160
158
|
background: #f8fafc;
|
|
159
|
+
background: ${({ disabled }) => (disabled ? 'rgba(0, 0, 0, 0.04)' : '#fff')};
|
|
160
|
+
color: ${({ disabled }) => (disabled ? '#666' : '#000')};
|
|
161
|
+
pointer-events: ${({ disabled }) => (disabled ? 'none' : 'auto')};
|
|
162
|
+
font-family: 'Lato', sans-serif;
|
|
163
|
+
min-height: 170px;
|
|
164
|
+
&::placeholder {
|
|
165
|
+
color: #aaa;
|
|
166
|
+
}
|
|
161
167
|
`;
|
|
162
168
|
export const ContentsContainer = styled(Column)`
|
|
163
169
|
display: flex;
|
package/src/components/store.ts
CHANGED
|
@@ -209,6 +209,11 @@ export function useNewReturnOrderData() {
|
|
|
209
209
|
return useAtom(newReturnOrderData);
|
|
210
210
|
}
|
|
211
211
|
|
|
212
|
+
const isClientPortalAtom = atom<boolean>(false);
|
|
213
|
+
function useClientPortal() {
|
|
214
|
+
return useAtom(isClientPortalAtom);
|
|
215
|
+
}
|
|
216
|
+
|
|
212
217
|
export {
|
|
213
218
|
useAtom,
|
|
214
219
|
useFilter,
|
|
@@ -239,4 +244,5 @@ export {
|
|
|
239
244
|
useLocationOptions,
|
|
240
245
|
useSelectedProducts,
|
|
241
246
|
useVisibilityData,
|
|
247
|
+
useClientPortal,
|
|
242
248
|
};
|
package/src/index.tsx
CHANGED
|
@@ -13,13 +13,17 @@ import {
|
|
|
13
13
|
useActionType,
|
|
14
14
|
useActionTypeOptions,
|
|
15
15
|
useAssignData,
|
|
16
|
-
|
|
16
|
+
useClientPortal,
|
|
17
17
|
useLocationData,
|
|
18
18
|
useStatusOrderData,
|
|
19
|
+
useVisibilityData,
|
|
19
20
|
} from './components/store';
|
|
20
21
|
import { ApiResponse } from './components/types';
|
|
21
22
|
import { useApiHook } from '@bjsdistribution/dms-component-library';
|
|
22
|
-
import {
|
|
23
|
+
import {
|
|
24
|
+
useLocationOptions,
|
|
25
|
+
useOrderStaticData,
|
|
26
|
+
} from './components/order-view/store';
|
|
23
27
|
import OrderViewQueryHandler from './OrderViewQueryHandler';
|
|
24
28
|
import OrderView from './components/order-view';
|
|
25
29
|
function ReturnClient() {
|
|
@@ -27,7 +31,6 @@ function ReturnClient() {
|
|
|
27
31
|
top: 80,
|
|
28
32
|
});
|
|
29
33
|
const LoadingMessage = () => <div>Loading...</div>;
|
|
30
|
-
const [, setCustomers] = useCustomerData();
|
|
31
34
|
const [, setActionType] = useActionType();
|
|
32
35
|
const [, setLocationData] = useLocationData();
|
|
33
36
|
const [, setStatusOfOrders] = useStatusOrderData();
|
|
@@ -38,6 +41,16 @@ function ReturnClient() {
|
|
|
38
41
|
const [, setSelectedClient] = useSelectedClient();
|
|
39
42
|
const [searchParams] = useSearchParams();
|
|
40
43
|
const [, setSelectedLocationValue] = useSelectedLocation();
|
|
44
|
+
const [, setVisibilityData] = useVisibilityData();
|
|
45
|
+
const [, setOrderStaticData] = useOrderStaticData();
|
|
46
|
+
const [, setClientPortal] = useClientPortal();
|
|
47
|
+
|
|
48
|
+
const userType = JSON.parse(localStorage.getItem('user_type')!);
|
|
49
|
+
|
|
50
|
+
useEffect(() => {
|
|
51
|
+
setClientPortal(userType?.is_customer || false); // change it to false bydefault
|
|
52
|
+
}, []);
|
|
53
|
+
|
|
41
54
|
const splitPath = (str: any) => {
|
|
42
55
|
const parts = str?.split('/')?.filter((part: any) => part !== ''); // Filter out empty parts
|
|
43
56
|
return parts;
|
|
@@ -54,15 +67,6 @@ function ReturnClient() {
|
|
|
54
67
|
}
|
|
55
68
|
}, [location.pathname, searchParams]);
|
|
56
69
|
|
|
57
|
-
//API for client data
|
|
58
|
-
const { data: fetchedCustomerData, loading: loading } = useApiHook<
|
|
59
|
-
ApiResponse
|
|
60
|
-
>({
|
|
61
|
-
endpoint: `/return_orders/customers/`,
|
|
62
|
-
method: 'GET',
|
|
63
|
-
//@ts-ignore
|
|
64
|
-
pagination: { is_pagination: false },
|
|
65
|
-
});
|
|
66
70
|
//API for action type
|
|
67
71
|
const { data: fetchedStaticData, loading: actionLoading } = useApiHook<
|
|
68
72
|
ApiResponse
|
|
@@ -79,20 +83,26 @@ function ReturnClient() {
|
|
|
79
83
|
//@ts-ignore
|
|
80
84
|
pagination: { is_pagination: false },
|
|
81
85
|
});
|
|
82
|
-
|
|
83
|
-
if (fetchedCustomerData && fetchedCustomerData?.data) {
|
|
84
|
-
setCustomers(fetchedCustomerData?.data);
|
|
85
|
-
}
|
|
86
|
-
}, [loading]);
|
|
86
|
+
|
|
87
87
|
useEffect(() => {
|
|
88
88
|
if (fetchedStaticData && fetchedStaticData?.data) {
|
|
89
|
+
const result = fetchedStaticData?.data;
|
|
90
|
+
setOrderStaticData(result[0]);
|
|
91
|
+
setVisibilityData(
|
|
92
|
+
fetchedStaticData?.data?.flatMap(
|
|
93
|
+
(i: any) => i?.resource_visibility_type
|
|
94
|
+
)
|
|
95
|
+
);
|
|
96
|
+
|
|
89
97
|
setActionType(
|
|
90
98
|
fetchedStaticData?.data?.flatMap(
|
|
91
99
|
(i: any) => i?.order_product_return_action
|
|
92
100
|
)
|
|
93
101
|
);
|
|
102
|
+
|
|
103
|
+
//for status of return orders key changes
|
|
94
104
|
setStatusOfOrders(
|
|
95
|
-
fetchedStaticData?.data?.flatMap((i: any) => i?.
|
|
105
|
+
fetchedStaticData?.data?.flatMap((i: any) => i?.return_order_status)
|
|
96
106
|
);
|
|
97
107
|
setAssignData(
|
|
98
108
|
fetchedStaticData?.data?.flatMap((i: any) => i?.assign_client)
|