@bjsdistribution/dms-client-return 0.0.14 → 0.0.16

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.14",
2
+ "version": "0.0.16",
3
3
  "license": "MIT",
4
4
  "main": "dist/index.js",
5
5
  "typings": "dist/index.d.ts",
@@ -59,7 +59,7 @@
59
59
  "testEnvironment": "jest-environment-jsdom-sixteen"
60
60
  },
61
61
  "devDependencies": {
62
- "@bjsdistribution/dms-component-library": "^0.1.3",
62
+ "@bjsdistribution/dms-component-library": "0.1.3",
63
63
  "@size-limit/preset-small-lib": "^11.0.1",
64
64
  "@tippyjs/react": "^4.2.6",
65
65
  "@types/react": "^18.2.47",
@@ -73,7 +73,7 @@ function OrderView() {
73
73
  const paths = splitPath(location.pathname);
74
74
  const [, setLocationOptions] = useLocationOptions();
75
75
  const [apiCalling] = useApiCalling();
76
-
76
+ console.log(paths, 'paths');
77
77
  const [orderResources, setOrderResources] = useOrderProductsResources();
78
78
  const [orderToolbox, setOrderToolbox] = useOrderProductsToolbox();
79
79
  const [GsitCUstomerId, setGsitCUstomerId] = useGsitCUstomerId();
@@ -138,7 +138,7 @@ function OrderView() {
138
138
 
139
139
  useEffect(() => {
140
140
  if (paths.length > 1) {
141
- setOrderId(paths[1]);
141
+ setOrderId(paths[2]);
142
142
  }
143
143
  // for local
144
144
  // if (paths.length >= 0) {
@@ -16,7 +16,7 @@ const CreateReturnModal = () => {
16
16
  const [selectedReturnOrder] = useSelectedOrders();
17
17
  const [load] = usePostLoading();
18
18
  const [groupedPayload] = useGroupedPayload();
19
- const [forDisabledCheck] = useSelectedConfirmLoc();
19
+ // const [forDisabledCheck] = useSelectedConfirmLoc();
20
20
  const [, setNew] = useFinalPayload();
21
21
 
22
22
  const handleSelectLocations = (id: number) => {
@@ -42,9 +42,9 @@ const CreateReturnModal = () => {
42
42
  }, []);
43
43
 
44
44
  useEffect(() => {
45
- if (groupedPayload?.length > 0 && forDisabledCheck?.length > 0) {
45
+ if (groupedPayload?.length > 0 && selectedlocation?.length > 0) {
46
46
  const matchedItems = groupedPayload?.filter((item: any) =>
47
- forDisabledCheck.includes(item.id)
47
+ selectedlocation.includes(item.id)
48
48
  );
49
49
 
50
50
  if (matchedItems.length > 0) {
@@ -52,7 +52,7 @@ const CreateReturnModal = () => {
52
52
  setNew(finalPayload);
53
53
  }
54
54
  }
55
- }, [forDisabledCheck]);
55
+ }, [selectedlocation]);
56
56
 
57
57
  return (
58
58
  <>
@@ -49,6 +49,7 @@ const ModalManager = () => {
49
49
  const [, setNewPayload] = useNewReturnPayload();
50
50
  const [, setGrouped] = useGroupedPayload();
51
51
  const [, setSelectAll] = useSelectAll();
52
+ const [forCheck, setStateCheck] = useState(false);
52
53
 
53
54
  console.log(orderProduct, 'abcabcabcabcabcabcabcabcabcabcabc');
54
55
 
@@ -259,24 +260,11 @@ const ModalManager = () => {
259
260
  SetPostLoading(confirmLoading);
260
261
  }, [confirmLoading]);
261
262
 
262
- console.log(response);
263
-
264
- useEffect(() => {
265
- if (response === null || (response && response?.data)) {
266
- dispatch({ type: 'close' });
267
- setNewGrouped([]);
268
- setSelectedReturnOrder([]);
269
- setCheck([]);
270
- setNewPayload([]);
271
- setGrouped([]);
272
- setShouldPerformAction(false);
273
- setSelectAll(false);
274
- }
275
- }, [response]);
263
+ console.log(response, 'response');
276
264
 
277
265
  const handleConfirmReturn = () => {
278
266
  setShouldPerformAction(false);
279
-
267
+ setStateCheck(!forCheck);
280
268
  if (newGrouped.length > 0) {
281
269
  setShouldPerformAction(true);
282
270
  } else {
@@ -285,6 +273,17 @@ const ModalManager = () => {
285
273
  dispatch({ type: 'close' });
286
274
  };
287
275
 
276
+ useEffect(() => {
277
+ dispatch({ type: 'close' });
278
+ setNewGrouped([]);
279
+ setSelectedReturnOrder([]);
280
+ setCheck([]);
281
+ setNewPayload([]);
282
+ setGrouped([]);
283
+ setShouldPerformAction(false);
284
+ setSelectAll(false);
285
+ }, [response, forCheck]);
286
+
288
287
  return (
289
288
  <>
290
289
  {popupName?.state == 'create-return' && (