diff --git a/react-bootstrap-migration/src/pages/admin/EditMenuGroupPage.js b/react-bootstrap-migration/src/pages/admin/EditMenuGroupPage.js deleted file mode 100644 index 70d4d33..0000000 --- a/react-bootstrap-migration/src/pages/admin/EditMenuGroupPage.js +++ /dev/null @@ -1,151 +0,0 @@ -import React, { useState, useEffect } from 'react'; -import { useParams, useNavigate } from 'react-router-dom'; -import { Form, Button, Container, Row, Col, Table, FloatingLabel } from 'react-bootstrap'; -import './EditMenuGroupPage.css'; - -const EditMenuGroupPage = () => { - const { id } = useParams(); - const navigate = useNavigate(); - - // Mock data based on Angular component analysis - const [header, setHeader] = useState({ - menu_name: '', - description: '', - active: true, - start_date: '', - end_date: '', - }); - - const [lines, setLines] = useState([]); - const types = ['user', 'admin', 'mis report', 'bi report']; - const [menuDropDown, setMenuDropDown] = useState([]); // Mocked menu items for dropdown - - useEffect(() => { - // Mock fetching data since services are commented out in Angular component - console.log("Fetching data for menu group with id:", id); - setHeader({ - menu_name: 'Admin Menu Group', - description: 'Main administrative menu group.', - active: true, - start_date: '2025-01-01', - end_date: '2025-12-31', - }); - setLines([ - { id: 1, name: 'User Management', type: 'admin', menu_id: '101', active: true, start_date: '2025-01-01', end_date: '2025-12-31', seq: 10 }, - { id: 2, name: 'System Reports', type: 'mis report', menu_id: '102', active: false, start_date: '2025-01-01', end_date: '2025-06-30', seq: 20 }, - ]); - setMenuDropDown([ - { id: '101', name: 'User Admin Menu' }, - { id: '102', name: 'Reporting Menu' }, - ]); - }, [id]); - - const handleHeaderChange = (e) => { - const { name, value, type, checked } = e.target; - setHeader(prev => ({ ...prev, [name]: type === 'checkbox' ? checked : value })); - }; - - const handleLineChange = (index, e) => { - const { name, value, type, checked } = e.target; - const newLines = [...lines]; - newLines[index] = { ...newLines[index], [name]: type === 'checkbox' ? checked : value }; - setLines(newLines); - }; - - const handleSubmit = (e) => { - e.preventDefault(); - console.log("Submitting data:", { id, header, lines }); - // Mock navigation on successful update - navigate('/admin/menu-group/all'); // A hypothetical route - }; - - const back = () => { - navigate(-1); // Go back to the previous page - } - - return ( - -

Menu Group Edit Form

-

ID: {id}

-
- -
-
-

Menu Group Header

-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-

Menu Group Lines Details

-
- - - - - - - - - - - - - - {lines.map((line, index) => ( - - - - - - - - - - ))} - -
NameTypeMenu NameActiveStart DateEnd DateOrder
handleLineChange(index, e)} /> - handleLineChange(index, e)}> - - {types.map(t => )} - - - handleLineChange(index, e)}> - - {menuDropDown.map(m => )} - - handleLineChange(index, e)} /> handleLineChange(index, e)} /> handleLineChange(index, e)} /> handleLineChange(index, e)} />
- - - -
-
- ); -}; - -export default EditMenuGroupPage;