This commit is contained in:
seb
2026-10-01 08:16:17 +02:00
parent 359efc6481
commit 6ea4f8fb36
3 changed files with 53 additions and 7 deletions

View File

@@ -97,6 +97,11 @@ export default class ArticleSearchDialog extends PureComponent {
const { onAssign, line } = this.props;
if (!onAssign || !article?.sku) return;
if (article.isFather || article.is_father) {
this.setState({ error: 'Ein Vaterartikel kann nicht auf Belege gebucht werden.' });
return;
}
this.setState({ assigningSku: article.sku, error: null });
try {
await onAssign(article, line);
@@ -112,9 +117,10 @@ export default class ArticleSearchDialog extends PureComponent {
const { open, onClose, line } = this.props;
const { query, articles, loading, error, assigningSku } = this.state;
const bookableArticles = articles.filter((a) => !a.isFather && !a.is_father);
const trimmed = query.trim().toLowerCase();
const filtered = trimmed
? articles.filter((a) => {
? bookableArticles.filter((a) => {
const skuMatch = a.sku?.toLowerCase().includes(trimmed);
const nameMatch = a.name?.toLowerCase().includes(trimmed);
const eanMatch = Array.isArray(a.eans)
@@ -122,7 +128,7 @@ export default class ArticleSearchDialog extends PureComponent {
: false;
return skuMatch || nameMatch || eanMatch;
})
: articles.slice(0, 50);
: bookableArticles.slice(0, 50);
const rawSku = line?.sku != null ? String(line.sku).trim() : '';