feat(app): экраны импорта отчётов, целей, доходов, ребалансировки, налогов и бенчмарков
Импорт (/imports, /instruments/pending) и фаза 4 (/goals, /income, /rebalance, /tax, аналитика-хаб с benchmarks_card) — по docs/ai/import-contract.md и docs/ai/phase4-contract.md. file_picker для загрузки отчёта.
This commit is contained in:
@@ -0,0 +1,75 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../core/utils/ru_date.dart';
|
||||
import '../../../core/widgets/money_text.dart';
|
||||
import '../../portfolio/labels.dart' show eventKindLabels, formatQty;
|
||||
import '../data/imports_api.dart';
|
||||
|
||||
/// The first lines of the report as the parser read them. A row already present in the
|
||||
/// ledger (same `dedupe_key`) is marked: committing will update it, not add a second one.
|
||||
class SampleEventsTable extends StatelessWidget {
|
||||
const SampleEventsTable({required this.events, super.key});
|
||||
|
||||
final List<SampleEvent> events;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final theme = Theme.of(context);
|
||||
return SingleChildScrollView(
|
||||
scrollDirection: Axis.horizontal,
|
||||
child: DataTable(
|
||||
columnSpacing: 20,
|
||||
headingRowHeight: 36,
|
||||
dataRowMinHeight: 36,
|
||||
dataRowMaxHeight: 52,
|
||||
columns: const [
|
||||
DataColumn(label: Text('№')),
|
||||
DataColumn(label: Text('Дата')),
|
||||
DataColumn(label: Text('Тип')),
|
||||
DataColumn(label: Text('Инструмент')),
|
||||
DataColumn(label: Text('Кол-во')),
|
||||
DataColumn(label: Text('Цена')),
|
||||
DataColumn(label: Text('Сумма')),
|
||||
DataColumn(label: Text('')),
|
||||
],
|
||||
rows: [
|
||||
for (final e in events)
|
||||
DataRow(
|
||||
color: e.isDuplicate
|
||||
? WidgetStatePropertyAll(
|
||||
theme.colorScheme.surfaceContainerHighest.withValues(alpha: 0.6))
|
||||
: null,
|
||||
cells: [
|
||||
DataCell(Text('${e.lineNo}')),
|
||||
DataCell(Text(e.tradeDate == null ? '—' : ruDate(e.tradeDate!))),
|
||||
DataCell(Text(eventKindLabels[e.kind] ?? e.kind)),
|
||||
DataCell(
|
||||
Tooltip(
|
||||
message: e.instrumentKey ?? '',
|
||||
child: Text(e.instrumentName ?? e.instrumentKey ?? '—'),
|
||||
),
|
||||
),
|
||||
DataCell(Text(e.quantity == null ? '—' : formatQty(e.quantity!))),
|
||||
DataCell(Text(_money(e.price, e.currency))),
|
||||
DataCell(Text(_money(e.amount, e.currency))),
|
||||
DataCell(e.isDuplicate
|
||||
? Tooltip(
|
||||
message: 'Такое событие уже есть в леджере',
|
||||
child: Chip(
|
||||
visualDensity: VisualDensity.compact,
|
||||
label: const Text('дубль'),
|
||||
backgroundColor:
|
||||
theme.colorScheme.secondaryContainer.withValues(alpha: 0.8),
|
||||
),
|
||||
)
|
||||
: const SizedBox.shrink()),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
static String _money(String? value, String? currency) =>
|
||||
value == null || value.isEmpty ? '—' : MoneyText.format(value, currency ?? 'RUB');
|
||||
}
|
||||
Reference in New Issue
Block a user