docs format updated
This commit is contained in:
@@ -13,10 +13,12 @@ class PaymentDocumentsService {
|
||||
String organizationRef,
|
||||
String gatewayService,
|
||||
String operationRef,
|
||||
String paymentRef,
|
||||
) async {
|
||||
final query = <String, String>{
|
||||
'gateway_service': gatewayService,
|
||||
'operation_ref': operationRef,
|
||||
'payment_ref': paymentRef,
|
||||
};
|
||||
final queryString = Uri(queryParameters: query).query;
|
||||
final url = '/documents/operation/$organizationRef?$queryString';
|
||||
|
||||
@@ -348,7 +348,7 @@ RouteBase payoutShellRoute() => ShellRoute(
|
||||
path: PayoutRoutes.reportPaymentPath,
|
||||
pageBuilder: (_, state) => NoTransitionPage(
|
||||
child: PaymentDetailsPage(
|
||||
paymentId:
|
||||
paymentRef:
|
||||
state.uri.queryParameters[PayoutRoutes.reportPaymentIdQuery] ??
|
||||
'',
|
||||
),
|
||||
|
||||
@@ -9,14 +9,14 @@ import 'package:pweb/utils/report/operations/document_rule.dart';
|
||||
|
||||
|
||||
class PaymentDetailsController extends ChangeNotifier {
|
||||
PaymentDetailsController({required String paymentId})
|
||||
: _paymentId = paymentId;
|
||||
PaymentDetailsController({required String paymentRef})
|
||||
: _paymentRef = paymentRef;
|
||||
|
||||
PaymentsProvider? _payments;
|
||||
String _paymentId;
|
||||
String _paymentRef;
|
||||
Payment? _payment;
|
||||
|
||||
String get paymentId => _paymentId;
|
||||
String get paymentId => _paymentRef;
|
||||
Payment? get payment => _payment;
|
||||
bool get isLoading => _payments?.isLoading ?? false;
|
||||
Exception? get error => _payments?.error;
|
||||
@@ -44,8 +44,8 @@ class PaymentDetailsController extends ChangeNotifier {
|
||||
operationDocumentRequest(operation) != null;
|
||||
|
||||
void update(PaymentsProvider provider, String paymentId) {
|
||||
if (_paymentId != paymentId) {
|
||||
_paymentId = paymentId;
|
||||
if (_paymentRef != paymentId) {
|
||||
_paymentRef = paymentId;
|
||||
}
|
||||
|
||||
if (!identical(_payments, provider)) {
|
||||
@@ -60,7 +60,7 @@ class PaymentDetailsController extends ChangeNotifier {
|
||||
}
|
||||
|
||||
void _rebuild() {
|
||||
_payment = _findPayment(_payments?.payments ?? const [], _paymentId);
|
||||
_payment = _findPayment(_payments?.payments ?? const [], _paymentRef);
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
|
||||
@@ -17,9 +17,9 @@ import 'package:pweb/generated/i18n/app_localizations.dart';
|
||||
|
||||
|
||||
class PaymentDetailsPage extends StatelessWidget {
|
||||
final String paymentId;
|
||||
final String paymentRef;
|
||||
|
||||
const PaymentDetailsPage({super.key, required this.paymentId});
|
||||
const PaymentDetailsPage({super.key, required this.paymentRef});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -27,16 +27,18 @@ class PaymentDetailsPage extends StatelessWidget {
|
||||
PaymentsProvider,
|
||||
PaymentDetailsController
|
||||
>(
|
||||
create: (_) => PaymentDetailsController(paymentId: paymentId),
|
||||
create: (_) => PaymentDetailsController(paymentRef: paymentRef),
|
||||
update: (_, payments, controller) =>
|
||||
controller!..update(payments, paymentId),
|
||||
child: const _PaymentDetailsView(),
|
||||
controller!..update(payments, paymentRef),
|
||||
child: _PaymentDetailsView(paymentRef: paymentRef),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _PaymentDetailsView extends StatelessWidget {
|
||||
const _PaymentDetailsView();
|
||||
final String paymentRef;
|
||||
|
||||
const _PaymentDetailsView({required this.paymentRef});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -73,6 +75,7 @@ class _PaymentDetailsView extends StatelessWidget {
|
||||
context,
|
||||
gatewayService: request.gatewayService,
|
||||
operationRef: request.operationRef,
|
||||
paymentRef: paymentRef,
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
@@ -13,7 +13,7 @@ import 'package:pweb/generated/i18n/app_localizations.dart';
|
||||
|
||||
|
||||
class OperationRow {
|
||||
static DataRow build(OperationItem op, BuildContext context) {
|
||||
static DataRow build(String paymentRef, OperationItem op, BuildContext context) {
|
||||
final isUnknownDate = op.date.millisecondsSinceEpoch == 0;
|
||||
final localDate = op.date.toLocal();
|
||||
final loc = AppLocalizations.of(context)!;
|
||||
@@ -33,6 +33,7 @@ class OperationRow {
|
||||
context,
|
||||
gatewayService: op.gatewayService ?? '',
|
||||
operationRef: op.operationRef ?? '',
|
||||
paymentRef: paymentRef,
|
||||
),
|
||||
icon: const Icon(Icons.download),
|
||||
label: Text(loc.downloadAct),
|
||||
|
||||
@@ -6,11 +6,13 @@ import 'package:pweb/pages/report/table/row.dart';
|
||||
|
||||
|
||||
class OperationsTable extends StatelessWidget {
|
||||
final String paymentRef;
|
||||
final List<OperationItem> operations;
|
||||
final bool showFileNameColumn;
|
||||
|
||||
const OperationsTable({
|
||||
super.key,
|
||||
required this.paymentRef,
|
||||
required this.operations,
|
||||
required this.showFileNameColumn,
|
||||
});
|
||||
@@ -49,7 +51,7 @@ class OperationsTable extends StatelessWidget {
|
||||
});
|
||||
|
||||
// Use the DataRow built by OperationRow and extract its cells
|
||||
final row = OperationRow.build(op, context);
|
||||
final row = OperationRow.build(paymentRef, op, context);
|
||||
return DataRow.byIndex(
|
||||
index: index,
|
||||
color: color,
|
||||
|
||||
@@ -10,10 +10,12 @@ import 'package:pweb/utils/error/snackbar.dart';
|
||||
|
||||
import 'package:pweb/generated/i18n/app_localizations.dart';
|
||||
|
||||
|
||||
Future<void> downloadPaymentAct(
|
||||
BuildContext context, {
|
||||
required String gatewayService,
|
||||
required String operationRef,
|
||||
required String paymentRef,
|
||||
}) async {
|
||||
final organizations = context.read<OrganizationsProvider>();
|
||||
if (!organizations.isOrganizationSet) {
|
||||
@@ -21,7 +23,8 @@ Future<void> downloadPaymentAct(
|
||||
}
|
||||
final gateway = gatewayService.trim();
|
||||
final operation = operationRef.trim();
|
||||
if (gateway.isEmpty || operation.isEmpty) {
|
||||
final payment = paymentRef.trim();
|
||||
if (gateway.isEmpty || operation.isEmpty || payment.isEmpty) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -33,6 +36,7 @@ Future<void> downloadPaymentAct(
|
||||
organizations.current.id,
|
||||
gateway,
|
||||
operation,
|
||||
payment,
|
||||
);
|
||||
await downloadFile(file);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user