feat: add the add to list

This commit is contained in:
Rodolfo Ruiz 2025-06-04 19:43:37 -06:00
parent 083b077ebb
commit cef04888c6
2 changed files with 6 additions and 4 deletions

View File

@ -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: '',
@ -15,8 +15,11 @@ export default function AddProductForm() {
setProduct((prev) => ({ ...prev, [name]: value }));
};
const handleSave = () => {
console.log('Saving product:', product);
const handleSave = () => {
if (onAdd) {
onAdd(product);
setProduct({ name: '', price: '', provider: '', stock: '', category: '' });
}
};
const handleDelete = () => {

View File

@ -50,7 +50,6 @@ export default function Admin({ children, maxWidth = 'lg', sx = {} }) {
</DialogContent>
</Dialog>
<DataGrid
rows={rows}
columns={columns}