Суммы null — прочерк, ноль — 0,00; «Нет вложений» серым без чекбокса; предупреждения иконкой с подсказкой; итоги «Всего» и «Итого по листу» из groups/totals ответа; в режиме редактирования — предпросмотр P/G, проверка доли (два знака, без обрезки) и комментария, групповой чекбокс по действующим строкам блока с indeterminate; сохранение одним пакетом изменённых строк, ошибка 422 подсвечивает поле своей строки; переключатель «Учитывать гудвилл в КФО»; фильтр «Нулевые»; экспорт с текущим фильтром. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
49 lines
1.6 KiB
TypeScript
49 lines
1.6 KiB
TypeScript
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<string>(['financial_investment_amount', 'participation_amount', 'charter_capital_amount', 'goodwill_amount']);
|
||
|
||
interface ConsolidationGoodwillSummaryI {
|
||
totals: GoodwillTotals | null;
|
||
columns: ColumnsType<GoodwillTreeRow>;
|
||
units: string;
|
||
decimals: number;
|
||
}
|
||
|
||
/** «Итого по листу» — `totals` ответа (по действующим строкам, P и G — по отмеченным). */
|
||
export const ConsolidationGoodwillSummary: React.FC<ConsolidationGoodwillSummaryI> = ({ totals, columns, units, decimals }) => {
|
||
if (!totals) return null;
|
||
return (
|
||
<Table.Summary fixed>
|
||
<Table.Summary.Row className='resRow'>
|
||
{columns.map((col, index) => {
|
||
const key = String(col.key);
|
||
if (key === 'name') {
|
||
return (
|
||
<Table.Summary.Cell key={key} index={index}>
|
||
<Text strong>Итого по листу</Text>
|
||
</Table.Summary.Cell>
|
||
);
|
||
}
|
||
if (MONEY_KEYS.has(key)) {
|
||
return (
|
||
<Table.Summary.Cell key={key} index={index} align='right'>
|
||
<Text strong>{formatMoney(totals[key as MoneyKey], units, decimals)}</Text>
|
||
</Table.Summary.Cell>
|
||
);
|
||
}
|
||
return (
|
||
<Table.Summary.Cell key={key} index={index} align='center'>
|
||
<Text strong>—</Text>
|
||
</Table.Summary.Cell>
|
||
);
|
||
})}
|
||
</Table.Summary.Row>
|
||
</Table.Summary>
|
||
);
|
||
};
|