@bjsdistribution/dms-client-return 0.0.34 → 0.0.36

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.34",
2
+ "version": "0.0.36",
3
3
  "license": "MIT",
4
4
  "main": "dist/index.js",
5
5
  "typings": "dist/index.d.ts",
@@ -67,27 +67,6 @@ function SelectionFilter() {
67
67
  localStorage.setItem('clientId', value?.toString());
68
68
  localStorage.setItem('account_number', option?.account_number);
69
69
 
70
- const selectedClient = clientOptions?.find(
71
- (client: any) => client?.value === value
72
- );
73
-
74
- const clientActions = selectedClient?.actions || [];
75
-
76
- const clientLocations = selectedClient?.return_locations || [];
77
-
78
- setActionTypeOptions(
79
- clientActions?.map((action: any) => ({
80
- label: action,
81
- value: action,
82
- }))
83
- );
84
-
85
- setLocationOptions(
86
- clientLocations?.map((action: any) => ({
87
- label: action,
88
- value: action,
89
- }))
90
- );
91
70
  //set payload
92
71
  setReturnPayload((prevState: any) => ({
93
72
  ...prevState,
@@ -164,6 +143,32 @@ function SelectionFilter() {
164
143
  if (storedName) {
165
144
  setTableName(storedName);
166
145
  }
146
+ const selectedClientValue = clientOptions?.find(
147
+ (client: any) => client?.value === selectedClient
148
+ );
149
+
150
+ const clientActions = selectedClientValue?.actions || [];
151
+
152
+ const clientLocations = selectedClientValue?.return_locations || [];
153
+
154
+ setActionTypeOptions(
155
+ Array.isArray(clientActions)
156
+ ? clientActions?.map(action => ({
157
+ label: action,
158
+ value: action,
159
+ }))
160
+ : []
161
+ );
162
+
163
+ setLocationOptions(
164
+ Array.isArray(clientLocations)
165
+ ? clientLocations?.map(location => ({
166
+ label: location,
167
+ value: location,
168
+ }))
169
+ : []
170
+ );
171
+
167
172
  //client value
168
173
  if (storedClientId) {
169
174
  dispatch({
@@ -192,7 +197,7 @@ function SelectionFilter() {
192
197
  });
193
198
  }
194
199
  //location value
195
- if (selectedLocationValue && selectedLocationValue.length > 0) {
200
+ if (selectedLocationValue && selectedLocationValue?.length > 0) {
196
201
  dispatch({
197
202
  type: 'SET_LOCATION_FILTER',
198
203
  payload: selectedLocationValue,
@@ -1,9 +1,9 @@
1
- import React, { useEffect, useState } from 'react';
1
+ import React, { useEffect } from 'react';
2
2
  import {
3
- useItemsPerOverviewPage,
3
+ // useItemsPerOverviewPage,
4
4
  //useItemsPerPage,
5
5
  useLoading,
6
- UsePaginationOverviewData,
6
+ // UsePaginationOverviewData,
7
7
  useTableName,
8
8
  //UsePaginationData,
9
9
  } from './store/store';
@@ -19,29 +19,29 @@ import { Text } from './filters/FilterStyle';
19
19
  import ReturnTable from './table/ReturnTable';
20
20
  import { overviewfiltersReducerAtom } from './header-filters/overViewFilter';
21
21
  // import { notification } from 'antd';
22
- import Pagination from './table-view/Pagination';
22
+ // import Pagination from './table-view/Pagination';
23
23
  // import Pagination from './table-view/Pagination';
24
24
  // import { overviewfiltersReducerAtom } from './header-filters/overViewFilter';
25
25
 
26
26
  function ReturnMainTable() {
27
27
  const [state] = useAtom(overviewfiltersReducerAtom);
28
- const [paginationObj] = UsePaginationOverviewData();
29
- const [, setCurrentPage] = useState(1);
30
- const [itemsPerPage, setItemsPerPage] = useItemsPerOverviewPage();
28
+ // const [paginationObj] = UsePaginationOverviewData();
29
+ // const [, setCurrentPage] = useState(1);
30
+ // const [itemsPerPage, setItemsPerPage] = useItemsPerOverviewPage();
31
31
  const { 'x-pagination': pagination } = state;
32
- const { page, total } = paginationObj;
32
+ // const { page, total } = paginationObj;
33
33
  // const [selectedClient] = useTableName();
34
34
  const [isScrolled] = useStickyStatus();
35
35
  const [, setLoading] = useLoading();
36
36
  const [, setClientData] = useClientData();
37
37
  const [tableName] = useTableName();
38
38
 
39
- const handlePageChange = (page: number) => {
40
- setCurrentPage(page);
41
- };
42
- const handleItemsPerPageChange = (itemsPerPage: number) => {
43
- setItemsPerPage(itemsPerPage);
44
- };
39
+ // const handlePageChange = (page: number) => {
40
+ // setCurrentPage(page);
41
+ // };
42
+ // const handleItemsPerPageChange = (itemsPerPage: number) => {
43
+ // setItemsPerPage(itemsPerPage);
44
+ // };
45
45
 
46
46
  const {
47
47
  data: fetchedClientData,
@@ -86,7 +86,7 @@ function ReturnMainTable() {
86
86
  </Row>
87
87
  <ReturnTable />
88
88
  </Container>
89
- {total > 0 && (
89
+ {/* {total > 0 && (
90
90
  <Pagination
91
91
  currentPage={page}
92
92
  totalItems={total}
@@ -94,7 +94,7 @@ function ReturnMainTable() {
94
94
  onPageChange={handlePageChange}
95
95
  onItemsPerPageChange={handleItemsPerPageChange}
96
96
  ></Pagination>
97
- )}
97
+ )} */}
98
98
  </div>
99
99
  </DashBoardWrapper>
100
100
  </>