@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,7 +1,16 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useEffect } from 'react';
|
|
2
2
|
import AddResources from './actions/add-resources';
|
|
3
3
|
import styled from 'styled-components';
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
useCurrentAction,
|
|
6
|
+
useOrderAlertsData,
|
|
7
|
+
useOrderDetails,
|
|
8
|
+
useOrderId,
|
|
9
|
+
usePrevOrderDetails,
|
|
10
|
+
useProductDetails,
|
|
11
|
+
useProductDetailsCopy,
|
|
12
|
+
useStatusDetails,
|
|
13
|
+
} from '../store';
|
|
5
14
|
import SplitOrder from './actions/split-order';
|
|
6
15
|
import LogServiceRefusal from './actions/log-service-refusal';
|
|
7
16
|
import CancelOrder from './actions/cancel-order';
|
|
@@ -10,20 +19,189 @@ import SendSmsModal from './actions/send-sms/SendSmsModal';
|
|
|
10
19
|
import SendEmailModal from './actions/send-email/SendEmailModal';
|
|
11
20
|
import ChangeCustomerAccModal from './actions/change-customer-account/ChangeCustomerAccModal';
|
|
12
21
|
import HoldOrderModal from './actions/hold-order/HoldOrderModal';
|
|
13
|
-
import LogFeedback from './actions/log-feedback/LogFeedback';
|
|
14
22
|
import UnholdOrder from './actions/unhold-order/UnholdOrder';
|
|
15
|
-
import
|
|
16
|
-
import OrderLock from './actions/order-lock';
|
|
23
|
+
import ViewReminderModal from '../view-reminder/ViewReminder';
|
|
24
|
+
// import OrderLock from './actions/order-lock';
|
|
17
25
|
import ViewFlag from '../flags-action-modal/index';
|
|
18
26
|
import ReleaseOrder from './actions/release-order/ReleaseOrder';
|
|
19
|
-
import UncancelOrder from './actions/uncancel-order/UncancelOrder';
|
|
20
27
|
import ClearBookingStatus from './actions/clear-booking-status/ClearBookingStatus';
|
|
28
|
+
import UncancelOrder from './actions/uncancel-order/UncancelOrder';
|
|
21
29
|
import RemoveFromRoute from './actions/remove-from-route/RemoveFromRoute';
|
|
30
|
+
import { useAxios } from '@bjsdistribution/dms-component-library';
|
|
31
|
+
import { ApiResponse, OrdersType } from '../types';
|
|
32
|
+
import { useLoading } from '../../order-daily-overview/store/store';
|
|
33
|
+
import { useReminderNotiData, useTasksData } from './store';
|
|
34
|
+
import ChargeLog from './actions/charge-log';
|
|
35
|
+
import ReminderModal from './actions/create-task-reminder';
|
|
22
36
|
import TaskModal from './actions/create-task-reminder/TaskModal';
|
|
23
|
-
import ViewReminderModal from '../view-reminder/ViewReminder';
|
|
24
37
|
|
|
25
38
|
function OrderActions() {
|
|
26
|
-
const [currentAction] = useCurrentAction();
|
|
39
|
+
const [currentAction, setCurrentAction] = useCurrentAction();
|
|
40
|
+
const [orderId] = useOrderId();
|
|
41
|
+
const [, setOrderDetails] = useOrderDetails();
|
|
42
|
+
const [, setPrevOrderDetails] = usePrevOrderDetails();
|
|
43
|
+
const [, setOrderStatus] = useStatusDetails();
|
|
44
|
+
const [, setOrderAlertsData] = useOrderAlertsData();
|
|
45
|
+
const [, setProductDetails] = useProductDetails();
|
|
46
|
+
const [, setProductDetailsCopy] = useProductDetailsCopy();
|
|
47
|
+
const [, setLoading] = useLoading();
|
|
48
|
+
const [, setTasksData] = useTasksData();
|
|
49
|
+
const [, setReminderNotifyData] = useReminderNotiData();
|
|
50
|
+
|
|
51
|
+
// call orders api
|
|
52
|
+
|
|
53
|
+
const { fetchData: callOrdersApi, loading, data: fetchedData } = useAxios<{
|
|
54
|
+
data: OrdersType[];
|
|
55
|
+
}>({
|
|
56
|
+
endpoint: `/orders/${orderId}`,
|
|
57
|
+
method: 'GET',
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
useEffect(() => {
|
|
61
|
+
setLoading(loading);
|
|
62
|
+
if (fetchedData && fetchedData?.data) {
|
|
63
|
+
const requiredData = fetchedData?.data;
|
|
64
|
+
setOrderDetails(requiredData[0]);
|
|
65
|
+
setPrevOrderDetails(requiredData[0]);
|
|
66
|
+
setCurrentAction(undefined);
|
|
67
|
+
}
|
|
68
|
+
if (
|
|
69
|
+
(fetchedData && fetchedData?.data === null) ||
|
|
70
|
+
fetchedData?.data?.length === 0
|
|
71
|
+
) {
|
|
72
|
+
setCurrentAction(undefined);
|
|
73
|
+
}
|
|
74
|
+
}, [loading]);
|
|
75
|
+
|
|
76
|
+
// orders api ends
|
|
77
|
+
|
|
78
|
+
// call order products api start
|
|
79
|
+
|
|
80
|
+
const {
|
|
81
|
+
data: productsData,
|
|
82
|
+
loading: orderProductsLoading,
|
|
83
|
+
fetchData: callOrderProductsApi,
|
|
84
|
+
} = useAxios<{
|
|
85
|
+
data: ApiResponse[];
|
|
86
|
+
}>({
|
|
87
|
+
endpoint: `/order/order_products/${orderId}`,
|
|
88
|
+
method: 'GET',
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
useEffect(() => {
|
|
92
|
+
if (productsData && productsData?.data?.length > 0) {
|
|
93
|
+
setProductDetails(productsData?.data);
|
|
94
|
+
setProductDetailsCopy(productsData?.data);
|
|
95
|
+
} else {
|
|
96
|
+
setProductDetails(null);
|
|
97
|
+
setProductDetailsCopy(null);
|
|
98
|
+
}
|
|
99
|
+
}, [orderProductsLoading]);
|
|
100
|
+
|
|
101
|
+
// call order products api end
|
|
102
|
+
|
|
103
|
+
// call alerts api
|
|
104
|
+
|
|
105
|
+
const {
|
|
106
|
+
data: alertsData,
|
|
107
|
+
fetchData: callOrderAlertsApi,
|
|
108
|
+
loading: alertsApiLoading,
|
|
109
|
+
} = useAxios<{
|
|
110
|
+
data: ApiResponse[];
|
|
111
|
+
}>({
|
|
112
|
+
endpoint: `v1/orders/alerts/?order_id=${orderId}`,
|
|
113
|
+
method: 'GET',
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
useEffect(() => {
|
|
117
|
+
if (alertsData && alertsData?.data) {
|
|
118
|
+
setOrderAlertsData(alertsData?.data);
|
|
119
|
+
}
|
|
120
|
+
}, [alertsApiLoading]);
|
|
121
|
+
|
|
122
|
+
// alerts api ends
|
|
123
|
+
|
|
124
|
+
// call live status api
|
|
125
|
+
|
|
126
|
+
const {
|
|
127
|
+
fetchData: fetchStatusData,
|
|
128
|
+
data: statusData,
|
|
129
|
+
loading: statusDataLoading,
|
|
130
|
+
} = useAxios<{
|
|
131
|
+
data: ApiResponse[];
|
|
132
|
+
}>({
|
|
133
|
+
endpoint: `/orders/get_live_status/${orderId}`,
|
|
134
|
+
method: 'GET',
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
useEffect(() => {
|
|
138
|
+
if (statusData && statusData?.data) {
|
|
139
|
+
setOrderStatus(statusData?.data);
|
|
140
|
+
}
|
|
141
|
+
}, [statusDataLoading]);
|
|
142
|
+
|
|
143
|
+
// Call Task Get Api
|
|
144
|
+
const {
|
|
145
|
+
fetchData: callUnresolvedTaskApi,
|
|
146
|
+
data: fetchedUnresolvedData,
|
|
147
|
+
loading: unresolvedLoading,
|
|
148
|
+
} = useAxios<{
|
|
149
|
+
data: ApiResponse[];
|
|
150
|
+
}>({
|
|
151
|
+
endpoint: `/v1/task/`,
|
|
152
|
+
method: 'GET',
|
|
153
|
+
pagination: { is_pagination: false },
|
|
154
|
+
filters: [{ field: 'order_id', op: '=', value: orderId }],
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
useEffect(() => {
|
|
158
|
+
if (fetchedUnresolvedData && fetchedUnresolvedData?.data) {
|
|
159
|
+
setTasksData(fetchedUnresolvedData?.data);
|
|
160
|
+
}
|
|
161
|
+
}, [unresolvedLoading]);
|
|
162
|
+
|
|
163
|
+
// Task Api Ends
|
|
164
|
+
|
|
165
|
+
// reminder api starts here
|
|
166
|
+
|
|
167
|
+
//reminder get
|
|
168
|
+
const {
|
|
169
|
+
data: fetchedReminderData,
|
|
170
|
+
loading: reminderLoading,
|
|
171
|
+
fetchData: callReminderApi,
|
|
172
|
+
} = useAxios<{
|
|
173
|
+
data: ApiResponse[];
|
|
174
|
+
}>({
|
|
175
|
+
endpoint: `/v1/task/reminder/get/`,
|
|
176
|
+
method: 'GET',
|
|
177
|
+
pagination: { is_pagination: false },
|
|
178
|
+
filters: [{ field: 'order_id', op: '=', value: orderId }],
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
useEffect(() => {
|
|
182
|
+
if (fetchedReminderData && fetchedReminderData?.data) {
|
|
183
|
+
setReminderNotifyData(fetchedReminderData?.data);
|
|
184
|
+
const filteredReminders = fetchedReminderData?.data?.filter(
|
|
185
|
+
(reminder: any) => reminder?.status === false
|
|
186
|
+
);
|
|
187
|
+
|
|
188
|
+
const filteredOverDueReminders = fetchedReminderData?.data?.filter(
|
|
189
|
+
(reminder: any) =>
|
|
190
|
+
reminder?.status === false &&
|
|
191
|
+
new Date(reminder?.due_datetime).getTime() < new Date().getTime()
|
|
192
|
+
);
|
|
193
|
+
|
|
194
|
+
// Store them correctly in localStorage
|
|
195
|
+
localStorage.setItem(
|
|
196
|
+
'filteredRemindersCount',
|
|
197
|
+
JSON.stringify(filteredReminders?.length)
|
|
198
|
+
);
|
|
199
|
+
localStorage.setItem(
|
|
200
|
+
'filteredOverDueReminders',
|
|
201
|
+
JSON.stringify(filteredOverDueReminders?.length)
|
|
202
|
+
);
|
|
203
|
+
}
|
|
204
|
+
}, [reminderLoading]);
|
|
27
205
|
|
|
28
206
|
const renderContent = () => {
|
|
29
207
|
switch (currentAction) {
|
|
@@ -36,11 +214,25 @@ function OrderActions() {
|
|
|
36
214
|
// case 'unrelease-order':
|
|
37
215
|
// return <UnreleaseOrder />;
|
|
38
216
|
case 'log-service-refusal':
|
|
39
|
-
return <LogServiceRefusal />;
|
|
217
|
+
return <LogServiceRefusal callOrdersApi={callOrdersApi} />;
|
|
40
218
|
case 'cancel-order':
|
|
41
|
-
return
|
|
219
|
+
return (
|
|
220
|
+
<CancelOrder
|
|
221
|
+
callOrdersApi={callOrdersApi}
|
|
222
|
+
callOrderStatusApi={fetchStatusData}
|
|
223
|
+
callOrderAlertsApi={callOrderAlertsApi}
|
|
224
|
+
callOrderProductsApi={callOrderProductsApi}
|
|
225
|
+
/>
|
|
226
|
+
);
|
|
42
227
|
case 'uncancel-order':
|
|
43
|
-
return
|
|
228
|
+
return (
|
|
229
|
+
<UncancelOrder
|
|
230
|
+
callOrdersApi={callOrdersApi}
|
|
231
|
+
callOrderStatusApi={fetchStatusData}
|
|
232
|
+
callOrderAlertsApi={callOrderAlertsApi}
|
|
233
|
+
callOrderProductsApi={callOrderProductsApi}
|
|
234
|
+
/>
|
|
235
|
+
);
|
|
44
236
|
case 'confirm-order':
|
|
45
237
|
return <ConfirmOrder />;
|
|
46
238
|
case 'send-sms':
|
|
@@ -48,21 +240,44 @@ function OrderActions() {
|
|
|
48
240
|
case 'send-email':
|
|
49
241
|
return <SendEmailModal />;
|
|
50
242
|
case 'change-customer-account':
|
|
51
|
-
return <ChangeCustomerAccModal />;
|
|
243
|
+
return <ChangeCustomerAccModal callOrdersApi={callOrdersApi} />;
|
|
244
|
+
|
|
52
245
|
case 'hold-order':
|
|
53
|
-
return
|
|
246
|
+
return (
|
|
247
|
+
<HoldOrderModal
|
|
248
|
+
callOrdersApi={callOrdersApi}
|
|
249
|
+
callOrderAlertsApi={callOrderAlertsApi}
|
|
250
|
+
callUnresolvedTaskApi={callUnresolvedTaskApi}
|
|
251
|
+
/>
|
|
252
|
+
);
|
|
54
253
|
case 'create-reminder':
|
|
55
|
-
return
|
|
254
|
+
return (
|
|
255
|
+
<ReminderModal
|
|
256
|
+
callUnresolvedTaskApi={callUnresolvedTaskApi}
|
|
257
|
+
callReminderApi={callReminderApi}
|
|
258
|
+
/>
|
|
259
|
+
);
|
|
56
260
|
case 'create-task':
|
|
57
|
-
return
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
261
|
+
return (
|
|
262
|
+
<TaskModal
|
|
263
|
+
callUnresolvedTaskApi={callUnresolvedTaskApi}
|
|
264
|
+
callReminderApi={callReminderApi}
|
|
265
|
+
/>
|
|
266
|
+
);
|
|
267
|
+
case 'charge-log':
|
|
268
|
+
return <ChargeLog />;
|
|
62
269
|
case 'unhold-order':
|
|
63
|
-
return
|
|
64
|
-
|
|
65
|
-
|
|
270
|
+
return (
|
|
271
|
+
<UnholdOrder
|
|
272
|
+
callOrdersApi={callOrdersApi}
|
|
273
|
+
callOrderAlertsApi={callOrderAlertsApi}
|
|
274
|
+
callUnresolvedTaskApi={callUnresolvedTaskApi}
|
|
275
|
+
/>
|
|
276
|
+
);
|
|
277
|
+
case 'view-reminder':
|
|
278
|
+
return <ViewReminderModal callReminderApi={callReminderApi} />;
|
|
279
|
+
// case 'order-lock':
|
|
280
|
+
// return <OrderLock />;
|
|
66
281
|
case 'view-flag':
|
|
67
282
|
return <ViewFlag />;
|
|
68
283
|
case 'clear-date':
|
|
@@ -2,71 +2,62 @@ import { atom, useAtom } from 'jotai';
|
|
|
2
2
|
import {
|
|
3
3
|
CreateReminderPayload,
|
|
4
4
|
CreateTaskPayload,
|
|
5
|
-
|
|
6
|
-
SingleResolvedPayload,
|
|
5
|
+
TaskUpdateType,
|
|
7
6
|
UpdateReminderPayload,
|
|
8
7
|
allTypes,
|
|
8
|
+
resolveTaskPayload,
|
|
9
9
|
splitOrderType,
|
|
10
10
|
} from './types';
|
|
11
11
|
import { OrdersType } from '../types';
|
|
12
12
|
import { ordersInitialValue } from '../store';
|
|
13
13
|
|
|
14
14
|
export const initialPayload: CreateTaskPayload = {
|
|
15
|
-
|
|
16
|
-
task_type_id: null,
|
|
17
|
-
task_categories_id: null,
|
|
18
|
-
task_subcategories_id: null,
|
|
19
|
-
task_priority_id: 1,
|
|
15
|
+
description: '',
|
|
20
16
|
is_private: true,
|
|
21
|
-
due_datetime: undefined,
|
|
22
|
-
task_status_id: 1,
|
|
23
17
|
order_id: null,
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
flag_attribute: '',
|
|
29
|
-
completion_note: '',
|
|
30
|
-
resolved_by: '',
|
|
31
|
-
sla: null,
|
|
32
|
-
description: '',
|
|
33
|
-
assigned_to: null,
|
|
34
|
-
legacy_id: null,
|
|
18
|
+
flag_type: '',
|
|
19
|
+
priority: 3,
|
|
20
|
+
status: 'AD',
|
|
21
|
+
due_datetime: '',
|
|
35
22
|
};
|
|
36
23
|
|
|
37
24
|
export const initialValue: CreateReminderPayload = {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
assigned_to:
|
|
41
|
-
status_id: 3,
|
|
42
|
-
task_priority_id: null,
|
|
43
|
-
department_id: null,
|
|
44
|
-
task_categories_id: null,
|
|
45
|
-
task_subcategories_id: null,
|
|
25
|
+
due_datetime: null,
|
|
26
|
+
description: '',
|
|
27
|
+
assigned_to: '',
|
|
46
28
|
order_id: null,
|
|
29
|
+
priority: 3,
|
|
30
|
+
department: '',
|
|
31
|
+
status: false,
|
|
47
32
|
};
|
|
48
33
|
|
|
49
34
|
export const updatePayload: UpdateReminderPayload = {
|
|
50
|
-
|
|
35
|
+
due_datetime: '',
|
|
36
|
+
description: '',
|
|
37
|
+
assigned_to: '',
|
|
38
|
+
order_id: null,
|
|
39
|
+
priority: null,
|
|
40
|
+
department: null,
|
|
41
|
+
status: false,
|
|
51
42
|
id: null,
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
43
|
+
is_deleted: null,
|
|
44
|
+
legacy_reminder_id: null,
|
|
45
|
+
order_data: null,
|
|
46
|
+
reference: null,
|
|
47
|
+
completed_at: null,
|
|
48
|
+
completed_by: null,
|
|
56
49
|
};
|
|
57
50
|
|
|
58
|
-
export const flagInitialValue:
|
|
51
|
+
export const flagInitialValue: TaskUpdateType = {
|
|
59
52
|
description: '',
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
is_resolved: false,
|
|
53
|
+
flag_type: 0,
|
|
54
|
+
priority: 0,
|
|
63
55
|
id: null,
|
|
64
56
|
is_private: false,
|
|
65
57
|
};
|
|
66
58
|
|
|
67
|
-
export const resolvedValue:
|
|
68
|
-
|
|
69
|
-
id: null,
|
|
59
|
+
export const resolvedValue: resolveTaskPayload = {
|
|
60
|
+
task_ids: null,
|
|
70
61
|
};
|
|
71
62
|
|
|
72
63
|
const allStaticData = atom<allTypes[] | null>([]);
|
|
@@ -95,7 +86,7 @@ const reminderNotifiData = atom<any>([]);
|
|
|
95
86
|
|
|
96
87
|
const singleFlagData = atom<any>({});
|
|
97
88
|
|
|
98
|
-
const
|
|
89
|
+
const flagByIdData = atom<any>({});
|
|
99
90
|
|
|
100
91
|
const flagRefId = atom<number | null>(null);
|
|
101
92
|
|
|
@@ -103,7 +94,7 @@ const ReminderRefId = atom<number | null>(null);
|
|
|
103
94
|
|
|
104
95
|
const reminderData = atom<any>([]);
|
|
105
96
|
|
|
106
|
-
const resolvedModalPayload = atom<
|
|
97
|
+
const resolvedModalPayload = atom<resolveTaskPayload>(resolvedValue);
|
|
107
98
|
|
|
108
99
|
const routeDetails = atom<any>({});
|
|
109
100
|
|
|
@@ -125,6 +116,8 @@ const loadingText = atom<{ title: string; subtitle: string } | undefined>(
|
|
|
125
116
|
defaultLoadingText
|
|
126
117
|
);
|
|
127
118
|
|
|
119
|
+
const deptData = atom<any>([]);
|
|
120
|
+
|
|
128
121
|
const loading = atom<boolean>(true);
|
|
129
122
|
|
|
130
123
|
export function useFlagsLoading() {
|
|
@@ -190,7 +183,7 @@ export function useCreateReminderPayload() {
|
|
|
190
183
|
return useAtom(createReminderPayload);
|
|
191
184
|
}
|
|
192
185
|
|
|
193
|
-
export function
|
|
186
|
+
export function useStaticData() {
|
|
194
187
|
return useAtom(allStaticData);
|
|
195
188
|
}
|
|
196
189
|
|
|
@@ -219,16 +212,26 @@ export function useTaskTypeExtended() {
|
|
|
219
212
|
return useAtom(taskTypeExtended);
|
|
220
213
|
}
|
|
221
214
|
|
|
222
|
-
export function
|
|
215
|
+
export function useTasksData() {
|
|
223
216
|
return useAtom(notificationData);
|
|
224
217
|
}
|
|
225
218
|
|
|
219
|
+
export function useDeptData() {
|
|
220
|
+
return useAtom(deptData);
|
|
221
|
+
}
|
|
222
|
+
|
|
226
223
|
export function useReminderNotiData() {
|
|
227
224
|
return useAtom(reminderNotifiData);
|
|
228
225
|
}
|
|
229
226
|
|
|
230
|
-
export function
|
|
231
|
-
return useAtom(
|
|
227
|
+
export function useFlagById() {
|
|
228
|
+
return useAtom(flagByIdData);
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
const taskUpdate = atom<TaskUpdateType>(flagInitialValue);
|
|
232
|
+
|
|
233
|
+
export function useUpdateTask() {
|
|
234
|
+
return useAtom(taskUpdate);
|
|
232
235
|
}
|
|
233
236
|
|
|
234
237
|
export function useSingleFlagData() {
|
|
@@ -247,7 +250,7 @@ export function useReminderRefId() {
|
|
|
247
250
|
return useAtom(ReminderRefId);
|
|
248
251
|
}
|
|
249
252
|
|
|
250
|
-
export function
|
|
253
|
+
export function useReminderById() {
|
|
251
254
|
return useAtom(reminderData);
|
|
252
255
|
}
|
|
253
256
|
|
|
@@ -264,7 +267,6 @@ export function useAllOrderStatus() {
|
|
|
264
267
|
return useAtom(allOrderStatus);
|
|
265
268
|
}
|
|
266
269
|
|
|
267
|
-
|
|
268
270
|
export const selectedCategoryIdAtom = atom<any>(null);
|
|
269
271
|
export const selectedDocumentTypeAtom = atom<any>(null);
|
|
270
272
|
export const selectedTypeAtom = atom<any>(null);
|
|
@@ -3,24 +3,6 @@ export interface Department {
|
|
|
3
3
|
name: string;
|
|
4
4
|
}
|
|
5
5
|
|
|
6
|
-
interface TaskTypeExtended {
|
|
7
|
-
id: number;
|
|
8
|
-
department_id: number;
|
|
9
|
-
type: string;
|
|
10
|
-
is_active: boolean;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
interface TaskCategory {
|
|
14
|
-
id: number;
|
|
15
|
-
category: string;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
interface TaskSubCategory {
|
|
19
|
-
id: number;
|
|
20
|
-
sub_category: string;
|
|
21
|
-
category_id: number;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
6
|
export interface TaskPriority {
|
|
25
7
|
id: number;
|
|
26
8
|
name: string;
|
|
@@ -28,56 +10,32 @@ export interface TaskPriority {
|
|
|
28
10
|
|
|
29
11
|
export interface allTypes {
|
|
30
12
|
department: Department[];
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
tasks_types: TaskTypeExtended[];
|
|
13
|
+
flags_static_data: any;
|
|
14
|
+
order_flag_types: any;
|
|
15
|
+
priority: any;
|
|
35
16
|
}
|
|
36
17
|
|
|
37
|
-
//create-task
|
|
38
18
|
export interface CreateTaskPayload {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
task_categories_id: number | null;
|
|
42
|
-
task_subcategories_id: number | null;
|
|
43
|
-
task_priority_id: number | string | null;
|
|
44
|
-
task_status_id: number | null;
|
|
45
|
-
is_private?: boolean;
|
|
46
|
-
due_datetime: any;
|
|
19
|
+
description: string | null;
|
|
20
|
+
is_private: boolean | null;
|
|
47
21
|
order_id: number | null;
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
sla: any;
|
|
56
|
-
description?: string;
|
|
57
|
-
assigned_to: number | null;
|
|
58
|
-
legacy_id: number | null;
|
|
22
|
+
flag_type: string | null;
|
|
23
|
+
priority: number | null;
|
|
24
|
+
status: string | null;
|
|
25
|
+
due_datetime: string | null;
|
|
26
|
+
}
|
|
27
|
+
export interface resolveTaskPayload {
|
|
28
|
+
task_ids: number[] | null;
|
|
59
29
|
}
|
|
60
30
|
|
|
61
|
-
//create reminder
|
|
62
31
|
export interface CreateReminderPayload {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
assigned_to:
|
|
66
|
-
status_id: number | null;
|
|
67
|
-
task_priority_id: number | null;
|
|
68
|
-
department_id: number | null;
|
|
69
|
-
task_categories_id: number | null;
|
|
70
|
-
task_subcategories_id: number | null;
|
|
32
|
+
due_datetime: Date | null;
|
|
33
|
+
description: string | null;
|
|
34
|
+
assigned_to: string | null;
|
|
71
35
|
order_id: number | null;
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
description?: string;
|
|
76
|
-
task_type_id?: number;
|
|
77
|
-
task_priority_id?: number;
|
|
78
|
-
is_resolved: boolean;
|
|
79
|
-
id: number | null;
|
|
80
|
-
is_private?: boolean;
|
|
36
|
+
priority: number | null;
|
|
37
|
+
department: string | null;
|
|
38
|
+
status: boolean | null;
|
|
81
39
|
}
|
|
82
40
|
|
|
83
41
|
export type StatusType = 'AD' | 'SD';
|
|
@@ -89,15 +47,32 @@ export interface SingleResolvedPayload {
|
|
|
89
47
|
|
|
90
48
|
//update Reminder Payload
|
|
91
49
|
export interface UpdateReminderPayload {
|
|
92
|
-
|
|
50
|
+
due_datetime: any | null;
|
|
51
|
+
description: any | null;
|
|
52
|
+
assigned_to: string | null;
|
|
53
|
+
order_id: number | null;
|
|
54
|
+
priority: number | null;
|
|
55
|
+
department: any | null;
|
|
56
|
+
status: boolean | null;
|
|
93
57
|
id: number | null;
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
58
|
+
is_deleted: boolean | null;
|
|
59
|
+
legacy_reminder_id: number | null;
|
|
60
|
+
order_data: any[] | null;
|
|
61
|
+
reference: any | null;
|
|
62
|
+
completed_at: any | null;
|
|
63
|
+
completed_by: any | null;
|
|
98
64
|
}
|
|
65
|
+
|
|
99
66
|
export interface splitOrderType {
|
|
100
67
|
return_order: number;
|
|
101
68
|
products: any[];
|
|
102
69
|
force: boolean;
|
|
103
70
|
}
|
|
71
|
+
|
|
72
|
+
export interface TaskUpdateType {
|
|
73
|
+
description: string | null;
|
|
74
|
+
flag_type: number | null;
|
|
75
|
+
priority: number | null;
|
|
76
|
+
id: number | null;
|
|
77
|
+
is_private: boolean | null;
|
|
78
|
+
}
|
|
@@ -33,15 +33,22 @@ export const getStatusColor = (status: StatusType) => {
|
|
|
33
33
|
};
|
|
34
34
|
|
|
35
35
|
//date format
|
|
36
|
-
export function formatDate(
|
|
37
|
-
if (
|
|
38
|
-
const date = new Date(dateString);
|
|
36
|
+
export function formatDate(dateInput?: string | number | Date): string {
|
|
37
|
+
if (!dateInput) return 'N/A';
|
|
39
38
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
39
|
+
const date = new Date(dateInput);
|
|
40
|
+
if (isNaN(date.getTime())) return 'N/A';
|
|
41
|
+
|
|
42
|
+
return format(date, 'eee, dd/MM/yyyy HH:mm:ss');
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export function getDay(dateInput?: string | number | Date): string {
|
|
46
|
+
if (!dateInput) return 'N/A';
|
|
47
|
+
|
|
48
|
+
const date = new Date(dateInput);
|
|
49
|
+
if (isNaN(date.getTime())) return 'N/A';
|
|
50
|
+
|
|
51
|
+
return format(date, 'eee');
|
|
45
52
|
}
|
|
46
53
|
|
|
47
54
|
//with colors
|
|
@@ -2,6 +2,7 @@ import { Input, Label } from '@bjsdistribution/dms-component-library';
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import styled from 'styled-components';
|
|
4
4
|
import { errorAtom, useAtom, useOrderDetails } from '../../../../store';
|
|
5
|
+
import { sanitizeInput } from '../../../../utils';
|
|
5
6
|
|
|
6
7
|
function ContactEmail() {
|
|
7
8
|
const emailRegex = /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i;
|
|
@@ -10,7 +11,7 @@ function ContactEmail() {
|
|
|
10
11
|
const orderRecipient = orderDetails?.order_recipient;
|
|
11
12
|
|
|
12
13
|
const onChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
|
13
|
-
|
|
14
|
+
let val = sanitizeInput(e.target.value);
|
|
14
15
|
validateInput(val);
|
|
15
16
|
const updatedOrderRecipient = {
|
|
16
17
|
...(orderRecipient === null
|