@bjsdistribution/dms-client-return 0.0.90 → 0.0.91
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/dms-client-return.cjs.development.js +55 -54
- 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 +56 -55
- package/dist/dms-client-return.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/order-view/notes/AddNote.tsx +18 -22
- package/src/components/order-view/notification/index.tsx +35 -42
package/package.json
CHANGED
|
@@ -1,33 +1,35 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Button,
|
|
3
3
|
Label,
|
|
4
|
+
useAxios,
|
|
4
5
|
// SelectDropdown,
|
|
5
6
|
} from '@bjsdistribution/dms-component-library';
|
|
6
7
|
import React, { useEffect, useState } from 'react';
|
|
7
8
|
import styled from 'styled-components';
|
|
8
|
-
// import NoteType from './NoteType';
|
|
9
|
-
import { getBaseEndpoint } from '@bjsdistribution/dms-component-library';
|
|
10
|
-
import { getCookie } from '../utils';
|
|
11
9
|
import { useLocation } from 'react-router-dom';
|
|
12
10
|
import { useGlobalStateHitAuditLog, usemoduleIds, useOrderId } from '../store';
|
|
13
11
|
import { notification } from 'antd';
|
|
14
12
|
import NoteType from './NoteType';
|
|
15
13
|
import { useSelectedData } from '../../store';
|
|
14
|
+
import { ApiResponse } from '../types';
|
|
16
15
|
|
|
17
16
|
function AddNote() {
|
|
18
17
|
const [noteText, setNoteText] = useState('');
|
|
19
18
|
const [orderId] = useOrderId();
|
|
20
|
-
|
|
21
19
|
const location = useLocation();
|
|
22
20
|
const pathname = location.pathname;
|
|
23
21
|
const orderIdLocaation = pathname.split('/')[1];
|
|
24
|
-
|
|
25
|
-
const ssoToken = getCookie('id_token');
|
|
26
22
|
const [moduleIds] = usemoduleIds();
|
|
27
23
|
const [, setRecallAuditLog] = useGlobalStateHitAuditLog();
|
|
28
24
|
const [selected] = useSelectedData();
|
|
29
25
|
|
|
30
26
|
// Save New Note
|
|
27
|
+
const { fetchData: callAuditLogs } = useAxios<{
|
|
28
|
+
data: ApiResponse[];
|
|
29
|
+
}>({
|
|
30
|
+
endpoint: `/audit_logs/orders/`,
|
|
31
|
+
method: 'POST',
|
|
32
|
+
});
|
|
31
33
|
|
|
32
34
|
const [notificationData, setNotificationData] = useState<{
|
|
33
35
|
type: 'success' | 'error';
|
|
@@ -38,7 +40,6 @@ function AddNote() {
|
|
|
38
40
|
const saveNote = async () => {
|
|
39
41
|
setRecallAuditLog(false);
|
|
40
42
|
if (!noteText) return;
|
|
41
|
-
const endpoint = `${getBaseEndpoint()}/audit_logs/orders/`;
|
|
42
43
|
const payload = {
|
|
43
44
|
audit_logs: [
|
|
44
45
|
{
|
|
@@ -54,30 +55,25 @@ function AddNote() {
|
|
|
54
55
|
},
|
|
55
56
|
],
|
|
56
57
|
};
|
|
57
|
-
//to change
|
|
58
58
|
try {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
// setNoteLoadingStore(false);
|
|
69
|
-
|
|
70
|
-
if (response.ok) {
|
|
59
|
+
let response = (await callAuditLogs({
|
|
60
|
+
payload: payload,
|
|
61
|
+
})) as {
|
|
62
|
+
code: number | null;
|
|
63
|
+
error?: string | null | undefined;
|
|
64
|
+
[key: string]: any;
|
|
65
|
+
};
|
|
66
|
+
if (response.code == 200 && response?.data) {
|
|
71
67
|
notification.success({
|
|
72
68
|
message: 'Success',
|
|
73
|
-
description:
|
|
69
|
+
description: `${response?.message}`,
|
|
74
70
|
});
|
|
75
71
|
setNoteText('');
|
|
76
72
|
setRecallAuditLog(true);
|
|
77
73
|
} else {
|
|
78
74
|
notification.error({
|
|
79
75
|
message: 'Error',
|
|
80
|
-
description:
|
|
76
|
+
description: `${response?.error}`,
|
|
81
77
|
});
|
|
82
78
|
}
|
|
83
79
|
} catch (error) {
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
useOrderNotify,
|
|
14
14
|
useReminderNotiData,
|
|
15
15
|
useRouteDetails,
|
|
16
|
-
useTaskLoading,
|
|
16
|
+
// useTaskLoading,
|
|
17
17
|
} from '../order-actions/store';
|
|
18
18
|
|
|
19
19
|
interface ApiResponse {
|
|
@@ -30,7 +30,7 @@ function Notification() {
|
|
|
30
30
|
const [, setShowMoreInfo] = useInfoType();
|
|
31
31
|
const [OrderData] = useOrderDetails();
|
|
32
32
|
const [notificationData, setNotififcationData] = useNotificationData();
|
|
33
|
-
const [flagLoading] = useTaskLoading();
|
|
33
|
+
// const [flagLoading] = useTaskLoading();
|
|
34
34
|
const [reminderData, setReminderData] = useReminderNotiData();
|
|
35
35
|
const routeId = OrderData?.order_routes?.route_id;
|
|
36
36
|
const [, setRouteData] = useRouteDetails();
|
|
@@ -181,14 +181,7 @@ function Notification() {
|
|
|
181
181
|
</StyledTab>
|
|
182
182
|
</TabsData>
|
|
183
183
|
</Container>
|
|
184
|
-
{
|
|
185
|
-
<Loader>
|
|
186
|
-
<Spinner />
|
|
187
|
-
<Text>Fetching Notifications...</Text>
|
|
188
|
-
</Loader>
|
|
189
|
-
) : notificationData.length > 0 ||
|
|
190
|
-
reminderData.length > 0 ||
|
|
191
|
-
OrderData ? (
|
|
184
|
+
{notificationData.length > 0 || reminderData.length > 0 || OrderData ? (
|
|
192
185
|
<TabsWrapper>
|
|
193
186
|
<Tabs
|
|
194
187
|
activeNotifications={activeNotifications}
|
|
@@ -215,31 +208,31 @@ const Container = styled.div`
|
|
|
215
208
|
border-bottom: 1px solid #ccc;
|
|
216
209
|
`;
|
|
217
210
|
|
|
218
|
-
const Loader = styled.div`
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
`;
|
|
225
|
-
|
|
226
|
-
const Spinner = styled.div`
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
`;
|
|
211
|
+
// const Loader = styled.div`
|
|
212
|
+
// align-items: center;
|
|
213
|
+
// justify-content: center;
|
|
214
|
+
// display: flex;
|
|
215
|
+
// flex-direction: column;
|
|
216
|
+
// gap: 10px;
|
|
217
|
+
// `;
|
|
218
|
+
|
|
219
|
+
// const Spinner = styled.div`
|
|
220
|
+
// border: 4px solid rgba(0, 0, 0, 0.1);
|
|
221
|
+
// border-left-color: #3a3630;
|
|
222
|
+
// border-radius: 50%;
|
|
223
|
+
// width: 40px;
|
|
224
|
+
// height: 40px;
|
|
225
|
+
// animation: spin 1s linear infinite;
|
|
226
|
+
|
|
227
|
+
// @keyframes spin {
|
|
228
|
+
// 0% {
|
|
229
|
+
// transform: rotate(0deg);
|
|
230
|
+
// }
|
|
231
|
+
// 100% {
|
|
232
|
+
// transform: rotate(360deg);
|
|
233
|
+
// }
|
|
234
|
+
// }
|
|
235
|
+
// `;
|
|
243
236
|
|
|
244
237
|
const FlagContainer = styled.div`
|
|
245
238
|
padding: 8px;
|
|
@@ -326,11 +319,11 @@ const TabsWrapper = styled.div`
|
|
|
326
319
|
}
|
|
327
320
|
`;
|
|
328
321
|
|
|
329
|
-
const Text = styled.div`
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
`;
|
|
322
|
+
// const Text = styled.div`
|
|
323
|
+
// color: var(--tonal-brown-651, #6a7378);
|
|
324
|
+
// font-family: Lato;
|
|
325
|
+
// font-size: 13px;
|
|
326
|
+
// font-style: normal;
|
|
327
|
+
// font-weight: 600;
|
|
328
|
+
// `;
|
|
336
329
|
export default Notification;
|