@bjsdistribution/dms-client-return 0.0.67 → 0.0.68

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.67",
2
+ "version": "0.0.68",
3
3
  "license": "MIT",
4
4
  "main": "dist/index.js",
5
5
  "typings": "dist/index.d.ts",
@@ -59,13 +59,21 @@ function ReturnMainTable() {
59
59
  if (fetchedClientData && fetchedClientData.data) {
60
60
  const result = fetchedClientData?.data;
61
61
  setClientData(result);
62
- if (paginationData !== null) {
63
- const { count, ...rest } = JSON.parse(paginationData);
64
- setPaginationObject(rest);
62
+ if (paginationData) {
63
+ try {
64
+ const { count, ...rest } = JSON.parse(paginationData);
65
+ setPaginationObject(rest);
66
+ } catch (error) {
67
+ console.error('Error parsing paginationData:', error);
68
+ notification.error({
69
+ message: 'Error',
70
+ description: 'Failed to parse pagination data',
71
+ });
72
+ }
65
73
  } else {
66
74
  notification.error({
67
75
  message: 'Error',
68
- description: 'Pagination data is null',
76
+ description: 'Pagination data is null or undefined',
69
77
  });
70
78
  }
71
79
  }
@@ -57,13 +57,21 @@ const ReturnAfterTable = () => {
57
57
  setLoading(loading);
58
58
  if (fetchedReturnOrderData && fetchedReturnOrderData?.data) {
59
59
  setReturnOrderData(fetchedReturnOrderData?.data);
60
- if (paginationData !== null) {
61
- const { count, ...rest } = JSON.parse(paginationData);
62
- setPaginationObject(rest);
60
+ if (paginationData) {
61
+ try {
62
+ const { count, ...rest } = JSON.parse(paginationData);
63
+ setPaginationObject(rest);
64
+ } catch (error) {
65
+ console.error('Error parsing paginationData:', error);
66
+ notification.error({
67
+ message: 'Error',
68
+ description: 'Failed to parse pagination data',
69
+ });
70
+ }
63
71
  } else {
64
72
  notification.error({
65
73
  message: 'Error',
66
- description: 'Pagination data is null',
74
+ description: 'Pagination data is null or undefined',
67
75
  });
68
76
  }
69
77
  }
@@ -146,6 +146,8 @@ const OrderTable = () => {
146
146
  return { color: '#F4A503', background: '#FFF1D6' };
147
147
  case 'Awaiting route':
148
148
  return { color: '#845ADF', background: 'rgba(132, 90, 223, 0.15)' };
149
+ case 'Awaiting':
150
+ return { color: '#845ADF', background: 'rgba(132, 90, 223, 0.15)' };
149
151
  case 'Completed':
150
152
  return { color: '#1F9254', background: 'rgba(41, 204, 106, 0.15)' };
151
153
  case 'Outstanding':
@@ -277,6 +279,7 @@ const OrderTable = () => {
277
279
  OO: 'On Hold',
278
280
  SC: 'Sub-Contracted',
279
281
  'awaiting route': 'Awaiting route',
282
+ 'awaiting confirmation': 'Awaiting',
280
283
  completed: 'completed',
281
284
  outstanding: 'Outstanding',
282
285
  routed: 'Routed',
@@ -131,13 +131,21 @@ const ReturnOrderTable = () => {
131
131
  setLoading(returnDataLoad);
132
132
  if (fetchedOrderData && fetchedOrderData?.data) {
133
133
  setReturnData(fetchedOrderData?.data);
134
- if (paginationData !== null) {
135
- const { count, ...rest } = JSON.parse(paginationData);
136
- setPaginationObject(rest);
134
+ if (paginationData) {
135
+ try {
136
+ const { count, ...rest } = JSON.parse(paginationData);
137
+ setPaginationObject(rest);
138
+ } catch (error) {
139
+ console.error('Error parsing paginationData:', error);
140
+ notification.error({
141
+ message: 'Error',
142
+ description: 'Failed to parse pagination data',
143
+ });
144
+ }
137
145
  } else {
138
146
  notification.error({
139
147
  message: 'Error',
140
- description: 'Pagination data is null',
148
+ description: 'Pagination data is null or undefined',
141
149
  });
142
150
  }
143
151
  }
@@ -221,7 +221,6 @@ function OrderView() {
221
221
  useEffect(() => {
222
222
  setLoading(depotDataLoading);
223
223
  if (fetchedDepotData && fetchedDepotData.data) {
224
- console.log(fetchedDepotData, 'fetchedDepotData');
225
224
  const requiredData = fetchedDepotData?.data;
226
225
  if (requiredData.length > 0) {
227
226
  const options = requiredData?.map((x: any) => {
package/src/index.tsx CHANGED
@@ -43,8 +43,9 @@ function ReturnClient() {
43
43
  return parts;
44
44
  };
45
45
  const paths = splitPath(location.pathname);
46
+
46
47
  useEffect(() => {
47
- if (paths[paths.length - 1] === 'orders/view/return') {
48
+ if (paths.join('/') === 'orders/view/return') {
48
49
  setActionTypeOptions([]);
49
50
  setLocationOptions([]);
50
51
  setSelectedClient(null);
@@ -52,11 +53,7 @@ function ReturnClient() {
52
53
  setSelectedLocationValue(null);
53
54
  }
54
55
  }, [location.pathname, searchParams]);
55
- // useEffect(() => {
56
- // if (selectedClientId) {
57
- // navigate(`filter/${selectedClientId}`);
58
- // }
59
- // }, [selectedClientId]);
56
+
60
57
  //API for client data
61
58
  const { data: fetchedCustomerData, loading: loading } = useApiHook<
62
59
  ApiResponse
@@ -113,22 +110,18 @@ function ReturnClient() {
113
110
  <Suspense fallback={<LoadingMessage />}>
114
111
  <Routes>
115
112
  {/* for local */}
113
+ {/* <Route
114
+ path="/orders/view/return/*"
115
+ element={<OrderViewQueryHandler />}
116
+ /> */}
116
117
  {/* for dev */}
117
118
  <Route path="" element={<OrderViewQueryHandler />} />
118
119
  <Route path="overview" element={<ReturnAfterTable />} />
119
120
  <Route path="/:id" element={<OrderView />} />
120
-
121
+ {/* for local */}
122
+ {/* <Route path="/orders/view/return/filter" element={<ReturnTable />} /> */}
123
+ {/* for dev */}
121
124
  <Route path="filter" element={<ReturnTable />} />
122
- {/* <Route
123
- path=""
124
- element={
125
- selectedClientString ? (
126
- <Navigate to={`return/${selectedClientString}`} />
127
- ) : (
128
- <ReturnMainTable />
129
- )
130
- }
131
- /> */}
132
125
  </Routes>
133
126
  </Suspense>
134
127
  </>