@bjsdistribution/dms-client-return 0.0.9 → 0.0.10

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 (47) hide show
  1. package/dist/components/order-daily-overview/return-after-table/table-filters/ReturnFilterStore.d.ts +16 -0
  2. package/dist/components/order-daily-overview/return-after-table/table-filters/ReturnOrderFilter.d.ts +1 -0
  3. package/dist/components/store.d.ts +12 -2
  4. package/dist/components/types.d.ts +7 -0
  5. package/dist/dms-client-return.cjs.development.js +692 -425
  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 +693 -426
  10. package/dist/dms-client-return.esm.js.map +1 -1
  11. package/package.json +1 -1
  12. package/src/common/custom-switch/index.tsx +12 -4
  13. package/src/components/order-daily-overview/filters/FilterStyle.tsx +2 -13
  14. package/src/components/order-daily-overview/filters/Filters.tsx +7 -1
  15. package/src/components/order-daily-overview/header-filters/HeaderFilter.tsx +1 -1
  16. package/src/components/order-daily-overview/header-filters/SelectionFilter.tsx +46 -1
  17. package/src/components/order-daily-overview/return-after-table/ReturnAfterTable.tsx +6 -5
  18. package/src/components/order-daily-overview/return-after-table/table-filters/ReturnFilterStore.ts +130 -0
  19. package/src/components/order-daily-overview/return-after-table/table-filters/ReturnOrderFilter.tsx +143 -63
  20. package/src/components/order-daily-overview/return-order-table/return-orders-filters/ReturnFilter.tsx +3 -2
  21. package/src/components/order-daily-overview/return-order-table/return-orders-filters/ReturnOrderTable.tsx +123 -14
  22. package/src/components/order-daily-overview/return-order-table/return-orders-filters/returnstyles.ts +1 -1
  23. package/src/components/order-daily-overview/table/ReturnTable.tsx +12 -0
  24. package/src/components/order-view/hooks/useGetEventNotes.tsx +15 -2
  25. package/src/components/order-view/hooks/useGetSystemLogs.tsx +14 -2
  26. package/src/components/order-view/hooks/useUpdateOrder.ts +13 -2
  27. package/src/components/order-view/modalsPopup/CreateReturnModal.tsx +14 -17
  28. package/src/components/order-view/modalsPopup/ModalManager.tsx +90 -62
  29. package/src/components/order-view/notes/AddNote.tsx +7 -2
  30. package/src/components/order-view/order-actions/actions/change-customer-account/ChangeCustomerAccModal.tsx +6 -2
  31. package/src/components/order-view/order-actions/actions/escalation/Dropdowns.tsx +5 -0
  32. package/src/components/order-view/order-actions/actions/escalation/upgrade/index.tsx +7 -1
  33. package/src/components/order-view/order-actions/hooks/useAllReminderData.ts +13 -2
  34. package/src/components/order-view/order-actions/hooks/useAllTaskData.ts +15 -5
  35. package/src/components/order-view/order-actions/hooks/useCreateReminder.ts +20 -4
  36. package/src/components/order-view/order-actions/hooks/useCreateTask.ts +14 -3
  37. package/src/components/order-view/order-actions/hooks/useFetchSingleFlagData.ts +15 -3
  38. package/src/components/order-view/order-actions/hooks/useFetchSingleReminder.ts +13 -2
  39. package/src/components/order-view/order-actions/hooks/useUpdateFlag.ts +12 -2
  40. package/src/components/order-view/order-actions/hooks/useUpdateReminder.ts +12 -2
  41. package/src/components/order-view/products-info/expanded-content/index.tsx +6 -1
  42. package/src/components/order-view/return-client-products/product-table-footer/ProductDetailsFooter.tsx +6 -1
  43. package/src/components/order-view/system-event-logs/expanded-content/index.tsx +7 -1
  44. package/src/components/order-view/view-reminder/AssigneeDropdown.tsx +6 -1
  45. package/src/components/store.ts +30 -1
  46. package/src/components/types.ts +8 -0
  47. package/src/index.tsx +8 -4
@@ -7,7 +7,12 @@ import { Empty } from 'antd';
7
7
  import { useAtom } from 'jotai';
8
8
  import React, { useEffect, useRef, useState } from 'react';
9
9
  import { Skeleton } from 'antd';
