umwd-components 0.1.655 → 0.1.657
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/.ai/form-patterns.md +2 -7
- package/dist/src/components/e-commerce/categories/AddCategoryForm.js +1 -1
- package/dist/src/components/e-commerce/categories/EditCategoryForm.js +1 -1
- package/dist/src/components/e-commerce/opo/TextualManageOpoForm.js +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/components/e-commerce/categories/AddCategoryForm.tsx +33 -20
- package/src/components/e-commerce/categories/CreateCategoryForm.tsx +23 -1
- package/src/components/e-commerce/categories/EditCategoryForm.tsx +30 -14
- package/src/components/e-commerce/opo/TextualManageOpoForm.tsx +1 -1
- package/dist/types/components/e-commerce/categories/CreateCategoryForm.d.ts +0 -9
package/package.json
CHANGED
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import React, { useEffect } from "react";
|
|
4
|
-
import Paper from "@mui/material/Paper";
|
|
5
4
|
import Box from "@mui/material/Box";
|
|
6
5
|
import Stack from "@mui/material/Stack";
|
|
7
|
-
import Alert from "@mui/material/Alert";
|
|
8
6
|
import TextField from "@mui/material/TextField";
|
|
9
7
|
import Typography from "@mui/material/Typography";
|
|
8
|
+
import { Button } from "@mui/material";
|
|
10
9
|
import { SubmitButton } from "../../SubmitButton";
|
|
11
10
|
import { useFormState } from "react-dom";
|
|
12
|
-
import { StrapiErrors } from "../../StrapiErrors";
|
|
13
11
|
import { createCategoryAction } from "../../../data/actions/e-commerce/categories/createCategoryAction";
|
|
14
12
|
import Grid from "@mui/material/Grid";
|
|
15
13
|
import ProductSelector from "../products/ProductSelector";
|
|
@@ -43,7 +41,6 @@ export function AddCategoryForm({
|
|
|
43
41
|
);
|
|
44
42
|
|
|
45
43
|
const { handleAddMessage } = useSnackbar();
|
|
46
|
-
|
|
47
44
|
useEffect(() => {
|
|
48
45
|
if (formState?.message) {
|
|
49
46
|
handleAddMessage({
|
|
@@ -52,10 +49,6 @@ export function AddCategoryForm({
|
|
|
52
49
|
});
|
|
53
50
|
|
|
54
51
|
if (formState.severity === "success") {
|
|
55
|
-
handleAddMessage({
|
|
56
|
-
message: formState.message || "Category created successfully",
|
|
57
|
-
severity: formState.severity || "success",
|
|
58
|
-
});
|
|
59
52
|
revalidateCallback && revalidateCallback();
|
|
60
53
|
handleClose && handleClose();
|
|
61
54
|
}
|
|
@@ -75,6 +68,18 @@ export function AddCategoryForm({
|
|
|
75
68
|
<Box sx={[...(Array.isArray(sx) ? sx : [sx])]}>
|
|
76
69
|
<form action={formAction}>
|
|
77
70
|
<Grid container spacing={2}>
|
|
71
|
+
<Grid item xs={12}>
|
|
72
|
+
<Stack spacing={2}>
|
|
73
|
+
<Typography variant="h3" component={"h1"}>
|
|
74
|
+
Add Category
|
|
75
|
+
</Typography>
|
|
76
|
+
<Typography variant="body2">
|
|
77
|
+
Create a new category for your products. You can add products to
|
|
78
|
+
this category later.
|
|
79
|
+
</Typography>
|
|
80
|
+
</Stack>
|
|
81
|
+
</Grid>
|
|
82
|
+
|
|
78
83
|
<Grid item xs={12}>
|
|
79
84
|
<Stack spacing={2}>
|
|
80
85
|
<TextField
|
|
@@ -96,19 +101,27 @@ export function AddCategoryForm({
|
|
|
96
101
|
currentValue={[]}
|
|
97
102
|
/>
|
|
98
103
|
</Grid>
|
|
104
|
+
|
|
105
|
+
<Grid item xs={12}>
|
|
106
|
+
<Stack
|
|
107
|
+
direction={"row"}
|
|
108
|
+
justifyContent={"space-between"}
|
|
109
|
+
alignItems={"center"}
|
|
110
|
+
sx={{ pt: 2 }}
|
|
111
|
+
>
|
|
112
|
+
{handleClose && (
|
|
113
|
+
<Button onClick={handleClose} variant="outlined">
|
|
114
|
+
Cancel
|
|
115
|
+
</Button>
|
|
116
|
+
)}
|
|
117
|
+
<SubmitButton
|
|
118
|
+
text="Create category"
|
|
119
|
+
loadingText="Loading..."
|
|
120
|
+
variant="contained"
|
|
121
|
+
/>
|
|
122
|
+
</Stack>
|
|
123
|
+
</Grid>
|
|
99
124
|
</Grid>
|
|
100
|
-
{/* <Grid item xs={12}>
|
|
101
|
-
<Stack
|
|
102
|
-
direction="row-reverse"
|
|
103
|
-
spacing={2}
|
|
104
|
-
alignItems={"center"}
|
|
105
|
-
sx={{
|
|
106
|
-
py: 1,
|
|
107
|
-
}}
|
|
108
|
-
>
|
|
109
|
-
<SubmitButton text="create category" loadingText="loading" />
|
|
110
|
-
</Stack>
|
|
111
|
-
</Grid> */}
|
|
112
125
|
</form>
|
|
113
126
|
</Box>
|
|
114
127
|
);
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
/*
|
|
2
|
+
TODO, This file is not used becuz a AddCategoryForm.tsx was created instead.
|
|
3
|
+
For the moment it's commented out to avoid confusion.
|
|
4
|
+
If this does not lead to any issues, we can remove it later.
|
|
5
|
+
|
|
1
6
|
"use client";
|
|
2
7
|
|
|
3
8
|
import { useFormState } from "react-dom";
|
|
@@ -55,6 +60,17 @@ export default function CreateCategoryForm({
|
|
|
55
60
|
<Box component={Paper} sx={{ p: 2 }}>
|
|
56
61
|
<form action={formAction}>
|
|
57
62
|
<Grid container spacing={2}>
|
|
63
|
+
<Grid item xs={12}>
|
|
64
|
+
<Stack spacing={2}>
|
|
65
|
+
<Typography variant="h3" component={"h1"}>
|
|
66
|
+
Create Category
|
|
67
|
+
</Typography>
|
|
68
|
+
<Typography variant="body2">
|
|
69
|
+
Create a new category for your products. You can add products to
|
|
70
|
+
this category later.
|
|
71
|
+
</Typography>
|
|
72
|
+
</Stack>
|
|
73
|
+
</Grid>
|
|
58
74
|
<Grid item xs={12}>
|
|
59
75
|
<Stack spacing={2}>
|
|
60
76
|
<TextField id="title" name="title" label="Title" />
|
|
@@ -71,7 +87,12 @@ export default function CreateCategoryForm({
|
|
|
71
87
|
</Grid>
|
|
72
88
|
</Grid>
|
|
73
89
|
<Grid item xs={12}>
|
|
74
|
-
<Stack
|
|
90
|
+
<Stack
|
|
91
|
+
direction={"row"}
|
|
92
|
+
justifyContent={"space-between"}
|
|
93
|
+
alignItems={"center"}
|
|
94
|
+
sx={{ pt: 2 }}
|
|
95
|
+
>
|
|
75
96
|
{handleClose !== undefined && (
|
|
76
97
|
<Button onClick={handleClose} variant="outlined">
|
|
77
98
|
Cancel
|
|
@@ -88,3 +109,4 @@ export default function CreateCategoryForm({
|
|
|
88
109
|
</Box>
|
|
89
110
|
);
|
|
90
111
|
}
|
|
112
|
+
*/
|
|
@@ -77,6 +77,17 @@ export function EditCategoryForm({
|
|
|
77
77
|
<form action={formAction}>
|
|
78
78
|
{id && <input id="id" type="hidden" name="id" value={id} />}
|
|
79
79
|
<Grid container spacing={2}>
|
|
80
|
+
<Grid item xs={12}>
|
|
81
|
+
<Stack spacing={2}>
|
|
82
|
+
<Typography variant="h3" component={"h1"}>
|
|
83
|
+
Edit Category
|
|
84
|
+
</Typography>
|
|
85
|
+
<Typography variant="body2">
|
|
86
|
+
Edit the category for your products. You can add products to
|
|
87
|
+
this category later.
|
|
88
|
+
</Typography>
|
|
89
|
+
</Stack>
|
|
90
|
+
</Grid>
|
|
80
91
|
<Grid item xs={12}>
|
|
81
92
|
<Stack spacing={2}>
|
|
82
93
|
<TextField
|
|
@@ -103,20 +114,25 @@ export function EditCategoryForm({
|
|
|
103
114
|
currentValue={[...initialProducts.map((prod) => prod.id)]}
|
|
104
115
|
/>
|
|
105
116
|
</Grid>
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
117
|
+
|
|
118
|
+
<Grid item xs={12}>
|
|
119
|
+
<Stack
|
|
120
|
+
direction={"row"}
|
|
121
|
+
justifyContent={"space-between"}
|
|
122
|
+
alignItems={"center"}
|
|
123
|
+
>
|
|
124
|
+
{handleClose && (
|
|
125
|
+
<Button onClick={handleClose} variant="outlined">
|
|
126
|
+
Cancel
|
|
127
|
+
</Button>
|
|
128
|
+
)}
|
|
129
|
+
<SubmitButton
|
|
130
|
+
text="Update category"
|
|
131
|
+
loadingText="Loading..."
|
|
132
|
+
variant="contained"
|
|
133
|
+
/>
|
|
134
|
+
</Stack>
|
|
135
|
+
</Grid>
|
|
120
136
|
</Grid>
|
|
121
137
|
</form>
|
|
122
138
|
</Box>
|
|
@@ -272,7 +272,7 @@ export default function TextualManageOPOForm({
|
|
|
272
272
|
}, [opo]);
|
|
273
273
|
|
|
274
274
|
return (
|
|
275
|
-
<Box sx={[
|
|
275
|
+
<Box sx={[...(Array.isArray(sx) ? sx : [sx])]}>
|
|
276
276
|
<Grid container spacing={2}>
|
|
277
277
|
<Grid item xs={12}>
|
|
278
278
|
<Stack spacing={2}>
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { ProductName } from "../../../types/e-commerce/product/types";
|
|
3
|
-
import { SxProps } from "@mui/material/styles";
|
|
4
|
-
export default function CreateCategoryForm({ productNamesArray, revalidateCallback, handleClose, sx, }: {
|
|
5
|
-
productNamesArray: ProductName[];
|
|
6
|
-
revalidateCallback?: () => void;
|
|
7
|
-
handleClose?: () => void;
|
|
8
|
-
sx?: SxProps;
|
|
9
|
-
}): import("react").JSX.Element;
|