@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,9 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { useCurrentAction } from '../store';
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
FlagAlert,
|
|
5
|
+
formatUtcToLocal,
|
|
6
|
+
} from '@bjsdistribution/dms-component-library';
|
|
4
7
|
import styled from 'styled-components';
|
|
5
8
|
import { useReminderRefId } from '../order-actions/store';
|
|
6
|
-
import {
|
|
9
|
+
import { getDay } from '../order-actions/utils';
|
|
7
10
|
|
|
8
11
|
function ReminderTemplate({ data, dismissReminder }: any) {
|
|
9
12
|
const [, setCurrentAction] = useCurrentAction();
|
|
@@ -19,16 +22,16 @@ function ReminderTemplate({ data, dismissReminder }: any) {
|
|
|
19
22
|
};
|
|
20
23
|
|
|
21
24
|
const type =
|
|
22
|
-
data?.
|
|
23
|
-
? '
|
|
24
|
-
: data?.
|
|
25
|
+
data?.status === true
|
|
26
|
+
? 'success'
|
|
27
|
+
: data?.status === false
|
|
25
28
|
? 'warn'
|
|
26
|
-
: '
|
|
29
|
+
: 'info';
|
|
27
30
|
|
|
28
31
|
const titleColor =
|
|
29
|
-
data?.
|
|
32
|
+
data?.status === true
|
|
30
33
|
? '#36A053'
|
|
31
|
-
: data?.
|
|
34
|
+
: data?.staus === false
|
|
32
35
|
? '#FEBA30'
|
|
33
36
|
: '#3A3630';
|
|
34
37
|
|
|
@@ -42,14 +45,21 @@ function ReminderTemplate({ data, dismissReminder }: any) {
|
|
|
42
45
|
<StyledTitle color={titleColor}>
|
|
43
46
|
Reminder:
|
|
44
47
|
<StyledLink onClick={() => handleClick(data.id)}>
|
|
45
|
-
{
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
{
|
|
48
|
+
{data?.reference || 'NA'}
|
|
49
|
+
</StyledLink>{' '}
|
|
50
|
+
(Due - {getDay(data?.due_datetime)},{' '}
|
|
51
|
+
{`${formatUtcToLocal(data?.due_datetime).date} ${
|
|
52
|
+
formatUtcToLocal(data?.due_datetime).time
|
|
53
|
+
}`}
|
|
54
|
+
), Assigned to: {data?.assigned_to} Completed On:{' '}
|
|
55
|
+
{getDay(data?.completed_at)},{' '}
|
|
56
|
+
{`${formatUtcToLocal(data?.completed_at).date} ${
|
|
57
|
+
formatUtcToLocal(data?.completed_at).time
|
|
58
|
+
}`} By: {data?.completed_by}
|
|
49
59
|
</StyledTitle>
|
|
50
60
|
</>
|
|
51
61
|
}
|
|
52
|
-
description={`${data?.
|
|
62
|
+
description={`${data?.description}`}
|
|
53
63
|
showOkButton={false}
|
|
54
64
|
onClose={() => dismissReminder(data.id)}
|
|
55
65
|
/>
|
|
@@ -75,7 +85,6 @@ const StyledLink = styled.span`
|
|
|
75
85
|
font-size: 14px;
|
|
76
86
|
font-style: normal;
|
|
77
87
|
font-weight: 600;
|
|
78
|
-
cursor: pointer;
|
|
79
88
|
`;
|
|
80
89
|
|
|
81
90
|
export default ReminderTemplate;
|
|
@@ -1,24 +1,23 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import styled from 'styled-components';
|
|
3
3
|
import { useOrderDetails, useTabType } from '../store';
|
|
4
|
+
import OrderTemplate from './OrderTemplate';
|
|
4
5
|
import FlagTemplate from './FlagTemplate';
|
|
5
6
|
import ReminderTemplate from './ReminderTemplate';
|
|
6
|
-
import OrderTemplate from './OrderTemplate';
|
|
7
7
|
|
|
8
8
|
function Tabs({
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
activeTasks,
|
|
10
|
+
closedTasks,
|
|
11
11
|
activeReminders,
|
|
12
12
|
closedReminders,
|
|
13
13
|
dismissReminder,
|
|
14
14
|
dismissFlags,
|
|
15
|
+
routeInfoData,
|
|
15
16
|
}: any) {
|
|
16
17
|
const [activeTab] = useTabType();
|
|
17
18
|
const [orderDetails] = useOrderDetails();
|
|
18
|
-
|
|
19
|
-
const
|
|
20
|
-
const additionalNotifications = activeNotifications?.slice(3);
|
|
21
|
-
|
|
19
|
+
const initialNotifications = activeTasks?.slice(0, 3);
|
|
20
|
+
const additionalNotifications = activeTasks?.slice(3);
|
|
22
21
|
const initialReminders = activeReminders?.slice(0, 3);
|
|
23
22
|
const additionalReminders = activeReminders?.slice(3);
|
|
24
23
|
|
|
@@ -28,8 +27,10 @@ function Tabs({
|
|
|
28
27
|
<Container className="tab-content">
|
|
29
28
|
{activeTab === 'active' && (
|
|
30
29
|
<>
|
|
31
|
-
<OrderTemplate
|
|
32
|
-
|
|
30
|
+
<OrderTemplate
|
|
31
|
+
orderDetails={orderDetails}
|
|
32
|
+
routeInfoData={routeInfoData}
|
|
33
|
+
/>
|
|
33
34
|
{initialReminders?.map((item: any, index: any) => (
|
|
34
35
|
<ReminderTemplate
|
|
35
36
|
key={index}
|
|
@@ -37,7 +38,7 @@ function Tabs({
|
|
|
37
38
|
dismissReminder={dismissReminder}
|
|
38
39
|
/>
|
|
39
40
|
))}
|
|
40
|
-
{initialNotifications
|
|
41
|
+
{initialNotifications?.map((item: any, index: any) => (
|
|
41
42
|
<FlagTemplate
|
|
42
43
|
key={index}
|
|
43
44
|
data={item}
|
|
@@ -45,14 +46,14 @@ function Tabs({
|
|
|
45
46
|
/>
|
|
46
47
|
))}
|
|
47
48
|
<>
|
|
48
|
-
{additionalReminders
|
|
49
|
+
{additionalReminders?.map((item: any, index: any) => (
|
|
49
50
|
<ReminderTemplate
|
|
50
51
|
key={index + initialReminders.length}
|
|
51
52
|
data={item}
|
|
52
53
|
dismissReminder={dismissReminder}
|
|
53
54
|
/>
|
|
54
55
|
))}
|
|
55
|
-
{additionalNotifications
|
|
56
|
+
{additionalNotifications?.map((item: any, index: any) => (
|
|
56
57
|
<FlagTemplate
|
|
57
58
|
key={index + initialNotifications.length}
|
|
58
59
|
data={item}
|
|
@@ -64,14 +65,14 @@ function Tabs({
|
|
|
64
65
|
)}
|
|
65
66
|
{activeTab === 'closed' && (
|
|
66
67
|
<>
|
|
67
|
-
{closedReminders
|
|
68
|
+
{closedReminders?.map((item: any, index: any) => (
|
|
68
69
|
<ReminderTemplate
|
|
69
70
|
key={index}
|
|
70
71
|
data={item}
|
|
71
72
|
dismissReminder={dismissReminder}
|
|
72
73
|
/>
|
|
73
74
|
))}
|
|
74
|
-
{
|
|
75
|
+
{closedTasks?.map((item: any, index: any) => (
|
|
75
76
|
<FlagTemplate
|
|
76
77
|
key={index}
|
|
77
78
|
data={item}
|
|
@@ -1,20 +1,27 @@
|
|
|
1
1
|
import {
|
|
2
2
|
SectionHeader,
|
|
3
|
-
useApiHook,
|
|
4
3
|
useAxios,
|
|
5
4
|
} from '@bjsdistribution/dms-component-library';
|
|
6
5
|
import React, { useEffect, useState } from 'react';
|
|
7
6
|
import Tabs from './Tabs';
|
|
8
7
|
import styled from 'styled-components';
|
|
9
|
-
import {
|
|
8
|
+
import {
|
|
9
|
+
useInfoType,
|
|
10
|
+
useOrderAlertsData,
|
|
11
|
+
useOrderDetails,
|
|
12
|
+
useOrderId,
|
|
13
|
+
useRouteId,
|
|
14
|
+
useTabType,
|
|
15
|
+
} from '../store';
|
|
10
16
|
import NotifyFlag from '../../../assets/icons/NotifyFlag';
|
|
11
17
|
import {
|
|
12
|
-
|
|
18
|
+
useTasksData,
|
|
13
19
|
useOrderNotify,
|
|
14
20
|
useReminderNotiData,
|
|
15
21
|
useRouteDetails,
|
|
16
|
-
|
|
22
|
+
useAllOrderStatus,
|
|
17
23
|
} from '../order-actions/store';
|
|
24
|
+
import { useParams, useSearchParams } from 'react-router-dom';
|
|
18
25
|
|
|
19
26
|
interface ApiResponse {
|
|
20
27
|
message: string;
|
|
@@ -28,17 +35,32 @@ interface ApiResponse {
|
|
|
28
35
|
function Notification() {
|
|
29
36
|
const [activeTab, setActiveTab] = useTabType();
|
|
30
37
|
const [, setShowMoreInfo] = useInfoType();
|
|
31
|
-
const [
|
|
32
|
-
const [
|
|
33
|
-
|
|
34
|
-
const [reminderData, setReminderData] = useReminderNotiData();
|
|
35
|
-
const routeId = OrderData?.order_routes?.route_id;
|
|
38
|
+
const [orderData] = useOrderDetails();
|
|
39
|
+
const [taskData, setTasksData] = useTasksData();
|
|
40
|
+
const [reminderNotifyData, setReminderNotifyData] = useReminderNotiData();
|
|
36
41
|
const [, setRouteData] = useRouteDetails();
|
|
37
|
-
const [
|
|
38
|
-
const [activeNotifications, setActiveNotifications] = useState([]);
|
|
39
|
-
const [closedNotifications, setCloseNotifications] = useState([]);
|
|
42
|
+
const [, setCount] = useOrderNotify();
|
|
40
43
|
const [activeReminders, setActiveReminders] = useState([]);
|
|
41
44
|
const [closedReminders, setCloseReminders] = useState([]);
|
|
45
|
+
const [activeTasks, setActiveTasks] = useState([]);
|
|
46
|
+
const [closedTasks, setCloseTasks] = useState([]);
|
|
47
|
+
const [idOfRoute, setRouteId] = useRouteId();
|
|
48
|
+
const [, setStatusVal] = useAllOrderStatus();
|
|
49
|
+
const [searchParams] = useSearchParams();
|
|
50
|
+
const [orderAlertsData, setOrderAlertsData] = useOrderAlertsData();
|
|
51
|
+
const orderIdParams = searchParams.get('order');
|
|
52
|
+
const { id } = useParams();
|
|
53
|
+
const [orderId, setOrderId] = useOrderId();
|
|
54
|
+
const routeId = orderData?.order_routes?.route_id;
|
|
55
|
+
|
|
56
|
+
useEffect(() => {
|
|
57
|
+
if (orderIdParams) {
|
|
58
|
+
setOrderId(id);
|
|
59
|
+
} else {
|
|
60
|
+
const paths = location.pathname.split('/');
|
|
61
|
+
setOrderId(paths[paths?.length - 1]);
|
|
62
|
+
}
|
|
63
|
+
}, []);
|
|
42
64
|
|
|
43
65
|
//Unresolved API
|
|
44
66
|
const {
|
|
@@ -48,10 +70,10 @@ function Notification() {
|
|
|
48
70
|
} = useAxios<{
|
|
49
71
|
data: ApiResponse[];
|
|
50
72
|
}>({
|
|
51
|
-
endpoint: `/
|
|
73
|
+
endpoint: `/v1/task/`,
|
|
52
74
|
method: 'GET',
|
|
53
75
|
pagination: { is_pagination: false },
|
|
54
|
-
filters: [{ field: 'order_id', op: '=', value:
|
|
76
|
+
filters: [{ field: 'order_id', op: '=', value: orderId }],
|
|
55
77
|
});
|
|
56
78
|
|
|
57
79
|
//reminder get
|
|
@@ -62,99 +84,141 @@ function Notification() {
|
|
|
62
84
|
} = useAxios<{
|
|
63
85
|
data: ApiResponse[];
|
|
64
86
|
}>({
|
|
65
|
-
endpoint: `/
|
|
87
|
+
endpoint: `/v1/task/reminder/get/`,
|
|
66
88
|
method: 'GET',
|
|
67
89
|
pagination: { is_pagination: false },
|
|
68
|
-
filters: [{ field: 'order_id', op: '=', value:
|
|
90
|
+
filters: [{ field: 'order_id', op: '=', value: orderId }],
|
|
69
91
|
});
|
|
70
92
|
|
|
93
|
+
useEffect(() => {
|
|
94
|
+
setStatusVal(orderData?.status_value);
|
|
95
|
+
}, [orderData?.status_value]);
|
|
96
|
+
|
|
71
97
|
const handleTabChange = (tab: string) => {
|
|
72
98
|
setActiveTab(tab);
|
|
99
|
+
//additionally set count
|
|
100
|
+
setCount(1);
|
|
73
101
|
setShowMoreInfo(false);
|
|
74
102
|
};
|
|
75
|
-
|
|
76
|
-
//flags notification data
|
|
103
|
+
//flags data set
|
|
77
104
|
useEffect(() => {
|
|
78
105
|
if (fetchedUnresolvedData && fetchedUnresolvedData?.data) {
|
|
79
|
-
|
|
106
|
+
setTasksData(fetchedUnresolvedData?.data);
|
|
80
107
|
}
|
|
81
|
-
}, [unresolvedLoading]);
|
|
108
|
+
}, [unresolvedLoading, fetchedUnresolvedData]);
|
|
82
109
|
|
|
83
110
|
//reminder data set
|
|
84
111
|
useEffect(() => {
|
|
85
112
|
if (fetchedReminderData && fetchedReminderData?.data) {
|
|
86
|
-
|
|
113
|
+
setReminderNotifyData(fetchedReminderData?.data);
|
|
87
114
|
}
|
|
88
115
|
}, [reminderLoading]);
|
|
89
116
|
|
|
90
|
-
//
|
|
91
|
-
const { data: fetchedData,
|
|
117
|
+
// Route API calling...
|
|
118
|
+
const { data: fetchedData, fetchData: fetchRoute } = useAxios<{
|
|
92
119
|
data: ApiResponse[];
|
|
93
120
|
}>({
|
|
94
121
|
endpoint: `route/${routeId}`,
|
|
95
122
|
method: 'GET',
|
|
96
|
-
performAction: false,
|
|
97
123
|
});
|
|
98
124
|
|
|
99
125
|
useEffect(() => {
|
|
100
|
-
if (
|
|
101
|
-
|
|
102
|
-
callUnresolvedTaskApi();
|
|
126
|
+
if (idOfRoute !== null && idOfRoute !== undefined) {
|
|
127
|
+
fetchRoute();
|
|
103
128
|
}
|
|
104
|
-
|
|
129
|
+
return () => {
|
|
130
|
+
setRouteId(null);
|
|
131
|
+
};
|
|
132
|
+
}, [idOfRoute]);
|
|
133
|
+
|
|
134
|
+
const {
|
|
135
|
+
data: alertsData,
|
|
136
|
+
fetchData: callOrderAlertsApi,
|
|
137
|
+
loading: alertsApiLoading,
|
|
138
|
+
} = useAxios<{
|
|
139
|
+
data: ApiResponse[];
|
|
140
|
+
}>({
|
|
141
|
+
endpoint: `v1/orders/alerts/?order_id=${orderId}`,
|
|
142
|
+
method: 'GET',
|
|
143
|
+
});
|
|
105
144
|
|
|
106
145
|
useEffect(() => {
|
|
107
|
-
if (
|
|
108
|
-
|
|
109
|
-
setRouteData(fetchedData?.data[0]);
|
|
146
|
+
if (alertsData && alertsData?.data) {
|
|
147
|
+
setOrderAlertsData(alertsData?.data);
|
|
110
148
|
}
|
|
111
|
-
});
|
|
149
|
+
}, [alertsApiLoading]);
|
|
112
150
|
|
|
113
151
|
useEffect(() => {
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
152
|
+
const fetchData = async () => {
|
|
153
|
+
if (orderId == null) return;
|
|
154
|
+
|
|
155
|
+
try {
|
|
156
|
+
await callReminderApi();
|
|
157
|
+
await callUnresolvedTaskApi();
|
|
158
|
+
await callOrderAlertsApi();
|
|
159
|
+
} catch (error) {
|
|
160
|
+
console.error('Error while fetching order-related data:', error);
|
|
161
|
+
}
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
fetchData();
|
|
165
|
+
}, [orderId]);
|
|
166
|
+
|
|
167
|
+
useEffect(() => {
|
|
168
|
+
if (fetchedData && fetchedData?.data) {
|
|
169
|
+
const data = fetchedData?.data[0];
|
|
170
|
+
setRouteData(data);
|
|
121
171
|
}
|
|
122
|
-
}, [
|
|
172
|
+
}, []);
|
|
123
173
|
|
|
124
174
|
useEffect(() => {
|
|
125
|
-
if (
|
|
175
|
+
if (taskData?.length > 0) {
|
|
176
|
+
setActiveTasks(taskData?.filter((item: any) => item.status !== 'SD'));
|
|
177
|
+
setCloseTasks(taskData?.filter((item: any) => item?.status === 'SD'));
|
|
178
|
+
}
|
|
179
|
+
}, [taskData, fetchedUnresolvedData]);
|
|
180
|
+
|
|
181
|
+
useEffect(() => {
|
|
182
|
+
if (reminderNotifyData?.length > 0) {
|
|
126
183
|
setActiveReminders(
|
|
127
|
-
|
|
128
|
-
(item: any) => item.status_id === 1 || item.status_id === 3
|
|
129
|
-
)
|
|
184
|
+
reminderNotifyData?.filter((item: any) => item.status === false)
|
|
130
185
|
);
|
|
131
186
|
setCloseReminders(
|
|
132
|
-
|
|
187
|
+
reminderNotifyData?.filter((item: any) => item?.status === true)
|
|
133
188
|
);
|
|
134
189
|
}
|
|
135
|
-
}, [
|
|
190
|
+
}, [reminderNotifyData]);
|
|
136
191
|
|
|
137
192
|
//dismiss notifcations
|
|
138
193
|
const dismissFlags = (id: any) => {
|
|
139
|
-
|
|
140
|
-
prevFlags
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
194
|
+
setActiveTasks(prevFlags => {
|
|
195
|
+
const updatedFlags = prevFlags?.filter((flags: any) => flags.id !== id);
|
|
196
|
+
return updatedFlags;
|
|
197
|
+
});
|
|
198
|
+
|
|
199
|
+
setCloseTasks(prevFlags => {
|
|
200
|
+
const updatedFlags = prevFlags?.filter((flags: any) => flags.id !== id);
|
|
201
|
+
return updatedFlags;
|
|
202
|
+
});
|
|
145
203
|
};
|
|
204
|
+
|
|
146
205
|
const dismissReminder = (id: any) => {
|
|
147
206
|
setActiveReminders(prevReminders =>
|
|
148
|
-
prevReminders
|
|
207
|
+
prevReminders?.filter((reminder: any) => reminder.id !== id)
|
|
149
208
|
);
|
|
150
209
|
setCloseReminders(prevReminders =>
|
|
151
|
-
prevReminders
|
|
210
|
+
prevReminders?.filter((reminder: any) => reminder.id !== id)
|
|
152
211
|
);
|
|
153
212
|
};
|
|
154
213
|
|
|
155
214
|
const totalActiveCount =
|
|
156
|
-
|
|
157
|
-
|
|
215
|
+
activeTasks?.filter((item: any) => item.status !== 'SD')?.length +
|
|
216
|
+
activeReminders?.length;
|
|
217
|
+
// orderCount;
|
|
218
|
+
|
|
219
|
+
const totalClosedCount =
|
|
220
|
+
closedTasks?.filter((item: any) => item.status === 'SD')?.length +
|
|
221
|
+
closedReminders?.length;
|
|
158
222
|
|
|
159
223
|
return (
|
|
160
224
|
<>
|
|
@@ -181,15 +245,23 @@ function Notification() {
|
|
|
181
245
|
</StyledTab>
|
|
182
246
|
</TabsData>
|
|
183
247
|
</Container>
|
|
184
|
-
{
|
|
248
|
+
{unresolvedLoading || reminderLoading ? (
|
|
249
|
+
<Loader>
|
|
250
|
+
<Spinner />
|
|
251
|
+
<Text>Fetching Notifications...</Text>
|
|
252
|
+
</Loader>
|
|
253
|
+
) : taskData?.length > 0 ||
|
|
254
|
+
reminderNotifyData?.length > 0 ||
|
|
255
|
+
orderData ? (
|
|
185
256
|
<TabsWrapper>
|
|
186
257
|
<Tabs
|
|
187
|
-
|
|
188
|
-
|
|
258
|
+
activeTasks={activeTasks}
|
|
259
|
+
closedTasks={closedTasks}
|
|
189
260
|
activeReminders={activeReminders}
|
|
190
261
|
closedReminders={closedReminders}
|
|
191
262
|
dismissReminder={dismissReminder}
|
|
192
263
|
dismissFlags={dismissFlags}
|
|
264
|
+
routeInfoData={orderAlertsData}
|
|
193
265
|
/>
|
|
194
266
|
</TabsWrapper>
|
|
195
267
|
) : (
|
|
@@ -208,31 +280,31 @@ const Container = styled.div`
|
|
|
208
280
|
border-bottom: 1px solid #ccc;
|
|
209
281
|
`;
|
|
210
282
|
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
283
|
+
const Loader = styled.div`
|
|
284
|
+
align-items: center;
|
|
285
|
+
justify-content: center;
|
|
286
|
+
display: flex;
|
|
287
|
+
flex-direction: column;
|
|
288
|
+
gap: 10px;
|
|
289
|
+
`;
|
|
290
|
+
|
|
291
|
+
const Spinner = styled.div`
|
|
292
|
+
border: 4px solid rgba(0, 0, 0, 0.1);
|
|
293
|
+
border-left-color: #3a3630;
|
|
294
|
+
border-radius: 50%;
|
|
295
|
+
width: 40px;
|
|
296
|
+
height: 40px;
|
|
297
|
+
animation: spin 1s linear infinite;
|
|
298
|
+
|
|
299
|
+
@keyframes spin {
|
|
300
|
+
0% {
|
|
301
|
+
transform: rotate(0deg);
|
|
302
|
+
}
|
|
303
|
+
100% {
|
|
304
|
+
transform: rotate(360deg);
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
`;
|
|
236
308
|
|
|
237
309
|
const FlagContainer = styled.div`
|
|
238
310
|
padding: 8px;
|
|
@@ -297,7 +369,7 @@ const Label = styled(SectionHeader)`
|
|
|
297
369
|
|
|
298
370
|
const TabsWrapper = styled.div`
|
|
299
371
|
/* min-height: 200px; */
|
|
300
|
-
max-height:
|
|
372
|
+
max-height: 350px;
|
|
301
373
|
overflow-y: auto;
|
|
302
374
|
scrollbar-width: none;
|
|
303
375
|
-ms-overflow-style: none;
|
|
@@ -319,11 +391,11 @@ const TabsWrapper = styled.div`
|
|
|
319
391
|
}
|
|
320
392
|
`;
|
|
321
393
|
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
394
|
+
const Text = styled.div`
|
|
395
|
+
color: var(--tonal-brown-651, #6a7378);
|
|
396
|
+
font-family: Lato;
|
|
397
|
+
font-size: 13px;
|
|
398
|
+
font-style: normal;
|
|
399
|
+
font-weight: 600;
|
|
400
|
+
`;
|
|
329
401
|
export default Notification;
|
|
@@ -21,8 +21,8 @@ import {
|
|
|
21
21
|
} from '../../store';
|
|
22
22
|
import OrderActionsDropdown from '../../Dropdown';
|
|
23
23
|
import { notification } from 'antd';
|
|
24
|
-
import { ApiResponse } from '../../../types';
|
|
25
24
|
import { useAxios } from '@bjsdistribution/dms-component-library';
|
|
25
|
+
import { ApiResponse } from '../../../types';
|
|
26
26
|
|
|
27
27
|
function AddResources() {
|
|
28
28
|
const [, setCurrentAction] = useCurrentAction();
|
|
@@ -37,6 +37,14 @@ function AddResources() {
|
|
|
37
37
|
const [orderId] = useOrderId();
|
|
38
38
|
const [selectedVisibility] = useAtom(selectedVisibilityAtom);
|
|
39
39
|
|
|
40
|
+
//add resources POST API
|
|
41
|
+
const { fetchData: callResourcesAPI } = useAxios<{
|
|
42
|
+
data: ApiResponse[];
|
|
43
|
+
}>({
|
|
44
|
+
endpoint: `/orders/${orderId}/order_resources/?document_type=${selectedDocumentType}&type=${selectedType}&category=${selectedCategoryId}&visibility=${selectedVisibility}`,
|
|
45
|
+
method: 'POST',
|
|
46
|
+
});
|
|
47
|
+
|
|
40
48
|
const onClose = () => {
|
|
41
49
|
setCurrentAction(undefined);
|
|
42
50
|
setUploadedFiles([]);
|
|
@@ -58,17 +66,7 @@ function AddResources() {
|
|
|
58
66
|
setSelectedType(selectedOption.value);
|
|
59
67
|
}
|
|
60
68
|
};
|
|
61
|
-
|
|
62
|
-
// upload files
|
|
63
|
-
const { fetchData: callUploadFile } = useAxios<{
|
|
64
|
-
data: ApiResponse[];
|
|
65
|
-
}>({
|
|
66
|
-
endpoint: `/orders/${orderId}/order_resources/?document_type=${selectedDocumentType}&type=${selectedType}&category=${selectedCategoryId}&visibility=${selectedVisibility}`,
|
|
67
|
-
method: 'POST',
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
//upload files
|
|
71
|
-
|
|
69
|
+
console.log(uploadedFiles, 'filesfiles');
|
|
72
70
|
const handleSubmit = async () => {
|
|
73
71
|
if (!uploadedFiles) {
|
|
74
72
|
notification.error({ message: 'No files selected' });
|
|
@@ -83,29 +81,21 @@ function AddResources() {
|
|
|
83
81
|
}
|
|
84
82
|
|
|
85
83
|
try {
|
|
86
|
-
let response = (await
|
|
84
|
+
let response = (await callResourcesAPI({
|
|
87
85
|
payload: formData,
|
|
88
86
|
})) as {
|
|
89
87
|
code: number | null;
|
|
90
88
|
error?: string | null | undefined;
|
|
91
89
|
[key: string]: any;
|
|
92
90
|
};
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
setResources(
|
|
100
|
-
|
|
101
|
-
setResources(true);
|
|
102
|
-
}, 1000);
|
|
103
|
-
} else {
|
|
104
|
-
notification.error({
|
|
105
|
-
message: 'Error',
|
|
106
|
-
description: `${response?.error}`,
|
|
107
|
-
});
|
|
108
|
-
}
|
|
91
|
+
console.log('Upload successful:', response);
|
|
92
|
+
notification.success({ message: 'Files uploaded successfully' });
|
|
93
|
+
onClose(); // Close modal after successful upload
|
|
94
|
+
setResources(false);
|
|
95
|
+
|
|
96
|
+
setTimeout(() => {
|
|
97
|
+
setResources(true);
|
|
98
|
+
}, 1000);
|
|
109
99
|
} catch (error) {
|
|
110
100
|
console.error('Upload failed:', error);
|
|
111
101
|
}
|