@bjsdistribution/dms-client-return 0.0.89 → 0.0.90
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/components/order-view/flags-action-modal/Actions.d.ts +1 -1
- package/dist/components/order-view/flags-action-modal/Header.d.ts +1 -1
- package/dist/dms-client-return.cjs.development.js +1136 -1898
- 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 +1138 -1900
- package/dist/dms-client-return.esm.js.map +1 -1
- package/package.json +2 -2
- package/src/components/order-daily-overview/return-after-table/table/OrderTable.tsx +0 -3
- package/src/components/order-daily-overview/return-order-table/return-orders-filters/ReturnOrderTable.tsx +1 -4
- package/src/components/order-daily-overview/table/ReturnTable.tsx +0 -2
- package/src/components/order-view/flags-action-modal/Actions.tsx +33 -17
- package/src/components/order-view/flags-action-modal/Header.tsx +34 -9
- package/src/components/order-view/flags-action-modal/index.tsx +44 -27
- package/src/components/order-view/index.tsx +28 -16
- package/src/components/order-view/notes/AddNote.tsx +1 -1
- package/src/components/order-view/notification/index.tsx +42 -15
- package/src/components/order-view/order-actions/actions/add-resources/index.tsx +40 -11
- package/src/components/order-view/order-actions/actions/confirm-order/index.tsx +17 -5
- package/src/components/order-view/order-actions/actions/create-task-reminder/CreateTaskModal.tsx +0 -4
- package/src/components/order-view/order-actions/actions/create-task-reminder/TaskModal.tsx +54 -14
- package/src/components/order-view/order-actions/actions/create-task-reminder/index.tsx +57 -22
- package/src/components/order-view/order-actions/actions/order-lock/index.tsx +34 -9
- package/src/components/order-view/order-details/expanded-content/footer/index.tsx +22 -5
- package/src/components/order-view/order-resources/columns/actions/index.tsx +1 -1
- package/src/components/order-view/return-client-products/product-table/ReturnProductTable.tsx +1 -7
- package/src/components/order-view/system-event-logs/expanded-content/index.tsx +23 -26
- package/src/components/order-view/view-reminder/ViewReminder.tsx +157 -118
- package/dist/components/order-view/hooks/AddResources.d.ts +0 -2
- package/dist/components/order-view/hooks/useGetEventNotes.d.ts +0 -2
- package/dist/components/order-view/hooks/useGetSystemLogs.d.ts +0 -2
- package/dist/components/order-view/hooks/useUpdateOrder.d.ts +0 -2
- package/dist/components/order-view/order-actions/hooks/useAllReminderData.d.ts +0 -2
- package/dist/components/order-view/order-actions/hooks/useAllTaskData.d.ts +0 -2
- package/dist/components/order-view/order-actions/hooks/useCreateReminder.d.ts +0 -3
- package/dist/components/order-view/order-actions/hooks/useCreateTask.d.ts +0 -3
- package/dist/components/order-view/order-actions/hooks/useFetchSingleFlagData.d.ts +0 -2
- package/dist/components/order-view/order-actions/hooks/useFetchSingleReminder.d.ts +0 -2
- package/dist/components/order-view/order-actions/hooks/useUpdateFlag.d.ts +0 -3
- package/dist/components/order-view/order-actions/hooks/useUpdateReminder.d.ts +0 -3
- package/src/components/order-view/hooks/AddResources.tsx +0 -54
- package/src/components/order-view/hooks/useGetEventNotes.tsx +0 -60
- package/src/components/order-view/hooks/useGetSystemLogs.tsx +0 -71
- package/src/components/order-view/hooks/useUpdateOrder.ts +0 -62
- package/src/components/order-view/order-actions/hooks/useAllReminderData.ts +0 -70
- package/src/components/order-view/order-actions/hooks/useAllTaskData.ts +0 -72
- package/src/components/order-view/order-actions/hooks/useCreateReminder.ts +0 -58
- package/src/components/order-view/order-actions/hooks/useCreateTask.ts +0 -58
- package/src/components/order-view/order-actions/hooks/useFetchSingleFlagData.ts +0 -58
- package/src/components/order-view/order-actions/hooks/useFetchSingleReminder.ts +0 -56
- package/src/components/order-view/order-actions/hooks/useUpdateFlag.ts +0 -54
- package/src/components/order-view/order-actions/hooks/useUpdateReminder.ts +0 -52
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.0.
|
|
2
|
+
"version": "0.0.90",
|
|
3
3
|
"license": "MIT",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"typings": "dist/index.d.ts",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"testEnvironment": "jest-environment-jsdom-sixteen"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
|
-
"@bjsdistribution/dms-component-library": "0.1.
|
|
62
|
+
"@bjsdistribution/dms-component-library": "0.1.87",
|
|
63
63
|
"@size-limit/preset-small-lib": "^11.0.1",
|
|
64
64
|
"@tippyjs/react": "^4.2.6",
|
|
65
65
|
"@types/react": "^18.2.47",
|
|
@@ -24,7 +24,6 @@ import {
|
|
|
24
24
|
import styled from 'styled-components';
|
|
25
25
|
import { useApiHook } from '@bjsdistribution/dms-component-library';
|
|
26
26
|
import { ApiResponse } from '../../common/interface';
|
|
27
|
-
import Loader from '../../header/loader/Loader';
|
|
28
27
|
import CaretDownFilledIcon from '../../../../common/CaretDownFilledIcon';
|
|
29
28
|
import SortIcon from '../../../../common/SortIcon';
|
|
30
29
|
|
|
@@ -163,7 +162,6 @@ const OrderTable = () => {
|
|
|
163
162
|
const {
|
|
164
163
|
data: actionResponse,
|
|
165
164
|
setShouldPerformAction: setAssignAction,
|
|
166
|
-
loading: AssignLoading,
|
|
167
165
|
error: apiError,
|
|
168
166
|
} = useApiHook<{
|
|
169
167
|
data: ApiResponse[];
|
|
@@ -212,7 +210,6 @@ const OrderTable = () => {
|
|
|
212
210
|
|
|
213
211
|
return (
|
|
214
212
|
<>
|
|
215
|
-
{AssignLoading && <Loader />}
|
|
216
213
|
<StyledTableWrapper className="fortables">
|
|
217
214
|
<StyledTable>
|
|
218
215
|
<thead>
|
|
@@ -7,7 +7,6 @@ import {
|
|
|
7
7
|
useGroupedPayload,
|
|
8
8
|
useLocationData,
|
|
9
9
|
useNewReturnPayload,
|
|
10
|
-
usePostLoading,
|
|
11
10
|
useReturnPayload,
|
|
12
11
|
useSelectAll,
|
|
13
12
|
useSelectedOrders,
|
|
@@ -27,7 +26,6 @@ import { filtersReducerAtom } from '../../header-filters/filterStore';
|
|
|
27
26
|
import { displayValueOrNA } from '../../shared/utlis';
|
|
28
27
|
import PrintDropDownReturn from '../../../order-view/details-filters/left-side-filters/dropdowns/PrintDropDownReturn';
|
|
29
28
|
import { format } from 'date-fns';
|
|
30
|
-
import Loader from '../../header/loader/Loader';
|
|
31
29
|
import CaretDownFilledIcon from '../../../../common/CaretDownFilledIcon';
|
|
32
30
|
import SortIcon from '../../../../common/SortIcon';
|
|
33
31
|
const ReturnOrderTable = () => {
|
|
@@ -38,7 +36,7 @@ const ReturnOrderTable = () => {
|
|
|
38
36
|
const { 'x-filters': filters, 'x-pagination': pagination } = state;
|
|
39
37
|
const [returnData, setReturnData] = useReturnData();
|
|
40
38
|
const [load, setLoading] = useLoading();
|
|
41
|
-
const [postLoading] = usePostLoading();
|
|
39
|
+
// const [postLoading] = usePostLoading();
|
|
42
40
|
const dropdownRefParent = useRef<HTMLDivElement>(null);
|
|
43
41
|
const dropdownRef = useRef<HTMLDivElement>(null);
|
|
44
42
|
const [printToogle, setPrintToggle] = usePrintOptionTOggle();
|
|
@@ -318,7 +316,6 @@ const ReturnOrderTable = () => {
|
|
|
318
316
|
|
|
319
317
|
return (
|
|
320
318
|
<>
|
|
321
|
-
{postLoading && <Loader />}
|
|
322
319
|
<StyledTableWrapper className="fortables">
|
|
323
320
|
<StyledTable>
|
|
324
321
|
<thead>
|
|
@@ -19,7 +19,6 @@ import { filtersReducerAtom } from '../header-filters/filterStore';
|
|
|
19
19
|
import { useCustomerData } from '../../store';
|
|
20
20
|
import SortIcon from '../../../common/SortIcon';
|
|
21
21
|
import CaretDownFilledIcon from '../../../common/CaretDownFilledIcon';
|
|
22
|
-
import Loader from '../header/loader/Loader';
|
|
23
22
|
|
|
24
23
|
interface ApiResponse {
|
|
25
24
|
message: string;
|
|
@@ -177,7 +176,6 @@ const ReturnTable: React.FC = () => {
|
|
|
177
176
|
|
|
178
177
|
return (
|
|
179
178
|
<>
|
|
180
|
-
{statsLoading && <Loader />}
|
|
181
179
|
<StyledTableWrapper>
|
|
182
180
|
<StyledTable>
|
|
183
181
|
<thead>
|
|
@@ -3,33 +3,49 @@ import styled from 'styled-components';
|
|
|
3
3
|
import {
|
|
4
4
|
Button,
|
|
5
5
|
RadioButtonGroup,
|
|
6
|
+
useAxios,
|
|
6
7
|
} from '@bjsdistribution/dms-component-library';
|
|
7
|
-
|
|
8
|
-
import {
|
|
9
|
-
useFlagsLoading,
|
|
10
|
-
useSingleFlagData,
|
|
11
|
-
useSinglePayload,
|
|
12
|
-
} from '../order-actions/store';
|
|
8
|
+
import { useSingleFlagData, useSinglePayload } from '../order-actions/store';
|
|
13
9
|
import { useCurrentAction } from '../store';
|
|
14
10
|
import Tippy from '@tippyjs/react';
|
|
15
|
-
import
|
|
16
|
-
import
|
|
11
|
+
import { notification } from 'antd';
|
|
12
|
+
import { ApiResponse } from '../types';
|
|
17
13
|
|
|
18
|
-
function ActionSection() {
|
|
14
|
+
function ActionSection({ callUnresolvedTaskApi }: any) {
|
|
19
15
|
const [, setCurrentAction] = useCurrentAction();
|
|
20
16
|
const [payload] = useSinglePayload();
|
|
21
17
|
const [dataArray] = useSingleFlagData();
|
|
22
|
-
const fetchData = useFetchUnresolvedTasks();
|
|
23
|
-
const [, setLoading] = useFlagsLoading();
|
|
24
18
|
|
|
25
|
-
|
|
19
|
+
//flag PUT API
|
|
20
|
+
const { fetchData: callFlagUpdateAPI } = useAxios<{
|
|
21
|
+
data: ApiResponse[];
|
|
22
|
+
}>({
|
|
23
|
+
endpoint: `/tasks/update/`,
|
|
24
|
+
method: 'PUT',
|
|
25
|
+
});
|
|
26
26
|
|
|
27
27
|
const onSubmit = async () => {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
28
|
+
let response = (await callFlagUpdateAPI({
|
|
29
|
+
payload: [payload],
|
|
30
|
+
})) as {
|
|
31
|
+
code: number | null;
|
|
32
|
+
error?: string | null | undefined;
|
|
33
|
+
[key: string]: any;
|
|
34
|
+
};
|
|
35
|
+
if (response.code == 200 && response.data) {
|
|
36
|
+
notification.success({
|
|
37
|
+
message: 'Success',
|
|
38
|
+
description: `${response.message}`,
|
|
39
|
+
});
|
|
40
|
+
setCurrentAction(undefined);
|
|
41
|
+
await callUnresolvedTaskApi();
|
|
42
|
+
}
|
|
43
|
+
if (response?.code == null && response.error) {
|
|
44
|
+
return notification.error({
|
|
45
|
+
message: 'Failure',
|
|
46
|
+
description: `${response.error}`,
|
|
47
|
+
});
|
|
48
|
+
}
|
|
33
49
|
};
|
|
34
50
|
|
|
35
51
|
const onCancel = () => {
|
|
@@ -4,20 +4,27 @@ import {
|
|
|
4
4
|
CancelAndCompleteAction,
|
|
5
5
|
CancelationModal,
|
|
6
6
|
CrossIcon,
|
|
7
|
+
useAxios,
|
|
7
8
|
} from '@bjsdistribution/dms-component-library';
|
|
8
9
|
import { useResolvedPayload, useSingleFlagData } from '../order-actions/store';
|
|
9
|
-
import useUpdateFlag from '../order-actions/hooks/useUpdateFlag';
|
|
10
10
|
import { useCurrentAction } from '../store';
|
|
11
|
-
import
|
|
11
|
+
import { notification } from 'antd';
|
|
12
|
+
import { ApiResponse } from '../types';
|
|
12
13
|
|
|
13
|
-
function HeaderSection() {
|
|
14
|
+
function HeaderSection({ callUnresolvedTaskApi }: any) {
|
|
14
15
|
const [dataArray] = useSingleFlagData();
|
|
15
16
|
const [forResolvedPayload, setPayload] = useResolvedPayload();
|
|
16
17
|
const [, setCurrentAction] = useCurrentAction();
|
|
17
|
-
const updateFlag = useUpdateFlag();
|
|
18
|
-
const fetchData = useFetchUnresolvedTasks();
|
|
19
18
|
const [isModalOpen, setIsModalOpen] = useState(false);
|
|
20
19
|
|
|
20
|
+
//flag PUT API
|
|
21
|
+
const { fetchData: callFlagUpdateAPI } = useAxios<{
|
|
22
|
+
data: ApiResponse[];
|
|
23
|
+
}>({
|
|
24
|
+
endpoint: `/tasks/update/`,
|
|
25
|
+
method: 'PUT',
|
|
26
|
+
});
|
|
27
|
+
|
|
21
28
|
useEffect(() => {
|
|
22
29
|
if (dataArray) {
|
|
23
30
|
setPayload({
|
|
@@ -37,10 +44,28 @@ function HeaderSection() {
|
|
|
37
44
|
};
|
|
38
45
|
|
|
39
46
|
const saveButton = async () => {
|
|
40
|
-
await
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
47
|
+
let response = (await callFlagUpdateAPI({
|
|
48
|
+
payload: [forResolvedPayload],
|
|
49
|
+
})) as {
|
|
50
|
+
code: number | null;
|
|
51
|
+
error?: string | null | undefined;
|
|
52
|
+
[key: string]: any;
|
|
53
|
+
};
|
|
54
|
+
if (response.code == 200 && response.data) {
|
|
55
|
+
notification.success({
|
|
56
|
+
message: 'Success',
|
|
57
|
+
description: `${response?.message}`,
|
|
58
|
+
});
|
|
59
|
+
setIsModalOpen(false); // Close modal after API call
|
|
60
|
+
setCurrentAction(undefined);
|
|
61
|
+
await callUnresolvedTaskApi();
|
|
62
|
+
}
|
|
63
|
+
if (response?.code == null && response.error) {
|
|
64
|
+
return notification.error({
|
|
65
|
+
message: 'Failure',
|
|
66
|
+
description: `${response?.error}`,
|
|
67
|
+
});
|
|
68
|
+
}
|
|
44
69
|
};
|
|
45
70
|
|
|
46
71
|
const onCancel = () => {
|
|
@@ -3,6 +3,7 @@ import styled from 'styled-components';
|
|
|
3
3
|
import {
|
|
4
4
|
BackgroundModal,
|
|
5
5
|
useApiHook,
|
|
6
|
+
useAxios,
|
|
6
7
|
} from '@bjsdistribution/dms-component-library';
|
|
7
8
|
import HeaderSection from './Header';
|
|
8
9
|
import TextSection from './TextSection';
|
|
@@ -13,7 +14,6 @@ import {
|
|
|
13
14
|
useCategoryData,
|
|
14
15
|
useDepartmentData,
|
|
15
16
|
useFlagRefId,
|
|
16
|
-
useFlagsLoading,
|
|
17
17
|
useSingleFlagData,
|
|
18
18
|
useSinglePayload,
|
|
19
19
|
useTaskPriority,
|
|
@@ -21,8 +21,6 @@ import {
|
|
|
21
21
|
useTaskTypeExtended,
|
|
22
22
|
} from '../order-actions/store';
|
|
23
23
|
import DetailSection from './DetailSection';
|
|
24
|
-
import Loader from '../../order-daily-overview/header/loader/Loader';
|
|
25
|
-
import useFetchSingleFlagsData from '../order-actions/hooks/useFetchSingleFlagData';
|
|
26
24
|
import { allTypes } from '../order-actions/types';
|
|
27
25
|
|
|
28
26
|
interface ApiResponse {
|
|
@@ -36,10 +34,8 @@ interface ApiResponse {
|
|
|
36
34
|
function ViewFlag() {
|
|
37
35
|
const [dataArray, setSingleFlag] = useSingleFlagData();
|
|
38
36
|
const [flagRefId] = useFlagRefId();
|
|
39
|
-
//const [ssoToken] = useSsoToken();
|
|
40
|
-
const [loading, setLoading] = useFlagsLoading();
|
|
41
37
|
const [payload, setPayload] = useSinglePayload();
|
|
42
|
-
const fetchData = useFetchSingleFlagsData();
|
|
38
|
+
// const fetchData = useFetchSingleFlagsData();
|
|
43
39
|
const [staticData, setStaticData] = useAllStaticData();
|
|
44
40
|
const [, setPriority] = useTaskPriority();
|
|
45
41
|
const [, setTaskCategory] = useCategoryData();
|
|
@@ -47,6 +43,25 @@ function ViewFlag() {
|
|
|
47
43
|
const [, setTaskTypeExtended] = useTaskTypeExtended();
|
|
48
44
|
const [, setDepartmentData] = useDepartmentData();
|
|
49
45
|
|
|
46
|
+
//single flag data
|
|
47
|
+
const {
|
|
48
|
+
data: singleFlagData,
|
|
49
|
+
fetchData: fetchedSingleFlagData,
|
|
50
|
+
loading,
|
|
51
|
+
} = useAxios<ApiResponse>({
|
|
52
|
+
endpoint: `/tasks/${flagRefId}`,
|
|
53
|
+
method: 'GET',
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
//Unresolved API
|
|
57
|
+
const { fetchData: callUnresolvedTaskApi } = useAxios<{
|
|
58
|
+
data: ApiResponse[];
|
|
59
|
+
}>({
|
|
60
|
+
endpoint: `/tasks/`,
|
|
61
|
+
method: 'GET',
|
|
62
|
+
pagination: { is_pagination: false },
|
|
63
|
+
});
|
|
64
|
+
|
|
50
65
|
// API Call
|
|
51
66
|
const { data: fetchedStaticData } = useApiHook<ApiResponse>({
|
|
52
67
|
endpoint: `/tasks/getStaticData/all/`,
|
|
@@ -72,17 +87,18 @@ function ViewFlag() {
|
|
|
72
87
|
}
|
|
73
88
|
}, [staticData]);
|
|
74
89
|
|
|
75
|
-
const fetchAndSetSingleFlagData = async () => {
|
|
76
|
-
setLoading(true);
|
|
77
|
-
const result = await fetchData();
|
|
78
|
-
setSingleFlag(result);
|
|
79
|
-
setLoading(false);
|
|
80
|
-
};
|
|
81
|
-
|
|
82
90
|
useEffect(() => {
|
|
83
|
-
|
|
91
|
+
if (flagRefId) {
|
|
92
|
+
fetchedSingleFlagData();
|
|
93
|
+
}
|
|
84
94
|
}, [flagRefId]);
|
|
85
95
|
|
|
96
|
+
useEffect(() => {
|
|
97
|
+
if (singleFlagData && singleFlagData?.data) {
|
|
98
|
+
setSingleFlag(singleFlagData?.data[0]);
|
|
99
|
+
}
|
|
100
|
+
}, [loading]);
|
|
101
|
+
|
|
86
102
|
useEffect(() => {
|
|
87
103
|
setPayload({
|
|
88
104
|
...payload,
|
|
@@ -97,19 +113,20 @@ function ViewFlag() {
|
|
|
97
113
|
|
|
98
114
|
return (
|
|
99
115
|
<>
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
116
|
+
{dataArray && (
|
|
117
|
+
<BackgroundModals>
|
|
118
|
+
<MainContainer>
|
|
119
|
+
<HeaderSection callUnresolvedTaskApi={callUnresolvedTaskApi} />
|
|
120
|
+
<DetailSection />
|
|
121
|
+
<TextSection />
|
|
122
|
+
<ButtonsSection />
|
|
123
|
+
<SectionsContainer>
|
|
124
|
+
<ActionSection callUnresolvedTaskApi={callUnresolvedTaskApi} />
|
|
125
|
+
<RadioButtonsSection />
|
|
126
|
+
</SectionsContainer>
|
|
127
|
+
</MainContainer>
|
|
128
|
+
</BackgroundModals>
|
|
129
|
+
)}
|
|
113
130
|
</>
|
|
114
131
|
);
|
|
115
132
|
}
|
|
@@ -6,8 +6,7 @@ import SystemLogs from './system-event-logs/expanded-content';
|
|
|
6
6
|
import GeneralHeader from './general-information';
|
|
7
7
|
import ProductsInfo from './products-info';
|
|
8
8
|
import OrderActions from './order-actions';
|
|
9
|
-
import { useApiHook } from '@bjsdistribution/dms-component-library';
|
|
10
|
-
|
|
9
|
+
import { useApiHook, useAxios } from '@bjsdistribution/dms-component-library';
|
|
11
10
|
import {
|
|
12
11
|
useOrderDetails,
|
|
13
12
|
useOrderStaticData,
|
|
@@ -16,7 +15,6 @@ import {
|
|
|
16
15
|
useDepotOptions,
|
|
17
16
|
usePrevOrderDetails,
|
|
18
17
|
useOrderProductsResources,
|
|
19
|
-
// useOrderProductsToolbox,
|
|
20
18
|
useCustomerInfo,
|
|
21
19
|
useLocationOptions,
|
|
22
20
|
useOrderProductSystemLogs,
|
|
@@ -31,9 +29,7 @@ import {
|
|
|
31
29
|
} from './store';
|
|
32
30
|
import { OrdersType } from './types';
|
|
33
31
|
import { useLocation } from 'react-router-dom';
|
|
34
|
-
import useSystemLogs from './hooks/useGetSystemLogs';
|
|
35
32
|
import { notification } from 'antd';
|
|
36
|
-
// import { useAssignData } from '../store';
|
|
37
33
|
import DetailsFilters from './details-filters/DetailsFilters';
|
|
38
34
|
import { useSubContracterData, useVisibilityData } from '../store';
|
|
39
35
|
import Notification from './notification';
|
|
@@ -65,22 +61,41 @@ function OrderView() {
|
|
|
65
61
|
const [, setCustomerInfo] = useCustomerInfo();
|
|
66
62
|
const [, setLocationOptions] = useLocationOptions();
|
|
67
63
|
const [orderResources, setOrderResources] = useOrderProductsResources();
|
|
68
|
-
// const [orderToolbox, setOrderToolbox] = useOrderProductsToolbox();
|
|
69
64
|
const [GsitCUstomerId, setGsitCUstomerId] = useGsitCUstomerId();
|
|
70
65
|
const [, setOrderProductId] = useOrderProductId();
|
|
71
66
|
const [, setCUstomerId] = useCUstomerId();
|
|
72
67
|
const [, setRouteId] = useRouteId();
|
|
73
68
|
const [liveRecalling] = useLiveRecalling();
|
|
74
|
-
const systemLogsData = useSystemLogs();
|
|
75
69
|
const [, setVisibilityData] = useVisibilityData();
|
|
76
70
|
const [, setSubContracterData] = useSubContracterData();
|
|
77
71
|
const [recallOrders] = useGlobalStateHitOrder();
|
|
78
72
|
const [, setStatusVal] = useAllOrderStatus();
|
|
73
|
+
const gsitId = orderDetails?.gsit_order_id;
|
|
79
74
|
|
|
80
75
|
useEffect(() => {
|
|
81
76
|
setStatusVal(orderDetails?.status_value);
|
|
82
77
|
}, [orderDetails?.status_value]);
|
|
83
78
|
|
|
79
|
+
//get system event logs
|
|
80
|
+
const {
|
|
81
|
+
data: fetchedSystemLogsData,
|
|
82
|
+
fetchData: callSystemLogsAPI,
|
|
83
|
+
loading: logsLoading,
|
|
84
|
+
} = useAxios<{
|
|
85
|
+
data: any[];
|
|
86
|
+
}>({
|
|
87
|
+
endpoint: `/events/get/event/`,
|
|
88
|
+
method: 'GET',
|
|
89
|
+
pagination: { page: 1, per_page: 100 },
|
|
90
|
+
filters: [
|
|
91
|
+
{
|
|
92
|
+
field: 'object_id',
|
|
93
|
+
op: '=',
|
|
94
|
+
value: `${gsitId}`,
|
|
95
|
+
},
|
|
96
|
+
],
|
|
97
|
+
});
|
|
98
|
+
|
|
84
99
|
// query param
|
|
85
100
|
const location = useLocation();
|
|
86
101
|
const [filters, setFilters] = useState<
|
|
@@ -131,7 +146,6 @@ function OrderView() {
|
|
|
131
146
|
}
|
|
132
147
|
} else {
|
|
133
148
|
const paths = location.pathname.split('/');
|
|
134
|
-
console.log(paths[paths.length - 1], 'paths');
|
|
135
149
|
setOrderId(paths[paths.length - 1]);
|
|
136
150
|
}
|
|
137
151
|
}, [location.search, loadingExternal]);
|
|
@@ -359,25 +373,23 @@ function OrderView() {
|
|
|
359
373
|
setLocationOptions(locationOptions);
|
|
360
374
|
}
|
|
361
375
|
}, [dataLoading]);
|
|
362
|
-
let gsitId = orderDetails?.gsit_order_id;
|
|
363
376
|
const [, setSystemLogsEvents] = useOrderProductSystemLogs();
|
|
364
377
|
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
378
|
+
useEffect(() => {
|
|
379
|
+
if (fetchedSystemLogsData && fetchedSystemLogsData?.data) {
|
|
380
|
+
setSystemLogsEvents(fetchedSystemLogsData?.data);
|
|
381
|
+
}
|
|
382
|
+
}, [logsLoading]);
|
|
369
383
|
|
|
370
384
|
useEffect(() => {
|
|
371
385
|
if (gsitOrderId) {
|
|
372
|
-
|
|
386
|
+
callSystemLogsAPI();
|
|
373
387
|
}
|
|
374
388
|
return () => {
|
|
375
389
|
setGsitOrderId(undefined);
|
|
376
390
|
};
|
|
377
391
|
}, [gsitId]);
|
|
378
392
|
|
|
379
|
-
console.log(orderId, 'orderId');
|
|
380
|
-
|
|
381
393
|
const { data: fetchedSubcontractotData, loading: apiLoading } = useApiHook<{
|
|
382
394
|
data: ApiResponse[];
|
|
383
395
|
}>({
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
SectionHeader,
|
|
3
3
|
useApiHook,
|
|
4
|
+
useAxios,
|
|
4
5
|
} from '@bjsdistribution/dms-component-library';
|
|
5
6
|
import React, { useEffect, useState } from 'react';
|
|
6
7
|
import Tabs from './Tabs';
|
|
7
8
|
import styled from 'styled-components';
|
|
8
9
|
import { useInfoType, useOrderDetails, useTabType } from '../store';
|
|
9
10
|
import NotifyFlag from '../../../assets/icons/NotifyFlag';
|
|
10
|
-
import useFetchUnresolvedTasks from '../order-actions/hooks/useAllTaskData';
|
|
11
11
|
import {
|
|
12
12
|
useNotificationData,
|
|
13
13
|
useOrderNotify,
|
|
@@ -15,7 +15,6 @@ import {
|
|
|
15
15
|
useRouteDetails,
|
|
16
16
|
useTaskLoading,
|
|
17
17
|
} from '../order-actions/store';
|
|
18
|
-
import useFetchReminders from '../order-actions/hooks/useAllReminderData';
|
|
19
18
|
|
|
20
19
|
interface ApiResponse {
|
|
21
20
|
message: string;
|
|
@@ -29,8 +28,6 @@ interface ApiResponse {
|
|
|
29
28
|
function Notification() {
|
|
30
29
|
const [activeTab, setActiveTab] = useTabType();
|
|
31
30
|
const [, setShowMoreInfo] = useInfoType();
|
|
32
|
-
const TaskData = useFetchUnresolvedTasks();
|
|
33
|
-
const ReminderData = useFetchReminders();
|
|
34
31
|
const [OrderData] = useOrderDetails();
|
|
35
32
|
const [notificationData, setNotififcationData] = useNotificationData();
|
|
36
33
|
const [flagLoading] = useTaskLoading();
|
|
@@ -43,22 +40,52 @@ function Notification() {
|
|
|
43
40
|
const [activeReminders, setActiveReminders] = useState([]);
|
|
44
41
|
const [closedReminders, setCloseReminders] = useState([]);
|
|
45
42
|
|
|
43
|
+
//Unresolved API
|
|
44
|
+
const {
|
|
45
|
+
data: fetchedUnresolvedData,
|
|
46
|
+
loading: unresolvedLoading,
|
|
47
|
+
fetchData: callUnresolvedTaskApi,
|
|
48
|
+
} = useAxios<{
|
|
49
|
+
data: ApiResponse[];
|
|
50
|
+
}>({
|
|
51
|
+
endpoint: `/tasks/`,
|
|
52
|
+
method: 'GET',
|
|
53
|
+
pagination: { is_pagination: false },
|
|
54
|
+
filters: [{ field: 'order_id', op: '=', value: OrderData.id }],
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
//reminder get
|
|
58
|
+
const {
|
|
59
|
+
data: fetchedReminderData,
|
|
60
|
+
loading: reminderLoading,
|
|
61
|
+
fetchData: callReminderApi,
|
|
62
|
+
} = useAxios<{
|
|
63
|
+
data: ApiResponse[];
|
|
64
|
+
}>({
|
|
65
|
+
endpoint: `/tasks/reminder/get/`,
|
|
66
|
+
method: 'GET',
|
|
67
|
+
pagination: { is_pagination: false },
|
|
68
|
+
filters: [{ field: 'order_id', op: '=', value: OrderData.id }],
|
|
69
|
+
});
|
|
70
|
+
|
|
46
71
|
const handleTabChange = (tab: string) => {
|
|
47
72
|
setActiveTab(tab);
|
|
48
73
|
setShowMoreInfo(false);
|
|
49
74
|
};
|
|
50
75
|
|
|
51
76
|
//flags notification data
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
77
|
+
useEffect(() => {
|
|
78
|
+
if (fetchedUnresolvedData && fetchedUnresolvedData?.data) {
|
|
79
|
+
setNotififcationData(fetchedUnresolvedData?.data);
|
|
80
|
+
}
|
|
81
|
+
}, [unresolvedLoading]);
|
|
56
82
|
|
|
57
|
-
//reminder
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
83
|
+
//reminder data set
|
|
84
|
+
useEffect(() => {
|
|
85
|
+
if (fetchedReminderData && fetchedReminderData?.data) {
|
|
86
|
+
setReminderData(fetchedReminderData?.data);
|
|
87
|
+
}
|
|
88
|
+
}, [reminderLoading]);
|
|
62
89
|
|
|
63
90
|
//route API calling...
|
|
64
91
|
const { data: fetchedData, setShouldPerformAction } = useApiHook<{
|
|
@@ -71,8 +98,8 @@ function Notification() {
|
|
|
71
98
|
|
|
72
99
|
useEffect(() => {
|
|
73
100
|
if (OrderData.id) {
|
|
74
|
-
|
|
75
|
-
|
|
101
|
+
callReminderApi();
|
|
102
|
+
callUnresolvedTaskApi();
|
|
76
103
|
}
|
|
77
104
|
}, [OrderData.id]);
|
|
78
105
|
|
|
@@ -9,29 +9,33 @@ import {
|
|
|
9
9
|
useAtom,
|
|
10
10
|
useCurrentAction,
|
|
11
11
|
useCustomerInfo,
|
|
12
|
+
useOrderId,
|
|
12
13
|
useOrderStaticData,
|
|
13
14
|
} from '../../../store';
|
|
14
15
|
import {
|
|
15
16
|
selectedCategoryIdAtom,
|
|
16
17
|
selectedDocumentTypeAtom,
|
|
17
18
|
selectedTypeAtom,
|
|
19
|
+
selectedVisibilityAtom,
|
|
18
20
|
setResourcesCall,
|
|
19
21
|
} from '../../store';
|
|
20
22
|
import OrderActionsDropdown from '../../Dropdown';
|
|
21
23
|
import { notification } from 'antd';
|
|
22
|
-
import
|
|
24
|
+
import { ApiResponse } from '../../../types';
|
|
25
|
+
import { useAxios } from '@bjsdistribution/dms-component-library';
|
|
23
26
|
|
|
24
27
|
function AddResources() {
|
|
25
28
|
const [, setCurrentAction] = useCurrentAction();
|
|
26
29
|
const [staticOrderData] = useOrderStaticData();
|
|
27
30
|
const [, setSelectedType] = useAtom(selectedTypeAtom);
|
|
28
31
|
const [uploadedFiles, setUploadedFiles] = useAtom(uploadedFilesAtom);
|
|
29
|
-
const uploadFiles = useUploadFiles();
|
|
30
32
|
const [isFormValid, setIsFormValid] = useState(false);
|
|
31
33
|
const [selectedCategoryId] = useAtom(selectedCategoryIdAtom);
|
|
32
34
|
const [selectedDocumentType] = useAtom(selectedDocumentTypeAtom);
|
|
33
35
|
const [selectedType] = useAtom(selectedTypeAtom);
|
|
34
36
|
const [, setResources] = useAtom(setResourcesCall);
|
|
37
|
+
const [orderId] = useOrderId();
|
|
38
|
+
const [selectedVisibility] = useAtom(selectedVisibilityAtom);
|
|
35
39
|
|
|
36
40
|
const onClose = () => {
|
|
37
41
|
setCurrentAction(undefined);
|
|
@@ -54,6 +58,17 @@ function AddResources() {
|
|
|
54
58
|
setSelectedType(selectedOption.value);
|
|
55
59
|
}
|
|
56
60
|
};
|
|
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
|
+
|
|
57
72
|
const handleSubmit = async () => {
|
|
58
73
|
if (!uploadedFiles) {
|
|
59
74
|
notification.error({ message: 'No files selected' });
|
|
@@ -68,15 +83,29 @@ function AddResources() {
|
|
|
68
83
|
}
|
|
69
84
|
|
|
70
85
|
try {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
86
|
+
let response = (await callUploadFile({
|
|
87
|
+
payload: formData,
|
|
88
|
+
})) as {
|
|
89
|
+
code: number | null;
|
|
90
|
+
error?: string | null | undefined;
|
|
91
|
+
[key: string]: any;
|
|
92
|
+
};
|
|
93
|
+
if (response?.code == 200 && response?.data?.length > 0) {
|
|
94
|
+
notification.success({
|
|
95
|
+
message: 'Success',
|
|
96
|
+
description: `${response?.message}`,
|
|
97
|
+
});
|
|
98
|
+
onClose(); // Close modal after successful upload
|
|
99
|
+
setResources(false);
|
|
100
|
+
setTimeout(() => {
|
|
101
|
+
setResources(true);
|
|
102
|
+
}, 1000);
|
|
103
|
+
} else {
|
|
104
|
+
notification.error({
|
|
105
|
+
message: 'Error',
|
|
106
|
+
description: `${response?.error}`,
|
|
107
|
+
});
|
|
108
|
+
}
|
|
80
109
|
} catch (error) {
|
|
81
110
|
console.error('Upload failed:', error);
|
|
82
111
|
}
|