mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2026-07-28 00:09:56 -07:00
Expand v3 layout.
This commit is contained in:
@@ -24,7 +24,8 @@ declare(strict_types=1);
|
||||
|
||||
use Carbon\Carbon;
|
||||
use FireflyIII\Exceptions\FireflyException;
|
||||
use FireflyIII\Models\TransactionCurrency;
|
||||
use FireflyIII\Models\Account;
|
||||
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
||||
use FireflyIII\Support\Facades\Amount;
|
||||
use FireflyIII\Support\Facades\Steam;
|
||||
use Illuminate\Support\Collection;
|
||||
@@ -50,6 +51,19 @@ if (!function_exists('env_default_when_empty')) {
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('bladeAccountGetMetaField')) {
|
||||
function bladeAccountGetMetaField(Account $account, string $field): string
|
||||
{
|
||||
/** @var AccountRepositoryInterface $repository */
|
||||
$repository = app(AccountRepositoryInterface::class);
|
||||
$result = $repository->getMetaValue($account, $field);
|
||||
if (null === $result) {
|
||||
return '';
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!function_exists('bladeAccountBalance')) {
|
||||
function bladeAccountBalance(\FireflyIII\Models\Account $account): string
|
||||
|
||||
@@ -53,7 +53,7 @@ final class HomeController extends Controller
|
||||
{
|
||||
parent::__construct();
|
||||
app('view')->share('title', 'Firefly III');
|
||||
app('view')->share('mainTitleIcon', 'fa-fire');
|
||||
app('view')->share('mainTitleIcon', 'bi-fire');
|
||||
$this->middleware(Installer::class);
|
||||
}
|
||||
|
||||
@@ -135,15 +135,8 @@ final class HomeController extends Controller
|
||||
if (0 === $count) {
|
||||
return redirect(route('new-user.index'));
|
||||
}
|
||||
|
||||
if ('v1' === (string) config('view.layout')) {
|
||||
return $this->indexV1($repository);
|
||||
}
|
||||
if ('v2' === (string) config('view.layout')) {
|
||||
return $this->indexV2();
|
||||
}
|
||||
|
||||
throw new FireflyException('Invalid layout configuration');
|
||||
// ignore v2.
|
||||
return $this->indexV1($repository);
|
||||
}
|
||||
|
||||
private function indexV1(AccountRepositoryInterface $repository): mixed
|
||||
@@ -152,6 +145,7 @@ final class HomeController extends Controller
|
||||
$pageTitle = (string) trans('firefly.main_dashboard_page_title');
|
||||
$count = $repository->count($types);
|
||||
$subTitle = (string) trans('firefly.welcome_back');
|
||||
$subTitleIcon = 'bi-piggy-bank';
|
||||
$transactions = [];
|
||||
$frontpage = Preferences::getFresh('frontpageAccounts', $repository->getAccountsByType([AccountTypeEnum::ASSET->value])->pluck('id')->toArray());
|
||||
$frontpageArray = $frontpage->data;
|
||||
@@ -188,6 +182,7 @@ final class HomeController extends Controller
|
||||
|
||||
return view('index', [
|
||||
'count' => $count,
|
||||
'subTitleIcon' => $subTitleIcon,
|
||||
'subTitle' => $subTitle,
|
||||
'transactions' => $transactions,
|
||||
'billCount' => $billCount,
|
||||
@@ -198,18 +193,4 @@ final class HomeController extends Controller
|
||||
]);
|
||||
}
|
||||
|
||||
private function indexV2(): mixed
|
||||
{
|
||||
$subTitle = (string) trans('firefly.welcome_back');
|
||||
$pageTitle = (string) trans('firefly.main_dashboard_page_title');
|
||||
|
||||
$start = session('start', today(config('app.timezone'))->startOfMonth());
|
||||
$end = session('end', today(config('app.timezone'))->endOfMonth());
|
||||
|
||||
/** @var User $user */
|
||||
$user = auth()->user();
|
||||
event(new SystemRequestedVersionCheck($user));
|
||||
|
||||
return view('index', ['subTitle' => $subTitle, 'start' => $start, 'end' => $end, 'pageTitle' => $pageTitle]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ declare(strict_types=1);
|
||||
namespace FireflyIII\Providers;
|
||||
|
||||
use FireflyIII\Models\Account;
|
||||
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
||||
use Illuminate\Support\Facades\Blade;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Facades\Response;
|
||||
@@ -32,7 +33,6 @@ use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Laravel\Passport\Passport;
|
||||
use Override;
|
||||
|
||||
use function Safe\preg_match;
|
||||
|
||||
/**
|
||||
@@ -49,9 +49,10 @@ class AppServiceProvider extends ServiceProvider
|
||||
Passport::$validateKeyPermissions = false;
|
||||
|
||||
Schema::defaultStringLength(191);
|
||||
|
||||
Response::macro('api', function (array $value) {
|
||||
$headers = ['Cache-Control' => 'no-store'];
|
||||
$uuid = (string) request()->header('X-Trace-Id');
|
||||
$uuid = (string)request()->header('X-Trace-Id');
|
||||
if ('' !== trim($uuid) && 1 === preg_match('/^[a-f\d]{8}(-[a-f\d]{4}){4}[a-f\d]{8}$/i', trim($uuid))) {
|
||||
$headers['X-Trace-Id'] = $uuid;
|
||||
}
|
||||
@@ -59,24 +60,37 @@ class AppServiceProvider extends ServiceProvider
|
||||
return response()->json($value)->withHeaders($headers);
|
||||
});
|
||||
|
||||
// blade extension for active menu link
|
||||
Blade::directive('menuItemActive', function (string $route): string {
|
||||
|
||||
// blade extension for active top menu sub menu (like "accounts")
|
||||
// TODO DO NOT USE ME
|
||||
Blade::directive('menuSubActive', function (string $route): string {
|
||||
$route = trim($route, "'");
|
||||
$name = Route::getCurrentRoute()->getName() ?? '';
|
||||
Log::debug(sprintf('menuItemActive("%s", "%s")', $route, $name));
|
||||
if (str_contains($route, $name)) {
|
||||
return 'active';
|
||||
Log::debug(sprintf('menuSubActive("%s", "%s")', $route, $name));
|
||||
if (str_contains($name, $route)) {
|
||||
return 'menu-open';
|
||||
}
|
||||
|
||||
return '';
|
||||
});
|
||||
|
||||
// blade extension for active top menu sub menu item (like "accounts" => "asset accounts)
|
||||
// TODO DO NOT USE ME
|
||||
Blade::directive('menuSubItemActive', function (string $routeAndType): string {
|
||||
|
||||
});
|
||||
|
||||
|
||||
// TODO @deprecated
|
||||
// blade extension for account balance.
|
||||
Blade::directive('balance', function (string $account): string {
|
||||
var_dump($account);exit;
|
||||
var_dump($account);
|
||||
exit;
|
||||
return $account;
|
||||
return 'blablabla';
|
||||
});
|
||||
|
||||
// TODO @deprecated
|
||||
// blade extension
|
||||
Blade::directive('activeXRoutePartial', function (string $route): string {
|
||||
$name = Route::getCurrentRoute()->getName() ?? '';
|
||||
@@ -87,14 +101,14 @@ class AppServiceProvider extends ServiceProvider
|
||||
return '';
|
||||
});
|
||||
Blade::if('partialroute', function (string $route, string $firstParam = ''): bool {
|
||||
$name = Route::getCurrentRoute()->getName() ?? '';
|
||||
$name = Route::getCurrentRoute()->getName() ?? '';
|
||||
if ('' === $firstParam && str_contains($name, $route)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/** @var null|array $params */
|
||||
$params = Route::getCurrentRoute()->parameters();
|
||||
$params ??= [];
|
||||
$params ??= [];
|
||||
$objectType = $params['objectType'] ?? '';
|
||||
|
||||
return $objectType === $firstParam && str_contains($name, $route);
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
/*
|
||||
* Navigation.php
|
||||
* Copyright (c) 2026 james@firefly-iii.org
|
||||
*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
namespace FireflyIII\Support\Blade;
|
||||
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
class Navigation
|
||||
{
|
||||
public static function menuItemActive (string $route): string {
|
||||
$name = Route::getCurrentRoute()->getName() ?? '';
|
||||
Log::debug(sprintf('menuItemActive("%s" = "%s")', $route, $name));
|
||||
if ($name === $route) {
|
||||
return 'active';
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
public static function menuItemActivePartial(string $route): string {
|
||||
$name = Route::getCurrentRoute()->getName() ?? '';
|
||||
Log::debug(sprintf('menuItemActivePartial("%s" starts with "%s")', $name, $route));
|
||||
if (str_starts_with($name, $route)) {
|
||||
return 'active';
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
public static function menuSubItemActive(string $route, string $objectType): string {
|
||||
$name = Route::getCurrentRoute()->getName() ?? '';
|
||||
Log::debug(sprintf('menuSubItemActive("%s" = "%s","%s" = "%s")', $route, $name, $objectType, Route::getCurrentRoute()->parameter('objectType')));
|
||||
if ($name === $route && $objectType === Route::getCurrentRoute()->parameter('objectType')) {
|
||||
return 'active';
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
public static function menuOpenPartial(string $route): string {
|
||||
$name = Route::getCurrentRoute()->getName() ?? '';
|
||||
Log::debug(sprintf('menuOpenPartial("%s" starts with "%s")', $name, $route));
|
||||
if (str_starts_with($name, $route)) {
|
||||
return 'menu-open';
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
}
|
||||
+120
-106
@@ -43,7 +43,6 @@ use Psr\Container\ContainerExceptionInterface;
|
||||
use Psr\Container\NotFoundExceptionInterface;
|
||||
use Safe\Exceptions\UrlException;
|
||||
use ValueError;
|
||||
|
||||
use function Safe\parse_url;
|
||||
use function Safe\preg_replace;
|
||||
|
||||
@@ -57,12 +56,13 @@ class Steam
|
||||
* properly gets the balance of a range.
|
||||
*/
|
||||
public function accountsBalancesInRange(
|
||||
Collection $accounts,
|
||||
Carbon $start,
|
||||
Carbon $end,
|
||||
Collection $accounts,
|
||||
Carbon $start,
|
||||
Carbon $end,
|
||||
?TransactionCurrency $primary = null,
|
||||
?bool $convertToPrimary = null
|
||||
): array {
|
||||
?bool $convertToPrimary = null
|
||||
): array
|
||||
{
|
||||
return [
|
||||
$this->accountsBalancesOptimized($accounts, $start, $primary, $convertToPrimary, inclusive: false),
|
||||
$this->accountsBalancesOptimized($accounts, $end, $primary, $convertToPrimary),
|
||||
@@ -70,54 +70,54 @@ class Steam
|
||||
}
|
||||
|
||||
public function accountsBalancesOptimized(
|
||||
Collection $accounts,
|
||||
Carbon $date,
|
||||
Collection $accounts,
|
||||
Carbon $date,
|
||||
?TransactionCurrency $primary = null,
|
||||
?bool $convertToPrimary = null,
|
||||
bool $inclusive = true
|
||||
): array {
|
||||
?bool $convertToPrimary = null,
|
||||
bool $inclusive = true
|
||||
): array
|
||||
{
|
||||
// Log::debug(sprintf('accountsBalancesOptimized: Called for %d account(s) with date/time "%s" (inclusive: %s)', $accounts->count(), $date->toIso8601String(), var_export($inclusive, true)));
|
||||
$result = [];
|
||||
$result = [];
|
||||
$convertToPrimary ??= Amount::convertToPrimary();
|
||||
$primary ??= Amount::getPrimaryCurrency();
|
||||
$currencies = $this->getCurrencies($accounts);
|
||||
$currencies = $this->getCurrencies($accounts);
|
||||
|
||||
// balance(s) in all currencies for ALL accounts.
|
||||
$arrayOfSums = Transaction::query()
|
||||
->whereIn('account_id', $accounts->pluck('id')->toArray())
|
||||
->leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id')
|
||||
->leftJoin('transaction_currencies', 'transaction_currencies.id', '=', 'transactions.transaction_currency_id')
|
||||
->where('transaction_journals.date', $inclusive ? '<=' : '<', $date->format('Y-m-d H:i:s'))
|
||||
->whereNull('transaction_journals.deleted_at')
|
||||
->groupBy(['transactions.account_id', 'transaction_currencies.code'])
|
||||
->get(['transactions.account_id', 'transaction_currencies.code', DB::raw('SUM(transactions.amount) as sum_of_amount')])
|
||||
->toArray()
|
||||
;
|
||||
->whereIn('account_id', $accounts->pluck('id')->toArray())
|
||||
->leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id')
|
||||
->leftJoin('transaction_currencies', 'transaction_currencies.id', '=', 'transactions.transaction_currency_id')
|
||||
->where('transaction_journals.date', $inclusive ? '<=' : '<', $date->format('Y-m-d H:i:s'))
|
||||
->whereNull('transaction_journals.deleted_at')
|
||||
->groupBy(['transactions.account_id', 'transaction_currencies.code'])
|
||||
->get(['transactions.account_id', 'transaction_currencies.code', DB::raw('SUM(transactions.amount) as sum_of_amount')])
|
||||
->toArray();
|
||||
|
||||
// Log::debug('Array of sums: ', $arrayOfSums);
|
||||
|
||||
/** @var Account $account */
|
||||
foreach ($accounts as $account) {
|
||||
$return = ['pc_balance' => '0', 'balance' => '0']; // this key is overwritten right away, but I must remember it is always created.
|
||||
$currency = $currencies[$account->id];
|
||||
$return = ['pc_balance' => '0', 'balance' => '0']; // this key is overwritten right away, but I must remember it is always created.
|
||||
$currency = $currencies[$account->id];
|
||||
|
||||
// second array
|
||||
$accountSums = array_filter($arrayOfSums, static fn (array $entry): bool => $entry['account_id'] === $account->id);
|
||||
$accountSums = array_filter($arrayOfSums, static fn(array $entry): bool => $entry['account_id'] === $account->id);
|
||||
if (0 === count($accountSums)) {
|
||||
$result[$account->id] = $return;
|
||||
|
||||
continue;
|
||||
}
|
||||
$sumsByCode = [];
|
||||
$sumsByCode = [];
|
||||
foreach ($accountSums as $accountSum) {
|
||||
// $accountSum = array_values($accountSum)[0];
|
||||
$sumOfAmount = (string) $accountSum['sum_of_amount'];
|
||||
$sumOfAmount = (string)$accountSum['sum_of_amount'];
|
||||
$sumOfAmount = $this->floatalize('' === $sumOfAmount ? '0' : $sumOfAmount);
|
||||
$sumsByCode[$accountSum['code']] = $sumOfAmount;
|
||||
}
|
||||
// Log::debug('All balances are (joined)', $others);
|
||||
// if there is no request to convert, take this as "balance" and "pc_balance".
|
||||
$return['balance'] = $sumsByCode[$currency->code] ?? '0';
|
||||
$return['balance'] = $sumsByCode[$currency->code] ?? '0';
|
||||
if (!$convertToPrimary) {
|
||||
unset($return['pc_balance']);
|
||||
|
||||
@@ -132,7 +132,7 @@ class Steam
|
||||
}
|
||||
|
||||
// either way, the balance is always combined with the virtual balance:
|
||||
$virtualBalance = (string) ('' === (string) $account->virtual_balance ? '0' : $account->virtual_balance);
|
||||
$virtualBalance = (string)('' === (string)$account->virtual_balance ? '0' : $account->virtual_balance);
|
||||
|
||||
if ($convertToPrimary) {
|
||||
// the primary currency balance is combined with a converted virtual_balance:
|
||||
@@ -189,10 +189,10 @@ class Steam
|
||||
// Log::debug(sprintf('Trying bcround("%s",%d)', $number, $precision));
|
||||
if (str_contains($number, '.')) {
|
||||
if ('-' !== $number[0]) {
|
||||
return bcadd($number, '0.'.str_repeat('0', $precision).'5', $precision);
|
||||
return bcadd($number, '0.' . str_repeat('0', $precision) . '5', $precision);
|
||||
}
|
||||
|
||||
return bcsub($number, '0.'.str_repeat('0', $precision).'5', $precision);
|
||||
return bcsub($number, '0.' . str_repeat('0', $precision) . '5', $precision);
|
||||
}
|
||||
|
||||
return $number;
|
||||
@@ -334,15 +334,17 @@ class Steam
|
||||
"balance": balance in the account's currency OR user's primary currency if the account has no currency
|
||||
--> "pc_balance": balance in the user's primary currency, with all amounts converted to the primary currency.
|
||||
"EUR": balance in EUR (or whatever currencies the account has balance in)
|
||||
TXT)]
|
||||
TXT
|
||||
)]
|
||||
public function finalAccountBalance(
|
||||
Account $account,
|
||||
Carbon $date,
|
||||
Account $account,
|
||||
Carbon $date,
|
||||
?TransactionCurrency $primary = null,
|
||||
?bool $convertToPrimary = null,
|
||||
bool $inclusive = true
|
||||
): array {
|
||||
$cache = new CacheProperties();
|
||||
?bool $convertToPrimary = null,
|
||||
bool $inclusive = true
|
||||
): array
|
||||
{
|
||||
$cache = new CacheProperties();
|
||||
$cache->addProperty($account->id);
|
||||
$cache->addProperty($date);
|
||||
if ($cache->has()) {
|
||||
@@ -358,26 +360,25 @@ class Steam
|
||||
$primary = Amount::getPrimaryCurrencyByUserGroup($account->user->userGroup);
|
||||
}
|
||||
// account balance thing.
|
||||
$currencyPresent = property_exists($account, 'meta') && array_key_exists('currency', $account->meta) && null !== $account->meta['currency'];
|
||||
$currencyPresent = property_exists($account, 'meta') && array_key_exists('currency', $account->meta) && null !== $account->meta['currency'];
|
||||
if ($currencyPresent) {
|
||||
$accountCurrency = $account->meta['currency'];
|
||||
}
|
||||
if (!$currencyPresent) {
|
||||
$accountCurrency = $this->getAccountCurrency($account);
|
||||
}
|
||||
$hasCurrency = null !== $accountCurrency;
|
||||
$currency = $hasCurrency ? $accountCurrency : $primary;
|
||||
$return = ['pc_balance' => '0', 'balance' => '0']; // this key is overwritten right away, but I must remember it is always created.
|
||||
$hasCurrency = null !== $accountCurrency;
|
||||
$currency = $hasCurrency ? $accountCurrency : $primary;
|
||||
$return = ['pc_balance' => '0', 'balance' => '0']; // this key is overwritten right away, but I must remember it is always created.
|
||||
// balance(s) in all currencies.
|
||||
$array = $account
|
||||
$array = $account
|
||||
->transactions()
|
||||
->leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id')
|
||||
->leftJoin('transaction_currencies', 'transaction_currencies.id', '=', 'transactions.transaction_currency_id')
|
||||
->where('transaction_journals.date', $inclusive ? '<=' : '<', $date->format('Y-m-d H:i:s'))
|
||||
->get(['transaction_currencies.code', 'transactions.amount'])
|
||||
->toArray()
|
||||
;
|
||||
$others = $this->groupAndSumTransactions($array, 'code', 'amount');
|
||||
->toArray();
|
||||
$others = $this->groupAndSumTransactions($array, 'code', 'amount');
|
||||
Log::debug('All balances are (joined)', $others);
|
||||
// if there is no request to convert, take this as "balance" and "pc_balance".
|
||||
$return['balance'] = $others[$currency->code] ?? '0';
|
||||
@@ -394,7 +395,7 @@ class Steam
|
||||
}
|
||||
|
||||
// either way, the balance is always combined with the virtual balance:
|
||||
$virtualBalance = (string) ('' === (string) $account->virtual_balance ? '0' : $account->virtual_balance);
|
||||
$virtualBalance = (string)('' === (string)$account->virtual_balance ? '0' : $account->virtual_balance);
|
||||
|
||||
if ($convertToPrimary) {
|
||||
// the primary currency balance is combined with a converted virtual_balance:
|
||||
@@ -410,7 +411,7 @@ class Steam
|
||||
|
||||
// Log::debug(sprintf('Virtual balance makes the (primary currency) total %s', $return['balance']));
|
||||
}
|
||||
$final = array_merge($return, $others);
|
||||
$final = array_merge($return, $others);
|
||||
Log::debug('Final balance is', $final);
|
||||
$cache->store($final);
|
||||
|
||||
@@ -428,7 +429,7 @@ class Steam
|
||||
Log::debug(sprintf('called finalAccountBalanceInRange(#%d, %s, %s)', $account->id, $start->format('Y-m-d H:i:s'), $end->format('Y-m-d H:i:s')));
|
||||
|
||||
// set up cache
|
||||
$cache = new CacheProperties();
|
||||
$cache = new CacheProperties();
|
||||
$cache->addProperty($account->id);
|
||||
$cache->addProperty('final-balance-in-range');
|
||||
$cache->addProperty($start);
|
||||
@@ -440,15 +441,15 @@ class Steam
|
||||
return $cache->get();
|
||||
}
|
||||
|
||||
$balances = [];
|
||||
$formatted = $start->format('Y-m-d');
|
||||
$balances = [];
|
||||
$formatted = $start->format('Y-m-d');
|
||||
Log::debug('Get first balance to start.');
|
||||
// 2025-10-08 replaced finalAccountBalance with accountsBalancesOptimized:
|
||||
$primaryCurrency = Amount::getPrimaryCurrencyByUserGroup($account->user->userGroup);
|
||||
$startBalance = $this->accountsBalancesOptimized(new Collection()->push($account), $start, $primaryCurrency, $convertToPrimary, false)[$account->id];
|
||||
$accountCurrency = $this->getAccountCurrency($account);
|
||||
$hasCurrency = $accountCurrency instanceof TransactionCurrency;
|
||||
$currency = $accountCurrency ?? $primaryCurrency;
|
||||
$primaryCurrency = Amount::getPrimaryCurrencyByUserGroup($account->user->userGroup);
|
||||
$startBalance = $this->accountsBalancesOptimized(new Collection()->push($account), $start, $primaryCurrency, $convertToPrimary, false)[$account->id];
|
||||
$accountCurrency = $this->getAccountCurrency($account);
|
||||
$hasCurrency = $accountCurrency instanceof TransactionCurrency;
|
||||
$currency = $accountCurrency ?? $primaryCurrency;
|
||||
Log::debug(sprintf('Currency is %s', $currency->code));
|
||||
|
||||
// set start balances:
|
||||
@@ -460,14 +461,14 @@ class Steam
|
||||
Log::debug(sprintf('Also set start balance in %s', $primaryCurrency->code));
|
||||
$startBalance[$primaryCurrency->code] ??= '0';
|
||||
}
|
||||
$currencies = [$currency->id => $currency, $primaryCurrency->id => $primaryCurrency];
|
||||
$currencies = [$currency->id => $currency, $primaryCurrency->id => $primaryCurrency];
|
||||
|
||||
$balances[$formatted] = $startBalance;
|
||||
Log::debug('Final start balance: ', $startBalance);
|
||||
|
||||
// sums up the balance changes per day.
|
||||
Log::debug(sprintf('Date >= %s and <= %s', $start->format('Y-m-d H:i:s'), $end->format('Y-m-d H:i:s')));
|
||||
$set = $account
|
||||
$set = $account
|
||||
->transactions()
|
||||
->leftJoin('transaction_journals', 'transactions.transaction_journal_id', '=', 'transaction_journals.id')
|
||||
->where('transaction_journals.date', '>=', $start->format('Y-m-d H:i:s'))
|
||||
@@ -476,51 +477,50 @@ class Steam
|
||||
->groupBy('transactions.transaction_currency_id')
|
||||
->orderBy('transaction_journals.date', 'ASC')
|
||||
->whereNull('transaction_journals.deleted_at')
|
||||
->get(['transaction_journals.date', 'transactions.transaction_currency_id', DB::raw('SUM(transactions.amount) AS sum_of_day')])
|
||||
;
|
||||
->get(['transaction_journals.date', 'transactions.transaction_currency_id', DB::raw('SUM(transactions.amount) AS sum_of_day')]);
|
||||
|
||||
$currentBalance = $startBalance;
|
||||
$converter = new ExchangeRateConverter();
|
||||
$currentBalance = $startBalance;
|
||||
$converter = new ExchangeRateConverter();
|
||||
|
||||
/** @var Transaction $entry */
|
||||
foreach ($set as $entry) {
|
||||
// get date object
|
||||
$carbon = new Carbon($entry->date, $entry->date_tz);
|
||||
$carbonKey = $carbon->format('Y-m-d');
|
||||
$carbon = new Carbon($entry->date, $entry->date_tz);
|
||||
$carbonKey = $carbon->format('Y-m-d');
|
||||
// make sure sum is a string:
|
||||
$sumOfDay = (string) ($entry->sum_of_day ?? '0');
|
||||
$sumOfDay = (string)($entry->sum_of_day ?? '0');
|
||||
// #10426 make sure sum is not in scientific notation.
|
||||
$sumOfDay = $this->floatalize($sumOfDay);
|
||||
$sumOfDay = $this->floatalize($sumOfDay);
|
||||
|
||||
// find currency of this entry, does not have to exist.
|
||||
$currencies[$entry->transaction_currency_id] ??= Amount::getTransactionCurrencyById($entry->transaction_currency_id);
|
||||
|
||||
// make sure this $entry has its own $entryCurrency
|
||||
/** @var TransactionCurrency $entryCurrency */
|
||||
$entryCurrency = $currencies[$entry->transaction_currency_id];
|
||||
$entryCurrency = $currencies[$entry->transaction_currency_id];
|
||||
|
||||
Log::debug(sprintf('Processing transaction(s) on moment %s', $carbon->format('Y-m-d H:i:s')));
|
||||
|
||||
// add amount to current balance in currency code.
|
||||
$currentBalance[$entryCurrency->code] ??= '0';
|
||||
$currentBalance[$entryCurrency->code] = bcadd($sumOfDay, (string) $currentBalance[$entryCurrency->code]);
|
||||
$currentBalance[$entryCurrency->code] ??= '0';
|
||||
$currentBalance[$entryCurrency->code] = bcadd($sumOfDay, (string)$currentBalance[$entryCurrency->code]);
|
||||
|
||||
// if not requested to convert to primary currency, add the amount to "balance", do nothing else.
|
||||
if (!$convertToPrimary) {
|
||||
$currentBalance['balance'] = bcadd((string) $currentBalance['balance'], $sumOfDay);
|
||||
$currentBalance['balance'] = bcadd((string)$currentBalance['balance'], $sumOfDay);
|
||||
}
|
||||
// if convert to primary currency add the converted amount to "pc_balance".
|
||||
// if there is a request to convert, convert to "pc_balance" and use "balance" for whichever amount is in the primary currency.
|
||||
if ($convertToPrimary) {
|
||||
$pcSumOfDay = $converter->convert($entryCurrency, $primaryCurrency, $carbon, $sumOfDay);
|
||||
$currentBalance['pc_balance'] = bcadd((string) ($currentBalance['pc_balance'] ?? '0'), $pcSumOfDay);
|
||||
$currentBalance['pc_balance'] = bcadd((string)($currentBalance['pc_balance'] ?? '0'), $pcSumOfDay);
|
||||
// if it's the same currency as the entry, also add to balance (see other code).
|
||||
if ($currency->id === $entryCurrency->id) {
|
||||
$currentBalance['balance'] = bcadd((string) $currentBalance['balance'], $sumOfDay);
|
||||
$currentBalance['balance'] = bcadd((string)$currentBalance['balance'], $sumOfDay);
|
||||
}
|
||||
}
|
||||
// add to final array.
|
||||
$balances[$carbonKey] = $currentBalance;
|
||||
$balances[$carbonKey] = $currentBalance;
|
||||
Log::debug(sprintf('Updated entry [%s]', $carbonKey), $currentBalance);
|
||||
}
|
||||
$cache->store($balances);
|
||||
@@ -537,32 +537,32 @@ class Steam
|
||||
*/
|
||||
public function floatalize(string $value): string
|
||||
{
|
||||
$value = strtoupper($value);
|
||||
$value = strtoupper($value);
|
||||
if (!str_contains($value, 'E')) {
|
||||
return $value;
|
||||
}
|
||||
Log::debug(sprintf('Floatalizing %s', $value));
|
||||
|
||||
$number = substr($value, 0, (int) strpos($value, 'E'));
|
||||
$number = substr($value, 0, (int)strpos($value, 'E'));
|
||||
if (str_contains($number, '.')) {
|
||||
$post = strlen(substr($number, (int) strpos($number, '.') + 1));
|
||||
$mantis = substr($value, (int) strpos($value, 'E') + 1);
|
||||
$post = strlen(substr($number, (int)strpos($number, '.') + 1));
|
||||
$mantis = substr($value, (int)strpos($value, 'E') + 1);
|
||||
if ($mantis < 0) {
|
||||
$post += abs((int) $mantis);
|
||||
$post += abs((int)$mantis);
|
||||
}
|
||||
|
||||
// TODO careless float could break financial math.
|
||||
return number_format((float) $value, $post, '.', '');
|
||||
return number_format((float)$value, $post, '.', '');
|
||||
}
|
||||
|
||||
// TODO careless float could break financial math.
|
||||
return number_format((float) $value, 0, '.', '');
|
||||
return number_format((float)$value, 0, '.', '');
|
||||
}
|
||||
|
||||
public function getAccountCurrency(Account $account): ?TransactionCurrency
|
||||
{
|
||||
$type = $account->accountType->type;
|
||||
$list = config('firefly.valid_currency_account_types');
|
||||
$type = $account->accountType->type;
|
||||
$list = config('firefly.valid_currency_account_types');
|
||||
|
||||
// return null if not in this list.
|
||||
if (!in_array($type, $list, true)) {
|
||||
@@ -573,7 +573,7 @@ class Steam
|
||||
return null;
|
||||
}
|
||||
|
||||
return Amount::getTransactionCurrencyById((int) $result->data);
|
||||
return Amount::getTransactionCurrencyById((int)$result->data);
|
||||
}
|
||||
|
||||
public function getHostName(string $ipAddress): string
|
||||
@@ -587,11 +587,11 @@ class Steam
|
||||
$hostName = $ipAddress;
|
||||
}
|
||||
|
||||
if ('' !== (string) $hostName && $hostName !== $ipAddress) {
|
||||
if ('' !== (string)$hostName && $hostName !== $ipAddress) {
|
||||
$host = $hostName;
|
||||
}
|
||||
|
||||
return (string) $host;
|
||||
return (string)$host;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -615,19 +615,18 @@ class Steam
|
||||
{
|
||||
$list = [];
|
||||
|
||||
$set = auth()
|
||||
$set = auth()
|
||||
->user()
|
||||
->transactions()
|
||||
->whereIn('transactions.account_id', $accounts)
|
||||
->groupBy(['transactions.account_id', 'transaction_journals.user_id'])
|
||||
->get(['transactions.account_id', DB::raw('MAX(transaction_journals.date) AS max_date')])
|
||||
;
|
||||
->get(['transactions.account_id', DB::raw('MAX(transaction_journals.date) AS max_date')]);
|
||||
|
||||
/** @var Transaction $entry */
|
||||
foreach ($set as $entry) {
|
||||
$date = new Carbon($entry->max_date, config('app.timezone'));
|
||||
$date = new Carbon($entry->max_date, config('app.timezone'));
|
||||
$date->setTimezone(config('app.timezone'));
|
||||
$list[(int) $entry->account_id] = $date;
|
||||
$list[(int)$entry->account_id] = $date;
|
||||
}
|
||||
|
||||
return $list;
|
||||
@@ -643,14 +642,14 @@ class Steam
|
||||
if (null !== $cached) {
|
||||
return $cached;
|
||||
}
|
||||
$locale = Preferences::get('locale', config('firefly.default_locale', 'equal'))->data;
|
||||
$locale = Preferences::get('locale', config('firefly.default_locale', 'equal'))->data;
|
||||
if (is_array($locale)) {
|
||||
$locale = 'equal';
|
||||
}
|
||||
if ('equal' === $locale) {
|
||||
$locale = $this->getLanguage();
|
||||
}
|
||||
$locale = (string) $locale;
|
||||
$locale = (string)$locale;
|
||||
|
||||
// Check for Windows to replace the locale correctly.
|
||||
if ('WIN' === strtoupper(substr(PHP_OS, 0, 3))) {
|
||||
@@ -690,7 +689,7 @@ class Steam
|
||||
public function getSafeUrl(string $unknownUrl, string $safeUrl): string
|
||||
{
|
||||
// Log::debug(sprintf('getSafeUrl(%s, %s)', $unknownUrl, $safeUrl));
|
||||
$returnUrl = $safeUrl;
|
||||
$returnUrl = $safeUrl;
|
||||
|
||||
// die('in get safe url');
|
||||
try {
|
||||
@@ -753,24 +752,24 @@ class Steam
|
||||
// has a K in it, remove the K and multiply by 1024.
|
||||
$bytes = bcmul(rtrim($string, 'k'), '1024');
|
||||
|
||||
return (int) $bytes;
|
||||
return (int)$bytes;
|
||||
}
|
||||
|
||||
if (false !== stripos($string, 'm')) {
|
||||
// has a M in it, remove the M and multiply by 1048576.
|
||||
$bytes = bcmul(rtrim($string, 'm'), '1048576');
|
||||
|
||||
return (int) $bytes;
|
||||
return (int)$bytes;
|
||||
}
|
||||
|
||||
if (false !== stripos($string, 'g')) {
|
||||
// has a G in it, remove the G and multiply by (1024)^3.
|
||||
$bytes = bcmul(rtrim($string, 'g'), '1073741824');
|
||||
|
||||
return (int) $bytes;
|
||||
return (int)$bytes;
|
||||
}
|
||||
|
||||
return (int) $string;
|
||||
return (int)$string;
|
||||
}
|
||||
|
||||
public function positive(string $amount): string
|
||||
@@ -809,12 +808,12 @@ class Steam
|
||||
if (null === $preference) {
|
||||
$singleton->setPreference($key, $currency);
|
||||
}
|
||||
$current = $amount;
|
||||
$current = $amount;
|
||||
if ($currency->id !== $primary->id) {
|
||||
$current = $converter->convert($currency, $primary, $date, $amount);
|
||||
Log::debug(sprintf('Convert %s %s to %s %s', $currency->code, $amount, $primary->code, $current));
|
||||
}
|
||||
$total = bcadd((string) $current, $total);
|
||||
$total = bcadd((string)$current, $total);
|
||||
}
|
||||
|
||||
return $total;
|
||||
@@ -828,18 +827,18 @@ class Steam
|
||||
$primary = Amount::getPrimaryCurrency();
|
||||
$currencies[$primary->id] = $primary;
|
||||
|
||||
$ids = $accounts->pluck('id')->toArray();
|
||||
$result = AccountMeta::query()->whereIn('account_id', $ids)->where('name', 'currency_id')->get();
|
||||
$ids = $accounts->pluck('id')->toArray();
|
||||
$result = AccountMeta::query()->whereIn('account_id', $ids)->where('name', 'currency_id')->get();
|
||||
|
||||
/** @var AccountMeta $item */
|
||||
foreach ($result as $item) {
|
||||
$integer = (int) $item->data;
|
||||
$integer = (int)$item->data;
|
||||
if (0 !== $integer) {
|
||||
$accountPreferences[(int) $item->account_id] = $integer;
|
||||
$accountPreferences[(int)$item->account_id] = $integer;
|
||||
}
|
||||
}
|
||||
// collect those currencies, skip primary because we already have it.
|
||||
$set = TransactionCurrency::query()->whereIn('id', $accountPreferences)->where('id', '!=', $primary->id)->get();
|
||||
$set = TransactionCurrency::query()->whereIn('id', $accountPreferences)->where('id', '!=', $primary->id)->get();
|
||||
foreach ($set as $item) {
|
||||
$currencies[$item->id] = $item;
|
||||
}
|
||||
@@ -850,7 +849,7 @@ class Steam
|
||||
$currencyPresent = property_exists($account, 'meta') && array_key_exists('currency', $account->meta) && null !== $account->meta['currency'];
|
||||
if ($currencyPresent) {
|
||||
$currencyId = $account->meta['currency']->id;
|
||||
$currencies[$currencyId] ??= $account->meta['currency'];
|
||||
$currencies[$currencyId] ??= $account->meta['currency'];
|
||||
$accountCurrencies[$accountId] = $account->meta['currency'];
|
||||
}
|
||||
if (!$currencyPresent && !array_key_exists($accountId, $accountPreferences)) {
|
||||
@@ -870,7 +869,7 @@ class Steam
|
||||
|
||||
foreach ($array as $item) {
|
||||
$groupKey = $item[$group] ?? 'unknown';
|
||||
$return[$groupKey] = bcadd($return[$groupKey] ?? '0', (string) $item[$field]);
|
||||
$return[$groupKey] = bcadd($return[$groupKey] ?? '0', (string)$item[$field]);
|
||||
}
|
||||
|
||||
return $return;
|
||||
@@ -902,4 +901,19 @@ class Steam
|
||||
|
||||
return Amount::formatAnything($currency, $amount, $coloured);
|
||||
}
|
||||
|
||||
public function formatAmountByCode(string $amount, string $code, ?bool $coloured = null): string
|
||||
{
|
||||
$coloured ??= true;
|
||||
|
||||
try {
|
||||
$currency = Amount::getTransactionCurrencyByCode($code);
|
||||
} catch (FireflyException) {
|
||||
Log::error(sprintf('Could not find currency with code "%s". Fallback to primary currency.', $code));
|
||||
$currency = Amount::getPrimaryCurrency();
|
||||
Log::error(sprintf('Fallback currency is "%s".', $currency->code));
|
||||
}
|
||||
|
||||
return Amount::formatAnything($currency, $amount, $coloured);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,14 +10,15 @@ use Illuminate\View\Component;
|
||||
|
||||
class Accounts extends Component
|
||||
{
|
||||
public LengthAwarePaginator|null $accounts = null;
|
||||
public LengthAwarePaginator $accounts;
|
||||
public string $objectType = '';
|
||||
/**
|
||||
* Create a new component instance.
|
||||
*/
|
||||
public function __construct()
|
||||
public function __construct(LengthAwarePaginator $accounts, string $objectType)
|
||||
{
|
||||
//
|
||||
$this->accounts = $accounts;
|
||||
$this->objectType = $objectType;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -27,4 +28,6 @@ class Accounts extends Component
|
||||
{
|
||||
return view('components.lists.accounts');
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -4,56 +4,59 @@
|
||||
<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 class="card-header">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div class="card-title">{{ trans('firefly.asset_accounts') }}</div>
|
||||
</div>
|
||||
<div class="col text-end">
|
||||
<div class="dropdown">
|
||||
<button class="btn btn-sm btn-secondary dropdown-toggle" type="button" id="dropdownMenuButton1" data-bs-toggle="dropdown" aria-expanded="false">
|
||||
<span class="bi bi-list"></span>
|
||||
</button>
|
||||
<ul class="dropdown-menu" aria-labelledby="dropdownMenuButton1">
|
||||
<li><a class="dropdown-item" href="{{ route('accounts.create', $objectType) }}"><span
|
||||
class="bi bi-plus-circle"></span> {{ __('firefly.make_new_'. $objectType . '_account') }}
|
||||
</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="card-body no-padding">
|
||||
<p>
|
||||
<div class="card-body p-0">
|
||||
<p class="m-2">
|
||||
<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>
|
||||
<div class="card-footer p-0">
|
||||
<p class="m-2">
|
||||
<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>
|
||||
@if($inactiveCount > 0)
|
||||
<p class="m-2"><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 class="m-2""><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>
|
||||
@endif
|
||||
|
||||
@@ -10,14 +10,14 @@
|
||||
<!-- <li class="nav-item menu-open"> -->
|
||||
<!-- <a href="route('index')" class="nav-link active"> -->
|
||||
<li class="nav-item">
|
||||
<a href="{{ route('index') }}" class="nav-link @menuItemActive('index')">
|
||||
<a href="{{ route('index') }}" class="nav-link {{ \FireflyIII\Support\Blade\Navigation::menuItemActive('index') }}">
|
||||
<em class="nav-icon bi bi-speedometer"></em>
|
||||
<p>{{ __('firefly.dashboard') }}</p>
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-header text-uppercase">{{ __('firefly.financial_control') }}</li>
|
||||
<li class="nav-item">
|
||||
<a href="{{ route('budgets.index') }}" class="nav-link @menuItemActive('budgets')">
|
||||
<a href="{{ route('budgets.index') }}" class="nav-link {{ \FireflyIII\Support\Blade\Navigation::menuItemActivePartial('budgets.') }}">
|
||||
<em class="nav-icon bi bi-pie-chart"></em>
|
||||
<p>
|
||||
{{ __('firefly.budgets') }}
|
||||
@@ -25,7 +25,7 @@
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a href="{{ route('subscriptions.index') }}" class="nav-link @menuItemActive('subscriptions')">
|
||||
<a href="{{ route('subscriptions.index') }}" class="nav-link {{ \FireflyIII\Support\Blade\Navigation::menuItemActivePartial('subscriptions.') }}">
|
||||
<em class="nav-icon bi bi-calendar"></em>
|
||||
<p>
|
||||
{{ __('firefly.subscriptions') }}
|
||||
@@ -33,7 +33,7 @@
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a href="{{ route('piggy-banks.index') }}" class="nav-link @menuItemActive('piggy-banks')">
|
||||
<a href="{{ route('piggy-banks.index') }}" class="nav-link {{ \FireflyIII\Support\Blade\Navigation::menuItemActivePartial('piggy-banks.') }}">
|
||||
<em class="nav-icon bi bi-bullseye"></em>
|
||||
<p>
|
||||
{{ __('firefly.piggyBanks') }}
|
||||
@@ -42,7 +42,7 @@
|
||||
</li>
|
||||
<li class="nav-header text-uppercase">{{ __('firefly.accounting') }}</li>
|
||||
|
||||
<li class="nav-item">
|
||||
<li class="nav-item {{ \FireflyIII\Support\Blade\Navigation::menuOpenPartial('transactions.') }}">
|
||||
<a href="#" class="nav-link">
|
||||
<em class="nav-icon bi bi-wallet"></em>
|
||||
<p>
|
||||
@@ -77,7 +77,7 @@
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<li class="nav-item {{ \FireflyIII\Support\Blade\Navigation::menuOpenPartial('rules.') }} {{ \FireflyIII\Support\Blade\Navigation::menuOpenPartial('recurring.') }}">
|
||||
<a href="#" class="nav-link">
|
||||
<em class="nav-icon bi bi-cpu"></em>
|
||||
<p>
|
||||
@@ -117,7 +117,7 @@
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-header text-uppercase">{{ __('firefly.organization') }}</li>
|
||||
<li class="nav-item">
|
||||
<li class="nav-item {{ \FireflyIII\Support\Blade\Navigation::menuOpenPartial('accounts.') }}">
|
||||
<a href="#" class="nav-link">
|
||||
<em class="nav-icon bi bi-credit-card"></em>
|
||||
<p>
|
||||
@@ -127,7 +127,7 @@
|
||||
</a>
|
||||
<ul class="nav nav-treeview">
|
||||
<li class="nav-item">
|
||||
<a href="{{ route('accounts.index', ['asset']) }}" class="nav-link">
|
||||
<a href="{{ route('accounts.index', ['asset']) }}" class="nav-link {{ \FireflyIII\Support\Blade\Navigation::menuSubItemActive('accounts.index','asset') }}">
|
||||
<em class="nav-icon bi bi-cash"></em>
|
||||
<p>{{ __('firefly.asset_accounts') }}</p>
|
||||
</a>
|
||||
@@ -153,7 +153,7 @@
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
<li class="nav-item">
|
||||
<li class="nav-item {{ \FireflyIII\Support\Blade\Navigation::menuOpenPartial('categories.') }} {{ \FireflyIII\Support\Blade\Navigation::menuOpenPartial('tags.') }} {{ \FireflyIII\Support\Blade\Navigation::menuOpenPartial('object-groups.') }}">
|
||||
<a href="#" class="nav-link">
|
||||
<em class="nav-icon bi bi-tags"></em>
|
||||
<p>
|
||||
@@ -185,25 +185,25 @@
|
||||
|
||||
|
||||
<li class="nav-header text-uppercase">{{ __('firefly.others') }}</li>
|
||||
<li class="nav-item">
|
||||
<li class="nav-item {{ \FireflyIII\Support\Blade\Navigation::menuItemActivePartial('currencies.') }}">
|
||||
<a href="{{ route('currencies.index') }}" class="nav-link">
|
||||
<em class="nav-icon bi bi-currency-euro"></em>
|
||||
<p>{{ __('firefly.currencies') }}</p>
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<li class="nav-item {{ \FireflyIII\Support\Blade\Navigation::menuItemActivePartial('exchange-rates.') }}">
|
||||
<a href="{{ route('exchange-rates.index') }}" class="nav-link">
|
||||
<em class="nav-icon bi bi-currency-exchange"></em>
|
||||
<p>{{ __('firefly.menu_exchange_rates_index') }}</p>
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<li class="nav-item {{ \FireflyIII\Support\Blade\Navigation::menuItemActivePartial('reports.') }}">
|
||||
<a href="{{ route('reports.index') }}" class="nav-link">
|
||||
<em class="nav-icon bi bi-bar-chart"></em>
|
||||
<p>{{ __('firefly.reports') }}</p>
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<li class="nav-item {{ \FireflyIII\Support\Blade\Navigation::menuItemActivePartial('export.') }}">
|
||||
<a href="{{ route('export.index') }}" class="nav-link">
|
||||
<em class="nav-icon bi bi-upload"></em>
|
||||
<p>{{ __('firefly.export_data_menu') }}</p>
|
||||
|
||||
@@ -5,24 +5,24 @@
|
||||
<div class="dropdown-menu dropdown-menu-lg dropdown-menu-end">
|
||||
<span class="dropdown-item dropdown-header">{{ Auth::user()->email }}</span>
|
||||
<div class="dropdown-divider"></div>
|
||||
<a href="#" class="dropdown-item">
|
||||
<i class="bi bi-envelope me-2"></i> Profile
|
||||
<a href="{{ route('profile.index') }}" class="dropdown-item">
|
||||
<em class="bi bi-person me-2"></em> {{ __('firefly.profile') }}
|
||||
</a>
|
||||
<div class="dropdown-divider"></div>
|
||||
<a href="#" class="dropdown-item">
|
||||
<i class="bi bi-people-fill me-2"></i> Preferences
|
||||
<a href="{{ route('preferences.index') }}" class="dropdown-item">
|
||||
<em class="bi bi-gear-wide-connected me-2"></em> {{ __('firefly.preferences') }}
|
||||
</a>
|
||||
<div class="dropdown-divider"></div>
|
||||
<a href="#" class="dropdown-item">
|
||||
<i class="bi bi-file-earmark-fill me-2"></i> Tokens
|
||||
<a href="{{ route('profile.oauth.index') }}" class="dropdown-item">
|
||||
<em class="bi bi-shield-lock me-2"></em> {{ __('firefly.oauth_tokens') }}
|
||||
</a>
|
||||
<div class="dropdown-divider"></div>
|
||||
<a href="#" class="dropdown-item">
|
||||
<i class="bi bi-file-earmark-fill me-2"></i> Financial administrations
|
||||
<a href="{{ route('administrations.index') }}" class="dropdown-item">
|
||||
<em class="bi bi-journals me-2"></em> {{ __('firefly.administrations_index_menu') }}
|
||||
</a>
|
||||
<div class="dropdown-divider"></div>
|
||||
<a href="#" class="dropdown-item">
|
||||
<i class="bi bi-file-earmark-fill me-2"></i> System settings
|
||||
<a href="{{ route('settings.index') }}" class="dropdown-item">
|
||||
<em class="bi bi-cpu me-2"></em> {{ __('firefly.system_settings') }}
|
||||
</a>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<div class="ml-1">
|
||||
<div class="m-2">
|
||||
{{ $accounts->links('pagination.bootstrap-4') }}
|
||||
</div>
|
||||
<table class="table table-responsive table-hover" id="sortable-table">
|
||||
@@ -38,111 +38,113 @@
|
||||
@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>
|
||||
<span class="bi bi-list 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 %}
|
||||
@if($account->location)
|
||||
<span class="bi bi-map"></span>
|
||||
@endif
|
||||
@if($account->attachments->count() > 0)
|
||||
<span class="bi bi-paperclip"></span>
|
||||
@endif
|
||||
</td>
|
||||
{% if objectType == "asset" %}
|
||||
@if('asset' === $objectType)
|
||||
<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 %}
|
||||
@foreach($account->accountMeta as $entry)
|
||||
@if('account_role' === $entry->name)
|
||||
{{ __('firefly.account_role_'.$entry['data']) }}
|
||||
@endif
|
||||
@endforeach
|
||||
</td>
|
||||
{% endif %}
|
||||
{% if objectType == 'liabilities' %}
|
||||
@endif
|
||||
@if('liabilities' === $objectType)
|
||||
<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' %}
|
||||
@endif
|
||||
<td class="hidden-sm hidden-xs">{{ $account->iban }} @if('' === $account->iban) {{ bladeAccountGetMetaField($account, 'account_number') }}@endif</td>
|
||||
@if('liabilities' !== $objectType)
|
||||
<td class="text-right">
|
||||
<span class="mr-2">
|
||||
{% for key, balance in account.endBalances %}
|
||||
@foreach($account->endBalances as $key => $balance)
|
||||
<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 %}
|
||||
@if('balance' === $key)
|
||||
@if(!$convertToPrimary)
|
||||
{!! \FireflyIII\Support\Facades\Steam::formatAmountBySymbol($balance, $account->currency->symbol, $account->currency->decimal_places) !!}
|
||||
@endif
|
||||
@elseif('pc_balance' === $key)
|
||||
@if($convertToPrimary)
|
||||
{!! \FireflyIII\Support\Facades\Steam::formatAmountBySymbol($balance, $primaryCurrency->symbol, $primaryCurrency->decimal_places) !!}
|
||||
@endif
|
||||
@else
|
||||
({!! \FireflyIII\Support\Facades\Steam::formatAmountByCode($balance, $key) !!})
|
||||
@endif
|
||||
</span>
|
||||
{% endfor %}
|
||||
@endforeach
|
||||
</span>
|
||||
</td>
|
||||
{% endif %}
|
||||
{% if objectType == 'liabilities' %}
|
||||
@endif
|
||||
@if('liabilities' === $objectType)
|
||||
<td class="text-right">
|
||||
{% if '-' != account.current_debt %}
|
||||
@if('' !== $account->current_debt)
|
||||
<span class="text-info money-transfer">
|
||||
{{ formatAmountBySymbol($account->current_debt, $account->currency->symbol, $account->currency->decimal_places, false) }}
|
||||
{!! \FireflyIII\Support\Facades\Steam::formatAmountBySymbol($account->current_debt, $account->currency->symbol, $account->currency->decimal_places, false) !!}
|
||||
</span>
|
||||
{% endif %}
|
||||
@endif
|
||||
</td>
|
||||
{% endif %}
|
||||
@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 %}
|
||||
@if($account->active)
|
||||
<span class="bi bi-check"></span>
|
||||
@endif
|
||||
@if(!$account->active)
|
||||
<span class="bi bi-ban"></span>
|
||||
@endif
|
||||
</td>
|
||||
{# hide last activity to make room for other stuff #}
|
||||
{% if objectType != 'liabilities' %}
|
||||
{% if account.lastActivityDate %}
|
||||
{{-- hide last activity to make room for other stuff --}}
|
||||
@if('liabilities' !== $objectType)
|
||||
@if($account->lastActivityDate)
|
||||
<td class="hidden-sm hidden-xs hidden-md">
|
||||
<!-- {{ $account->lastActivityDate }} -->
|
||||
{{ $account->lastActivityDate->isoFormat($monthAndDayFormat) }}
|
||||
{{ $account->lastActivityDate?->isoFormat($monthAndDayFormat) }}
|
||||
</td>
|
||||
{% else %}
|
||||
@else
|
||||
<td class="hidden-sm hidden-xs hidden-md">
|
||||
<em>{{ 'never'|_ }}</em>
|
||||
<em>{{ __('firefly.never') }}</em>
|
||||
</td>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
@endif
|
||||
@endif
|
||||
<td class="text-right hidden-sm hidden-xs hidden-md">
|
||||
<span class="mr-1">
|
||||
{% for key, balance in account.differences %}
|
||||
@foreach($account->differences as $key => $balance)
|
||||
<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 %}
|
||||
@if('balance' === $key)
|
||||
@if(!$convertToPrimary)
|
||||
{!! \FireflyIII\Support\Facades\Steam::formatAmountBySymbol($balance, $account->currency->symbol, $account->currency->decimal_places) !!}
|
||||
@endif
|
||||
@elseif('pc_balance' === $key)
|
||||
@if($convertToPrimary)
|
||||
{!! \FireflyIII\Support\Facades\Steam::formatAmountBySymbol($balance, $primaryCurrency->symbol, $primaryCurrency->decimal_places) !!}
|
||||
@endif
|
||||
@else
|
||||
({!! \FireflyIII\Support\Facades\Steam::formatAmountByCode($balance, $key) !!})
|
||||
@endif
|
||||
</span>
|
||||
{% endfor %}
|
||||
@endforeach
|
||||
</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 %}
|
||||
<td class="hidden-sm hidden-xs justify-content-end">
|
||||
<div class="dropdown">
|
||||
<button class="btn btn-secondary btn-sm dropdown-toggle" type="button" id="action_menu_{{$account->id}}" data-bs-toggle="dropdown" aria-expanded="false">
|
||||
{{ __('firefly.actions') }}
|
||||
</button>
|
||||
<ul class="dropdown-menu" aria-labelledby="action_menu_{{$account->id}}">
|
||||
<li><a class="dropdown-item" href="{{ route('accounts.edit',$account->id) }}"><span class="bi bi-pencil"></span> {{ __('firefly.edit') }}</a></li>
|
||||
<li><a class="dropdown-item" href="{{ route('accounts.delete',$account->id) }}"><span class="bi bi-trash"></span> {{ __('firefly.delete') }}</a></li>
|
||||
@if('asset' === $objectType)
|
||||
<li><a class="dropdown-item" href="{{ route('accounts.reconcile',$account->id) }}"><span class="bi bi-check"></span> {{ __('firefly.reconcile_this_account') }}</a></li>
|
||||
@endif
|
||||
</ul>
|
||||
</div>
|
||||
</td>
|
||||
@@ -151,6 +153,6 @@
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="pl-3">
|
||||
<div class="m-2">
|
||||
{{ $accounts->links('pagination.bootstrap-4')}}
|
||||
</div>
|
||||
|
||||
@@ -7,9 +7,9 @@
|
||||
<div class="row" x-data="index">
|
||||
<div class="col-lg-8 col-md-12 col-sm-12">
|
||||
<!--ACCOUNTS -->
|
||||
<div class="card card-primary mb-4">
|
||||
<div class="card-header with-border">
|
||||
<div class="card-title"><a href="{{ route('accounts.index',['asset']) }}" title="{{ __('firefly.yourAccounts') }}">{{ __('firefly.yourAccounts') }}</a></div>
|
||||
<div class="card card-primary card-outline mb-4">
|
||||
<div class="card-header">
|
||||
<div class="card-title"><a href="{{ route('accounts.index',['asset']) }}" title="{{ __('firefly.yourAccounts') }}">{{ __('firefly.yourAccounts') }}</a></div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<canvas id="accounts-chart" class="wide-chart" height="400" width="100%"></canvas>
|
||||
@@ -21,7 +21,7 @@
|
||||
|
||||
<!--BUDGETS -->
|
||||
<div class="card card-outline mb-4">
|
||||
<div class="card-header with-border">
|
||||
<div class="card-header ">
|
||||
<div class="card-title"><a href="{{ route('budgets.index') }}"
|
||||
title="{{ __('firefly.budgetsAndSpending') }}">{{ __('firefly.budgetsAndSpending') }}</a></div>
|
||||
</div>
|
||||
@@ -37,7 +37,7 @@
|
||||
</div>
|
||||
<!--CATEGORIES -->
|
||||
<div class="card card-outline mb-4">
|
||||
<div class="card-header with-border">
|
||||
<div class="card-header">
|
||||
<div class="card-title"><a href="{{ route('categories.index') }}"
|
||||
title="{{ __('firefly.categories') }}">{{ __('firefly.categories') }}</a></div>
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
<div id="all_transactions">
|
||||
@foreach($transactions as $data)
|
||||
<div class="card mb-4">
|
||||
<div class="card-header with-border">
|
||||
<div class="card-header">
|
||||
<div class="card-title"><a href="{{ route('accounts.show', [$data['account']['id']]) }}">{{ $data['account']['name'] }}</a>
|
||||
</div>
|
||||
</div>
|
||||
@@ -123,7 +123,7 @@
|
||||
@if($billCount > 0)
|
||||
<!--BILLS -->
|
||||
<div class="card mb-4">
|
||||
<div class="card-header with-border">
|
||||
<div class="card-header">
|
||||
<div class="card-title"><a href="{{ route('subscriptions.index') }}" title="{{ __('firefly.bills') }}">{{ __('firefly.bills') }}</a></div>
|
||||
|
||||
</div>
|
||||
@@ -149,7 +149,7 @@
|
||||
<div class="col-lg-12 col-md-12 col-sm-12">
|
||||
<!--EXPENSE ACCOUNTS -->
|
||||
<div class="card mb-4">
|
||||
<div class="card-header with-border">
|
||||
<div class="card-header">
|
||||
<div class="card-title"><a href="{{ route('accounts.index',['expense']) }}" title="{{ __('firefly.expense_accounts') }}">{{ __('firefly.expense_accounts') }}</a>
|
||||
</div>
|
||||
</div>
|
||||
@@ -164,7 +164,7 @@
|
||||
</div>
|
||||
<!--OPTIONAL REVENUE ACCOUNTS -->
|
||||
<div class="card mb-4">
|
||||
<div class="card-header with-border">
|
||||
<div class="card-header">
|
||||
<div class="card-title"><a href="{{ route('accounts.index',['revenue']) }}"
|
||||
title="{{ __('firefly.revenue_accounts') }}">{{ __('firefly.revenue_accounts') }}</a></div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user