u
This commit is contained in:
@@ -20,15 +20,15 @@ export default class ArticleAttributesTab extends PureComponent {
|
||||
return this.props.article || getArticle(this.props.sku);
|
||||
}
|
||||
|
||||
isFatherVariantAttribute(attr) {
|
||||
isParentVariantAttribute(attr) {
|
||||
const article = this.getArticle();
|
||||
const isFather = Boolean(article?.isFather ?? article?.is_father);
|
||||
if (!isFather || !attr) return false;
|
||||
const fatherAttrId = article?.fatherAttributeNameId ?? article?.attributeNameId ?? null;
|
||||
if (fatherAttrId != null && Number(attr.id) === Number(fatherAttrId)) return true;
|
||||
const isParent = Boolean(article?.isParent ?? article?.is_parent);
|
||||
if (!isParent || !attr) return false;
|
||||
const parentAttrId = article?.parentAttributeNameId ?? article?.attributeNameId ?? null;
|
||||
if (parentAttrId != null && Number(attr.id) === Number(parentAttrId)) return true;
|
||||
if (
|
||||
article?.fatherAttributeName &&
|
||||
String(attr.name).trim().toLowerCase() === String(article.fatherAttributeName).trim().toLowerCase()
|
||||
article?.parentAttributeName &&
|
||||
String(attr.name).trim().toLowerCase() === String(article.parentAttributeName).trim().toLowerCase()
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
@@ -41,16 +41,16 @@ export default class ArticleAttributesTab extends PureComponent {
|
||||
const initialProperties = selectProperties() || [];
|
||||
|
||||
const article = props.article || getArticle(props.sku);
|
||||
const isFather = Boolean(article?.isFather ?? article?.is_father);
|
||||
const fatherAttrId = article?.fatherAttributeNameId ?? article?.attributeNameId ?? null;
|
||||
const fatherAttrName = article?.fatherAttributeName;
|
||||
const isParent = Boolean(article?.isParent ?? article?.is_parent);
|
||||
const parentAttrId = article?.parentAttributeNameId ?? article?.attributeNameId ?? null;
|
||||
const parentAttrName = article?.parentAttributeName;
|
||||
|
||||
const selectableAttrs = initialAttributes.filter((a) => {
|
||||
if (!isFather) return true;
|
||||
if (fatherAttrId != null && Number(a.id) === Number(fatherAttrId)) return false;
|
||||
if (!isParent) return true;
|
||||
if (parentAttrId != null && Number(a.id) === Number(parentAttrId)) return false;
|
||||
if (
|
||||
fatherAttrName &&
|
||||
String(a.name).trim().toLowerCase() === String(fatherAttrName).trim().toLowerCase()
|
||||
parentAttrName &&
|
||||
String(a.name).trim().toLowerCase() === String(parentAttrName).trim().toLowerCase()
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
@@ -231,7 +231,7 @@ export default class ArticleAttributesTab extends PureComponent {
|
||||
if (effectiveKey.startsWith('attr-')) {
|
||||
const attrId = Number(effectiveKey.replace('attr-', ''));
|
||||
const targetAttr = selectableAttributes.find((a) => a.id === attrId);
|
||||
if (!targetAttr || this.isFatherVariantAttribute(targetAttr)) return;
|
||||
if (!targetAttr || this.isParentVariantAttribute(targetAttr)) return;
|
||||
|
||||
const effectiveItemId = targetAttr.values?.some((v) => v.id === selectedItemId)
|
||||
? selectedItemId
|
||||
@@ -411,7 +411,7 @@ export default class ArticleAttributesTab extends PureComponent {
|
||||
merkmalOptions.find((m) => m.key === selectedMerkmalKey) ?? merkmalOptions[0] ?? null;
|
||||
const currentMerkmalKey = selectedOption?.key ?? '';
|
||||
const isAttr = selectedOption?.type === 'attr';
|
||||
const isVariantBlocked = isAttr && this.isFatherVariantAttribute(selectedOption);
|
||||
const isVariantBlocked = isAttr && this.isParentVariantAttribute(selectedOption);
|
||||
const availableItems = selectedOption?.values || [];
|
||||
const currentItemId = isAttr
|
||||
? (availableItems.some((v) => v.id === selectedItemId)
|
||||
|
||||
@@ -207,7 +207,7 @@ export default class ArticleSupplierTab extends PureComponent {
|
||||
busyId,
|
||||
} = this.state;
|
||||
|
||||
if (this.props.article?.isFather) {
|
||||
if (this.props.article?.isParent) {
|
||||
return (
|
||||
<Box
|
||||
sx={{
|
||||
|
||||
Reference in New Issue
Block a user