umwd-components 0.1.817 → 0.1.819
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/node_modules/color-string/index.js +1 -1
- package/dist/cjs/node_modules/crypto-js/index.js +1 -1
- package/dist/cjs/src/components/e-commerce/invoice/InvoicePDF.js +1 -1
- package/dist/cjs/src/components/e-commerce/iro/RmaForm.js +1 -1
- package/dist/cjs/src/data/actions/e-commerce/iro/createIroAction.js +1 -1
- package/dist/cjs/src/data/actions/e-commerce/iro/requestRmaAction.js +1 -1
- package/dist/cjs/tsconfig.build.tsbuildinfo +1 -1
- package/dist/esm/src/components/e-commerce/invoice/InvoicePDF.js +3 -4
- package/dist/esm/src/components/e-commerce/iro/RmaForm.js +6 -7
- package/dist/esm/src/data/actions/e-commerce/iro/createIroAction.js +1 -0
- package/dist/esm/src/data/actions/e-commerce/iro/requestRmaAction.js +3 -2
- package/dist/esm/tsconfig.build.tsbuildinfo +1 -1
- package/dist/esm/types/components/e-commerce/invoice/InvoicePDF.d.ts +2 -4
- package/package.json +1 -1
|
@@ -87,8 +87,7 @@ const createStyles = (StyleSheet) => StyleSheet.create({
|
|
|
87
87
|
h3: { fontSize: 16, fontWeight: "bold" },
|
|
88
88
|
});
|
|
89
89
|
// Create Document Component
|
|
90
|
-
const InvoicePDF = ({
|
|
91
|
-
const { invoice } = props;
|
|
90
|
+
const InvoicePDF = ({ invoice }) => {
|
|
92
91
|
const { pdfComponents, loading, error } = usePDFRenderer();
|
|
93
92
|
if (loading) {
|
|
94
93
|
return jsx(CircularProgress, {});
|
|
@@ -154,7 +153,7 @@ function InvoiceDownloadLink({ invoice }) {
|
|
|
154
153
|
const { PDFDownloadLink } = pdfComponents;
|
|
155
154
|
// Add error boundary for PDF generation
|
|
156
155
|
try {
|
|
157
|
-
return (jsx(PDFDownloadLink, { document: jsx(InvoicePDF, {
|
|
156
|
+
return (jsx(PDFDownloadLink, { document: jsx(InvoicePDF, { invoice: invoice }), fileName: `invoice_${safeGet(invoice, "invoice_number", "unknown")}`, children: jsx(IconButton, { children: jsx(PictureAsPdfIcon, {}) }) }, Date.now()));
|
|
158
157
|
}
|
|
159
158
|
catch (err) {
|
|
160
159
|
console.error("Error creating PDF download link:", err);
|
|
@@ -176,7 +175,7 @@ function InvoicePDFViewer({ invoice }) {
|
|
|
176
175
|
return (jsxs(Fragment, { children: [jsx(IconButton, { onClick: handleOpenPDF, children: jsx(PictureAsPdfIcon, {}) }), jsxs(Dialog, { open: open, fullWidth: true, maxWidth: "lg", children: [jsx(DialogContent, { children: pdfError ? (jsxs("div", { children: ["Error rendering PDF: ", pdfError] })) : (jsx(PDFViewer, { style: {
|
|
177
176
|
width: "100%",
|
|
178
177
|
minHeight: "70vh",
|
|
179
|
-
}, children: jsx(InvoicePDF, {
|
|
178
|
+
}, children: jsx(InvoicePDF, { invoice: invoice }) }, Date.now())) }), jsx(DialogActions, { children: jsx(Button, { variant: "contained", onClick: () => setOpen(false), children: "Close" }) })] })] }));
|
|
180
179
|
}
|
|
181
180
|
|
|
182
181
|
export { InvoiceDownloadLink, InvoicePDF, InvoicePDFViewer };
|
|
@@ -9,7 +9,6 @@ import { jsx, jsxs, Fragment as Fragment$1 } from 'react/jsx-runtime';
|
|
|
9
9
|
import { useActionState, useState, useEffect, Suspense, Fragment, useTransition } from 'react';
|
|
10
10
|
import { useSnackbar } from '../../../context/common/SnackbarContext.js';
|
|
11
11
|
import { requestRmaAction } from '../../../data/actions/e-commerce/iro/requestRmaAction.js';
|
|
12
|
-
import { StrapiErrors } from '../../StrapiErrors.js';
|
|
13
12
|
import { SubmitButton } from '../../SubmitButton.js';
|
|
14
13
|
import Typography from '@mui/material/Typography';
|
|
15
14
|
import Grid from '@mui/material/Grid';
|
|
@@ -111,7 +110,7 @@ const ConfirmRMADialog = ({ open, onClose, items, formState, submitCallback, })
|
|
|
111
110
|
});
|
|
112
111
|
}
|
|
113
112
|
};
|
|
114
|
-
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: [jsx(SubmitButton, { text: "Yes", loadingText: "Loading...", disabled: missingConfirmations, onClick: handleSubmit, loading: isPending }), jsx(Button, { onClick: onClose, children: "No" })
|
|
113
|
+
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: [jsx(SubmitButton, { text: "Yes", loadingText: "Loading...", disabled: missingConfirmations, onClick: handleSubmit, loading: isPending }), jsx(Button, { onClick: onClose, children: "No" })] })] }));
|
|
115
114
|
};
|
|
116
115
|
/* INFO Request RMA Return Merchandise Authorization for customers*/
|
|
117
116
|
function RmaForm({ opo, sx, revalidateCallback, handleClose, }) {
|
|
@@ -154,11 +153,11 @@ function RmaForm({ opo, sx, revalidateCallback, handleClose, }) {
|
|
|
154
153
|
formAction(new FormData());
|
|
155
154
|
}
|
|
156
155
|
setOpen(!open);
|
|
157
|
-
} }),
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
156
|
+
} }), jsx(Grid, { size: 12, children: jsx(Button, { onClick: () => {
|
|
157
|
+
console.log(formState);
|
|
158
|
+
setOpen(!open);
|
|
159
|
+
}, disabled: selectedItems.length === 0 ||
|
|
160
|
+
selectedItems.reduce((acc, index) => acc + itemsToReturn[index].returned_quantity, 0) === 0, children: "Request RMA" }) })] }) }) }));
|
|
162
161
|
}
|
|
163
162
|
|
|
164
163
|
export { RmaForm as default };
|
|
@@ -16,11 +16,9 @@ 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);
|
|
20
19
|
parsedFormData.data.iro_items = JSON.parse(parsedFormData.data.iro_items);
|
|
21
20
|
}
|
|
22
21
|
if (parsedFormData.data.opos) {
|
|
23
|
-
console.log("parsedFormData.data.opos", parsedFormData.data.opos);
|
|
24
22
|
parsedFormData.data.opos = parsedFormData.data.opos;
|
|
25
23
|
}
|
|
26
24
|
const responseData = await mutateData("POST", `/api/iros`, parsedFormData);
|
|
@@ -28,6 +26,7 @@ async function requestRmaAction(prevState, formData) {
|
|
|
28
26
|
return {
|
|
29
27
|
...prevState,
|
|
30
28
|
strapiErrors: null,
|
|
29
|
+
severity: "error",
|
|
31
30
|
message: "Ops! Something went wrong. Please try again.",
|
|
32
31
|
};
|
|
33
32
|
}
|
|
@@ -35,6 +34,7 @@ async function requestRmaAction(prevState, formData) {
|
|
|
35
34
|
return {
|
|
36
35
|
...prevState,
|
|
37
36
|
strapiErrors: responseData.error,
|
|
37
|
+
severity: "error",
|
|
38
38
|
message: "Failed to Create Iro.",
|
|
39
39
|
};
|
|
40
40
|
}
|
|
@@ -42,6 +42,7 @@ async function requestRmaAction(prevState, formData) {
|
|
|
42
42
|
return {
|
|
43
43
|
...prevState,
|
|
44
44
|
message: "Iro Created Successfully",
|
|
45
|
+
severity: "success",
|
|
45
46
|
data: flattenedData,
|
|
46
47
|
strapiErrors: null,
|
|
47
48
|
};
|