10
- import { useSelectedOrders } from '../../../store';
10
+ import {
11
+ useGroupedPayload,
12
+ useNewReturnPayload,
13
+ useReturnPayload,
14
+ useSelectedOrders,
15
+ } from '../../../store';
11
16
  import { useReturnData } from '../../../order-view/store';
12
17
  import { EmptyDataContainer } from '../../table/table-data/styles';
13
18
  import { CustomDrop, StyledTable, StyledTableWrapper } from './returnstyles';
@@ -17,7 +22,6 @@ import { useLoading, usePrintOptionTOggle } from '../../store/store';
17
22
  import { ApiResponse } from '../../../types';
18
23
  import { filtersReducerAtom } from '../../header-filters/filterStore';
19
24
  import PrintDropDown from '../../../order-view/details-filters/left-side-filters/dropdowns/PrintDropDown';
20
-
21
25
  const ReturnOrderTable = ({ loadingskeleton }: any) => {
22
26
  const [state] = useAtom(filtersReducerAtom);
23
27
 
@@ -29,6 +33,9 @@ const ReturnOrderTable = ({ loadingskeleton }: any) => {
29
33
  const dropdownRefParent = useRef<HTMLDivElement>(null);
30
34
  const dropdownRef = useRef<HTMLDivElement>(null);
31
35
  const [printToogle, setPrintToggle] = usePrintOptionTOggle();
36
+ const [createReturn, setReturnPayload] = useReturnPayload();
37
+ const [newpayload, setNewPayload] = useNewReturnPayload();
38
+ const [, setGrouped] = useGroupedPayload();
32
39
 
33
40
  const OpenDropDown = (index: number) => {
34
41
  setPrintToggle(prevIndex => (prevIndex === index ? null : index));
@@ -70,9 +77,23 @@ const ReturnOrderTable = ({ loadingskeleton }: any) => {
70
77
  setSelectAll(e.target.checked);
71
78
  if (e.target.checked) {
72
79
  setSelectedReturnOrder(
73
- returnData.map((invoice: any) => ({
74
- id: invoice.id,
75
- status_id: 3,
80
+ returnData?.map((loc: any) => ({
81
+ id: loc.id,
82
+ return_locations: loc?.return_locations,
83
+ return_location: loc?.return_location,
84
+ products: loc.id,
85
+ order_product_return_action: loc?.order_product_return_action,
86
+ return_location_token: loc?.return_locations?.token,
87
+ }))
88
+ );
89
+ setNewPayload(
90
+ returnData?.map((loc: any) => ({
91
+ id: loc.id,
92
+ account_number: createReturn?.account_number,
93
+ customer_id: createReturn?.customer_id,
94
+ products: loc.id,
95
+ return_action: loc?.order_product_return_action?.type || null,
96
+ return_location_token: loc?.return_locations?.token,
76
97
  }))
77
98
  );
78
99
  } else {
@@ -80,29 +101,110 @@ const ReturnOrderTable = ({ loadingskeleton }: any) => {
80
101
  }
81
102
  };
82
103
 
83
- const handleSelectInvoice = (id: any) => {
84
- setSelectedReturnOrder((prevSelectedInvoices: any) => {
85
- const isSelected = prevSelectedInvoices?.some(
86
- (invoice: any) => invoice.id === id
104
+ const handleSelectOrderReturn = (
105
+ id: any,
106
+ return_location: any,
107
+ return_locations: any,
108
+ order_product_return_action: any
109
+ ) => {
110
+ setSelectedReturnOrder((prevSelectedLocations: any) => {
111
+ const isSelected = prevSelectedLocations?.some(
112
+ (loc: any) => loc.id === id
87
113
  );
88
114
 
89
115
  if (isSelected) {
90
- return prevSelectedInvoices.filter((invoice: any) => invoice.id !== id);
116
+ const updatedSelectedLocations = prevSelectedLocations.filter(
117
+ (loc: any) => loc.id !== id
118
+ );
119
+
120
+ setReturnPayload(prevState => ({
121
+ ...prevState,
122
+ products: id,
123
+ return_action: order_product_return_action?.type || null,
124
+ return_location_token: return_locations?.token || null,
125
+ }));
126
+
127
+ setNewPayload((prevPayload: any) =>
128
+ prevPayload.filter((item: any) => item.id !== id)
129
+ );
130
+
131
+ return updatedSelectedLocations;
91
132
  } else {
92
- return [...prevSelectedInvoices, { id, status_id: 3 }];
133
+ const newReturnPayload = {
134
+ id,
135
+ account_number: createReturn?.account_number,
136
+ customer_id: createReturn?.customer_id,
137
+ products: id,
138
+ return_action: order_product_return_action?.type || null,
139
+ return_location_token: return_locations?.token || null,
140
+ };
141
+
142
+ setNewPayload((prevPayload: any) => [...prevPayload, newReturnPayload]);
143
+
144
+ setReturnPayload(prevState => ({
145
+ ...prevState,
146
+ products: id,
147
+ return_action: order_product_return_action?.type || null,
148
+ return_location_token: return_locations?.token || null,
149
+ }));
150
+
151
+ return [
152
+ ...prevSelectedLocations,
153
+ {
154
+ id,
155
+ return_location,
156
+ return_locations,
157
+ order_product_return_action,
158
+ },
159
+ ];
93
160
  }
94
161
  });
95
162
  };
163
+
164
+ useEffect(() => {
165
+ if (newpayload?.length === 0) return;
166
+
167
+ const groupedPayload = newpayload?.reduce((acc: any, item: any) => {
168
+ const { return_location_token } = item;
169
+
170
+ if (!return_location_token) {
171
+ acc.push(item);
172
+ } else {
173
+ if (!acc[return_location_token]) {
174
+ acc[return_location_token] = {
175
+ ...item,
176
+ products: [],
177
+ return_action: [],
178
+ };
179
+ }
180
+
181
+ acc[return_location_token].products = [
182
+ ...acc[return_location_token].products,
183
+ ...item.products,
184
+ ];
185
+
186
+ acc[return_location_token].return_action = [
187
+ ...acc[return_location_token].return_action,
188
+ ...item.return_action,
189
+ ];
190
+ }
191
+
192
+ return acc;
193
+ }, []);
194
+
195
+ const mergedPayload = Object.values(groupedPayload);
196
+ setGrouped(mergedPayload);
197
+ }, [newpayload]);
198
+
96
199
  return (
97
200
  <>
98
- <StyledTableWrapper id="tableScrolling">
201
+ <StyledTableWrapper>
99
202
  <StyledTable>
100
203
  <thead>
101
204
  <tr>
102
205
  <th className="emailInvoiceCheckbox">
103
206
  <Checkbox checked={selectAll} onChange={handleSelectAll} />
104
207
  </th>
105
- {/* <th className="emailInvoiceNo">Invoice No.</th> */}
106
208
  <th>Product Location</th>
107
209
  <th>Return Location</th>
108
210
  <th>Recipient</th>
@@ -142,7 +244,14 @@ const ReturnOrderTable = ({ loadingskeleton }: any) => {
142
244
  (selectedInvoice: any) =>
143
245
  selectedInvoice?.id === item.id
144
246
  )}
145
- onChange={() => handleSelectInvoice(item.id)}
247
+ onChange={() =>
248
+ handleSelectOrderReturn(
249
+ item.id,
250
+ item.return_location,
251
+ item.return_locations,
252
+ item.order_product_return_action
253
+ )
254
+ }
146
255
  />
147
256
  </td>
148
257
 
@@ -498,7 +498,7 @@ export const StyledTableWrapper = styled.div`
498
498
  overflow-x: auto;
499
499
  max-height: calc(100vh - 396px);
500
500
  scrollbar-width: none;
501
- height: 400px;
501
+ height: 600px;
502
502
  /* box-shadow: 0px 0px 30px 6px rgba(46, 45, 116, 0.05); */
503
503
  &::-webkit-scrollbar {
504
504
  width: 5px;
@@ -49,6 +49,8 @@ const ReturnTable: React.FC = ({ loadingskeleton }: any) => {
49
49
  <th>Client</th>
50
50
  <th>Orders</th>
51
51
  <th>Products</th>
52
+ <th>RTS</th>
53
+ <th>Pending</th>
52
54
  <th>Dispose</th>
53
55
  <th>Re-allocate</th>
54
56
  <th>Re-Del</th>
@@ -105,6 +107,16 @@ const ReturnTable: React.FC = ({ loadingskeleton }: any) => {
105
107
  <GreyBox>{key?.return_order_products}</GreyBox>
106
108
  </ColumStyle>
107
109
  </td>
110
+ <td>
111
+ <ColumStyle>
112
+ <GreyBox>{key?.RTS}</GreyBox>
113
+ </ColumStyle>
114
+ </td>
115
+ <td>
116
+ <ColumStyle>
117
+ <GreyBox>{key?.PENDING}</GreyBox>
118
+ </ColumStyle>
119
+ </td>
108
120
  <td>
109
121
  <ColumStyle>
110
122
  <GreyBox>{key?.DISPOSE}</GreyBox>
@@ -1,5 +1,6 @@
1
1
  import { getBaseEndpoint } from '@bjsdistribution/dms-component-library';
2
2
  import { getCookie } from '../utils';
3
+ import { notification } from 'antd';
3
4
  // import { useOrderDetails, useOrderProductSystemLogs } from '../store';
4
5
 
5
6
  function useGetEventNotes() {
@@ -25,7 +26,13 @@ function useGetEventNotes() {
25
26
  const json = await response.json();
26
27
  const detail = json?.detail;
27
28
  const msg = detail[0]?.msg;
28
- console.error('Error response:', msg);
29
+ // console.error('Error response:', msg);
30
+
31
+ notification.error({
32
+ message: 'Error',
33
+ description:
34
+ `${msg}` || 'An error has occurred. Please try again later.',
35
+ });
29
36
  // setLoading(false);
30
37
  return [];
31
38
  }
@@ -35,7 +42,13 @@ function useGetEventNotes() {
35
42
  }
36
43
  return [];
37
44
  } catch (err) {
38
- console.error('Error fetching data:', err);
45
+ // console.error('Error fetching data:', err);
46
+ notification.error({
47
+ message: 'Error',
48
+ description:
49
+ `${err}` || 'An error has occurred. Please try again later.',
50
+ });
51
+
39
52
  return [];
40
53
  } finally {
41
54
  // setLoading(false);
@@ -1,6 +1,7 @@
1
1
  import { getBaseEndpoint } from '@bjsdistribution/dms-component-library';
2
2
  import { getCookie } from '../utils';
3
3
  import { useOrderDetails, useOrderProductSystemLogs } from '../store';
4
+ import { notification } from 'antd';
4
5
 
5
6
  function useSystemLogs() {
6
7
  const ssoToken = getCookie('id_token');
@@ -36,7 +37,13 @@ function useSystemLogs() {
36
37
  const json = await response.json();
37
38
  const detail = json?.detail;
38
39
  const msg = detail[0]?.msg;
39
- console.error('Error response:', msg);
40
+ // console.error('Error response:', msg);
41
+
42
+ notification.error({
43
+ message: 'Error',
44
+ description:
45
+ `${msg}` || 'An error has occurred. Please try again later.',
46
+ });
40
47
  // setLoading(false);
41
48
  return [];
42
49
  }
@@ -48,7 +55,12 @@ function useSystemLogs() {
48
55
  }
49
56
  return [];
50
57
  } catch (err) {
51
- console.error('Error fetching data:', err);
58
+ // console.error('Error fetching data:', err);
59
+ notification.error({
60
+ message: 'Error',
61
+ description:
62
+ `${err}` || 'An error has occurred. Please try again later.',
63
+ });
52
64
  return [];
53
65
  } finally {
54
66
  // setLoading(false);
@@ -1,5 +1,6 @@
1
1
  import { getBaseEndpoint } from '@bjsdistribution/dms-component-library';
2
2
  import { getCookie } from '../utils';
3
+ import { notification } from 'antd';
3
4
 
4
5
  function useUpdateOrder() {
5
6
  let controller: AbortController;
@@ -32,11 +33,21 @@ function useUpdateOrder() {
32
33
  throw new Error('response is not ok');
33
34
  }
34
35
  const json = await response.json();
35
- alert('Order has been updated');
36
+ // alert('Order has been updated');
37
+ notification.success({
38
+ message: 'Success',
39
+ description: 'Order has been updated.',
40
+ });
36
41
  return json;
37
42
  } catch (err) {
38
43
  // setLoading(false);
39
- console.log(err, 'error');
44
+ // console.log(err, 'error');
45
+
46
+ notification.error({
47
+ message: 'Error',
48
+ description:
49
+ `${err}` || 'An error has occurred. Please try again later.',
50
+ });
40
51
  } finally {
41
52
  // setLoading(false); // Set loading to false after fetching
42
53
  }
@@ -1,27 +1,24 @@
1
1
  import { Alert, Checkbox } from '@bjsdistribution/dms-component-library';
2
2
  import React, { useState } from 'react';
3
3
  import styled from 'styled-components';
4
- import { useLocationData } from '../../store';
4
+ import { useSelectedOrders } from '../../store';
5
5
 
6
6
  const CreateReturnModal = () => {
7
- const [, setSelectedLocations] = useState<any[]>();
8
- const [locationData] = useLocationData();
7
+ const [selectedlocation, setSelectedLocations] = useState<any[]>([]);
8
+ const [selectedReturnOrder] = useSelectedOrders();
9
9
 
10
- const handleSelectLocations = (id: any) => {
11
- setSelectedLocations((prevSelectedLocations: any) => {
12
- const isSelected = prevSelectedLocations?.some(
13
- (location: any) => location.id === id
14
- );
10
+ const handleSelectLocations = (id: number) => {
11
+ setSelectedLocations((prevSelectedLocations: number[]) => {
12
+ const isSelected = prevSelectedLocations.includes(id);
15
13
 
16
14
  if (isSelected) {
17
- return prevSelectedLocations.filter(
18
- (invoice: any) => invoice.id !== id
19
- );
15
+ return prevSelectedLocations.filter(selectedId => selectedId !== id);
20
16
  } else {
21
- return [...prevSelectedLocations, { id, status_id: 3 }];
17
+ return [...prevSelectedLocations, id];
22
18
  }
23
19
  });
24
20
  };
21
+
25
22
  return (
26
23
  <Wrapper>
27
24
  <Alert
@@ -33,9 +30,9 @@ const CreateReturnModal = () => {
33
30
  />
34
31
  <Container>
35
32
  <ul style={{ listStyle: 'none', padding: 0 }}>
36
- {locationData?.map((invoice: any) => (
33
+ {selectedReturnOrder?.map((returnLoc: any) => (
37
34
  <li
38
- key={invoice.id}
35
+ key={returnLoc.id}
39
36
  style={{
40
37
  marginBottom: '8px',
41
38
  display: 'flex',
@@ -43,11 +40,11 @@ const CreateReturnModal = () => {
43
40
  }}
44
41
  >
45
42
  <Checkbox
46
- checked={true}
47
- onChange={() => handleSelectLocations(invoice.id)}
43
+ checked={selectedlocation.includes(returnLoc.id)}
44
+ onChange={() => handleSelectLocations(returnLoc.id)}
48
45
  />
49
46
  <StyledText style={{ marginLeft: '8px' }}>
50
- {invoice.location_name}
47
+ {returnLoc?.return_location}
51
48
  </StyledText>
52
49
  </li>
53
50
  ))}
@@ -15,16 +15,17 @@ import {
15
15
 
16
16
  import ProductAction from './ProductAction';
17
17
  // import DeleteProduct from './DeleteProduct';
18
- import AddProduct from './AddProduct';
18
+ // import AddProduct from './AddProduct';
19
19
  import logsTable from './qclogs/logsTable';
20
20
  import DefectsModal from './DefectsModal';
21
21
  import repackModal from './RepackModal';
22
22
  import { ApiResponse } from '../types';
23
23
  import CreateReturnModal from './CreateReturnModal';
24
+ import { useNewReturnPayload } from '../../store';
24
25
  const ModalManager = () => {
25
26
  const [popupName, dispatch] = useAtom(countReducerAtom);
26
27
  const [,] = useProductDetails();
27
- const [orderProduct, setOrderProduct] = useCreateOrderProducts();
28
+ const [orderProduct] = useCreateOrderProducts();
28
29
  const [orderId] = useOrderId();
29
30
  const [selectedRows] = useDeleteProdsID();
30
31
  const [unRecieve, setUnRecieve] = useRecieveOrderProducts();
@@ -32,6 +33,7 @@ const ModalManager = () => {
32
33
  const [selectedProductId] = useAtom(selectedProductIdAtom);
33
34
  const [selectedTab] = useAtom(selectedTabKeyAtom);
34
35
  const [, setIsFormValid] = useState(false);
36
+ const [newPayload, setNewPayload] = useNewReturnPayload();
35
37
 
36
38
  console.log(orderProduct, 'abcabcabcabcabcabcabcabcabcabcabc');
37
39
 
@@ -89,71 +91,71 @@ const ModalManager = () => {
89
91
  // };
90
92
 
91
93
  // API block for creating product order
92
- const {
93
- data: response,
94
- setShouldPerformAction: setOrderAction,
95
- } = useApiHook<{
96
- data: ApiResponse[];
97
- }>({
98
- endpoint: `order/order_products/create/`,
99
- method: 'POST',
100
- body: [orderProduct],
101
- performAction: false,
102
- });
94
+ // const {
95
+ // data: response,
96
+ // setShouldPerformAction: setOrderAction,
97
+ // } = useApiHook<{
98
+ // data: ApiResponse[];
99
+ // }>({
100
+ // endpoint: `order/order_products/create/`,
101
+ // method: 'POST',
102
+ // body: [orderProduct],
103
+ // performAction: false,
104
+ // });
103
105
 
104
- const validateAddForm = () => {
105
- if (!Array.isArray(orderProduct)) return false;
106
+ // const validateAddForm = () => {
107
+ // if (!Array.isArray(orderProduct)) return false;
106
108
 
107
- return orderProduct.every(
108
- (product: any) =>
109
- product.code !== '' &&
110
- product.description !== '' &&
111
- product.weight !== 0 &&
112
- product.cube !== 0 &&
113
- product.order_product_type_id !== 0 &&
114
- product.sku !== ''
115
- );
116
- };
109
+ // return orderProduct.every(
110
+ // (product: any) =>
111
+ // product.code !== '' &&
112
+ // product.description !== '' &&
113
+ // product.weight !== 0 &&
114
+ // product.cube !== 0 &&
115
+ // product.order_product_type_id !== 0 &&
116
+ // product.sku !== ''
117
+ // );
118
+ // };
117
119
 
118
- useEffect(() => {
119
- setAddIsFormValid(validateAddForm());
120
- }, [orderProduct]);
120
+ // useEffect(() => {
121
+ // setAddIsFormValid(validateAddForm());
122
+ // }, [orderProduct]);
121
123
 
122
- const onAddOrderProduct = () => {
123
- if (isAddFormValid) {
124
- setOrderProduct((prev: any) =>
125
- prev.map((product: any) => ({
126
- ...product,
127
- order_id: orderId,
128
- }))
129
- );
130
- setOrderAction(true);
131
- } else {
132
- console.log('Please fill in all required fields before proceeding.');
133
- }
134
- };
124
+ // const onAddOrderProduct = () => {
125
+ // if (isAddFormValid) {
126
+ // setOrderProduct((prev: any) =>
127
+ // prev.map((product: any) => ({
128
+ // ...product,
129
+ // order_id: orderId,
130
+ // }))
131
+ // );
132
+ // setOrderAction(true);
133
+ // } else {
134
+ // console.log('Please fill in all required fields before proceeding.');
135
+ // }
136
+ // };
135
137
 
136
- useEffect(() => {
137
- if (response && response?.data) {
138
- dispatch({ type: 'close' });
139
- }
140
- }, [response]);
138
+ // useEffect(() => {
139
+ // if (response && response?.data) {
140
+ // dispatch({ type: 'close' });
141
+ // }
142
+ // }, [response]);
141
143
 
142
- const [isAddFormValid, setAddIsFormValid] = useState(false);
144
+ // const [isAddFormValid, setAddIsFormValid] = useState(false);
143
145
 
144
- const AddMore = () => {
145
- setOrderProduct((prevProducts: any) => [
146
- ...prevProducts,
147
- {
148
- code: '',
149
- description: '',
150
- sku: '',
151
- weight: '',
152
- cube: '',
153
- order_product_type_id: '',
154
- },
155
- ]);
156
- };
146
+ // const AddMore = () => {
147
+ // setOrderProduct((prevProducts: any) => [
148
+ // ...prevProducts,
149
+ // {
150
+ // code: '',
151
+ // description: '',
152
+ // sku: '',
153
+ // weight: '',
154
+ // cube: '',
155
+ // order_product_type_id: '',
156
+ // },
157
+ // ]);
158
+ // };
157
159
 
158
160
  // api block for the create product order
159
161
  const {
@@ -224,6 +226,30 @@ const ModalManager = () => {
224
226
  }
225
227
  }, [updateResponse]);
226
228
 
229
+ //Confirm return popup
230
+ const { data: response, setShouldPerformAction } = useApiHook<{
231
+ data: ApiResponse[];
232
+ }>({
233
+ endpoint: `return_orders/`,
234
+ method: 'POST',
235
+ body: [newPayload],
236
+ performAction: false,
237
+ });
238
+ const handleConfirmReturn = () => {
239
+ const payloadWithoutId = newPayload?.map(({ id, ...rest }: any) => ({
240
+ ...rest,
241
+ }));
242
+
243
+ console.log(response);
244
+
245
+ if (payloadWithoutId) {
246
+ setNewPayload(payloadWithoutId);
247
+ setShouldPerformAction(true);
248
+ } else {
249
+ setShouldPerformAction(false);
250
+ }
251
+ };
252
+
227
253
  return (
228
254
  <>
229
255
  {popupName?.state == 'create-return' && (
@@ -239,7 +265,9 @@ const ModalManager = () => {
239
265
  {
240
266
  name: 'Submit',
241
267
  btnStyle: 'rounded',
268
+ onClick: handleConfirmReturn,
242
269
  type: 'button',
270
+ disabled: !newPayload,
243
271
  },
244
272
  ],
245
273
 
@@ -277,7 +305,7 @@ const ModalManager = () => {
277
305
  />
278
306
  )} */}
279
307
 
280
- {popupName?.state === 'addProduct' && (
308
+ {/* {popupName?.state === 'addProduct' && (
281
309
  <AntModal
282
310
  openStatus={popupName?.state === 'addProduct'}
283
311
  closeModal={closeModal}
@@ -306,7 +334,7 @@ const ModalManager = () => {
306
334
  width={1104}
307
335
  classNameAdd={'globalPopup'}
308
336
  />
309
- )}
337
+ )} */}
310
338
  {popupName?.state === 'qclog' && (
311
339
  <AntModal
312
340
  openStatus={popupName?.state === 'qclog'}
@@ -92,8 +92,13 @@ function AddNote() {
92
92
  });
93
93
  }
94
94
  } catch (error) {
95
- console.error('Error saving note:', error);
96
- alert('Failed to save note');
95
+ // console.error('Error saving note:', error);
96
+ // alert('Failed to save note');
97
+ notification.error({
98
+ message: 'Error',
99
+ description:
100
+ `${error}` || 'An error has occurred. Please try again later.',
101
+ });
97
102
  }
98
103
  };
99
104
 
@@ -4,9 +4,9 @@ import OrderActionModal from '../../../../../common/modals/order-action-modal/Or
4
4
  import { ContentContainer, Label, Row, SplitLayout } from '../modalstyle';
5
5
  import { OptionsMenu } from '../../../fakedata';
6
6
  import { useCurrentAction } from '../../../store';
7
+ import { notification } from 'antd';
7
8
 
8
9
  function ChangeCustomerAccModal() {
9
-
10
10
  const [, setCurrentAction] = useCurrentAction();
11
11
 
12
12
  const closeModal = () => {
@@ -14,7 +14,11 @@ function ChangeCustomerAccModal() {
14
14
  };
15
15
 
16
16
  const handleSelectChange = () => {
17
- alert('hello');
17
+ // alert('hello');
18
+ notification.success({
19
+ message: 'Success',
20
+ description: 'Saved successfully.',
21
+ });
18
22
  };
19
23
  return (
20
24
  <OrderActionModal
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
  import { AntSelect, Label } from '@bjsdistribution/dms-component-library';
3
3
  import styled from 'styled-components';
4
+ import { notification } from 'antd';
4
5
  // import {
5
6
  // EscalationCategory,
6
7
  // EscalationLevel,
@@ -29,6 +30,10 @@ const StyledAntSelect = styled(AntSelect)`
29
30
  const Dropdowns = () => {
30
31
  const handleSelectChange = () => {
31
32
  // alert('hello');
33
+ notification.success({
34
+ message: 'Success',
35
+ description: 'Saved successfully.',
36
+ });
32
37
  };
33
38
  return (
34
39
  <FlexContainer>