TRON -> TRON_MAINNET

This commit is contained in:
Stephan D
2026-02-01 03:35:16 +01:00
parent be3fd6075f
commit 8faed5cbaa
28 changed files with 452 additions and 90 deletions

View File

@@ -488,6 +488,14 @@
"howItWorks": "How it works?",
"exampleTitle": "File Format & Sample",
"downloadSampleCSV": "Download sample.csv",
"downloadAct": "Download Act",
"@downloadAct": {
"description": "Button label for downloading the acceptance act PDF"
},
"downloadActError": "Failed to download act",
"@downloadActError": {
"description": "Error message shown when act download fails"
},
"tokenColumn": "Token (required)",
"currency": "Currency",
"amount": "Amount",

View File

@@ -488,6 +488,14 @@
"howItWorks": "Как это работает?",
"exampleTitle": "Формат файла и образец",
"downloadSampleCSV": "Скачать sample.csv",
"downloadAct": "Скачать акт",
"@downloadAct": {
"description": "Button label for downloading the acceptance act PDF"
},
"downloadActError": "Не удалось скачать акт",
"@downloadActError": {
"description": "Error message shown when act download fails"
},
"tokenColumn": "Токен (обязательно)",
"currency": "Валюта",
"amount": "Сумма",

View File

@@ -104,6 +104,7 @@ class _OperationHistoryPageState extends State<OperationHistoryPage> {
toAmount: toAmount,
toCurrency: toCurrency,
payId: payId,
paymentRef: payment.paymentRef,
cardNumber: null,
name: name,
date: _resolvePaymentDate(payment),
@@ -141,6 +142,7 @@ class _OperationHistoryPageState extends State<OperationHistoryPage> {
return OperationStatus.processing;
case 'settled':
case 'success':
return OperationStatus.success;
case 'failed':

View File

@@ -1,23 +1,43 @@
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:pshared/models/payment/operation.dart';
import 'package:pshared/models/payment/status.dart';
import 'package:pshared/provider/organizations.dart';
import 'package:pshared/service/payment/documents.dart';
import 'package:pshared/utils/currency.dart';
import 'package:pweb/generated/i18n/app_localizations.dart';
import 'package:pweb/pages/report/table/badge.dart';
import 'package:pweb/utils/download.dart';
import 'package:pweb/utils/error/snackbar.dart';
class OperationRow {
static DataRow build(OperationItem op, BuildContext context) {
final isUnknownDate = op.date.millisecondsSinceEpoch == 0;
final localDate = op.date.toLocal();
final loc = AppLocalizations.of(context)!;
final dateLabel = isUnknownDate
? '-'
: '${TimeOfDay.fromDateTime(localDate).format(context)}\n'
'${localDate.toIso8601String().split("T").first}';
final canDownload = op.status == OperationStatus.success &&
(op.paymentRef ?? '').trim().isNotEmpty;
final documentCell = canDownload
? TextButton.icon(
onPressed: () => _downloadAct(context, op),
icon: const Icon(Icons.download),
label: Text(loc.downloadAct),
)
: Text(op.fileName ?? '');
return DataRow(cells: [
DataCell(OperationStatusBadge(status: op.status)),
DataCell(Text(op.fileName ?? '')),
DataCell(documentCell),
DataCell(Text('${amountToString(op.amount)} ${op.currency}')),
DataCell(Text('${amountToString(op.toAmount)} ${op.toCurrency}')),
DataCell(Text(op.payId)),
@@ -27,4 +47,28 @@ class OperationRow {
DataCell(Text(op.comment)),
]);
}
static Future<void> _downloadAct(BuildContext context, OperationItem op) async {
final organizations = context.read<OrganizationsProvider>();
if (!organizations.isOrganizationSet) {
return;
}
final paymentRef = (op.paymentRef ?? '').trim();
if (paymentRef.isEmpty) {
return;
}
final loc = AppLocalizations.of(context)!;
await executeActionWithNotification(
context: context,
action: () async {
final file = await PaymentDocumentsService.getAct(
organizations.current.id,
paymentRef,
);
await downloadFile(file);
},
errorMessage: loc.downloadActError,
);
}
}

View File

@@ -0,0 +1,25 @@
import 'dart:typed_data';
import 'package:universal_html/html.dart' as html;
import 'package:pshared/models/file/downloaded_file.dart';
Future<void> downloadFile(DownloadedFile file) async {
final blob = html.Blob(
[Uint8List.fromList(file.bytes)],
file.mimeType,
);
final url = html.Url.createObjectUrlFromBlob(blob);
final anchor = html.AnchorElement(href: url)
..download = file.filename
..style.display = 'none';
html.document.body!.append(anchor);
anchor.click();
anchor.remove();
html.Url.revokeObjectUrl(url);
}

View File

@@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
# In Windows, build-name is used as the major, minor, and patch parts
# of the product and file versions while build-number is used as the build suffix.
version: 2.5.0+495
version: 2.6.0+507
environment:
sdk: ^3.8.1
@@ -53,7 +53,7 @@ dependencies:
collection: ^1.18.0
icann_tlds: ^1.0.0
flutter_timezone: ^5.0.1
json_annotation: ^4.9.0
json_annotation: ^4.10.0
go_router: ^17.0.0
jovial_svg: ^1.1.23
cached_network_image: ^3.4.1
@@ -70,6 +70,7 @@ dependencies:
dotted_border: ^3.1.0
qr_flutter: ^4.1.0
duration: ^4.0.3
universal_html: ^2.3.0