From 701a93fc1db2ac532ca11d6ee06dd9103a88c830 Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Wed, 20 Nov 2019 21:53:33 +0200 Subject: [PATCH] Settings --- lib/data/repositories/auth_repository.dart | 2 +- lib/redux/app/app_state.dart | 2 +- lib/redux/company/company_state.dart | 25 +-- lib/redux/company/company_state.g.dart | 150 ++++++++++++------ lib/redux/settings/settings_actions.dart | 6 +- lib/redux/ui/pref_reducer.dart | 30 ++-- lib/redux/ui/ui_reducer.dart | 16 +- lib/ui/app/menu_drawer.dart | 2 +- .../company_gateway_screen_vm.dart | 2 +- lib/ui/settings/client_portal_vm.dart | 4 +- lib/ui/settings/company_details_vm.dart | 4 +- lib/ui/settings/custom_fields_vm.dart | 4 +- lib/ui/settings/email_settings_vm.dart | 2 +- lib/ui/settings/generated_numbers_vm.dart | 4 +- lib/ui/settings/invoice_design_vm.dart | 4 +- lib/ui/settings/localization_vm.dart | 4 +- lib/ui/settings/product_settings_vm.dart | 4 +- lib/ui/settings/settings_list_vm.dart | 2 +- lib/ui/settings/tax_settings_vm.dart | 4 +- .../settings/templates_and_reminders_vm.dart | 2 +- lib/ui/settings/user_details_vm.dart | 4 +- lib/ui/settings/workflow_vm.dart | 2 +- 22 files changed, 169 insertions(+), 110 deletions(-) diff --git a/lib/data/repositories/auth_repository.dart b/lib/data/repositories/auth_repository.dart index aeca9599e..4872ad533 100644 --- a/lib/data/repositories/auth_repository.dart +++ b/lib/data/repositories/auth_repository.dart @@ -93,7 +93,7 @@ class AuthRepository { {String url, dynamic data, String token, String secret}) async { final includes = [ 'account', - 'user', + 'user.company_user', 'token', 'company.users.company_user', 'company.tax_rates', diff --git a/lib/redux/app/app_state.dart b/lib/redux/app/app_state.dart index 5e843eef9..96b96a308 100644 --- a/lib/redux/app/app_state.dart +++ b/lib/redux/app/app_state.dart @@ -382,7 +382,7 @@ abstract class AppState implements Built { @override String toString() { - //return 'Custom fields [UI]: ${uiState.settingsUIState.userCompany.company.customFields}, [DB] ${selectedCompany.customFields}'; + //return 'Custom fields [UI]: ${uiState.settingsUIState.company.customFields}, [DB] ${selectedCompany.customFields}'; //return 'Permissions: ${uiState.userUIState.editing.userCompany.permissions}'; //return 'Layout: ${uiState.layout}, menu: ${uiState.menuSidebarMode}, history: ${uiState.historySidebarMode}'; //return 'Sidebars - isMenuVisible: ${uiState.isMenuVisible}, isHistoryVisible: ${uiState.isHistoryVisible}'; diff --git a/lib/redux/company/company_state.dart b/lib/redux/company/company_state.dart index ed83859b5..54c280ae0 100644 --- a/lib/redux/company/company_state.dart +++ b/lib/redux/company/company_state.dart @@ -107,23 +107,27 @@ abstract class UserCompanyState abstract class SettingsUIState extends Object implements Built { factory SettingsUIState( - {UserCompanyEntity userCompany, + {CompanyEntity company, ClientEntity client, GroupEntity group, - UserCompanyEntity origUserCompany, + UserEntity user, + CompanyEntity origCompany, ClientEntity origClient, GroupEntity origGroup, + UserEntity origUser, String section}) { return _$SettingsUIState._( - userCompany: userCompany ?? UserCompanyEntity(), + company: company ?? CompanyEntity(), client: client ?? ClientEntity(), group: group ?? GroupEntity(), + user: user ?? UserEntity(), entityType: client != null ? EntityType.client : group != null ? EntityType.group : EntityType.company, origClient: origClient ?? ClientEntity(), origGroup: origGroup ?? GroupEntity(), - origUserCompany: origUserCompany ?? UserCompanyEntity(), + origCompany: origCompany ?? CompanyEntity(), + origUser: origUser ?? UserEntity(), isChanged: false, updatedAt: 0, filterClearedAt: 0, @@ -133,9 +137,9 @@ abstract class SettingsUIState extends Object SettingsUIState._(); - UserCompanyEntity get userCompany; + CompanyEntity get company; - UserCompanyEntity get origUserCompany; + CompanyEntity get origCompany; ClientEntity get client; @@ -145,6 +149,10 @@ abstract class SettingsUIState extends Object GroupEntity get origGroup; + UserEntity get user; + + UserEntity get origUser; + EntityType get entityType; bool get isChanged; @@ -162,12 +170,11 @@ abstract class SettingsUIState extends Object SettingsEntity get settings { if (entityType == EntityType.client && client != null) { - return userCompany - .company.settings; // TODO fix this, change to client.settings + return company.settings; // TODO fix this, change to client.settings } else if (entityType == EntityType.group && group != null) { return group.settings; } else { - return userCompany.company.settings; + return company.settings; } } diff --git a/lib/redux/company/company_state.g.dart b/lib/redux/company/company_state.g.dart index 6e1994f4b..db1bbd3fc 100644 --- a/lib/redux/company/company_state.g.dart +++ b/lib/redux/company/company_state.g.dart @@ -173,12 +173,12 @@ class _$SettingsUIStateSerializer Iterable serialize(Serializers serializers, SettingsUIState object, {FullType specifiedType = FullType.unspecified}) { final result = [ - 'userCompany', - serializers.serialize(object.userCompany, - specifiedType: const FullType(UserCompanyEntity)), - 'origUserCompany', - serializers.serialize(object.origUserCompany, - specifiedType: const FullType(UserCompanyEntity)), + 'company', + serializers.serialize(object.company, + specifiedType: const FullType(CompanyEntity)), + 'origCompany', + serializers.serialize(object.origCompany, + specifiedType: const FullType(CompanyEntity)), 'client', serializers.serialize(object.client, specifiedType: const FullType(ClientEntity)), @@ -191,6 +191,12 @@ class _$SettingsUIStateSerializer 'origGroup', serializers.serialize(object.origGroup, specifiedType: const FullType(GroupEntity)), + 'user', + serializers.serialize(object.user, + specifiedType: const FullType(UserEntity)), + 'origUser', + serializers.serialize(object.origUser, + specifiedType: const FullType(UserEntity)), 'entityType', serializers.serialize(object.entityType, specifiedType: const FullType(EntityType)), @@ -228,15 +234,13 @@ class _$SettingsUIStateSerializer iterator.moveNext(); final dynamic value = iterator.current; switch (key) { - case 'userCompany': - result.userCompany.replace(serializers.deserialize(value, - specifiedType: const FullType(UserCompanyEntity)) - as UserCompanyEntity); + case 'company': + result.company.replace(serializers.deserialize(value, + specifiedType: const FullType(CompanyEntity)) as CompanyEntity); break; - case 'origUserCompany': - result.origUserCompany.replace(serializers.deserialize(value, - specifiedType: const FullType(UserCompanyEntity)) - as UserCompanyEntity); + case 'origCompany': + result.origCompany.replace(serializers.deserialize(value, + specifiedType: const FullType(CompanyEntity)) as CompanyEntity); break; case 'client': result.client.replace(serializers.deserialize(value, @@ -254,6 +258,14 @@ class _$SettingsUIStateSerializer result.origGroup.replace(serializers.deserialize(value, specifiedType: const FullType(GroupEntity)) as GroupEntity); break; + case 'user': + result.user.replace(serializers.deserialize(value, + specifiedType: const FullType(UserEntity)) as UserEntity); + break; + case 'origUser': + result.origUser.replace(serializers.deserialize(value, + specifiedType: const FullType(UserEntity)) as UserEntity); + break; case 'entityType': result.entityType = serializers.deserialize(value, specifiedType: const FullType(EntityType)) as EntityType; @@ -688,9 +700,9 @@ class UserCompanyStateBuilder class _$SettingsUIState extends SettingsUIState { @override - final UserCompanyEntity userCompany; + final CompanyEntity company; @override - final UserCompanyEntity origUserCompany; + final CompanyEntity origCompany; @override final ClientEntity client; @override @@ -700,6 +712,10 @@ class _$SettingsUIState extends SettingsUIState { @override final GroupEntity origGroup; @override + final UserEntity user; + @override + final UserEntity origUser; + @override final EntityType entityType; @override final bool isChanged; @@ -716,12 +732,14 @@ class _$SettingsUIState extends SettingsUIState { (new SettingsUIStateBuilder()..update(updates)).build(); _$SettingsUIState._( - {this.userCompany, - this.origUserCompany, + {this.company, + this.origCompany, this.client, this.origClient, this.group, this.origGroup, + this.user, + this.origUser, this.entityType, this.isChanged, this.updatedAt, @@ -729,11 +747,11 @@ class _$SettingsUIState extends SettingsUIState { this.filter, this.filterClearedAt}) : super._() { - if (userCompany == null) { - throw new BuiltValueNullFieldError('SettingsUIState', 'userCompany'); + if (company == null) { + throw new BuiltValueNullFieldError('SettingsUIState', 'company'); } - if (origUserCompany == null) { - throw new BuiltValueNullFieldError('SettingsUIState', 'origUserCompany'); + if (origCompany == null) { + throw new BuiltValueNullFieldError('SettingsUIState', 'origCompany'); } if (client == null) { throw new BuiltValueNullFieldError('SettingsUIState', 'client'); @@ -747,6 +765,12 @@ class _$SettingsUIState extends SettingsUIState { if (origGroup == null) { throw new BuiltValueNullFieldError('SettingsUIState', 'origGroup'); } + if (user == null) { + throw new BuiltValueNullFieldError('SettingsUIState', 'user'); + } + if (origUser == null) { + throw new BuiltValueNullFieldError('SettingsUIState', 'origUser'); + } if (entityType == null) { throw new BuiltValueNullFieldError('SettingsUIState', 'entityType'); } @@ -776,12 +800,14 @@ class _$SettingsUIState extends SettingsUIState { bool operator ==(Object other) { if (identical(other, this)) return true; return other is SettingsUIState && - userCompany == other.userCompany && - origUserCompany == other.origUserCompany && + company == other.company && + origCompany == other.origCompany && client == other.client && origClient == other.origClient && group == other.group && origGroup == other.origGroup && + user == other.user && + origUser == other.origUser && entityType == other.entityType && isChanged == other.isChanged && updatedAt == other.updatedAt && @@ -802,12 +828,18 @@ class _$SettingsUIState extends SettingsUIState { $jc( $jc( $jc( - $jc($jc(0, userCompany.hashCode), - origUserCompany.hashCode), - client.hashCode), - origClient.hashCode), - group.hashCode), - origGroup.hashCode), + $jc( + $jc( + $jc( + $jc(0, + company.hashCode), + origCompany.hashCode), + client.hashCode), + origClient.hashCode), + group.hashCode), + origGroup.hashCode), + user.hashCode), + origUser.hashCode), entityType.hashCode), isChanged.hashCode), updatedAt.hashCode), @@ -819,12 +851,14 @@ class _$SettingsUIState extends SettingsUIState { @override String toString() { return (newBuiltValueToStringHelper('SettingsUIState') - ..add('userCompany', userCompany) - ..add('origUserCompany', origUserCompany) + ..add('company', company) + ..add('origCompany', origCompany) ..add('client', client) ..add('origClient', origClient) ..add('group', group) ..add('origGroup', origGroup) + ..add('user', user) + ..add('origUser', origUser) ..add('entityType', entityType) ..add('isChanged', isChanged) ..add('updatedAt', updatedAt) @@ -839,17 +873,16 @@ class SettingsUIStateBuilder implements Builder { _$SettingsUIState _$v; - UserCompanyEntityBuilder _userCompany; - UserCompanyEntityBuilder get userCompany => - _$this._userCompany ??= new UserCompanyEntityBuilder(); - set userCompany(UserCompanyEntityBuilder userCompany) => - _$this._userCompany = userCompany; + CompanyEntityBuilder _company; + CompanyEntityBuilder get company => + _$this._company ??= new CompanyEntityBuilder(); + set company(CompanyEntityBuilder company) => _$this._company = company; - UserCompanyEntityBuilder _origUserCompany; - UserCompanyEntityBuilder get origUserCompany => - _$this._origUserCompany ??= new UserCompanyEntityBuilder(); - set origUserCompany(UserCompanyEntityBuilder origUserCompany) => - _$this._origUserCompany = origUserCompany; + CompanyEntityBuilder _origCompany; + CompanyEntityBuilder get origCompany => + _$this._origCompany ??= new CompanyEntityBuilder(); + set origCompany(CompanyEntityBuilder origCompany) => + _$this._origCompany = origCompany; ClientEntityBuilder _client; ClientEntityBuilder get client => @@ -871,6 +904,15 @@ class SettingsUIStateBuilder _$this._origGroup ??= new GroupEntityBuilder(); set origGroup(GroupEntityBuilder origGroup) => _$this._origGroup = origGroup; + UserEntityBuilder _user; + UserEntityBuilder get user => _$this._user ??= new UserEntityBuilder(); + set user(UserEntityBuilder user) => _$this._user = user; + + UserEntityBuilder _origUser; + UserEntityBuilder get origUser => + _$this._origUser ??= new UserEntityBuilder(); + set origUser(UserEntityBuilder origUser) => _$this._origUser = origUser; + EntityType _entityType; EntityType get entityType => _$this._entityType; set entityType(EntityType entityType) => _$this._entityType = entityType; @@ -900,12 +942,14 @@ class SettingsUIStateBuilder SettingsUIStateBuilder get _$this { if (_$v != null) { - _userCompany = _$v.userCompany?.toBuilder(); - _origUserCompany = _$v.origUserCompany?.toBuilder(); + _company = _$v.company?.toBuilder(); + _origCompany = _$v.origCompany?.toBuilder(); _client = _$v.client?.toBuilder(); _origClient = _$v.origClient?.toBuilder(); _group = _$v.group?.toBuilder(); _origGroup = _$v.origGroup?.toBuilder(); + _user = _$v.user?.toBuilder(); + _origUser = _$v.origUser?.toBuilder(); _entityType = _$v.entityType; _isChanged = _$v.isChanged; _updatedAt = _$v.updatedAt; @@ -936,12 +980,14 @@ class SettingsUIStateBuilder try { _$result = _$v ?? new _$SettingsUIState._( - userCompany: userCompany.build(), - origUserCompany: origUserCompany.build(), + company: company.build(), + origCompany: origCompany.build(), client: client.build(), origClient: origClient.build(), group: group.build(), origGroup: origGroup.build(), + user: user.build(), + origUser: origUser.build(), entityType: entityType, isChanged: isChanged, updatedAt: updatedAt, @@ -951,10 +997,10 @@ class SettingsUIStateBuilder } catch (_) { String _$failedField; try { - _$failedField = 'userCompany'; - userCompany.build(); - _$failedField = 'origUserCompany'; - origUserCompany.build(); + _$failedField = 'company'; + company.build(); + _$failedField = 'origCompany'; + origCompany.build(); _$failedField = 'client'; client.build(); _$failedField = 'origClient'; @@ -963,6 +1009,10 @@ class SettingsUIStateBuilder group.build(); _$failedField = 'origGroup'; origGroup.build(); + _$failedField = 'user'; + user.build(); + _$failedField = 'origUser'; + origUser.build(); } catch (e) { throw new BuiltValueNestedFieldError( 'SettingsUIState', _$failedField, e.toString()); diff --git a/lib/redux/settings/settings_actions.dart b/lib/redux/settings/settings_actions.dart index 88764c117..16d17865a 100644 --- a/lib/redux/settings/settings_actions.dart +++ b/lib/redux/settings/settings_actions.dart @@ -11,16 +11,18 @@ import 'package:invoiceninja_flutter/redux/app/app_actions.dart'; class ViewSettings extends AbstractNavigatorAction implements PersistUI { ViewSettings({ @required NavigatorState navigator, - this.userCompany, + this.company, this.group, this.client, + this.user, this.force = false, this.section, }) : super(navigator: navigator); - final UserCompanyEntity userCompany; + final CompanyEntity company; final GroupEntity group; final ClientEntity client; + final UserEntity user; final bool force; final String section; } diff --git a/lib/redux/ui/pref_reducer.dart b/lib/redux/ui/pref_reducer.dart index f3bb5abc8..057662f1d 100644 --- a/lib/redux/ui/pref_reducer.dart +++ b/lib/redux/ui/pref_reducer.dart @@ -171,17 +171,10 @@ Reducer selectedCompanyIndexReducer = combineReducers([ ]); Reducer settingsUIReducer = combineReducers([ - TypedReducer((state, action) { - return state.rebuild((b) => b - ..updatedAt = DateTime.now().millisecondsSinceEpoch - ..userCompany.replace(state.origUserCompany) - ..entityType = EntityType.company - ..isChanged = false); - }), TypedReducer((state, action) { return state.rebuild((b) => b - ..userCompany.replace(action.userCompany ?? state.userCompany) - ..origUserCompany.replace(action.userCompany ?? state.origUserCompany) + ..company.replace(action.company ?? state.company) + ..origCompany.replace(action.company ?? state.origCompany) ..group.replace(action.group ?? state.group) ..origGroup.replace(action.group ?? state.origGroup) ..client.replace(action.client ?? state.client) @@ -195,14 +188,14 @@ Reducer settingsUIReducer = combineReducers([ }), TypedReducer((state, action) { return state.rebuild((b) => b - ..userCompany.company.replace(action.company) + ..company.replace(action.company) ..isChanged = true); }), TypedReducer((state, action) { switch (state.entityType) { case EntityType.client: return state.rebuild((b) => b - //..client.settings.replace(action.settings) + ..client.settings.replace(action.settings) ..isChanged = true); case EntityType.group: return state.rebuild((b) => b @@ -210,18 +203,18 @@ Reducer settingsUIReducer = combineReducers([ ..isChanged = true); default: return state.rebuild((b) => b - ..userCompany.company.settings.replace(action.settings) + ..company.settings.replace(action.settings) ..isChanged = true); } }), TypedReducer((state, action) { return state.rebuild((b) => b - ..userCompany.user.replace(action.user) + ..user.replace(action.user) ..isChanged = true); }), TypedReducer((state, action) { return state.rebuild((b) => b - ..userCompany.replace(state.origUserCompany) + ..company.replace(state.origCompany) ..group.replace(state.origGroup) ..client.replace(state.origClient) ..isChanged = false @@ -229,7 +222,7 @@ Reducer settingsUIReducer = combineReducers([ }), TypedReducer((state, action) { return state.rebuild((b) => b - ..userCompany.company.replace(action.company) + ..company.replace(action.company) ..isChanged = false); }), TypedReducer((state, action) { @@ -249,6 +242,13 @@ Reducer settingsUIReducer = combineReducers([ ? DateTime.now().millisecondsSinceEpoch : state.filterClearedAt); }), + TypedReducer((state, action) { + return state.rebuild((b) => b + ..updatedAt = DateTime.now().millisecondsSinceEpoch + ..company.replace(state.company) + ..entityType = EntityType.company + ..isChanged = false); + }), ]); CompanyPrefState companyPrefReducer(CompanyPrefState state, dynamic action) { diff --git a/lib/redux/ui/ui_reducer.dart b/lib/redux/ui/ui_reducer.dart index c1c809e92..37b8d3a84 100644 --- a/lib/redux/ui/ui_reducer.dart +++ b/lib/redux/ui/ui_reducer.dart @@ -226,14 +226,14 @@ Reducer settingsUIReducer = combineReducers([ TypedReducer((state, action) { return state.rebuild((b) => b ..updatedAt = DateTime.now().millisecondsSinceEpoch - ..userCompany.replace(state.origUserCompany) + ..company.replace(state.origCompany) ..entityType = EntityType.company ..isChanged = false); }), TypedReducer((state, action) { return state.rebuild((b) => b - ..userCompany.replace(action.userCompany ?? state.userCompany) - ..origUserCompany.replace(action.userCompany ?? state.origUserCompany) + ..company.replace(action.company ?? state.company) + ..origCompany.replace(action.company ?? state.origCompany) ..group.replace(action.group ?? state.group) ..origGroup.replace(action.group ?? state.origGroup) ..client.replace(action.client ?? state.client) @@ -247,7 +247,7 @@ Reducer settingsUIReducer = combineReducers([ }), TypedReducer((state, action) { return state.rebuild((b) => b - ..userCompany.company.replace(action.company) + ..company.replace(action.company) ..isChanged = true); }), TypedReducer((state, action) { @@ -262,18 +262,18 @@ Reducer settingsUIReducer = combineReducers([ ..isChanged = true); default: return state.rebuild((b) => b - ..userCompany.company.settings.replace(action.settings) + ..company.settings.replace(action.settings) ..isChanged = true); } }), TypedReducer((state, action) { return state.rebuild((b) => b - ..userCompany.user.replace(action.user) + ..user.replace(action.user) ..isChanged = true); }), TypedReducer((state, action) { return state.rebuild((b) => b - ..userCompany.replace(state.origUserCompany) + ..company.replace(state.origCompany) ..group.replace(state.origGroup) ..client.replace(state.origClient) ..isChanged = false @@ -281,7 +281,7 @@ Reducer settingsUIReducer = combineReducers([ }), TypedReducer((state, action) { return state.rebuild((b) => b - ..userCompany.company.replace(action.company) + ..company.replace(action.company) ..isChanged = false); }), TypedReducer((state, action) { diff --git a/lib/ui/app/menu_drawer.dart b/lib/ui/app/menu_drawer.dart index fae30cfc6..0e91c8438 100644 --- a/lib/ui/app/menu_drawer.dart +++ b/lib/ui/app/menu_drawer.dart @@ -213,7 +213,7 @@ class MenuDrawer extends StatelessWidget { onTap: () { store.dispatch(ViewSettings( navigator: Navigator.of(context), - userCompany: state.userCompany)); + company: state.company)); }, ), ], diff --git a/lib/ui/company_gateway/company_gateway_screen_vm.dart b/lib/ui/company_gateway/company_gateway_screen_vm.dart index 93d46ca50..99fdc3c46 100644 --- a/lib/ui/company_gateway/company_gateway_screen_vm.dart +++ b/lib/ui/company_gateway/company_gateway_screen_vm.dart @@ -70,7 +70,7 @@ class CompanyGatewayScreenVM { context, AppLocalization.of(context).savedSettings); store.dispatch(SaveCompanyRequest( completer: completer, - company: settingsUIState.userCompany.company)); + company: settingsUIState.company)); break; case EntityType.group: final completer = snackBarCompleter( diff --git a/lib/ui/settings/client_portal_vm.dart b/lib/ui/settings/client_portal_vm.dart index 50e948b82..1e4548570 100644 --- a/lib/ui/settings/client_portal_vm.dart +++ b/lib/ui/settings/client_portal_vm.dart @@ -50,7 +50,7 @@ class ClientPortalVM { return ClientPortalVM( state: state, settings: state.uiState.settingsUIState.settings, - company: state.uiState.settingsUIState.userCompany.company, + company: state.uiState.settingsUIState.company, onSettingsChanged: (settings) => store.dispatch(UpdateSettings(settings: settings)), onCompanyChanged: (company) => @@ -63,7 +63,7 @@ class ClientPortalVM { context, AppLocalization.of(context).savedSettings); store.dispatch(SaveCompanyRequest( completer: completer, - company: settingsUIState.userCompany.company)); + company: settingsUIState.company)); break; case EntityType.group: final completer = snackBarCompleter( diff --git a/lib/ui/settings/company_details_vm.dart b/lib/ui/settings/company_details_vm.dart index 0afc033c0..6ec425a3c 100644 --- a/lib/ui/settings/company_details_vm.dart +++ b/lib/ui/settings/company_details_vm.dart @@ -50,7 +50,7 @@ class CompanyDetailsVM { return CompanyDetailsVM( state: state, settings: state.uiState.settingsUIState.settings, - company: state.uiState.settingsUIState.userCompany.company, + company: state.uiState.settingsUIState.company, onSettingsChanged: (settings) => store.dispatch(UpdateSettings(settings: settings)), onCompanyChanged: (company) => @@ -63,7 +63,7 @@ class CompanyDetailsVM { context, AppLocalization.of(context).savedSettings); store.dispatch(SaveCompanyRequest( completer: completer, - company: settingsUIState.userCompany.company)); + company: settingsUIState.company)); break; case EntityType.group: final completer = snackBarCompleter( diff --git a/lib/ui/settings/custom_fields_vm.dart b/lib/ui/settings/custom_fields_vm.dart index 65df86745..aee4b8e39 100644 --- a/lib/ui/settings/custom_fields_vm.dart +++ b/lib/ui/settings/custom_fields_vm.dart @@ -46,7 +46,7 @@ class CustomFieldsVM { return CustomFieldsVM( state: state, - company: state.uiState.settingsUIState.userCompany.company, + company: state.uiState.settingsUIState.company, onCompanyChanged: (company) => store.dispatch(UpdateCompany(company: company)), onSavePressed: (context) { @@ -57,7 +57,7 @@ class CustomFieldsVM { context, AppLocalization.of(context).savedSettings); store.dispatch(SaveCompanyRequest( completer: completer, - company: settingsUIState.userCompany.company)); + company: settingsUIState.company)); break; case EntityType.group: final completer = snackBarCompleter( diff --git a/lib/ui/settings/email_settings_vm.dart b/lib/ui/settings/email_settings_vm.dart index 936b68bbc..8287ed739 100644 --- a/lib/ui/settings/email_settings_vm.dart +++ b/lib/ui/settings/email_settings_vm.dart @@ -59,7 +59,7 @@ class EmailSettingsVM { context, AppLocalization.of(context).savedSettings); store.dispatch(SaveCompanyRequest( completer: completer, - company: settingsUIState.userCompany.company)); + company: settingsUIState.company)); break; case EntityType.group: final completer = snackBarCompleter( diff --git a/lib/ui/settings/generated_numbers_vm.dart b/lib/ui/settings/generated_numbers_vm.dart index 9c2bbe08d..1e7aecd05 100644 --- a/lib/ui/settings/generated_numbers_vm.dart +++ b/lib/ui/settings/generated_numbers_vm.dart @@ -49,7 +49,7 @@ class GeneratedNumbersVM { return GeneratedNumbersVM( state: state, - company: state.uiState.settingsUIState.userCompany.company, + company: state.uiState.settingsUIState.company, settings: state.uiState.settingsUIState.settings, onCompanyChanged: (company) => store.dispatch(UpdateCompany(company: company)), @@ -64,7 +64,7 @@ class GeneratedNumbersVM { context, AppLocalization.of(context).savedSettings); store.dispatch(SaveCompanyRequest( completer: completer, - company: settingsUIState.userCompany.company)); + company: settingsUIState.company)); break; case EntityType.group: final completer = snackBarCompleter( diff --git a/lib/ui/settings/invoice_design_vm.dart b/lib/ui/settings/invoice_design_vm.dart index 1a69dd5e9..1d05d91fd 100644 --- a/lib/ui/settings/invoice_design_vm.dart +++ b/lib/ui/settings/invoice_design_vm.dart @@ -49,7 +49,7 @@ class InvoiceDesignVM { return InvoiceDesignVM( state: state, settings: state.uiState.settingsUIState.settings, - company: state.uiState.settingsUIState.userCompany.company, + company: state.uiState.settingsUIState.company, onSettingsChanged: (settings) { store.dispatch(UpdateSettings(settings: settings)); }, @@ -61,7 +61,7 @@ class InvoiceDesignVM { context, AppLocalization.of(context).savedSettings); store.dispatch(SaveCompanyRequest( completer: completer, - company: settingsUIState.userCompany.company)); + company: settingsUIState.company)); break; case EntityType.group: final completer = snackBarCompleter( diff --git a/lib/ui/settings/localization_vm.dart b/lib/ui/settings/localization_vm.dart index 886b54898..ecc50dc4d 100644 --- a/lib/ui/settings/localization_vm.dart +++ b/lib/ui/settings/localization_vm.dart @@ -50,7 +50,7 @@ class LocalizationSettingsVM { return LocalizationSettingsVM( state: state, settings: state.uiState.settingsUIState.settings, - company: state.uiState.settingsUIState.userCompany.company, + company: state.uiState.settingsUIState.company, onSettingsChanged: (settings) { store.dispatch(UpdateSettings(settings: settings)); }, @@ -64,7 +64,7 @@ class LocalizationSettingsVM { context, AppLocalization.of(context).savedSettings); store.dispatch(SaveCompanyRequest( completer: completer, - company: settingsUIState.userCompany.company)); + company: settingsUIState.company)); break; case EntityType.group: final completer = snackBarCompleter( diff --git a/lib/ui/settings/product_settings_vm.dart b/lib/ui/settings/product_settings_vm.dart index 292667841..a5e040112 100644 --- a/lib/ui/settings/product_settings_vm.dart +++ b/lib/ui/settings/product_settings_vm.dart @@ -41,7 +41,7 @@ class ProductSettingsVM { return ProductSettingsVM( state: state, - company: state.uiState.settingsUIState.userCompany.company, + company: state.uiState.settingsUIState.company, onCompanyChanged: (company) => store.dispatch(UpdateCompany(company: company)), onSavePressed: (context) { @@ -50,7 +50,7 @@ class ProductSettingsVM { context, AppLocalization.of(context).savedSettings); store.dispatch(SaveCompanyRequest( completer: completer, - company: settingsUIState.userCompany.company)); + company: settingsUIState.company)); }); } diff --git a/lib/ui/settings/settings_list_vm.dart b/lib/ui/settings/settings_list_vm.dart index 3f84155b6..383c3817e 100644 --- a/lib/ui/settings/settings_list_vm.dart +++ b/lib/ui/settings/settings_list_vm.dart @@ -40,7 +40,7 @@ class SettingsListVM { store.dispatch(ViewSettings( navigator: Navigator.of(context), section: section, - userCompany: state.userCompany)); + company: state.company)); }, onClearSettingsFilterPressed: () => store.dispatch(ClearSettingsFilter()), diff --git a/lib/ui/settings/tax_settings_vm.dart b/lib/ui/settings/tax_settings_vm.dart index 8ade5508a..727448fe5 100644 --- a/lib/ui/settings/tax_settings_vm.dart +++ b/lib/ui/settings/tax_settings_vm.dart @@ -46,7 +46,7 @@ class TaxSettingsVM { return TaxSettingsVM( state: state, settings: state.uiState.settingsUIState.settings, - company: state.uiState.settingsUIState.userCompany.company, + company: state.uiState.settingsUIState.company, onSettingsChanged: (settings) { store.dispatch(UpdateSettings(settings: settings)); }, @@ -58,7 +58,7 @@ class TaxSettingsVM { context, AppLocalization.of(context).savedSettings); store.dispatch(SaveCompanyRequest( completer: completer, - company: settingsUIState.userCompany.company)); + company: settingsUIState.company)); }, onConfigureRatesPressed: (context) { if (state.taxRateState.list.isEmpty) { diff --git a/lib/ui/settings/templates_and_reminders_vm.dart b/lib/ui/settings/templates_and_reminders_vm.dart index 173407578..6a0294064 100644 --- a/lib/ui/settings/templates_and_reminders_vm.dart +++ b/lib/ui/settings/templates_and_reminders_vm.dart @@ -60,7 +60,7 @@ class TemplatesAndRemindersVM { context, AppLocalization.of(context).savedSettings); store.dispatch(SaveCompanyRequest( completer: completer, - company: settingsUIState.userCompany.company)); + company: settingsUIState.company)); break; case EntityType.group: final completer = snackBarCompleter( diff --git a/lib/ui/settings/user_details_vm.dart b/lib/ui/settings/user_details_vm.dart index e99697e97..245f61c27 100644 --- a/lib/ui/settings/user_details_vm.dart +++ b/lib/ui/settings/user_details_vm.dart @@ -40,14 +40,14 @@ class UserDetailsVM { return UserDetailsVM( state: state, - user: state.uiState.settingsUIState.userCompany.user, + user: state.uiState.settingsUIState.user, onChanged: (user) => store.dispatch(UpdateSettingsUser(user: user)), onSavePressed: (context) { final completer = snackBarCompleter( context, AppLocalization.of(context).savedSettings); store.dispatch(SaveUserRequest( completer: completer, - user: state.uiState.settingsUIState.userCompany.user)); + user: state.uiState.settingsUIState.user)); }); } diff --git a/lib/ui/settings/workflow_vm.dart b/lib/ui/settings/workflow_vm.dart index 15a0daec5..c6ff7dde5 100644 --- a/lib/ui/settings/workflow_vm.dart +++ b/lib/ui/settings/workflow_vm.dart @@ -59,7 +59,7 @@ class WorkflowSettingsVM { context, AppLocalization.of(context).savedSettings); store.dispatch(SaveCompanyRequest( completer: completer, - company: settingsUIState.userCompany.company)); + company: settingsUIState.company)); break; case EntityType.group: final completer = snackBarCompleter(