@bjsdistribution/dms-client-return 0.0.54 → 0.0.55

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/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.0.54",
2
+ "version": "0.0.55",
3
3
  "license": "MIT",
4
4
  "main": "dist/index.js",
5
5
  "typings": "dist/index.d.ts",
@@ -1,10 +1,12 @@
1
1
  import { getBaseEndpoint } from '@bjsdistribution/dms-component-library';
2
2
  import { getCookie } from '../utils';
3
3
  import { notification } from 'antd';
4
+ import { useUpdateApiCall } from '../store';
4
5
 
5
6
  function useUpdateOrder() {
6
7
  let controller: AbortController;
7
8
  const ssoToken = getCookie('id_token');
9
+ const [, setCallApi] = useUpdateApiCall(); //single detail
8
10
 
9
11
  const update = async (data: any) => {
10
12
  const endpoint = `${getBaseEndpoint()}/orders/update/`;
@@ -38,6 +40,7 @@ function useUpdateOrder() {
38
40
  message: 'Success',
39
41
  description: 'Order has been updated.',
40
42
  });
43
+ setCallApi(true);
41
44
  return json;
42
45
  } catch (err) {
43
46
  // setLoading(false);
@@ -30,7 +30,7 @@ import {
30
30
  useRouteId,
31
31
  useGsitOrderId,
32
32
  useOrderProductId,
33
- useApiCalling,
33
+ useUpdateApiCall,
34
34
  useLiveRecalling,
35
35
  } from './store';
36
36
  // import Loader from '../order-daily-overview/header/loader/Loader';
@@ -72,7 +72,7 @@ function OrderView() {
72
72
  const location = useLocation();
73
73
  const paths = splitPath(location.pathname);
74
74
  const [, setLocationOptions] = useLocationOptions();
75
- const [apiCalling] = useApiCalling();
75
+ const [apiCalling] = useUpdateApiCall();
76
76
  const [orderResources, setOrderResources] = useOrderProductsResources();
77
77
  const [orderToolbox, setOrderToolbox] = useOrderProductsToolbox();
78
78
  const [GsitCUstomerId, setGsitCUstomerId] = useGsitCUstomerId();
@@ -128,11 +128,8 @@ function OrderView() {
128
128
  }, [orderId, liveRecalling]);
129
129
 
130
130
  useEffect(() => {
131
- if (apiCalling) {
132
- orderUpdate(true);
133
- } else {
134
- orderUpdate(false);
135
- }
131
+ orderUpdate(true);
132
+ apiCalling ? orderUpdate(true) : orderUpdate(false);
136
133
  }, [apiCalling]);
137
134
 
138
135
  useEffect(() => {
@@ -1,11 +1,11 @@
1
1
  import React, { useEffect } from 'react';
2
2
  import { useDeleteProdsID, useProductDetails } from '../store';
3
+ import { Empty, Skeleton } from 'antd';
3
4
  import {
4
5
  EmptyDataContainer,
5
6
  StyledTable,
6
7
  StyledTableWrapper,
7
- } from '../all-reminder/table-view/ReminderStyles';
8
- import { Empty, Skeleton } from 'antd';
8
+ } from '../order-actions/actions/confirm-order/tables/ReminderStyles';
9
9
 
10
10
  const DeleteProduct = () => {
11
11
  const [productdata] = useProductDetails();
@@ -9,7 +9,7 @@ import {
9
9
  errorAtom,
10
10
  useCustomerInfo,
11
11
  // useLogsCallAPi,
12
- useApiCalling,
12
+ useUpdateApiCall,
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] = useApiCalling(); //single detail
26
+ const [, setCallApi] = useUpdateApiCall(); //single detail
27
27
  // const [, setNoteLoadingStore] = UseNotesLoading();
28
28
 
29
29
  const errorFound = () => {
@@ -78,12 +78,10 @@ function OrderDetailsFooter() {
78
78
  };
79
79
 
80
80
  const onSave = async () => {
81
- setCallApi(true);
82
81
  const payload = compareOrderDetailsStates(prevOrderDetails, orderDetails);
83
82
  const response = await updateOrder([payload]);
84
-
83
+ setCallApi(false);
85
84
  // setLogsCallAPi(prev => !prev);
86
-
87
85
  if (response && response?.data?.length > 0) {
88
86
  setOrderDetails(response?.data[0]);
89
87
  setPrevOrderDetails(response?.data[0]);
@@ -437,10 +437,10 @@ const returnDataAtom = atom<any[]>([]);
437
437
  export function useReturnData() {
438
438
  return useAtom(returnDataAtom);
439
439
  }
440
- const apiCalling = atom<boolean>(false);
440
+ const apiUpdateCalling = atom<boolean>(false);
441
441
 
442
- export function useApiCalling() {
443
- return useAtom(apiCalling);
442
+ export function useUpdateApiCall() {
443
+ return useAtom(apiUpdateCalling);
444
444
  }
445
445
  const liveRecalling = atom<boolean>(false);
446
446
 
@@ -448,6 +448,14 @@ const liveRecalling = atom<boolean>(false);
448
448
  export function useLiveRecalling() {
449
449
  return useAtom(liveRecalling);
450
450
  }
451
+
452
+ //delete products
453
+ const onDeleteProduct = atom<boolean>(false);
454
+
455
+ export function useDeleteRecall() {
456
+ return useAtom(onDeleteProduct);
457
+ }
458
+
451
459
  export const selectedTabKeyAtom = atom<string>('1');
452
460
  export const letselectedProductIdAtom = atom<number | null>(null);
453
461
 
@@ -475,12 +483,10 @@ const popupReducer = (state: any, action: any) => {
475
483
  } else if (action.type === 'addProduct') {
476
484
  state = 'addProduct';
477
485
  return { state };
478
- }
479
- else if (action.type === 'split-order') {
486
+ } else if (action.type === 'split-order') {
480
487
  state = 'split-order';
481
488
  return { state };
482
- }
483
- else if (action.type === 'deleteProduct') {
489
+ } else if (action.type === 'deleteProduct') {
484
490
  state = 'deleteProduct';
485
491
  return { state };
486
492
  } else if (action.type === 'defectsModal') {