@bjsdistribution/dms-client-return 0.0.59 → 0.0.61

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.59",
2
+ "version": "0.0.61",
3
3
  "license": "MIT",
4
4
  "main": "dist/index.js",
5
5
  "typings": "dist/index.d.ts",
@@ -168,7 +168,8 @@ function SelectionFilter() {
168
168
  if (!currentSearch.includes('filter')) {
169
169
  console.log('inside include');
170
170
  // for dev
171
- navigate(`filter?${queryParams.toString()}`);
171
+ //navigate(`filter?${queryParams.toString()}`);
172
+ navigate(`/orders/view/return/filter?${queryParams.toString()}`);
172
173
 
173
174
  // for local
174
175
  //navigate(`/filter?${queryParams.toString()}`);
@@ -272,7 +273,7 @@ function SelectionFilter() {
272
273
  useEffect(() => {
273
274
  if (clearState) {
274
275
  dispatch({ type: 'CLEAR_CLIENT' });
275
- window.location.href = '/order/return';
276
+ window.location.href = '/orders/view/return/';
276
277
  }
277
278
  }, [clearState]);
278
279
 
@@ -330,6 +331,12 @@ function SelectionFilter() {
330
331
  value={selectedClient}
331
332
  allowClear
332
333
  onClear={handleClear}
334
+ filterOption={(input: any, option: any) =>
335
+ (option?.label ?? '')
336
+ .toLowerCase()
337
+ .includes(input.toLowerCase())
338
+ }
339
+ showSearch
333
340
  />
334
341
  </FilterColumn>
335
342
 
@@ -12,7 +12,7 @@ import {
12
12
  CustomDrop,
13
13
  } from '../../return-order-table/return-orders-filters/returnstyles';
14
14
  import LoadIcon from '../../../../assets/icons/LoadIcon';
15
- import { usePrintOptionTOggle } from '../../store/store';
15
+ import { useLoading, usePrintOptionTOggle } from '../../store/store';
16
16
  import { NavLink } from 'react-router-dom';
17
17
  import { displayValueOrNA, formatDate } from '../../shared/utlis';
18
18
  import PrintDropDown from '../../shared/elements/PrintDropDown';
@@ -28,7 +28,7 @@ import Loader from '../../header/loader/Loader';
28
28
  import CaretDownFilledIcon from '../../../../common/CaretDownFilledIcon';
29
29
  import SortIcon from '../../../../common/SortIcon';
30
30
 
31
- const OrderTable = ({ loadingskeleton }: any) => {
31
+ const OrderTable = () => {
32
32
  // const [, setSelectedReturnOrder] = useSelectedOrders();
33
33
  // const [selectAll, setSelectAll] = useState(false);
34
34
  const dropdownRefParent = useRef<HTMLDivElement>(null);
@@ -40,6 +40,7 @@ const OrderTable = ({ loadingskeleton }: any) => {
40
40
  const [assignPayload, setAssignPayload] = useAssignPayload();
41
41
  const [, setAssign] = useState<boolean>(false);
42
42
  const [, setCallAPi] = useCallApiAgain();
43
+ const [loading] = useLoading();
43
44
 
44
45
  //sorting
45
46
  const [sortConfig, setSortConfig] = useState<{
@@ -254,7 +255,7 @@ const OrderTable = ({ loadingskeleton }: any) => {
254
255
  </tr>
255
256
  </thead>
256
257
  <tbody>
257
- {loadingskeleton ? (
258
+ {loading ? (
258
259
  <tr>
259
260
  <td colSpan={16}>
260
261
  <Skeleton active />
@@ -41,7 +41,7 @@ export const useStatsLoading = () => {
41
41
  return useAtom(loading);
42
42
  };
43
43
 
44
- //this
44
+ //order return page
45
45
  const loadingState = atom<boolean>(false);
46
46
  export const useLoading = () => {
47
47
  return useAtom(loadingState);
@@ -138,7 +138,8 @@ const ReturnTable: React.FC = () => {
138
138
  customerId: customerId?.toString(),
139
139
  });
140
140
  //for dev
141
- navigate(`filter?${queryParams.toString()}`);
141
+ //navigate(`filter?${queryParams.toString()}`);
142
+ navigate(`/orders/view/return/filter?${queryParams.toString()}`);
142
143
 
143
144
  //for local
144
145
  //navigate(`/filter?${queryParams.toString()}`);
@@ -167,7 +168,8 @@ const ReturnTable: React.FC = () => {
167
168
  type: RTS,
168
169
  });
169
170
  //for dev
170
- navigate(`filter?${queryParams.toString()}`);
171
+ //navigate(`filter?${queryParams.toString()}`);
172
+ navigate(`/orders/view/return/filter?${queryParams.toString()}`);
171
173
 
172
174
  //for local
173
175
  //navigate(`/filter?${queryParams.toString()}`);
@@ -176,7 +178,7 @@ const ReturnTable: React.FC = () => {
176
178
  return (
177
179
  <>
178
180
  {statsLoading && <Loader />}
179
- <StyledTableWrapper id="tableScrolling">
181
+ <StyledTableWrapper>
180
182
  <StyledTable>
181
183
  <thead>
182
184
  <tr>
@@ -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);
@@ -58,7 +58,6 @@ function OrderView() {
58
58
  const [, setDepotOptions] = useDepotOptions();
59
59
  const [, setCustomerInfo] = useCustomerInfo();
60
60
  const [, setLocationOptions] = useLocationOptions();
61
-
62
61
  const [orderResources, setOrderResources] = useOrderProductsResources();
63
62
  const [orderToolbox, setOrderToolbox] = useOrderProductsToolbox();
64
63
  const [GsitCUstomerId, setGsitCUstomerId] = useGsitCUstomerId();
@@ -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]);
@@ -81,7 +81,8 @@ function ExpandedContent() {
81
81
 
82
82
  //@ts-ignore
83
83
  if (response?.code === 200 && newId) {
84
- navigate(`details/${newId}`);
84
+ // suggested by rahul
85
+ navigate(`${newId}`);
85
86
  setSelectedProducts([]);
86
87
  }
87
88
  }, [response, newId, navigate, setSelectedProducts]);
@@ -433,10 +433,10 @@ const returnDataAtom = atom<any[]>([]);
433
433
  export function useReturnData() {
434
434
  return useAtom(returnDataAtom);
435
435
  }
436
- const apiCalling = atom<boolean>(false);
436
+ const apiUpdateCalling = atom<boolean>(false);
437
437
 
438
- export function useApiCalling() {
439
- return useAtom(apiCalling);
438
+ export function useUpdateApiCall() {
439
+ return useAtom(apiUpdateCalling);
440
440
  }
441
441
 
442
442
 
@@ -446,6 +446,14 @@ const liveRecalling = atom<boolean>(false);
446
446
  export function useLiveRecalling() {
447
447
  return useAtom(liveRecalling);
448
448
  }
449
+
450
+ //delete products
451
+ const onDeleteProduct = atom<boolean>(false);
452
+
453
+ export function useDeleteRecall() {
454
+ return useAtom(onDeleteProduct);
455
+ }
456
+
449
457
  export const selectedTabKeyAtom = atom<string>('1');
450
458
  export const letselectedProductIdAtom = atom<number | null>(null);
451
459
 
@@ -482,12 +490,10 @@ const popupReducer = (state: any, action: any) => {
482
490
  } else if (action.type === 'addProduct') {
483
491
  state = 'addProduct';
484
492
  return { state };
485
- }
486
- else if (action.type === 'split-order') {
493
+ } else if (action.type === 'split-order') {
487
494
  state = 'split-order';
488
495
  return { state };
489
- }
490
- else if (action.type === 'deleteProduct') {
496
+ } else if (action.type === 'deleteProduct') {
491
497
  state = 'deleteProduct';
492
498
  return { state };
493
499
  } else if (action.type === 'defectsModal') {
package/src/index.tsx CHANGED
@@ -5,6 +5,7 @@ import ReturnAfterTable from './components/order-daily-overview/return-after-tab
5
5
  import {
6
6
  useSelectedAction,
7
7
  useSelectedClient,
8
+ useSelectedLocation,
8
9
  } from './components/order-daily-overview/store/store';
9
10
  import { notification } from 'antd';
10
11
  import RouterHeader from './components/order-daily-overview/header/route-header/RouterHeader';
@@ -36,6 +37,7 @@ function ReturnClient() {
36
37
  const [, setSelectedFilterValue] = useSelectedAction();
37
38
  const [, setSelectedClient] = useSelectedClient();
38
39
  const [searchParams] = useSearchParams();
40
+ const [, setSelectedLocationValue] = useSelectedLocation();
39
41
  const splitPath = (str: any) => {
40
42
  const parts = str?.split('/')?.filter((part: any) => part !== ''); // Filter out empty parts
41
43
  return parts;
@@ -47,6 +49,7 @@ function ReturnClient() {
47
49
  setLocationOptions([]);
48
50
  setSelectedClient(null);
49
51
  setSelectedFilterValue(null);
52
+ setSelectedLocationValue(null);
50
53
  }
51
54
  }, [location.pathname, searchParams]);
52
55
  // useEffect(() => {
@@ -114,7 +117,7 @@ function ReturnClient() {
114
117
  <Route path="" element={<OrderViewQueryHandler />} />
115
118
  <Route path="overview" element={<ReturnAfterTable />} />
116
119
  <Route path="/:id" element={<OrderView />} />
117
-
120
+
118
121
  <Route path="filter" element={<ReturnTable />} />
119
122
  {/* <Route
120
123
  path=""
@@ -131,4 +134,4 @@ function ReturnClient() {
131
134
  </>
132
135
  );
133
136
  }
134
- export default ReturnClient;
137
+ export default ReturnClient;