@bjsdistribution/dms-client-return 0.0.55 → 0.0.57

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.
Files changed (34) hide show
  1. package/dist/components/order-view/details-filters/left-side-filters/dropdowns/MenuDropDown.d.ts +2 -2
  2. package/dist/components/order-view/details-filters/left-side-filters/dropdowns/OptionsDropDown.d.ts +2 -2
  3. package/dist/components/order-view/fakedata.d.ts +1 -1
  4. package/dist/components/order-view/store.d.ts +2 -2
  5. package/dist/dms-client-return.cjs.development.js +415 -384
  6. package/dist/dms-client-return.cjs.development.js.map +1 -1
  7. package/dist/dms-client-return.cjs.production.min.js +1 -1
  8. package/dist/dms-client-return.cjs.production.min.js.map +1 -1
  9. package/dist/dms-client-return.esm.js +415 -384
  10. package/dist/dms-client-return.esm.js.map +1 -1
  11. package/package.json +1 -1
  12. package/src/components/order-daily-overview/header-filters/SelectionFilter.tsx +1 -1
  13. package/src/components/order-daily-overview/return-after-table/table/OrderTable.tsx +1 -1
  14. package/src/components/order-daily-overview/table/ReturnTable.tsx +2 -2
  15. package/src/components/order-view/details-filters/left-side-filters/dropdowns/DropDowns.tsx +1 -1
  16. package/src/components/order-view/details-filters/left-side-filters/dropdowns/MenuDropDown.tsx +57 -45
  17. package/src/components/order-view/details-filters/left-side-filters/dropdowns/OptionsDropDown.tsx +74 -61
  18. package/src/components/order-view/fakedata.ts +6 -69
  19. package/src/components/order-view/general-information/dropdowns/Print.tsx +57 -35
  20. package/src/components/order-view/general-information/dropdowns/index.tsx +1 -2
  21. package/src/components/order-view/hooks/useUpdateOrder.ts +0 -3
  22. package/src/components/order-view/index.tsx +81 -56
  23. package/src/components/order-view/modalsPopup/DeleteProduct.tsx +2 -2
  24. package/src/components/order-view/modalsPopup/ModalManager.tsx +1 -1
  25. package/src/components/order-view/notes/order-dropdown/NewReturnDropdown.tsx +3 -1
  26. package/src/components/order-view/order-actions/actions/change-customer-account/ChangeCustomerAccModal.tsx +3 -3
  27. package/src/components/order-view/order-actions/actions/confirm-order/tables/NotesTable.tsx +3 -1
  28. package/src/components/order-view/order-actions/actions/unhold-order/UnholdOrder.tsx +72 -7
  29. package/src/components/order-view/order-details/expanded-content/footer/index.tsx +5 -3
  30. package/src/components/order-view/return-client-products/product-table/ReturnProductTable.tsx +9 -3
  31. package/src/components/order-view/store.ts +14 -13
  32. package/src/index.tsx +4 -20
  33. package/dist/components/order-view/general-information/dropdowns/Options.d.ts +0 -3
  34. 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
- useUpdateApiCall,
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
- const [apiCalling] = useUpdateApiCall();
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,33 +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
- orderUpdate(true);
132
- apiCalling ? orderUpdate(true) : orderUpdate(false);
133
- }, [apiCalling]);
134
-
135
- useEffect(() => {
136
- if (paths.length > 1) {
137
- setOrderId(paths[2]);
138
- }
139
- // for local
140
- // if (paths.length >= 0) {
141
- // setOrderId(paths[1]);
142
- // }
143
- }, [paths]);
144
171
 
145
172
  useEffect(() => {
146
173
  setLoading(staticDataLoading);
147
174
  if (fetchedStaticData && fetchedStaticData.data) {
148
175
  const result = fetchedStaticData?.data;
149
176
  setOrderStaticData(result[0]);
177
+ setAssignData(
178
+ fetchedStaticData?.data?.flatMap(
179
+ (i: any) => i?.resource_visibility_type
180
+ )
181
+ );
150
182
  }
151
183
  }, [staticDataLoading]);
152
184
 
@@ -181,7 +213,7 @@ function OrderView() {
181
213
  }
182
214
  }
183
215
  return () => {
184
- setOrderId(null);
216
+ // setOrderId(null);
185
217
  };
