Settings
This commit is contained in:
parent
e71b09816b
commit
ed271f6389
|
|
@ -35,14 +35,10 @@ import 'package:invoiceninja_flutter/redux/quote/quote_state.dart';
|
||||||
// STARTER: import - do not remove comment
|
// STARTER: import - do not remove comment
|
||||||
import 'package:invoiceninja_flutter/data/models/user_model.dart';
|
import 'package:invoiceninja_flutter/data/models/user_model.dart';
|
||||||
import 'package:invoiceninja_flutter/redux/user/user_state.dart';
|
import 'package:invoiceninja_flutter/redux/user/user_state.dart';
|
||||||
|
|
||||||
import 'package:invoiceninja_flutter/redux/tax_rate/tax_rate_state.dart';
|
import 'package:invoiceninja_flutter/redux/tax_rate/tax_rate_state.dart';
|
||||||
|
|
||||||
import 'package:invoiceninja_flutter/data/models/company_gateway_model.dart';
|
import 'package:invoiceninja_flutter/data/models/company_gateway_model.dart';
|
||||||
import 'package:invoiceninja_flutter/redux/company_gateway/company_gateway_state.dart';
|
import 'package:invoiceninja_flutter/redux/company_gateway/company_gateway_state.dart';
|
||||||
|
|
||||||
import 'package:invoiceninja_flutter/redux/group/group_state.dart';
|
import 'package:invoiceninja_flutter/redux/group/group_state.dart';
|
||||||
|
|
||||||
import 'package:invoiceninja_flutter/redux/document/document_state.dart';
|
import 'package:invoiceninja_flutter/redux/document/document_state.dart';
|
||||||
|
|
||||||
part 'serializers.g.dart';
|
part 'serializers.g.dart';
|
||||||
|
|
@ -112,7 +108,8 @@ part 'serializers.g.dart';
|
||||||
TaxRateListResponse,
|
TaxRateListResponse,
|
||||||
// STARTER: serializers - do not remove comment
|
// STARTER: serializers - do not remove comment
|
||||||
UserEntity,
|
UserEntity,
|
||||||
|
UserListResponse,
|
||||||
|
UserItemResponse,
|
||||||
CompanyGatewayEntity,
|
CompanyGatewayEntity,
|
||||||
CompanyGatewayListResponse,
|
CompanyGatewayListResponse,
|
||||||
CompanyGatewayItemResponse,
|
CompanyGatewayItemResponse,
|
||||||
|
|
|
||||||
|
|
@ -134,6 +134,7 @@ Serializers _$serializers = (new Serializers().toBuilder()
|
||||||
..add(UserCompanyState.serializer)
|
..add(UserCompanyState.serializer)
|
||||||
..add(UserEntity.serializer)
|
..add(UserEntity.serializer)
|
||||||
..add(UserItemResponse.serializer)
|
..add(UserItemResponse.serializer)
|
||||||
|
..add(UserListResponse.serializer)
|
||||||
..add(UserState.serializer)
|
..add(UserState.serializer)
|
||||||
..add(UserUIState.serializer)
|
..add(UserUIState.serializer)
|
||||||
..add(VendorContactEntity.serializer)
|
..add(VendorContactEntity.serializer)
|
||||||
|
|
@ -314,6 +315,7 @@ Serializers _$serializers = (new Serializers().toBuilder()
|
||||||
const FullType(BuiltList, const [const FullType(TaxRateEntity)]), () => new ListBuilder<TaxRateEntity>())
|
const FullType(BuiltList, const [const FullType(TaxRateEntity)]), () => new ListBuilder<TaxRateEntity>())
|
||||||
..addBuilderFactory(const FullType(BuiltList, const [const FullType(TimezoneEntity)]), () => new ListBuilder<TimezoneEntity>())
|
..addBuilderFactory(const FullType(BuiltList, const [const FullType(TimezoneEntity)]), () => new ListBuilder<TimezoneEntity>())
|
||||||
..addBuilderFactory(const FullType(BuiltList, const [const FullType(UserCompanyEntity)]), () => new ListBuilder<UserCompanyEntity>())
|
..addBuilderFactory(const FullType(BuiltList, const [const FullType(UserCompanyEntity)]), () => new ListBuilder<UserCompanyEntity>())
|
||||||
|
..addBuilderFactory(const FullType(BuiltList, const [const FullType(UserEntity)]), () => new ListBuilder<UserEntity>())
|
||||||
..addBuilderFactory(const FullType(BuiltList, const [const FullType(VendorContactEntity)]), () => new ListBuilder<VendorContactEntity>())
|
..addBuilderFactory(const FullType(BuiltList, const [const FullType(VendorContactEntity)]), () => new ListBuilder<VendorContactEntity>())
|
||||||
..addBuilderFactory(const FullType(BuiltList, const [const FullType(VendorEntity)]), () => new ListBuilder<VendorEntity>())
|
..addBuilderFactory(const FullType(BuiltList, const [const FullType(VendorEntity)]), () => new ListBuilder<VendorEntity>())
|
||||||
..addBuilderFactory(const FullType(BuiltMap, const [const FullType(String), const FullType(ClientEntity)]), () => new MapBuilder<String, ClientEntity>())
|
..addBuilderFactory(const FullType(BuiltMap, const [const FullType(String), const FullType(ClientEntity)]), () => new MapBuilder<String, ClientEntity>())
|
||||||
|
|
|
||||||
|
|
@ -56,6 +56,7 @@ abstract class UserEntity extends Object
|
||||||
updatedAt: 0,
|
updatedAt: 0,
|
||||||
archivedAt: 0,
|
archivedAt: 0,
|
||||||
isDeleted: false,
|
isDeleted: false,
|
||||||
|
isAdmin: false,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -76,6 +77,10 @@ abstract class UserEntity extends Object
|
||||||
|
|
||||||
String get phone;
|
String get phone;
|
||||||
|
|
||||||
|
@nullable
|
||||||
|
@BuiltValueField(wireName: 'is_admin')
|
||||||
|
bool get isAdmin;
|
||||||
|
|
||||||
String get fullName => (firstName + ' ' + lastName).trim();
|
String get fullName => (firstName + ' ' + lastName).trim();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|
|
||||||
|
|
@ -122,6 +122,12 @@ class _$UserEntitySerializer implements StructuredSerializer<UserEntity> {
|
||||||
serializers.serialize(object.phone,
|
serializers.serialize(object.phone,
|
||||||
specifiedType: const FullType(String)),
|
specifiedType: const FullType(String)),
|
||||||
];
|
];
|
||||||
|
if (object.isAdmin != null) {
|
||||||
|
result
|
||||||
|
..add('is_admin')
|
||||||
|
..add(serializers.serialize(object.isAdmin,
|
||||||
|
specifiedType: const FullType(bool)));
|
||||||
|
}
|
||||||
if (object.isChanged != null) {
|
if (object.isChanged != null) {
|
||||||
result
|
result
|
||||||
..add('isChanged')
|
..add('isChanged')
|
||||||
|
|
@ -194,6 +200,10 @@ class _$UserEntitySerializer implements StructuredSerializer<UserEntity> {
|
||||||
result.phone = serializers.deserialize(value,
|
result.phone = serializers.deserialize(value,
|
||||||
specifiedType: const FullType(String)) as String;
|
specifiedType: const FullType(String)) as String;
|
||||||
break;
|
break;
|
||||||
|
case 'is_admin':
|
||||||
|
result.isAdmin = serializers.deserialize(value,
|
||||||
|
specifiedType: const FullType(bool)) as bool;
|
||||||
|
break;
|
||||||
case 'isChanged':
|
case 'isChanged':
|
||||||
result.isChanged = serializers.deserialize(value,
|
result.isChanged = serializers.deserialize(value,
|
||||||
specifiedType: const FullType(bool)) as bool;
|
specifiedType: const FullType(bool)) as bool;
|
||||||
|
|
@ -424,6 +434,8 @@ class _$UserEntity extends UserEntity {
|
||||||
@override
|
@override
|
||||||
final String phone;
|
final String phone;
|
||||||
@override
|
@override
|
||||||
|
final bool isAdmin;
|
||||||
|
@override
|
||||||
final bool isChanged;
|
final bool isChanged;
|
||||||
@override
|
@override
|
||||||
final int createdAt;
|
final int createdAt;
|
||||||
|
|
@ -446,6 +458,7 @@ class _$UserEntity extends UserEntity {
|
||||||
this.lastName,
|
this.lastName,
|
||||||
this.email,
|
this.email,
|
||||||
this.phone,
|
this.phone,
|
||||||
|
this.isAdmin,
|
||||||
this.isChanged,
|
this.isChanged,
|
||||||
this.createdAt,
|
this.createdAt,
|
||||||
this.updatedAt,
|
this.updatedAt,
|
||||||
|
|
@ -483,6 +496,7 @@ class _$UserEntity extends UserEntity {
|
||||||
lastName == other.lastName &&
|
lastName == other.lastName &&
|
||||||
email == other.email &&
|
email == other.email &&
|
||||||
phone == other.phone &&
|
phone == other.phone &&
|
||||||
|
isAdmin == other.isAdmin &&
|
||||||
isChanged == other.isChanged &&
|
isChanged == other.isChanged &&
|
||||||
createdAt == other.createdAt &&
|
createdAt == other.createdAt &&
|
||||||
updatedAt == other.updatedAt &&
|
updatedAt == other.updatedAt &&
|
||||||
|
|
@ -503,10 +517,12 @@ class _$UserEntity extends UserEntity {
|
||||||
$jc(
|
$jc(
|
||||||
$jc(
|
$jc(
|
||||||
$jc(
|
$jc(
|
||||||
$jc($jc(0, firstName.hashCode),
|
$jc(
|
||||||
lastName.hashCode),
|
$jc($jc(0, firstName.hashCode),
|
||||||
email.hashCode),
|
lastName.hashCode),
|
||||||
phone.hashCode),
|
email.hashCode),
|
||||||
|
phone.hashCode),
|
||||||
|
isAdmin.hashCode),
|
||||||
isChanged.hashCode),
|
isChanged.hashCode),
|
||||||
createdAt.hashCode),
|
createdAt.hashCode),
|
||||||
updatedAt.hashCode),
|
updatedAt.hashCode),
|
||||||
|
|
@ -523,6 +539,7 @@ class _$UserEntity extends UserEntity {
|
||||||
..add('lastName', lastName)
|
..add('lastName', lastName)
|
||||||
..add('email', email)
|
..add('email', email)
|
||||||
..add('phone', phone)
|
..add('phone', phone)
|
||||||
|
..add('isAdmin', isAdmin)
|
||||||
..add('isChanged', isChanged)
|
..add('isChanged', isChanged)
|
||||||
..add('createdAt', createdAt)
|
..add('createdAt', createdAt)
|
||||||
..add('updatedAt', updatedAt)
|
..add('updatedAt', updatedAt)
|
||||||
|
|
@ -553,6 +570,10 @@ class UserEntityBuilder implements Builder<UserEntity, UserEntityBuilder> {
|
||||||
String get phone => _$this._phone;
|
String get phone => _$this._phone;
|
||||||
set phone(String phone) => _$this._phone = phone;
|
set phone(String phone) => _$this._phone = phone;
|
||||||
|
|
||||||
|
bool _isAdmin;
|
||||||
|
bool get isAdmin => _$this._isAdmin;
|
||||||
|
set isAdmin(bool isAdmin) => _$this._isAdmin = isAdmin;
|
||||||
|
|
||||||
bool _isChanged;
|
bool _isChanged;
|
||||||
bool get isChanged => _$this._isChanged;
|
bool get isChanged => _$this._isChanged;
|
||||||
set isChanged(bool isChanged) => _$this._isChanged = isChanged;
|
set isChanged(bool isChanged) => _$this._isChanged = isChanged;
|
||||||
|
|
@ -589,6 +610,7 @@ class UserEntityBuilder implements Builder<UserEntity, UserEntityBuilder> {
|
||||||
_lastName = _$v.lastName;
|
_lastName = _$v.lastName;
|
||||||
_email = _$v.email;
|
_email = _$v.email;
|
||||||
_phone = _$v.phone;
|
_phone = _$v.phone;
|
||||||
|
_isAdmin = _$v.isAdmin;
|
||||||
_isChanged = _$v.isChanged;
|
_isChanged = _$v.isChanged;
|
||||||
_createdAt = _$v.createdAt;
|
_createdAt = _$v.createdAt;
|
||||||
_updatedAt = _$v.updatedAt;
|
_updatedAt = _$v.updatedAt;
|
||||||
|
|
@ -622,6 +644,7 @@ class UserEntityBuilder implements Builder<UserEntity, UserEntityBuilder> {
|
||||||
lastName: lastName,
|
lastName: lastName,
|
||||||
email: email,
|
email: email,
|
||||||
phone: phone,
|
phone: phone,
|
||||||
|
isAdmin: isAdmin,
|
||||||
isChanged: isChanged,
|
isChanged: isChanged,
|
||||||
createdAt: createdAt,
|
createdAt: createdAt,
|
||||||
updatedAt: updatedAt,
|
updatedAt: updatedAt,
|
||||||
|
|
|
||||||
|
|
@ -151,6 +151,18 @@ class _UserEditState extends State<UserEdit> {
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
FormCard(
|
||||||
|
children: <Widget>[
|
||||||
|
SwitchListTile(
|
||||||
|
title: Text(localization.administrator),
|
||||||
|
subtitle: Text(localization.administratorHelp),
|
||||||
|
value: user.isAdmin ?? false,
|
||||||
|
onChanged: (value) => viewModel
|
||||||
|
.onChanged(user.rebuild((b) => b..isAdmin = value)),
|
||||||
|
activeColor: Theme.of(context).accentColor,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,8 @@ abstract class LocaleCodeAware {
|
||||||
mixin LocalizationsProvider on LocaleCodeAware {
|
mixin LocalizationsProvider on LocaleCodeAware {
|
||||||
static final Map<String, Map<String, String>> _localizedValues = {
|
static final Map<String, Map<String, String>> _localizedValues = {
|
||||||
'en': {
|
'en': {
|
||||||
|
'administrator': 'Administrator',
|
||||||
|
'administrator_help': 'Allow user to manage users, change settings and modify all records',
|
||||||
'user_management': 'User Management',
|
'user_management': 'User Management',
|
||||||
'users': 'Users',
|
'users': 'Users',
|
||||||
'new_user': 'New User',
|
'new_user': 'New User',
|
||||||
|
|
@ -15395,6 +15397,11 @@ mixin LocalizationsProvider on LocaleCodeAware {
|
||||||
|
|
||||||
String get userManagement => _localizedValues[localeCode]['user_management'];
|
String get userManagement => _localizedValues[localeCode]['user_management'];
|
||||||
|
|
||||||
|
String get administrator => _localizedValues[localeCode]['administrator'];
|
||||||
|
|
||||||
|
String get administratorHelp => _localizedValues[localeCode]['administrator_help'];
|
||||||
|
|
||||||
|
|
||||||
String lookup(String key) {
|
String lookup(String key) {
|
||||||
final lookupKey = toSnakeCase(key);
|
final lookupKey = toSnakeCase(key);
|
||||||
return _localizedValues[localeCode][lookupKey] ??
|
return _localizedValues[localeCode][lookupKey] ??
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue