This commit is contained in:
seb
2026-09-30 21:58:28 +02:00
parent 2f2906b8b5
commit d6dea21f22
4 changed files with 169 additions and 3 deletions

View File

@@ -758,6 +758,7 @@ export class StorageManager extends ApiClient {
name: a.name,
eans: a.eans ?? [],
categories: Array.isArray(a.categoryIds) ? a.categoryIds.join(',') : null,
isFather: Boolean(a.isFather ?? a.is_father),
}));
}

View File

@@ -33,7 +33,7 @@ import { enqueueSnackbar } from 'notistack';
import { artikelDetailPath } from '../articleRoute';
import { article as articleApi } from '../../../api';
import attributeAutomat, { selectAttributes } from '../../../automats/attributeAutomat';
import artikelAutomat from '../../../automats/artikelAutomat';
import artikelAutomat, { getArticle } from '../../../automats/artikelAutomat';
import { notifyError } from '../../../utils/notify';
import { StorageManagerContext } from '../../../api/storageManagerContext';
@@ -352,6 +352,16 @@ export default class ArticleViewLists extends PureComponent {
return;
}
const isTargetFather = Boolean(
stuecklisteTargetArticle.isFather ||
stuecklisteTargetArticle.is_father ||
getArticle(stuecklisteTargetArticle.sku)?.isFather
);
if (isTargetFather) {
enqueueSnackbar('Ein Vaterartikel kann nicht als Komponente einer Stückliste hinzugefügt werden.', { variant: 'error' });
return;
}
const currentItems = Array.isArray(article.articlelist) ? article.articlelist : [];
const count = Math.max(1, Number(stuecklisteCount) || 1);
@@ -468,6 +478,16 @@ export default class ArticleViewLists extends PureComponent {
return;
}
const isTargetFather = Boolean(
optionTargetArticle.isFather ||
optionTargetArticle.is_father ||
getArticle(optionTargetArticle.sku)?.isFather
);
if (isTargetFather) {
enqueueSnackbar('Ein Vaterartikel kann nicht als Option hinzugefügt werden.', { variant: 'error' });
return;
}
const currentOptions = Array.isArray(article.options) ? article.options : [];
const count = Math.max(1, Number(optionCount) || 1);
@@ -1376,8 +1396,10 @@ export default class ArticleViewLists extends PureComponent {
(a) => !assignedAttributeIds.has(a.id)
);
// Filter available articles for Autocomplete (cannot select self)
const selectableOtherArticles = allArticles.filter((a) => a.sku !== articleData.sku);
// Filter available articles for Autocomplete (cannot select self, and cannot select father articles)
const selectableOtherArticles = allArticles.filter(
(a) => a.sku !== articleData.sku && !a.isFather && !a.is_father
);
// Find father attribute definition & values
const fatherAttrDef = isFather