ProductGroupTreeView

This commit is contained in:
2026-08-12 19:01:54 +02:00
parent 0e8ad1b0ab
commit 55a3332938
3 changed files with 19 additions and 10 deletions
@@ -1,6 +1,9 @@
import Paper from '@mui/material/Paper';
import type { ProductGroup } from '../data/productGroup'; import type { ProductGroup } from '../data/productGroup';
import { SimpleTreeView } from '@mui/x-tree-view/SimpleTreeView'; import { SimpleTreeView } from '@mui/x-tree-view/SimpleTreeView';
import { TreeItem } from '@mui/x-tree-view/TreeItem'; import { TreeItem } from '@mui/x-tree-view/TreeItem';
import Typography from '@mui/material/Typography';
import Divider from '@mui/material/Divider';
type ProductGroupTreeViewProps = { type ProductGroupTreeViewProps = {
ProductGroups?: ProductGroup[]; ProductGroups?: ProductGroup[];
@@ -16,12 +19,18 @@ export default function ProductGroupTreeView({ ProductGroups = [] }: ProductGrou
</TreeItem> </TreeItem>
); );
return ( return (
<SimpleTreeView <Paper sx={{ height: 600, width: '10vw', marginRight: 2, border: '1px solid', borderColor: 'primary.main', borderRadius: 1, p: 1, bgcolor: '#f9f9f9' }}>
aria-label="Product Group Tree View" <Typography variant="body1" component="div" sx={{ flexGrow: 1, p: 1}}>
sx={{ height: 240, flexGrow: 1, maxWidth: 400, overflowY: 'auto' }} Product Groups:
> </Typography>
{ProductGroups.map((productGroup) => renderTree(productGroup))} <Divider />
</SimpleTreeView> <SimpleTreeView
aria-label="Product Group Tree View"
sx={{ height: 500, flexGrow: 1, overflowY: 'auto' }}
>
{ProductGroups.map((productGroup) => renderTree(productGroup))}
</SimpleTreeView>
</Paper>
); );
} }
@@ -130,7 +130,7 @@ const PropertyTypesTableView = ({ selectedRow }: { selectedRow: number }) => {
<div> <div>
{errorMessage !== '' && <Alert severity="error" sx={{ mb: 2 }}>{errorMessage}</Alert>} {errorMessage !== '' && <Alert severity="error" sx={{ mb: 2 }}>{errorMessage}</Alert>}
<CrudDataGrid <CrudDataGrid
paperSx={{ height: 600, width: '60vw' }} paperSx={{ height: 600, width: '60vw', color: 'primary.main' }}
initialState={{ initialState={{
sorting: { sorting: {
sortModel: [{ field: 'id', sort: 'asc' }], sortModel: [{ field: 'id', sort: 'asc' }],
@@ -20,13 +20,13 @@ const ProductPage: React.FC = () => {
return ( return (
<Box component="section" sx={{ p: 2, border: '1px dashed grey' }}> <Box component="section" sx={{ p: 2, border: '1px dashed grey' }}>
<Typography variant="h3"> <Typography variant="h3">
Property Type Management Product Management
</Typography> </Typography>
<Box <Box
sx={{ sx={{
display: "flex", // Arrange children in a row display: "flex", // Arrange children in a row
flexDirection: "row", flexDirection: "row",
width: "100vw", // Full width of the parent width: "98%", // Full width of the parent
p: 2, // Padding around the flex container p: 2, // Padding around the flex container
bgcolor: "#f5f5f5" bgcolor: "#f5f5f5"
}} }}