LCOV - code coverage report
Current view: top level - lib/pages/automation - payment_edit_page.dart Coverage Total Hit
Test: lcov.info Lines: 0.0 % 29 0
Test Date: 2026-11-14 15:08:11 Functions: - 0 0

            Line data    Source code
       1              : // Copyright 2024 The terCAD team. All rights reserved.
       2              : // Use of this source code is governed by a CC BY-NC-ND 4.0 license that can be found in the LICENSE file.
       3              : 
       4              : import 'package:app_finance/_classes/herald/app_locale.dart';
       5              : import 'package:app_finance/_classes/structure/invoice_app_data.dart';
       6              : import 'package:app_finance/_classes/structure/payment_app_data.dart';
       7              : import 'package:app_finance/_configs/budget_type.dart';
       8              : import 'package:app_finance/_configs/payment_type.dart';
       9              : import 'package:app_finance/_ext/data_ext.dart';
      10              : import 'package:app_finance/pages/automation/payment_add_page.dart';
      11              : import 'package:material_ui/material_ui.dart';
      12              : 
      13              : class PaymentEditPage extends PaymentAddPage {
      14              :   final String uuid;
      15              : 
      16            0 :   const PaymentEditPage({
      17              :     super.key,
      18              :     required this.uuid,
      19              :   });
      20              : 
      21            0 :   @override
      22            0 :   PaymentEditPageState createState() => PaymentEditPageState();
      23              : }
      24              : 
      25              : class PaymentEditPageState extends PaymentAddPageState<PaymentEditPage> {
      26            0 :   @override
      27            0 :   String getButtonName() => AppLocale.labels.updatePaymentTooltip;
      28              : 
      29            0 :   @override
      30              :   void updateStorage() {
      31            0 :     final values = getValues();
      32            0 :     state.update(
      33            0 :       widget.uuid,
      34            0 :       PaymentAppData(
      35            0 :         uuid: widget.uuid,
      36            0 :         title: intervalType ?? AppBudgetType.month.name,
      37            0 :         data: values.toFile(),
      38            0 :         days: int.tryParse(days.text) ?? 1,
      39            0 :         updatedAt: values.createdAt,
      40              :       ),
      41              :     );
      42              :   }
      43              : 
      44            0 :   @override
      45              :   Widget buildContent(BuildContext context, BoxConstraints constraints) {
      46            0 :     if (intervalType == null) {
      47            0 :       final payment = state.getByUuid(widget.uuid) as PaymentAppData;
      48            0 :       item = payment.data.toDataObject(state);
      49            0 :       WidgetsBinding.instance.addPostFrameCallback((_) => setState(() {
      50            0 :             intervalType = payment.title;
      51            0 :             itemType = AppPaymentType.bill.name;
      52            0 :             updatedAt = payment.updatedAt;
      53            0 :             days.text = payment.days.toString();
      54            0 :             if (item is InvoiceAppData) {
      55            0 :               itemType = (item as InvoiceAppData).accountFrom == null
      56            0 :                   ? AppPaymentType.invoice.name
      57            0 :                   : AppPaymentType.transfer.name;
      58              :             }
      59              :           }));
      60              :     }
      61            0 :     return super.buildContent(context, constraints);
      62              :   }
      63              : }
        

Generated by: LCOV version 2.0-1