umwd-components 0.1.735 → 0.1.736

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 (32) hide show
  1. package/dist/cjs/src/components/ContactForm.js +1 -1
  2. package/dist/cjs/src/components/common/Contacts.js +1 -1
  3. package/dist/cjs/src/components/e-commerce/iro/RmaForm.js +1 -1
  4. package/dist/cjs/src/components/e-commerce/iro/TextualIROItemUpdater.js +1 -1
  5. package/dist/cjs/src/components/logistics/vendor/EditVendorForm.js +1 -1
  6. package/dist/cjs/src/components/logistics/vendor/VendorDisplay.js +1 -1
  7. package/dist/cjs/src/data/actions/e-commerce/iro/requestRmaAction.js +1 -1
  8. package/dist/cjs/src/data/loaders/e-commerce/getAllOpos.js +1 -1
  9. package/dist/cjs/src/data/loaders/e-commerce/getSingleOpo.js +1 -1
  10. package/dist/cjs/src/data/loaders/e-commerce/iros/getSingleIro.js +1 -1
  11. package/dist/cjs/tsconfig.build.tsbuildinfo +1 -1
  12. package/dist/esm/src/components/ContactForm.js +1 -0
  13. package/dist/esm/src/components/common/Contacts.js +2 -2
  14. package/dist/esm/src/components/e-commerce/iro/RmaForm.js +7 -11
  15. package/dist/esm/src/components/e-commerce/iro/TextualIROItemUpdater.js +6 -5
  16. package/dist/esm/src/components/e-commerce/iro/TextualManageIROForm.js +4 -4
  17. package/dist/esm/src/components/logistics/vendor/EditVendorForm.js +5 -6
  18. package/dist/esm/src/components/logistics/vendor/VendorDisplay.js +1 -1
  19. package/dist/esm/src/data/actions/e-commerce/iro/requestRmaAction.js +3 -1
  20. package/dist/esm/src/data/loaders/e-commerce/getAllOpos.js +1 -1
  21. package/dist/esm/src/data/loaders/e-commerce/getSingleOpo.js +1 -3
  22. package/dist/esm/src/data/loaders/e-commerce/iros/getAllIros.js +8 -0
  23. package/dist/esm/src/data/loaders/e-commerce/iros/getSingleIro.js +5 -5
  24. package/dist/esm/tsconfig.build.tsbuildinfo +1 -1
  25. package/dist/esm/types/components/e-commerce/iro/TextualIROItemUpdater.d.ts +2 -2
  26. package/dist/esm/types/components/e-commerce/iro/TextualManageIROForm.d.ts +1 -1
  27. package/dist/esm/types/data/loaders/e-commerce/getAllOpos.d.ts +1 -1
  28. package/dist/esm/types/data/loaders/e-commerce/iros/getAllIros.d.ts +8 -0
  29. package/dist/esm/types/data/loaders/e-commerce/iros/getSingleIro.d.ts +1 -1
  30. package/dist/esm/types/types/e-commerce/iro/types.d.ts +1 -1
  31. package/dist/esm/types/types/logistics/Vendor.d.ts +2 -6
  32. package/package.json +1 -1
@@ -87,6 +87,7 @@ function ContactForm({ data }) {
87
87
  },
88
88
  method: "POST",
89
89
  });
