Bank transactions
This commit is contained in:
parent
483d4a3055
commit
a23799776b
|
|
@ -71,6 +71,7 @@ abstract class BankAccountEntity extends Object
|
|||
balance: 0,
|
||||
currency: '',
|
||||
disabledUpstream: false,
|
||||
autoSync: false,
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -92,6 +93,9 @@ abstract class BankAccountEntity extends Object
|
|||
@BuiltValueField(wireName: 'provider_name')
|
||||
String get provider;
|
||||
|
||||
@BuiltValueField(wireName: 'auto_sync')
|
||||
bool get autoSync;
|
||||
|
||||
@BuiltValueField(wireName: 'disabled_upstream')
|
||||
bool get disabledUpstream;
|
||||
|
||||
|
|
@ -107,6 +111,8 @@ abstract class BankAccountEntity extends Object
|
|||
return name;
|
||||
}
|
||||
|
||||
bool get isConnected => type.isNotEmpty;
|
||||
|
||||
@override
|
||||
List<EntityAction> getActions(
|
||||
{UserCompanyEntity userCompany,
|
||||
|
|
@ -190,8 +196,9 @@ abstract class BankAccountEntity extends Object
|
|||
FormatNumberType get listDisplayAmountType => FormatNumberType.money;
|
||||
|
||||
// ignore: unused_element
|
||||
static void _initializeBuilder(BankAccountEntityBuilder builder) =>
|
||||
builder..disabledUpstream = false;
|
||||
static void _initializeBuilder(BankAccountEntityBuilder builder) => builder
|
||||
..disabledUpstream = false
|
||||
..autoSync = false;
|
||||
|
||||
static Serializer<BankAccountEntity> get serializer =>
|
||||
_$bankAccountEntitySerializer;
|
||||
|
|
|
|||
|
|
@ -130,6 +130,9 @@ class _$BankAccountEntitySerializer
|
|||
'provider_name',
|
||||
serializers.serialize(object.provider,
|
||||
specifiedType: const FullType(String)),
|
||||
'auto_sync',
|
||||
serializers.serialize(object.autoSync,
|
||||
specifiedType: const FullType(bool)),
|
||||
'disabled_upstream',
|
||||
serializers.serialize(object.disabledUpstream,
|
||||
specifiedType: const FullType(bool)),
|
||||
|
|
@ -211,6 +214,10 @@ class _$BankAccountEntitySerializer
|
|||
result.provider = serializers.deserialize(value,
|
||||
specifiedType: const FullType(String)) as String;
|
||||
break;
|
||||
case 'auto_sync':
|
||||
result.autoSync = serializers.deserialize(value,
|
||||
specifiedType: const FullType(bool)) as bool;
|
||||
break;
|
||||
case 'disabled_upstream':
|
||||
result.disabledUpstream = serializers.deserialize(value,
|
||||
specifiedType: const FullType(bool)) as bool;
|
||||
|
|
@ -462,6 +469,8 @@ class _$BankAccountEntity extends BankAccountEntity {
|
|||
@override
|
||||
final String provider;
|
||||
@override
|
||||
final bool autoSync;
|
||||
@override
|
||||
final bool disabledUpstream;
|
||||
@override
|
||||
final double balance;
|
||||
|
|
@ -493,6 +502,7 @@ class _$BankAccountEntity extends BankAccountEntity {
|
|||
this.status,
|
||||
this.type,
|
||||
this.provider,
|
||||
this.autoSync,
|
||||
this.disabledUpstream,
|
||||
this.balance,
|
||||
this.currency,
|
||||
|
|
@ -511,6 +521,8 @@ class _$BankAccountEntity extends BankAccountEntity {
|
|||
BuiltValueNullFieldError.checkNotNull(type, 'BankAccountEntity', 'type');
|
||||
BuiltValueNullFieldError.checkNotNull(
|
||||
provider, 'BankAccountEntity', 'provider');
|
||||
BuiltValueNullFieldError.checkNotNull(
|
||||
autoSync, 'BankAccountEntity', 'autoSync');
|
||||
BuiltValueNullFieldError.checkNotNull(
|
||||
disabledUpstream, 'BankAccountEntity', 'disabledUpstream');
|
||||
BuiltValueNullFieldError.checkNotNull(
|
||||
|
|
@ -542,6 +554,7 @@ class _$BankAccountEntity extends BankAccountEntity {
|
|||
status == other.status &&
|
||||
type == other.type &&
|
||||
provider == other.provider &&
|
||||
autoSync == other.autoSync &&
|
||||
disabledUpstream == other.disabledUpstream &&
|
||||
balance == other.balance &&
|
||||
currency == other.currency &&
|
||||
|
|
@ -572,11 +585,16 @@ class _$BankAccountEntity extends BankAccountEntity {
|
|||
$jc(
|
||||
$jc(
|
||||
$jc(
|
||||
$jc(0,
|
||||
name.hashCode),
|
||||
status.hashCode),
|
||||
$jc(
|
||||
$jc(
|
||||
0,
|
||||
name
|
||||
.hashCode),
|
||||
status
|
||||
.hashCode),
|
||||
type.hashCode),
|
||||
provider.hashCode),
|
||||
autoSync.hashCode),
|
||||
disabledUpstream.hashCode),
|
||||
balance.hashCode),
|
||||
currency.hashCode),
|
||||
|
|
@ -597,6 +615,7 @@ class _$BankAccountEntity extends BankAccountEntity {
|
|||
..add('status', status)
|
||||
..add('type', type)
|
||||
..add('provider', provider)
|
||||
..add('autoSync', autoSync)
|
||||
..add('disabledUpstream', disabledUpstream)
|
||||
..add('balance', balance)
|
||||
..add('currency', currency)
|
||||
|
|
@ -632,6 +651,10 @@ class BankAccountEntityBuilder
|
|||
String get provider => _$this._provider;
|
||||
set provider(String provider) => _$this._provider = provider;
|
||||
|
||||
bool _autoSync;
|
||||
bool get autoSync => _$this._autoSync;
|
||||
set autoSync(bool autoSync) => _$this._autoSync = autoSync;
|
||||
|
||||
bool _disabledUpstream;
|
||||
bool get disabledUpstream => _$this._disabledUpstream;
|
||||
set disabledUpstream(bool disabledUpstream) =>
|
||||
|
|
@ -690,6 +713,7 @@ class BankAccountEntityBuilder
|
|||
_status = $v.status;
|
||||
_type = $v.type;
|
||||
_provider = $v.provider;
|
||||
_autoSync = $v.autoSync;
|
||||
_disabledUpstream = $v.disabledUpstream;
|
||||
_balance = $v.balance;
|
||||
_currency = $v.currency;
|
||||
|
|
@ -729,6 +753,8 @@ class BankAccountEntityBuilder
|
|||
type, 'BankAccountEntity', 'type'),
|
||||
provider: BuiltValueNullFieldError.checkNotNull(
|
||||
provider, 'BankAccountEntity', 'provider'),
|
||||
autoSync: BuiltValueNullFieldError.checkNotNull(
|
||||
autoSync, 'BankAccountEntity', 'autoSync'),
|
||||
disabledUpstream: BuiltValueNullFieldError.checkNotNull(
|
||||
disabledUpstream, 'BankAccountEntity', 'disabledUpstream'),
|
||||
balance: BuiltValueNullFieldError.checkNotNull(
|
||||
|
|
@ -738,10 +764,9 @@ class BankAccountEntityBuilder
|
|||
isChanged: isChanged,
|
||||
createdAt: BuiltValueNullFieldError.checkNotNull(
|
||||
createdAt, 'BankAccountEntity', 'createdAt'),
|
||||
updatedAt: BuiltValueNullFieldError.checkNotNull(
|
||||
updatedAt, 'BankAccountEntity', 'updatedAt'),
|
||||
archivedAt:
|
||||
BuiltValueNullFieldError.checkNotNull(archivedAt, 'BankAccountEntity', 'archivedAt'),
|
||||
updatedAt:
|
||||
BuiltValueNullFieldError.checkNotNull(updatedAt, 'BankAccountEntity', 'updatedAt'),
|
||||
archivedAt: BuiltValueNullFieldError.checkNotNull(archivedAt, 'BankAccountEntity', 'archivedAt'),
|
||||
isDeleted: isDeleted,
|
||||
createdUserId: createdUserId,
|
||||
assignedUserId: assignedUserId,
|
||||
|
|
|
|||
|
|
@ -115,6 +115,14 @@ class _BankAccountEditState extends State<BankAccountEdit> {
|
|||
onSavePressed: (_) => _onSavePressed(),
|
||||
keyboardType: TextInputType.text,
|
||||
),
|
||||
SizedBox(height: 16),
|
||||
SwitchListTile(
|
||||
activeColor: Theme.of(context).colorScheme.secondary,
|
||||
title: Text(localization.autoSync),
|
||||
value: bankAccount.autoSync,
|
||||
onChanged: (value) => viewModel.onChanged(
|
||||
bankAccount.rebuild((b) => b..autoSync = value)),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ class _BankAccountViewState extends State<BankAccountView> {
|
|||
entity: bankAccount,
|
||||
body: ScrollableListView(
|
||||
children: <Widget>[
|
||||
if (bankAccount.isConnected)
|
||||
EntityHeader(
|
||||
entity: bankAccount,
|
||||
label: localization.balance,
|
||||
|
|
@ -58,6 +59,10 @@ class _BankAccountViewState extends State<BankAccountView> {
|
|||
localization.type: toTitleCase(bankAccount.type),
|
||||
localization.status: toTitleCase(bankAccount.status),
|
||||
localization.provider: toTitleCase(bankAccount.provider),
|
||||
if (bankAccount.isConnected)
|
||||
localization.autoSync: bankAccount.autoSync
|
||||
? localization.enabled
|
||||
: localization.disabled,
|
||||
}),
|
||||
],
|
||||
),
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ mixin LocalizationsProvider on LocaleCodeAware {
|
|||
static final Map<String, Map<String, String>> _localizedValues = {
|
||||
'en': {
|
||||
// STARTER: lang key - do not remove comment
|
||||
'auto_sync': 'Auto Sync',
|
||||
'refresh_accounts': 'Refresh Accounts',
|
||||
'upgrade_to_connect_bank_account':
|
||||
'Upgrade to Enterprise to connect your bank account',
|
||||
|
|
@ -90147,6 +90148,10 @@ mixin LocalizationsProvider on LocaleCodeAware {
|
|||
_localizedValues[localeCode]['refresh_accounts'] ??
|
||||
_localizedValues['en']['refresh_accounts'];
|
||||
|
||||
String get autoSync =>
|
||||
_localizedValues[localeCode]['auto_sync'] ??
|
||||
_localizedValues['en']['auto_sync'];
|
||||
|
||||
// STARTER: lang field - do not remove comment
|
||||
|
||||
String lookup(String key) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue