Refunds
This commit is contained in:
parent
96e0bc2d67
commit
a35ff9972d
|
|
@ -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);
|
||||||
}),
|
}),
|
||||||
|
|
|
||||||
|
|
@ -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');
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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,21 +110,24 @@ class _PaymentRefundState extends State<PaymentRefund> {
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
FormCard(
|
FormCard(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
DecoratedFormField(
|
if (payment.paymentables.isEmpty)
|
||||||
controller: _amountController,
|
DecoratedFormField(
|
||||||
autocorrect: false,
|
controller: _amountController,
|
||||||
keyboardType: TextInputType.numberWithOptions(decimal: true),
|
autocorrect: false,
|
||||||
label: localization.amount,
|
keyboardType:
|
||||||
),
|
TextInputType.numberWithOptions(decimal: true),
|
||||||
for (var index = 0; index < paymentables.length; index++)
|
label: localization.amount,
|
||||||
PaymentableEditor(
|
|
||||||
key: ValueKey(
|
|
||||||
'__paymentable_${index}_${paymentables[index].id}__'),
|
|
||||||
viewModel: viewModel,
|
|
||||||
paymentable: paymentables[index],
|
|
||||||
index: index,
|
|
||||||
onChanged: () {},
|
|
||||||
),
|
),
|
||||||
|
if (payment.paymentables.isNotEmpty)
|
||||||
|
for (var index = 0; index < paymentables.length; index++)
|
||||||
|
PaymentableEditor(
|
||||||
|
key: ValueKey(
|
||||||
|
'__paymentable_${index}_${paymentables[index].id}__'),
|
||||||
|
viewModel: viewModel,
|
||||||
|
paymentable: paymentables[index],
|
||||||
|
index: index,
|
||||||
|
onChanged: () {},
|
||||||
|
),
|
||||||
DatePicker(
|
DatePicker(
|
||||||
validator: (String val) => val.trim().isEmpty
|
validator: (String val) => val.trim().isEmpty
|
||||||
? AppLocalization.of(context).pleaseSelectADate
|
? AppLocalization.of(context).pleaseSelectADate
|
||||||
|
|
@ -141,17 +141,15 @@ 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),
|
value: viewModel.prefState.emailPayment,
|
||||||
value: viewModel.prefState.emailPayment,
|
subtitle: Text(localization.emailReceipt),
|
||||||
subtitle: Text(localization.emailReceipt),
|
onChanged: (value) => viewModel.onEmailChanged(value),
|
||||||
onChanged: (value) => viewModel.onEmailChanged(value),
|
),
|
||||||
),
|
]),
|
||||||
])
|
|
||||||
: Container(),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue