umwd-components 0.1.785 → 0.1.787
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/dist/cjs/src/components/common/media/MediaGrid.js +1 -1
- package/dist/cjs/src/components/common/media/UploadMediaForm.js +1 -1
- package/dist/cjs/src/components/common/media/minio/MinioDisplay.js +1 -1
- package/dist/cjs/src/components/common/media/minio/MinioDownloadButton.js +1 -1
- package/dist/cjs/src/components/common/media/minio/MinioItemList.js +7 -0
- package/dist/cjs/src/components/common/media/minio/UploadMinioMediaForm.js +1 -1
- package/dist/cjs/src/components/e-commerce/iro/RmaForm.js +1 -1
- package/dist/cjs/src/components/e-commerce/iro/TextualManageIROForm.js +1 -1
- package/dist/cjs/src/components/logistics/ipo/TextualManageIPOForm.js +1 -1
- package/dist/cjs/src/data/loaders/common/media/minio/getAllMinioMedia.js +7 -0
- package/dist/cjs/src/data/loaders/common/media/minio/getAllMinioReferences.js +7 -0
- package/dist/cjs/src/data/services/common/media/minio/minioUploadService.js +1 -1
- package/dist/cjs/src/index.js +1 -1
- package/dist/cjs/tsconfig.build.tsbuildinfo +1 -1
- package/dist/esm/src/components/common/media/MediaGrid.js +1 -1
- package/dist/esm/src/components/common/media/UploadMediaForm.js +1 -1
- package/dist/esm/src/components/common/media/minio/MinioDisplay.js +7 -2
- package/dist/esm/src/components/common/media/minio/MinioDownloadButton.js +3 -2
- package/dist/esm/src/components/common/media/minio/MinioItemList.js +27 -0
- package/dist/esm/src/components/common/media/minio/UploadMinioMediaForm.js +3 -4
- package/dist/esm/src/components/e-commerce/iro/RmaForm.js +0 -1
- package/dist/esm/src/components/e-commerce/iro/TextualManageIROForm.js +2 -1
- package/dist/esm/src/components/logistics/ipo/TextualManageIPOForm.js +1 -1
- package/dist/esm/src/data/loaders/common/media/minio/getAllMinioMedia.js +37 -0
- package/dist/esm/src/data/loaders/common/media/minio/getAllMinioReferences.js +37 -0
- package/dist/esm/src/data/services/common/media/minio/minioUploadService.js +15 -9
- package/dist/esm/src/index.js +4 -0
- package/dist/esm/tsconfig.build.tsbuildinfo +1 -1
- package/dist/esm/types/components/common/media/minio/MinioDisplay.d.ts +7 -1
- package/dist/esm/types/components/common/media/minio/MinioItemList.d.ts +24 -0
- package/dist/esm/types/data/loaders/common/media/minio/getAllMinioReferences.d.ts +1 -0
- package/dist/esm/types/index.d.ts +4 -0
- package/dist/esm/types/types/e-commerce/iro/types.d.ts +5 -0
- package/package.json +1 -1
|
@@ -22,7 +22,7 @@ function MediaGrid({ mediaArray, selected = [], handleSelect, }) {
|
|
|
22
22
|
setOpenDialog(false);
|
|
23
23
|
openItem !== null && setOpenItem(null);
|
|
24
24
|
};
|
|
25
|
-
return (jsx(Grid, { container: true, spacing: 2,
|
|
25
|
+
return (jsx(Grid, { container: true, spacing: 2, children: mediaArray?.length > 0 &&
|
|
26
26
|
mediaArray.map((item, index) => {
|
|
27
27
|
return (jsxs(Fragment, { children: [jsx(EditMediaDialog, { open: openDialog && openItem === index, handleClose: handleClose, data: item }), jsx(Grid, { size: 3, children: jsx(MediaItem, { mediaItem: item, isSelected: selected.findIndex((select) => select.id === item.id) !== -1, onClick: handleSelect
|
|
28
28
|
? () => handleSelect(item)
|
|
@@ -33,7 +33,7 @@ function UploadMediaForm({ reference, refID, field, multiple = true, accept = "i
|
|
|
33
33
|
revalidateCallback?.();
|
|
34
34
|
}
|
|
35
35
|
}, [formState.data]);
|
|
36
|
-
return (jsx("form", { action: formAction, children: jsxs(Stack, { spacing:
|
|
36
|
+
return (jsx("form", { action: formAction, children: jsxs(Stack, { spacing: 2, sx: { flex: 1 }, children: [reference && (jsx("input", { type: "text", name: "ref", value: reference, style: { display: "none" }, readOnly: true })), refID && (jsx("input", { type: "text", name: "refId", value: refID, style: { display: "none" }, readOnly: true })), field && (jsx("input", { type: "text", name: "field", value: field, style: { display: "none" }, readOnly: true })), filePreviews !== null ? (jsx(Box, { onClick: () => fileInput.current?.click(), sx: {
|
|
37
37
|
p: 2,
|
|
38
38
|
width: "100%",
|
|
39
39
|
border: "1px dashed white",
|
|
@@ -10,8 +10,13 @@ import { Stack, Typography } from '@mui/material';
|
|
|
10
10
|
import { MinioDownloadButton } from './MinioDownloadButton.js';
|
|
11
11
|
import { MinioDeleteFormButton } from './MinioDeleteFormButton.js';
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
/**
|
|
14
|
+
* MinioDisplay component to show file information about a single minio file and actions such as download and delete.
|
|
15
|
+
* @param param0 - Props containing file information and actions
|
|
16
|
+
* @returns MinioDisplay component
|
|
17
|
+
*/
|
|
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 })] })] }));
|
|
15
20
|
};
|
|
16
21
|
|
|
17
22
|
export { MinioDisplay };
|
|
@@ -6,9 +6,10 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import { jsx } from 'react/jsx-runtime';
|
|
9
|
-
import {
|
|
9
|
+
import { IconButton } from '@mui/material';
|
|
10
10
|
import { getMinioSignedUrl } from '../../../../data/loaders/common/media/minio/getMinioSignedUrl.js';
|
|
11
11
|
import { downloadMinioItemClient } from '../../../../data/loaders/common/media/minio/downloadMinioItemClient.js';
|
|
12
|
+
import DownloadIcon from '@mui/icons-material/Download';
|
|
12
13
|
|
|
13
14
|
const MinioDownloadButton = ({ bucketName, fileName, }) => {
|
|
14
15
|
const handleDownload = async () => {
|
|
@@ -17,7 +18,7 @@ const MinioDownloadButton = ({ bucketName, fileName, }) => {
|
|
|
17
18
|
downloadMinioItemClient(signedUrl, fileName);
|
|
18
19
|
}
|
|
19
20
|
};
|
|
20
|
-
return (jsx(
|
|
21
|
+
return (jsx(IconButton, { onClick: handleDownload, children: jsx(DownloadIcon, {}) }));
|
|
21
22
|
};
|
|
22
23
|
|
|
23
24
|
export { MinioDownloadButton };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
/*
|
|
3
|
+
* UMWD-Components
|
|
4
|
+
* @copyright Jelle Paulus
|
|
5
|
+
* @license MIT
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { jsx } from 'react/jsx-runtime';
|
|
9
|
+
import { List, ListItem, ListItemText } from '@mui/material';
|
|
10
|
+
import { MinioDisplay } from './MinioDisplay.js';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* MinioItemList component to display a list of Minio file references
|
|
14
|
+
* @param items - Array of MinioFileReference objects
|
|
15
|
+
* @param emptyMessage - Message to display when no items are present
|
|
16
|
+
* @param bucketName - Default bucket name for files (defaults to "umwd")
|
|
17
|
+
* @param direction - Direction for MinioDisplay component (defaults to "row")
|
|
18
|
+
* @param revalidateCallback - Callback function to refresh data after actions
|
|
19
|
+
*/
|
|
20
|
+
const MinioItemList = ({ items, emptyMessage = "No attachments found.", bucketName = "umwd", direction = "row", revalidateCallback, }) => {
|
|
21
|
+
if (!items || items.length === 0) {
|
|
22
|
+
return (jsx(List, { children: jsx(ListItem, { children: jsx(ListItemText, { primary: emptyMessage }) }) }));
|
|
23
|
+
}
|
|
24
|
+
return (jsx(List, { children: items.map((item, index) => (jsx(ListItem, { children: jsx(MinioDisplay, { fileName: item.fileName, fileSize: item.fileSize, bucketName: item.bucketName || bucketName, mimeType: item.mimeType || "application/octet-stream", direction: direction, revalidateCallback: revalidateCallback }) }, item.documentId || index))) }));
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export { MinioItemList };
|
|
@@ -6,8 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
9
|
-
import { useState, useRef, useEffect } from 'react';
|
|
10
|
-
import { useFormState } from 'react-dom';
|
|
9
|
+
import { useState, useActionState, useRef, useEffect } from 'react';
|
|
11
10
|
import { uploadMinioMediaAction } from '../../../../data/actions/media/minio/uploadMinioMediaAction.js';
|
|
12
11
|
import { useSnackbar } from '../../../../context/common/SnackbarContext.js';
|
|
13
12
|
import { StrapiErrors } from '../../../StrapiErrors.js';
|
|
@@ -48,7 +47,7 @@ function UploadMinioMediaForm({ bucketName = process.env.MINIO_BUCKET_NAME || "u
|
|
|
48
47
|
], reference, refID, field, revalidateCallback, sx, handleClose, }) {
|
|
49
48
|
const [filePreviews, setFilePreviews] = useState(null);
|
|
50
49
|
const [fileList, setFileList] = useState(null);
|
|
51
|
-
const [formState, formAction] =
|
|
50
|
+
const [formState, formAction] = useActionState(uploadMinioMediaAction, INITIAL_STATE);
|
|
52
51
|
const fileInput = useRef(null);
|
|
53
52
|
const { handleAddMessage } = useSnackbar();
|
|
54
53
|
useEffect(() => {
|
|
@@ -98,7 +97,7 @@ function UploadMinioMediaForm({ bucketName = process.env.MINIO_BUCKET_NAME || "u
|
|
|
98
97
|
}
|
|
99
98
|
return false;
|
|
100
99
|
};
|
|
101
|
-
return (jsx(Box, { sx: [...(Array.isArray(sx) ? sx : [sx])], children: jsx("form", { action: formAction, children: jsxs(Grid, { container: true, spacing: 2, children: [
|
|
100
|
+
return (jsx(Box, { sx: [...(Array.isArray(sx) ? sx : [sx])], children: jsx("form", { action: formAction, children: jsxs(Grid, { container: true, spacing: 2, children: [jsxs(Grid, { size: { xs: 12 }, children: [reference && refID && field && (jsxs(Fragment, { children: [jsx("input", { type: "text", name: "reference", value: reference, style: { display: "none" }, readOnly: true }), jsx("input", { type: "text", name: "refID", value: refID, style: { display: "none" }, readOnly: true }), jsx("input", { type: "text", name: "field", value: field, style: { display: "none" }, readOnly: true })] })), bucketName && (jsx("input", { type: "text", name: "bucketName", value: bucketName, style: { display: "none" }, readOnly: true })), filePreviews !== null ? (jsx(Box, { onClick: () => fileInput.current?.click(), sx: {
|
|
102
101
|
p: 2,
|
|
103
102
|
width: "100%",
|
|
104
103
|
border: "1px dashed white",
|
|
@@ -26,7 +26,6 @@ import DialogContent from '@mui/material/DialogContent';
|
|
|
26
26
|
import DialogContentText from '@mui/material/DialogContentText';
|
|
27
27
|
import DialogTitle from '@mui/material/DialogTitle';
|
|
28
28
|
import NumberInput from '../../common/NumberInput.js';
|
|
29
|
-
import 'react-dom';
|
|
30
29
|
import 'next/headers';
|
|
31
30
|
|
|
32
31
|
const INITIAL_STATE = {
|
|
@@ -37,6 +37,7 @@ import { IroStatusIndicator } from './IroStatusIndicator.js';
|
|
|
37
37
|
import { queryAllProducts } from '../../../data/loaders/e-commerce/queryAllProducts.js';
|
|
38
38
|
import qs from '../../../../node_modules/qs/lib/index.js';
|
|
39
39
|
import { useSnackbar } from '../../../context/common/SnackbarContext.js';
|
|
40
|
+
import { MinioItemList } from '../../common/media/minio/MinioItemList.js';
|
|
40
41
|
|
|
41
42
|
const INITIAL_STATE = {
|
|
42
43
|
zodErrors: null,
|
|
@@ -344,7 +345,7 @@ revalidateCallback, handleClose, role, }) {
|
|
|
344
345
|
{ id: data.documentId, __type: "api::e-commerce.iro" },
|
|
345
346
|
], revalidateCallback: revalidateCallback })] }), jsx(Divider, {})] }) }), jsx(Grid, { size: 12, children: jsx(Typography, { variant: "h5", sx: { py: 1 }, children: "Details" }) }), jsx(Grid, { size: 6, children: jsx(Paper, { elevation: 2, sx: { p: 2, height: "100%" }, children: jsxs(Stack, { spacing: 2, children: [jsxs(Stack, { direction: "row", spacing: 2, alignItems: "center", children: [jsx(NumbersIcon, { color: "primary" }), jsx(Typography, { variant: "subtitle1", color: "text.secondary", width: "200px", children: "Return Number" }), jsx(Typography, { variant: "body1", fontWeight: "medium", children: data.return_number })] }), jsxs(Stack, { direction: "row", spacing: 2, alignItems: "center", children: [jsx(AssignmentReturnIcon, { color: "primary" }), jsx(Typography, { variant: "subtitle1", color: "text.secondary", width: "200px", children: "RMA Number" }), jsx(Typography, { variant: "body1", fontWeight: "medium", children: data.rma_number })] }), jsxs(Stack, { direction: "row", spacing: 2, alignItems: "center", children: [jsx(DescriptionIcon, { color: "primary" }), jsx(Typography, { variant: "subtitle1", color: "text.secondary", width: "200px", children: "Customer Reference" }), jsx(Typography, { variant: "body1", fontWeight: "medium", children: data.customer_reference })] }), jsxs(Stack, { direction: "row", spacing: 2, alignItems: "center", children: [jsx(CalendarTodayIcon, { color: "primary" }), jsx(Typography, { variant: "subtitle1", color: "text.secondary", width: "200px", children: "Return Date" }), jsx(Typography, { variant: "body1", fontWeight: "medium", children: data.return_date })] }), jsxs(Stack, { direction: "row", spacing: 2, alignItems: "center", children: [jsx(BusinessIcon, { color: "primary" }), jsx(Typography, { variant: "subtitle1", color: "text.secondary", width: "200px", children: "Customer" }), jsx(Typography, { variant: "body1", fontWeight: "medium", children: data.customer?.business_credentials?.company_name })] }), jsxs(Stack, { direction: "row", spacing: 2, alignItems: "center", children: [jsx(UpdateIcon, { color: "primary" }), jsx(Typography, { variant: "subtitle1", color: "text.secondary", width: "200px", children: "Return Status" }), jsx(IroStatusIndicator, { status: data.internal_status })] })] }) }) }), (data.internal_status === "requested" ||
|
|
346
347
|
data.internal_status === "finalising_process") &&
|
|
347
|
-
role === "enduser" && (jsx(Grid, { size: 6, children: jsx(Paper, { elevation: 2, sx: { p: 2, height: "100%" }, children: jsxs(Stack, { spacing: 2, children: [jsx(Button, { variant: "contained", color: "primary", onClick: () => setConfirmDialogOpen(true), children: "Confirm order" }), data.internal_status === "requested" && (jsx(Alert, { severity: "warning", children: "Please confirm the order as soon as possible, only upon confirmation this order will be assigned an RMA number and will become available to the dispatcher. Status: requested - returning" })), data.internal_status === "finalising_process" && (jsx(Alert, { severity: "warning", children: "Please finalise this return order. Make sure the customer receives a return payment if eligible and then confirm this step. Status: finalising_process - done" })), data.internal_status === "finalising_process" && (jsx(Button, { variant: "contained", sx: { color: "yellow" }, children: "// TODO RE-PAYMENT PROCESS" })), jsx(Button, { variant: "contained", color: "error", onClick: () => setCancelDialogOpen(true), children: "Cancel order" }), jsx(ConfirmFormDialog, { open: confirmDialogOpen, handleClose: () => setConfirmDialogOpen(false), orderID: data.documentId, currentStatus: data.internal_status, revalidateCallback: revalidateCallback, openOverwritesDialog: () => setOverwritesDialogOpen(true) }), jsx(OverwritesDialog, { open: overwritesDialogOpen, handleClose: () => setOverwritesDialogOpen(false), overwrites: overwrites, setOverwrites: setOverwrites, iro: data }), jsx(CancelIroDialog, { open: cancelDialogOpen, handleClose: () => setCancelDialogOpen(false), orderID: data.documentId, revalidateCallback: revalidateCallback })] }) }) })), jsx(Grid, { size: 12, children: jsxs(Stack, { spacing: 2, children: [jsx(Typography, { variant: "h5", children: "Documents" }), jsx(Paper, { sx: { p: 2 }, children: jsx(Stack, { spacing: 1 }) })] }) }), data?.notes?.length > 0 && (jsx(Grid, { size: 12, children: jsxs(Stack, { spacing: 2, children: [jsx(Typography, { variant: "h5", children: "Notes" }), jsx(NotesDisplay, { notes: data.notes }), jsx(Divider, {})] }) })), jsx(Grid, { size: 12, children: jsxs(Stack, { spacing: 1, children: [jsx(Typography, { variant: "h5", children: "Items" }), jsxs(Stack, { direction: "row", alignItems: "center", justifyContent: "flex-end", spacing: 2, component: Paper, p: 1, sx: {
|
|
348
|
+
role === "enduser" && (jsx(Grid, { size: 6, children: jsx(Paper, { elevation: 2, sx: { p: 2, height: "100%" }, children: jsxs(Stack, { spacing: 2, children: [jsx(Button, { variant: "contained", color: "primary", onClick: () => setConfirmDialogOpen(true), children: "Confirm order" }), data.internal_status === "requested" && (jsx(Alert, { severity: "warning", children: "Please confirm the order as soon as possible, only upon confirmation this order will be assigned an RMA number and will become available to the dispatcher. Status: requested - returning" })), data.internal_status === "finalising_process" && (jsx(Alert, { severity: "warning", children: "Please finalise this return order. Make sure the customer receives a return payment if eligible and then confirm this step. Status: finalising_process - done" })), data.internal_status === "finalising_process" && (jsx(Button, { variant: "contained", sx: { color: "yellow" }, children: "// TODO RE-PAYMENT PROCESS" })), jsx(Button, { variant: "contained", color: "error", onClick: () => setCancelDialogOpen(true), children: "Cancel order" }), jsx(ConfirmFormDialog, { open: confirmDialogOpen, handleClose: () => setConfirmDialogOpen(false), orderID: data.documentId, currentStatus: data.internal_status, revalidateCallback: revalidateCallback, openOverwritesDialog: () => setOverwritesDialogOpen(true) }), jsx(OverwritesDialog, { open: overwritesDialogOpen, handleClose: () => setOverwritesDialogOpen(false), overwrites: overwrites, setOverwrites: setOverwrites, iro: data }), jsx(CancelIroDialog, { open: cancelDialogOpen, handleClose: () => setCancelDialogOpen(false), orderID: data.documentId, revalidateCallback: revalidateCallback })] }) }) })), jsx(Grid, { size: 12, children: jsxs(Stack, { spacing: 2, children: [jsx(Typography, { variant: "h5", children: "Documents" }), jsx(Paper, { sx: { p: 2 }, children: jsx(Stack, { spacing: 1 }) })] }) }), jsx(Grid, { size: 12, children: jsxs(Stack, { spacing: 2, children: [jsx(Typography, { variant: "h5", children: "Customer Attachements" }), jsx(Paper, { sx: { p: 1 }, children: jsx(MinioItemList, { items: data.customer_attachment, emptyMessage: "No customer attachments found.", direction: "row", revalidateCallback: revalidateCallback }) })] }) }), data?.notes?.length > 0 && (jsx(Grid, { size: 12, children: jsxs(Stack, { spacing: 2, children: [jsx(Typography, { variant: "h5", children: "Notes" }), jsx(NotesDisplay, { notes: data.notes }), jsx(Divider, {})] }) })), jsx(Grid, { size: 12, children: jsxs(Stack, { spacing: 1, children: [jsx(Typography, { variant: "h5", children: "Items" }), jsxs(Stack, { direction: "row", alignItems: "center", justifyContent: "flex-end", spacing: 2, component: Paper, p: 1, sx: {
|
|
348
349
|
bgcolor: "background.default",
|
|
349
350
|
border: "1px solid",
|
|
350
351
|
borderColor: "divider",
|
|
@@ -210,7 +210,7 @@ function TextualManageIPOForm({ data, sx, revalidateCallback, handleClose, role,
|
|
|
210
210
|
{ id: data.documentId, __type: "api::logistics.ipo" },
|
|
211
211
|
], revalidateCallback: revalidateCallback })] }), jsx(Divider, {})] }) }), jsx(Grid, { size: 12, children: jsx(Typography, { variant: "h5", sx: { py: 1 }, children: "Details" }) }), jsx(Grid, { size: 6, children: jsx(Paper, { elevation: 2, sx: { p: 2, height: "100%" }, children: jsxs(Stack, { spacing: 2, children: [jsxs(Stack, { direction: "row", spacing: 2, alignItems: "center", children: [jsx(NumbersIcon, { color: "primary" }), jsx(Typography, { variant: "subtitle1", color: "text.secondary", width: "200px", children: "Purchase Order Number" }), jsx(Typography, { variant: "body1", fontWeight: "medium", children: data.ipo_number })] }), jsxs(Stack, { direction: "row", spacing: 2, alignItems: "center", children: [jsx(DescriptionIcon, { color: "primary" }), jsx(Typography, { variant: "subtitle1", color: "text.secondary", width: "200px", children: "Custom Reference" }), jsx(Typography, { variant: "body1", fontWeight: "medium", children: data.customer_reference })] }), jsxs(Stack, { direction: "row", spacing: 2, alignItems: "center", children: [jsx(CalendarTodayIcon, { color: "primary" }), jsx(Typography, { variant: "subtitle1", color: "text.secondary", width: "200px", children: "Order Date" }), jsx(Typography, { variant: "body1", fontWeight: "medium", children: data.order_date })] }), jsxs(Stack, { direction: "row", spacing: 2, alignItems: "center", children: [jsx(BusinessIcon, { color: "primary" }), jsx(Typography, { variant: "subtitle1", color: "text.secondary", width: "200px", children: "Supplier" }), jsx(Typography, { variant: "body1", fontWeight: "medium", children: data.vendor_profile?.business_credentials?.company_name })] }), jsxs(Stack, { direction: "row", spacing: 2, alignItems: "center", children: [jsx(UpdateIcon, { color: "primary" }), jsx(Typography, { variant: "subtitle1", color: "text.secondary", width: "200px", children: "Order Status" }), jsx(IpoStatusIndicator, { status: data.internal_status })] })] }) }) }), role === "enduser" && (jsx(Grid, { size: 6, children: jsx(Paper, { elevation: 2, sx: { p: 2, height: "100%" }, children: jsxs(Stack, { spacing: 2, children: [(data.internal_status === "placed" ||
|
|
212
212
|
data.internal_status === "released_on_stock") && (jsxs(Fragment, { children: [jsx(Button, { variant: "contained", color: "primary", onClick: () => setConfirmDialogOpen(true), children: "Confirm order" }), jsx(Alert, { severity: "warning", children: "Please confirm the order as soon as possible, only upon confirmation this order will be available to the dispatcher" }), jsx(ConfirmFormDialog, { open: confirmDialogOpen, handleClose: () => setConfirmDialogOpen(false), orderID: data.documentId, currentStatus: data.internal_status, revalidateCallback: revalidateCallback })] })), (data.internal_status === "placed" ||
|
|
213
|
-
data.internal_status === "ordered") && (jsxs(Fragment, { children: [jsx(Button, { variant: "contained", color: "error", onClick: () => setCancelDialogOpen(true), children: "Cancel order" }), jsx(CancelIpoDialog, { open: cancelDialogOpen, handleClose: () => setCancelDialogOpen(false), orderID: data.documentId, revalidateCallback: revalidateCallback })] }))] }) }) })), jsx(Grid, { size: 12, children:
|
|
213
|
+
data.internal_status === "ordered") && (jsxs(Fragment, { children: [jsx(Button, { variant: "contained", color: "error", onClick: () => setCancelDialogOpen(true), children: "Cancel order" }), jsx(CancelIpoDialog, { open: cancelDialogOpen, handleClose: () => setCancelDialogOpen(false), orderID: data.documentId, revalidateCallback: revalidateCallback })] }))] }) }) })), jsx(Grid, { size: 12, children: jsx(Typography, { variant: "h5", children: "Documents" }) }), role === "enduser" && (jsx(Grid, { size: 6, children: data.minio_order_confirmation ? (jsx(Paper, { sx: { p: 2 }, children: jsxs(Stack, { spacing: 2, children: [jsx(Typography, { variant: "h6", children: "Order Confirmation" }), jsx(MinioDisplay, { fileSize: data.minio_order_confirmation?.fileSize, mimeType: data.minio_order_confirmation?.mimeType, fileName: data.minio_order_confirmation?.fileName, bucketName: data.minio_order_confirmation?.bucketName, revalidateCallback: revalidateCallback })] }) })) : (jsx(Paper, { sx: { p: 2 }, children: jsxs(Stack, { spacing: 2, children: [jsx(Typography, { variant: "h6", children: "Order Confirmation" }), jsx(Typography, { variant: "body2", children: "Upload the order confirmation document for this purchase order" }), jsx(UploadMinioMediaForm, { reference: "api::logistics.ipo", refID: data.documentId, field: "minio_order_confirmation", bucketName: "umwd", multiple: false, revalidateCallback: revalidateCallback })] }) })) })), jsx(Grid, { size: 6, children: data.minio_delivery_note ? (jsx(Paper, { sx: { p: 2 }, children: jsxs(Stack, { spacing: 2, children: [jsx(Typography, { variant: "h6", children: "Delivery Note" }), jsx(MinioDisplay, { fileSize: data.minio_delivery_note?.fileSize, mimeType: data.minio_delivery_note?.mimeType, fileName: data.minio_delivery_note?.fileName, bucketName: data.minio_delivery_note?.bucketName, revalidateCallback: revalidateCallback })] }) })) : (jsx(Paper, { sx: { p: 2 }, children: jsxs(Stack, { spacing: 2, children: [jsx(Typography, { variant: "h6", children: "Delivery Note" }), jsx(Typography, { variant: "body2", children: "Upload the delivery note document for this purchase order" }), jsx(UploadMinioMediaForm, { reference: "api::logistics.ipo", refID: data.documentId, field: "minio_delivery_note", bucketName: "umwd", multiple: false, revalidateCallback: revalidateCallback })] }) })) }), data?.notes?.length > 0 && (jsx(Grid, { size: 12, children: jsxs(Stack, { spacing: 2, children: [jsx(Typography, { variant: "h5", children: "Notes" }), jsx(NotesDisplay, { notes: data.notes }), jsx(Divider, {})] }) })), jsx(Grid, { size: 12, children: jsxs(Stack, { spacing: 1, children: [jsx(Typography, { variant: "h5", children: "Items" }), jsxs(Stack, { direction: "row", alignItems: "center", justifyContent: "flex-end", spacing: 2, component: Paper, p: 1, sx: {
|
|
214
214
|
bgcolor: "background.default",
|
|
215
215
|
border: "1px solid",
|
|
216
216
|
borderColor: "divider",
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use server";
|
|
2
|
+
/*
|
|
3
|
+
* UMWD-Components
|
|
4
|
+
* @copyright Jelle Paulus
|
|
5
|
+
* @license MIT
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { getStrapiURL, flattenAttributes } from '../../../../../lib/utils.js';
|
|
9
|
+
import { getAuthToken } from '../../../../services/get-token.js';
|
|
10
|
+
|
|
11
|
+
const baseUrl = getStrapiURL();
|
|
12
|
+
async function getAllMinioMedia(bucketName) {
|
|
13
|
+
console.log("minio bucket:", bucketName);
|
|
14
|
+
const authToken = await getAuthToken();
|
|
15
|
+
const headers = {
|
|
16
|
+
method: "POST",
|
|
17
|
+
headers: {
|
|
18
|
+
"Content-Type": "application/json",
|
|
19
|
+
Authorization: `Bearer ${authToken}`,
|
|
20
|
+
},
|
|
21
|
+
body: JSON.stringify({
|
|
22
|
+
bucketName: bucketName ? bucketName : "umwd", // Default bucket if none provided
|
|
23
|
+
}),
|
|
24
|
+
};
|
|
25
|
+
const url = new URL("/api/minio-plugin/minio/list", baseUrl);
|
|
26
|
+
try {
|
|
27
|
+
const response = await fetch(url, authToken ? headers : {});
|
|
28
|
+
const data = await response.json();
|
|
29
|
+
return flattenAttributes(data);
|
|
30
|
+
}
|
|
31
|
+
catch (error) {
|
|
32
|
+
console.error("Error fetching fileList:", error);
|
|
33
|
+
throw error;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export { getAllMinioMedia };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use server";
|
|
2
|
+
/*
|
|
3
|
+
* UMWD-Components
|
|
4
|
+
* @copyright Jelle Paulus
|
|
5
|
+
* @license MIT
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { getStrapiURL, flattenAttributes } from '../../../../../lib/utils.js';
|
|
9
|
+
import { getAuthToken } from '../../../../services/get-token.js';
|
|
10
|
+
|
|
11
|
+
const baseUrl = getStrapiURL();
|
|
12
|
+
async function getAllMinioReferences(bucketName) {
|
|
13
|
+
console.log("minio bucket:", bucketName);
|
|
14
|
+
const authToken = await getAuthToken();
|
|
15
|
+
const headers = {
|
|
16
|
+
method: "POST",
|
|
17
|
+
headers: {
|
|
18
|
+
"Content-Type": "application/json",
|
|
19
|
+
Authorization: `Bearer ${authToken}`,
|
|
20
|
+
},
|
|
21
|
+
body: JSON.stringify({
|
|
22
|
+
bucketName: bucketName ? bucketName : "umwd", // Default bucket if none provided
|
|
23
|
+
}),
|
|
24
|
+
};
|
|
25
|
+
const url = new URL("/api/minio-plugin/minio/miniofilereference", baseUrl);
|
|
26
|
+
try {
|
|
27
|
+
const response = await fetch(url, authToken ? headers : {});
|
|
28
|
+
const data = await response.json();
|
|
29
|
+
return flattenAttributes(data);
|
|
30
|
+
}
|
|
31
|
+
catch (error) {
|
|
32
|
+
console.error("Error fetching fileList:", error);
|
|
33
|
+
throw error;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export { getAllMinioReferences };
|
|
@@ -15,23 +15,29 @@ async function minioUploadService(bucketName, files, reference, refID, field) {
|
|
|
15
15
|
const baseUrl = getStrapiURL();
|
|
16
16
|
const url = new URL("/api/minio-plugin/uploadbyreference", baseUrl);
|
|
17
17
|
try {
|
|
18
|
+
const requestBody = {
|
|
19
|
+
bucketName,
|
|
20
|
+
files,
|
|
21
|
+
reference,
|
|
22
|
+
refID,
|
|
23
|
+
field,
|
|
24
|
+
};
|
|
25
|
+
console.log("Sending request body:", JSON.stringify(requestBody, null, 2));
|
|
18
26
|
const response = await fetch(url, {
|
|
19
27
|
headers: {
|
|
20
28
|
Authorization: `Bearer ${authToken}`,
|
|
21
29
|
"Content-Type": "application/json",
|
|
22
30
|
},
|
|
23
31
|
method: "POST",
|
|
24
|
-
body: JSON.stringify(
|
|
25
|
-
data: {
|
|
26
|
-
bucketName,
|
|
27
|
-
files,
|
|
28
|
-
reference,
|
|
29
|
-
refID,
|
|
30
|
-
field,
|
|
31
|
-
},
|
|
32
|
-
}),
|
|
32
|
+
body: JSON.stringify(requestBody),
|
|
33
33
|
});
|
|
34
|
+
if (!response.ok) {
|
|
35
|
+
const errorText = await response.text();
|
|
36
|
+
console.error("Upload service error:", response.status, errorText);
|
|
37
|
+
throw new Error(`Upload failed with status ${response.status}: ${errorText}`);
|
|
38
|
+
}
|
|
34
39
|
const dataResponse = await response.json();
|
|
40
|
+
console.log("Upload service response:", dataResponse);
|
|
35
41
|
return dataResponse;
|
|
36
42
|
}
|
|
37
43
|
catch (error) {
|
package/dist/esm/src/index.js
CHANGED
|
@@ -217,3 +217,7 @@ export { default as TextualIROItemUpdater } from './components/e-commerce/iro/Te
|
|
|
217
217
|
export { default as TextualManageIroForm } from './components/e-commerce/iro/TextualManageIROForm.js';
|
|
218
218
|
export { UploadMinioMediaForm } from './components/common/media/minio/UploadMinioMediaForm.js';
|
|
219
219
|
export { uploadMinioMediaAction } from './data/actions/media/minio/uploadMinioMediaAction.js';
|
|
220
|
+
export { getAllMinioMedia } from './data/loaders/common/media/minio/getAllMinioMedia.js';
|
|
221
|
+
export { getAllMinioReferences } from './data/loaders/common/media/minio/getAllMinioReferences.js';
|
|
222
|
+
export { MinioItemList } from './components/common/media/minio/MinioItemList.js';
|
|
223
|
+
export { MinioDisplay } from './components/common/media/minio/MinioDisplay.js';
|