Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e18e86e918 | ||
|
|
cadf766d3c |
@@ -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]),
|
||||
|
||||
Reference in New Issue
Block a user