import { Table, Typography } from 'antd'; import type { ColumnsType } from 'antd/es/table'; import type { GoodwillTotals } from '../../../types/goodwill/goodwill'; import { type GoodwillTreeRow, type MoneyKey, formatMoney } from '../ConsolidationGoodwillTable/config'; const { Text } = Typography; const MONEY_KEYS = new Set(['financial_investment_amount', 'participation_amount', 'charter_capital_amount', 'goodwill_amount']); interface ConsolidationGoodwillSummaryI { totals: GoodwillTotals | null; columns: ColumnsType; units: string; decimals: number; } /** «Итого по листу» — `totals` ответа (по действующим строкам, P и G — по отмеченным). */ export const ConsolidationGoodwillSummary: React.FC = ({ totals, columns, units, decimals }) => { if (!totals) return null; return ( {columns.map((col, index) => { const key = String(col.key); if (key === 'name') { return ( Итого по листу ); } if (MONEY_KEYS.has(key)) { return ( {formatMoney(totals[key as MoneyKey], units, decimals)} ); } return ( — ); })} ); };