Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Add sort column to account overview. and some css fixes
James Cole538933691ea8
diff --git a/app/Transformers/V2/AccountTransformer.php b/app/Transformers/V2/AccountTransformer.phpindex d3e2a297ef..74266fa6c5 100644--- a/app/Transformers/V2/AccountTransformer.php+++ b/app/Transformers/V2/AccountTransformer.php@@ -137,6 +137,17 @@ class AccountTransformer extends AbstractTransformerreturn $rightBalance <=> $leftBalance;});}+ if ('last_activity' === $column) {+ $dates = $this->lastActivity;+ $objects = $objects->sort(function (Account $left, Account $right) use ($dates, $direction) {+ $leftDate = $dates[$left->id] ?? Carbon::create(1900, 1, 1, 0, 0, 0);+ $rightDate = $dates[$right->id] ?? Carbon::create(1900, 1, 1, 0, 0, 0);+ if ('asc' === $direction) {+ return $leftDate->gt($rightDate) ? 1 : -1;+ }+ return $rightDate->gt($leftDate) ? 1 : -1;+ });+ }}}diff --git a/config/firefly.php b/config/firefly.phpindex 24e197c22e..2512b28e53 100644--- a/config/firefly.php+++ b/config/firefly.php@@ -434,7 +434,7 @@ return ['transfers' => 'fa-exchange',],- 'bindables' => [+ 'bindables' => [// models'account' => Account::class,'attachment' => Attachment::class,@@ -492,7 +492,7 @@ return ['userGroupBill' => UserGroupBill::class,'userGroup' => UserGroup::class,],- 'rule-actions' => [+ 'rule-actions' => ['set_category' => SetCategory::class,'clear_category' => ClearCategory::class,'set_budget' => SetBudget::class,@@ -526,7 +526,7 @@ return [// 'set_foreign_amount' => SetForeignAmount::class,// 'set_foreign_currency' => SetForeignCurrency::class,],- 'context-rule-actions' => [+ 'context-rule-actions' => ['set_category','set_budget','add_tag',@@ -545,13 +545,13 @@ return ['convert_transfer',],- 'test-triggers' => [+ 'test-triggers' => ['limit' => 10,'range' => 200,],// expected source types for each transaction type, in order of preference.- 'expected_source_types' => [+ 'expected_source_types' => ['source' => [TransactionTypeModel::WITHDRAWAL => [AccountType::ASSET, AccountType::LOAN, AccountType::DEBT, AccountType::MORTGAGE],TransactionTypeEnum::DEPOSIT->value => [AccountType::LOAN, AccountType::DEBT, AccountType::MORTGAGE, AccountType::REVENUE, AccountType::CASH],@@ -596,7 +596,7 @@ return [TransactionTypeModel::LIABILITY_CREDIT => [AccountType::LIABILITY_CREDIT, AccountType::LOAN, AccountType::DEBT, AccountType::MORTGAGE],],],- 'allowed_opposing_types' => [+ 'allowed_opposing_types' => ['source' => [AccountType::ASSET => [AccountType::ASSET,@@ -686,7 +686,7 @@ return [],],// depending on the account type, return the allowed transaction types:- 'allowed_transaction_types' => [+ 'allowed_transaction_types' => ['source' => [AccountType::ASSET => [TransactionTypeModel::WITHDRAWAL,@@ -755,7 +755,7 @@ return [],// having the source + dest will tell you the transaction type.- 'account_to_transaction' => [+ 'account_to_transaction' => [AccountType::ASSET => [AccountType::ASSET => TransactionTypeModel::TRANSFER,AccountType::CASH => TransactionTypeModel::WITHDRAWAL,@@ -820,7 +820,7 @@ return [],// allowed source -> destination accounts.- 'source_dests' => [+ 'source_dests' => [TransactionTypeModel::WITHDRAWAL => [AccountType::ASSET => [AccountType::EXPENSE, AccountType::LOAN, AccountType::DEBT, AccountType::MORTGAGE, AccountType::CASH],AccountType::LOAN => [AccountType::EXPENSE, AccountType::CASH],@@ -859,7 +859,7 @@ return [],],// if you add fields to this array, don't forget to update the export routine (ExportDataGenerator).- 'journal_meta_fields' => [+ 'journal_meta_fields' => [// sepa'sepa_cc','sepa_ct_op',@@ -893,36 +893,36 @@ return ['recurrence_count','recurrence_date',],- 'webhooks' => [+ 'webhooks' => ['max_attempts' => env('WEBHOOK_MAX_ATTEMPTS', 3),],- 'can_have_virtual_amounts' => [AccountType::ASSET],- 'can_have_opening_balance' => [AccountType::ASSET, AccountType::LOAN, AccountType::DEBT, AccountType::MORTGAGE],- 'dynamic_creation_allowed' => [+ 'can_have_virtual_amounts' => [AccountType::ASSET],+ 'can_have_opening_balance' => [AccountType::ASSET, AccountType::LOAN, AccountType::DEBT, AccountType::MORTGAGE],+ 'dynamic_creation_allowed' => [AccountType::EXPENSE,AccountType::REVENUE,AccountType::INITIAL_BALANCE,AccountType::RECONCILIATION,AccountType::LIABILITY_CREDIT,],- 'valid_asset_fields' => ['account_role', 'account_number', 'currency_id', 'BIC', 'include_net_worth'],- 'valid_cc_fields' => ['account_role', 'cc_monthly_payment_date', 'cc_type', 'account_number', 'currency_id', 'BIC', 'include_net_worth'],- 'valid_account_fields' => ['account_number', 'currency_id', 'BIC', 'interest', 'interest_period', 'include_net_worth', 'liability_direction'],+ 'valid_asset_fields' => ['account_role', 'account_number', 'currency_id', 'BIC', 'include_net_worth'],+ 'valid_cc_fields' => ['account_role', 'cc_monthly_payment_date', 'cc_type', 'account_number', 'currency_id', 'BIC', 'include_net_worth'],+ 'valid_account_fields' => ['account_number', 'currency_id', 'BIC', 'interest', 'interest_period', 'include_net_worth', 'liability_direction'],// dynamic date ranges are as follows:- 'dynamic_date_ranges' => ['last7', 'last30', 'last90', 'last365', 'MTD', 'QTD', 'YTD'],+ 'dynamic_date_ranges' => ['last7', 'last30', 'last90', 'last365', 'MTD', 'QTD', 'YTD'],// only used in v1- 'allowed_sort_parameters' => ['order', 'name', 'iban'],+ 'allowed_sort_parameters' => ['order', 'name', 'iban'],// preselected account lists possibilities:- 'preselected_accounts' => ['all', 'assets', 'liabilities'],+ 'preselected_accounts' => ['all', 'assets', 'liabilities'],// allowed sort columns for API's- 'sorting' => [+ 'sorting' => ['allowed' => ['transactions' => ['description', 'amount'],- 'accounts' => ['name', 'active', 'iban', 'balance'],+ 'accounts' => ['name', 'active', 'iban', 'balance', 'last_activity'],],],];diff --git a/resources/assets/v2/sass/app.scss b/resources/assets/v2/sass/app.scssindex 6fbdb47374..a6415c4d2f 100644--- a/resources/assets/v2/sass/app.scss+++ b/resources/assets/v2/sass/app.scss@@ -26,8 +26,13 @@ $danger: #CD5029 !default;$primary: #1E6581 !default;$success: #64B624 !default;-.balance-box {+h3.hover-expand {+ overflow-x: hidden;+ text-overflow: ellipsis+}+h3.hover-expand:hover {container: sidebar / inline-size;+ overflow-x: scroll;}.form-control {diff --git a/resources/views/v2/accounts/index.blade.php b/resources/views/v2/accounts/index.blade.phpindex 559b175737..402dd3a190 100644--- a/resources/views/v2/accounts/index.blade.php+++ b/resources/views/v2/accounts/index.blade.php@@ -78,7 +78,11 @@<em x-show="sortingColumn === 'balance' && sortDirection === 'asc'" class="fa-solid fa-arrow-down-wide-short"></em><em x-show="sortingColumn === 'balance' && sortDirection === 'desc'" class="fa-solid fa-arrow-up-wide-short"></em></td>- <td>Last activity</td>+ <td>+ <a href="#" x-on:click.prevent="sort('last_activity')">Last activity</a>+ <em x-show="sortingColumn === 'last_activity' && sortDirection === 'asc'" class="fa-solid fa-arrow-down-wide-short"></em>+ <em x-show="sortingColumn === 'last_activity' && sortDirection === 'desc'" class="fa-solid fa-arrow-up-wide-short"></em>+ </td><td>Balance difference</td><td> </td></tr>@@ -126,7 +130,7 @@<td><!-- IBAN and no account nr --><template x-if="'' === account.account_number && '' !== account.iban">- <span x-text="account.iban + 'A'"></span>+ <span x-text="account.iban"></span></template><!-- no IBAN and account nr --><template x-if="'' !== account.account_number && '' === account.iban">diff --git a/resources/views/v2/partials/dashboard/boxes.blade.php b/resources/views/v2/partials/dashboard/boxes.blade.phpindex df3325c033..b2fe281d12 100644--- a/resources/views/v2/partials/dashboard/boxes.blade.php+++ b/resources/views/v2/partials/dashboard/boxes.blade.php@@ -1,10 +1,8 @@-<div class="row" x-data="boxes">- <!--begin::Col-->+<div class="row mb-2" x-data="boxes"><div class="col-xl-3 col-lg-6 col-md-12 col-sm-12">- <!--begin::Small Box Widget 1--><div class="small-box text-bg-primary">- <div class="inner balance-box">- <h3>+ <div class="inner balance-box">+ <h3 class="hover-expand"><template x-for="(amount, index) in balanceBox.amounts" :key="index"><span><span x-text="amount"></span><span@@ -27,7 +25,7 @@<i class="fa-solid fa-scale-balanced"></i></span>- <span class="small-box-footer">+ <span class="small-box-footer hover-footer"><template x-for="(subtitle, index) in balanceBox.subtitles" :key="index"><span><span x-text="subtitle"></span><span@@ -39,11 +37,11 @@<!--end::Small Box Widget 1--></div><!--end::Col-->- <div class="col-xl-3 col-lg-6 col-md-12 col-sm-12">+ <div class="col-xl-3 col-lg-6 col-md-12 col-sm-12" style="flex-grow: 1;"><!--begin::Small Box Widget 2--><div class="small-box text-bg-success"><div class="inner">- <h3>+ <h3 class="hover-expand"><template x-for="(amount, index) in billBox.unpaid" :key="index"><span><span x-text="amount"></span><span@@ -77,11 +75,11 @@<!--end::Small Box Widget 2--></div><!--end::Col-->- <div class="col-xl-3 col-lg-6 col-md-12 col-sm-12">+ <div class="col-xl-3 col-lg-6 col-md-12 col-sm-12" style="flex-grow: 1;"><!--begin::Small Box Widget 3--><div class="small-box text-bg-warning"><div class="inner">- <h3>+ <h3 class="hover-expand"><template x-for="(amount, index) in leftBox.left" :key="index"><span><span x-text="amount"></span><span@@ -115,11 +113,11 @@<!--end::Small Box Widget 3--></div><!--end::Col-->- <div class="col-xl-3 col-lg-6 col-md-12 col-sm-12">+ <div class="col-xl-3 col-lg-6 col-md-12 col-sm-12" style="flex-grow: 1;"><!--begin::Small Box Widget 4--><div class="small-box text-bg-danger"><div class="inner">- <h3>+ <h3 class="hover-expand"><template x-for="(amount, index) in netBox.net" :key="index"><span><span x-text="amount"></span><span