Files
sendico/frontend/pweb/lib/pages/report/table/row.dart
2026-01-30 16:54:56 +01:00

31 lines
1.0 KiB
Dart

import 'package:flutter/material.dart';
import 'package:pshared/models/payment/operation.dart';
import 'package:pshared/utils/currency.dart';
import 'package:pweb/pages/report/table/badge.dart';
class OperationRow {
static DataRow build(OperationItem op, BuildContext context) {
final isUnknownDate = op.date.millisecondsSinceEpoch == 0;
final localDate = op.date.toLocal();
final dateLabel = isUnknownDate
? '-'
: '${TimeOfDay.fromDateTime(localDate).format(context)}\n'
'${localDate.toIso8601String().split("T").first}';
return DataRow(cells: [
DataCell(OperationStatusBadge(status: op.status)),
DataCell(Text(op.fileName ?? '')),
DataCell(Text('${amountToString(op.amount)} ${op.currency}')),
DataCell(Text('${amountToString(op.toAmount)} ${op.toCurrency}')),
DataCell(Text(op.payId)),
DataCell(Text(op.cardNumber ?? '-')),
DataCell(Text(op.name)),
DataCell(Text(dateLabel)),
DataCell(Text(op.comment)),
]);
}
}