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