diff --git a/web-v2/src/pages/AssetEditorPage.tsx b/web-v2/src/pages/AssetEditorPage.tsx index 5dcb14b..489661a 100644 --- a/web-v2/src/pages/AssetEditorPage.tsx +++ b/web-v2/src/pages/AssetEditorPage.tsx @@ -78,6 +78,14 @@ function hasAttributeValue(definition: AssetAttributeDefinition, value: unknown) return value !== undefined && value !== null && String(value).trim() !== ''; } +function normalizeStructuralType(value: string | null | undefined): string { + return (value ?? '') + .normalize('NFD') + .replace(/[\u0300-\u036f]/g, '') + .trim() + .toLowerCase(); +} + export function AssetEditorPage() { const { id } = useParams(); const editing = Boolean(id); @@ -343,9 +351,15 @@ export function AssetEditorPage() { ? 'companies' : 'territory'; - const structuralTypeCode = selectedType?.code.trim().toLowerCase() ?? ''; - const compactStructuralSummary = editing - && (structuralTypeCode === 'instalacion' || structuralTypeCode === 'subinstalacion'); + const structuralTypeCode = normalizeStructuralType(selectedType?.code); + const structuralTypeName = normalizeStructuralType(selectedType?.name); + const compactStructuralSummary = editing && ( + ['instalacion', 'instalacion-superficie', 'instalacion_de_superficie', 'instalacion-de-superficie', 'subinstalacion'] + .includes(structuralTypeCode) + || structuralTypeName === 'instalacion' + || structuralTypeName === 'instalacion de superficie' + || structuralTypeName === 'subinstalacion' + ); const technicalFilledCount = definitions.filter( (definition) => hasAttributeValue(definition, attributeValues[definition.id]),