Bank accounts

This commit is contained in:
Hillel Coren 2022-09-08 21:17:08 +03:00
parent f8494658bb
commit 96f96bfff0
4 changed files with 60 additions and 7 deletions

View File

@ -112,6 +112,8 @@ abstract class AccountEntity
return Version.parse(currentVersion) < Version.parse(latestVersion);
}
bool get isOld => id.isNotEmpty;
bool get isTrial => trialDaysLeft > 0;
bool get isEligibleForTrial => trialStarted.isEmpty && plan == kPlanFree;

View File

@ -66,6 +66,8 @@ abstract class BankAccountEntity extends Object
status: '',
type: '',
provider: '',
balance: 0,
currency: '',
);
}
@ -87,6 +89,10 @@ abstract class BankAccountEntity extends Object
@BuiltValueField(wireName: 'provider_name')
String get provider;
double get balance;
String get currency;
@override
EntityType get entityType => EntityType.bankAccount;

View File

@ -130,6 +130,12 @@ class _$BankAccountEntitySerializer
'provider_name',
serializers.serialize(object.provider,
specifiedType: const FullType(String)),
'balance',
serializers.serialize(object.balance,
specifiedType: const FullType(double)),
'currency',
serializers.serialize(object.currency,
specifiedType: const FullType(String)),
'created_at',
serializers.serialize(object.createdAt,
specifiedType: const FullType(int)),
@ -202,6 +208,14 @@ class _$BankAccountEntitySerializer
result.provider = serializers.deserialize(value,
specifiedType: const FullType(String)) as String;
break;
case 'balance':
result.balance = serializers.deserialize(value,
specifiedType: const FullType(double)) as double;
break;
case 'currency':
result.currency = serializers.deserialize(value,
specifiedType: const FullType(String)) as String;
break;
case 'isChanged':
result.isChanged = serializers.deserialize(value,
specifiedType: const FullType(bool)) as bool;
@ -441,6 +455,10 @@ class _$BankAccountEntity extends BankAccountEntity {
@override
final String provider;
@override
final double balance;
@override
final String currency;
@override
final bool isChanged;
@override
final int createdAt;
@ -466,6 +484,8 @@ class _$BankAccountEntity extends BankAccountEntity {
this.status,
this.type,
this.provider,
this.balance,
this.currency,
this.isChanged,
this.createdAt,
this.updatedAt,
@ -481,6 +501,10 @@ class _$BankAccountEntity extends BankAccountEntity {
BuiltValueNullFieldError.checkNotNull(type, 'BankAccountEntity', 'type');
BuiltValueNullFieldError.checkNotNull(
provider, 'BankAccountEntity', 'provider');
BuiltValueNullFieldError.checkNotNull(
balance, 'BankAccountEntity', 'balance');
BuiltValueNullFieldError.checkNotNull(
currency, 'BankAccountEntity', 'currency');
BuiltValueNullFieldError.checkNotNull(
createdAt, 'BankAccountEntity', 'createdAt');
BuiltValueNullFieldError.checkNotNull(
@ -506,6 +530,8 @@ class _$BankAccountEntity extends BankAccountEntity {
status == other.status &&
type == other.type &&
provider == other.provider &&
balance == other.balance &&
currency == other.currency &&
isChanged == other.isChanged &&
createdAt == other.createdAt &&
updatedAt == other.updatedAt &&
@ -526,6 +552,8 @@ class _$BankAccountEntity extends BankAccountEntity {
$jc(
$jc(
$jc(
$jc(
$jc(
$jc(
$jc(
$jc(
@ -533,6 +561,8 @@ class _$BankAccountEntity extends BankAccountEntity {
status.hashCode),
type.hashCode),
provider.hashCode),
balance.hashCode),
currency.hashCode),
isChanged.hashCode),
createdAt.hashCode),
updatedAt.hashCode),
@ -550,6 +580,8 @@ class _$BankAccountEntity extends BankAccountEntity {
..add('status', status)
..add('type', type)
..add('provider', provider)
..add('balance', balance)
..add('currency', currency)
..add('isChanged', isChanged)
..add('createdAt', createdAt)
..add('updatedAt', updatedAt)
@ -582,6 +614,14 @@ class BankAccountEntityBuilder
String get provider => _$this._provider;
set provider(String provider) => _$this._provider = provider;
double _balance;
double get balance => _$this._balance;
set balance(double balance) => _$this._balance = balance;
String _currency;
String get currency => _$this._currency;
set currency(String currency) => _$this._currency = currency;
bool _isChanged;
bool get isChanged => _$this._isChanged;
set isChanged(bool isChanged) => _$this._isChanged = isChanged;
@ -625,6 +665,8 @@ class BankAccountEntityBuilder
_status = $v.status;
_type = $v.type;
_provider = $v.provider;
_balance = $v.balance;
_currency = $v.currency;
_isChanged = $v.isChanged;
_createdAt = $v.createdAt;
_updatedAt = $v.updatedAt;
@ -661,6 +703,10 @@ class BankAccountEntityBuilder
type, 'BankAccountEntity', 'type'),
provider: BuiltValueNullFieldError.checkNotNull(
provider, 'BankAccountEntity', 'provider'),
balance: BuiltValueNullFieldError.checkNotNull(
balance, 'BankAccountEntity', 'balance'),
currency: BuiltValueNullFieldError.checkNotNull(
currency, 'BankAccountEntity', 'currency'),
isChanged: isChanged,
createdAt: BuiltValueNullFieldError.checkNotNull(
createdAt, 'BankAccountEntity', 'createdAt'),
@ -671,8 +717,7 @@ class BankAccountEntityBuilder
isDeleted: isDeleted,
createdUserId: createdUserId,
assignedUserId: assignedUserId,
id: BuiltValueNullFieldError.checkNotNull(
id, 'BankAccountEntity', 'id'));
id: BuiltValueNullFieldError.checkNotNull(id, 'BankAccountEntity', 'id'));
replace(_$result);
return _$result;
}

View File

@ -933,7 +933,7 @@ class SidebarFooter extends StatelessWidget {
if (state.isMenuCollapsed) ...[
Expanded(child: SizedBox())
] else ...[
if (!Config.DEMO_MODE && !state.isDemo)
if (!Config.DEMO_MODE && !state.isDemo && account.isOld)
if (state.isSelfHosted && !account.isSchedulerRunning)
IconButton(
tooltip: prefState.enableTooltips ? localization.error : '',