This commit is contained in:
seb
2026-10-19 02:39:03 +02:00
parent 06d0dd3bb2
commit c84a504a5c

View File

@@ -5,7 +5,6 @@ import WarehouseIcon from '@mui/icons-material/Warehouse';
import EditOutlinedIcon from '@mui/icons-material/EditOutlined';
import LocalShippingOutlinedIcon from '@mui/icons-material/LocalShippingOutlined';
import Tooltip from '@mui/material/Tooltip';
import Chip from '@mui/material/Chip';
import { PanelTile } from 'dashgui/panels';
import { formatStock } from '../searchFormat';
import ArticleStockAdjustDialog from '../ArticleStockAdjustDialog';
@@ -145,40 +144,6 @@ export default class ArticleViewStock extends PureComponent {
this.setState({ adjustOpen: false });
}
renderIncomingChip(totalIncoming, incomingItems, unit) {
const tooltipText = `${formatStock(totalIncoming)}${unit ? ` ${unit}` : ''} im Zulauf aus ${
incomingItems.length === 1
? 'einer offenen Lieferung'
: `${incomingItems.length} offenen Lieferungen`
}`;
return (
<Tooltip title={tooltipText} arrow placement="top-start">
<Chip
size="small"
icon={
<LocalShippingOutlinedIcon
sx={{ fontSize: '14px !important', transform: 'scaleX(-1)' }}
/>
}
label={`+${formatStock(totalIncoming)}${unit ? ` ${unit}` : ''} im Zulauf`}
onClick={(e) => e.stopPropagation()}
sx={{
fontWeight: 600,
fontSize: '0.75rem',
height: 22,
backgroundColor: VEIL_PANEL,
cursor: 'default',
'& .MuiChip-icon': {
color: 'text.secondary',
ml: '6px',
},
}}
/>
</Tooltip>
);
}
render() {
const { article: articleData } = this.props;
const { adjustOpen } = this.state;
@@ -280,8 +245,8 @@ export default class ArticleViewStock extends PureComponent {
</Typography>
{isParent ? (
<Box sx={{ my: 0.75 }}>
{anyVariantTracksStock || totalVariantsStock > 0 ? (
anyVariantTracksStock || totalVariantsStock > 0 ? (
<Box sx={{ my: 0.75 }}>
<Typography
component="div"
sx={{
@@ -293,74 +258,12 @@ export default class ArticleViewStock extends PureComponent {
>
Alle Varianten zusammen: {formatStock(totalVariantsStock)}
</Typography>
) : null}
{hasIncoming ? (
<Box sx={{ mt: 0.75 }}>
{this.renderIncomingChip(totalIncoming, incomingItems, unit)}
</Box>
) : null}
</Box>
</Box>
) : null
) : isStueckliste ? (
<Box sx={{ my: 0.5 }}>
<Tooltip title="Virtueller Bestand – Anpassung erfolgt an den einzelnen Komponenten" arrow placement="top-start">
<Box>
<Box sx={{ display: 'inline-flex', alignItems: 'baseline', gap: 0.75 }}>
<Typography
component="div"
sx={{
fontSize: '2.4rem',
fontWeight: 700,
lineHeight: 1.1,
letterSpacing: '-0.02em',
color: totalStock > 0 ? 'text.primary' : 'text.secondary',
}}
>
{formatStock(totalStock)}
</Typography>
{unit ? (
<Typography
variant="body2"
color="text.secondary"
sx={{ fontWeight: 500 }}
>
{unit}
</Typography>
) : null}
</Box>
<Typography
variant="caption"
color="text.secondary"
sx={{ display: 'block', mt: 0.25 }}
>
Virtueller Bestand (aus Komponenten)
</Typography>
</Box>
</Tooltip>
{hasIncoming ? (
<Box sx={{ mt: 0.75 }}>
{this.renderIncomingChip(totalIncoming, incomingItems, unit)}
</Box>
) : null}
</Box>
) : isTrackStock ? (
<Box sx={{ my: 0.5 }}>
<Tooltip title="Klicken, um Bestand anzupassen" arrow placement="top-start">
<Box
onClick={this.handleOpenAdjust}
sx={{
display: 'inline-flex',
alignItems: 'baseline',
gap: 0.75,
cursor: 'pointer',
borderRadius: 1,
px: 0.5,
mx: -0.5,
transition: 'background-color 0.15s ease',
'&:hover': {
backgroundColor: TINT_ROW_HOVER,
},
}}
>
<Tooltip title="Virtueller Bestand – Anpassung erfolgt an den einzelnen Komponenten" arrow placement="top-start">
<Box sx={{ my: 0.5 }}>
<Box sx={{ display: 'inline-flex', alignItems: 'baseline', gap: 0.75 }}>
<Typography
component="div"
sx={{
@@ -383,18 +286,24 @@ export default class ArticleViewStock extends PureComponent {
</Typography>
) : null}
</Box>
</Tooltip>
{hasIncoming ? (
<Box sx={{ mt: 0.75 }}>
{this.renderIncomingChip(totalIncoming, incomingItems, unit)}
</Box>
) : null}
</Box>
) : (
<Box sx={{ my: 0.75 }}>
<Typography
variant="caption"
color="text.secondary"
sx={{ display: 'block', mt: 0.25 }}
>
Virtueller Bestand (aus Komponenten)
</Typography>
</Box>
</Tooltip>
) : isTrackStock ? (
<Tooltip title="Klicken, um Bestand anzupassen" arrow placement="top-start">
<Box
onClick={this.handleOpenAdjust}
sx={{
display: 'inline-flex',
alignItems: 'baseline',
gap: 0.75,
my: 0.5,
cursor: 'pointer',
borderRadius: 1,
px: 0.5,
@@ -408,27 +317,59 @@ export default class ArticleViewStock extends PureComponent {
<Typography
component="div"
sx={{
fontSize: '1.25rem',
fontSize: '2.4rem',
fontWeight: 700,
lineHeight: 1.2,
color: 'text.secondary',
lineHeight: 1.1,
letterSpacing: '-0.02em',
color: totalStock > 0 ? 'text.primary' : 'text.secondary',
}}
>
Keine Erfassung
</Typography>
<Typography
variant="caption"
color="text.secondary"
sx={{ display: 'block', mt: 0.25 }}
>
Bestand wird nicht überwacht
{formatStock(totalStock)}
</Typography>
{unit ? (
<Typography
variant="body2"
color="text.secondary"
sx={{ fontWeight: 500 }}
>
{unit}
</Typography>
) : null}
</Box>
{hasIncoming ? (
<Box sx={{ mt: 0.75 }}>
{this.renderIncomingChip(totalIncoming, incomingItems, unit)}
</Box>
) : null}
</Tooltip>
) : (
<Box
onClick={this.handleOpenAdjust}
sx={{
my: 0.75,
cursor: 'pointer',
borderRadius: 1,
px: 0.5,
mx: -0.5,
transition: 'background-color 0.15s ease',
'&:hover': {
backgroundColor: TINT_ROW_HOVER,
},
}}
>
<Typography
component="div"
sx={{
fontSize: '1.25rem',
fontWeight: 700,
lineHeight: 1.2,
color: 'text.secondary',
}}
>
Keine Erfassung
</Typography>
<Typography
variant="caption"
color="text.secondary"
sx={{ display: 'block', mt: 0.25 }}
>
Bestand wird nicht überwacht
</Typography>
</Box>
)}
</Box>