90
+ console.log("Response from sendgrid:", res);
90
91
  if (res.ok) {
91
92
  setShowSuccessMessage(true);
92
93
  setShowFailureMessage(false);
@@ -18,8 +18,8 @@ import { Delete } from '@mui/icons-material';
18
18
  function Contacts({ data, }) {
19
19
  const { documentId, first_name, last_name, email, phone_number, type, onClick, } = data;
20
20
  return (jsx(Stack, { children: jsxs(Stack, { spacing: 2, direction: "row", children: [jsx(AccountCircleIcon, {}), jsxs(Stack, { children: [jsxs(Typography, { children: [first_name, " ", last_name] }), jsx(Typography, { children: email }), jsx(Typography, { children: phone_number }), jsx(Typography, { children: type }), onClick && (jsx(Button, { onClick: (e) => {
21
- if (documentId) {
22
- onClick(e, documentId);
21
+ if (first_name) {
22
+ onClick(e, first_name); // TODO need fixing!!
23
23
  }
24
24
  }, children: "Edit" }))] })] }) }));
25
25
  }
@@ -52,8 +52,8 @@ const ItemLines = ({ items, itemsToReturn, setItemsToReturn, selectedItems, setS
52
52
  if (items) {
53
53
  setItemsToReturn(items.map((item) => {
54
54
  return {
55
- line_item_number: item.line_item_number,
56
- product: item.product,
55
+ line_item_number: item.line_item_number || "", // Handle undefined
56
+ product: item.product?.documentId || "", // Extract string ID from Product object
57
57
  ordered_quantity: item.ordered_quantity,
58
58
  returned_quantity: 0,
59
59
  reason: "damaged",
@@ -64,12 +64,10 @@ const ItemLines = ({ items, itemsToReturn, setItemsToReturn, selectedItems, setS
64
64
  }, [items]);
65
65
  const [parsedItems, setParsedItems] = useState([]);
66
66
  const parseItems = (items) => {
67
- return itemsToReturn.map((item, index) => {
67
+ return items.map((item, index) => {
68
68
  return {
69
69
  line_item_number: `${index + 1}.0.0`,
70
- product: typeof item.product === "object" && "documentId" in item.product
71
- ? item.product.documentId
72
- : "",
70
+ product: item.product,
73
71
  returned_quantity: item.returned_quantity,
74
72
  reason: item.reason,
75
73
  other_reason: item.other_reason || "",
@@ -78,7 +76,7 @@ const ItemLines = ({ items, itemsToReturn, setItemsToReturn, selectedItems, setS
78
76
  };
79
77
  useEffect(() => {
80
78
  if (itemsToReturn) {
81
- setParsedItems(parseItems());
79
+ setParsedItems(parseItems(itemsToReturn));
82
80
  }
83
81
  }, [itemsToReturn]);
84
82
  return (jsx(Suspense, { fallback: jsx("div", { children: "Loading..." }), children: jsxs(Stack, { spacing: 2, children: [jsx(Typography, { variant: "h6", children: "Items" }), jsx(Typography, { variant: "body1", children: "from the items in the original order please select the items you'd like to return" }), jsx("input", { type: "hidden", name: "iro_items", value: JSON.stringify(parsedItems) }), jsx(Stack, { spacing: 1, children: items.map((item, index) => (jsxs(Fragment, { children: [jsxs(Stack, { spacing: 1, direction: "row", alignItems: "center", children: [jsx(Checkbox, { checked: selectedItems.includes(index), onChange: (e) => {
@@ -108,9 +106,7 @@ const ItemLines = ({ items, itemsToReturn, setItemsToReturn, selectedItems, setS
108
106
  };
109
107
  const ConfirmRMADialog = ({ open, onClose, items, formState, submitCallback, }) => {
110
108
  const [missingConfirmations, setMissingConfirmations] = useState(true);
111
- return (jsxs(Dialog, { open: open, onClose: onClose, children: [jsx(DialogTitle, { children: "Confirm RMA" }), jsxs(DialogContent, { children: [jsx(DialogContentText, { children: "Summary of items to be returned:" }), jsx(List, { children: items.map((item, index) => (jsxs(ListItem, { children: [typeof item.product === "object"
112
- ? `${item?.product?.product_number} ${item?.product?.title}`
113
- : `Product with ID ${item.product}`, " ", "- Quantity: ", item.returned_quantity] }, index))) }), jsx(DialogContentText, { children: "Are you sure you want to request a return merchandise authorization for these items?" }), jsx(Checkbox, { onChange: (e) => setMissingConfirmations(!e.target.checked) }), jsx(Typography, { variant: "body1", children: "I confirm that the information I have provided is accurate and truthful. I understand that providing false or misleading information about the reason for returning goods may result in additional costs being charged to me. By checking this box, I acknowledge my legal responsibility for the accuracy of my declaration." })] }), jsxs(DialogActions, { children: [submitCallback ? (jsx(SubmitButton, { text: "Yes", loadingText: "Loading...", disabled: missingConfirmations, onClick: submitCallback })) : (jsx(SubmitButton, { text: "Yes", loadingText: "Loading...", disabled: missingConfirmations })), jsx(Button, { onClick: onClose, children: "No" }), formState?.strapiErrors !== null && (jsx(StrapiErrors, { error: formState?.strapiErrors })), formState?.message && (jsx(Alert, { severity: "error", children: formState?.message }))] })] }));
109
+ return (jsxs(Dialog, { open: open, onClose: onClose, children: [jsx(DialogTitle, { children: "Confirm RMA" }), jsxs(DialogContent, { children: [jsx(DialogContentText, { children: "Summary of items to be returned:" }), jsx(List, { children: items.map((item, index) => (jsx(ListItem, { children: `Product with ID ${item.product} - Quantity: ${item.returned_quantity}` }, index))) }), jsx(DialogContentText, { children: "Are you sure you want to request a return merchandise authorization for these items?" }), jsx(Checkbox, { onChange: (e) => setMissingConfirmations(!e.target.checked) }), jsx(Typography, { variant: "body1", children: "I confirm that the information I have provided is accurate and truthful. I understand that providing false or misleading information about the reason for returning goods may result in additional costs being charged to me. By checking this box, I acknowledge my legal responsibility for the accuracy of my declaration." })] }), jsxs(DialogActions, { children: [submitCallback ? (jsx(SubmitButton, { text: "Yes", loadingText: "Loading...", disabled: missingConfirmations, onClick: submitCallback })) : (jsx(SubmitButton, { text: "Yes", loadingText: "Loading...", disabled: missingConfirmations })), jsx(Button, { onClick: onClose, children: "No" }), formState?.strapiErrors !== null && (jsx(StrapiErrors, { error: formState?.strapiErrors })), formState?.message && (jsx(Alert, { severity: "error", children: formState?.message }))] })] }));
114
110
  };
115
111
  /* INFO Request RMA Return Merchandise Authorization for customers*/
116
112
  function RmaForm({ opo, sx, revalidateCallback, handleClose, }) {
@@ -143,7 +139,7 @@ function RmaForm({ opo, sx, revalidateCallback, handleClose, }) {
143
139
  });
144
140
  }
145
141
  }, [formState?.strapiErrors]);
146
- return (jsx(Box, { sx: [...(Array.isArray(sx) ? sx : [sx])], children: jsx("form", { action: formAction, children: jsxs(Grid, { container: true, spacing: 2, children: [jsx(Grid, { item: true, xs: 12, children: jsx(Typography, { variant: "h6", children: "RMA Form" }) }), jsx("input", { type: "hidden", name: "opos", value: JSON.stringify([opo.documentId]) }), jsx(Grid, { item: true, xs: 12, children: jsxs(Stack, { spacing: 2, children: [jsx(Typography, { variant: "body1", children: "Please fill out the form below to request a return merchandise authorization. Due to the sensitive nature of the products, only unopened packages can be returned." }), jsx(Alert, { severity: "warning", children: "We urge you to carefully photograph the items you are returning. These pictures can be requested at a later time by our team to verify the condition of the items." })] }) }), jsx(Grid, { item: true, xs: 12, children: opo.opo_items ? (jsx(Stack, { spacing: 1, children: opo.opo_items && (jsx(ItemLines, { items: opo.opo_items, itemsToReturn: itemsToReturn, setItemsToReturn: setItemsToReturn, selectedItems: selectedItems, setSelectedItems: setSelectedItems })) })) : (jsx(Typography, { variant: "body1", children: "No items" })) }), jsx(ConfirmRMADialog, { formState: formState, open: open, items: itemsToReturn.filter((item) => item.returned_quantity > 0), onClose: () => setOpen(!open), submitCallback: () => {
142
+ return (jsx(Box, { sx: [...(Array.isArray(sx) ? sx : [sx])], children: jsx("form", { action: formAction, children: jsxs(Grid, { container: true, spacing: 2, children: [jsx(Grid, { item: true, xs: 12, children: jsx(Typography, { variant: "h6", children: "RMA Form" }) }), jsx("input", { type: "hidden", name: "opos", value: opo.documentId }), jsx(Grid, { item: true, xs: 12, children: jsxs(Stack, { spacing: 2, children: [jsx(Typography, { variant: "body1", children: "Please fill out the form below to request a return merchandise authorization. Due to the sensitive nature of the products, only unopened packages can be returned." }), jsx(Alert, { severity: "warning", children: "We urge you to carefully photograph the items you are returning. These pictures can be requested at a later time by our team to verify the condition of the items." })] }) }), jsx(Grid, { item: true, xs: 12, children: opo.opo_items ? (jsx(Stack, { spacing: 1, children: opo.opo_items && (jsx(ItemLines, { items: opo.opo_items, itemsToReturn: itemsToReturn, setItemsToReturn: setItemsToReturn, selectedItems: selectedItems, setSelectedItems: setSelectedItems })) })) : (jsx(Typography, { variant: "body1", children: "No items" })) }), jsx(ConfirmRMADialog, { formState: formState, open: open, items: itemsToReturn.filter((item) => item.returned_quantity > 0), onClose: () => setOpen(!open), submitCallback: () => {
147
143
  console.log("submit callback");
148
144
  const formElement = document.querySelector("form");
149
145
  if (formElement) {
@@ -19,21 +19,22 @@ import PreReportsDisplay from '../../logistics/report/PreReportsDisplay.js';
19
19
  import SimpleReportFields from '../../logistics/report/SimpleReportFields.js';
20
20
  import Box from '@mui/material/Box';
21
21
 
22
- function TextualIROItemUpdater({ item, index, handleAddReport, handleUpdateQuantity, image, handleRemoveReportAtIndex, showing, }) {
22
+ function TextualIroItemUpdater({ item, index, handleAddReport, handleUpdateQuantity, image, handleRemoveReportAtIndex, showing, }) {
23
+ console.log("TextualIROItemUpdater", item);
23
24
  const { line_item_number, product, returned_quantity, received_quantity, registered_quantity, released_quantity, reports, reason, other_reason, } = item;
24
25
  const [open, setOpen] = useState(false);
25
26
  // these values where wrapped with useMemo before but that did not work well while updating values
26
- reports !== undefined && reports.length > 0
27
+ reports != null && reports.length > 0
27
28
  ? reports
28
29
  .filter((report) => report.type === "received")
29
30
  .reduce((a, b) => a + b.quantity, 0)
30
31
  : 0;
31
- const registered_reports_quantity = reports !== undefined && reports.length > 0
32
+ const registered_reports_quantity = reports != null && reports.length > 0
32
33
  ? reports
33
34
  .filter((report) => report.type === "registered")
34
35
  .reduce((a, b) => a + b.quantity, 0)
35
36
  : 0;
36
- reports !== undefined && reports.length > 0
37
+ reports != null && reports.length > 0
37
38
  ? reports
38
39
  .filter((report) => report.type === "released")
39
40
  .reduce((a, b) => a + b.quantity, 0)
@@ -54,4 +55,4 @@ function TextualIROItemUpdater({ item, index, handleAddReport, handleUpdateQuant
54
55
  } })] }))] })) }, index));
55
56
  }
56
57
 
57
- export { TextualIROItemUpdater as default };
58
+ export { TextualIroItemUpdater as default };
@@ -8,7 +8,7 @@ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
8
8
  import { useState, useEffect } from 'react';
9
9
  import { useFormState } from 'react-dom';
10
10
  import { updateIroAction } from '../../../data/actions/e-commerce/iro/updateIroAction.js';
11
- import TextualIROItemUpdater from './TextualIROItemUpdater.js';
11
+ import TextualIroItemUpdater from './TextualIROItemUpdater.js';
12
12
  import IroItemDisplay from './IroItemDisplay.js';
13
13
  import NotesDisplay from '../../logistics/note/NotesDisplay.js';
14
14
  import NoteTakingComponent from '../../logistics/note/NoteTakingComponent.js';
@@ -241,7 +241,7 @@ function CancelIroDialog({ open, handleClose, orderID, revalidateCallback, }) {
241
241
  };
242
242
  return (jsx("form", { children: jsxs(Dialog, { open: open, onClose: handleClose, children: [jsx(DialogTitle, { children: "Cancel Return" }), jsx(DialogContent, { children: jsxs(Stack, { spacing: 2, children: [jsx(Typography, { children: "Are you sure you want to cancel this return?" }), jsxs(List, { children: [jsx(ListItem, { children: "By cancelling this return order you will update it's status from requested to cancelled" }), jsx(ListItem, { children: "Please provide a reason for the cancellation" }), jsx(ListItem, { children: "The customer will be notified about the cancellation and of the reason for the cancellation" })] }), jsx(TextField, { label: "Cancellation reason", name: "reason", multiline: true, rows: 4, fullWidth: true, variant: "outlined", value: reason, onChange: (e) => setRoason(e.target.value), placeholder: "Please provide a reason for the cancellation", error: !!reasonError, helperText: reasonError })] }) }), jsxs(DialogActions, { children: [jsx(Button, { variant: "outlined", onClick: handleClose, children: "Close" }), jsx(Button, { variant: "contained", color: "error", onClick: handleCancel, children: "Confirm Cancellation" })] })] }) }));
243
243
  }
244
- function TextualManageIROForm({ data, sx,
244
+ function TextualManageIroForm({ data, sx,
245
245
  // revalidates the selectedOpo from the database
246
246
  revalidateCallback, handleClose, role, }) {
247
247
  // Bind documentId to the action
@@ -361,8 +361,8 @@ revalidateCallback, handleClose, role, }) {
361
361
  items.map((item, index) => {
362
362
  return (jsx(Paper, { sx: { p: 2, mb: 2 }, children: data.internal_status === "requested" ||
363
363
  data.internal_status === "cancelled" ||
364
- data.internal_status === "done" ? (jsx(IroItemDisplay, { item: item, index: index, image: item?.product?.image })) : (jsx(TextualIROItemUpdater, { item: item, index: index, handleUpdateQuantity: handleUpdateQuantity, handleAddReport: handleAddReport, image: item?.product?.image, handleRemoveReportAtIndex: handleRemoveReportAtIndex, revalidateCallback: revalidateCallback, showing: showing })) }, index));
364
+ data.internal_status === "done" ? (jsx(IroItemDisplay, { item: item, index: index, image: item?.product?.image })) : (jsx(TextualIroItemUpdater, { item: item, index: index, handleUpdateQuantity: handleUpdateQuantity, handleAddReport: handleAddReport, image: item?.product?.image, handleRemoveReportAtIndex: handleRemoveReportAtIndex, revalidateCallback: revalidateCallback, showing: showing })) }, index));
365
365
  }), jsxs(Stack, { direction: "row", justifyContent: "space-between", alignItems: "center", sx: { pt: 2 }, children: [handleClose && (jsx(Button, { onClick: handleClose, variant: "outlined", children: "Cancel" })), jsx(SubmitButton, { text: "Save changes", loadingText: "Saving...", variant: "contained" })] })] })] }) })] }) }));
366
366
  }
367
367
 
368
- export { TextualManageIROForm as default };
368
+ export { TextualManageIroForm as default };
@@ -37,7 +37,6 @@ const INITIAL_STATE = {
37
37
  };
38
38
  function EditVendorForm({ data, productNamesArr, revalidateCallback, handleClose, sx, }) {
39
39
  const { documentId, website_url, phone_number, email, business_credentials, address, products, contacts, notes, } = data;
40
- console.log("contacts", contacts);
41
40
  const [formState, formAction] = useFormState((prevState, formData) => updateVendorAction(documentId, prevState, formData), INITIAL_STATE);
42
41
  const { handleAddMessage } = useSnackbar();
43
42
  useEffect(() => {
@@ -60,7 +59,8 @@ function EditVendorForm({ data, productNamesArr, revalidateCallback, handleClose
60
59
  });
61
60
  }
62
61
  }, [formState?.strapiErrors]);
63
- const initialProducts = products?.data || [];
62
+ const initialProducts = products || [];
63
+ console.log("initialProducts", initialProducts);
64
64
  const [open, setOpen] = useState([]);
65
65
  const onClickHandler = (event, id) => {
66
66
  if (open.includes(id)) {
@@ -78,7 +78,6 @@ function EditVendorForm({ data, productNamesArr, revalidateCallback, handleClose
78
78
  });
79
79
  return acc;
80
80
  }, []));
81
- console.log("oldContacts", oldContacts);
82
81
  // INFO must utilize the uuid to ensure that the new contacts are unique
83
82
  // this is important to use both the deleteCallback and still not have problems with the key
84
83
  const [newContacts, setNewContacts] = useState([]);
@@ -89,8 +88,8 @@ function EditVendorForm({ data, productNamesArr, revalidateCallback, handleClose
89
88
  },
90
89
  ], revalidateCallback: revalidateCallback })] }) }), jsx(Grid, { item: true, xs: 12, children: jsx(ExplanatoryFoldOut, { title: "Vendor", description: "Vendors are businesses that you purchase products from." }) }), jsx(Grid, { item: true, xs: 12, md: 6, children: jsx(BusinessCredentialsFields, { data: business_credentials, componentName: "business_credentials", componentReference: "common.business-credentials" }) }), jsx(Grid, { item: true, xs: 12, md: 6, children: jsxs(Stack, { spacing: 2, children: [jsx(TextField, { id: "website_url", name: "website_url", label: "Website Url", defaultValue: website_url }), jsx(TextField, { id: "phone_number", name: "phone_number", label: "Phone Number", defaultValue: phone_number }), jsx(TextField, { id: "email", name: "email", label: "Email", defaultValue: email })] }) }), jsxs(Grid, { item: true, xs: 12, md: 6, children: [jsx(Typography, { variant: "h6", children: "Address" }), jsx(AddressFields, { data: address, componentName: "address", componentReference: "common.address" })] }), jsxs(Grid, { item: true, xs: 12, sx: { mt: 1 }, children: [jsx(Typography, { variant: "h6", children: "Products" }), jsx(ProductSelector, { productNames: productNamesArr, currentValue: initialProducts.map((prod) => prod.documentId) })] }), jsx(Grid, { item: true, xs: 12, sx: { mt: 1 }, children: jsx(Typography, { variant: "h6", children: "Contacts" }) }), oldContacts?.map((contact, index) => {
91
90
  console.log("contact", contact);
92
- if (contact.data?.documentId) {
93
- if (open.includes(contact.data?.documentId)) {
91
+ if (contact.data?.first_name) {
92
+ if (open.includes(contact.data?.first_name)) {
94
93
  return (jsx(Grid, { item: true, xs: 12, sm: 6, md: 4, lg: 3, sx: {
95
94
  justifyContent: "center",
96
95
  display: "flex",
@@ -175,7 +174,7 @@ function EditVendorForm({ data, productNamesArr, revalidateCallback, handleClose
175
174
  },
176
175
  },
177
176
  ]);
178
- }, size: "large", children: "Add contact" }) }) }), jsxs(Grid, { item: true, xs: 12, children: [jsx(Typography, { variant: "h6", children: "Notes" }), notes?.data !== undefined ? (jsx(NotesDisplay, { notes: notes.data })) : (jsx(Typography, { children: "No notes to display" }))] }), " ", jsx(Grid, { item: true, xs: 12, children: jsxs(Stack, { direction: "row", spacing: 2, justifyContent: "space-between", alignItems: "center", sx: { mt: 2 }, children: [handleClose && (jsx(Button, { onClick: handleClose, variant: "outlined", children: "Cancel" })), jsx(SubmitButton, { text: "Update Vendor", loadingText: "Updating..." })] }) })] }) }) }));
177
+ }, size: "large", children: "Add contact" }) }) }), jsxs(Grid, { item: true, xs: 12, children: [jsx(Typography, { variant: "h6", children: "Notes" }), Array.isArray(notes) && notes.length > 0 ? (jsx(NotesDisplay, { notes: notes })) : (jsx(Typography, { children: "No notes to display" }))] }), " ", jsx(Grid, { item: true, xs: 12, children: jsxs(Stack, { direction: "row", spacing: 2, justifyContent: "space-between", alignItems: "center", sx: { mt: 2 }, children: [handleClose && (jsx(Button, { onClick: handleClose, variant: "outlined", children: "Cancel" })), jsx(SubmitButton, { text: "Update Vendor", loadingText: "Updating..." })] }) })] }) }) }));
179
178
  }
