Add client count
This commit is contained in:
parent
0957ebe1d6
commit
d9af7bef45
|
|
@ -27,6 +27,7 @@ abstract class AccountEntity
|
||||||
defaultCompanyId: '',
|
defaultCompanyId: '',
|
||||||
trialPlan: '',
|
trialPlan: '',
|
||||||
trialStarted: '',
|
trialStarted: '',
|
||||||
|
clientCount: 0,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -79,6 +80,9 @@ abstract class AccountEntity
|
||||||
@BuiltValueField(wireName: 'default_company_id')
|
@BuiltValueField(wireName: 'default_company_id')
|
||||||
String get defaultCompanyId;
|
String get defaultCompanyId;
|
||||||
|
|
||||||
|
@BuiltValueField(wireName: 'client_count')
|
||||||
|
int get clientCount;
|
||||||
|
|
||||||
bool get isUpdateAvailable {
|
bool get isUpdateAvailable {
|
||||||
if (!isSchedulerRunning || disableAutoUpdate) {
|
if (!isSchedulerRunning || disableAutoUpdate) {
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -98,7 +102,8 @@ abstract class AccountEntity
|
||||||
..isMigrated = false
|
..isMigrated = false
|
||||||
..trialPlan = ''
|
..trialPlan = ''
|
||||||
..trialStarted = ''
|
..trialStarted = ''
|
||||||
..defaultCompanyId = '';
|
..defaultCompanyId = ''
|
||||||
|
..clientCount = 0;
|
||||||
|
|
||||||
static Serializer<AccountEntity> get serializer => _$accountEntitySerializer;
|
static Serializer<AccountEntity> get serializer => _$accountEntitySerializer;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -62,6 +62,9 @@ class _$AccountEntitySerializer implements StructuredSerializer<AccountEntity> {
|
||||||
'default_company_id',
|
'default_company_id',
|
||||||
serializers.serialize(object.defaultCompanyId,
|
serializers.serialize(object.defaultCompanyId,
|
||||||
specifiedType: const FullType(String)),
|
specifiedType: const FullType(String)),
|
||||||
|
'client_count',
|
||||||
|
serializers.serialize(object.clientCount,
|
||||||
|
specifiedType: const FullType(int)),
|
||||||
];
|
];
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|
@ -139,6 +142,10 @@ class _$AccountEntitySerializer implements StructuredSerializer<AccountEntity> {
|
||||||
result.defaultCompanyId = serializers.deserialize(value,
|
result.defaultCompanyId = serializers.deserialize(value,
|
||||||
specifiedType: const FullType(String)) as String;
|
specifiedType: const FullType(String)) as String;
|
||||||
break;
|
break;
|
||||||
|
case 'client_count':
|
||||||
|
result.clientCount = serializers.deserialize(value,
|
||||||
|
specifiedType: const FullType(int)) as int;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -177,6 +184,8 @@ class _$AccountEntity extends AccountEntity {
|
||||||
final bool disableAutoUpdate;
|
final bool disableAutoUpdate;
|
||||||
@override
|
@override
|
||||||
final String defaultCompanyId;
|
final String defaultCompanyId;
|
||||||
|
@override
|
||||||
|
final int clientCount;
|
||||||
|
|
||||||
factory _$AccountEntity([void Function(AccountEntityBuilder) updates]) =>
|
factory _$AccountEntity([void Function(AccountEntityBuilder) updates]) =>
|
||||||
(new AccountEntityBuilder()..update(updates)).build();
|
(new AccountEntityBuilder()..update(updates)).build();
|
||||||
|
|
@ -196,7 +205,8 @@ class _$AccountEntity extends AccountEntity {
|
||||||
this.isMigrated,
|
this.isMigrated,
|
||||||
this.isSchedulerRunning,
|
this.isSchedulerRunning,
|
||||||
this.disableAutoUpdate,
|
this.disableAutoUpdate,
|
||||||
this.defaultCompanyId})
|
this.defaultCompanyId,
|
||||||
|
this.clientCount})
|
||||||
: super._() {
|
: super._() {
|
||||||
BuiltValueNullFieldError.checkNotNull(id, 'AccountEntity', 'id');
|
BuiltValueNullFieldError.checkNotNull(id, 'AccountEntity', 'id');
|
||||||
BuiltValueNullFieldError.checkNotNull(
|
BuiltValueNullFieldError.checkNotNull(
|
||||||
|
|
@ -226,6 +236,8 @@ class _$AccountEntity extends AccountEntity {
|
||||||
disableAutoUpdate, 'AccountEntity', 'disableAutoUpdate');
|
disableAutoUpdate, 'AccountEntity', 'disableAutoUpdate');
|
||||||
BuiltValueNullFieldError.checkNotNull(
|
BuiltValueNullFieldError.checkNotNull(
|
||||||
defaultCompanyId, 'AccountEntity', 'defaultCompanyId');
|
defaultCompanyId, 'AccountEntity', 'defaultCompanyId');
|
||||||
|
BuiltValueNullFieldError.checkNotNull(
|
||||||
|
clientCount, 'AccountEntity', 'clientCount');
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|
@ -253,7 +265,8 @@ class _$AccountEntity extends AccountEntity {
|
||||||
isMigrated == other.isMigrated &&
|
isMigrated == other.isMigrated &&
|
||||||
isSchedulerRunning == other.isSchedulerRunning &&
|
isSchedulerRunning == other.isSchedulerRunning &&
|
||||||
disableAutoUpdate == other.disableAutoUpdate &&
|
disableAutoUpdate == other.disableAutoUpdate &&
|
||||||
defaultCompanyId == other.defaultCompanyId;
|
defaultCompanyId == other.defaultCompanyId &&
|
||||||
|
clientCount == other.clientCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
int __hashCode;
|
int __hashCode;
|
||||||
|
|
@ -272,9 +285,16 @@ class _$AccountEntity extends AccountEntity {
|
||||||
$jc(
|
$jc(
|
||||||
$jc(
|
$jc(
|
||||||
$jc(
|
$jc(
|
||||||
$jc($jc(0, id.hashCode),
|
$jc(
|
||||||
trialPlan.hashCode),
|
$jc(
|
||||||
trialStarted.hashCode),
|
$jc(
|
||||||
|
0,
|
||||||
|
id
|
||||||
|
.hashCode),
|
||||||
|
trialPlan
|
||||||
|
.hashCode),
|
||||||
|
trialStarted
|
||||||
|
.hashCode),
|
||||||
defaultUrl.hashCode),
|
defaultUrl.hashCode),
|
||||||
reportErrors.hashCode),
|
reportErrors.hashCode),
|
||||||
plan.hashCode),
|
plan.hashCode),
|
||||||
|
|
@ -286,7 +306,8 @@ class _$AccountEntity extends AccountEntity {
|
||||||
isMigrated.hashCode),
|
isMigrated.hashCode),
|
||||||
isSchedulerRunning.hashCode),
|
isSchedulerRunning.hashCode),
|
||||||
disableAutoUpdate.hashCode),
|
disableAutoUpdate.hashCode),
|
||||||
defaultCompanyId.hashCode));
|
defaultCompanyId.hashCode),
|
||||||
|
clientCount.hashCode));
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|
@ -306,7 +327,8 @@ class _$AccountEntity extends AccountEntity {
|
||||||
..add('isMigrated', isMigrated)
|
..add('isMigrated', isMigrated)
|
||||||
..add('isSchedulerRunning', isSchedulerRunning)
|
..add('isSchedulerRunning', isSchedulerRunning)
|
||||||
..add('disableAutoUpdate', disableAutoUpdate)
|
..add('disableAutoUpdate', disableAutoUpdate)
|
||||||
..add('defaultCompanyId', defaultCompanyId))
|
..add('defaultCompanyId', defaultCompanyId)
|
||||||
|
..add('clientCount', clientCount))
|
||||||
.toString();
|
.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -380,6 +402,10 @@ class AccountEntityBuilder
|
||||||
set defaultCompanyId(String defaultCompanyId) =>
|
set defaultCompanyId(String defaultCompanyId) =>
|
||||||
_$this._defaultCompanyId = defaultCompanyId;
|
_$this._defaultCompanyId = defaultCompanyId;
|
||||||
|
|
||||||
|
int _clientCount;
|
||||||
|
int get clientCount => _$this._clientCount;
|
||||||
|
set clientCount(int clientCount) => _$this._clientCount = clientCount;
|
||||||
|
|
||||||
AccountEntityBuilder() {
|
AccountEntityBuilder() {
|
||||||
AccountEntity._initializeBuilder(this);
|
AccountEntity._initializeBuilder(this);
|
||||||
}
|
}
|
||||||
|
|
@ -402,6 +428,7 @@ class AccountEntityBuilder
|
||||||
_isSchedulerRunning = $v.isSchedulerRunning;
|
_isSchedulerRunning = $v.isSchedulerRunning;
|
||||||
_disableAutoUpdate = $v.disableAutoUpdate;
|
_disableAutoUpdate = $v.disableAutoUpdate;
|
||||||
_defaultCompanyId = $v.defaultCompanyId;
|
_defaultCompanyId = $v.defaultCompanyId;
|
||||||
|
_clientCount = $v.clientCount;
|
||||||
_$v = null;
|
_$v = null;
|
||||||
}
|
}
|
||||||
return this;
|
return this;
|
||||||
|
|
@ -445,7 +472,8 @@ class AccountEntityBuilder
|
||||||
isMigrated: BuiltValueNullFieldError.checkNotNull(isMigrated, 'AccountEntity', 'isMigrated'),
|
isMigrated: BuiltValueNullFieldError.checkNotNull(isMigrated, 'AccountEntity', 'isMigrated'),
|
||||||
isSchedulerRunning: BuiltValueNullFieldError.checkNotNull(isSchedulerRunning, 'AccountEntity', 'isSchedulerRunning'),
|
isSchedulerRunning: BuiltValueNullFieldError.checkNotNull(isSchedulerRunning, 'AccountEntity', 'isSchedulerRunning'),
|
||||||
disableAutoUpdate: BuiltValueNullFieldError.checkNotNull(disableAutoUpdate, 'AccountEntity', 'disableAutoUpdate'),
|
disableAutoUpdate: BuiltValueNullFieldError.checkNotNull(disableAutoUpdate, 'AccountEntity', 'disableAutoUpdate'),
|
||||||
defaultCompanyId: BuiltValueNullFieldError.checkNotNull(defaultCompanyId, 'AccountEntity', 'defaultCompanyId'));
|
defaultCompanyId: BuiltValueNullFieldError.checkNotNull(defaultCompanyId, 'AccountEntity', 'defaultCompanyId'),
|
||||||
|
clientCount: BuiltValueNullFieldError.checkNotNull(clientCount, 'AccountEntity', 'clientCount'));
|
||||||
replace(_$result);
|
replace(_$result);
|
||||||
return _$result;
|
return _$result;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -306,7 +306,7 @@ class _AccountOverview extends StatelessWidget {
|
||||||
String secondLabel;
|
String secondLabel;
|
||||||
|
|
||||||
if (state.isHosted && (account.plan.isEmpty || account.isTrial)) {
|
if (state.isHosted && (account.plan.isEmpty || account.isTrial)) {
|
||||||
final clientLimit = viewModel.state.account.isMigrated ? 100 : 50;
|
final clientLimit = account.clientCount;
|
||||||
secondLabel = localization.clients;
|
secondLabel = localization.clients;
|
||||||
secondValue = '${viewModel.state.clientState.list.length} / $clientLimit';
|
secondValue = '${viewModel.state.clientState.list.length} / $clientLimit';
|
||||||
} else if (account.planExpires.isNotEmpty) {
|
} else if (account.planExpires.isNotEmpty) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue