umwd-components 0.1.788 → 0.1.790

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 (27) hide show
  1. package/dist/cjs/src/components/common/media/minio/MinioDisplay.js +1 -1
  2. package/dist/cjs/src/components/logistics/ipo/AddIPOForm.js +1 -1
  3. package/dist/cjs/src/components/logistics/ipo/IPOItemFields.js +1 -1
  4. package/dist/cjs/src/data/actions/e-commerce/opo/createOpoAction.js +1 -1
  5. package/dist/cjs/src/data/actions/logistics/ipo/createIPOAction.js +1 -1
  6. package/dist/cjs/src/data/actions/media/minio/deleteMinioMediaAction.js +1 -1
  7. package/dist/cjs/src/data/actions/media/minio/uploadMinioMediaAction.js +1 -1
  8. package/dist/cjs/src/data/loaders/common/media/minio/getAllMinioMedia.js +1 -1
  9. package/dist/cjs/src/data/loaders/common/media/minio/getAllMinioReferences.js +1 -1
  10. package/dist/cjs/src/data/loaders/common/media/minio/getMinioSignedUrl.js +1 -1
  11. package/dist/cjs/src/data/loaders/logistics/getSingleIpo.js +1 -1
  12. package/dist/cjs/tsconfig.build.tsbuildinfo +1 -1
  13. package/dist/esm/src/components/common/media/minio/MinioDisplay.js +1 -1
  14. package/dist/esm/src/components/e-commerce/iro/RmaForm.js +0 -3
  15. package/dist/esm/src/components/logistics/ipo/AddIPOForm.js +5 -2
  16. package/dist/esm/src/components/logistics/ipo/IPOItemFields.js +4 -1
  17. package/dist/esm/src/data/actions/e-commerce/opo/createOpoAction.js +1 -0
  18. package/dist/esm/src/data/actions/logistics/ipo/createIPOAction.js +2 -0
  19. package/dist/esm/src/data/actions/media/minio/deleteMinioMediaAction.js +0 -1
  20. package/dist/esm/src/data/actions/media/minio/uploadMinioMediaAction.js +0 -30
  21. package/dist/esm/src/data/loaders/common/media/minio/getAllMinioMedia.js +0 -1
  22. package/dist/esm/src/data/loaders/common/media/minio/getAllMinioReferences.js +1 -9
  23. package/dist/esm/src/data/loaders/common/media/minio/getMinioSignedUrl.js +0 -2
  24. package/dist/esm/src/data/loaders/logistics/getSingleIpo.js +0 -1
  25. package/dist/esm/src/data/services/common/media/minio/minioDeleteService.js +0 -1
  26. package/dist/esm/tsconfig.build.tsbuildinfo +1 -1
  27. package/package.json +1 -1
@@ -16,7 +16,7 @@ import { MinioDeleteFormButton } from './MinioDeleteFormButton.js';
16
16
  * @returns MinioDisplay component
17
17
  */
18
18
  const MinioDisplay = ({ fileSize, mimeType, fileName, bucketName, direction = "column", revalidateCallback, }) => {
19
- return (jsxs(Stack, { direction: direction, spacing: 1, marginTop: 1, alignItems: direction === "column" ? "flex-start" : "center", children: [jsxs(Typography, { children: ["File: ", fileName] }), jsxs(Typography, { variant: "body2", color: "text.secondary", children: ["Size: ", fileSize, " bytes"] }), jsxs(Typography, { variant: "body2", color: "text.secondary", children: ["Type: ", mimeType] }), jsxs(Stack, { direction: "row", spacing: 2, alignItems: "center", justifyContent: "center", width: "min-content", children: [jsx(MinioDownloadButton, { bucketName: bucketName || "umwd", fileName: fileName || "" }), jsx(MinioDeleteFormButton, { bucketName: bucketName || "umwd", fileName: fileName || "", revalidateCallback: revalidateCallback })] })] }));
19
+ return (jsxs(Stack, { direction: direction, spacing: 1, marginTop: 1, alignItems: direction === "column" ? "flex-start" : "center", justifyContent: direction === "column" ? "flex-start" : "space-between", children: [jsxs(Typography, { children: ["File: ", fileName] }), jsxs(Typography, { variant: "body2", children: ["Size: ", fileSize, " bytes"] }), jsxs(Typography, { variant: "body2", children: ["Type: ", mimeType] }), jsxs(Stack, { direction: "row", spacing: 2, alignItems: "center", justifyContent: "center", width: "min-content", children: [jsx(MinioDownloadButton, { bucketName: bucketName || "umwd", fileName: fileName || "" }), jsx(MinioDeleteFormButton, { bucketName: bucketName || "umwd", fileName: fileName || "", revalidateCallback: revalidateCallback })] })] }));
20
20
  };
21
21
 
22
22
  export { MinioDisplay };
@@ -36,9 +36,6 @@ const INITIAL_STATE = {
36
36
  severity: null,
37
37
  };
38
38
  const ItemLines = ({ items, itemsToReturn, setItemsToReturn, selectedItems, setSelectedItems, }) => {
39
- // const [itemsToReturn, setItemsToReturn] = useState<NewIroItem[]>([]);
40
- // const [selectedItems, setSelectedItems] = useState<number[]>([]);
41
- // itemsToReturn, setItemsToReturn, selectedItems, setSelectedItems
42
39
  const [showCustomReason, setShowCustomReason] = useState(false);
43
40
  const updateItemsToReturn = (index, name, newValue) => {
44
41
  setItemsToReturn(itemsToReturn.map((item, i) => {
@@ -13,6 +13,7 @@ import TextField from '@mui/material/TextField';
13
13
  import Typography from '@mui/material/Typography';
14
14
  import Divider from '@mui/material/Divider';
15
15
  import Button from '@mui/material/Button';
16
+ import Checkbox from '@mui/material/Checkbox';
16
17
  import { SubmitButton } from '../../SubmitButton.js';
17
18
  import { createIPOAction } from '../../../data/actions/logistics/ipo/createIPOAction.js';
18
19
  import Grid from '@mui/material/Grid';
@@ -64,7 +65,9 @@ function AddIPOForm({ vendorNamesArr, sx, revalidateCallback, handleClose, }) {
64
65
  return;
65
66
  }
66
67
  const vendor = await getSingleVendor(selectedVendorID);
67
- setProductsArr(vendor?.products?.data);
68
+ console.log("vendor", vendor);
69
+ const vendorProducts = vendor?.products.filter((product) => !product.product_number.startsWith("r")) || [];
70
+ setProductsArr(vendorProducts);
68
71
  };
69
72
  return (jsx(Box, { sx: [
70
73
  // You cannot spread `sx` directly because `SxProps` (typeof sx) can be an array.
@@ -72,7 +75,7 @@ function AddIPOForm({ vendorNamesArr, sx, revalidateCallback, handleClose, }) {
72
75
  ], children: jsx("form", { action: formAction, children: jsxs(Grid, { container: true, spacing: 2, children: [jsx(Grid, { size: 12, children: jsxs(Stack, { spacing: 2, children: [jsx(Typography, { variant: "h3", component: "h1", children: "Add IPO" }), jsx(Typography, { variant: "body1", children: "Create a new incoming purchase order" })] }) }), jsx(Grid, { sx: { mt: 1 }, size: {
73
76
  xs: 12,
74
77
  md: 6,
75
- }, children: vendorNamesArr ? (jsx(VendorSelector, { vendorNames: vendorNamesArr, currentValue: null, onSelectVendor: handleVendorSelect })) : (jsx(Typography, { children: "No vendors on file, you need to create a vendor first before you are able to create incoming purchase orders" })) }), jsx(Grid, { size: 12, children: jsxs(Stack, { spacing: 2, children: [jsx(Typography, { variant: "h5", children: "Order Details" }), jsx(Typography, { variant: "body1", children: "The orderdate should be the official date of the order, don't worry, you can also set days in the past or future" }), jsx(LocalizationProvider, { dateAdapter: AdapterDayjs, children: jsx(DatePicker, { name: "order_date", label: "Order Date" }) }), jsx(Typography, { variant: "body1", children: "Please enter a custom reference for this order" }), jsx(TextField, { id: "customer_reference", name: "customer_reference", type: "text", label: "Custom Reference" }), jsx(Divider, {})] }) }), jsx(Grid, { size: 12, children: jsx(IPOItemFields, { productsArr: productsArr, vendorID: vendorID }) }), jsx(Grid, { size: 12, children: jsxs(Stack, { direction: "row", justifyContent: "space-between", alignItems: "center", sx: { mt: 2 }, children: [handleClose && (jsx(Button, { onClick: handleClose, variant: "outlined", children: "Cancel" })), jsx(SubmitButton, { text: "Create IPO", loadingText: "Creating...", variant: "contained" })] }) })] }) }) }));
78
+ }, children: vendorNamesArr ? (jsx(VendorSelector, { vendorNames: vendorNamesArr, currentValue: null, onSelectVendor: handleVendorSelect })) : (jsx(Typography, { children: "No vendors on file, you need to create a vendor first before you are able to create incoming purchase orders" })) }), jsx(Grid, { size: 12, children: jsxs(Stack, { spacing: 2, children: [jsx(Typography, { variant: "h5", children: "Order Details" }), jsx(Typography, { variant: "body1", children: "The orderdate should be the official date of the order, don't worry, you can also set days in the past or future" }), jsx(LocalizationProvider, { dateAdapter: AdapterDayjs, children: jsx(DatePicker, { name: "order_date", label: "Order Date" }) }), jsx(Typography, { variant: "body1", children: "Please enter a custom reference for this order" }), jsx(TextField, { id: "customer_reference", name: "customer_reference", type: "text", label: "Custom Reference" }), jsx(Divider, {})] }) }), jsx(Grid, { size: 12, children: jsx(IPOItemFields, { productsArr: productsArr, vendorID: vendorID }) }), jsxs(Grid, { size: 12, children: [jsx(Checkbox, { name: "confirmation", defaultChecked: true }), jsx(Typography, { variant: "body2", children: "I confirm that the information provided is accurate to the best of my knowledge and like to confirm immediately." })] }), jsx(Grid, { size: 12, children: jsxs(Stack, { direction: "row", justifyContent: "space-between", alignItems: "center", sx: { mt: 2 }, children: [handleClose && (jsx(Button, { onClick: handleClose, variant: "outlined", children: "Cancel" })), jsx(SubmitButton, { text: "Create IPO", loadingText: "Creating...", variant: "contained", disabled: vendorID === null })] }) })] }) }) }));
76
79
  }
