New api and zone management; highligh occlusion and highlighAll functionality; improved search in reports and alerts history + autofill; refactored alert panel

This commit is contained in:
iv_vuytsik
2025-12-25 03:10:21 +03:00
parent 31030f2997
commit ce7e39debf
36 changed files with 1562 additions and 472 deletions

View File

@@ -10,11 +10,27 @@ import { useRouter } from 'next/navigation'
const transformRawToObjectData = (raw: any): ObjectData => {
const rawId = raw?.id ?? raw?.object_id ?? raw?.uuid ?? raw?.name
const object_id = typeof rawId === 'number' ? `object_${rawId}` : String(rawId ?? '')
// Если объект имеет числовой идентификатор, возвращаем его в виде строки с префиксом 'object_'
const deriveTitle = (): string => {
const t = (raw?.title || '').toString().trim()
if (t) return t
const idStr = String(rawId ?? '').toString()
const numMatch = typeof rawId === 'number'
? rawId
: (() => { const m = idStr.match(/\d+/); return m ? Number(m[0]) : undefined })()
if (typeof numMatch === 'number' && !Number.isNaN(numMatch)) {
return `Объект ${numMatch}`
}
// Если объект не имеет числовой идентификатор, возвращаем его строковый идентификатор
return idStr ? `Объект ${idStr}` : `Объект ${object_id}`
}
return {
object_id,
title: raw?.title ?? `Объект ${object_id}`,
title: deriveTitle(),
description: raw?.description ?? `Описание объекта ${raw?.title ?? object_id}`,
image: raw?.image ?? '/images/test_image.png',
image: raw?.image ?? null,
location: raw?.location ?? raw?.address ?? 'Не указано',
floors: Number(raw?.floors ?? 0),
area: String(raw?.area ?? ''),