180
179
 
181
180
  export { EditVendorForm };
@@ -24,7 +24,7 @@ function VendorDisplay({ data, sx }) {
24
24
  // You cannot spread `sx` directly because `SxProps` (typeof sx) can be an array.
25
25
  { p: 2 },
26
26
  ...(Array.isArray(sx) ? sx : [sx]),
27
- ], component: Paper, children: [jsxs(Grid, { container: true, spacing: 2, children: [jsx(Grid, { item: true, xs: 12, children: jsx(Typography, { variant: "h5", children: "Vendor" }) }), jsx(Grid, { item: true, xs: 12, md: 6, children: jsx(BusinessCredentials, { data: business_credentials }) }), jsxs(Grid, { item: true, xs: 12, md: 6, children: [jsxs(Typography, { variant: "body1", children: ["Website Url: ", website_url] }), jsxs(Typography, { variant: "body1", children: ["Phone Number: ", phone_number] }), jsxs(Typography, { variant: "body1", children: ["Email: ", email] })] }), jsxs(Grid, { item: true, xs: 12, md: 6, children: [jsx(Typography, { variant: "h6", children: "Address" }), jsx(Address, { data: address })] })] }), jsxs(Grid, { item: true, xs: 12, sx: { mt: 3 }, children: [jsx(Typography, { variant: "h6", children: "Products" }), jsx(ExplanatoryFoldOut, { title: "Products", sx: { mt: 1 }, children: jsx(Stack, { spacing: 1, children: products.data.map((product, index) => (jsx(Paper, { sx: { p: 1 }, children: jsxs(Stack, { direction: "row", justifyContent: "space-between", children: [jsxs(Typography, { variant: "h6", children: ["Product: ", product.title, " ", product.product_number] }), jsx(Price, { ...product.price })] }) }, index))) }) })] }), jsxs(Grid, { item: true, xs: 12, sx: { mt: 3 }, children: [jsx(Typography, { variant: "h6", children: "Contacts" }), jsx(ExplanatoryFoldOut, { title: "Contacts", sx: { mt: 1 }, children: jsx(Stack, { spacing: 1, children: contacts.map((contact, index) => (jsx(Paper, { sx: { p: 1 }, children: jsx(Contacts, { data: contact }) }, index))) }) })] })] }));
27
+ ], component: Paper, children: [jsxs(Grid, { container: true, spacing: 2, children: [jsx(Grid, { item: true, xs: 12, children: jsx(Typography, { variant: "h5", children: "Vendor" }) }), jsx(Grid, { item: true, xs: 12, md: 6, children: jsx(BusinessCredentials, { data: business_credentials }) }), jsxs(Grid, { item: true, xs: 12, md: 6, children: [jsxs(Typography, { variant: "body1", children: ["Website Url: ", website_url] }), jsxs(Typography, { variant: "body1", children: ["Phone Number: ", phone_number] }), jsxs(Typography, { variant: "body1", children: ["Email: ", email] })] }), jsxs(Grid, { item: true, xs: 12, md: 6, children: [jsx(Typography, { variant: "h6", children: "Address" }), jsx(Address, { data: address })] })] }), jsxs(Grid, { item: true, xs: 12, sx: { mt: 3 }, children: [jsx(Typography, { variant: "h6", children: "Products" }), jsx(ExplanatoryFoldOut, { title: "Products", sx: { mt: 1 }, children: jsx(Stack, { spacing: 1, children: products.map((product, index) => (jsx(Paper, { sx: { p: 1 }, children: jsxs(Stack, { direction: "row", justifyContent: "space-between", children: [jsxs(Typography, { variant: "h6", children: ["Product: ", product.title, " ", product.product_number] }), jsx(Price, { ...product.price })] }) }, index))) }) })] }), jsxs(Grid, { item: true, xs: 12, sx: { mt: 3 }, children: [jsx(Typography, { variant: "h6", children: "Contacts" }), jsx(ExplanatoryFoldOut, { title: "Contacts", sx: { mt: 1 }, children: jsx(Stack, { spacing: 1, children: contacts.map((contact, index) => (jsx(Paper, { sx: { p: 1 }, children: jsx(Contacts, { data: contact }) }, index))) }) })] })] }));
28
28
  }
