updated document upload according to fresh api
This commit is contained in:
@@ -65,7 +65,15 @@ class _PaymentDetailsView extends StatelessWidget {
|
||||
payment: payment,
|
||||
onBack: () => _handleBack(context),
|
||||
onDownloadAct: controller.canDownload
|
||||
? () => downloadPaymentAct(context, payment.paymentRef ?? '')
|
||||
? () {
|
||||
final request = controller.primaryOperationDocumentRequest;
|
||||
if (request == null) return;
|
||||
downloadPaymentAct(
|
||||
context,
|
||||
gatewayService: request.gatewayService,
|
||||
operationRef: request.operationRef,
|
||||
);
|
||||
}
|
||||
: null,
|
||||
canDownloadOperationDocument:
|
||||
controller.canDownloadOperationDocument,
|
||||
@@ -74,7 +82,7 @@ class _PaymentDetailsView extends StatelessWidget {
|
||||
if (request == null) return;
|
||||
downloadPaymentAct(
|
||||
context,
|
||||
request.paymentRef,
|
||||
gatewayService: request.gatewayService,
|
||||
operationRef: request.operationRef,
|
||||
);
|
||||
},
|
||||
|
||||
@@ -9,7 +9,6 @@ import 'package:pweb/utils/report/download_act.dart';
|
||||
|
||||
import 'package:pweb/generated/i18n/app_localizations.dart';
|
||||
|
||||
|
||||
class OperationRow {
|
||||
static DataRow build(OperationItem op, BuildContext context) {
|
||||
final isUnknownDate = op.date.millisecondsSinceEpoch == 0;
|
||||
@@ -18,29 +17,37 @@ class OperationRow {
|
||||
final dateLabel = isUnknownDate
|
||||
? '-'
|
||||
: '${TimeOfDay.fromDateTime(localDate).format(context)}\n'
|
||||
'${localDate.toIso8601String().split("T").first}';
|
||||
'${localDate.toIso8601String().split("T").first}';
|
||||
|
||||
final canDownload = op.status == OperationStatus.success &&
|
||||
(op.paymentRef ?? '').trim().isNotEmpty;
|
||||
final canDownload =
|
||||
op.status == OperationStatus.success &&
|
||||
(op.operationRef ?? '').trim().isNotEmpty &&
|
||||
(op.gatewayService ?? '').trim().isNotEmpty;
|
||||
|
||||
final documentCell = canDownload
|
||||
? TextButton.icon(
|
||||
onPressed: () => downloadPaymentAct(context, op.paymentRef ?? ''),
|
||||
onPressed: () => downloadPaymentAct(
|
||||
context,
|
||||
gatewayService: op.gatewayService ?? '',
|
||||
operationRef: op.operationRef ?? '',
|
||||
),
|
||||
icon: const Icon(Icons.download),
|
||||
label: Text(loc.downloadAct),
|
||||
)
|
||||
: Text(op.fileName ?? '');
|
||||
|
||||
return DataRow(cells: [
|
||||
DataCell(OperationStatusBadge(status: op.status)),
|
||||
DataCell(documentCell),
|
||||
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)),
|
||||
]);
|
||||
return DataRow(
|
||||
cells: [
|
||||
DataCell(OperationStatusBadge(status: op.status)),
|
||||
DataCell(documentCell),
|
||||
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)),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user