import React, { useState, useRef, useEffect, useMemo } from "react"; 
 | 
import { Box, Card, CardContent, Grid, Typography, Tooltip } from '@mui/material'; 
 | 
import { 
 | 
    useTranslate, 
 | 
    useRecordContext, 
 | 
} from 'react-admin'; 
 | 
import PanelTypography from "@/page/components/PanelTypography"; 
 | 
import * as Common from '@/utils/common' 
 | 
  
 | 
const MatnrPanel = () => { 
 | 
    const record = useRecordContext(); 
 | 
    if (!record) return null; 
 | 
    const translate = useTranslate(); 
 | 
    return ( 
 | 
        <> 
 | 
            <Card sx={{ width: { xs: 300, sm: 500, md: 600, lg: 1400 }, margin: 'auto' }}> 
 | 
                <CardContent> 
 | 
                    <Grid container spacing={2}> 
 | 
                        <Grid item xs={12} sx={{ display: 'flex', justifyContent: 'space-between' }}> 
 | 
                            <Typography variant="h6" gutterBottom align="left" sx={{ 
 | 
                                maxWidth: { xs: '100px', sm: '180px', md: '260px', lg: '360px' }, 
 | 
                                whiteSpace: 'nowrap', 
 | 
                                overflow: 'hidden', 
 | 
                                textOverflow: 'ellipsis', 
 | 
                            }}> 
 | 
                                {Common.camelToPascalWithSpaces(translate('table.field.matnr.name'))}: {record.name} 
 | 
                            </Typography> 
 | 
                            {/*  inherit, primary, secondary, textPrimary, textSecondary, error */} 
 | 
                            <Typography variant="h6" gutterBottom align="right" > 
 | 
                                ID: {record.id} 
 | 
                            </Typography> 
 | 
                        </Grid> 
 | 
                    </Grid> 
 | 
                    <Grid container spacing={2}> 
 | 
                        <Grid item xs={12} container alignContent="flex-end"> 
 | 
                            <Typography variant="caption" color="textSecondary" sx={{ wordWrap: 'break-word', wordBreak: 'break-all' }}> 
 | 
                                {Common.camelToPascalWithSpaces(translate('common.field.memo'))}:{record.memo} 
 | 
                            </Typography> 
 | 
                        </Grid> 
 | 
                    </Grid> 
 | 
                    <Box height={20}> </Box> 
 | 
                    <Grid container spacing={2}> 
 | 
                        <Grid item xs={3}> 
 | 
                            <PanelTypography 
 | 
                                title="table.field.matnr.name"  
 | 
                                property={record.name} 
 | 
                            /> 
 | 
                        </Grid> 
 | 
                        <Grid item xs={3}> 
 | 
                            <PanelTypography 
 | 
                                title="table.field.matnr.code"  
 | 
                                property={record.code} 
 | 
                            /> 
 | 
                        </Grid> 
 | 
                        <Grid item xs={3}> 
 | 
                            <PanelTypography 
 | 
                                title="table.field.matnr.shipperId"  
 | 
                                property={record.shipperId$} 
 | 
                            /> 
 | 
                        </Grid> 
 | 
                        <Grid item xs={3}> 
 | 
                            <PanelTypography 
 | 
                                title="table.field.matnr.groupId"  
 | 
                                property={record.groupId$} 
 | 
                            /> 
 | 
                        </Grid> 
 | 
                        <Grid item xs={3}> 
 | 
                            <PanelTypography 
 | 
                                title="table.field.matnr.rglarId"  
 | 
                                property={record.rglarId$} 
 | 
                            /> 
 | 
                        </Grid> 
 | 
                        <Grid item xs={3}> 
 | 
                            <PanelTypography 
 | 
                                title="table.field.matnr.platCode" 
 | 
                                property={record.platCode} 
 | 
                            /> 
 | 
                        </Grid> 
 | 
                        <Grid item xs={3}> 
 | 
                            <PanelTypography 
 | 
                                title="table.field.matnr.spec"  
 | 
                                property={record.spec} 
 | 
                            /> 
 | 
                        </Grid> 
 | 
                        <Grid item xs={3}> 
 | 
                            <PanelTypography 
 | 
                                title="table.field.matnr.model"  
 | 
                                property={record.model} 
 | 
                            /> 
 | 
                        </Grid> 
 | 
                        <Grid item xs={3}> 
 | 
                            <PanelTypography 
 | 
                                title="table.field.matnr.weight"  
 | 
                                property={record.weight} 
 | 
                            /> 
 | 
                        </Grid> 
 | 
                        <Grid item xs={3}> 
 | 
                            <PanelTypography 
 | 
                                title="table.field.matnr.color"  
 | 
                                property={record.color} 
 | 
                            /> 
 | 
                        </Grid> 
 | 
                        <Grid item xs={3}> 
 | 
                            <PanelTypography 
 | 
                                title="table.field.matnr.size"  
 | 
                                property={record.size} 
 | 
                            /> 
 | 
                        </Grid> 
 | 
                        <Grid item xs={3}> 
 | 
                            <PanelTypography 
 | 
                                title="table.field.matnr.describle"  
 | 
                                property={record.describle} 
 | 
                            /> 
 | 
                        </Grid> 
 | 
                        <Grid item xs={3}> 
 | 
                            <PanelTypography 
 | 
                                title="table.field.matnr.nromNum"  
 | 
                                property={record.nromNum} 
 | 
                            /> 
 | 
                        </Grid> 
 | 
                        <Grid item xs={3}> 
 | 
                            <PanelTypography 
 | 
                                title="table.field.matnr.unit"  
 | 
                                property={record.unit} 
 | 
                            /> 
 | 
                        </Grid> 
 | 
                        <Grid item xs={3}> 
 | 
                            <PanelTypography 
 | 
                                title="table.field.matnr.purUnit"  
 | 
                                property={record.purUnit} 
 | 
                            /> 
 | 
                        </Grid> 
 | 
                        <Grid item xs={3}> 
 | 
                            <PanelTypography 
 | 
                                title="table.field.matnr.stockUnit"  
 | 
                                property={record.stockUnit} 
 | 
                            /> 
 | 
                        </Grid> 
 | 
                        <Grid item xs={3}> 
 | 
                            <PanelTypography 
 | 
                                title="table.field.matnr.stockLevel"  
 | 
                                property={record.stockLevel$} 
 | 
                            /> 
 | 
                        </Grid> 
 | 
                        <Grid item xs={3}> 
 | 
                            <PanelTypography 
 | 
                                title="table.field.matnr.isLabelMange"  
 | 
                                property={record.isLabelMange$} 
 | 
                            /> 
 | 
                        </Grid> 
 | 
                        <Grid item xs={3}> 
 | 
                            <PanelTypography 
 | 
                                title="table.field.matnr.safeQty"  
 | 
                                property={record.safeQty} 
 | 
                            /> 
 | 
                        </Grid> 
 | 
                        <Grid item xs={3}> 
 | 
                            <PanelTypography 
 | 
                                title="table.field.matnr.minQty"  
 | 
                                property={record.minQty} 
 | 
                            /> 
 | 
                        </Grid> 
 | 
                        <Grid item xs={3}> 
 | 
                            <PanelTypography 
 | 
                                title="table.field.matnr.maxQty"  
 | 
                                property={record.maxQty} 
 | 
                            /> 
 | 
                        </Grid> 
 | 
                        <Grid item xs={3}> 
 | 
                            <PanelTypography 
 | 
                                title="table.field.matnr.stagn"  
 | 
                                property={record.stagn} 
 | 
                            /> 
 | 
                        </Grid> 
 | 
                        <Grid item xs={3}> 
 | 
                            <PanelTypography 
 | 
                                title="table.field.matnr.valid"  
 | 
                                property={record.valid} 
 | 
                            /> 
 | 
                        </Grid> 
 | 
                        <Grid item xs={3}> 
 | 
                            <PanelTypography 
 | 
                                title="table.field.matnr.validWarn"  
 | 
                                property={record.validWarn} 
 | 
                            /> 
 | 
                        </Grid> 
 | 
                        <Grid item xs={3}> 
 | 
                            <PanelTypography 
 | 
                                title="table.field.matnr.flagCheck"  
 | 
                                property={record.flagCheck} 
 | 
                            /> 
 | 
                        </Grid> 
 | 
  
 | 
                    </Grid> 
 | 
                </CardContent> 
 | 
            </Card > 
 | 
        </> 
 | 
    ); 
 | 
}; 
 | 
  
 | 
export default MatnrPanel; 
 |