186
218
  }, [statusDataLoading, fetchedStatusData]);
187
219
 
@@ -202,7 +234,7 @@ function OrderView() {
202
234
  }
203
235
  }
204
236
  return () => {
205
- setOrderId(null);
237
+ // setOrderId(null);
206
238
  };
207
239
  }, [depotDataLoading]);
208
240
 
@@ -229,7 +261,7 @@ function OrderView() {
229
261
  setOrderResources(fetchedResourcesData);
230
262
  }
231
263
  return () => {
232
- setOrderId(null);
264
+ // setOrderId(null);
233
265
  };
234
266
  }, [fetchedResourcesData, orderResources, setOrderResources]);
235
267
 
@@ -256,18 +288,10 @@ function OrderView() {
256
288
  setOrderToolbox(fetchedToolboxData);
257
289
  }
258
290
  return () => {
259
- setOrderId(undefined);
291
+ // setOrderId(undefined);
260
292
  };
261
293
  }, [fetchedToolboxData, orderToolbox, setOrderToolbox]);
262
294
 
263
- useEffect(() => {
264
- if (GsitCUstomerId?.id) {
265
- shouldFetch(true);
266
- } else {
267
- shouldFetch(false);
268
- }
269
- }, [GsitCUstomerId]);
270
-
271
295
  useEffect(() => {
272
296
  return () => {
273
297
  setGsitCUstomerId((prev: any) => ({ ...prev, id: undefined }));
@@ -286,6 +310,14 @@ function OrderView() {
286
310
  performAction: false,
287
311
  });
288
312
 
313
+ useEffect(() => {
314
+ if (GsitCUstomerId?.id) {
315
+ shouldFetch(true);
316
+ } else {
317
+ shouldFetch(false);
318
+ }
319
+ }, [GsitCUstomerId]);
320
+
289
321
  useEffect(() => {
290
322
  if (fetchedLocationData && fetchedLocationData?.data) {
291
323
  const locationOptions = fetchedLocationData?.data?.map((item: any) => {
@@ -317,10 +349,8 @@ function OrderView() {
317
349
 
318
350
  return (
319
351
  <MainContainer>
320
- {/* <Loader /> */}
321
352
  <GeneralHeader />
322
353
  <DetailsFilters />
323
- {/* <Notification /> */}
324
354
  <OrderDetails />
325
355
  <ProductsInfo />
326
356
  <SplitLayout>
@@ -328,9 +358,6 @@ function OrderView() {
328
358
  <Notes />
329
359
  </NotesContainer>
330
360
  <TablesContainer>
331
- {/* call logs */}
332
- {/* <Order /> */}
333
- {/* <Toolbox /> */}
334
361
  <SystemLogs />
335
362
  </TablesContainer>
336
363
  </SplitLayout>
@@ -344,8 +371,6 @@ const MainContainer = styled.div`
344
371
  flex-direction: column;
345
372
  gap: 10px;
346
373
  padding-bottom: 30px;
347
- border-radius: 25px;
348
- border: 1px solid #e3e3e3;
349
374
  `;
350
375
 
351
376
  const SplitLayout = styled.div`
@@ -1,11 +1,11 @@
1
1
  import React, { useEffect } from 'react';
2
2
  import { useDeleteProdsID, useProductDetails } from '../store';
3
- import { Empty, Skeleton } from 'antd';
4
3
  import {
5
4
  EmptyDataContainer,
6
5
  StyledTable,
7
6
  StyledTableWrapper,
8
- } from '../order-actions/actions/confirm-order/tables/ReminderStyles';
7
+ } from '../all-reminder/table-view/ReminderStyles';
8
+ import { Empty, Skeleton } from 'antd';
9
9
 
10
10
  const DeleteProduct = () => {
11
11
  const [productdata] = useProductDetails();
@@ -114,7 +114,7 @@ const ModalManager = () => {
114
114
  // navigate('/order-return');
115
115
 
116
116
  // for dev
117
- navigate('/order/return/view');
117
+ navigate('/orders/view/return');
118
118
  }
119
119
  }, [postLoading]);
120
120
 
@@ -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={OptionsMenu}
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={OptionsMenu}
51
+ options={optionsMenu}
52
52
  placeholder="Select Trading Name"
53
53
  onChange={handleSelectChange}
54
54
  disabled={false}
@@ -118,7 +118,9 @@ function NotesTable() {
118
118
  )}
119
119
  </div>
120
120
  </td>
121
- <td>{order?.description}</td>
121
+ <td
122
+ dangerouslySetInnerHTML={{ __html: order?.description }}
123
+ ></td>
122
124
  </tr>
123
125
  ))
124
126
  )}
@@ -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 { useCurrentAction, useIsOnHoldOrder } from '../../../store';
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
- const [, setOnHoldOrder] = useIsOnHoldOrder();
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
- setOnHoldOrder(false);
16
- setCurrentAction(undefined);
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="Un-hold Order"
25
- description="Are you sure, you want to Un-Hold the Order?"
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"
@@ -9,7 +9,7 @@ import {
9
9
  errorAtom,
10
10
  useCustomerInfo,
11
11
  // useLogsCallAPi,
12
- useUpdateApiCall,
12
+ useApiCalling,
13
13
  // UseNotesLoading,
14
14
  } from '../../../store';
15
15
  import useUpdateOrder from '../../../hooks/useUpdateOrder';
@@ -23,7 +23,7 @@ function OrderDetailsFooter() {
23
23
  const updateOrder = useUpdateOrder();
24
24
  const [errorState] = useAtom(errorAtom);
25
25
  // const [, setLogsCallAPi] = useLogsCallAPi();
26
- const [, setCallApi] = useUpdateApiCall(); //single detail
26
+ const [, setCallApi] = useApiCalling(); //single detail
27
27
  // const [, setNoteLoadingStore] = UseNotesLoading();
28
28
 
29
29
  const errorFound = () => {
@@ -78,10 +78,12 @@ function OrderDetailsFooter() {
78
78
  };
79
79
 
80
80
  const onSave = async () => {
81
+ setCallApi(true);
81
82
  const payload = compareOrderDetailsStates(prevOrderDetails, orderDetails);
82
83
  const response = await updateOrder([payload]);
83
- setCallApi(false);
84
+
84
85
  // setLogsCallAPi(prev => !prev);
86
+
85
87
  if (response && response?.data?.length > 0) {
86
88
  setOrderDetails(response?.data[0]);
87
89
  setPrevOrderDetails(response?.data[0]);
@@ -40,7 +40,7 @@ const ReturnProductTable = () => {
40
40
  if (isresponse && isresponse.data) {
41
41
  notification.success({
42
42
  message: 'Success',
43
- description: 'An error has occurred. Please try again later.',
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.map((product: any) => product.id);
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 checked={selectAll} onChange={handleSelectAll} />
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>
@@ -437,25 +437,24 @@ const returnDataAtom = atom<any[]>([]);
437
437
  export function useReturnData() {
438
438
  return useAtom(returnDataAtom);
439
439
  }
440
- const apiUpdateCalling = atom<boolean>(false);
440
+ const apiCalling = atom<boolean>(false);
441
441
 
442
- export function useUpdateApiCall() {
443
- return useAtom(apiUpdateCalling);
442
+ export function useApiCalling() {
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
448
455
  export function useLiveRecalling() {
449
456
  return useAtom(liveRecalling);
450
457
  }
451
-
452
- //delete products
453
- const onDeleteProduct = atom<boolean>(false);
454
-
455
- export function useDeleteRecall() {
456
- return useAtom(onDeleteProduct);
457
- }
458
-
459
458
  export const selectedTabKeyAtom = atom<string>('1');
460
459
  export const letselectedProductIdAtom = atom<number | null>(null);
461
460
 
@@ -483,10 +482,12 @@ const popupReducer = (state: any, action: any) => {
483
482
  } else if (action.type === 'addProduct') {
484
483
  state = 'addProduct';
485
484
  return { state };
486
- } else if (action.type === 'split-order') {
485
+ }
486
+ else if (action.type === 'split-order') {
487
487
  state = 'split-order';
488
488
  return { state };
489
- } else if (action.type === 'deleteProduct') {
489
+ }
490
+ else if (action.type === 'deleteProduct') {
490
491
  state = 'deleteProduct';
491
492
  return { state };
492
493
  } else if (action.type === 'defectsModal') {
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] === 'order/return') {
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="view" element={<ReturnAfterTable />} />
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,3 +0,0 @@
1
- import React from 'react';
2
- declare function Options(): React.JSX.Element;
3
- export default Options;