49 lines
1.4 KiB
Dart
49 lines
1.4 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
import 'package:pshared/models/payment/execution_operation.dart';
|
|
import 'package:pshared/models/payment/payment.dart';
|
|
|
|
import 'package:pweb/pages/report/details/sections/fx.dart';
|
|
import 'package:pweb/pages/report/details/sections/operations/section.dart';
|
|
|
|
|
|
class PaymentDetailsSections extends StatelessWidget {
|
|
final Payment payment;
|
|
final bool Function(PaymentExecutionOperation operation)?
|
|
canDownloadOperationDocument;
|
|
final ValueChanged<PaymentExecutionOperation>? onDownloadOperationDocument;
|
|
|
|
const PaymentDetailsSections({
|
|
super.key,
|
|
required this.payment,
|
|
this.canDownloadOperationDocument,
|
|
this.onDownloadOperationDocument,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final hasFx = _hasFxQuote(payment);
|
|
final hasOperations = payment.operations.isNotEmpty;
|
|
|
|
return Column(
|
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
|
children: [
|
|
if (hasFx) ...[
|
|
PaymentFxSection(payment: payment),
|
|
const SizedBox(height: 16),
|
|
],
|
|
if (hasOperations) ...[
|
|
PaymentOperationsSection(
|
|
payment: payment,
|
|
canDownloadDocument: canDownloadOperationDocument,
|
|
onDownloadDocument: onDownloadOperationDocument,
|
|
),
|
|
const SizedBox(height: 16),
|
|
],
|
|
],
|
|
);
|
|
}
|
|
|
|
bool _hasFxQuote(Payment payment) => payment.lastQuote?.fxQuote != null;
|
|
}
|