import type { IConsolidation } from '../../types/consolidations/consolidations'; import { quarterShortLabel } from '../../utils/labels'; /** Подпись консолидации у файла в режиме «Все документы организации» (design D-4): null — файл текущей консоли. */ export function consolidationLabel( fileConsolidationId: string | null, consolidations: IConsolidation[], currentConsolidationId: string | null, ): string | null { if (fileConsolidationId === null) return 'вне консолидации'; if (fileConsolidationId === currentConsolidationId) return null; const found = consolidations.find((c) => c.consolidation_id === fileConsolidationId); return found ? `${found.year} ${quarterShortLabel(found.quarter)}` : 'другая консолидация'; }