29
29
 
30
30
  export { VendorDisplay };
@@ -16,10 +16,12 @@ async function requestRmaAction(prevState, formData) {
16
16
  Object.fromEntries(formData);
17
17
  const parsedFormData = parseFormData(formData);
18
18
  if (parsedFormData.data.iro_items) {
19
+ console.log("parsedFormData.data.iro_items", parsedFormData.data.iro_items);
19
20
  parsedFormData.data.iro_items = JSON.parse(parsedFormData.data.iro_items);
20
21
  }
21
22
  if (parsedFormData.data.opos) {
22
- parsedFormData.data.opos = JSON.parse(parsedFormData.data.opos);
23
+ console.log("parsedFormData.data.opos", parsedFormData.data.opos);
24
+ parsedFormData.data.opos = parsedFormData.data.opos;
23
25
  }
24
26
  const responseData = await mutateData("POST", `/api/iros`, parsedFormData);
25
27
  if (!responseData) {
@@ -25,7 +25,7 @@ const baseUrl = getStrapiURL();
25
25
  * @return A promise that resolves to the fetched OPO data
26
26
  * * @throws Will throw an error if the fetch fails
27
27
  */
28
- async function getAllOpos(currentPage, rowsPerPage, order, orderBy, is_archive = [false], // default to only non-archived OPOs
28
+ async function getAllOpos(currentPage, rowsPerPage, order, orderBy = "createdAt", is_archive = [false], // default to only non-archived OPOs
29
29
  filters = {}) {
30
30
  unstable_noStore();
31
31
  const user = await getUserRole();
@@ -32,9 +32,7 @@ async function getSingleOpo(documentId, filters = {}) {
32
32
  },
33
33
  },
34
34
  customer: {
35
- populate: {
36
- business_credentials: true,
37
- },
35
+ populate: ["business_credentials"],
38
36
  },
39
37
  notes: {
40
38
  populate: {
@@ -16,6 +16,14 @@ const baseUrl = getStrapiURL();
16
16
  /**
17
17
  * INFO Fetch all IROs
18
18
  * used by the IROs table in the admin panel
19
+ * @param currentPage - The current page number for pagination
20
+ * @param rowsPerPage - The number of rows per page for pagination
21
+ * @param order - The sort order (asc or desc)
22
+ * @param orderBy - The field to order by, defaults to "createdAt"
23
+ * @param is_archive - An array of booleans to filter by archived status, defaulting to only non-archived IROs
24
+ * @param filters - An object containing additional filters to apply
25
+ * @return A promise that resolves to the fetched IRO data
26
+ * * @throws Will throw an error if the fetch fails
19
27
  */
20
28
  async function getAllIros(currentPage, rowsPerPage, order, orderBy = "createdAt", is_archive = [false], // default to only non-archived OPOs
21
29
  filters = {}) {
@@ -8,10 +8,11 @@
8
8
  import qs from '../../../../../node_modules/qs/lib/index.js';
9
9
  import { fetchData } from '../../loaders.js';
10
10
  import { getStrapiURL } from '../../../../lib/utils.js';
11
+ import { unstable_noStore } from 'next/cache';
11
12
 
12
13
  const baseUrl = getStrapiURL();
13
- async function getSingleIro(documentId) {
14
- // noStore();
14
+ async function getSingleIro(documentId, filters = {}) {
15
+ unstable_noStore();
15
16
  const url = new URL(`/api/iros/${documentId}`, baseUrl);
16
17
  url.search = qs.stringify({
17
18
  populate: {
@@ -35,12 +36,11 @@ async function getSingleIro(documentId) {
35
36
  notes: {
36
37
  // should only be available to enduser and dispatcher
37
38
  populate: {
38
- author: {
39
- populate: true,
40
- },
39
+ author: true,
41
40
  },
42
41
  },
43
42
  },
43
+ filters: { ...filters },
44
44
  });
45
45
  return await fetchData(url.href);
46
46
  }