umwd-components 0.1.800 → 0.1.802
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/e-commerce/iro/TextualManageIROForm.js +1 -1
- package/dist/cjs/src/components/e-commerce/products/EditStockForm.js +1 -1
- package/dist/cjs/src/components/logistics/ipo/TextualManageIPOForm.js +1 -1
- package/dist/cjs/src/components/logistics/vendor/EditVendorForm.js +1 -1
- package/dist/cjs/src/data/actions/logistics/note/createNoteAction.js +1 -1
- package/dist/cjs/src/data/actions/logistics/report/createReportAction.js +1 -1
- package/dist/cjs/tsconfig.build.tsbuildinfo +1 -1
- package/dist/esm/src/components/e-commerce/iro/TextualManageIROForm.js +17 -5
- package/dist/esm/src/components/e-commerce/products/EditStockForm.js +2 -2
- package/dist/esm/src/components/logistics/ipo/TextualManageIPOForm.js +0 -1
- package/dist/esm/src/components/logistics/vendor/EditVendorForm.js +3 -2
- package/dist/esm/src/data/actions/logistics/note/createNoteAction.js +2 -0
- package/dist/esm/src/data/actions/logistics/report/createReportAction.js +7 -1
- package/dist/esm/tsconfig.build.tsbuildinfo +1 -1
- package/dist/esm/types/data/actions/logistics/note/createNoteAction.d.ts +2 -1
- package/dist/esm/types/data/actions/logistics/report/createReportAction.d.ts +2 -1
- package/dist/esm/types/types/e-commerce/product/types.d.ts +1 -0
- package/dist/esm/types/types/logistics/Note.d.ts +1 -1
- package/dist/esm/types/types/logistics/Report.d.ts +1 -1
- package/dist/esm/types/types/logistics/Vendor.d.ts +1 -0
- package/package.json +1 -1
|
@@ -46,8 +46,22 @@ const INITIAL_STATE = {
|
|
|
46
46
|
message: null,
|
|
47
47
|
severity: null,
|
|
48
48
|
};
|
|
49
|
-
function OverwritesDialog({ open, handleClose, overwrites, setOverwrites, iro, }) {
|
|
49
|
+
function OverwritesDialog({ open, handleClose, overwrites, setOverwrites, iro, revalidateCallback, }) {
|
|
50
50
|
const [loading, setLoading] = useState(false);
|
|
51
|
+
const { handleAddMessage } = useSnackbar();
|
|
52
|
+
const handleConfirm = async () => {
|
|
53
|
+
try {
|
|
54
|
+
await confirmationService("iros", [iro.documentId], overwrites);
|
|
55
|
+
revalidateCallback && revalidateCallback();
|
|
56
|
+
handleClose();
|
|
57
|
+
}
|
|
58
|
+
catch (error) {
|
|
59
|
+
handleAddMessage({
|
|
60
|
+
message: "Failed to confirm return order",
|
|
61
|
+
severity: "error",
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
};
|
|
51
65
|
// Initialize overwrites values when dialog opens
|
|
52
66
|
useEffect(() => {
|
|
53
67
|
const fetchProducts = async () => {
|
|
@@ -165,10 +179,7 @@ function OverwritesDialog({ open, handleClose, overwrites, setOverwrites, iro, }
|
|
|
165
179
|
lines: newLines,
|
|
166
180
|
});
|
|
167
181
|
} })] }, item.documentId));
|
|
168
|
-
})] }))] }) }), jsxs(DialogActions, { children: [jsx(Button, { variant: "contained", onClick: (
|
|
169
|
-
confirmationService("iros", [iro.documentId], overwrites);
|
|
170
|
-
handleClose();
|
|
171
|
-
}, children: "Confirm" }), jsx(Button, { variant: "contained", onClick: handleClose, children: "Cancel" })] })] }));
|
|
182
|
+
})] }))] }) }), jsxs(DialogActions, { children: [jsx(Button, { variant: "contained", onClick: handleConfirm, children: "Confirm" }), jsx(Button, { variant: "contained", onClick: handleClose, children: "Cancel" })] })] }));
|
|
172
183
|
}
|
|
173
184
|
function ConfirmFormDialog({ open, handleClose, orderID, currentStatus, revalidateCallback, openOverwritesDialog, }) {
|
|
174
185
|
const { handleAddMessage } = useSnackbar();
|
|
@@ -193,6 +204,7 @@ function ConfirmFormDialog({ open, handleClose, orderID, currentStatus, revalida
|
|
|
193
204
|
handleClose();
|
|
194
205
|
return;
|
|
195
206
|
}
|
|
207
|
+
// if currentStatus is requested
|
|
196
208
|
try {
|
|
197
209
|
await confirmationService("iros", [orderID]);
|
|
198
210
|
handleAddMessage({
|
|
@@ -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, opoItems, reports, } = data;
|
|
38
|
+
const { id, 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);
|
|
@@ -98,7 +98,7 @@ function EditStockForm({ data, revalidateCallback, handleClose, sx, }) {
|
|
|
98
98
|
? reports.reduce((total, report) => total + report.quantity, 0)
|
|
99
99
|
: 0) }) }) })] })] }) })] }) })] }), jsxs("form", { action: formAction, children: [jsx("input", { id: "stock_reports", type: "hidden", name: "stock_reports", value: JSON.stringify(reports) }), jsxs(Grid, { container: true, spacing: 2, children: [jsx(Grid, { size: 12, sx: { mt: 2 }, children: jsxs(Stack, { spacing: 2, children: [jsx(Typography, { variant: "h5", children: "Stock corrections" }), jsx(Typography, { variant: "body2", children: "Here you can report and correct for damages wrong items etc. Do not forget to click the button!" }), jsx(ReportsDisplay, { reports: reports }), jsx(Stack, { direction: "row", justifyContent: "flex-end", children: jsx(ReportMakingComponent, { content: "content", quantity: 0, type: "stock", related: [
|
|
100
100
|
{
|
|
101
|
-
|
|
101
|
+
id: id,
|
|
102
102
|
__type: "api::e-commerce.product",
|
|
103
103
|
},
|
|
104
104
|
], revalidateCallback: revalidateCallback, biggerButton: true }) })] }) }), jsx(Grid, { size: 12, children: jsx(Stack, { direction: "row", justifyContent: "flex-end", alignItems: "center", sx: { py: 1 }, children: handleClose && (jsx(Button, { onClick: handleClose, variant: "outlined", children: "Close" })) }) })] })] })] }));
|
|
@@ -97,7 +97,6 @@ function CancelIpoDialog({ open, handleClose, orderID, revalidateCallback, }) {
|
|
|
97
97
|
return (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) => setReason(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" })] })] }));
|
|
98
98
|
}
|
|
99
99
|
function TextualManageIPOForm({ data, sx, revalidateCallback, handleClose, role, }) {
|
|
100
|
-
console.log("TextualManageIPOForm data", data);
|
|
101
100
|
const [formState, formAction] = useActionState((prevState, formData) => updateIpoAction(data.documentId, prevState, formData), INITIAL_STATE);
|
|
102
101
|
const { handleAddMessage } = useSnackbar();
|
|
103
102
|
const [items, setItems] = useState(data.items ? data.items : []);
|
|
@@ -35,7 +35,8 @@ const INITIAL_STATE = {
|
|
|
35
35
|
severity: null,
|
|
36
36
|
};
|
|
37
37
|
function EditVendorForm({ data, productNamesArr, revalidateCallback, handleClose, sx, }) {
|
|
38
|
-
|
|
38
|
+
console.log("EditVendorForm data", data);
|
|
39
|
+
const { id, documentId, website_url, phone_number, email, business_credentials, address, products, contacts, notes, } = data;
|
|
39
40
|
const [formState, formAction] = useActionState((prevState, formData) => updateVendorAction(documentId, prevState, formData), INITIAL_STATE);
|
|
40
41
|
const { handleAddMessage } = useSnackbar();
|
|
41
42
|
useEffect(() => {
|
|
@@ -82,7 +83,7 @@ function EditVendorForm({ data, productNamesArr, revalidateCallback, handleClose
|
|
|
82
83
|
const [newContacts, setNewContacts] = useState([]);
|
|
83
84
|
return (jsx(Box, { sx: [...(Array.isArray(sx) ? sx : [sx])], children: jsx("form", { action: formAction, children: jsxs(Grid, { container: true, spacing: 2, children: [jsx(Grid, { size: 12, children: jsxs(Stack, { direction: "row", justifyContent: "space-between", children: [jsx(Typography, { variant: "h5", children: "Edit Vendor" }), jsx(NoteTakingComponent, { content: "", related: [
|
|
84
85
|
{
|
|
85
|
-
id:
|
|
86
|
+
id: id,
|
|
86
87
|
__type: "api::logistics.vendor-profile",
|
|
87
88
|
},
|
|
88
89
|
], revalidateCallback: revalidateCallback })] }) }), jsx(Grid, { size: 12, children: jsx(ExplanatoryFoldOut, { title: "Vendor", description: "Vendors are businesses that you purchase products from." }) }), jsx(Grid, { size: {
|
|
@@ -44,7 +44,9 @@ async function createNoteAction(related, prevState, formData) {
|
|
|
44
44
|
related,
|
|
45
45
|
},
|
|
46
46
|
};
|
|
47
|
+
console.log(noteData.data.related);
|
|
47
48
|
const responseData = await mutateData("POST", `/api/notes`, noteData);
|
|
49
|
+
console.log("responseData", responseData);
|
|
48
50
|
if (!responseData) {
|
|
49
51
|
return {
|
|
50
52
|
...prevState,
|
|
@@ -19,26 +19,32 @@ async function createReportAction(related, type, prevState, formData) {
|
|
|
19
19
|
type,
|
|
20
20
|
},
|
|
21
21
|
};
|
|
22
|
-
console.
|
|
22
|
+
console.dir(reportData, 3);
|
|
23
|
+
console.log(reportData.data.related);
|
|
23
24
|
const responseData = await mutateData("POST", `/api/reports`, reportData);
|
|
24
25
|
console.log("responseData", responseData);
|
|
25
26
|
if (!responseData) {
|
|
26
27
|
return {
|
|
27
28
|
...prevState,
|
|
29
|
+
zodErrors: null,
|
|
28
30
|
strapiErrors: null,
|
|
29
31
|
message: "Ops! Something went wrong. Please try again.",
|
|
32
|
+
severity: "error",
|
|
30
33
|
};
|
|
31
34
|
}
|
|
32
35
|
if (responseData.error) {
|
|
33
36
|
return {
|
|
34
37
|
...prevState,
|
|
38
|
+
zodErrors: null,
|
|
35
39
|
strapiErrors: responseData.error,
|
|
36
40
|
message: "Failed to Create Report.",
|
|
41
|
+
severity: "error",
|
|
37
42
|
};
|
|
38
43
|
}
|
|
39
44
|
const flattenedData = flattenAttributes(responseData);
|
|
40
45
|
return {
|
|
41
46
|
...prevState,
|
|
47
|
+
zodErrors: null,
|
|
42
48
|
message: "New Report Created",
|
|
43
49
|
severity: "success",
|
|
44
50
|
data: flattenedData,
|