Transactions
This commit is contained in:
parent
76c3944e14
commit
6db3ab4b9d
|
|
@ -103,7 +103,6 @@ abstract class BankAccountEntity extends Object
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
@override
|
@override
|
||||||
List<EntityAction> getActions(
|
List<EntityAction> getActions(
|
||||||
{UserCompanyEntity userCompany,
|
{UserCompanyEntity userCompany,
|
||||||
|
|
@ -112,9 +111,14 @@ abstract class BankAccountEntity extends Object
|
||||||
bool multiselect = false}) {
|
bool multiselect = false}) {
|
||||||
final actions = <EntityAction>[];
|
final actions = <EntityAction>[];
|
||||||
|
|
||||||
|
if (!isDeleted) {
|
||||||
|
if (!multiselect && includeEdit && userCompany.canEditEntity(this)) {
|
||||||
|
actions.add(EntityAction.edit);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return actions..addAll(super.getActions(userCompany: userCompany));
|
return actions..addAll(super.getActions(userCompany: userCompany));
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
int compareTo(
|
int compareTo(
|
||||||
BankAccountEntity bankAccount, String sortField, bool sortAscending) {
|
BankAccountEntity bankAccount, String sortField, bool sortAscending) {
|
||||||
|
|
|
||||||
|
|
@ -320,10 +320,7 @@ abstract class ProductEntity extends Object
|
||||||
final actions = <EntityAction>[];
|
final actions = <EntityAction>[];
|
||||||
|
|
||||||
if (!isDeleted) {
|
if (!isDeleted) {
|
||||||
if (!multiselect &&
|
if (!multiselect && includeEdit && userCompany.canEditEntity(this)) {
|
||||||
!multiselect &&
|
|
||||||
includeEdit &&
|
|
||||||
userCompany.canEditEntity(this)) {
|
|
||||||
actions.add(EntityAction.edit);
|
actions.add(EntityAction.edit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ import 'package:flutter/material.dart';
|
||||||
import 'package:built_collection/built_collection.dart';
|
import 'package:built_collection/built_collection.dart';
|
||||||
import 'package:flutter_redux/flutter_redux.dart';
|
import 'package:flutter_redux/flutter_redux.dart';
|
||||||
import 'package:invoiceninja_flutter/ui/bank_account/bank_account_screen.dart';
|
import 'package:invoiceninja_flutter/ui/bank_account/bank_account_screen.dart';
|
||||||
|
import 'package:invoiceninja_flutter/ui/bank_account/edit/bank_account_edit.dart';
|
||||||
import 'package:redux/redux.dart';
|
import 'package:redux/redux.dart';
|
||||||
|
|
||||||
// Project imports:
|
// Project imports:
|
||||||
|
|
@ -952,6 +953,14 @@ void createEntityByType({
|
||||||
),
|
),
|
||||||
));
|
));
|
||||||
break;
|
break;
|
||||||
|
case EntityType.bankAccount:
|
||||||
|
store.dispatch(EditBankAccount(
|
||||||
|
force: force,
|
||||||
|
bankAccount: BankAccountEntity(state: state),
|
||||||
|
));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
print('## Create by type not handled for $entityType');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -26,8 +26,11 @@ class ViewBankAccount implements PersistUI, PersistPrefs {
|
||||||
}
|
}
|
||||||
|
|
||||||
class EditBankAccount implements PersistUI, PersistPrefs {
|
class EditBankAccount implements PersistUI, PersistPrefs {
|
||||||
EditBankAccount(
|
EditBankAccount({
|
||||||
{@required this.bankAccount, this.completer, this.force = false});
|
@required this.bankAccount,
|
||||||
|
this.completer,
|
||||||
|
this.force = false,
|
||||||
|
});
|
||||||
|
|
||||||
final BankAccountEntity bankAccount;
|
final BankAccountEntity bankAccount;
|
||||||
final Completer completer;
|
final Completer completer;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/widgets.dart';
|
import 'package:flutter/widgets.dart';
|
||||||
|
import 'package:invoiceninja_flutter/ui/bank_account/edit/bank_account_edit_vm.dart';
|
||||||
import 'package:redux/redux.dart';
|
import 'package:redux/redux.dart';
|
||||||
import 'package:invoiceninja_flutter/main_app.dart';
|
import 'package:invoiceninja_flutter/main_app.dart';
|
||||||
import 'package:invoiceninja_flutter/redux/app/app_actions.dart';
|
import 'package:invoiceninja_flutter/redux/app/app_actions.dart';
|
||||||
|
|
@ -16,6 +17,7 @@ List<Middleware<AppState>> createStoreBankAccountsMiddleware([
|
||||||
]) {
|
]) {
|
||||||
final viewBankAccountList = _viewBankAccountList();
|
final viewBankAccountList = _viewBankAccountList();
|
||||||
final viewBankAccount = _viewBankAccount();
|
final viewBankAccount = _viewBankAccount();
|
||||||
|
final editBankAccount = _editBankAccount();
|
||||||
final loadBankAccounts = _loadBankAccounts(repository);
|
final loadBankAccounts = _loadBankAccounts(repository);
|
||||||
final loadBankAccount = _loadBankAccount(repository);
|
final loadBankAccount = _loadBankAccount(repository);
|
||||||
final saveBankAccount = _saveBankAccount(repository);
|
final saveBankAccount = _saveBankAccount(repository);
|
||||||
|
|
@ -26,6 +28,7 @@ List<Middleware<AppState>> createStoreBankAccountsMiddleware([
|
||||||
return [
|
return [
|
||||||
TypedMiddleware<AppState, ViewBankAccountList>(viewBankAccountList),
|
TypedMiddleware<AppState, ViewBankAccountList>(viewBankAccountList),
|
||||||
TypedMiddleware<AppState, ViewBankAccount>(viewBankAccount),
|
TypedMiddleware<AppState, ViewBankAccount>(viewBankAccount),
|
||||||
|
TypedMiddleware<AppState, EditBankAccount>(editBankAccount),
|
||||||
TypedMiddleware<AppState, LoadBankAccounts>(loadBankAccounts),
|
TypedMiddleware<AppState, LoadBankAccounts>(loadBankAccounts),
|
||||||
TypedMiddleware<AppState, LoadBankAccount>(loadBankAccount),
|
TypedMiddleware<AppState, LoadBankAccount>(loadBankAccount),
|
||||||
TypedMiddleware<AppState, SaveBankAccountRequest>(saveBankAccount),
|
TypedMiddleware<AppState, SaveBankAccountRequest>(saveBankAccount),
|
||||||
|
|
@ -35,6 +38,20 @@ List<Middleware<AppState>> createStoreBankAccountsMiddleware([
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Middleware<AppState> _editBankAccount() {
|
||||||
|
return (Store<AppState> store, dynamic dynamicAction, NextDispatcher next) {
|
||||||
|
final action = dynamicAction as EditBankAccount;
|
||||||
|
|
||||||
|
next(action);
|
||||||
|
|
||||||
|
store.dispatch(UpdateCurrentRoute(BankAccountEditScreen.route));
|
||||||
|
|
||||||
|
if (store.state.prefState.isMobile) {
|
||||||
|
navigatorKey.currentState.pushNamed(BankAccountEditScreen.route);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
Middleware<AppState> _viewBankAccount() {
|
Middleware<AppState> _viewBankAccount() {
|
||||||
return (Store<AppState> store, dynamic dynamicAction,
|
return (Store<AppState> store, dynamic dynamicAction,
|
||||||
NextDispatcher next) async {
|
NextDispatcher next) async {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue