fix(web): reconocer Instalación de superficie en ficha compacta
This commit is contained in:
@@ -78,6 +78,14 @@ function hasAttributeValue(definition: AssetAttributeDefinition, value: unknown)
|
|||||||
return value !== undefined && value !== null && String(value).trim() !== '';
|
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() {
|
export function AssetEditorPage() {
|
||||||
const { id } = useParams();
|
const { id } = useParams();
|
||||||
const editing = Boolean(id);
|
const editing = Boolean(id);
|
||||||
@@ -343,9 +351,15 @@ export function AssetEditorPage() {
|
|||||||
? 'companies'
|
? 'companies'
|
||||||
: 'territory';
|
: 'territory';
|
||||||
|
|
||||||
const structuralTypeCode = selectedType?.code.trim().toLowerCase() ?? '';
|
const structuralTypeCode = normalizeStructuralType(selectedType?.code);
|
||||||
const compactStructuralSummary = editing
|
const structuralTypeName = normalizeStructuralType(selectedType?.name);
|
||||||
&& (structuralTypeCode === 'instalacion' || structuralTypeCode === 'subinstalacion');
|
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(
|
const technicalFilledCount = definitions.filter(
|
||||||
(definition) => hasAttributeValue(definition, attributeValues[definition.id]),
|
(definition) => hasAttributeValue(definition, attributeValues[definition.id]),
|
||||||
|
|||||||
Reference in New Issue
Block a user