Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Various changes
James Colec3f0a32a0e19
diff --git a/app/Http/Controllers/Account/IndexController.php b/app/Http/Controllers/Account/IndexController.phpindex ef8dddb140..cc85346a87 100644--- a/app/Http/Controllers/Account/IndexController.php+++ b/app/Http/Controllers/Account/IndexController.php@@ -56,7 +56,7 @@ final class IndexController extends Controller// translations:$this->middleware(function ($request, $next) {- app('view')->share('mainTitleIcon', 'fa-credit-card');+ app('view')->share('mainTitleIcon', 'bi-credit-card');app('view')->share('title', (string) trans('firefly.accounts'));$this->repository = app(AccountRepositoryInterface::class);@@ -134,6 +134,7 @@ final class IndexController extends Controllerpublic function index(Request $request, string $objectType): Factory|\Illuminate\Contracts\View\View{Log::debug(sprintf('Now at %s', __METHOD__));+ $inactivePage = false;$subTitle = (string) trans(sprintf('firefly.%s_accounts', $objectType));$subTitleIcon = config(sprintf('firefly.subIconsByIdentifier.%s', $objectType));$types = config(sprintf('firefly.accountTypesByIdentifier.%s', $objectType));@@ -198,6 +199,7 @@ final class IndexController extends Controllerreturn view('accounts.index', ['objectType' => $objectType,'inactiveCount' => $inactiveCount,+ 'inactivePage' => $inactivePage,'subTitleIcon' => $subTitleIcon,'subTitle' => $subTitle,'page' => $page,diff --git a/app/View/Components/Lists/Accounts.php b/app/View/Components/Lists/Accounts.phpnew file mode 100644index 0000000000..1a4f25298c--- /dev/null+++ b/app/View/Components/Lists/Accounts.php@@ -0,0 +1,30 @@+<?php++namespace FireflyIII\View\Components\lists;++use Closure;+use Illuminate\Contracts\View\View;+use Illuminate\Pagination\LengthAwarePaginator;+use Illuminate\Support\Collection;+use Illuminate\View\Component;++class Accounts extends Component+{+ public LengthAwarePaginator|null $accounts = null;+ public string $objectType = '';+ /**+ * Create a new component instance.+ */+ public function __construct()+ {+ //+ }++ /**+ * Get the view / contents that represent the component.+ */+ public function render(): View|Closure|string+ {+ return view('components.lists.accounts');+ }+}diff --git a/config/firefly.php b/config/firefly.phpindex 942f5a074b..ac0f2fe569 100644--- a/config/firefly.php+++ b/config/firefly.php@@ -334,10 +334,10 @@ return ['liability' => 'Liabilities',],'subIconsByIdentifier' => [- 'asset' => 'fa-money',- AccountTypeEnum::ASSET->value => 'fa-money',- AccountTypeEnum::DEFAULT->value => 'fa-money',- AccountTypeEnum::CASH->value => 'fa-money',+ 'asset' => 'bi-cash',+ AccountTypeEnum::ASSET->value => 'bi-cash',+ AccountTypeEnum::DEFAULT->value => 'bi-cash',+ AccountTypeEnum::CASH->value => 'bi-cash','expense' => 'fa-shopping-cart',AccountTypeEnum::EXPENSE->value => 'fa-shopping-cart',AccountTypeEnum::BENEFICIARY->value => 'fa-shopping-cart',diff --git a/resources/assets/v3/js/boot/bootstrap.js b/resources/assets/v3/js/boot/bootstrap.jsindex 43241c097f..d8e5faa533 100644--- a/resources/assets/v3/js/boot/bootstrap.js+++ b/resources/assets/v3/js/boot/bootstrap.js@@ -35,6 +35,7 @@ import {getVariable} from "v2/src/store/get-variable.js";import {getViewRange} from "v2/src/support/get-viewrange.js";import {loadTranslations} from "v2/src/support/load-translations.js";+store.addPlugin(observePlugin);@@ -82,7 +83,7 @@ getFreshVariable('lastActivity').then((serverValue) => {console.log('Bootstrapped!');// page may have an introduction necessary to be played.- if(!showTour) {+ if (!showTour) {return;}const url = '/';diff --git a/resources/assets/v3/js/pages/accounts/index.js b/resources/assets/v3/js/pages/accounts/index.jsnew file mode 100644index 0000000000..217ae6c5fb--- /dev/null+++ b/resources/assets/v3/js/pages/accounts/index.js@@ -0,0 +1,61 @@+/*+ * dashboard.js+ * Copyright (c) 2026 [email protected]+ *+ * This file is part of Firefly III (https://github.com/firefly-iii).+ *+ * This program is free software: you can redistribute it and/or modify+ * it under the terms of the GNU Affero General Public License as+ * published by the Free Software Foundation, either version 3 of the+ * License, or (at your option) any later version.+ *+ * This program is distributed in the hope that it will be useful,+ * but WITHOUT ANY WARRANTY; without even the implied warranty of+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ * GNU Affero General Public License for more details.+ *+ * You should have received a copy of the GNU Affero General Public License+ * along with this program. If not, see <https://www.gnu.org/licenses/>.+ */++// CSS+import '../../boot/bootstrap.js';+import sidebar from '../../pages/shared/sidebar.js';+import dates from '../shared/dates.js';++let index = function () {+ return {+ foo2: 'bar2',+ init() {+ console.log('init op index xxx');+ }+ }+};+++const comps = {+ index,+ sidebar,+ dates+};++function loadPage(comps) {+ console.log('loadPage');+ Object.keys(comps).forEach(comp => {+ let data = comps[comp]();+ Alpine.data(comp, () => data);+ console.log(comp);+ });+ Alpine.start();+}++// wait for load until bootstrapped event is received.+document.addEventListener('firefly-iii-bootstrapped', () => {+ console.log('Loaded through event listener.');+ loadPage(comps);+});+// or is bootstrapped before event is triggered.+if (window.bootstrapped) {+ console.log('Loaded through window variable.');+ loadPage(comps);+}diff --git a/resources/assets/v3/js/pages/dashboard/dashboard.js b/resources/assets/v3/js/pages/dashboard/dashboard.jsindex 5d37e10b37..84b9da4b4a 100644--- a/resources/assets/v3/js/pages/dashboard/dashboard.js+++ b/resources/assets/v3/js/pages/dashboard/dashboard.js@@ -18,12 +18,13 @@* along with this program. If not, see <https://www.gnu.org/licenses/>.*/-// CSSimport '../../boot/bootstrap.js';import sidebar from '../../pages/shared/sidebar.js';-import boxes from './boxes.js';import dates from '../shared/dates.js';++import boxes from './boxes.js';+let index = function () {return {foo2: 'bar2',diff --git a/resources/assets/v3/vite.config.js b/resources/assets/v3/vite.config.jsindex 71dddfe4d6..d549e78244 100644--- a/resources/assets/v3/vite.config.js+++ b/resources/assets/v3/vite.config.js@@ -42,7 +42,10 @@ export default defineConfig(({command, mode, isSsrBuild, isPreview}) => {// dashboard'js/pages/dashboard/boxes.js',- 'js/pages/dashboard/dashboard.js'+ 'js/pages/dashboard/dashboard.js',++ // accounts+ 'js/pages/accounts/index.js',],buildDirectory: '../../../../public/build',// publicDirectory: '../../../public',diff --git a/resources/views/accounts/index.twig b/resources/views/accounts/index-old.twigsimilarity index 100%rename from resources/views/accounts/index.twigrename to resources/views/accounts/index-old.twigdiff --git a/resources/views/accounts/index.blade.php b/resources/views/accounts/index.blade.phpnew file mode 100644index 0000000000..7e5d2e1304--- /dev/null+++ b/resources/views/accounts/index.blade.php@@ -0,0 +1,84 @@+@extends('layout.v3.session')+@section('content')+ @if(count($accounts) > 0)+ <div class="row">+ <div class="col-lg-12 col-md-12 col-sm-12">+ <div class="card" id="account-index-{{ $objectType }}">+ <div class="card-header with-border">+ <h3 class="card-title">+ {{ $subTitle }}+ </h3>+ <div class="card-tools pull-right">+ <div class="btn-group">+ <button class="btn btn-box-tool dropdown-toggle" data-toggle="dropdown"><span class="fa fa-ellipsis-v"></span></button>+ <ul class="dropdown-menu" role="menu">+ <li><a href="{{ route('accounts.create', $objectType) }}"><span+ class="fa fa-plus fa-fw"></span> {{ __('firefly.make_new_'. $objectType . '_account') }}+ </a></li>+ </ul>+ </div>+ </div>+++ </div>+ <div class="card-body no-padding">+ <p>+ <a href="{{ route('accounts.create', $objectType) }}" class="btn btn-success"><span class="bi bi-plus-circle"></span> {{ __('firefly.make_new_' . $objectType . '_account') }}</a>+ </p>+ <x-lists.accounts :accounts="$accounts" :objectType="$objectType" />+ </div>+ <div class="card-footer">+ <p>+ <a href="{{ route('accounts.create', $objectType) }}" class="btn btn-success"><span class="bi bi-plus-circle"></span> {{ __('firefly.make_new_' . $objectType . '_account') }}</a>+ </p>+ @if($inactiveCount > 0)+ <p><small>+ <em>+ <a href="{{ route('accounts.inactive.index', $objectType) }}" class="text-muted">+ {{ trans_choice('firefly.inactive_account_link', $inactiveCount) }}+ </a>+ </em>+ </small>+ </p>+ @endif+ @if($inactivePage)+ <p><small class="text-muted">+ <em>+ {{ trans('firefly.all_accounts_inactive') }}+ <a href="{{ route('accounts.index', $objectType) }}">+ {{ trans('firefly.active_account_link', ['count' => $inactiveCount]) }}+ </a>+ </em>+ </small>+ </p>+ @endif+ </div>+ </div>+ </div>+ </div>+ @endif+ @if(0 === count($accounts) && 1 === $page)+ {% include 'partials.empty' with {objectType: objectType, type: 'accounts',route: route('accounts.create', [objectType])} %}++ @if($inactiveCount > 0)+ <p class="text-center"><small>+ <em>+ <a href="{{ route('accounts.inactive.index', $objectType) }}" class="text-muted">+ {{ trans_choice('firefly.inactive_account_link', $inactiveCount) }}+ </a>+ </em>+ </small>+ </p>+ @endif++ @endif++@endsection+@section('scripts')+ @vite(['js/pages/accounts/index.js'])+ <script type="text/javascript" nonce="{{ $JS_NONCE }}">+ var objectType = '{{ e($objectType) }}';+ </script>+ <script src="v1/js/lib/jquery-ui.min.js?v={{ $FF_BUILD_TIME }}" type="text/javascript" nonce="{{ $JS_NONCE }}"></script>+ <script type="text/javascript" nonce="{{ $JS_NONCE }}" src="v1/js/ff/accounts/index.js?v={{ $FF_BUILD_TIME }}"></script>+@endsectiondiff --git a/resources/views/components/lists/accounts.blade.php b/resources/views/components/lists/accounts.blade.phpnew file mode 100644index 0000000000..bae703a601--- /dev/null+++ b/resources/views/components/lists/accounts.blade.php@@ -0,0 +1,156 @@+<div class="ml-1">+ {{ $accounts->links('pagination.bootstrap-4') }}+</div>+<table class="table table-responsive table-hover" id="sortable-table">+ <thead>+ <tr>+ <th class="hidden-sm hidden-xs"> </th>+ <th>{{ trans('list.name') }}</th>+ @if('asset' === $objectType)++ <th class="hidden-sm hidden-xs hidden-md">{{ trans('list.role') }}</th>+ @endif+ @if('liabilities' === $objectType)+ <th>{{ trans('list.liability_type') }}</th>+ <th>{{ trans('form.liability_direction') }}</th>+ <th>{{ trans('list.interest') }} ({{ trans('list.interest_period') }})</th>+ @endif+ <th class="hidden-sm hidden-xs">{{ trans('form.account_number') }}</th>+ @if('liabilities' !== $objectType)+ <th class="text-right">{{ trans('list.currentBalance') }}</th>+ @endif+ @if('liabilities' === $objectType)+ <th class="text-right">+ {{ trans('firefly.left_in_debt') }}+ </th>+ @endif+ <th class="hidden-sm hidden-xs">{{ trans('list.active') }}</th>+ {{-- hide last activity to make room for other stuff --}}+ @if('liabilities' !== $objectType)+ <th class="hidden-sm hidden-xs hidden-md">{{ trans('list.lastActivity') }}</th>+ @endif+ <th+ class="fifteen hidden-sm hidden-xs hidden-md">{{ trans('list.balanceDiff') }}</th>+ <th class="hidden-sm hidden-xs"> </th>+ </tr>+ </thead>+ <tbody>+ @foreach($accounts as $account)+ <tr class="sortable-object" data-id="{{ $account->id }}" data-order="{{ $account->order }}" data-position="{{ $loop->index }}">+ <td class="hidden-sm hidden-xs">+ <span class="fa fa-fw fa-bars object-handle"></span>+ </td>+ <td>+ <a href="{{ route('accounts.show',$account->id) }}">{{ $account->name }}</a>+ {% if account.location %}+ <span class="fa fa-fw fa-map-marker"></span>+ {% endif %}+ {% if account.attachments.count() > 0 %}+ <span class="fa fa-fw fa-paperclip"></span>+ {% endif %}+ </td>+ {% if objectType == "asset" %}+ <td class="hidden-sm hidden-xs hidden-md">+ {% for entry in account.accountmeta %}+ {% if entry.name == 'account_role' %}+ {{ __('firefly.account_role_'.$entry['data']) }}+ {% endif %}+ {% endfor %}+ </td>+ {% endif %}+ {% if objectType == 'liabilities' %}+ <td>{{ $account->accountTypeString }}</td>+ <td>{{ trans('firefly.liability_direction_' . $account->liability_direction . '_short') }}</td>+ <td>{{ $account->interest }}% ({{ strtolower($account->interestPeriod) }})</td>+ {% endif %}+ <td class="hidden-sm hidden-xs">{{ $account->iban }}{% if account.iban == '' %}{{ accountGetMetaField($account, 'account_number') }}{% endif %}</td>+ {% if objectType != 'liabilities' %}+ <td class="text-right">+ <span class="mr-2">+ {% for key, balance in account.endBalances %}+ <span title="{{ $key }}">+ {% if 'balance' == key %}+ {% if not convertToPrimary %}+ {{ formatAmountBySymbol($balance, $account->currency->symbol, $account->currency->decimal_places) }}+ {% endif %}+ {% elseif 'pc_balance' == key %}+ {% if convertToPrimary %}+ {{ formatAmountBySymbol($balance, $primaryCurrency->symbol, $primaryCurrency->decimal_places) }}+ {% endif %}+ {% else %}+ ({{ formatAmountByCode($balance, $key) }})+ {% endif %}+ </span>+ {% endfor %}+ </span>+ </td>+ {% endif %}+ {% if objectType == 'liabilities' %}+ <td class="text-right">+ {% if '-' != account.current_debt %}+ <span class="text-info money-transfer">+ {{ formatAmountBySymbol($account->current_debt, $account->currency->symbol, $account->currency->decimal_places, false) }}+ </span>+ {% endif %}+ </td>+ {% endif %}+ <td class="hidden-sm hidden-xs">+ {% if account.active %}+ <span class="fa fa-fw fa-check"></span>+ {% else %}+ <span class="fa fa-fw fa-ban"></span>+ {% endif %}+ </td>+ {# hide last activity to make room for other stuff #}+ {% if objectType != 'liabilities' %}+ {% if account.lastActivityDate %}+ <td class="hidden-sm hidden-xs hidden-md">+ <!-- {{ $account->lastActivityDate }} -->+ {{ $account->lastActivityDate->isoFormat($monthAndDayFormat) }}+ </td>+ {% else %}+ <td class="hidden-sm hidden-xs hidden-md">+ <em>{{ 'never'|_ }}</em>+ </td>+ {% endif %}+ {% endif %}+ <td class="text-right hidden-sm hidden-xs hidden-md">+ <span class="mr-1">+ {% for key, balance in account.differences %}+ <span title="{{ $key }}">+ {% if 'balance' == key %}+ {% if not convertToPrimary %}+ {{ formatAmountBySymbol($balance, $account->currency->symbol, $account->currency->decimal_places) }}+ {% endif %}+ {% elseif 'pc_balance' == key %}+ {% if convertToPrimary %}+ {{ formatAmountBySymbol($balance, $primaryCurrency->symbol, $primaryCurrency->decimal_places) }}+ {% endif %}+ {% else %}+ ({{ formatAmountByCode($balance, $key) }})+ {% endif %}+ </span>+ {% endfor %}+ </span>+ </td>+ <td class="hidden-sm hidden-xs">+ <div class="btn-group btn-group-xs pull-right">+ <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">+ {{ __('firefly.actions') }} <span class="caret"></span></button>+ <ul class="dropdown-menu dropdown-menu-right" role="menu">+ <li><a href="{{ route('accounts.edit',$account->id) }}"><span class="fa fa-fw fa-pencil"></span> {{ __('firefly.edit') }}</a></li>+ <li><a href="{{ route('accounts.delete',$account->id) }}"><span class="fa fa-fw fa-trash"></span> {{ __('firefly.delete') }}</a></li>+ {% if objectType == 'asset' %}+ <li><a href="{{ route('accounts.reconcile',$account->id) }}"><span class="fa fa-fw fa-check"></span> {{ __('firefly.reconcile_this_account') }}</a></li>+ {% endif %}+ </ul>+ </div>+ </td>+ </tr>++ @endforeach+ </tbody>+</table>+<div class="pl-3">+ {{ $accounts->links('pagination.bootstrap-4')}}+</div>diff --git a/resources/views/layout/v3/session.blade.php b/resources/views/layout/v3/session.blade.phpindex 8908da97a7..be0ee110b2 100644--- a/resources/views/layout/v3/session.blade.php+++ b/resources/views/layout/v3/session.blade.php@@ -14,10 +14,10 @@--><base href="{{ route('index', null, true) }}/"><title>- @if('' !== (string)$pageTitle)+ @if('' !== (string)($pageTitle ?? '')){{ $pageTitle }} »@endif- @if('' !== (string)$subTitle && '' === (string) $pageTitle)+ @if('' !== (string)$subTitle && '' === (string) ($pageTitle ?? '')){{ $subTitle }} »@endif@if('Firefly III' !== $title)@@ -265,10 +265,10 @@<div class="col-sm-6"><h3 class="mb-0"><em class="bi {{ $mainTitleIcon }}"></em>- {{ $pageTitle }}+ {{ $pageTitle ?? $title ?? '(no title)' }}<small class="text-xs text-muted">@if(isset($subTitleIcon))- <em class="bi {{ $subTitleIcon }}"></em>X+ <em class="bi {{ $subTitleIcon }}"></em>@endif{{$subTitle}}</small></h3></div>