From 479cac85a56df8d98f3ffaf0e7ec3fdead9b0178 Mon Sep 17 00:00:00 2001 From: seb Date: Sun, 18 Oct 2026 22:01:56 +0200 Subject: [PATCH] u --- src/components/manifest/ManifestFormLine.jsx | 88 +++++++++++++++++++- 1 file changed, 86 insertions(+), 2 deletions(-) diff --git a/src/components/manifest/ManifestFormLine.jsx b/src/components/manifest/ManifestFormLine.jsx index 04e4ee3..d501604 100644 --- a/src/components/manifest/ManifestFormLine.jsx +++ b/src/components/manifest/ManifestFormLine.jsx @@ -22,6 +22,7 @@ import LinkOffOutlinedIcon from '@mui/icons-material/LinkOffOutlined'; import { getFirstVal, parseNum, LINE_COLUMNS } from './manifestConfig'; import ArticlePhoto from '../article/ArticlePhoto'; import { formatPrice, grossFromNet } from '../../utils/price'; +import { formatStock } from '../article/searchFormat'; import { primaryPrice, priceBrutto } from '../../utils/articleDetail'; import artikelAutomat, { createArticleSelector, getArticle } from '../../automats/artikelAutomat'; import { artikelDetailPath } from '../article/articleRoute'; @@ -598,6 +599,20 @@ class ManifestFormLine extends PureComponent { const hasPriceInfo = vkNetto != null || vkBrutto != null || ekNetto != null || ekBrutto != null || kind === 'quote' || kind === 'order'; + const rawWarehouses = Array.isArray(cachedArticle.warehouses) ? cachedArticle.warehouses : []; + const isTracked = cachedArticle.track_stock ?? cachedArticle.trackStock ?? (rawWarehouses.length > 0); + const stockVal = isTracked === false + ? null + : (cachedArticle.stock != null && !Number.isNaN(Number(cachedArticle.stock)) + ? Number(cachedArticle.stock) + : (rawWarehouses.length > 0 || isTracked + ? rawWarehouses.reduce((sum, wh) => sum + (Number(wh.stock) || 0), 0) + : null)); + const warehouseTooltip = rawWarehouses.length > 0 + ? rawWarehouses.map((w) => `${w.name || 'Lager'}: ${formatStock(w.stock)}`).join(' · ') + : (isTracked === false ? 'Keine Bestandsführung' : undefined); + const lineAmount = parseNum(getFirstVal(this.props.line?.amount, this.props.line?.menge)) ?? 0; + return ( + {/* Bestand */} + + stockVal + ? 'warning.main' + : 'text.secondary', + fontSize: '0.72rem', + }} + > + Bestand: {isTracked === false ? '∞' : formatStock(stockVal)} + + + {/* Marge */} 0); + const deliveryStockVal = isDeliveryTracked === false + ? null + : (fullArticle.stock != null && !Number.isNaN(Number(fullArticle.stock)) + ? Number(fullArticle.stock) + : (rawWarehouses.length > 0 || isDeliveryTracked + ? rawWarehouses.reduce((sum, wh) => sum + (Number(wh.stock) || 0), 0) + : null)); + const deliveryWarehouseTooltip = rawWarehouses.length > 0 + ? rawWarehouses.map((w) => `${w.name || 'Lager'}: ${formatStock(w.stock)}`).join(' · ') + : (isDeliveryTracked === false ? 'Keine Bestandsführung' : undefined); + return ( )} - {/* Stored Purchase Price (Netto), VK Netto & VK Brutto */} - {(priceNet != null || vkNetto != null || vkBrutto != null) && ( + {/* Stored Purchase Price (Netto), VK Netto, VK Brutto, Marge & Bestand */} + {(priceNet != null || vkNetto != null || vkBrutto != null || deliveryStockVal != null) && ( + {/* Bestand */} + + + Bestand: {isDeliveryTracked === false ? '∞' : formatStock(deliveryStockVal)} + + + {/* Marge */} {margeDelivery != null && (