This commit is contained in:
seb
2026-10-15 03:32:41 +02:00
parent 954f276404
commit 9817d4abda

View File

@@ -50,7 +50,7 @@ export function createDummyTestQuote() {
id: 999999,
number: maxNumber,
date: '2030-10-30T12:00:00Z',
customerName: 'Testkunde (Mustermann GmbH)',
customerName: 'Kunde',
positions: 999,
grossTotal: 30000.90,
files: [
@@ -76,17 +76,6 @@ export function createDummyTestQuote() {
thumby: 200,
skeledash: '6w5VujjmxhSpoO8VSwebe2yXU3Tj4108PysbXPqoHmyYcs9oXH8z6npbrjwK90StUBOXY0LLPiDgZy9qjYjkFDVKSjUp3dcWQ',
},
{
id: 99993,
manifestId: 999999,
fileId: 99993,
name: 'skizze-entwurf.pdf',
mimetype: 'application/pdf',
size: 8900,
thumbx: 141,
thumby: 200,
skeledash: '6w5VujjmxhSpoO8VSwebe2yXU3Tj4108PysbXPqoHmyYcs9oXH8z6npbrjwK90StUBOXY0LLPiDgZy9qjYjkFDVKSjUp3dcWQ',
}
],
};
}
@@ -102,33 +91,51 @@ const rowGridSx = {
const ellipsisSx = { overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' };
const measuringCellSx = {
border: '1px dashed #1976d2',
opacity: 0.55,
boxSizing: 'border-box',
pointerEvents: 'none',
textTransform: 'none',
letterSpacing: 'normal',
};
const headerCellSx = {
color: 'text.secondary',
typography: 'caption',
fontWeight: 600,
textTransform: 'uppercase',
letterSpacing: '0.04em',
userSelect: 'none',
};
function renderInvisibleDummyRow(dummy) {
if (!dummy) return null;
const d = dummy || createDummyTestQuote();
return (
<>
<Box aria-hidden sx={{ gridColumn: 1, gridRow: 1, visibility: 'hidden', height: 0, overflow: 'hidden', whiteSpace: 'nowrap', pointerEvents: 'none' }}>
<Typography variant="body1" sx={{ fontWeight: 600 }}>{dummy.number}</Typography>
<Box aria-hidden sx={{ gridColumn: 1, gridRow: 1, whiteSpace: 'nowrap', ...measuringCellSx }}>
<Typography variant="body1" sx={{ fontWeight: 600 }}>{d.number}</Typography>
</Box>
<Box aria-hidden sx={{ gridColumn: 2, gridRow: 1, visibility: 'hidden', height: 0, overflow: 'hidden', whiteSpace: 'nowrap', pointerEvents: 'none' }}>
<Typography variant="body2">{dummy.date ? formatDate(dummy.date) : '–'}</Typography>
<Box aria-hidden sx={{ gridColumn: 2, gridRow: 1, whiteSpace: 'nowrap', ...measuringCellSx }}>
<Typography variant="body2">{d.date ? formatDate(d.date) : '–'}</Typography>
</Box>
<Box aria-hidden sx={{ gridColumn: 3, gridRow: 1, visibility: 'hidden', height: 0, overflow: 'hidden', whiteSpace: 'nowrap', pointerEvents: 'none' }}>
<Typography variant="body1">{dummy.customerName}</Typography>
<Box aria-hidden sx={{ gridColumn: 3, gridRow: 1, whiteSpace: 'nowrap', ...measuringCellSx }}>
<Typography variant="body1">{d.customerName}</Typography>
</Box>
<Box aria-hidden sx={{ gridColumn: 4, gridRow: 1, visibility: 'hidden', height: 0, overflow: 'hidden', pointerEvents: 'none' }}>
<Chip size="small" label={dummy.positions} sx={{ height: 24, '& .MuiChip-label': { px: 0.5 } }} />
<Box aria-hidden sx={{ gridColumn: 4, gridRow: 1, display: 'flex', justifyContent: 'center', ...measuringCellSx }}>
<Chip size="small" label={d.positions} sx={{ height: 24, '& .MuiChip-label': { px: 0.5 } }} />
</Box>
<Box aria-hidden sx={{ gridColumn: 5, gridRow: 1, visibility: 'hidden', height: 0, overflow: 'hidden', display: 'flex', gap: '3px', pointerEvents: 'none' }}>
{[0, 1, 2, 3].map((i) => (
<Box key={i} sx={{ width: 15, height: 20, flexShrink: 0 }} />
<Box aria-hidden sx={{ gridColumn: 5, gridRow: 1, display: 'flex', gap: '3px', alignItems: 'center', whiteSpace: 'nowrap', ...measuringCellSx }}>
{(d.files || []).map((file, i) => (
<Box key={file.id ?? file.fileId ?? i} sx={{ width: 15, height: 20, flexShrink: 0, bgcolor: 'primary.light', borderRadius: 0.5 }} />
))}
</Box>
<Box aria-hidden sx={{ gridColumn: 6, gridRow: 1, visibility: 'hidden', height: 0, overflow: 'hidden', whiteSpace: 'nowrap', pointerEvents: 'none' }}>
<Box aria-hidden sx={{ gridColumn: 6, gridRow: 1, whiteSpace: 'nowrap', display: 'flex', justifyContent: 'flex-end', ...measuringCellSx }}>
<Typography variant="body2" sx={{ fontWeight: 600, fontVariantNumeric: 'tabular-nums' }}>
{formatPrice(dummy.grossTotal)}
{formatPrice(d.grossTotal)}
</Typography>
</Box>
<Box aria-hidden sx={{ gridColumn: 7, gridRow: 1, visibility: 'hidden', height: 0, overflow: 'hidden', pointerEvents: 'none' }}>
<Box aria-hidden sx={{ gridColumn: 7, gridRow: 1, display: 'flex', justifyContent: 'center', ...measuringCellSx }}>
<IconButton sx={{ width: 40, height: 40 }} />
</Box>
</>
@@ -169,15 +176,15 @@ class QuoteRow extends PureComponent {
);
}
return (
<ListItemButton disabled divider sx={{ ...rowGridSx, height: 64, minHeight: 64, maxHeight: 64, px: 2, py: 0 }}>
<ListItemButton disabled divider sx={{ ...rowGridSx, minHeight: 64, px: 2, py: 0.5 }}>
{renderInvisibleDummyRow(dummy)}
<Box sx={{ gridColumn: 1, gridRow: 2 }}><Skeleton variant="text" width="90%" height={20} /></Box>
<Box sx={{ gridColumn: 2, gridRow: 2 }}><Skeleton variant="text" width="90%" height={20} /></Box>
<Box sx={{ gridColumn: 3, gridRow: 2 }}><Skeleton variant="text" width="60%" height={20} /></Box>
<Box sx={{ gridColumn: 4, gridRow: 2, display: 'flex', justifyContent: 'center' }}><Skeleton variant="rounded" width={28} height={20} /></Box>
<Box sx={{ gridColumn: 5, gridRow: 2, display: 'flex', alignItems: 'center', gap: '3px' }}><Skeleton variant="rounded" width={15} height={20} /></Box>
<Box sx={{ gridColumn: 6, gridRow: 2, display: 'flex', justifyContent: 'flex-end' }}><Skeleton variant="text" width="80%" height={20} /></Box>
<Box sx={{ gridColumn: 7, gridRow: 2 }} />
<Box sx={{ gridColumn: 1, gridRow: 2, border: '1px solid red' }}><Skeleton variant="text" width="90%" height={20} /></Box>
<Box sx={{ gridColumn: 2, gridRow: 2, border: '1px solid red' }}><Skeleton variant="text" width="90%" height={20} /></Box>
<Box sx={{ gridColumn: 3, gridRow: 2, border: '1px solid red' }}><Skeleton variant="text" width="60%" height={20} /></Box>
<Box sx={{ gridColumn: 4, gridRow: 2, display: 'flex', justifyContent: 'center', border: '1px solid red' }}><Skeleton variant="rounded" width={28} height={20} /></Box>
<Box sx={{ gridColumn: 5, gridRow: 2, display: 'flex', alignItems: 'center', gap: '3px', border: '1px solid red' }}><Skeleton variant="rounded" width={15} height={20} /></Box>
<Box sx={{ gridColumn: 6, gridRow: 2, display: 'flex', justifyContent: 'flex-end', border: '1px solid red' }}><Skeleton variant="text" width="80%" height={20} /></Box>
<Box sx={{ gridColumn: 7, gridRow: 2, border: '1px solid red' }} />
</ListItemButton>
);
}
@@ -192,31 +199,31 @@ class QuoteRow extends PureComponent {
return (
<ListItemButton
divider
sx={{ ...rowGridSx, height: 64, minHeight: 64, maxHeight: 64, px: 2, py: 0 }}
sx={{ ...rowGridSx, minHeight: 64, px: 2, py: 0.5 }}
onClick={disabled ? undefined : () => onOpen?.(quote)}
disabled={disabled}
>
{renderInvisibleDummyRow(dummy)}
<Box sx={{ gridColumn: 1, gridRow: 2, minWidth: 0, overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }}>
<Box sx={{ gridColumn: 1, gridRow: 2, minWidth: 0, overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap', border: '1px solid red' }}>
<Typography variant="body1" sx={{ fontWeight: 600, ...ellipsisSx }}>
{quote.number}
</Typography>
</Box>
<Box sx={{ gridColumn: 2, gridRow: 2, minWidth: 0, overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }}>
<Box sx={{ gridColumn: 2, gridRow: 2, minWidth: 0, overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap', border: '1px solid red' }}>
<Typography variant="body2" color="text.secondary" sx={ellipsisSx}>
{quote.date ? formatDate(quote.date) : '–'}
</Typography>
</Box>
<Box sx={{ gridColumn: 3, gridRow: 2, minWidth: 0, overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }}>
<Box sx={{ gridColumn: 3, gridRow: 2, minWidth: 0, overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap', border: '1px solid red' }}>
<Typography variant="body1" sx={{ fontWeight: 500, ...ellipsisSx }}>
{customer}
</Typography>
</Box>
<Box sx={{ gridColumn: 4, gridRow: 2, display: 'flex', justifyContent: 'center' }}>
<Box sx={{ gridColumn: 4, gridRow: 2, display: 'flex', justifyContent: 'center', border: '1px solid red' }}>
<Chip
size="small"
label={posCount}
@@ -233,7 +240,7 @@ class QuoteRow extends PureComponent {
/>
</Box>
{/* Files / Attachments column after Pos.: space for 4 per row, 2 lines max */}
{/* Files / Attachments column after Pos.: space for 2 per row, 2 lines max (up to 4 thumbnails) */}
<Box
sx={{
gridColumn: 5,
@@ -244,9 +251,12 @@ class QuoteRow extends PureComponent {
gap: '3px',
maxHeight: 44,
overflow: 'hidden',
width: 0,
minWidth: '100%',
border: '1px solid red',
}}
>
{files.slice(0, 8).map((file, index) => {
{files.slice(0, 4).map((file, index) => {
const fileId = file.fileId ?? file.id;
const title = file.name ? `${file.name} (Öffnen)` : 'Datei öffnen';
return (
@@ -305,7 +315,7 @@ class QuoteRow extends PureComponent {
})}
</Box>
<Box sx={{ gridColumn: 6, gridRow: 2, display: 'flex', justifyContent: 'flex-end' }}>
<Box sx={{ gridColumn: 6, gridRow: 2, display: 'flex', justifyContent: 'flex-end', border: '1px solid red' }}>
<Typography
variant="body2"
sx={{ fontWeight: 600, fontVariantNumeric: 'tabular-nums', textAlign: 'right', whiteSpace: 'nowrap' }}
@@ -314,7 +324,7 @@ class QuoteRow extends PureComponent {
</Typography>
</Box>
<Box sx={{ gridColumn: 7, gridRow: 2, display: 'flex', justifyContent: 'center' }}>
<Box sx={{ gridColumn: 7, gridRow: 2, display: 'flex', justifyContent: 'center', border: '1px solid red' }}>
<IconButton
aria-label={`„${quote.number}“ löschen`}
disabled={busyId != null || disabled}
@@ -673,27 +683,21 @@ export class QuoteList extends PureComponent {
<Box
sx={{
...rowGridSx,
height: 36,
minHeight: 36,
px: 2,
py: 0.5,
borderBottom: '1px solid',
borderColor: 'divider',
color: 'text.secondary',
typography: 'caption',
fontWeight: 600,
textTransform: 'uppercase',
letterSpacing: '0.04em',
userSelect: 'none',
}}
>
{renderInvisibleDummyRow(this.headerItem)}
<Box sx={{ gridColumn: 1, gridRow: 2 }}>Nr.</Box>
<Box sx={{ gridColumn: 2, gridRow: 2 }}>Datum</Box>
<Box sx={{ gridColumn: 3, gridRow: 2 }}>Kunde</Box>
<Box sx={{ gridColumn: 4, gridRow: 2, textAlign: 'center' }}>Pos.</Box>
<Box sx={{ gridColumn: 5, gridRow: 2, textAlign: 'center' }}>Dateien</Box>
<Box sx={{ gridColumn: 6, gridRow: 2, textAlign: 'right' }}>Gesamt</Box>
<Box sx={{ gridColumn: 7, gridRow: 2 }} />
<Box sx={{ gridColumn: 1, gridRow: 2, ...headerCellSx, border: '1px solid red' }}>Nr.</Box>
<Box sx={{ gridColumn: 2, gridRow: 2, ...headerCellSx, border: '1px solid red' }}>Datum</Box>
<Box sx={{ gridColumn: 3, gridRow: 2, ...headerCellSx, border: '1px solid red' }}>Kunde</Box>
<Box sx={{ gridColumn: 4, gridRow: 2, display: 'flex', justifyContent: 'center', textAlign: 'center', ...headerCellSx, border: '1px solid red' }}>Pos.</Box>
<Box sx={{ gridColumn: 5, gridRow: 2, textAlign: 'left', minWidth: 0, overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap', ...headerCellSx, border: '1px solid red' }}></Box>
<Box sx={{ gridColumn: 6, gridRow: 2, textAlign: 'right', ...headerCellSx, border: '1px solid red' }}>Gesamt</Box>
<Box sx={{ gridColumn: 7, gridRow: 2, ...headerCellSx, border: '1px solid red' }} />
</Box>
}
onPageChange={this.handlePageChange}