feat: add the add to list
This commit is contained in:
		| @@ -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: '', | ||||||
| @@ -15,8 +15,11 @@ export default function AddProductForm() { | |||||||
|     setProduct((prev) => ({ ...prev, [name]: value })); |     setProduct((prev) => ({ ...prev, [name]: value })); | ||||||
|   }; |   }; | ||||||
|  |  | ||||||
|   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} | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Rodolfo Ruiz
					Rodolfo Ruiz