Payments
This commit is contained in:
parent
50ae325567
commit
f1f88a1eb7
|
|
@ -52,7 +52,7 @@ abstract class PaymentEntity extends Object with BaseEntity implements Built<Pay
|
||||||
id: --PaymentEntity.counter,
|
id: --PaymentEntity.counter,
|
||||||
amount: 0.0,
|
amount: 0.0,
|
||||||
transactionReference: '',
|
transactionReference: '',
|
||||||
paymentDate: '',
|
paymentDate: convertDateTimeToSqlDate(),
|
||||||
paymentTypeId: 0,
|
paymentTypeId: 0,
|
||||||
invoiceId: 0,
|
invoiceId: 0,
|
||||||
clientId: 0,
|
clientId: 0,
|
||||||
|
|
|
||||||
|
|
@ -81,7 +81,8 @@ Middleware<AppState> _showEmailInvoice() {
|
||||||
return (Store<AppState> store, dynamic action, NextDispatcher next) async {
|
return (Store<AppState> store, dynamic action, NextDispatcher next) async {
|
||||||
next(action);
|
next(action);
|
||||||
|
|
||||||
final emailWasSent = await Navigator.of(action.context).pushNamed(InvoiceEmailScreen.route);
|
final emailWasSent =
|
||||||
|
await Navigator.of(action.context).pushNamed(InvoiceEmailScreen.route);
|
||||||
|
|
||||||
if (action.completer != null && emailWasSent) {
|
if (action.completer != null && emailWasSent) {
|
||||||
action.completer.complete(null);
|
action.completer.complete(null);
|
||||||
|
|
@ -243,7 +244,9 @@ Middleware<AppState> _loadInvoice(InvoiceRepository repository) {
|
||||||
repository
|
repository
|
||||||
.loadItem(state.selectedCompany, state.authState, action.invoiceId)
|
.loadItem(state.selectedCompany, state.authState, action.invoiceId)
|
||||||
.then((invoice) {
|
.then((invoice) {
|
||||||
|
|
||||||
store.dispatch(LoadInvoiceSuccess(invoice));
|
store.dispatch(LoadInvoiceSuccess(invoice));
|
||||||
|
store.dispatch(LoadClient(clientId: invoice.clientId));
|
||||||
|
|
||||||
if (action.completer != null) {
|
if (action.completer != null) {
|
||||||
action.completer.complete(null);
|
action.completer.complete(null);
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/widgets.dart';
|
import 'package:flutter/widgets.dart';
|
||||||
import 'package:invoiceninja_flutter/redux/client/client_actions.dart';
|
import 'package:invoiceninja_flutter/redux/client/client_actions.dart';
|
||||||
|
import 'package:invoiceninja_flutter/redux/invoice/invoice_actions.dart';
|
||||||
import 'package:invoiceninja_flutter/redux/payment/payment_selectors.dart';
|
import 'package:invoiceninja_flutter/redux/payment/payment_selectors.dart';
|
||||||
import 'package:invoiceninja_flutter/redux/quote/quote_actions.dart';
|
import 'package:invoiceninja_flutter/redux/quote/quote_actions.dart';
|
||||||
import 'package:redux/redux.dart';
|
import 'package:redux/redux.dart';
|
||||||
|
|
@ -105,8 +106,7 @@ Middleware<AppState> _deletePayment(PaymentRepository repository) {
|
||||||
origPayment, EntityAction.delete)
|
origPayment, EntityAction.delete)
|
||||||
.then((PaymentEntity payment) {
|
.then((PaymentEntity payment) {
|
||||||
store.dispatch(DeletePaymentSuccess(payment));
|
store.dispatch(DeletePaymentSuccess(payment));
|
||||||
store.dispatch(LoadClient(
|
store.dispatch(LoadInvoice(invoiceId: payment.invoiceId));
|
||||||
clientId: paymentInvoiceSelector(payment.id, store.state).clientId));
|
|
||||||
if (action.completer != null) {
|
if (action.completer != null) {
|
||||||
action.completer.complete(null);
|
action.completer.complete(null);
|
||||||
}
|
}
|
||||||
|
|
@ -130,8 +130,7 @@ Middleware<AppState> _restorePayment(PaymentRepository repository) {
|
||||||
origPayment, EntityAction.restore)
|
origPayment, EntityAction.restore)
|
||||||
.then((PaymentEntity payment) {
|
.then((PaymentEntity payment) {
|
||||||
store.dispatch(RestorePaymentSuccess(payment));
|
store.dispatch(RestorePaymentSuccess(payment));
|
||||||
store.dispatch(LoadClient(
|
store.dispatch(LoadInvoice(invoiceId: payment.invoiceId));
|
||||||
clientId: paymentInvoiceSelector(payment.id, store.state).clientId));
|
|
||||||
if (action.completer != null) {
|
if (action.completer != null) {
|
||||||
action.completer.complete(null);
|
action.completer.complete(null);
|
||||||
}
|
}
|
||||||
|
|
@ -158,8 +157,7 @@ Middleware<AppState> _savePayment(PaymentRepository repository) {
|
||||||
} else {
|
} else {
|
||||||
store.dispatch(SavePaymentSuccess(payment));
|
store.dispatch(SavePaymentSuccess(payment));
|
||||||
}
|
}
|
||||||
store.dispatch(LoadClient(
|
store.dispatch(LoadInvoice(invoiceId: payment.invoiceId));
|
||||||
clientId: paymentInvoiceSelector(payment.id, store.state).clientId));
|
|
||||||
action.completer.complete(null);
|
action.completer.complete(null);
|
||||||
}).catchError((Object error) {
|
}).catchError((Object error) {
|
||||||
print(error);
|
print(error);
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,9 @@ class ClientList extends StatelessWidget {
|
||||||
}
|
}
|
||||||
|
|
||||||
void _showMenu(BuildContext context, ClientEntity client) async {
|
void _showMenu(BuildContext context, ClientEntity client) async {
|
||||||
|
if (client == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
final user = viewModel.user;
|
final user = viewModel.user;
|
||||||
final message = await showDialog<String>(
|
final message = await showDialog<String>(
|
||||||
context: context,
|
context: context,
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,10 @@ class InvoiceList extends StatelessWidget {
|
||||||
|
|
||||||
void _showMenu(
|
void _showMenu(
|
||||||
BuildContext context, InvoiceEntity invoice, ClientEntity client) async {
|
BuildContext context, InvoiceEntity invoice, ClientEntity client) async {
|
||||||
|
if (invoice == null || client == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
final user = viewModel.user;
|
final user = viewModel.user;
|
||||||
final message = await showDialog<String>(
|
final message = await showDialog<String>(
|
||||||
context: context,
|
context: context,
|
||||||
|
|
|
||||||
|
|
@ -92,12 +92,8 @@ class PaymentEditVM {
|
||||||
final Completer<Null> completer = errorCompleter(context)
|
final Completer<Null> completer = errorCompleter(context)
|
||||||
..future.then((_) {
|
..future.then((_) {
|
||||||
if (payment.isNew) {
|
if (payment.isNew) {
|
||||||
if (store.state.uiState.currentRoute == PaymentEditScreen.route) {
|
|
||||||
Navigator.of(context).pop();
|
|
||||||
} else {
|
|
||||||
Navigator.of(context)
|
Navigator.of(context)
|
||||||
.pushReplacementNamed(PaymentViewScreen.route);
|
.pushReplacementNamed(PaymentViewScreen.route);
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,10 @@ class PaymentList extends StatelessWidget {
|
||||||
|
|
||||||
void _showMenu(
|
void _showMenu(
|
||||||
BuildContext context, PaymentEntity payment, ClientEntity client) async {
|
BuildContext context, PaymentEntity payment, ClientEntity client) async {
|
||||||
|
if (payment == null || client == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
final user = viewModel.user;
|
final user = viewModel.user;
|
||||||
final message = await showDialog<String>(
|
final message = await showDialog<String>(
|
||||||
context: context,
|
context: context,
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,9 @@ class ProductList extends StatelessWidget {
|
||||||
}
|
}
|
||||||
|
|
||||||
void _showMenu(BuildContext context, ProductEntity product) async {
|
void _showMenu(BuildContext context, ProductEntity product) async {
|
||||||
|
if (product == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
final user = viewModel.user;
|
final user = viewModel.user;
|
||||||
final message = await showDialog<String>(
|
final message = await showDialog<String>(
|
||||||
context: context,
|
context: context,
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,9 @@ class StubList extends StatelessWidget {
|
||||||
}
|
}
|
||||||
|
|
||||||
void _showMenu(BuildContext context, StubEntity stub) async {
|
void _showMenu(BuildContext context, StubEntity stub) async {
|
||||||
|
if (stub == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
final user = viewModel.user;
|
final user = viewModel.user;
|
||||||
final message = await showDialog<String>(
|
final message = await showDialog<String>(
|
||||||
context: context,
|
context: context,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue