Skip to content

Firefly III: a personal finances manager

Expand index.

James Coleeee46562beb5
diff --git a/app/Helpers/Functions/helpers.php b/app/Helpers/Functions/helpers.php
index f271f5376b..6c2b8d575e 100644
--- a/app/Helpers/Functions/helpers.php
+++ b/app/Helpers/Functions/helpers.php
@@ -22,8 +22,13 @@
declare(strict_types=1);
+use Carbon\Carbon;
use FireflyIII\Exceptions\FireflyException;
-
+use FireflyIII\Models\TransactionCurrency;
+use FireflyIII\Support\Facades\Amount;
+use FireflyIII\Support\Facades\Steam;
+use Illuminate\Support\Collection;
+use Illuminate\Support\Facades\Log;
use function Safe\mb_ord;
use function Safe\preg_match;
use function Safe\preg_replace_callback;
@@ -32,7 +37,7 @@ if (!function_exists('env_default_when_empty')) {
/**
* @return null|mixed
*/
- function env_default_when_empty(mixed $value, bool|int|string|null $default = null): mixed
+ function env_default_when_empty(mixed $value, bool | int | string | null $default = null): mixed
{
if (null === $value) {
return $default;
@@ -45,6 +50,59 @@ if (!function_exists('env_default_when_empty')) {
}
}
+
+if (!function_exists('bladeAccountBalance')) {
+ function bladeAccountBalance(\FireflyIII\Models\Account $account): string
+ {
+ /** @var Carbon $date */
+ $date = now();
+
+ // get the date from the current session. If it's in the future, keep `now()`.
+ /** @var Carbon $session */
+ $session = clone session('end', today(config('app.timezone'))->endOfMonth());
+ if ($session->lt($date)) {
+ $date = $session->copy();
+ $date->endOfDay();
+ }
+ Log::debug(sprintf('twig balance: Call finalAccountBalance with date/time "%s"', $date->toIso8601String()));
+
+ // 2025-10-08 replace finalAccountBalance with accountsBalancesOptimized.
+ $info = Steam::accountsBalancesOptimized(new Collection()->push($account), $date)[$account->id];
+ // $info = Steam::finalAccountBalance($account, $date);
+ $currency = Steam::getAccountCurrency($account);
+ $primary = Amount::getPrimaryCurrency();
+ $convertToPrimary = Amount::convertToPrimary();
+ $usePrimary = $convertToPrimary && $primary->id !== $currency->id;
+ $currency ??= $primary;
+ $strings = [];
+ foreach ($info as $key => $balance) {
+ if ('balance' === $key) {
+ // balance in account currency.
+ if (!$usePrimary) {
+ $strings[] = Amount::formatAnything($currency, $balance, false);
+ }
+
+ continue;
+ }
+ if ('pc_balance' === $key) {
+ // balance in primary currency.
+ if ($usePrimary) {
+ $strings[] = Amount::formatAnything($primary, $balance, false);
+ }
+
+ continue;
+ }
+ // for multi currency accounts.
+ if ($usePrimary && $key !== $primary->code) {
+ $strings[] = Amount::formatAnything(Amount::getTransactionCurrencyByCode($key), $balance, false);
+ }
+ }
+
+ return implode(', ', $strings);
+
+ }
+}
+
if (!function_exists('string_is_equal')) {
function string_is_equal(string $left, string $right): bool
{
@@ -64,14 +122,14 @@ if (!function_exists('blade_escape_js')) {
return preg_replace_callback(
'#[^a-zA-Z0-9,\._]#Su',
static function ($matches) {
- $char = $matches[0];
+ $char = $matches[0];
/*
* A few characters have short escape sequences in JSON and JavaScript.
* Escape sequences supported only by JavaScript, not JSON, are omitted.
* \" is also supported but omitted, because the resulting string is not HTML safe.
*/
- $short = match ($char) {
+ $short = match ($char) {
'\\' => '\\\\',
'/' => '\/',
"\x08" => '\b',
@@ -93,9 +151,9 @@ if (!function_exists('blade_escape_js')) {
// Split characters outside the BMP into surrogate pairs
// https://tools.ietf.org/html/rfc2781.html#section-2.1
- $u = $codepoint - 0x10_000;
- $high = 0xD800 | ($u >> 10);
- $low = 0xDC00 | ($u & 0x3FF);
+ $u = $codepoint - 0x10_000;
+ $high = 0xD800 | ($u >> 10);
+ $low = 0xDC00 | ($u & 0x3FF);
return \sprintf('\u%04X\u%04X', $high, $low);
},
diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php
index 62b343e586..1190032367 100644
--- a/app/Providers/AppServiceProvider.php
+++ b/app/Providers/AppServiceProvider.php
@@ -23,6 +23,7 @@ declare(strict_types=1);
namespace FireflyIII\Providers;
+use FireflyIII\Models\Account;
use Illuminate\Support\Facades\Blade;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Response;
@@ -69,6 +70,13 @@ class AppServiceProvider extends ServiceProvider
return '';
});
+ // blade extension for account balance.
+ Blade::directive('balance', function (string $account): string {
+ var_dump($account);exit;
+ return $account;
+ return 'blablabla';
+ });
+
// blade extension
Blade::directive('activeXRoutePartial', function (string $route): string {
$name = Route::getCurrentRoute()->getName() ?? '';
diff --git a/app/Support/Steam.php b/app/Support/Steam.php
index 661ab57a48..5d5a3ef3fc 100644
--- a/app/Support/Steam.php
+++ b/app/Support/Steam.php
@@ -875,4 +875,31 @@ class Steam
return $return;
}
+
+ /**
+ * Will format the amount by the currency related to the given account.
+ */
+ public function formatAmountBySymbol(string $amount, ?string $symbol = null, ?int $decimalPlaces = null, ?bool $coloured = null): string
+ {
+ if (null === $symbol) {
+ $message = sprintf(
+ 'formatAmountBySymbol("%s", %s, %d, %s) was called without a symbol. Please browse to /flush to clear your cache.',
+ $amount,
+ var_export($symbol, true),
+ $decimalPlaces,
+ var_export($coloured, true)
+ );
+ Log::error($message);
+ $currency = Amount::getPrimaryCurrency();
+ }
+ if (null !== $symbol) {
+ $decimalPlaces ??= 2;
+ $coloured ??= true;
+ $currency = new TransactionCurrency();
+ $currency->symbol = $symbol;
+ $currency->decimal_places = $decimalPlaces;
+ }
+
+ return Amount::formatAnything($currency, $amount, $coloured);
+ }
}
diff --git a/app/View/Components/Generic/Amount.php b/app/View/Components/Generic/Amount.php
new file mode 100644
index 0000000000..ee3a4a17d6
--- /dev/null
+++ b/app/View/Components/Generic/Amount.php
@@ -0,0 +1,27 @@
+<?php
+
+namespace FireflyIII\View\Components\Generic;
+
+use Closure;
+use Illuminate\Contracts\View\View;
+use Illuminate\View\Component;
+
+class Amount extends Component
+{
+
+ /**
+ * Create a new component instance.
+ */
+ public function __construct(public array $transaction)
+ {
+ //
+ }
+
+ /**
+ * Get the view / contents that represent the component.
+ */
+ public function render(): View|Closure|string
+ {
+ return view('components.generic.amount');
+ }
+}
diff --git a/app/View/Components/Lists/GroupsTiny.php b/app/View/Components/Lists/GroupsTiny.php
index e214081531..2813c9d120 100644
--- a/app/View/Components/Lists/GroupsTiny.php
+++ b/app/View/Components/Lists/GroupsTiny.php
@@ -11,7 +11,7 @@ class GroupsTiny extends Component
/**
* Create a new component instance.
*/
- public function __construct()
+ public function __construct(public array $transactions)
{
//
}
diff --git a/public/v1/js/css/app.css b/public/v1/js/css/app.css
new file mode 100755
index 0000000000..8b13789179
--- /dev/null
+++ b/public/v1/js/css/app.css
@@ -0,0 +1 @@
+
diff --git a/public/v1/js/css/layout.css b/public/v1/js/css/layout.css
new file mode 100755
index 0000000000..8b13789179
--- /dev/null
+++ b/public/v1/js/css/layout.css
@@ -0,0 +1 @@
+
diff --git a/resources/assets/v1/mix-manifest.json b/resources/assets/v1/mix-manifest.json
index 66803d654c..7b58ca1f4e 100644
--- a/resources/assets/v1/mix-manifest.json
+++ b/resources/assets/v1/mix-manifest.json
@@ -22,6 +22,8 @@
"/public/v1/js/app_vue.js.LICENSE.txt": "/public/v1/js/app_vue.js.LICENSE.txt",
"/public/v1/js/create_transaction.js": "/public/v1/js/create_transaction.js",
"/public/v1/js/create_transaction.js.LICENSE.txt": "/public/v1/js/create_transaction.js.LICENSE.txt",
+ "/public/v1/js/css/app.css": "/public/v1/js/css/app.css",
+ "/public/v1/js/css/layout.css": "/public/v1/js/css/layout.css",
"/public/v1/js/edit_transaction.js": "/public/v1/js/edit_transaction.js",
"/public/v1/js/edit_transaction.js.LICENSE.txt": "/public/v1/js/edit_transaction.js.LICENSE.txt",
"/public/v1/js/exchange-rates/index.js": "/public/v1/js/exchange-rates/index.js",
@@ -97,6 +99,10 @@
"/public/v1/js/ff/transactions/mass/edit-bulk.js": "/public/v1/js/ff/transactions/mass/edit-bulk.js",
"/public/v1/js/ff/transactions/mass/edit.js": "/public/v1/js/ff/transactions/mass/edit.js",
"/public/v1/js/ff/transactions/show.js": "/public/v1/js/ff/transactions/show.js",
+ "/public/v1/js/js/layout.js": "/public/v1/js/js/layout.js",
+ "/public/v1/js/js/layout.js.LICENSE.txt": "/public/v1/js/js/layout.js.LICENSE.txt",
+ "/public/v1/js/layout.js": "/public/v1/js/layout.js",
+ "/public/v1/js/layout.js.LICENSE.txt": "/public/v1/js/layout.js.LICENSE.txt",
"/public/v1/js/lib/Chart.bundle.min.js": "/public/v1/js/lib/Chart.bundle.min.js",
"/public/v1/js/lib/accounting.min.js": "/public/v1/js/lib/accounting.min.js",
"/public/v1/js/lib/bootstrap-multiselect.js": "/public/v1/js/lib/bootstrap-multiselect.js",
diff --git a/resources/assets/v3/js/boot/bootstrap.js b/resources/assets/v3/js/boot/bootstrap.js
index af35106cea..5e4fda4937 100644
--- a/resources/assets/v3/js/boot/bootstrap.js
+++ b/resources/assets/v3/js/boot/bootstrap.js
@@ -22,17 +22,61 @@
import "bootstrap"
import "admin-lte"
import Alpine from 'alpinejs'
+import store from "store";
+import axios from 'axios';
+import observePlugin from 'store/plugins/observe';
+import {getFreshVariable} from "v2/src/store/get-fresh-variable.js";
+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";
-console.log('Loaded A');
+store.addPlugin(observePlugin);
-
-// start alpine JS
+window.bootstrapped = false;
+window.store = store;
window.Alpine = Alpine
-console.log('Loaded B');
+window.axios = axios;
+window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
+
+// always grab the preference "marker" from Firefly III.
+getFreshVariable('lastActivity').then((serverValue) => {
+ if(null === serverValue) {
+ console.log('Server value is null in getFreshVariable.');
+ throw new Error('401 in getFreshVariable.');
+ }
+ const localValue = store.get('lastActivity');
+ store.set('cacheValid', localValue === serverValue);
+ store.set('lastActivity', serverValue);
+ console.log('Server value: ' + serverValue);
+ console.log('Local value: ' + localValue);
+ console.log('Cache valid: ' + (localValue === serverValue));
+}).then(() => {
+ Promise.all([
+ getVariable('viewRange'),
+ getVariable('darkMode'),
+ getVariable('locale'),
+ getVariable('language')
+ ]).then((values) => {
+ if (!store.get('start') || !store.get('end')) {
+ // calculate new start and end, and store them.
+ const range = getViewRange(values[0], new Date);
+ store.set('start', range.start);
+ store.set('end', range.end);
+ }
-const event = new Event('firefly-iii-bootstrapped');
-document.dispatchEvent(event);
-window.bootstrapped = true;
+ // save local in window.__ something
+ window.__localeId__ = values[2];
+ store.set('language', values[3]);
+ store.set('locale', values[3]);
+ loadTranslations(values[3]).then(() => {
+ const event = new Event('firefly-iii-bootstrapped');
+ document.dispatchEvent(event);
+ window.bootstrapped = true;
+ console.log('Bootstrapped!');
+ });
+ });
+}).catch((error) => {
+ console.error('Error while bootstrapping: ' + error);
+});
-console.log('Bootstrapped!');
diff --git a/resources/views/components/generic/amount.blade.php b/resources/views/components/generic/amount.blade.php
new file mode 100644
index 0000000000..d90d7e9926
--- /dev/null
+++ b/resources/views/components/generic/amount.blade.php
@@ -0,0 +1,116 @@
+
+
+
+
+@if(\FireflyIII\Enums\TransactionTypeEnum::DEPOSIT->value === $transaction['transaction_type_type'])
+ {!! \FireflyIII\Support\Facades\Steam::formatAmountBySymbol(bcmul($transaction['amount'],'-1'), $transaction['currency_symbol'], $transaction['currency_decimal_places']) !!}
+ @if(null !== $transaction['foreign_amount'])
+ ({!! \FireflyIII\Support\Facades\Steam::formatAmountBySymbol(bcmul($transaction['foreign_amount'], '-1'), $transaction['foreign_currency_symbol'], $transaction['foreign_currency_decimal_places']) !!})
+ @endif
+ @if($convertToPrimary && null !== $transaction['pc_amount'])
+ ({!! \FireflyIII\Support\Facades\Steam::formatAmountBySymbol(bcmul($transaction['pc_amount'], '-1'), $primaryCurrency->symbol, $primaryCurrency->decimal_places) !!})
+ @endif
+@endif
+
+@if(\FireflyIII\Enums\TransactionTypeEnum::WITHDRAWAL->value === $transaction['transaction_type_type'])
+ {!! \FireflyIII\Support\Facades\Steam::formatAmountBySymbol($transaction['amount'], $transaction['currency_symbol'], $transaction['currency_decimal_places']) !!}
+ @if(null !== $transaction['foreign_amount'])
+ ({!! \FireflyIII\Support\Facades\Steam::formatAmountBySymbol($transaction['foreign_amount'], $transaction['foreign_currency_symbol'], $transaction['foreign_currency_decimal_places']) !!})
+ @endif
+ @if($convertToPrimary && null !== $transaction['pc_amount'])
+ ({!! \FireflyIII\Support\Facades\Steam::formatAmountBySymbol($transaction['pc_amount'], $primaryCurrency->symbol, $primaryCurrency->decimal_places) !!})
+ @endif
+@endif
+
+@if(\FireflyIII\Enums\TransactionTypeEnum::TRANSFER->value === $transaction['transaction_type_type'])
+ <span class="text-info money-transfer">
+ {{-- transfer away --}}
+ @if(isset($account) && $transaction['source_account_id'] === $account->id)
+ {!! \FireflyIII\Support\Facades\Steam::formatAmountBySymbol(bcmul($transaction['amount'],'-1'), $transaction['currency_symbol'], $transaction['currency_decimal_places'], false) !!}
+ @if(null !== $transaction['foreign_amount'])
+ ({!! \FireflyIII\Support\Facades\Steam::formatAmountBySymbol(bcmul($transaction['foreign_amount'],'-1'), $transaction['foreign_currency_symbol'], $transaction['foreign_currency_decimal_places'], false) !!})
+ @endif
+ @if($convertToPrimary && null !== $transaction['pc_amount'])
+ ({!! \FireflyIII\Support\Facades\Steam::formatAmountBySymbol(bcmul($transaction['pc_amount'], '-1'), $primaryCurrency->symbol, $primaryCurrency->decimal_places, false) !!})
+ @endif
+ @endif
+
+ {{-- transfer in (default) --}}
+ @if(!isset($account) || $transaction['source_account_id'] !== $account->id)
+ {!! \FireflyIII\Support\Facades\Steam::formatAmountBySymbol($transaction['amount'], $transaction['currency_symbol'], $transaction['currency_decimal_places'], false) !!}
+ @if(null !== $transaction['foreign_amount'])
+ ({!! \FireflyIII\Support\Facades\Steam::formatAmountBySymbol($transaction['foreign_amount'], $transaction['foreign_currency_symbol'], $transaction['foreign_currency_decimal_places'], false) !!})
+ @endif
+ @if($convertToPrimary && null !== $transaction['pc_amount'])
+ ({!! \FireflyIII\Support\Facades\Steam::formatAmountBySymbol($transaction['pc_amount'], $primaryCurrency->symbol, $primaryCurrency->decimal_places, false) !!})
+ @endif
+ @endif
+ </span>
+@endif
+
+
+@if(\FireflyIII\Enums\TransactionTypeEnum::OPENING_BALANCE->value === $transaction['transaction_type_type'])
+ {{-- Opening balance is deposited on this account (render as positive amount) --}}
+ @if(\FireflyIII\Enums\AccountTypeEnum::INITIAL_BALANCE->value === $transaction['source_account_type'])
+ {!! \FireflyIII\Support\Facades\Steam::formatAmountBySymbol(bcmul($transaction['amount'],'-1'), $transaction['currency_symbol'], $transaction['currency_decimal_places'], false) !!}
+ @if(null !== $transaction['foreign_amount'])
+ ({!! \FireflyIII\Support\Facades\Steam::formatAmountBySymbol(bcmul($transaction['foreign_amount'],'-1'), $transaction['foreign_currency_symbol'], $transaction['foreign_currency_decimal_places'], false) !!})
+ @endif
+ @if($convertToPrimary && null !== $transaction['pc_amount'])
+ ({!! \FireflyIII\Support\Facades\Steam::formatAmountBySymbol(bcmul($transaction['pc_amount'], '-1'), $primaryCurrency->symbol, $primaryCurrency->decimal_places, false) !!})
+ @endif
+ @endif
+
+ {{-- Opening balance is removed from this account (render as negative amount) --}}
+ @if(\FireflyIII\Enums\AccountTypeEnum::INITIAL_BALANCE->value === $transaction['destination_account_type'])
+ {!! \FireflyIII\Support\Facades\Steam::formatAmountBySymbol($transaction['amount'], $transaction['currency_symbol'], $transaction['currency_decimal_places'], false) !!}
+ @if(null !== $transaction['foreign_amount'])
+ ({!! \FireflyIII\Support\Facades\Steam::formatAmountBySymbol($transaction['foreign_amount'], $transaction['foreign_currency_symbol'], $transaction['foreign_currency_decimal_places'], false) !!})
+ @endif
+ @if($convertToPrimary && null !== $transaction['pc_amount'])
+ ({!! \FireflyIII\Support\Facades\Steam::formatAmountBySymbol($transaction['pc_amount'], $primaryCurrency->symbol, $primaryCurrency->decimal_places, false) !!})
+ @endif
+ @endif
+@endif
+
+@if(\FireflyIII\Enums\TransactionTypeEnum::RECONCILIATION->value === $transaction['transaction_type_type'])
+ {{-- Reconciliation correction is deposited on this account (render as positive amount) --}}
+ @if(\FireflyIII\Enums\AccountTypeEnum::RECONCILIATION->value === $transaction['source_account_type'])
+ {!! \FireflyIII\Support\Facades\Steam::formatAmountBySymbol(bcmul($transaction['amount'],'-1'), $transaction['currency_symbol'], $transaction['currency_decimal_places'], false) !!}
+ @if(null !== $transaction['foreign_amount'])
+ ({!! \FireflyIII\Support\Facades\Steam::formatAmountBySymbol(bcmul($transaction['foreign_amount'],'-1'), $transaction['foreign_currency_symbol'], $transaction['foreign_currency_decimal_places'], false) !!})
+ @endif
+ @if($convertToPrimary && null !== $transaction['pc_amount'])
+ ({!! \FireflyIII\Support\Facades\Steam::formatAmountBySymbol(bcmul($transaction['pc_amount'], '-1'), $primaryCurrency->symbol, $primaryCurrency->decimal_places, false) !!})
+ @endif
+ @endif
+
+ {{-- Reconciliation correction is removed from this account (render as negative amount) --}}
+ @if(\FireflyIII\Enums\AccountTypeEnum::RECONCILIATION->value === $transaction['destination_account_type'])
+ {!! \FireflyIII\Support\Facades\Steam::formatAmountBySymbol($transaction['amount'], $transaction['currency_symbol'], $transaction['currency_decimal_places'], false) !!}
+ @if(null !== $transaction['foreign_amount'])
+ ({!! \FireflyIII\Support\Facades\Steam::formatAmountBySymbol($transaction['foreign_amount'], $transaction['foreign_currency_symbol'], $transaction['foreign_currency_decimal_places'], false) !!})
+ @endif
+ @if($convertToPrimary && null !== $transaction['pc_amount'])
+ ({!! \FireflyIII\Support\Facades\Steam::formatAmountBySymbol($transaction['pc_amount'], $primaryCurrency->symbol, $primaryCurrency->decimal_places, false) !!})
+ @endif
+ @endif
+@endif
+
+
+{{--
+<span class="pull-right small">
+
+
+{% elseif transaction.transaction_type_type == 'Reconciliation' %}
+{% else %}
+ {{ formatAmountBySymbol(transaction.amount, transaction.currency_symbol, transaction.currency_decimal_places) }}
+ {% if null != transaction.foreign_amount %}
+ ({{ formatAmountBySymbol(transaction.foreign_amount, transaction.foreign_currency_symbol, transaction.foreign_currency_decimal_places) }})
+ {% endif %}
+ {% if convertToPrimary and null != transaction.pc_amount %}
+ ({{ formatAmountBySymbol(transaction.pc_amount, primaryCurrency.symbol, foreign_currency_.decimal_places) }})
+ {% endif %}
+{% endif %}
+ </span>
+ --}}
diff --git a/resources/views/components/layout/create-menu.blade.php b/resources/views/components/layout/create-menu.blade.php
index fd9e50c13e..e9aac6be4c 100644
--- a/resources/views/components/layout/create-menu.blade.php
+++ b/resources/views/components/layout/create-menu.blade.php
@@ -1,83 +1,154 @@
<!-- begin create menu -->
<li class="nav-item dropdown">
<a class="nav-link" data-bs-toggle="dropdown" href="#" aria-expanded="false">
- <i class="bi bi-chat-text"></i>
- <span class="navbar-badge badge text-bg-danger">3</span>
+ <em class="bi bi-plus-circle"></em>
</a>
<div class="dropdown-menu dropdown-menu-lg dropdown-menu-end">
- <a href="#" class="dropdown-item">
- <!--begin::Message-->
+ <a href="{{ route('transactions.create', ['withdrawal']) }}" class="dropdown-item">
<div class="d-flex">
- <div class="flex-shrink-0">
- <img src="./assets/img/user1-128x128.jpg" alt="User Avatar" class="img-size-50 rounded-circle me-3">
- </div>
- <div class="flex-grow-1">
+ <div class="grow">
<h3 class="dropdown-item-title">
- Brad Diesel
- <span class="float-end fs-7 text-danger"><i class="bi bi-star-fill"></i></span>
+ <!-- withdrawal, deposit, transfer -->
+ <em class="bi bi-arrow-left me-2"></em>
+ {{ __('firefly.create_new_withdrawal') }}
</h3>
- <p class="fs-7">Call me whenever you can...</p>
- <p class="fs-7 text-secondary">
- <i class="bi bi-clock-fill me-1"></i> 4 Hours Ago
- </p>
</div>
</div>
- <!--end::Message-->
</a>
<div class="dropdown-divider"></div>
- <a href="#" class="dropdown-item">
- <!--begin::Message-->
+ <a href="{{ route('transactions.create', ['deposit']) }}" class="dropdown-item">
<div class="d-flex">
- <div class="flex-shrink-0">
- <img src="./assets/img/user8-128x128.jpg" alt="User Avatar" class="img-size-50 rounded-circle me-3">
+ <div class="grow">
+ <h3 class="dropdown-item-title">
+ <!-- withdrawal, deposit, transfer -->
+ <em class="bi bi-arrow-right me-2"></em>
+ {{ __('firefly.create_new_deposit') }}
+ </h3>
</div>
- <div class="flex-grow-1">
+ </div>
+ </a>
+ <div class="dropdown-divider"></div>
+ <a href="{{ route('transactions.create', ['transfer']) }}" class="dropdown-item">
+ <div class="d-flex">
+ <div class="grow">
<h3 class="dropdown-item-title">
- John Pierce
- <span class="float-end fs-7 text-secondary">
- <i class="bi bi-star-fill"></i>
- </span>
+ <!-- withdrawal, deposit, transfer -->
+ <em class="bi bi-arrow-left-right me-2"></em>
+ {{ __('firefly.create_new_transfer') }}
</h3>
- <p class="fs-7">I got your message bro</p>
- <p class="fs-7 text-secondary">
- <i class="bi bi-clock-fill me-1"></i> 4 Hours Ago
- </p>
</div>
</div>
- <!--end::Message-->
</a>
<div class="dropdown-divider"></div>
- <a href="#" class="dropdown-item">
- <!--begin::Message-->
+
+ <a href="{{ route('accounts.create', ['asset']) }}" class="dropdown-item">
<div class="d-flex">
- <div class="flex-grow-1">
+ <div class="grow">
<h3 class="dropdown-item-title">
- <em class="bi bi-car-front"></em> Nora SilvesterX
+ <!-- withdrawal, deposit, transfer -->
+ <em class="bi bi-cash me-2"></em>
+ {{ __('firefly.create_new_asset') }}
</h3>
</div>
</div>
- <!--end::Message-->
</a>
<div class="dropdown-divider"></div>
- <a href="#" class="dropdown-item">
- <!--begin::Message-->
+ <a href="{{ route('accounts.create', ['liabilities']) }}" class="dropdown-item">
<div class="d-flex">
- <div class="flex-grow-1">
- <p class="fs-7">The subject goes here</p>
+ <div class="grow">
+ <h3 class="dropdown-item-title">
+ <!-- withdrawal, deposit, transfer -->
+ <em class="bi bi-ticket-detailed me-2"></em>
+ {{ __('firefly.create_new_liabilities') }}
+ </h3>
</div>
</div>
- <!--end::Message-->
</a>
-
<div class="dropdown-divider"></div>
- <a href="#" class="dropdown-item">
- Bla bla
- <!--end::Message-->
+ <a href="{{ route('budgets.create') }}" class="dropdown-item">
+ <div class="d-flex">
+ <div class="grow">
+ <h3 class="dropdown-item-title">
+ <!-- withdrawal, deposit, transfer -->
+ <em class="bi bi-pie-chart me-2"></em>
+ {{ __('firefly.create_new_budget') }}
+ </h3>
+ </div>
+ </div>
+ </a>
+ <div class="dropdown-divider"></div>
+ <a href="{{ route('categories.create') }}" class="dropdown-item">
+ <div class="d-flex">
+ <div class="grow">
+ <h3 class="dropdown-item-title">
+ <!-- withdrawal, deposit, transfer -->
+ <em class="bi bi-bookmark me-2"></em>
+ {{ __('firefly.create_new_category') }}
+ </h3>
+ </div>
+ </div>
+ </a>
+ <div class="dropdown-divider"></div>
+ <a href="{{ route('piggy-banks.create') }}" class="dropdown-item">
+ <div class="d-flex">
+ <div class="grow">
+ <h3 class="dropdown-item-title">
+ <!-- withdrawal, deposit, transfer -->
+ <em class="bi bi-bullseye me-2"></em>
+ {{ __('firefly.create_new_piggy_bank') }}
+ </h3>
+ </div>
+ </div>
</a>
-
<div class="dropdown-divider"></div>
- <a href="#" class="dropdown-item dropdown-footer">See All Messages</a>
+ <a href="{{ route('subscriptions.create') }}" class="dropdown-item">
+ <div class="d-flex">
+ <div class="grow">
+ <h3 class="dropdown-item-title">
+ <!-- withdrawal, deposit, transfer -->
+ <em class="bi bi-calendar me-2"></em>
+ {{ __('firefly.create_new_subscription') }}
+ </h3>
+ </div>
+ </div>
+ </a>
+ <div class="dropdown-divider"></div>
+ <a href="{{ route('rules.create') }}" class="dropdown-item">
+ <div class="d-flex">
+ <div class="grow">
+ <h3 class="dropdown-item-title">
+ <!-- withdrawal, deposit, transfer -->
+ <em class="bi bi-shuffle me-2"></em>
+ {{ __('firefly.create_new_rule') }}
+ </h3>
+ </div>
+ </div>
+ </a>
+ <div class="dropdown-divider"></div>
+ <a href="{{ route('recurring.create') }}" class="dropdown-item">
+ <div class="d-flex">
+ <div class="grow">
+ <h3 class="dropdown-item-title">
+ <!-- withdrawal, deposit, transfer -->
+ <em class="bi bi-paint-bucket me-2"></em>
+ {{ __('firefly.create_new_recurrence') }}
+ </h3>
+ </div>
+ </div>
+ </a>
+ <div class="dropdown-divider"></div>
+ <a href="{{ route('webhooks.create') }}" class="dropdown-item">
+ <div class="d-flex">
+ <div class="grow">
+ <h3 class="dropdown-item-title">
+ <!-- withdrawal, deposit, transfer -->
+ <em class="bi bi-lightning me-2"></em>
+ {{ __('firefly.create_new_webhook') }}
+ </h3>
+ </div>
+ </div>
+ </a>
</div>
</li>
<!-- end create menu -->
diff --git a/resources/views/components/lists/groups-tiny.blade.php b/resources/views/components/lists/groups-tiny.blade.php
index 4956686526..c1a13f5f06 100644
--- a/resources/views/components/lists/groups-tiny.blade.php
+++ b/resources/views/components/lists/groups-tiny.blade.php
@@ -1,4 +1,14 @@
-<div>
- <!-- No surplus words or unnecessary actions. - Marcus Aurelius -->
- TODO include groups-tiny
+<div class="list-group">
+ @foreach($transactions as $transaction)
+
+ <a class="list-group-item list-group-item-action d-flex justify-content-between align-items-center" href="{{ route('transactions.show', [$transaction['transaction_group_id']]) }}">
+ @if('' !== (string) $transaction['transaction_group_title'])
+ {{ $transaction['transaction_group_title'] }}:
+ @endif
+ {{ $transaction['description'] }}
+ <span class="small">
+ <x-generic.amount :transaction="$transaction" />
+ </span>
+ </a>
+ @endforeach
</div>
diff --git a/resources/views/index.blade.php b/resources/views/index.blade.php
index ce35e56074..e0a460092c 100644
--- a/resources/views/index.blade.php
+++ b/resources/views/index.blade.php
@@ -1,17 +1,14 @@
@extends('layout.v3.session')
@section('content')
TODO boxes
- TODO charts
- TODO piggy bank overview
- TODO side menu voor het maken van shit
TODO internals modal voor pagina settings
TODO wizard modal voor weet ik veel
TODO dark mode ook onthouden en dat script in het template
- TODO fix create menu.
+ TODO date picker
+ TODO intro js
<x-dashboard.boxes :start="$start" :end="$end" />
-
<div class="row" x-data="index">
<div class="col-lg-8 col-md-12 col-sm-12">
<!--ACCOUNTS -->
@@ -33,12 +30,12 @@
<div class="card-title"><a href="{{ route('budgets.index') }}"
title="{{ __('firefly.budgetsAndSpending') }}">{{ __('firefly.budgetsAndSpending') }}</a></div>
</div>
- <div class="box-body">
+ <div class="card-body">
<canvas id="budgets-chart" class="wide-chart" height="400" width="100%"></canvas>
</div>
- <div class="box-footer">
+ <div class="card-footer">
<a href="{{ route('budgets.index') }}" class="btn btn-primary btn-sm">
- <span class="fa fa-pie-chart"></span>
+ <span class="bi bi-pie-chart"></span>
<span>{{ __('firefly.go_to_budgets') }}</span>
</a>
</div>
@@ -50,12 +47,12 @@
title="{{ __('firefly.categories') }}">{{ __('firefly.categories') }}</a></div>
</div>
- <div class="box-body">
+ <div class="card-body">
<canvas id="categories-chart" class="wide-chart" height="400" width="100%"></canvas>
</div>
- <div class="box-footer">
+ <div class="card-footer">
<a href="{{ route('categories.index') }}" class="btn btn-primary btn-sm">
- <span class="fa fa-bookmark"></span>
+ <span class="bi bi-bookmark"></span>
<span>{{ __('firefly.go_to_categories') }}</span>
</a>
</div>
@@ -66,20 +63,18 @@
<!--TRANSACTIONS -->
<div id="all_transactions">
@foreach($transactions as $data)
- <div class="card">
- <div class="box-header with-border">
- <div class="card-title"><a
- href="{{ route('accounts.show', [$data['account']['id']]) }}">{{ $data['account']['name'] }}</a>
+ <div class="card mb-4">
+ <div class="card-header with-border">
+ <div class="card-title"><a href="{{ route('accounts.show', [$data['account']['id']]) }}">{{ $data['account']['name'] }}</a>
</div>
</div>
@if(count($data['transactions']) > 0)
- <div class="box-body no-padding">
- <x-lists.groups-tiny></x-lists.groups-tiny>
- <!-- {% include 'list.groups-tiny' with {'transactions': data.transactions,'account': data.account} %} -->
+ <div class="card-body p-0">
+ <x-lists.groups-tiny :transactions="$data['transactions']" />
</div>
@endif
@if(0 === count($data['transactions']))
- <div class="box-body">
+ <div class="card-body">
<p>
<em>
{{ __('firefly.no_transactions_account', ['name' => $data['account']['name']]) }}
@@ -89,43 +84,39 @@
</div>
@endif
- <div class="box-footer clearfix">
+ <div class="card-footer">
<!-- Single button -->
- <div class="btn-group">
- <a type="button" class="btn btn-success dropdown-toggle" data-toggle="dropdown"
- aria-haspopup="true" aria-expanded="false">
- {{ __('firefly.sidebar_frontpage_create') }} <span class="caret"></span>
- </a>
+ <div class="btn-group" role="group">
+ <button type="button" class="btn btn-primary btn-sm dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false">{{ __('firefly.sidebar_frontpage_create') }}</button>
<ul class="dropdown-menu">
<li>
- <a href="{{ route('transactions.create', ['withdrawal']) }}?source={{ $data['account']['id'] }}">{{ __('firefly.create_new_withdrawal') }}</a>
+ <a class="dropdown-item" href="{{ route('transactions.create', ['withdrawal']) }}?source={{ $data['account']['id'] }}">{{ __('firefly.create_new_withdrawal') }}</a>
</li>
<li>
- <a href="{{ route('transactions.create', ['deposit']) }}?destination={{ $data['account']['id'] }}">{{ __('firefly.create_new_deposit') }}</a>
+ <a class="dropdown-item" href="{{ route('transactions.create', ['deposit']) }}?destination={{ $data['account']['id'] }}">{{ __('firefly.create_new_deposit') }}</a>
</li>
<li>
- <a href="{{ route('transactions.create', ['transfer']) }}?source={{ $data['account']['id'] }}">{{ __('firefly.create_new_transfer') }}</a>
+ <a class="dropdown-item" href="{{ route('transactions.create', ['transfer']) }}?source={{ $data['account']['id'] }}">{{ __('firefly.create_new_transfer') }}</a>
</li>
</ul>
</div>
- <div class="btn-group">
- <a type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown"
- aria-haspopup="true" aria-expanded="false"
- href="{{ route('accounts.show', [$data['account']['id']]) }}"> TODO account balance: @{{ data.account|balance }}
- <span class="caret"></span>
- </a>
+
+ <div class="btn-group" role="group">
+ <button type="button" class="btn btn-primary btn-sm dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false">
+ {{ bladeAccountBalance($data['account']) }}
+ </button>
<ul class="dropdown-menu">
<li>
- <a href="{{ route('accounts.show', [$data['account']['id']]) }}">{{ __('firefly.show') }}</a>
+ <a class="dropdown-item" href="{{ route('accounts.show', [$data['account']['id']]) }}">{{ __('firefly.show') }}</a>
</li>
<li>
- <a href="{{ route('accounts.reconcile', [$data['account']['id']]) }}">{{ __('firefly.reconcile') }}</a>
+ <a class="dropdown-item" href="{{ route('accounts.reconcile', [$data['account']['id']]) }}">{{ __('firefly.reconcile') }}</a>
</li>
<li>
- <a href="{{ route('accounts.edit', [$data['account']['id']]) }}">{{ __('firefly.edit') }}</a>
+ <a class="dropdown-item" href="{{ route('accounts.edit', [$data['account']['id']]) }}">{{ __('firefly.edit') }}</a>
</li>
<li>
- <a href="{{ route('accounts.delete', [$data['account']['id']]) }}">{{ __('firefly.delete') }}</a>
+ <a class="dropdown-item" href="{{ route('accounts.delete', [$data['account']['id']]) }}">{{ __('firefly.delete') }}</a>
</li>
</ul>
</div>
@@ -137,19 +128,18 @@
@if($billCount > 0)
<!--BILLS -->
<div class="card">
- <div class="box-header with-border">
- <div class="card-title"><a href="{{ route('subscriptions.index') }}"
- title="{{ __('firefly.bills') }}">{{ __('firefly.bills') }}</a></div>
+ <div class="card-header with-border">
+ <div class="card-title"><a href="{{ route('subscriptions.index') }}" title="{{ __('firefly.bills') }}">{{ __('firefly.bills') }}</a></div>
</div>
- <div class="box-body">
+ <div class="card-body">
<div class="center-chart">
<canvas id="bills-chart" class="low-chart" height="200"></canvas>
</div>
</div>
- <div class="box-footer">
+ <div class="card-footer">
<a href="{{ route('bills.index') }}" class="btn btn-primary btn-sm"><span
- class="fa fa-calendar"></span> {{ __('firefly.go_to_bills') }}</a>
+ class="bi bi-calendar"></span> {{ __('firefly.go_to_bills') }}</a>
</div>
</div>
@endif
@@ -169,13 +159,13 @@
title="{{ __('firefly.expense_accounts') }}">{{ __('firefly.expense_accounts') }}</a>
</div>
</div>
- <div class="box-body">
+ <div class="card-body">
<canvas id="expense-accounts-chart" class="wide-chart" height="400"
width="100%"></canvas>
</div>
- <div class="box-footer">
+ <div class="card-footer">
<a href="{{ route('accounts.index', ['expense']) }}" class="btn btn-primary btn-sm"><span
- class="fa fa-shopping-cart"></span> {{ __('firefly.go_to_expense_accounts') }}</a>
+ class="bi bi-cart"></span> {{ __('firefly.go_to_expense_accounts') }}</a>
</div>
</div>
<!--OPTIONAL REVENUE ACCOUNTS -->
@@ -185,13 +175,13 @@
title="{{ __('firefly.revenue_accounts') }}">{{ __('firefly.revenue_accounts') }}</a></div>
</div>
- <div class="box-body">
+ <div class="card-body">
<canvas id="revenue-accounts-chart" class="wide-chart" height="400"
width="100%"></canvas>
</div>
- <div class="box-footer">
+ <div class="card-footer">
<a href="{{ route('accounts.index', ['revenue']) }}" class="btn btn-primary btn-sm"><span
- class="fa fa-download"></span> {{ __('firefly.go_to_revenue_accounts') }}</a>
+ class="bi bi-box-arrow-down"></span> {{ __('firefly.go_to_revenue_accounts') }}</a>
</div>
</div>
</div>
@@ -200,6 +190,36 @@
@endsection
@section('scripts')
@vite(['js/pages/dashboard/dashboard.js'])
+
+
+ <script type="text/javascript" nonce="{{ $JS_NONCE }}">
+ var lineColor = 'red';
+ var lineTextColor = '#000';
+ if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {
+ lineColor = '#a00';
+ lineTextColor = '#bec5cb';
+ }
+ var billCount = {{ $billCount }};
+ var accountFrontpageUrl = '{{ route('chart.account.frontpage') }}';
+ var accountRevenueUrl = '{{ route('chart.account.revenue') }}';
+ var accountExpenseUrl = '{{ route('chart.account.expense') }}';
+ var piggyInfoUrl = '{{ route('json.fp.piggy-banks') }}';
+ var drawVerticalLine = '';
+ {{-- render vertical line with text "today" --}}
+ @if($start->lte($today) && $end->gte($today))
+ drawVerticalLine = '{{ $today->isoFormat($monthAndDayFormat) }}';
+ @endif
+ </script>
+
+ <script type="text/javascript" src="v1/js/lib/Chart.bundle.min.js?v={{ $FF_BUILD_TIME }}"
+ nonce="{{ $JS_NONCE }}"></script>
+ <script type="text/javascript" src="v1/js/lib/chartjs-plugin-annotation.min.js?v={{ $FF_BUILD_TIME }}"
+ nonce="{{ $JS_NONCE }}"></script>
+ <script type="text/javascript" src="v1/js/ff/charts.defaults.js?v={{ $FF_BUILD_TIME }}"
+ nonce="{{ $JS_NONCE }}"></script>
+ <script type="text/javascript" src="v1/js/ff/charts.js?v={{ $FF_BUILD_TIME }}" nonce="{{ $JS_NONCE }}"></script>
+ <script type="text/javascript" src="v1/js/ff/index.js?v={{ $FF_BUILD_TIME }}" nonce="{{ $JS_NONCE }}"></script>
+
@endsection
{{--
<script type="text/javascript" nonce="{{ $JS_NONCE }}">
diff --git a/resources/views/json/piggy-banks.twig b/resources/views/json/piggy-banks-old.twig
similarity index 100%
rename from resources/views/json/piggy-banks.twig
rename to resources/views/json/piggy-banks-old.twig
diff --git a/resources/views/layout/v3/session.blade.php b/resources/views/layout/v3/session.blade.php
index 5f3a9ecdd0..67cc816e45 100644
--- a/resources/views/layout/v3/session.blade.php
+++ b/resources/views/layout/v3/session.blade.php
@@ -267,6 +267,26 @@
<!--end::OverlayScrollbars Configure-->
+{{-- Moment JS --}}
+<script src="v1/js/lib/moment.min.js?v={{ $FF_BUILD_TIME }}" type="text/javascript" nonce="{{ $JS_NONCE }}"></script>
+<script src="v1/js/lib/moment/{{ str_replace($language,'-','_') }}.js?v={{ $FF_BUILD_TIME }}" type="text/javascript" nonce="{{ $JS_NONCE }}"></script>
+
+{{-- All kinds of variables. --}}
+<script src="{{ route('javascript.variables') }}?ext=.js&amp;v={{ $FF_VERSION }}@if(isset($account))&amp;account={{ $account->id }}@endif" type="text/javascript" nonce="{{ $JS_NONCE }}"></script>
+
+{{-- Base script: jquery and bootstrap --}}
+<script src="v1/js/app.js?v={{ $FF_BUILD_TIME }}" type="text/javascript" nonce="{{ $JS_NONCE }}"></script>
+
+
+{{-- date range picker, current template, etc. --}}
+<script src="v1/js/lib/daterangepicker.js?v={{ $FF_BUILD_TIME }}" type="text/javascript" nonce="{{ $JS_NONCE }}"></script>
+<script src="v1/lib/adminlte/js/adminlte.min.js?v={{ $FF_BUILD_TIME }}" type="text/javascript" nonce="{{ $JS_NONCE }}"></script>
+<script type="text/javascript" src="v1/js/lib/accounting.min.js?v={{ $FF_BUILD_TIME }}" nonce="{{ $JS_NONCE }}"></script>
+
+{{-- Firefly III code --}}
+<script type="text/javascript" src="v1/js/ff/firefly.js?v={{ $FF_BUILD_TIME }}" nonce="{{ $JS_NONCE }}"></script>
+<script type="text/javascript" src="v1/js/ff/help.js?v={{ $FF_BUILD_TIME }}" nonce="{{ $JS_NONCE }}"></script>
+
@yield('scripts')
<!--begin::Color Mode Toggle (#6010)-->
diff --git a/resources/views/v2/partials/layout/topbar.blade.php b/resources/views/v2/partials/layout/topbar.blade.php
index 37e070589c..960d91a6ea 100644
--- a/resources/views/v2/partials/layout/topbar.blade.php
+++ b/resources/views/v2/partials/layout/topbar.blade.php
@@ -57,11 +57,7 @@
<i class="fa-solid fa-plus-circle"></i>
</a>
<div class="dropdown-menu dropdown-menu-lg dropdown-menu-end">
- <!-- withdrawal, deposit, transfer -->
- <a href="{{ route('transactions.create', ['withdrawal']) }}" class="dropdown-item">
- <em class="fa-solid fa-arrow-left fa-fw me-2"></em>
- {{ __('firefly.create_new_withdrawal') }}
- </a>
+
<a href="{{ route('transactions.create', ['deposit']) }}" class="dropdown-item">
<em class="fa-solid fa-arrow-right fa-fw me-2"></em>
{{ __('firefly.create_new_deposit') }}