77
80
 
78
81
  export { AddIPOForm };
@@ -118,7 +118,10 @@ function IPOItemFields({ productsArr, vendorID = null, }) {
118
118
  setNextAmount(parseInt(e.target.value));
119
119
  }, disabled: vendorID === null, sx: { width: "15%" } }), jsx(WeekPicker, { value: nextPDW, onChangeCallback: (date) => {
120
120
  setNextPDW(date);
121
- }, label: "Preferred delivery week", disabled: false }), jsx(IconButton, { disabled: vendorID === null, onClick: handleAddItem, children: jsx(AddIcon, {}) })] })] }));
121
+ }, label: "Preferred delivery week", disabled: false }), jsx(IconButton, { disabled: vendorID === null ||
122
+ nextAmount === 0 ||
123
+ nextPDW === null ||
124
+ nextProductName === null, onClick: handleAddItem, children: jsx(AddIcon, {}) })] })] }));
122
125
  }
123
126
 
124
127
  export { IPOItemFields };
@@ -16,6 +16,7 @@ import { parseFormData } from '../../../../lib/parseFormData.js';
16
16
  async function createOpoAction(prevState, formData) {
17
17
  Object.fromEntries(formData);
18
18
  const parsedFormData = parseFormData(formData);
19
+ console.log("createOpoAction parsedFormData", parsedFormData);
19
20
  const responseData = await mutateData("POST", `/api/opos/createAdmin`, parsedFormData);
20
21
  if (!responseData) {
21
22
  return {
@@ -12,6 +12,7 @@ import dayjs from '../../../../../node_modules/dayjs/dayjs.min.js';
12
12
 
13
13
  async function createIPOAction(prevState, formData) {
14
14
  const parsedFormData = parseFormData(formData);
15
+ console.log("createIPOAction parsedFormData", parsedFormData);
15
16
  if (!parsedFormData.data.order_date) {
16
17
  return {
17
18
  ...prevState,
@@ -26,6 +27,7 @@ async function createIPOAction(prevState, formData) {
26
27
  customer_reference: parsedFormData.data.customer_reference,
27
28
  order_date: dayjs(parsedFormData.data.order_date).format("YYYY-MM-DD"),
28
29
  items: parsedFormData.data.ipo_items,
30
+ internal_status: parsedFormData.data.confirmation ? "ordered" : "placed",
29
31
  },
30
32
  };
31
33
  const items = JSON.parse(parsedFormData.data.ipo_items);
@@ -8,7 +8,6 @@ import { minioDeleteService } from '../../../services/common/media/minio/minioDe
8
8
  import { flattenAttributes } from '../../../../lib/utils.js';
9
9
 
10
10
  async function deleteMinioMediaAction(bucketName, fileName, prevState) {
11
- console.log("bucketName:", bucketName, " fileName:", fileName, "prevState:", prevState);
12
11
  if (!bucketName || !fileName) {
13
12
  return {
14
13
  ...prevState,
@@ -7,34 +7,6 @@
7
7
  import { minioUploadService } from '../../../services/common/media/minio/minioUploadService.js';
8
8
  import { flattenAttributes } from '../../../../lib/utils.js';
9
9
 
10
- // VALIDATE FILES WITH ZOD
11
- /* const filesSchema = z.object({
12
- files: z
13
- .any()
14
- .refine((files) => {
15
- if (files instanceof FileList) {
16
- return Array.from(files).every(file => file.size > 0 && file.name !== undefined);
17
- }
18
- if (files instanceof File) {
19
- return files.size > 0 && files.name !== undefined;
20
- }
21
- return false;
22
- }, "Please select valid files.")
23
- .refine(
24
- (files) => {
25
- const fileArray = files instanceof FileList ? Array.from(files) : [files];
26
- return fileArray.every(file => ACCEPTED_FILE_TYPES.includes(file?.type));
27
- },
28
- "Invalid file types selected."
29
- )
30
- .refine(
31
- (files) => {
32
- const fileArray = files instanceof FileList ? Array.from(files) : [files];
33
- return fileArray.every(file => file.size <= MAX_FILE_SIZE);
34
- },
35
- `Max file size is 5MB.`
36
- ),
37
- }); */
38
10
  async function uploadMinioMediaAction(prevState, formData) {
39
11
  try {
40
12
  // CONVERT FORM DATA TO OBJECT
@@ -55,7 +27,6 @@ async function uploadMinioMediaAction(prevState, formData) {
55
27
  severity: "error",
56
28
  };
57
29
  }
58
- console.log(`Uploading ${validFiles.length} file(s):`);
59
30
  // Prepare files data for upload
60
31
  const filesData = [];
61
32
  for (const file of validFiles) {
@@ -65,7 +36,6 @@ async function uploadMinioMediaAction(prevState, formData) {
65
36
  fileName: file.name,
66
37
  fileContent: fileContent,
67
38
  });
68
- console.log("Prepared file:", file.name, "Size:", Math.round(fileContent.length / 1024 / 1024), "MB");
69
39
  }
70
40
  // UPLOAD ALL FILES TO MINIO
71
41
  const fileUploadResponse = await minioUploadService(bucketName, filesData, reference, refID, field);
@@ -10,7 +10,6 @@ import { getAuthToken } from '../../../../services/get-token.js';
10
10
 
11
11
  const baseUrl = getStrapiURL();
12
12
  async function getAllMinioMedia(bucketName) {
13
- console.log("minio bucket:", bucketName);
14
13
  const authToken = await getAuthToken();
15
14
  const headers = {
16
15
  method: "POST",
@@ -10,25 +10,17 @@ import { getAuthToken } from '../../../../services/get-token.js';
10
10
 
11
11
  const baseUrl = getStrapiURL();
12
12
  async function getAllMinioReferences(bucketName) {
13
- console.log("minio bucket:", bucketName);
14
13
  const authToken = await getAuthToken();
15
14
  const headers = {
16
- method: "POST",
15
+ method: "GET",
17
16
  headers: {
18
17
  "Content-Type": "application/json",
19
18
  Authorization: `Bearer ${authToken}`,
20
19
  },
21
- body: JSON.stringify({
22
- bucketName: bucketName ? bucketName : "umwd", // Default bucket if none provided
23
- }),
24
20
  };
25
21
  const url = new URL("/api/minio-plugin/miniofilereference", baseUrl);
26
22
  try {
27
23
  const response = await fetch(url, authToken ? headers : {});
28
- if (!response.ok) {
29
- console.log("Response not ok:", response);
30
- throw new Error(`Error fetching fileList: ${response.statusText}`);
31
- }
32
24
  const data = await response.json();
33
25
  return flattenAttributes(data);
34
26
  }
@@ -10,8 +10,6 @@ import { getAuthToken } from '../../../../services/get-token.js';
10
10
 
11
11
  const baseUrl = getStrapiURL();
12
12
  async function getMinioSignedUrl(bucketName, fileName) {
13
- console.log("minio bucket:", bucketName);
14
- console.log("minio fileName:", fileName);
15
13
  if (!bucketName || !fileName) {
16
14
  throw new Error("Bucket name and file name are required");
17
15
  }
@@ -49,7 +49,6 @@ async function getSingleIpo(documentId) {
49
49
  },
50
50
  });
51
51
  const responseData = await fetchData(url.href);
52
- console.log("Raw IPO data:", responseData);
53
52
  return responseData;
54
53
  }
55
54
 
@@ -21,7 +21,6 @@ async function minioDeleteService(bucketName, fileName) {
21
21
  headers: { Authorization: `Bearer ${authToken}` },
22
22
  method: "DELETE",
23
23
  });
24
- //console.log(response);
25
24
  const dataResponse = await response.json();
26
25
  return dataResponse;
27
26
  }