Autoformat lol

This commit is contained in:
James Cole
2026-01-23 15:09:50 +01:00
parent ae1347c550
commit 8f15a32bd6
1071 changed files with 21111 additions and 21687 deletions

View File

@@ -23,7 +23,6 @@ declare(strict_types=1);
namespace FireflyIII\Http\Controllers;
use FireflyIII\Support\Facades\Preferences;
use Carbon\Carbon;
use FireflyIII\Enums\AccountTypeEnum;
use FireflyIII\Exceptions\FireflyException;
@@ -31,13 +30,14 @@ use FireflyIII\Models\Account;
use FireflyIII\Models\TransactionCurrency;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
use FireflyIII\Support\Facades\Amount;
use FireflyIII\Support\Facades\Preferences;
use FireflyIII\Support\Facades\Steam;
use FireflyIII\Support\Http\Controllers\GetConfigurationData;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;
use FireflyIII\Support\Facades\Amount;
/**
* Class JavascriptController.
@@ -51,24 +51,26 @@ class JavascriptController extends Controller
*/
public function accounts(AccountRepositoryInterface $repository): Response
{
$accounts = $repository->getAccountsByType(
[AccountTypeEnum::DEFAULT->value, AccountTypeEnum::ASSET->value, AccountTypeEnum::DEBT->value, AccountTypeEnum::LOAN->value, AccountTypeEnum::MORTGAGE->value, AccountTypeEnum::CREDITCARD->value]
);
$data = ['accounts' => []];
$accounts = $repository->getAccountsByType([
AccountTypeEnum::DEFAULT->value,
AccountTypeEnum::ASSET->value,
AccountTypeEnum::DEBT->value,
AccountTypeEnum::LOAN->value,
AccountTypeEnum::MORTGAGE->value,
AccountTypeEnum::CREDITCARD->value
]);
$data = ['accounts' => []];
/** @var Account $account */
foreach ($accounts as $account) {
$accountId = $account->id;
$currency = (int) $repository->getMetaValue($account, 'currency_id');
$currency = 0 === $currency ? $this->primaryCurrency->id : $currency;
$entry = ['preferredCurrency' => $currency, 'name' => $account->name];
$accountId = $account->id;
$currency = (int) $repository->getMetaValue($account, 'currency_id');
$currency = 0 === $currency ? $this->primaryCurrency->id : $currency;
$entry = ['preferredCurrency' => $currency, 'name' => $account->name];
$data['accounts'][$accountId] = $entry;
}
return response()
->view('javascript.accounts', $data)
->header('Content-Type', 'text/javascript')
;
return response()->view('javascript.accounts', $data)->header('Content-Type', 'text/javascript');
}
/**
@@ -77,19 +79,16 @@ class JavascriptController extends Controller
public function currencies(CurrencyRepositoryInterface $repository): Response
{
$currencies = $repository->get();
$data = ['currencies' => []];
$data = ['currencies' => []];
/** @var TransactionCurrency $currency */
foreach ($currencies as $currency) {
$currencyId = $currency->id;
$entry = ['name' => $currency->name, 'code' => $currency->code, 'symbol' => $currency->symbol];
$currencyId = $currency->id;
$entry = ['name' => $currency->name, 'code' => $currency->code, 'symbol' => $currency->symbol];
$data['currencies'][$currencyId] = $entry;
}
return response()
->view('javascript.currencies', $data)
->header('Content-Type', 'text/javascript')
;
return response()->view('javascript.currencies', $data)->header('Content-Type', 'text/javascript');
}
/**
@@ -101,19 +100,19 @@ class JavascriptController extends Controller
*/
public function variables(Request $request, AccountRepositoryInterface $repository): Response
{
$account = $repository->find((int) $request->get('account'));
$currency = $this->primaryCurrency;
$account = $repository->find((int) $request->get('account'));
$currency = $this->primaryCurrency;
if ($account instanceof Account) {
$currency = $repository->getAccountCurrency($account) ?? $this->primaryCurrency;
}
$locale = Steam::getLocale();
$accounting = Amount::getJsConfig();
$locale = Steam::getLocale();
$accounting = Amount::getJsConfig();
$accounting['frac_digits'] = $currency->decimal_places;
$pref = Preferences::get('language', config('firefly.default_language', 'en_US'));
$lang = $pref->data;
$dateRange = $this->getDateRangeConfig();
$uid = substr(hash('sha256', sprintf('%s-%s-%s', (string) config('app.key'), auth()->user()->id, auth()->user()->email)), 0, 12);
$data = [
$pref = Preferences::get('language', config('firefly.default_language', 'en_US'));
$lang = $pref->data;
$dateRange = $this->getDateRangeConfig();
$uid = substr(hash('sha256', sprintf('%s-%s-%s', (string) config('app.key'), auth()->user()->id, auth()->user()->email)), 0, 12);
$data = [
'currencyCode' => $currency->code,
'currencySymbol' => $currency->symbol,
'accountingLocaleInfo' => $accounting,
@@ -122,14 +121,11 @@ class JavascriptController extends Controller
'dateRangeTitle' => $dateRange['title'],
'locale' => $locale,
'dateRangeConfig' => $dateRange['configuration'],
'uid' => $uid,
'uid' => $uid
];
$request->session()->keep(['two-factor-secret']);
return response()
->view('javascript.variables', $data)
->header('Content-Type', 'text/javascript')
;
return response()->view('javascript.variables', $data)->header('Content-Type', 'text/javascript');
}
/**
@@ -141,16 +137,10 @@ class JavascriptController extends Controller
$start = clone session('start', today(config('app.timezone'))->startOfMonth());
/** @var Carbon $end */
$end = clone session('end', today(config('app.timezone'))->endOfMonth());
$end = clone session('end', today(config('app.timezone'))->endOfMonth());
$data = [
'start' => $start->format('Y-m-d'),
'end' => $end->format('Y-m-d'),
];
$data = ['start' => $start->format('Y-m-d'), 'end' => $end->format('Y-m-d')];
return response()
->view('v2.javascript.variables', $data)
->header('Content-Type', 'text/javascript')
;
return response()->view('v2.javascript.variables', $data)->header('Content-Type', 'text/javascript');
}
}