feat: add the add to list
This commit is contained in:
parent
083b077ebb
commit
cef04888c6
@ -1,7 +1,7 @@
|
|||||||
import React, { useState } from 'react';
|
import React, { useState } from 'react';
|
||||||
import { Box, Button, TextField, Typography, Grid } from '@mui/material';
|
import { Box, Button, TextField, Typography, Grid } from '@mui/material';
|
||||||
|
|
||||||
export default function AddProductForm() {
|
export default function AddProductForm({ onAdd }) {
|
||||||
const [product, setProduct] = useState({
|
const [product, setProduct] = useState({
|
||||||
name: '',
|
name: '',
|
||||||
price: '',
|
price: '',
|
||||||
@ -16,7 +16,10 @@ export default function AddProductForm() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const handleSave = () => {
|
const handleSave = () => {
|
||||||
console.log('Saving product:', product);
|
if (onAdd) {
|
||||||
|
onAdd(product);
|
||||||
|
setProduct({ name: '', price: '', provider: '', stock: '', category: '' });
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleDelete = () => {
|
const handleDelete = () => {
|
||||||
|
|||||||
@ -50,7 +50,6 @@ export default function Admin({ children, maxWidth = 'lg', sx = {} }) {
|
|||||||
</DialogContent>
|
</DialogContent>
|
||||||
</Dialog>
|
</Dialog>
|
||||||
|
|
||||||
|
|
||||||
<DataGrid
|
<DataGrid
|
||||||
rows={rows}
|
rows={rows}
|
||||||
columns={columns}
|
columns={columns}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user