This commit is contained in:
seb
2026-10-08 22:44:51 +02:00
parent 22063e6944
commit ee93f71b27
11 changed files with 1047 additions and 67 deletions

View File

@@ -199,19 +199,49 @@ class ManifestFormLine extends PureComponent {
renderField(column, colIdx, totalCols) {
const { id, align, type } = column;
const { line, saving, onChange } = this.props;
const { line, saving, onChange, columns } = this.props;
if (id === 'pos') {
const posVal =
this.props.positionIndex ??
(this.props.index != null ? this.props.index + 1 : colIdx + 1);
return (
<Box
sx={{
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
height: '100%',
minHeight: 38,
fontWeight: 700,
fontSize: '0.82rem',
color: 'text.secondary',
userSelect: 'none',
}}
>
{posVal}
</Box>
);
}
let val = line[id];
if (val == null || val === '') {
if (id === 'tax' || id === 'taxrate') {
val = line.taxrate ?? line.tax ?? '';
} else if (id === 'net' || id === 'netprice') {
val = line.netprice ?? line.net ?? '';
} else if (id === 'gross') {
const netNum = parseNum(line.netprice ?? line.net);
const taxNum = parseNum(line.taxrate ?? line.tax) ?? 0;
if (netNum != null) {
val = String(Math.round((netNum * (1 + taxNum / 100) + Number.EPSILON) * 100) / 100);
}
}
}
let isError = false;
if (id === 'name') {
isError = !String(line.name ?? '').trim();
isError = !String(line.name ?? '').trim() && !String(line.sku ?? '').trim();
} else if (id === 'amount') {
const raw = getFirstVal(line.amount, line.count);
isError = raw == null || parseNum(raw) == null;
@@ -224,11 +254,15 @@ class ManifestFormLine extends PureComponent {
} else if (id === 'net' || id === 'netprice') {
const raw = getFirstVal(line.net, line.netprice, line.netPrice, line.eknetto);
isError = raw == null || parseNum(raw) == null;
} else if (id === 'gross') {
const raw = getFirstVal(line.gross, val);
isError = raw == null || parseNum(raw) == null;
} else if (id === 'sku') {
isError = !String(line.sku ?? '').trim() && !String(line.name ?? '').trim();
}
const isFirst = colIdx === 0;
const hasPosCol = columns?.[0]?.id === 'pos';
const isFirstInput = hasPosCol ? colIdx === 1 : colIdx === 0;
const isLast = colIdx === totalCols - 1;
return (
@@ -252,8 +286,8 @@ class ManifestFormLine extends PureComponent {
}}
sx={{
'& .MuiOutlinedInput-root': {
borderRadius: isFirst ? '4px 0 0 4px' : isLast ? '0 4px 4px 0' : 0,
ml: isFirst ? 0 : '-1px',
borderRadius: isFirstInput ? '4px 0 0 4px' : isLast ? '0 4px 4px 0' : 0,
ml: isFirstInput ? 0 : '-1px',
'&:hover': {
zIndex: 1,
},
@@ -285,7 +319,9 @@ class ManifestFormLine extends PureComponent {
}
renderArticleSecondLine(rawSku) {
const { loading } = this.props;
const { loading, kind, columns } = this.props;
const isOrder = kind === 'order';
const hasNameColumn = columns?.some((c) => c.id === 'name');
const { cachedArticle, loadingArticle } = this.state;
if (loading || loadingArticle) {
@@ -393,8 +429,8 @@ class ManifestFormLine extends PureComponent {
/>
)}
{/* Article Name */}
{cachedArticle.name && (
{/* Article Name: omit if already editable in line 1 or if kind is order */}
{!hasNameColumn && !isOrder && cachedArticle.name && (
<Typography
variant="caption"
fontWeight={600}
@@ -406,8 +442,8 @@ class ManifestFormLine extends PureComponent {
</Typography>
)}
{/* Primary EAN */}
{primaryEan && (
{/* Primary EAN: omit for order */}
{!isOrder && primaryEan && (
<Typography
variant="caption"
color="text.secondary"
@@ -424,8 +460,8 @@ class ManifestFormLine extends PureComponent {
</Typography>
)}
{/* VK Netto & VK Brutto */}
{(vkNetto != null || vkBrutto != null) && (
{/* VK Netto & VK Brutto: omit end on 2nd line for order */}
{!isOrder && (vkNetto != null || vkBrutto != null) && (
<Box
sx={{
display: 'flex',
@@ -779,7 +815,9 @@ class ManifestFormLine extends PureComponent {
)}
<HelpOutlineIcon sx={{ fontSize: 15, color: 'warning.main' }} />
<Typography variant="caption" color="text.secondary" sx={{ fontSize: '0.72rem' }}>
Kein Lieferanten-Artikel für SKU &bdquo;{rawSku}&ldquo; gefunden.
{this.props.kind === 'delivery'
? `Kein Lieferanten-Artikel für SKU „${rawSku}“ gefunden.`
: `Kein Artikel für SKU „${rawSku}“ gefunden.`}
</Typography>
{this.renderLedgerChip()}
</Box>