This commit is contained in:
Hillel Coren 2020-02-05 10:28:55 +02:00
parent 96e0bc2d67
commit a35ff9972d
3 changed files with 29 additions and 29 deletions

View File

@ -34,6 +34,7 @@ final editingReducer = combineReducers<PaymentEntity>([
return action.payments[0]; return action.payments[0];
}), }),
TypedReducer<PaymentEntity, EditPayment>(_updateEditing), TypedReducer<PaymentEntity, EditPayment>(_updateEditing),
TypedReducer<PaymentEntity, RefundPayment>(_updateEditing),
TypedReducer<PaymentEntity, UpdatePayment>((payment, action) { TypedReducer<PaymentEntity, UpdatePayment>((payment, action) {
return action.payment.rebuild((b) => b..isChanged = true); return action.payment.rebuild((b) => b..isChanged = true);
}), }),

View File

@ -122,7 +122,8 @@ abstract class UIState implements Built<UIState, UIStateBuilder> {
return parts.length > 1 ? parts[1] : ''; return parts.length > 1 ? parts[1] : '';
} }
bool get isEditing => currentRoute.endsWith('edit'); bool get isEditing =>
currentRoute.endsWith('edit') || currentRoute.endsWith('refund');
bool get isInSettings => currentRoute.contains('settings'); bool get isInSettings => currentRoute.contains('settings');
} }

View File

@ -5,12 +5,9 @@ import 'package:invoiceninja_flutter/data/models/entities.dart';
import 'package:invoiceninja_flutter/data/models/invoice_model.dart'; import 'package:invoiceninja_flutter/data/models/invoice_model.dart';
import 'package:invoiceninja_flutter/data/models/payment_model.dart'; import 'package:invoiceninja_flutter/data/models/payment_model.dart';
import 'package:invoiceninja_flutter/redux/invoice/invoice_selectors.dart'; import 'package:invoiceninja_flutter/redux/invoice/invoice_selectors.dart';
import 'package:invoiceninja_flutter/redux/client/client_selectors.dart';
import 'package:invoiceninja_flutter/redux/static/static_selectors.dart';
import 'package:invoiceninja_flutter/ui/app/form_card.dart'; import 'package:invoiceninja_flutter/ui/app/form_card.dart';
import 'package:invoiceninja_flutter/ui/app/forms/date_picker.dart'; import 'package:invoiceninja_flutter/ui/app/forms/date_picker.dart';
import 'package:invoiceninja_flutter/ui/app/forms/decorated_form_field.dart'; import 'package:invoiceninja_flutter/ui/app/forms/decorated_form_field.dart';
import 'package:invoiceninja_flutter/ui/payment/edit/payment_edit_vm.dart';
import 'package:invoiceninja_flutter/ui/app/edit_scaffold.dart'; import 'package:invoiceninja_flutter/ui/app/edit_scaffold.dart';
import 'package:invoiceninja_flutter/ui/payment/refund/payment_refund_vm.dart'; import 'package:invoiceninja_flutter/ui/payment/refund/payment_refund_vm.dart';
import 'package:invoiceninja_flutter/utils/completers.dart'; import 'package:invoiceninja_flutter/utils/completers.dart';
@ -113,12 +110,15 @@ class _PaymentRefundState extends State<PaymentRefund> {
children: <Widget>[ children: <Widget>[
FormCard( FormCard(
children: <Widget>[ children: <Widget>[
if (payment.paymentables.isEmpty)
DecoratedFormField( DecoratedFormField(
controller: _amountController, controller: _amountController,
autocorrect: false, autocorrect: false,
keyboardType: TextInputType.numberWithOptions(decimal: true), keyboardType:
TextInputType.numberWithOptions(decimal: true),
label: localization.amount, label: localization.amount,
), ),
if (payment.paymentables.isNotEmpty)
for (var index = 0; index < paymentables.length; index++) for (var index = 0; index < paymentables.length; index++)
PaymentableEditor( PaymentableEditor(
key: ValueKey( key: ValueKey(
@ -141,8 +141,7 @@ class _PaymentRefundState extends State<PaymentRefund> {
), ),
], ],
), ),
payment.isNew FormCard(children: <Widget>[
? FormCard(children: <Widget>[
SwitchListTile( SwitchListTile(
activeColor: Theme.of(context).accentColor, activeColor: Theme.of(context).accentColor,
title: Text(localization.sendEmail), title: Text(localization.sendEmail),
@ -150,8 +149,7 @@ class _PaymentRefundState extends State<PaymentRefund> {
subtitle: Text(localization.emailReceipt), subtitle: Text(localization.emailReceipt),
onChanged: (value) => viewModel.onEmailChanged(value), onChanged: (value) => viewModel.onEmailChanged(value),
), ),
]) ]),
: Container(),
], ],
), ),
), ),