Add sort column to account overview. and some css fixes

This commit is contained in:
James Cole
2024-03-24 13:24:48 +01:00
parent 46c49ddbd8
commit 538933691e
5 changed files with 55 additions and 37 deletions

View File

@@ -137,6 +137,17 @@ class AccountTransformer extends AbstractTransformer
return $rightBalance <=> $leftBalance; return $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;
});
}
} }
} }

View File

@@ -434,7 +434,7 @@ return [
'transfers' => 'fa-exchange', 'transfers' => 'fa-exchange',
], ],
'bindables' => [ 'bindables' => [
// models // models
'account' => Account::class, 'account' => Account::class,
'attachment' => Attachment::class, 'attachment' => Attachment::class,
@@ -492,7 +492,7 @@ return [
'userGroupBill' => UserGroupBill::class, 'userGroupBill' => UserGroupBill::class,
'userGroup' => UserGroup::class, 'userGroup' => UserGroup::class,
], ],
'rule-actions' => [ 'rule-actions' => [
'set_category' => SetCategory::class, 'set_category' => SetCategory::class,
'clear_category' => ClearCategory::class, 'clear_category' => ClearCategory::class,
'set_budget' => SetBudget::class, 'set_budget' => SetBudget::class,
@@ -526,7 +526,7 @@ return [
// 'set_foreign_amount' => SetForeignAmount::class, // 'set_foreign_amount' => SetForeignAmount::class,
// 'set_foreign_currency' => SetForeignCurrency::class, // 'set_foreign_currency' => SetForeignCurrency::class,
], ],
'context-rule-actions' => [ 'context-rule-actions' => [
'set_category', 'set_category',
'set_budget', 'set_budget',
'add_tag', 'add_tag',
@@ -545,13 +545,13 @@ return [
'convert_transfer', 'convert_transfer',
], ],
'test-triggers' => [ 'test-triggers' => [
'limit' => 10, 'limit' => 10,
'range' => 200, 'range' => 200,
], ],
// expected source types for each transaction type, in order of preference. // expected source types for each transaction type, in order of preference.
'expected_source_types' => [ 'expected_source_types' => [
'source' => [ 'source' => [
TransactionTypeModel::WITHDRAWAL => [AccountType::ASSET, AccountType::LOAN, AccountType::DEBT, AccountType::MORTGAGE], TransactionTypeModel::WITHDRAWAL => [AccountType::ASSET, AccountType::LOAN, AccountType::DEBT, AccountType::MORTGAGE],
TransactionTypeEnum::DEPOSIT->value => [AccountType::LOAN, AccountType::DEBT, AccountType::MORTGAGE, AccountType::REVENUE, AccountType::CASH], 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], TransactionTypeModel::LIABILITY_CREDIT => [AccountType::LIABILITY_CREDIT, AccountType::LOAN, AccountType::DEBT, AccountType::MORTGAGE],
], ],
], ],
'allowed_opposing_types' => [ 'allowed_opposing_types' => [
'source' => [ 'source' => [
AccountType::ASSET => [ AccountType::ASSET => [
AccountType::ASSET, AccountType::ASSET,
@@ -686,7 +686,7 @@ return [
], ],
], ],
// depending on the account type, return the allowed transaction types: // depending on the account type, return the allowed transaction types:
'allowed_transaction_types' => [ 'allowed_transaction_types' => [
'source' => [ 'source' => [
AccountType::ASSET => [ AccountType::ASSET => [
TransactionTypeModel::WITHDRAWAL, TransactionTypeModel::WITHDRAWAL,
@@ -755,7 +755,7 @@ return [
], ],
// having the source + dest will tell you the transaction type. // having the source + dest will tell you the transaction type.
'account_to_transaction' => [ 'account_to_transaction' => [
AccountType::ASSET => [ AccountType::ASSET => [
AccountType::ASSET => TransactionTypeModel::TRANSFER, AccountType::ASSET => TransactionTypeModel::TRANSFER,
AccountType::CASH => TransactionTypeModel::WITHDRAWAL, AccountType::CASH => TransactionTypeModel::WITHDRAWAL,
@@ -820,7 +820,7 @@ return [
], ],
// allowed source -> destination accounts. // allowed source -> destination accounts.
'source_dests' => [ 'source_dests' => [
TransactionTypeModel::WITHDRAWAL => [ TransactionTypeModel::WITHDRAWAL => [
AccountType::ASSET => [AccountType::EXPENSE, AccountType::LOAN, AccountType::DEBT, AccountType::MORTGAGE, AccountType::CASH], AccountType::ASSET => [AccountType::EXPENSE, AccountType::LOAN, AccountType::DEBT, AccountType::MORTGAGE, AccountType::CASH],
AccountType::LOAN => [AccountType::EXPENSE, 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). // if you add fields to this array, don't forget to update the export routine (ExportDataGenerator).
'journal_meta_fields' => [ 'journal_meta_fields' => [
// sepa // sepa
'sepa_cc', 'sepa_cc',
'sepa_ct_op', 'sepa_ct_op',
@@ -893,36 +893,36 @@ return [
'recurrence_count', 'recurrence_count',
'recurrence_date', 'recurrence_date',
], ],
'webhooks' => [ 'webhooks' => [
'max_attempts' => env('WEBHOOK_MAX_ATTEMPTS', 3), 'max_attempts' => env('WEBHOOK_MAX_ATTEMPTS', 3),
], ],
'can_have_virtual_amounts' => [AccountType::ASSET], 'can_have_virtual_amounts' => [AccountType::ASSET],
'can_have_opening_balance' => [AccountType::ASSET, AccountType::LOAN, AccountType::DEBT, AccountType::MORTGAGE], 'can_have_opening_balance' => [AccountType::ASSET, AccountType::LOAN, AccountType::DEBT, AccountType::MORTGAGE],
'dynamic_creation_allowed' => [ 'dynamic_creation_allowed' => [
AccountType::EXPENSE, AccountType::EXPENSE,
AccountType::REVENUE, AccountType::REVENUE,
AccountType::INITIAL_BALANCE, AccountType::INITIAL_BALANCE,
AccountType::RECONCILIATION, AccountType::RECONCILIATION,
AccountType::LIABILITY_CREDIT, AccountType::LIABILITY_CREDIT,
], ],
'valid_asset_fields' => ['account_role', 'account_number', 'currency_id', 'BIC', 'include_net_worth'], '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_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_account_fields' => ['account_number', 'currency_id', 'BIC', 'interest', 'interest_period', 'include_net_worth', 'liability_direction'],
// dynamic date ranges are as follows: // 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 // only used in v1
'allowed_sort_parameters' => ['order', 'name', 'iban'], 'allowed_sort_parameters' => ['order', 'name', 'iban'],
// preselected account lists possibilities: // preselected account lists possibilities:
'preselected_accounts' => ['all', 'assets', 'liabilities'], 'preselected_accounts' => ['all', 'assets', 'liabilities'],
// allowed sort columns for API's // allowed sort columns for API's
'sorting' => [ 'sorting' => [
'allowed' => [ 'allowed' => [
'transactions' => ['description', 'amount'], 'transactions' => ['description', 'amount'],
'accounts' => ['name', 'active', 'iban', 'balance'], 'accounts' => ['name', 'active', 'iban', 'balance', 'last_activity'],
], ],
], ],
]; ];

View File

@@ -26,8 +26,13 @@ $danger: #CD5029 !default;
$primary: #1E6581 !default; $primary: #1E6581 !default;
$success: #64B624 !default; $success: #64B624 !default;
.balance-box { h3.hover-expand {
overflow-x: hidden;
text-overflow: ellipsis
}
h3.hover-expand:hover {
container: sidebar / inline-size; container: sidebar / inline-size;
overflow-x: scroll;
} }
.form-control { .form-control {

View File

@@ -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 === '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> <em x-show="sortingColumn === 'balance' && sortDirection === 'desc'" class="fa-solid fa-arrow-up-wide-short"></em>
</td> </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>Balance difference</td>
<td>&nbsp;</td> <td>&nbsp;</td>
</tr> </tr>
@@ -126,7 +130,7 @@
<td> <td>
<!-- IBAN and no account nr --> <!-- IBAN and no account nr -->
<template x-if="'' === account.account_number && '' !== account.iban"> <template x-if="'' === account.account_number && '' !== account.iban">
<span x-text="account.iban + 'A'"></span> <span x-text="account.iban"></span>
</template> </template>
<!-- no IBAN and account nr --> <!-- no IBAN and account nr -->
<template x-if="'' !== account.account_number && '' === account.iban"> <template x-if="'' !== account.account_number && '' === account.iban">

View File

@@ -1,10 +1,8 @@
<div class="row" x-data="boxes"> <div class="row mb-2" x-data="boxes">
<!--begin::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">
<!--begin::Small Box Widget 1-->
<div class="small-box text-bg-primary"> <div class="small-box text-bg-primary">
<div class="inner balance-box"> <div class="inner balance-box">
<h3> <h3 class="hover-expand">
<template x-for="(amount, index) in balanceBox.amounts" :key="index"> <template x-for="(amount, index) in balanceBox.amounts" :key="index">
<span> <span>
<span x-text="amount"></span><span <span x-text="amount"></span><span
@@ -27,7 +25,7 @@
<i class="fa-solid fa-scale-balanced"></i> <i class="fa-solid fa-scale-balanced"></i>
</span> </span>
<span class="small-box-footer"> <span class="small-box-footer hover-footer">
<template x-for="(subtitle, index) in balanceBox.subtitles" :key="index"> <template x-for="(subtitle, index) in balanceBox.subtitles" :key="index">
<span> <span>
<span x-text="subtitle"></span><span <span x-text="subtitle"></span><span
@@ -39,11 +37,11 @@
<!--end::Small Box Widget 1--> <!--end::Small Box Widget 1-->
</div> </div>
<!--end::Col--> <!--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--> <!--begin::Small Box Widget 2-->
<div class="small-box text-bg-success"> <div class="small-box text-bg-success">
<div class="inner"> <div class="inner">
<h3> <h3 class="hover-expand">
<template x-for="(amount, index) in billBox.unpaid" :key="index"> <template x-for="(amount, index) in billBox.unpaid" :key="index">
<span> <span>
<span x-text="amount"></span><span <span x-text="amount"></span><span
@@ -77,11 +75,11 @@
<!--end::Small Box Widget 2--> <!--end::Small Box Widget 2-->
</div> </div>
<!--end::Col--> <!--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--> <!--begin::Small Box Widget 3-->
<div class="small-box text-bg-warning"> <div class="small-box text-bg-warning">
<div class="inner"> <div class="inner">
<h3> <h3 class="hover-expand">
<template x-for="(amount, index) in leftBox.left" :key="index"> <template x-for="(amount, index) in leftBox.left" :key="index">
<span> <span>
<span x-text="amount"></span><span <span x-text="amount"></span><span
@@ -115,11 +113,11 @@
<!--end::Small Box Widget 3--> <!--end::Small Box Widget 3-->
</div> </div>
<!--end::Col--> <!--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--> <!--begin::Small Box Widget 4-->
<div class="small-box text-bg-danger"> <div class="small-box text-bg-danger">
<div class="inner"> <div class="inner">
<h3> <h3 class="hover-expand">
<template x-for="(amount, index) in netBox.net" :key="index"> <template x-for="(amount, index) in netBox.net" :key="index">
<span> <span>
<span x-text="amount"></span><span <span x-text="amount"></span><span