umwd-components 0.1.792 → 0.1.793

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.
@@ -5,7 +5,7 @@
5
5
  * @license MIT
6
6
  */
7
7
 
8
- import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
8
+ import { jsxs, jsx } from 'react/jsx-runtime';
9
9
  import { useActionState, useEffect } from 'react';
10
10
  import Paper from '@mui/material/Paper';
11
11
  import Box from '@mui/material/Box';
@@ -35,7 +35,7 @@ const INITIAL_STATE = {
35
35
  severity: null,
36
36
  };
37
37
  function EditStockForm({ data, revalidateCallback, handleClose, sx, }) {
38
- const { documentId, title, product_number, stock, ipos, opos, reports } = data;
38
+ const { documentId, title, product_number, stock, ipos, opos, opoItems, reports, } = data;
39
39
  const { handleAddMessage } = useSnackbar();
40
40
  // Bind the documentId to the form action following form patterns
41
41
  const boundAction = updateProductAction.bind(null, documentId);
@@ -60,10 +60,10 @@ function EditStockForm({ data, revalidateCallback, handleClose, sx, }) {
60
60
  });
61
61
  }
62
62
  }, [formState?.strapiErrors, handleAddMessage]);
63
- return (jsxs(Box, { sx: [...(Array.isArray(sx) ? sx : [sx])], children: [jsxs(Grid, { container: true, spacing: 2, children: [jsx(Grid, { size: 12, children: jsx(Typography, { variant: "h6", children: title }) }), jsx(Grid, { size: 12, children: jsxs(TableContainer, { component: Paper, children: [jsx(Typography, { variant: "h6", sx: { pl: 2 }, children: "Incoming orders" }), jsxs(Table, { size: "small", children: [jsx(TableHead, { children: jsxs(TableRow, { children: [jsx(TableCell, { children: "Number" }), jsx(TableCell, { children: "Order Date" }), jsx(TableCell, { children: "Line Item Number" }), jsx(TableCell, { children: "Ordered Quantity" }), jsx(TableCell, { children: "Received Quantity" }), jsx(TableCell, { children: "Registered Quantity" }), jsx(TableCell, { children: "Released Quantity" })] }) }), jsx(TableBody, { children: Array.isArray(ipos) ? (ipos.map((ipo) => (jsx(Fragment, { children: ipo.items.map((item) => (jsxs(TableRow, { children: [jsx(TableCell, { children: ipo.ipo_number }), jsx(TableCell, { children: ipo.order_date }), jsx(TableCell, { children: item.line_item_number }), jsx(TableCell, { children: jsx(AmountIndicator, { value: item.ordered_quantity, maxValue: item.ordered_quantity, color: "primary" }) }), jsx(TableCell, { children: jsx(AmountIndicator, { value: item.received_quantity, maxValue: item.ordered_quantity, color: "primary" }) }), jsx(TableCell, { children: jsx(AmountIndicator, { value: item.registered_quantity, maxValue: item.ordered_quantity, color: "primary" }) }), jsx(TableCell, { children: jsx(AmountIndicator, { value: item.released_quantity, maxValue: item.ordered_quantity, color: "primary" }) })] }, ipo.documentId))) })))) : (jsx(TableRow, { children: jsx(TableCell, { colSpan: 7, align: "center", children: "No incoming orders found." }) })) }), jsx(TableFooter, { children: jsxs(TableRow, { children: [jsx(TableCell, { colSpan: 6, align: "right", children: "Total added to stock:" }), jsx(TableCell, { children: Array.isArray(ipos)
63
+ return (jsxs(Box, { sx: [...(Array.isArray(sx) ? sx : [sx])], children: [jsxs(Grid, { container: true, spacing: 2, children: [jsx(Grid, { size: 12, children: jsx(Typography, { variant: "h6", children: title }) }), jsx(Grid, { size: 12, children: jsxs(TableContainer, { component: Paper, children: [jsx(Typography, { variant: "h6", sx: { pl: 2 }, children: "Incoming orders" }), jsxs(Table, { size: "small", children: [jsx(TableHead, { children: jsxs(TableRow, { children: [jsx(TableCell, { children: "Number" }), jsx(TableCell, { children: "Order Date" }), jsx(TableCell, { children: "Line Item Number" }), jsx(TableCell, { children: "Ordered Quantity" }), jsx(TableCell, { children: "Received Quantity" }), jsx(TableCell, { children: "Registered Quantity" }), jsx(TableCell, { children: "Released Quantity" })] }) }), jsx(TableBody, { children: Array.isArray(ipos) ? (ipos.map((ipo) => ipo.items.map((item) => (jsxs(TableRow, { children: [jsx(TableCell, { children: ipo.ipo_number }), jsx(TableCell, { children: ipo.order_date }), jsx(TableCell, { children: item.line_item_number }), jsx(TableCell, { children: jsx(AmountIndicator, { value: item.ordered_quantity, maxValue: item.ordered_quantity, color: "primary" }) }), jsx(TableCell, { children: jsx(AmountIndicator, { value: item.received_quantity, maxValue: item.ordered_quantity, color: "primary" }) }), jsx(TableCell, { children: jsx(AmountIndicator, { value: item.registered_quantity, maxValue: item.ordered_quantity, color: "primary" }) }), jsx(TableCell, { children: jsx(AmountIndicator, { value: item.released_quantity, maxValue: item.ordered_quantity, color: "primary" }) })] }, ipo.documentId))))) : (jsx(TableRow, { children: jsx(TableCell, { colSpan: 7, align: "center", children: "No incoming orders found." }) })) }), jsx(TableFooter, { children: jsxs(TableRow, { children: [jsx(TableCell, { colSpan: 6, align: "right", children: "Total added to stock:" }), jsx(TableCell, { children: Array.isArray(ipos)
64
64
  ? ipos.reduce((total, ipo) => total +
65
65
  ipo.items.reduce((itemTotal, item) => itemTotal + item.released_quantity, 0), 0)
66
- : 0 })] }) })] }), jsx(Typography, { variant: "h6", sx: { pl: 2 }, children: "Outgoing orders" }), jsxs(Table, { size: "small", children: [jsx(TableHead, { children: jsxs(TableRow, { children: [jsx(TableCell, { children: "Number" }), jsx(TableCell, { children: "Order Date" }), jsx(TableCell, { children: "Line Item Number" }), jsx(TableCell, { children: "Ordered Quantity" }), jsx(TableCell, { children: "Picked Quantity" }), jsx(TableCell, { children: "Packed Quantity" }), jsx(TableCell, { children: "Shipped Quantity" })] }) }), jsx(TableBody, { children: Array.isArray(opos) ? (opos.map((opo) => (jsx(Fragment, { children: opo.opo_items.map((item) => (jsxs(TableRow, { children: [jsx(TableCell, { children: opo.opo_number }), jsx(TableCell, { children: opo.order_date }), jsx(TableCell, { children: item.line_item_number }), jsx(TableCell, { children: jsx(AmountIndicator, { value: item.ordered_quantity, maxValue: item.ordered_quantity, color: "primary" }) }), jsx(TableCell, { children: jsx(AmountIndicator, { value: item.picked_quantity, maxValue: item.ordered_quantity, color: "primary" }) }), jsx(TableCell, { children: jsx(AmountIndicator, { value: item.packed_quantity, maxValue: item.ordered_quantity, color: "primary" }) }), jsx(TableCell, { children: jsx(AmountIndicator, { value: item.shipped_quantity, maxValue: item.ordered_quantity, color: "primary" }) })] }, opo.documentId))) })))) : (jsx(TableRow, { children: jsx(TableCell, { colSpan: 7, align: "center", children: "No outgoing orders found" }) })) }), jsx(TableFooter, { children: jsxs(TableRow, { children: [jsx(TableCell, { colSpan: 3, align: "right", children: "Total reduced from stock:" }), jsx(TableCell, { children: Array.isArray(opos)
66
+ : 0 })] }) })] }), jsx(Typography, { variant: "h6", sx: { pl: 2 }, children: "Outgoing orders" }), jsxs(Table, { size: "small", children: [jsx(TableHead, { children: jsxs(TableRow, { children: [jsx(TableCell, { children: "Number" }), jsx(TableCell, { children: "Order Date" }), jsx(TableCell, { children: "Line Item Number" }), jsx(TableCell, { children: "Ordered Quantity" }), jsx(TableCell, { children: "Picked Quantity" }), jsx(TableCell, { children: "Packed Quantity" }), jsx(TableCell, { children: "Shipped Quantity" })] }) }), jsx(TableBody, { children: Array.isArray(opos) ? (opos.map((opo) => opo.opo_items.map((item) => (jsxs(TableRow, { children: [jsx(TableCell, { children: opo.opo_number }), jsx(TableCell, { children: opo.order_date }), jsx(TableCell, { children: item.line_item_number }), jsx(TableCell, { children: jsx(AmountIndicator, { value: item.ordered_quantity, maxValue: item.ordered_quantity, color: "primary" }) }), jsx(TableCell, { children: jsx(AmountIndicator, { value: item.picked_quantity, maxValue: item.ordered_quantity, color: "primary" }) }), jsx(TableCell, { children: jsx(AmountIndicator, { value: item.packed_quantity, maxValue: item.ordered_quantity, color: "primary" }) }), jsx(TableCell, { children: jsx(AmountIndicator, { value: item.shipped_quantity, maxValue: item.ordered_quantity, color: "primary" }) })] }, opo.documentId))))) : (jsx(TableRow, { children: jsx(TableCell, { colSpan: 7, align: "center", children: "No outgoing orders found" }) })) }), jsx(TableFooter, { children: jsxs(TableRow, { children: [jsx(TableCell, { colSpan: 3, align: "right", children: "Total reduced from stock:" }), jsx(TableCell, { children: Array.isArray(opos)
67
67
  ? opos.reduce((total, opo) => total +
68
68
  opo.opo_items.reduce((itemTotal, item) => itemTotal + item.ordered_quantity, 0), 0)
69
69
  : 0 })] }) })] }), jsxs(Table, { size: "small", children: [jsxs(TableRow, { children: [jsx(TableCell, { align: "right", children: "Total added to stock:" }), jsx(TableCell, { children: Array.isArray(ipos) && ipos.length > 0
@@ -101,7 +101,7 @@ function PublicInformationForm({ publicInformation, sx, }) {
101
101
  componentName: `socials[${i + oldSocials.length}]`,
102
102
  };
103
103
  }));
104
- } }) }, social.data?.uuid));
104
+ } }) }, social.data?.uuid || index));
105
105
  }), jsx(Grid, { justifyContent: "center", alignItems: "center", size: {
106
106
  xs: 12,
107
107
  md: 6,
@@ -10,6 +10,7 @@ import { getStrapiURL } from '../../../lib/utils.js';
10
10
  import { unstable_noStore } from 'next/cache';
11
11
 
12
12
  const baseUrl = getStrapiURL();
13
+ // this returns an oversight of how the stock is by build up for a single product
13
14
  async function getSingleStock(documentId) {
14
15
  unstable_noStore();
15
16
  const url = new URL(`/api/products/getStock/${documentId}`, baseUrl);