@bjsdistribution/dms-client-return 0.0.88 → 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/assets/icons/DownloadIcon.d.ts +3 -0
- 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 +1169 -1904
- 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 +1171 -1906
- package/dist/dms-client-return.esm.js.map +1 -1
- package/package.json +2 -2
- package/src/assets/icons/DownloadIcon.tsx +36 -0
- 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-details/expanded-content/orders-section/DeliveryDate.tsx +2 -4
- package/src/components/order-view/order-resources/columns/actions/index.tsx +3 -3
- 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
|
@@ -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
|
}
|
|
@@ -5,7 +5,7 @@ import CustomerInformation from './customer-info';
|
|
|
5
5
|
import ProductTable from './tables/ProductTable';
|
|
6
6
|
import NotesTable from './tables/NotesTable';
|
|
7
7
|
import SlotAndInstructions from './slot-and-instructions';
|
|
8
|
-
import { useApiHook } from '@bjsdistribution/dms-component-library';
|
|
8
|
+
import { useApiHook, useAxios } from '@bjsdistribution/dms-component-library';
|
|
9
9
|
import {
|
|
10
10
|
useCurrentAction,
|
|
11
11
|
useCustomerInfo,
|
|
@@ -23,9 +23,7 @@ import {
|
|
|
23
23
|
import { ApiResponse } from '../../../types';
|
|
24
24
|
import { notification } from 'antd';
|
|
25
25
|
import { compareOrderDetailsStates, filterObject } from '../../../utils';
|
|
26
|
-
import useUpdateOrder from '../../../hooks/useUpdateOrder';
|
|
27
26
|
import { format } from 'date-fns';
|
|
28
|
-
// import { filterObject } from '../../../utils';
|
|
29
27
|
|
|
30
28
|
function ConfirmOrder() {
|
|
31
29
|
const [, setCurrentAction] = useCurrentAction();
|
|
@@ -41,13 +39,21 @@ function ConfirmOrder() {
|
|
|
41
39
|
const [, setRecalling] = useLiveRecalling();
|
|
42
40
|
const [orderId] = useOrderId();
|
|
43
41
|
const [errorState] = useErrorConfirmOrder();
|
|
44
|
-
const updateOrder = useUpdateOrder();
|
|
42
|
+
// const updateOrder = useUpdateOrder();
|
|
45
43
|
const [, setRecallOrders] = useGlobalStateHitOrder();
|
|
46
44
|
|
|
47
45
|
const onClose = () => {
|
|
48
46
|
setCurrentAction(undefined);
|
|
49
47
|
};
|
|
50
48
|
|
|
49
|
+
//update Order API
|
|
50
|
+
const { fetchData: callUpdateOrderAPI } = useAxios<{
|
|
51
|
+
data: ApiResponse[];
|
|
52
|
+
}>({
|
|
53
|
+
endpoint: `/orders/update/`,
|
|
54
|
+
method: 'PUT',
|
|
55
|
+
});
|
|
56
|
+
|
|
51
57
|
useEffect(() => {
|
|
52
58
|
const clone = JSON.parse(JSON.stringify(orderDetails));
|
|
53
59
|
setOrderDetailsConfirmOrder(clone);
|
|
@@ -129,7 +135,13 @@ function ConfirmOrder() {
|
|
|
129
135
|
|
|
130
136
|
const notUpdateOrder = hasOnlyIdKey(payload);
|
|
131
137
|
if (!notUpdateOrder) {
|
|
132
|
-
|
|
138
|
+
let response = (await callUpdateOrderAPI({
|
|
139
|
+
payload: [payload],
|
|
140
|
+
})) as {
|
|
141
|
+
code: number | null;
|
|
142
|
+
error?: string | null | undefined;
|
|
143
|
+
[key: string]: any;
|
|
144
|
+
};
|
|
133
145
|
if (response && response?.data?.length > 0) {
|
|
134
146
|
setOrderDetails(response?.data[0]);
|
|
135
147
|
setPrevOrderDetails(response?.data[0]);
|
package/src/components/order-view/order-actions/actions/create-task-reminder/CreateTaskModal.tsx
CHANGED
|
@@ -3,7 +3,6 @@ import {
|
|
|
3
3
|
useCategoryData,
|
|
4
4
|
useCreateTaskPayload,
|
|
5
5
|
useNotiifcationLabel,
|
|
6
|
-
useTaskLoading,
|
|
7
6
|
useTaskTypeData,
|
|
8
7
|
useTaskTypeExtended,
|
|
9
8
|
} from '../../store';
|
|
@@ -18,7 +17,6 @@ import RadioButtonGroup from '../../../../../common/radio-group/RadioButtonGroup
|
|
|
18
17
|
import styled from 'styled-components';
|
|
19
18
|
import { isValid } from 'date-fns';
|
|
20
19
|
import { TextArea } from '@bjsdistribution/dms-component-library';
|
|
21
|
-
import Loader from '../../../../order-daily-overview/header/loader/Loader';
|
|
22
20
|
import { StandardOptionsType } from '../../../../../common/radio-group/types';
|
|
23
21
|
import { DatePicker } from 'antd';
|
|
24
22
|
import dayjs from 'dayjs';
|
|
@@ -33,7 +31,6 @@ function CreateTaskModal() {
|
|
|
33
31
|
const [subCategory] = useTaskTypeExtended();
|
|
34
32
|
const [createTask, setPayload] = useCreateTaskPayload();
|
|
35
33
|
const [, setLabel] = useNotiifcationLabel();
|
|
36
|
-
const [loading] = useTaskLoading();
|
|
37
34
|
|
|
38
35
|
const handleSelectChange = () => console.log('');
|
|
39
36
|
|
|
@@ -132,7 +129,6 @@ function CreateTaskModal() {
|
|
|
132
129
|
|
|
133
130
|
return (
|
|
134
131
|
<Wrapper>
|
|
135
|
-
{loading && <Loader />}
|
|
136
132
|
<SplitContainer>
|
|
137
133
|
<FormRow label="Task Type" required>
|
|
138
134
|
<StyledAntSelect
|
|
@@ -2,6 +2,7 @@ import React, { useEffect } from 'react';
|
|
|
2
2
|
import {
|
|
3
3
|
RadioButtonGroup,
|
|
4
4
|
useApiHook,
|
|
5
|
+
useAxios,
|
|
5
6
|
} from '@bjsdistribution/dms-component-library';
|
|
6
7
|
import 'react-datepicker/dist/react-datepicker.css';
|
|
7
8
|
import {
|
|
@@ -10,22 +11,20 @@ import {
|
|
|
10
11
|
useCategoryData,
|
|
11
12
|
useCreateTaskPayload,
|
|
12
13
|
useDepartmentData,
|
|
14
|
+
useNotificationData,
|
|
13
15
|
useNotiifcationLabel,
|
|
14
|
-
useTaskLoading,
|
|
15
16
|
useTaskPriority,
|
|
16
17
|
useTaskTypeData,
|
|
17
18
|
useTaskTypeExtended,
|
|
18
19
|
} from '../../store';
|
|
19
|
-
import Loader from '../../../../order-daily-overview/header/loader/Loader';
|
|
20
20
|
import { allTypes } from '../../types';
|
|
21
21
|
import { ContentContainer } from './SharedComponents';
|
|
22
22
|
import { useCurrentAction, useOrderDetails } from '../../../store';
|
|
23
23
|
import OrderActionModal from '../../../../../common/modals/order-action-modal/OrderActionModal';
|
|
24
24
|
import styled from 'styled-components';
|
|
25
|
-
import useFetchUnresolvedTasks from '../../hooks/useAllTaskData';
|
|
26
25
|
import CreateTaskModal from './CreateTaskModal';
|
|
27
|
-
import useCreateTask from '../../hooks/useCreateTask';
|
|
28
26
|
import { CustomOptions } from '../../../../fakeData';
|
|
27
|
+
import { notification } from 'antd';
|
|
29
28
|
|
|
30
29
|
interface ApiResponse {
|
|
31
30
|
message: string;
|
|
@@ -36,17 +35,15 @@ interface ApiResponse {
|
|
|
36
35
|
}
|
|
37
36
|
|
|
38
37
|
function TaskModal() {
|
|
39
|
-
const createTaskAPI = useCreateTask();
|
|
40
38
|
const [, setCurrentAction] = useCurrentAction();
|
|
41
39
|
const [createTask, setPayload] = useCreateTaskPayload();
|
|
42
|
-
const [loading, setLoading] = useTaskLoading();
|
|
43
40
|
const [staticData, setStaticData] = useAllStaticData();
|
|
44
41
|
const [, setPriority] = useTaskPriority();
|
|
45
42
|
const [, setTaskCategory] = useCategoryData();
|
|
46
43
|
const [, setTaskTypes] = useTaskTypeData();
|
|
47
44
|
const [, setTaskTypeExtended] = useTaskTypeExtended();
|
|
48
45
|
const [, setDepartmentData] = useDepartmentData();
|
|
49
|
-
const
|
|
46
|
+
const [, setNotififcationData] = useNotificationData();
|
|
50
47
|
const [, setLabel] = useNotiifcationLabel();
|
|
51
48
|
const [orderDetails] = useOrderDetails();
|
|
52
49
|
|
|
@@ -56,12 +53,32 @@ function TaskModal() {
|
|
|
56
53
|
method: 'GET',
|
|
57
54
|
});
|
|
58
55
|
|
|
56
|
+
//create task API
|
|
57
|
+
const { fetchData: createFlagAPI } = useAxios<{
|
|
58
|
+
data: ApiResponse[];
|
|
59
|
+
}>({
|
|
60
|
+
endpoint: `/tasks/`,
|
|
61
|
+
method: 'POST',
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
//Unresolved API
|
|
65
|
+
const {
|
|
66
|
+
fetchData: callUnresolvedTaskApi,
|
|
67
|
+
data: fetchedUnresolvedData,
|
|
68
|
+
loading: unresolvedLoading,
|
|
69
|
+
} = useAxios<{
|
|
70
|
+
data: ApiResponse[];
|
|
71
|
+
}>({
|
|
72
|
+
endpoint: `/tasks/`,
|
|
73
|
+
method: 'GET',
|
|
74
|
+
pagination: { is_pagination: false },
|
|
75
|
+
filters: [{ field: 'order_id', op: '=', value: orderDetails?.id }],
|
|
76
|
+
});
|
|
77
|
+
|
|
59
78
|
useEffect(() => {
|
|
60
|
-
setLoading(true);
|
|
61
79
|
if (fetchedStaticData) {
|
|
62
80
|
setStaticData(fetchedStaticData.data);
|
|
63
81
|
}
|
|
64
|
-
setLoading(false);
|
|
65
82
|
}, [fetchedStaticData]);
|
|
66
83
|
|
|
67
84
|
//extracted types from whole static data
|
|
@@ -92,12 +109,36 @@ function TaskModal() {
|
|
|
92
109
|
};
|
|
93
110
|
|
|
94
111
|
const handleTaskSubmit = async () => {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
112
|
+
let response = (await createFlagAPI({
|
|
113
|
+
payload: { flags: [createTask] },
|
|
114
|
+
})) as {
|
|
115
|
+
code: number | null;
|
|
116
|
+
error?: string | null | undefined;
|
|
117
|
+
[key: string]: any;
|
|
118
|
+
};
|
|
119
|
+
if (response?.code == 200 && response?.data) {
|
|
120
|
+
notification.success({
|
|
121
|
+
message: 'Success',
|
|
122
|
+
description: `${response.message}`,
|
|
123
|
+
});
|
|
124
|
+
callUnresolvedTaskApi();
|
|
125
|
+
closeModal();
|
|
126
|
+
}
|
|
127
|
+
if (response?.code == null && response.error) {
|
|
128
|
+
return notification.error({
|
|
129
|
+
message: 'Failure',
|
|
130
|
+
description: `${response.error}`,
|
|
131
|
+
});
|
|
132
|
+
}
|
|
99
133
|
};
|
|
100
134
|
|
|
135
|
+
//flags data set
|
|
136
|
+
useEffect(() => {
|
|
137
|
+
if (fetchedUnresolvedData && fetchedUnresolvedData.data) {
|
|
138
|
+
setNotififcationData(fetchedUnresolvedData?.data);
|
|
139
|
+
}
|
|
140
|
+
}, [unresolvedLoading]);
|
|
141
|
+
|
|
101
142
|
const isSubmitDisabled = () => {
|
|
102
143
|
const { description, due_datetime, task_type_id } = createTask;
|
|
103
144
|
return !description || !due_datetime || !task_type_id;
|
|
@@ -117,7 +158,6 @@ function TaskModal() {
|
|
|
117
158
|
|
|
118
159
|
return (
|
|
119
160
|
<>
|
|
120
|
-
{loading && <Loader />}
|
|
121
161
|
<OrderModal
|
|
122
162
|
headerTitle={'CREATE TASK'}
|
|
123
163
|
onCloseHeader={closeModal}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useEffect } from 'react';
|
|
2
|
-
import { useApiHook } from '@bjsdistribution/dms-component-library';
|
|
2
|
+
import { useApiHook, useAxios } from '@bjsdistribution/dms-component-library';
|
|
3
3
|
import 'react-datepicker/dist/react-datepicker.css';
|
|
4
4
|
import CreateReminder from './CreateReminderModal';
|
|
5
5
|
import {
|
|
@@ -8,21 +8,17 @@ import {
|
|
|
8
8
|
useCategoryData,
|
|
9
9
|
useCreateReminderPayload,
|
|
10
10
|
useDepartmentData,
|
|
11
|
-
|
|
11
|
+
useReminderNotiData,
|
|
12
12
|
useTaskPriority,
|
|
13
13
|
useTaskTypeData,
|
|
14
14
|
useTaskTypeExtended,
|
|
15
15
|
} from '../../store';
|
|
16
|
-
import Loader from '../../../../order-daily-overview/header/loader/Loader';
|
|
17
|
-
import useCreateReminder from '../../hooks/useCreateReminder';
|
|
18
16
|
import { allTypes } from '../../types';
|
|
19
|
-
|
|
20
17
|
import { ContentContainer } from './SharedComponents';
|
|
21
|
-
import { useCurrentAction } from '../../../store';
|
|
18
|
+
import { useCurrentAction, useOrderDetails } from '../../../store';
|
|
22
19
|
import OrderActionModal from '../../../../../common/modals/order-action-modal/OrderActionModal';
|
|
23
20
|
import styled from 'styled-components';
|
|
24
|
-
import
|
|
25
|
-
import useFetchReminders from '../../hooks/useAllReminderData';
|
|
21
|
+
import { notification } from 'antd';
|
|
26
22
|
|
|
27
23
|
interface ApiResponse {
|
|
28
24
|
message: string;
|
|
@@ -33,19 +29,38 @@ interface ApiResponse {
|
|
|
33
29
|
}
|
|
34
30
|
|
|
35
31
|
function TaskReminderModal() {
|
|
36
|
-
const createReminderAPI = useCreateReminder();
|
|
37
32
|
const [, setCurrentAction] = useCurrentAction();
|
|
38
|
-
// const [modalType, setModalTypeState] = useState<string>('task');
|
|
39
33
|
const [createReminder, setReminderPayload] = useCreateReminderPayload();
|
|
40
|
-
const [loading, setLoading] = useTaskLoading();
|
|
41
34
|
const [staticData, setStaticData] = useAllStaticData();
|
|
42
35
|
const [, setPriority] = useTaskPriority();
|
|
43
36
|
const [, setTaskCategory] = useCategoryData();
|
|
44
37
|
const [, setTaskTypes] = useTaskTypeData();
|
|
45
38
|
const [, setTaskTypeExtended] = useTaskTypeExtended();
|
|
46
39
|
const [, setDepartmentData] = useDepartmentData();
|
|
47
|
-
const
|
|
48
|
-
const
|
|
40
|
+
const [, setReminderData] = useReminderNotiData();
|
|
41
|
+
const [OrderData] = useOrderDetails();
|
|
42
|
+
|
|
43
|
+
//create reminder API
|
|
44
|
+
const { fetchData: createReminderAPI } = useAxios<{
|
|
45
|
+
data: ApiResponse[];
|
|
46
|
+
}>({
|
|
47
|
+
endpoint: `/tasks/reminders/create/`,
|
|
48
|
+
method: 'POST',
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
//reminder get
|
|
52
|
+
const {
|
|
53
|
+
fetchData: callReminderApi,
|
|
54
|
+
data: fetchedReminderData,
|
|
55
|
+
loading: reminderLoading,
|
|
56
|
+
} = useAxios<{
|
|
57
|
+
data: ApiResponse[];
|
|
58
|
+
}>({
|
|
59
|
+
endpoint: `/tasks/reminder/get/`,
|
|
60
|
+
method: 'GET',
|
|
61
|
+
pagination: { is_pagination: false },
|
|
62
|
+
filters: [{ field: 'order_id', op: '=', value: OrderData.id }],
|
|
63
|
+
});
|
|
49
64
|
|
|
50
65
|
// API Call
|
|
51
66
|
const { data: fetchedStaticData } = useApiHook<ApiResponse>({
|
|
@@ -54,11 +69,9 @@ function TaskReminderModal() {
|
|
|
54
69
|
});
|
|
55
70
|
|
|
56
71
|
useEffect(() => {
|
|
57
|
-
setLoading(true);
|
|
58
72
|
if (fetchedStaticData) {
|
|
59
|
-
setStaticData(fetchedStaticData
|
|
73
|
+
setStaticData(fetchedStaticData?.data);
|
|
60
74
|
}
|
|
61
|
-
setLoading(false);
|
|
62
75
|
}, [fetchedStaticData]);
|
|
63
76
|
|
|
64
77
|
//extracted types from whole static data
|
|
@@ -81,13 +94,36 @@ function TaskReminderModal() {
|
|
|
81
94
|
};
|
|
82
95
|
|
|
83
96
|
const handleReminderSubmit = async () => {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
97
|
+
let response = (await createReminderAPI({
|
|
98
|
+
payload: { reminder: createReminder },
|
|
99
|
+
})) as {
|
|
100
|
+
code: number | null;
|
|
101
|
+
error?: string | null | undefined;
|
|
102
|
+
[key: string]: any;
|
|
103
|
+
};
|
|
104
|
+
if (response.code == 200 && response.data) {
|
|
105
|
+
notification.success({
|
|
106
|
+
message: 'Success',
|
|
107
|
+
description: `${response.message}`,
|
|
108
|
+
});
|
|
109
|
+
callReminderApi();
|
|
110
|
+
closeModal();
|
|
111
|
+
}
|
|
112
|
+
if (response?.code == null && response.error) {
|
|
113
|
+
return notification.error({
|
|
114
|
+
message: 'Failure',
|
|
115
|
+
description: `${response.error}`,
|
|
116
|
+
});
|
|
117
|
+
}
|
|
89
118
|
};
|
|
90
119
|
|
|
120
|
+
//reminder data set
|
|
121
|
+
useEffect(() => {
|
|
122
|
+
if (fetchedReminderData && fetchedReminderData?.data) {
|
|
123
|
+
setReminderData(fetchedReminderData?.data);
|
|
124
|
+
}
|
|
125
|
+
}, [reminderLoading]);
|
|
126
|
+
|
|
91
127
|
const isSubmitDisabled = () => {
|
|
92
128
|
const { details, due } = createReminder;
|
|
93
129
|
return !details || !due;
|
|
@@ -97,7 +133,6 @@ function TaskReminderModal() {
|
|
|
97
133
|
|
|
98
134
|
return (
|
|
99
135
|
<>
|
|
100
|
-
{loading && <Loader />}
|
|
101
136
|
<OrderModal
|
|
102
137
|
headerTitle={'CREATE REMINDER'}
|
|
103
138
|
onCloseHeader={closeModal}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CancelAndCompleteAction,
|
|
3
3
|
CancelationModal,
|
|
4
|
+
useAxios,
|
|
4
5
|
} from '@bjsdistribution/dms-component-library';
|
|
5
6
|
import React from 'react';
|
|
6
7
|
import styled from 'styled-components';
|
|
@@ -10,15 +11,23 @@ import {
|
|
|
10
11
|
useGlobalStateHitOrder,
|
|
11
12
|
useOrderDetails,
|
|
12
13
|
} from '../../../store';
|
|
13
|
-
import
|
|
14
|
+
import { notification } from 'antd';
|
|
15
|
+
import { ApiResponse } from '../../../types';
|
|
14
16
|
|
|
15
17
|
function OrderLock() {
|
|
16
18
|
const [, setCurrentAction] = useCurrentAction();
|
|
17
19
|
const [orderDetails, setOrderdetails] = useOrderDetails();
|
|
18
|
-
const lockOrder = useUpdateOrder();
|
|
19
20
|
const [, setRecallOrders] = useGlobalStateHitOrder();
|
|
20
21
|
const [, setRecallAuditLog] = useGlobalStateHitAuditLog();
|
|
21
22
|
|
|
23
|
+
//update order
|
|
24
|
+
const { fetchData: callUpdateOrderAPI } = useAxios<{
|
|
25
|
+
data: ApiResponse[];
|
|
26
|
+
}>({
|
|
27
|
+
endpoint: `/orders/update/`,
|
|
28
|
+
method: 'PUT',
|
|
29
|
+
});
|
|
30
|
+
|
|
22
31
|
const title =
|
|
23
32
|
orderDetails?.order_locked === true ? 'Unlocking Order' : 'Locking Order';
|
|
24
33
|
const action = orderDetails?.order_locked === true ? 'Unlock' : 'Lock';
|
|
@@ -32,13 +41,29 @@ function OrderLock() {
|
|
|
32
41
|
const isLocked =
|
|
33
42
|
orderDetails?.order_locked === null ? false : orderDetails?.order_locked;
|
|
34
43
|
const payload = [{ id: orderDetails?.id, order_locked: !isLocked }];
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
44
|
+
try {
|
|
45
|
+
let response = (await callUpdateOrderAPI({
|
|
46
|
+
payload: payload,
|
|
47
|
+
})) as {
|
|
48
|
+
code: number | null;
|
|
49
|
+
error?: string | null | undefined;
|
|
50
|
+
[key: string]: any;
|
|
51
|
+
};
|
|
52
|
+
if (response.code == 200 && response?.data?.length > 0) {
|
|
53
|
+
notification.success({
|
|
54
|
+
message: 'Success',
|
|
55
|
+
description: `${response?.message}`,
|
|
56
|
+
});
|
|
57
|
+
setOrderdetails(response?.data[0]);
|
|
58
|
+
setRecallAuditLog(true);
|
|
59
|
+
setRecallOrders(true);
|
|
60
|
+
} else {
|
|
61
|
+
notification.error({
|
|
62
|
+
message: 'Error',
|
|
63
|
+
description: `${response?.error}`,
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
} catch (error) {}
|
|
42
67
|
onClose();
|
|
43
68
|
};
|
|
44
69
|
return (
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import styled from 'styled-components';
|
|
3
3
|
import AllowTracking from './AllowTracking';
|
|
4
|
-
import { Button } from '@bjsdistribution/dms-component-library';
|
|
4
|
+
import { Button, useAxios } from '@bjsdistribution/dms-component-library';
|
|
5
5
|
import {
|
|
6
6
|
useAtom,
|
|
7
7
|
useOrderDetails,
|
|
@@ -13,21 +13,28 @@ import {
|
|
|
13
13
|
useGlobalStateHitAuditLog,
|
|
14
14
|
useGlobalStateHitOrder,
|
|
15
15
|
} from '../../../store';
|
|
16
|
-
import useUpdateOrder from '../../../hooks/useUpdateOrder';
|
|
17
16
|
import { compareOrderDetailsStates, filterObject } from '../../../utils';
|
|
18
|
-
import { OrderServiceType } from '../../../types';
|
|
17
|
+
import { ApiResponse, OrderServiceType } from '../../../types';
|
|
18
|
+
import { notification } from 'antd';
|
|
19
19
|
|
|
20
20
|
function OrderDetailsFooter() {
|
|
21
21
|
const [orderDetails, setOrderDetails] = useOrderDetails();
|
|
22
22
|
const [prevOrderDetails, setPrevOrderDetails] = usePrevOrderDetails();
|
|
23
23
|
const [, setCustomerInfo] = useCustomerInfo();
|
|
24
|
-
const updateOrder = useUpdateOrder();
|
|
25
24
|
const [errorState] = useAtom(errorAtom);
|
|
26
25
|
const [, setCallApi] = useUpdateApiCall(); //single detail
|
|
27
26
|
const [, setRecalling] = useLiveRecalling();
|
|
28
27
|
const [, setRecallAuditLog] = useGlobalStateHitAuditLog();
|
|
29
28
|
const [, setRecallOrders] = useGlobalStateHitOrder();
|
|
30
29
|
|
|
30
|
+
//update order
|
|
31
|
+
const { fetchData: callUpdateOrderAPI } = useAxios<{
|
|
32
|
+
data: ApiResponse[];
|
|
33
|
+
}>({
|
|
34
|
+
endpoint: `/orders/update/`,
|
|
35
|
+
method: 'PUT',
|
|
36
|
+
});
|
|
37
|
+
|
|
31
38
|
const errorFound = () => {
|
|
32
39
|
const isError =
|
|
33
40
|
errorState?.w3wError.length > 0 ||
|
|
@@ -83,11 +90,21 @@ function OrderDetailsFooter() {
|
|
|
83
90
|
setRecallAuditLog(false);
|
|
84
91
|
setRecallOrders(false);
|
|
85
92
|
const payload = compareOrderDetailsStates(prevOrderDetails, orderDetails);
|
|
86
|
-
|
|
93
|
+
let response = (await callUpdateOrderAPI({
|
|
94
|
+
payload: [payload],
|
|
95
|
+
})) as {
|
|
96
|
+
code: number | null;
|
|
97
|
+
error?: string | null | undefined;
|
|
98
|
+
[key: string]: any;
|
|
99
|
+
};
|
|
87
100
|
setCallApi(false);
|
|
88
101
|
setRecallOrders(true);
|
|
89
102
|
// setLogsCallAPi(prev => !prev);
|
|
90
103
|
if (response && response?.data?.length > 0) {
|
|
104
|
+
notification.success({
|
|
105
|
+
message: 'Success',
|
|
106
|
+
description: `${response?.message}`,
|
|
107
|
+
});
|
|
91
108
|
setOrderDetails(response?.data[0]);
|
|
92
109
|
setPrevOrderDetails(response?.data[0]);
|
|
93
110
|
setCustomerInfo({
|
package/src/components/order-view/order-details/expanded-content/orders-section/DeliveryDate.tsx
CHANGED
|
@@ -13,7 +13,6 @@ function DeliveryDate() {
|
|
|
13
13
|
const [orderDetails, setOrderDetails] = useOrderDetails();
|
|
14
14
|
const [prevOrderDetails] = usePrevOrderDetails();
|
|
15
15
|
const [orderStatus] = useStatusDetails();
|
|
16
|
-
|
|
17
16
|
const routedStatus = orderStatus?.[0]?.routed;
|
|
18
17
|
|
|
19
18
|
const actionDate = orderDetails?.action_date
|
|
@@ -53,15 +52,14 @@ function DeliveryDate() {
|
|
|
53
52
|
});
|
|
54
53
|
}
|
|
55
54
|
};
|
|
56
|
-
|
|
57
55
|
return (
|
|
58
56
|
<MainContainer>
|
|
59
|
-
<Label label="Delivery Date
|
|
57
|
+
<Label label="Delivery Date" />
|
|
60
58
|
<DatePicker
|
|
61
59
|
onChange={onChange}
|
|
62
60
|
value={actionDate === null ? actionDate : dayjs(actionDate)}
|
|
63
61
|
format="DD/MM/YY"
|
|
64
|
-
|
|
62
|
+
disabledDate={current => current && current < dayjs().startOf('day')}
|
|
65
63
|
allowClear={false}
|
|
66
64
|
disabled={routedStatus}
|
|
67
65
|
/>
|
|
@@ -5,7 +5,7 @@ import styled from 'styled-components';
|
|
|
5
5
|
import { atom } from 'jotai';
|
|
6
6
|
import { useOrderProductsResources } from '../../../store';
|
|
7
7
|
import { notification } from 'antd';
|
|
8
|
-
import
|
|
8
|
+
import DownloadIcon from '../../../../../assets/icons/DownloadIcon';
|
|
9
9
|
|
|
10
10
|
export const selectedOrderIdAtom = atom<number[]>([]);
|
|
11
11
|
|
|
@@ -48,7 +48,7 @@ function Action({ row }: ActionProps) {
|
|
|
48
48
|
message: 'Info',
|
|
49
49
|
description: `Download is in progress. Please wait`,
|
|
50
50
|
});
|
|
51
|
-
|
|
51
|
+
//to change
|
|
52
52
|
fetch(resourceUrl, {
|
|
53
53
|
method: 'GET',
|
|
54
54
|
headers: {},
|
|
@@ -114,7 +114,7 @@ function Action({ row }: ActionProps) {
|
|
|
114
114
|
opacity: isDownloading ? 0.6 : 1,
|
|
115
115
|
}}
|
|
116
116
|
>
|
|
117
|
-
<
|
|
117
|
+
<DownloadIcon />
|
|
118
118
|
</TippyContainer>
|
|
119
119
|
</Tippy>
|
|
120
120
|
</Row>
|
package/src/components/order-view/return-client-products/product-table/ReturnProductTable.tsx
CHANGED
|
@@ -8,7 +8,6 @@ import ActionIcon from '../../../../assets/icons/ActionIcon';
|
|
|
8
8
|
// import { useSelectedOrders } from '../../../store';
|
|
9
9
|
import { useOrderId, useOrderStaticData, useProductDetails } from '../../store';
|
|
10
10
|
import { ApiResponse } from '../../types';
|
|
11
|
-
import Loader from '../../../order-daily-overview/header/loader/Loader';
|
|
12
11
|
import { notification } from 'antd';
|
|
13
12
|
import { useNewReturnOrderData, useSelectedProducts } from '../../../store';
|
|
14
13
|
import styled from 'styled-components';
|
|
@@ -25,11 +24,7 @@ const ReturnProductTable = () => {
|
|
|
25
24
|
setSelectedRowId(id);
|
|
26
25
|
};
|
|
27
26
|
|
|
28
|
-
const {
|
|
29
|
-
data: isresponse,
|
|
30
|
-
setShouldPerformAction: setAction,
|
|
31
|
-
loading,
|
|
32
|
-
} = useApiHook<{
|
|
27
|
+
const { data: isresponse, setShouldPerformAction: setAction } = useApiHook<{
|
|
33
28
|
data: ApiResponse[];
|
|
34
29
|
}>({
|
|
35
30
|
endpoint: `order/order_products/delete/`,
|
|
@@ -100,7 +95,6 @@ const ReturnProductTable = () => {
|
|
|
100
95
|
|
|
101
96
|
return (
|
|
102
97
|
<div>
|
|
103
|
-
{loading && <Loader title="Deleting" />}
|
|
104
98
|
<StyledTableWrapper id="tableScrolling" className="orderProductTable">
|
|
105
99
|
<StyledTable>
|
|
106
100
|
<thead>
|