@bjsdistribution/dms-client-return 0.0.54 → 0.0.56
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/details-filters/left-side-filters/dropdowns/MenuDropDown.d.ts +2 -2
- package/dist/components/order-view/details-filters/left-side-filters/dropdowns/OptionsDropDown.d.ts +2 -2
- package/dist/components/order-view/fakedata.d.ts +1 -1
- package/dist/components/order-view/store.d.ts +1 -0
- package/dist/dms-client-return.cjs.development.js +400 -369
- 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 +400 -369
- package/dist/dms-client-return.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/order-daily-overview/header-filters/SelectionFilter.tsx +1 -1
- package/src/components/order-daily-overview/return-after-table/table/OrderTable.tsx +1 -1
- package/src/components/order-daily-overview/table/ReturnTable.tsx +2 -2
- package/src/components/order-view/details-filters/left-side-filters/dropdowns/DropDowns.tsx +1 -1
- package/src/components/order-view/details-filters/left-side-filters/dropdowns/MenuDropDown.tsx +57 -45
- package/src/components/order-view/details-filters/left-side-filters/dropdowns/OptionsDropDown.tsx +74 -61
- package/src/components/order-view/fakedata.ts +6 -69
- package/src/components/order-view/general-information/dropdowns/Print.tsx +57 -35
- package/src/components/order-view/general-information/dropdowns/index.tsx +1 -2
- package/src/components/order-view/index.tsx +81 -59
- package/src/components/order-view/modalsPopup/ModalManager.tsx +1 -1
- package/src/components/order-view/notes/order-dropdown/NewReturnDropdown.tsx +3 -1
- package/src/components/order-view/order-actions/actions/change-customer-account/ChangeCustomerAccModal.tsx +3 -3
- package/src/components/order-view/order-actions/actions/confirm-order/tables/NotesTable.tsx +3 -1
- package/src/components/order-view/order-actions/actions/unhold-order/UnholdOrder.tsx +72 -7
- package/src/components/order-view/return-client-products/product-table/ReturnProductTable.tsx +9 -3
- package/src/components/order-view/store.ts +7 -0
- package/src/index.tsx +4 -20
- package/dist/components/order-view/general-information/dropdowns/Options.d.ts +0 -3
- package/src/components/order-view/general-information/dropdowns/Options.tsx +0 -68
|
@@ -1,15 +1,10 @@
|
|
|
1
1
|
import React, { useEffect, useState } from 'react';
|
|
2
|
-
// import Notification from './notification';
|
|
3
2
|
import styled from 'styled-components';
|
|
4
3
|
import OrderDetails from './order-details';
|
|
5
4
|
import Notes from './notes';
|
|
6
|
-
// import Order from './order-resources/expanded-content';
|
|
7
|
-
// import Toolbox from './toolbox-resources/expanded-content';
|
|
8
5
|
import SystemLogs from './system-event-logs/expanded-content';
|
|
9
6
|
import GeneralHeader from './general-information';
|
|
10
7
|
import ProductsInfo from './products-info';
|
|
11
|
-
// import { OrderViewType } from '../types';
|
|
12
|
-
// import Modals from './modals';
|
|
13
8
|
import OrderActions from './order-actions';
|
|
14
9
|
import { useApiHook } from '@bjsdistribution/dms-component-library';
|
|
15
10
|
|
|
@@ -30,15 +25,13 @@ import {
|
|
|
30
25
|
useRouteId,
|
|
31
26
|
useGsitOrderId,
|
|
32
27
|
useOrderProductId,
|
|
33
|
-
useApiCalling,
|
|
34
28
|
useLiveRecalling,
|
|
35
29
|
} from './store';
|
|
36
|
-
// import Loader from '../order-daily-overview/header/loader/Loader';
|
|
37
|
-
// import { useLoading } from '../order-daily-overview/store/store';
|
|
38
30
|
import { OrdersType } from './types';
|
|
39
31
|
import { useLocation } from 'react-router-dom';
|
|
40
32
|
import useSystemLogs from './hooks/useGetSystemLogs';
|
|
41
33
|
import { notification } from 'antd';
|
|
34
|
+
import { useAssignData } from '../store';
|
|
42
35
|
import DetailsFilters from './details-filters/DetailsFilters';
|
|
43
36
|
|
|
44
37
|
interface ApiResponse {
|
|
@@ -56,11 +49,6 @@ function OrderView() {
|
|
|
56
49
|
});
|
|
57
50
|
const [orderId, setOrderId] = useOrderId();
|
|
58
51
|
const [gsitOrderId, setGsitOrderId] = useGsitOrderId();
|
|
59
|
-
const splitPath = (str: any) => {
|
|
60
|
-
const parts = str?.split('/')?.filter((part: any) => part !== ''); // Filter out empty parts
|
|
61
|
-
return parts;
|
|
62
|
-
};
|
|
63
|
-
|
|
64
52
|
// For API Call
|
|
65
53
|
const [orderDetails, setOrderDetails] = useOrderDetails();
|
|
66
54
|
const [, setPrevOrderDetails] = usePrevOrderDetails();
|
|
@@ -69,10 +57,8 @@ function OrderView() {
|
|
|
69
57
|
const [, setOrderStatus] = useStatusDetails();
|
|
70
58
|
const [, setDepotOptions] = useDepotOptions();
|
|
71
59
|
const [, setCustomerInfo] = useCustomerInfo();
|
|
72
|
-
const location = useLocation();
|
|
73
|
-
const paths = splitPath(location.pathname);
|
|
74
60
|
const [, setLocationOptions] = useLocationOptions();
|
|
75
|
-
|
|
61
|
+
|
|
76
62
|
const [orderResources, setOrderResources] = useOrderProductsResources();
|
|
77
63
|
const [orderToolbox, setOrderToolbox] = useOrderProductsToolbox();
|
|
78
64
|
const [GsitCUstomerId, setGsitCUstomerId] = useGsitCUstomerId();
|
|
@@ -81,6 +67,61 @@ function OrderView() {
|
|
|
81
67
|
const [, setRouteId] = useRouteId();
|
|
82
68
|
const [liveRecalling] = useLiveRecalling();
|
|
83
69
|
const systemLogsData = useSystemLogs();
|
|
70
|
+
const [, setAssignData] = useAssignData();
|
|
71
|
+
|
|
72
|
+
// query param
|
|
73
|
+
const location = useLocation();
|
|
74
|
+
const [filters, setFilters] = useState<
|
|
75
|
+
Array<{ field: string; op: string; value: string | null }>
|
|
76
|
+
>([]);
|
|
77
|
+
|
|
78
|
+
// for third party apps
|
|
79
|
+
const {
|
|
80
|
+
data: fetchedDataExternal,
|
|
81
|
+
loading: loadingExternal,
|
|
82
|
+
setShouldPerformAction: setShouldPerformExternal,
|
|
83
|
+
} = useApiHook<{
|
|
84
|
+
data: any[];
|
|
85
|
+
}>({
|
|
86
|
+
endpoint: `orders/`,
|
|
87
|
+
method: 'GET',
|
|
88
|
+
filters: filters,
|
|
89
|
+
performAction: false,
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
useEffect(() => {
|
|
93
|
+
const searchParams = new URLSearchParams(location.search);
|
|
94
|
+
if (searchParams?.toString()) {
|
|
95
|
+
const dynamicFilters: Array<{
|
|
96
|
+
field: string;
|
|
97
|
+
op: string;
|
|
98
|
+
value: string | null;
|
|
99
|
+
}> = [];
|
|
100
|
+
searchParams?.forEach((value, key) => {
|
|
101
|
+
if (key === 'order') {
|
|
102
|
+
dynamicFilters.push({
|
|
103
|
+
field: 'gsit_order_id',
|
|
104
|
+
op: '=',
|
|
105
|
+
value: value,
|
|
106
|
+
});
|
|
107
|
+
} else {
|
|
108
|
+
dynamicFilters.push({
|
|
109
|
+
field: key,
|
|
110
|
+
op: '=',
|
|
111
|
+
value: value,
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
setFilters(dynamicFilters);
|
|
116
|
+
if (filters) {
|
|
117
|
+
setShouldPerformExternal(true);
|
|
118
|
+
setOrderId(fetchedDataExternal?.data[0]?.id);
|
|
119
|
+
}
|
|
120
|
+
} else {
|
|
121
|
+
const paths = location.pathname.split('/');
|
|
122
|
+
setOrderId(paths[paths.length - 1]);
|
|
123
|
+
}
|
|
124
|
+
}, [location.search, loadingExternal]);
|
|
84
125
|
|
|
85
126
|
const {
|
|
86
127
|
data: fetchedData,
|
|
@@ -94,6 +135,13 @@ function OrderView() {
|
|
|
94
135
|
performAction: false,
|
|
95
136
|
});
|
|
96
137
|
|
|
138
|
+
useEffect(() => {
|
|
139
|
+
if (orderId) {
|
|
140
|
+
orderUpdate(true);
|
|
141
|
+
liveRecalling ? setLivePerformAction(false) : setLivePerformAction(true);
|
|
142
|
+
}
|
|
143
|
+
}, [orderId, liveRecalling]);
|
|
144
|
+
|
|
97
145
|
const { data: fetchedStaticData, loading: staticDataLoading } = useApiHook<{
|
|
98
146
|
data: ApiResponse[];
|
|
99
147
|
}>({
|
|
@@ -120,36 +168,17 @@ function OrderView() {
|
|
|
120
168
|
method: 'GET',
|
|
121
169
|
filters: [{ field: 'visibility', op: '=', value: true }],
|
|
122
170
|
});
|
|
123
|
-
useEffect(() => {
|
|
124
|
-
if (orderId) {
|
|
125
|
-
orderUpdate(true);
|
|
126
|
-
liveRecalling ? setLivePerformAction(false) : setLivePerformAction(true);
|
|
127
|
-
}
|
|
128
|
-
}, [orderId, liveRecalling]);
|
|
129
|
-
|
|
130
|
-
useEffect(() => {
|
|
131
|
-
if (apiCalling) {
|
|
132
|
-
orderUpdate(true);
|
|
133
|
-
} else {
|
|
134
|
-
orderUpdate(false);
|
|
135
|
-
}
|
|
136
|
-
}, [apiCalling]);
|
|
137
|
-
|
|
138
|
-
useEffect(() => {
|
|
139
|
-
if (paths.length > 1) {
|
|
140
|
-
setOrderId(paths[2]);
|
|
141
|
-
}
|
|
142
|
-
// for local
|
|
143
|
-
// if (paths.length >= 0) {
|
|
144
|
-
// setOrderId(paths[1]);
|
|
145
|
-
// }
|
|
146
|
-
}, [paths]);
|
|
147
171
|
|
|
148
172
|
useEffect(() => {
|
|
149
173
|
setLoading(staticDataLoading);
|
|
150
174
|
if (fetchedStaticData && fetchedStaticData.data) {
|
|
151
175
|
const result = fetchedStaticData?.data;
|
|
152
176
|
setOrderStaticData(result[0]);
|
|
177
|
+
setAssignData(
|
|
178
|
+
fetchedStaticData?.data?.flatMap(
|
|
179
|
+
(i: any) => i?.resource_visibility_type
|
|
180
|
+
)
|
|
181
|
+
);
|
|
153
182
|
}
|
|
154
183
|
}, [staticDataLoading]);
|
|
155
184
|
|
|
@@ -184,7 +213,7 @@ function OrderView() {
|
|
|
184
213
|
}
|
|
185
214
|
}
|
|
186
215
|
return () => {
|
|
187
|
-
setOrderId(null);
|
|
216
|
+
// setOrderId(null);
|
|
188
217
|
};
|
|
189
218
|
}, [statusDataLoading, fetchedStatusData]);
|
|
190
219
|
|
|
@@ -205,7 +234,7 @@ function OrderView() {
|
|
|
205
234
|
}
|
|
206
235
|
}
|
|
207
236
|
return () => {
|
|
208
|
-
setOrderId(null);
|
|
237
|
+
// setOrderId(null);
|
|
209
238
|
};
|
|
210
239
|
}, [depotDataLoading]);
|
|
211
240
|
|
|
@@ -232,7 +261,7 @@ function OrderView() {
|
|
|
232
261
|
setOrderResources(fetchedResourcesData);
|
|
233
262
|
}
|
|
234
263
|
return () => {
|
|
235
|
-
setOrderId(null);
|
|
264
|
+
// setOrderId(null);
|
|
236
265
|
};
|
|
237
266
|
}, [fetchedResourcesData, orderResources, setOrderResources]);
|
|
238
267
|
|
|
@@ -259,18 +288,10 @@ function OrderView() {
|
|
|
259
288
|
setOrderToolbox(fetchedToolboxData);
|
|
260
289
|
}
|
|
261
290
|
return () => {
|
|
262
|
-
setOrderId(undefined);
|
|
291
|
+
// setOrderId(undefined);
|
|
263
292
|
};
|
|
264
293
|
}, [fetchedToolboxData, orderToolbox, setOrderToolbox]);
|
|
265
294
|
|
|
266
|
-
useEffect(() => {
|
|
267
|
-
if (GsitCUstomerId?.id) {
|
|
268
|
-
shouldFetch(true);
|
|
269
|
-
} else {
|
|
270
|
-
shouldFetch(false);
|
|
271
|
-
}
|
|
272
|
-
}, [GsitCUstomerId]);
|
|
273
|
-
|
|
274
295
|
useEffect(() => {
|
|
275
296
|
return () => {
|
|
276
297
|
setGsitCUstomerId((prev: any) => ({ ...prev, id: undefined }));
|
|
@@ -289,6 +310,14 @@ function OrderView() {
|
|
|
289
310
|
performAction: false,
|
|
290
311
|
});
|
|
291
312
|
|
|
313
|
+
useEffect(() => {
|
|
314
|
+
if (GsitCUstomerId?.id) {
|
|
315
|
+
shouldFetch(true);
|
|
316
|
+
} else {
|
|
317
|
+
shouldFetch(false);
|
|
318
|
+
}
|
|
319
|
+
}, [GsitCUstomerId]);
|
|
320
|
+
|
|
292
321
|
useEffect(() => {
|
|
293
322
|
if (fetchedLocationData && fetchedLocationData?.data) {
|
|
294
323
|
const locationOptions = fetchedLocationData?.data?.map((item: any) => {
|
|
@@ -320,10 +349,8 @@ function OrderView() {
|
|
|
320
349
|
|
|
321
350
|
return (
|
|
322
351
|
<MainContainer>
|
|
323
|
-
{/* <Loader /> */}
|
|
324
352
|
<GeneralHeader />
|
|
325
353
|
<DetailsFilters />
|
|
326
|
-
{/* <Notification /> */}
|
|
327
354
|
<OrderDetails />
|
|
328
355
|
<ProductsInfo />
|
|
329
356
|
<SplitLayout>
|
|
@@ -331,9 +358,6 @@ function OrderView() {
|
|
|
331
358
|
<Notes />
|
|
332
359
|
</NotesContainer>
|
|
333
360
|
<TablesContainer>
|
|
334
|
-
{/* call logs */}
|
|
335
|
-
{/* <Order /> */}
|
|
336
|
-
{/* <Toolbox /> */}
|
|
337
361
|
<SystemLogs />
|
|
338
362
|
</TablesContainer>
|
|
339
363
|
</SplitLayout>
|
|
@@ -347,8 +371,6 @@ const MainContainer = styled.div`
|
|
|
347
371
|
flex-direction: column;
|
|
348
372
|
gap: 10px;
|
|
349
373
|
padding-bottom: 30px;
|
|
350
|
-
border-radius: 25px;
|
|
351
|
-
border: 1px solid #e3e3e3;
|
|
352
374
|
`;
|
|
353
375
|
|
|
354
376
|
const SplitLayout = styled.div`
|
|
@@ -2,7 +2,7 @@ import React, { useEffect, useState } from 'react';
|
|
|
2
2
|
import styled from 'styled-components';
|
|
3
3
|
import { useApiHook } from '@bjsdistribution/dms-component-library';
|
|
4
4
|
import { ApiResponse } from '../../types';
|
|
5
|
-
import { useOrderDetails, useProductDetails } from '../../store';
|
|
5
|
+
import { useOrderDetails, useOrderId, useProductDetails } from '../../store';
|
|
6
6
|
import { Select } from 'antd';
|
|
7
7
|
import { useSelectedProducts } from '../../../store';
|
|
8
8
|
import { atom, useAtom } from 'jotai';
|
|
@@ -19,6 +19,7 @@ const NewReturnDropdown = () => {
|
|
|
19
19
|
const [, setPayload] = useAtom(payloadAtom);
|
|
20
20
|
const [productData] = useProductDetails();
|
|
21
21
|
const [idProduct, setId] = useState<any>();
|
|
22
|
+
const [orderId] = useOrderId();
|
|
22
23
|
|
|
23
24
|
const id = orderData?.customer_id;
|
|
24
25
|
|
|
@@ -32,6 +33,7 @@ const NewReturnDropdown = () => {
|
|
|
32
33
|
{ field: 'customer_id', op: '=', value: id },
|
|
33
34
|
{ field: 'is_deleted', op: '=', value: 0 },
|
|
34
35
|
{ field: 'status', op: '!=', value: 'SD' },
|
|
36
|
+
{ field: 'id', op: '!=', value: orderId },
|
|
35
37
|
];
|
|
36
38
|
|
|
37
39
|
if (idProduct?.length > 0 && idProduct[0]) {
|
|
@@ -2,9 +2,9 @@ import React from 'react';
|
|
|
2
2
|
import { AntSelect } from '@bjsdistribution/dms-component-library';
|
|
3
3
|
import OrderActionModal from '../../../../../common/modals/order-action-modal/OrderActionModal';
|
|
4
4
|
import { ContentContainer, Label, Row, SplitLayout } from '../modalstyle';
|
|
5
|
-
import { OptionsMenu } from '../../../fakedata';
|
|
6
5
|
import { useCurrentAction } from '../../../store';
|
|
7
6
|
import { notification } from 'antd';
|
|
7
|
+
import { optionsMenu } from '../../../fakedata';
|
|
8
8
|
|
|
9
9
|
function ChangeCustomerAccModal() {
|
|
10
10
|
const [, setCurrentAction] = useCurrentAction();
|
|
@@ -34,7 +34,7 @@ function ChangeCustomerAccModal() {
|
|
|
34
34
|
<Row>
|
|
35
35
|
<Label>New Customer</Label>
|
|
36
36
|
<AntSelect
|
|
37
|
-
options={
|
|
37
|
+
options={optionsMenu}
|
|
38
38
|
placeholder="Select Customer"
|
|
39
39
|
onChange={handleSelectChange}
|
|
40
40
|
disabled={false}
|
|
@@ -48,7 +48,7 @@ function ChangeCustomerAccModal() {
|
|
|
48
48
|
<Row>
|
|
49
49
|
<Label>New Trading Name</Label>
|
|
50
50
|
<AntSelect
|
|
51
|
-
options={
|
|
51
|
+
options={optionsMenu}
|
|
52
52
|
placeholder="Select Trading Name"
|
|
53
53
|
onChange={handleSelectChange}
|
|
54
54
|
disabled={false}
|
|
@@ -1,19 +1,84 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CancelAndCompleteAction,
|
|
3
3
|
CancelationModal,
|
|
4
|
+
useApiHook,
|
|
4
5
|
} from '@bjsdistribution/dms-component-library';
|
|
5
|
-
import React from 'react';
|
|
6
|
+
import React, { useEffect } from 'react';
|
|
6
7
|
import styled from 'styled-components';
|
|
7
|
-
import {
|
|
8
|
+
import {
|
|
9
|
+
useCurrentAction,
|
|
10
|
+
useOrderDetails,
|
|
11
|
+
useOrderId,
|
|
12
|
+
usePrevOrderDetails,
|
|
13
|
+
} from '../../../store';
|
|
14
|
+
import { ApiResponse, OrdersType } from '../../../types';
|
|
15
|
+
import { useLoading } from '../../../../order-daily-overview/store/store';
|
|
16
|
+
import { notification } from 'antd';
|
|
8
17
|
|
|
9
18
|
const UnholdOrder = () => {
|
|
19
|
+
const [orderId] = useOrderId();
|
|
10
20
|
const [, setCurrentAction] = useCurrentAction();
|
|
21
|
+
const [, setOrderDetails] = useOrderDetails();
|
|
22
|
+
const [, setPrevOrderDetails] = usePrevOrderDetails();
|
|
23
|
+
const [, setLoading] = useLoading();
|
|
24
|
+
|
|
25
|
+
const {
|
|
26
|
+
data: response,
|
|
27
|
+
setShouldPerformAction: setPerformAction,
|
|
28
|
+
} = useApiHook<{
|
|
29
|
+
data: ApiResponse[];
|
|
30
|
+
}>({
|
|
31
|
+
endpoint: `orders/${orderId}/unhold/?unhold_reason="unhold"`,
|
|
32
|
+
method: 'POST',
|
|
33
|
+
performAction: false,
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
const { data: fetchedData, loading, setShouldPerformAction } = useApiHook<{
|
|
37
|
+
data: OrdersType[];
|
|
38
|
+
}>({
|
|
39
|
+
endpoint: `orders/${orderId}`,
|
|
40
|
+
method: 'GET',
|
|
41
|
+
performAction: false,
|
|
42
|
+
});
|
|
11
43
|
|
|
12
|
-
|
|
44
|
+
useEffect(() => {
|
|
45
|
+
setLoading(loading);
|
|
46
|
+
if (fetchedData && fetchedData.data) {
|
|
47
|
+
const requiredData = fetchedData?.data;
|
|
48
|
+
setOrderDetails(requiredData[0]);
|
|
49
|
+
setPrevOrderDetails(requiredData[0]);
|
|
50
|
+
setCurrentAction(undefined);
|
|
51
|
+
}
|
|
52
|
+
if (
|
|
53
|
+
(fetchedData && fetchedData?.data === null) ||
|
|
54
|
+
fetchedData?.data?.length === 0
|
|
55
|
+
) {
|
|
56
|
+
setCurrentAction(undefined);
|
|
57
|
+
}
|
|
58
|
+
}, [loading]);
|
|
59
|
+
|
|
60
|
+
useEffect(() => {
|
|
61
|
+
if (response) {
|
|
62
|
+
//@ts-ignore
|
|
63
|
+
if (response?.data && response?.code === 200) {
|
|
64
|
+
setShouldPerformAction(true);
|
|
65
|
+
} else {
|
|
66
|
+
notification.error({
|
|
67
|
+
message: 'Error',
|
|
68
|
+
description:
|
|
69
|
+
//@ts-ignore
|
|
70
|
+
response?.error_traceback ||
|
|
71
|
+
'An error has occurred. Please try again later.',
|
|
72
|
+
});
|
|
73
|
+
setCurrentAction(undefined);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}, [response]);
|
|
13
77
|
|
|
14
78
|
const saveButton = () => {
|
|
15
|
-
|
|
16
|
-
|
|
79
|
+
if (orderId) {
|
|
80
|
+
setPerformAction(true);
|
|
81
|
+
}
|
|
17
82
|
};
|
|
18
83
|
|
|
19
84
|
const closeModal = () => {
|
|
@@ -21,8 +86,8 @@ const UnholdOrder = () => {
|
|
|
21
86
|
};
|
|
22
87
|
return (
|
|
23
88
|
<CancelationModal
|
|
24
|
-
title="
|
|
25
|
-
description="Are you sure, you want to
|
|
89
|
+
title="Unhold Order"
|
|
90
|
+
description="Are you sure, you want to UnHold the Order?"
|
|
26
91
|
actions={
|
|
27
92
|
<CustomCancelAndCompleteAction
|
|
28
93
|
cancelLabel="Cancel"
|
package/src/components/order-view/return-client-products/product-table/ReturnProductTable.tsx
CHANGED
|
@@ -40,7 +40,7 @@ const ReturnProductTable = () => {
|
|
|
40
40
|
if (isresponse && isresponse.data) {
|
|
41
41
|
notification.success({
|
|
42
42
|
message: 'Success',
|
|
43
|
-
description: '
|
|
43
|
+
description: 'Successfully Delete Order Product.',
|
|
44
44
|
});
|
|
45
45
|
handleRemoveRow();
|
|
46
46
|
setSelectedRowId(null);
|
|
@@ -63,7 +63,7 @@ const ReturnProductTable = () => {
|
|
|
63
63
|
if (selectAll) {
|
|
64
64
|
setSelectedProducts([]);
|
|
65
65
|
} else {
|
|
66
|
-
const allProductIds = productData
|
|
66
|
+
const allProductIds = productData?.map((product: any) => product.id);
|
|
67
67
|
setSelectedProducts(allProductIds);
|
|
68
68
|
}
|
|
69
69
|
setSelectAll(!selectAll);
|
|
@@ -93,6 +93,8 @@ const ReturnProductTable = () => {
|
|
|
93
93
|
return matchedReason ? matchedReason.label : 'N/A';
|
|
94
94
|
};
|
|
95
95
|
|
|
96
|
+
const disableCheckbox = productData?.length == 0;
|
|
97
|
+
|
|
96
98
|
return (
|
|
97
99
|
<div>
|
|
98
100
|
{loading && <Loader title="Deleting" />}
|
|
@@ -101,7 +103,11 @@ const ReturnProductTable = () => {
|
|
|
101
103
|
<thead>
|
|
102
104
|
<tr>
|
|
103
105
|
<th className="emailproductsCheckbox">
|
|
104
|
-
<Checkbox
|
|
106
|
+
<Checkbox
|
|
107
|
+
disabled={disableCheckbox}
|
|
108
|
+
checked={selectAll}
|
|
109
|
+
onChange={handleSelectAll}
|
|
110
|
+
/>
|
|
105
111
|
</th>
|
|
106
112
|
<th>Location</th>
|
|
107
113
|
<th>Sender</th>
|
|
@@ -442,6 +442,13 @@ const apiCalling = atom<boolean>(false);
|
|
|
442
442
|
export function useApiCalling() {
|
|
443
443
|
return useAtom(apiCalling);
|
|
444
444
|
}
|
|
445
|
+
|
|
446
|
+
const globalStateHitAuditLog = atom<boolean>(false);
|
|
447
|
+
export function useGlobalStateHitAuditLog() {
|
|
448
|
+
return useAtom(globalStateHitAuditLog);
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
|
|
445
452
|
const liveRecalling = atom<boolean>(false);
|
|
446
453
|
|
|
447
454
|
//re api call of live status
|
package/src/index.tsx
CHANGED
|
@@ -21,7 +21,6 @@ import {
|
|
|
21
21
|
import { ApiResponse } from './components/types';
|
|
22
22
|
import { useApiHook } from '@bjsdistribution/dms-component-library';
|
|
23
23
|
import { useLocationOptions } from './components/order-view/store';
|
|
24
|
-
|
|
25
24
|
function ReturnClient() {
|
|
26
25
|
notification.config({
|
|
27
26
|
top: 80,
|
|
@@ -37,28 +36,24 @@ function ReturnClient() {
|
|
|
37
36
|
const [, setSelectedFilterValue] = useSelectedAction();
|
|
38
37
|
const [, setSelectedClient] = useSelectedClient();
|
|
39
38
|
const [searchParams] = useSearchParams();
|
|
40
|
-
|
|
41
39
|
const splitPath = (str: any) => {
|
|
42
40
|
const parts = str?.split('/')?.filter((part: any) => part !== ''); // Filter out empty parts
|
|
43
41
|
return parts;
|
|
44
42
|
};
|
|
45
43
|
const paths = splitPath(location.pathname);
|
|
46
|
-
|
|
47
44
|
useEffect(() => {
|
|
48
|
-
if (paths[paths.length - 1] === '
|
|
45
|
+
if (paths[paths.length - 1] === 'orders/view/return') {
|
|
49
46
|
setActionTypeOptions([]);
|
|
50
47
|
setLocationOptions([]);
|
|
51
48
|
setSelectedClient(null);
|
|
52
49
|
setSelectedFilterValue(null);
|
|
53
50
|
}
|
|
54
51
|
}, [location.pathname, searchParams]);
|
|
55
|
-
|
|
56
52
|
// useEffect(() => {
|
|
57
53
|
// if (selectedClientId) {
|
|
58
54
|
// navigate(`filter/${selectedClientId}`);
|
|
59
55
|
// }
|
|
60
56
|
// }, [selectedClientId]);
|
|
61
|
-
|
|
62
57
|
//API for client data
|
|
63
58
|
const { data: fetchedCustomerData, loading: loading } = useApiHook<
|
|
64
59
|
ApiResponse
|
|
@@ -68,7 +63,6 @@ function ReturnClient() {
|
|
|
68
63
|
//@ts-ignore
|
|
69
64
|
pagination: { page: 1, per_page: 50 },
|
|
70
65
|
});
|
|
71
|
-
|
|
72
66
|
//API for action type
|
|
73
67
|
const { data: fetchedStaticData, loading: actionLoading } = useApiHook<
|
|
74
68
|
ApiResponse
|
|
@@ -76,7 +70,6 @@ function ReturnClient() {
|
|
|
76
70
|
endpoint: `/orders/getStaticData/all/`,
|
|
77
71
|
method: 'GET',
|
|
78
72
|
});
|
|
79
|
-
|
|
80
73
|
//API for return locations
|
|
81
74
|
const { data: fetchedLocationData, loading: locationloading } = useApiHook<
|
|
82
75
|
ApiResponse
|
|
@@ -86,13 +79,11 @@ function ReturnClient() {
|
|
|
86
79
|
//@ts-ignore
|
|
87
80
|
pagination: { is_pagination: false },
|
|
88
81
|
});
|
|
89
|
-
|
|
90
82
|
useEffect(() => {
|
|
91
83
|
if (fetchedCustomerData && fetchedCustomerData?.data) {
|
|
92
84
|
setCustomers(fetchedCustomerData?.data);
|
|
93
85
|
}
|
|
94
86
|
}, [loading]);
|
|
95
|
-
|
|
96
87
|
useEffect(() => {
|
|
97
88
|
if (fetchedStaticData && fetchedStaticData?.data) {
|
|
98
89
|
setActionType(
|
|
@@ -108,28 +99,22 @@ function ReturnClient() {
|
|
|
108
99
|
);
|
|
109
100
|
}
|
|
110
101
|
}, [actionLoading]);
|
|
111
|
-
|
|
112
102
|
useEffect(() => {
|
|
113
103
|
if (fetchedLocationData && fetchedLocationData?.data) {
|
|
114
104
|
setLocationData(fetchedLocationData?.data);
|
|
115
105
|
}
|
|
116
106
|
}, [locationloading]);
|
|
117
|
-
|
|
118
107
|
return (
|
|
119
108
|
<>
|
|
120
109
|
<RouterHeader />
|
|
121
110
|
<Suspense fallback={<LoadingMessage />}>
|
|
122
111
|
<Routes>
|
|
123
112
|
{/* for local */}
|
|
124
|
-
{/* <Route path="order/return" element={<ReturnMainTable />} /> */}
|
|
125
|
-
|
|
126
113
|
{/* for dev */}
|
|
127
114
|
<Route path="" element={<ReturnMainTable />} />
|
|
128
|
-
|
|
129
|
-
<Route path="
|
|
130
|
-
<Route path="view/:id" element={<OrderView />} />
|
|
115
|
+
<Route path="overview" element={<ReturnAfterTable />} />
|
|
116
|
+
<Route path="/:id" element={<OrderView />} />
|
|
131
117
|
<Route path="filter" element={<ReturnTable />} />
|
|
132
|
-
|
|
133
118
|
{/* <Route
|
|
134
119
|
path=""
|
|
135
120
|
element={
|
|
@@ -145,5 +130,4 @@ function ReturnClient() {
|
|
|
145
130
|
</>
|
|
146
131
|
);
|
|
147
132
|
}
|
|
148
|
-
|
|
149
|
-
export default ReturnClient;
|
|
133
|
+
export default ReturnClient;
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
SelectDropdown,
|
|
3
|
-
dropdownStyles,
|
|
4
|
-
filterDropdownStyles,
|
|
5
|
-
} from '@bjsdistribution/dms-component-library';
|
|
6
|
-
import React from 'react';
|
|
7
|
-
import styled from 'styled-components';
|
|
8
|
-
import { OptionsMenu } from '../../fakedata';
|
|
9
|
-
import { useCurrentAction, useIsOnHoldOrder } from '../../store';
|
|
10
|
-
|
|
11
|
-
function Options() {
|
|
12
|
-
const [, setCurrentAction] = useCurrentAction();
|
|
13
|
-
const [hold] = useIsOnHoldOrder();
|
|
14
|
-
|
|
15
|
-
const handleSelectChange = (selectedOption: any) => {
|
|
16
|
-
setCurrentAction(selectedOption.value);
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
const filteredOptions = OptionsMenu.filter(option => {
|
|
20
|
-
if (hold) {
|
|
21
|
-
return option.value !== 'hold-order';
|
|
22
|
-
} else {
|
|
23
|
-
return option.value !== 'unhold-order';
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
return (
|
|
28
|
-
<Option>
|
|
29
|
-
<SelectDropdown
|
|
30
|
-
placeholder="OPTIONS"
|
|
31
|
-
inputId="bjsmenu"
|
|
32
|
-
options={filteredOptions}
|
|
33
|
-
onChange={handleSelectChange}
|
|
34
|
-
isSearchable={false}
|
|
35
|
-
styles={{
|
|
36
|
-
...dropdownStyles,
|
|
37
|
-
...filterDropdownStyles,
|
|
38
|
-
container: styles => ({
|
|
39
|
-
...styles,
|
|
40
|
-
cursor: 'pointer',
|
|
41
|
-
}),
|
|
42
|
-
menu: styles => ({
|
|
43
|
-
...styles,
|
|
44
|
-
top: '113%',
|
|
45
|
-
borderRadius: '5px',
|
|
46
|
-
width: 'max-content',
|
|
47
|
-
cursor: 'pointer',
|
|
48
|
-
}),
|
|
49
|
-
control: styles => ({
|
|
50
|
-
...styles,
|
|
51
|
-
width: '105px',
|
|
52
|
-
boxShadow: 'none',
|
|
53
|
-
borderColor: 'transparent',
|
|
54
|
-
cursor: 'pointer',
|
|
55
|
-
'&:hover': {
|
|
56
|
-
boxShadow: 'none',
|
|
57
|
-
borderColor: 'transparent',
|
|
58
|
-
},
|
|
59
|
-
}),
|
|
60
|
-
}}
|
|
61
|
-
value="OPTIONS"
|
|
62
|
-
/>
|
|
63
|
-
</Option>
|
|
64
|
-
);
|
|
65
|
-
}
|
|
66
|
-
const Option = styled.div``;
|
|
67
|
-
|
|
68
|
-
export default Options;
|