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 { Box, Button, TextField, Typography, Grid } from '@mui/material';
|
||||
|
||||
export default function AddProductForm() {
|
||||
export default function AddProductForm({ onAdd }) {
|
||||
const [product, setProduct] = useState({
|
||||
name: '',
|
||||
price: '',
|
||||
@ -16,7 +16,10 @@ export default function AddProductForm() {
|
||||
};
|
||||
|
||||
const handleSave = () => {
|
||||
console.log('Saving product:', product);
|
||||
if (onAdd) {
|
||||
onAdd(product);
|
||||
setProduct({ name: '', price: '', provider: '', stock: '', category: '' });
|
||||
}
|
||||
};
|
||||
|
||||
const handleDelete = () => {
|
||||
|
||||
@ -50,7 +50,6 @@ export default function Admin({ children, maxWidth = 'lg', sx = {} }) {
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
|
||||
|
||||
<DataGrid
|
||||
rows={rows}
|
||||
columns={columns}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user