Add a button to go back to the v1 layout.

This commit is contained in:
James Cole 2024-03-05 19:38:45 +01:00
parent a5b15bbc16
commit 3a339382d4
No known key found for this signature in database
GPG Key ID: B49A324B7EAD6D80
8 changed files with 64 additions and 67 deletions

View File

@ -73,6 +73,7 @@ class IndexController extends Controller
return response()
->json($this->jsonApiList(self::RESOURCE_KEY, $paginator, $transformer))
->header('Content-Type', self::CONTENT_TYPE);
->header('Content-Type', self::CONTENT_TYPE)
;
}
}

View File

@ -69,6 +69,11 @@ abstract class Controller extends BaseController
$authGuard = config('firefly.authentication_guard');
$logoutUrl = config('firefly.custom_logout_url');
// overrule v2 layout back to v1.
if ('true' === request()->get('force_default_layout') && 'v2' === config('firefly.layout')) {
app('view')->getFinder()->setPaths([realpath(base_path('resources/views'))]);
}
app('view')->share('authGuard', $authGuard);
app('view')->share('logoutUrl', $logoutUrl);

View File

@ -34,7 +34,6 @@ use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Collection;
use Log;
/**
* Class ReconcileController
@ -119,10 +118,10 @@ class ReconcileController extends Controller
$clearedAmount = $this->processJournal($account, $accountCurrency, $journal, $clearedAmount);
}
}
Log::debug(sprintf('Start balance: "%s"', $startBalance));
Log::debug(sprintf('End balance: "%s"', $endBalance));
Log::debug(sprintf('Cleared amount: "%s"', $clearedAmount));
Log::debug(sprintf('Amount: "%s"', $amount));
\Log::debug(sprintf('Start balance: "%s"', $startBalance));
\Log::debug(sprintf('End balance: "%s"', $endBalance));
\Log::debug(sprintf('Cleared amount: "%s"', $clearedAmount));
\Log::debug(sprintf('Amount: "%s"', $amount));
$difference = bcadd(bcadd(bcsub($startBalance, $endBalance), $clearedAmount), $amount);
$diffCompare = bccomp($difference, '0');
$countCleared = count($clearedJournals);

View File

@ -75,17 +75,11 @@ class IndexController extends Controller
$objectType = 'transfer';
}
// add a split for the (future) v2 release.
$periods = [];
$groups = [];
$subTitle = 'TODO page subtitle in v2';
$subTitleIcon = config('firefly.transactionIconsByType.'.$objectType);
$types = config('firefly.transactionTypesByType.'.$objectType);
$page = (int)$request->get('page');
$pageSize = (int)app('preferences')->get('listPageSize', 50)->data;
if ('v2' !== (string)config('firefly.layout')) {
if (null === $start) {
$start = session('start');
$end = session('end');
@ -120,7 +114,6 @@ class IndexController extends Controller
;
$groups = $collector->getPaginatedGroups();
$groups->setPath($path);
}
return view('transactions.index', compact('subTitle', 'objectType', 'subTitleIcon', 'groups', 'periods', 'start', 'end'));
}

View File

@ -252,10 +252,8 @@ class AccountRepository implements AccountRepositoryInterface
}
}
/**
* @inheritDoc
*/
#[\Override] public function getAccountsInOrder(array $types, array $sort, int $startRow, int $endRow): Collection
#[\Override]
public function getAccountsInOrder(array $types, array $sort, int $startRow, int $endRow): Collection
{
$query = $this->userGroup->accounts();
if (0 !== count($types)) {
@ -280,12 +278,14 @@ class AccountRepository implements AccountRepositoryInterface
return $query->get(['accounts.*']);
}
#[\Override] public function countAccounts(array $types): int
#[\Override]
public function countAccounts(array $types): int
{
$query = $this->userGroup->accounts();
if (0 !== count($types)) {
$query->accountTypeIn($types);
}
return $query->count();
}
}

View File

@ -53,13 +53,6 @@ interface AccountRepositoryInterface
/**
* Used in the infinite accounts list.
*
* @param array $types
* @param array $sort
* @param int $startRow
* @param int $endRow
*
* @return Collection
*/
public function getAccountsInOrder(array $types, array $sort, int $startRow, int $endRow): Collection;

View File

@ -1,3 +1,9 @@
<li class="nav-item">
<a class="nav-link" href="{{ route(Route::current()->getName(), Route::current()->parameters()) }}?force_default_layout=true">
<i class="fa-solid fa-landmark"></i>
</a>
</li>
<li class="nav-item dropdown">
<a class="nav-link" data-bs-toggle="dropdown" href="#">
<i class="fa-solid fa-gears"></i>