Skip to content

Commit

Permalink
Add participant name to transactions UI
Browse files Browse the repository at this point in the history
  • Loading branch information
hillelcoren committed Jan 12, 2024
1 parent 0fbf09d commit ce13a35
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/data/models/transaction_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ class TransactionFields {
static const String status = 'status';
static const String accountType = 'account_type';
static const String defaultCategory = 'default_category';
static const String participantName = 'participant_name';
}

abstract class TransactionEntity extends Object
Expand Down
5 changes: 5 additions & 0 deletions lib/ui/reports/transaction_report.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ enum TransactionReportFields {
created_at,
updated_at,
record_state,
participant_name,
}

var memoizedTransactionReport = memo10((
Expand Down Expand Up @@ -178,6 +179,10 @@ ReportResult transactionReport(
case TransactionReportFields.record_state:
value = AppLocalization.of(navigatorKey.currentContext!)!
.lookup(transaction.entityState);
break;
case TransactionReportFields.participant_name:
value = transaction.participantName;
break;
}

if (!ReportResult.matchField(
Expand Down
3 changes: 3 additions & 0 deletions lib/ui/transaction/transaction_presenter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class TransactionPresenter extends EntityPresenter {
TransactionFields.category,
TransactionFields.payment,
TransactionFields.defaultCategory,
TransactionFields.participantName,
];
}

Expand Down Expand Up @@ -76,6 +77,8 @@ class TransactionPresenter extends EntityPresenter {
);
case TransactionFields.description:
return Text(transaction!.description);
case TransactionFields.participantName:
return Text(transaction!.participantName);
case TransactionFields.accountType:
final bankAccount =
state.bankAccountState.get(transaction!.bankAccountId);
Expand Down
5 changes: 5 additions & 0 deletions lib/utils/i18n.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ mixin LocalizationsProvider on LocaleCodeAware {
static final Map<String, Map<String, String>> _localizedValues = {
'en': {
// STARTER: lang key - do not remove comment
'participant_name': 'Participant Name',
'yodlee_regions': 'Regions: USA, UK, Australia & India',
'nordigen_regions': 'Regions: Europe & UK',
'select_provider': 'Select Provider',
Expand Down Expand Up @@ -111603,6 +111604,10 @@ mixin LocalizationsProvider on LocaleCodeAware {
_localizedValues[localeCode]!['nordigen_regions'] ??
_localizedValues['en']!['nordigen_regions']!;

String get participantName =>
_localizedValues[localeCode]!['participant_name'] ??
_localizedValues['en']!['participant_name']!;

// STARTER: lang field - do not remove comment

String lookup(String? key) {
Expand Down

0 comments on commit ce13a35

Please sign in to comment.