Documents
This commit is contained in:
parent
677882fa2d
commit
001599359a
|
|
@ -20,6 +20,10 @@ const String kSharedPrefAppVersion = 'app_version';
|
||||||
const String kSharedPrefRequireAuthentication = 'require_authentication';
|
const String kSharedPrefRequireAuthentication = 'require_authentication';
|
||||||
const String kSharedPrefAddDocumentsToInvoice = 'add_documents_to_invoice';
|
const String kSharedPrefAddDocumentsToInvoice = 'add_documents_to_invoice';
|
||||||
|
|
||||||
|
const String kPlanFree = '';
|
||||||
|
const String kPlanPro = 'pro';
|
||||||
|
const String kPlanEnterprise = 'enterprise';
|
||||||
|
|
||||||
String getCompanyTokenKey([int companyIndex = 0]) =>
|
String getCompanyTokenKey([int companyIndex = 0]) =>
|
||||||
'${kSharedPrefToken}_$companyIndex';
|
'${kSharedPrefToken}_$companyIndex';
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -320,6 +320,14 @@ abstract class CompanyEntity
|
||||||
return plan.isNotEmpty;
|
return plan.isNotEmpty;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool get isEnterprisePlan {
|
||||||
|
if (appUrl != kAppUrl) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return plan == kPlanEnterprise;
|
||||||
|
}
|
||||||
|
|
||||||
bool isModuleEnabled(EntityType entityType) {
|
bool isModuleEnabled(EntityType entityType) {
|
||||||
if (entityType == EntityType.recurringInvoice &&
|
if (entityType == EntityType.recurringInvoice &&
|
||||||
enabledModules & kModuleRecurringInvoice == 0) {
|
enabledModules & kModuleRecurringInvoice == 0) {
|
||||||
|
|
|
||||||
|
|
@ -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/redux/dashboard/dashboard_actions.dart';
|
||||||
import 'package:redux/redux.dart';
|
import 'package:redux/redux.dart';
|
||||||
import 'package:invoiceninja_flutter/data/models/models.dart';
|
import 'package:invoiceninja_flutter/data/models/models.dart';
|
||||||
import 'package:invoiceninja_flutter/redux/ui/ui_actions.dart';
|
import 'package:invoiceninja_flutter/redux/ui/ui_actions.dart';
|
||||||
|
|
@ -216,11 +217,9 @@ Middleware<AppState> _loadDocuments(DocumentRepository repository) {
|
||||||
if (action.completer != null) {
|
if (action.completer != null) {
|
||||||
action.completer.complete(null);
|
action.completer.complete(null);
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
if (state.productState.isStale) {
|
if (state.productState.isStale) {
|
||||||
store.dispatch(LoadProducts());
|
store.dispatch(LoadDashboard());
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
}).catchError((Object error) {
|
}).catchError((Object error) {
|
||||||
print(error);
|
print(error);
|
||||||
store.dispatch(LoadDocumentsFailure(error));
|
store.dispatch(LoadDocumentsFailure(error));
|
||||||
|
|
|
||||||
|
|
@ -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/dashboard/dashboard_actions.dart';
|
import 'package:invoiceninja_flutter/redux/dashboard/dashboard_actions.dart';
|
||||||
|
import 'package:invoiceninja_flutter/redux/document/document_actions.dart';
|
||||||
import 'package:redux/redux.dart';
|
import 'package:redux/redux.dart';
|
||||||
import 'package:invoiceninja_flutter/data/models/models.dart';
|
import 'package:invoiceninja_flutter/data/models/models.dart';
|
||||||
import 'package:invoiceninja_flutter/redux/ui/ui_actions.dart';
|
import 'package:invoiceninja_flutter/redux/ui/ui_actions.dart';
|
||||||
|
|
@ -218,8 +219,12 @@ Middleware<AppState> _loadExpenses(ExpenseRepository repository) {
|
||||||
action.completer.complete(null);
|
action.completer.complete(null);
|
||||||
}
|
}
|
||||||
if (state.dashboardState.isStale) {
|
if (state.dashboardState.isStale) {
|
||||||
|
if (state.selectedCompany.isEnterprisePlan) {
|
||||||
|
store.dispatch(LoadDocuments());
|
||||||
|
} else {
|
||||||
store.dispatch(LoadDashboard());
|
store.dispatch(LoadDashboard());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}).catchError((Object error) {
|
}).catchError((Object error) {
|
||||||
print(error);
|
print(error);
|
||||||
store.dispatch(LoadExpensesFailure(error));
|
store.dispatch(LoadExpensesFailure(error));
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue