From 1ee71355daf2104acb093fc6e9617d161bab41cc Mon Sep 17 00:00:00 2001 From: Grog Date: Fri, 6 Nov 2026 09:08:39 +0300 Subject: [PATCH] =?UTF-8?q?=D1=84=D1=83=D1=82=D0=B5=D1=80=20=D1=82=D0=B0?= =?UTF-8?q?=D0=B1=D0=BB=D0=B8=D1=86=D1=8B=20=D0=B3=D1=83=D0=B4=D0=B2=D0=B8?= =?UTF-8?q?=D0=BB=D0=B0=20=D0=B2=D1=8B=D0=BD=D0=B5=D1=81=D0=B5=D0=BD=20?= =?UTF-8?q?=D0=B2=20=D0=BE=D1=82=D0=B4=D0=B5=D0=BB=D1=8C=D0=BD=D1=8B=D0=B9?= =?UTF-8?q?=20=D0=BA=D0=BE=D0=BC=D0=BF=D0=BE=D0=BD=D0=B5=D0=BD=D1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ConsolidationGoodwillSummary.tsx | 108 ++++++++++++++++++ .../ConsolidationGoodwillTable.tsx | 103 +---------------- 2 files changed, 112 insertions(+), 99 deletions(-) create mode 100644 web/src/widgets/ConsolidationGoodwill/ConsolidationGoodwillSummary/ConsolidationGoodwillSummary.tsx diff --git a/web/src/widgets/ConsolidationGoodwill/ConsolidationGoodwillSummary/ConsolidationGoodwillSummary.tsx b/web/src/widgets/ConsolidationGoodwill/ConsolidationGoodwillSummary/ConsolidationGoodwillSummary.tsx new file mode 100644 index 0000000..194833b --- /dev/null +++ b/web/src/widgets/ConsolidationGoodwill/ConsolidationGoodwillSummary/ConsolidationGoodwillSummary.tsx @@ -0,0 +1,108 @@ +import { Table, Typography } from 'antd'; +import type { GoodwillTableResponse, GoodwillTreeRow } from '../../../types/goodwill/goodwill'; +import { chessTableCellFormatValue } from '../../../utils/chessTableCellFormatValue'; +import { sumAmounts } from '../../../utils/money'; +import { ColumnGroupType } from 'antd/es/table'; +import { ColumnType } from 'antd/lib/table'; + +const { Text } = Typography; + +interface ConsolidationGoodwillSummaryI { + data: GoodwillTableResponse | null; + visibleColumns: (ColumnGroupType | ColumnType)[]; + units: string; + decimals: number; +} + +export const ConsolidationGoodwillSummary: React.FC = ({ data, visibleColumns, units, decimals }) => { + if (!data?.rows) return null; + + const totalFinInv = sumAmounts(data.rows.map((c) => c.financial_investment_amount)) ?? '0.00'; + const totalParticipation = sumAmounts(data.rows.map((c) => c.participation_amount)) ?? '0.00'; + const totalCharter = sumAmounts(data.rows.map((c) => c.charter_capital_amount)) ?? '0.00'; + const totalGoodwill = sumAmounts(data.rows.map((c) => c.goodwill_amount)) ?? '0.00'; + + return ( + + + {visibleColumns.map((col, index) => { + if (col.key === 'include_in_kfo') { + return ( + + — + + ); + } + + if (col.key === 'name') { + return ( + +
+ Итого по листу +
+
+ ); + } + + if (col.key === 'ownership_share') { + return ( + + — + + ); + } + + if (col.key === 'financial_investment_amount') { + return ( + +
+ {chessTableCellFormatValue(totalFinInv, units, decimals)} +
+
+ ); + } + + if (col.key === 'participation_amount') { + return ( + +
+ {chessTableCellFormatValue(totalParticipation, units, decimals)} +
+
+ ); + } + + if (col.key === 'charter_capital_amount') { + return ( + +
+ {chessTableCellFormatValue(totalCharter, units, decimals)} +
+
+ ); + } + + if (col.key === 'goodwill_amount') { + return ( + +
+ {chessTableCellFormatValue(totalGoodwill, units, decimals)} +
+
+ ); + } + + if (col.key === 'comment') { + return ( + + — + + ); + } + + return null; + })} +
+
+ ); +}; diff --git a/web/src/widgets/ConsolidationGoodwill/ConsolidationGoodwillTable/ConsolidationGoodwillTable.tsx b/web/src/widgets/ConsolidationGoodwill/ConsolidationGoodwillTable/ConsolidationGoodwillTable.tsx index 7631f8e..73d6878 100644 --- a/web/src/widgets/ConsolidationGoodwill/ConsolidationGoodwillTable/ConsolidationGoodwillTable.tsx +++ b/web/src/widgets/ConsolidationGoodwill/ConsolidationGoodwillTable/ConsolidationGoodwillTable.tsx @@ -1,14 +1,12 @@ -import { Table, Typography } from 'antd'; +import { Table } from 'antd'; import type { ColumnsType } from 'antd/es/table'; import type React from 'react'; import { useMemo } from 'react'; import type { GoodwillRow, GoodwillTableResponse, GoodwillTreeRow } from '../../../types/goodwill/goodwill'; import './ConsolidationGoodwillTable.css'; -import { chessTableCellFormatValue } from '../../../utils/chessTableCellFormatValue'; -import { sumAmounts } from '../../../utils/money'; -import { getGoodwillColumns } from './config'; -const { Text } = Typography; +import { getGoodwillColumns } from './config'; +import { ConsolidationGoodwillSummary } from '../ConsolidationGoodwillSummary/ConsolidationGoodwillSummary'; interface ConsolidationGoodwillTableI { data: GoodwillTableResponse | null; @@ -128,99 +126,6 @@ export const ConsolidationGoodwillTable: React.FC = const scrollY = isFullscreen ? 'calc(100vh - 200px)' : 'auto'; - const renderSummary = () => { - if (!data?.rows) return null; - - const totalFinInv = sumAmounts(data.rows.map((c) => c.financial_investment_amount)) ?? '0.00'; - const totalParticipation = sumAmounts(data.rows.map((c) => c.participation_amount)) ?? '0.00'; - const totalCharter = sumAmounts(data.rows.map((c) => c.charter_capital_amount)) ?? '0.00'; - const totalGoodwill = sumAmounts(data.rows.map((c) => c.goodwill_amount)) ?? '0.00'; - - return ( - - - {visibleColumns.map((col, index) => { - if (col.key === 'include_in_kfo') { - return ( - - — - - ); - } - - if (col.key === 'name') { - return ( - -
- Итого по листу -
-
- ); - } - - if (col.key === 'ownership_share') { - return ( - - — - - ); - } - - if (col.key === 'financial_investment_amount') { - return ( - -
- {chessTableCellFormatValue(String(totalFinInv), units, decimals)} -
-
- ); - } - - if (col.key === 'participation_amount') { - return ( - -
- {chessTableCellFormatValue(String(totalParticipation), units, decimals)} -
-
- ); - } - - if (col.key === 'charter_capital_amount') { - return ( - -
- {chessTableCellFormatValue(String(totalCharter), units, decimals)} -
-
- ); - } - - if (col.key === 'goodwill_amount') { - return ( - -
- {chessTableCellFormatValue(String(totalGoodwill), units, decimals)} -
-
- ); - } - - if (col.key === 'comment') { - return ( - - — - - ); - } - - return null; - })} -
-
- ); - }; - return ( className='goodwillTable' @@ -235,7 +140,7 @@ export const ConsolidationGoodwillTable: React.FC = title={() => toolbar} key={data?.rows?.length} expandable={{ defaultExpandAllRows: true }} - summary={renderSummary} + summary={() => } rowClassName={(record) => (record.isGroupTotal ? 'group-total-row' : '')} /> );