This commit is contained in:
James Cole
2019-09-04 07:51:31 +02:00
parent 47de2fec28
commit d107e78641
17 changed files with 81 additions and 46 deletions

View File

@@ -57,6 +57,8 @@ class ShowController extends Controller
{
parent::__construct();
app('view')->share('showCategory', true);
// translations:
$this->middleware(
function ($request, $next) {
@@ -116,7 +118,7 @@ class ShowController extends Controller
$collector
->setAccounts(new Collection([$account]))
->setLimit($pageSize)
->setPage($page)->withAccountInformation()
->setPage($page)->withAccountInformation()->withCategoryInformation()
->setRange($start, $end);
$groups = $collector->getPaginatedGroups();
$groups->setPath(route('accounts.show', [$account->id, $start->format('Y-m-d'), $end->format('Y-m-d')]));
@@ -158,7 +160,7 @@ class ShowController extends Controller
$periods = new Collection;
/** @var GroupCollectorInterface $collector */
$collector = app(GroupCollectorInterface::class);
$collector->setAccounts(new Collection([$account]))->setLimit($pageSize)->setPage($page)->withAccountInformation();
$collector->setAccounts(new Collection([$account]))->setLimit($pageSize)->setPage($page)->withAccountInformation()->withCategoryInformation();
$groups = $collector->getPaginatedGroups();
$groups->setPath(route('accounts.show.all', [$account->id]));
$chartUri = route('chart.account.period', [$account->id, $start->format('Y-m-d'), $end->format('Y-m-d')]);

View File

@@ -65,6 +65,7 @@ class BillController extends Controller
$maxPostSize = app('steam')->phpBytes(ini_get('post_max_size'));
$uploadSize = min($maxFileSize, $maxPostSize);
app('view')->share('uploadSize', $uploadSize);
app('view')->share('showBudget', true);
$this->middleware(
function ($request, $next) {

View File

@@ -53,8 +53,6 @@ class AvailableBudgetController extends Controller
{
parent::__construct();
app('view')->share('hideBudgets', true);
$this->middleware(
function ($request, $next) {
app('view')->share('title', (string)trans('firefly.budgets'));

View File

@@ -46,7 +46,6 @@ class CreateController extends Controller
{
parent::__construct();
app('view')->share('hideBudgets', true);
$this->middleware(
function ($request, $next) {

View File

@@ -46,8 +46,6 @@ class DeleteController extends Controller
{
parent::__construct();
app('view')->share('hideBudgets', true);
$this->middleware(
function ($request, $next) {
app('view')->share('title', (string)trans('firefly.budgets'));

View File

@@ -48,8 +48,6 @@ class EditController extends Controller
{
parent::__construct();
app('view')->share('hideBudgets', true);
$this->middleware(
function ($request, $next) {
app('view')->share('title', (string)trans('firefly.budgets'));

View File

@@ -69,8 +69,6 @@ class IndexController extends Controller
{
parent::__construct();
app('view')->share('hideBudgets', true);
$this->middleware(
function ($request, $next) {
app('view')->share('title', (string)trans('firefly.budgets'));

View File

@@ -53,6 +53,7 @@ class ShowController extends Controller
*/
public function __construct()
{
app('view')->share('showCategory', true);
parent::__construct();
$this->middleware(
function ($request, $next) {
@@ -76,6 +77,8 @@ class ShowController extends Controller
*/
public function noBudget(Request $request, Carbon $start = null, Carbon $end = null)
{
/** @var Carbon $start */
$start = $start ?? session('start');
/** @var Carbon $end */
@@ -95,7 +98,7 @@ class ShowController extends Controller
/** @var GroupCollectorInterface $collector */
$collector = app(GroupCollectorInterface::class);
$collector->setRange($start, $end)->setTypes([TransactionType::WITHDRAWAL])->setLimit($pageSize)->setPage($page)
->withoutBudget()->withAccountInformation();
->withoutBudget()->withAccountInformation()->withCategoryInformation();
$groups = $collector->getPaginatedGroups();
$groups->setPath(route('budgets.no-budget'));
@@ -111,6 +114,7 @@ class ShowController extends Controller
*/
public function noBudgetAll(Request $request)
{
$subTitle = (string)trans('firefly.all_journals_without_budget');
$first = $this->journalRepos->firstNull();
$start = null === $first ? new Carbon : $first->date;
@@ -121,7 +125,7 @@ class ShowController extends Controller
/** @var GroupCollectorInterface $collector */
$collector = app(GroupCollectorInterface::class);
$collector->setRange($start, $end)->setTypes([TransactionType::WITHDRAWAL])->setLimit($pageSize)->setPage($page)
->withoutBudget()->withAccountInformation();
->withoutBudget()->withAccountInformation()->withCategoryInformation();
$groups = $collector->getPaginatedGroups();
$groups->setPath(route('budgets.no-budget'));
@@ -150,7 +154,7 @@ class ShowController extends Controller
// collector:
/** @var GroupCollectorInterface $collector */
$collector = app(GroupCollectorInterface::class);
$collector->setRange($start, $end)->setBudget($budget)->setLimit($pageSize)->setPage($page)->withBudgetInformation();
$collector->setRange($start, $end)->setBudget($budget)->setLimit($pageSize)->setPage($page)->withBudgetInformation()->withCategoryInformation();
$groups = $collector->getPaginatedGroups();
$groups->setPath(route('budgets.show', [$budget->id]));
@@ -191,7 +195,7 @@ class ShowController extends Controller
$collector = app(GroupCollectorInterface::class);
$collector->setRange($budgetLimit->start_date, $budgetLimit->end_date)
->setBudget($budget)->setLimit($pageSize)->setPage($page)->withBudgetInformation();
->setBudget($budget)->setLimit($pageSize)->setPage($page)->withBudgetInformation()->withCategoryInformation();
$groups = $collector->getPaginatedGroups();
$groups->setPath(route('budgets.show', [$budget->id, $budgetLimit->id]));
/** @var Carbon $start */

View File

@@ -51,6 +51,7 @@ class NoCategoryController extends Controller
public function __construct()
{
parent::__construct();
app('view')->share('showBudget', true);
$this->middleware(
function ($request, $next) {

View File

@@ -50,6 +50,7 @@ class ShowController extends Controller
public function __construct()
{
parent::__construct();
app('view')->share('showBudget', true);
$this->middleware(
function ($request, $next) {

View File

@@ -54,15 +54,9 @@ class Controller extends BaseController
*/
public function __construct()
{
// for transaction lists:
app('view')->share('hideBudgets', false,); // Firefly III will break here if you don't have PHP 7.3up
app('view')->share('hideCategories', false,);
app('view')->share('hideBills', false,);
app('view')->share('hideTags', false,);
// is site a demo site?
$isDemoSite = app('fireflyconfig')->get('is_demo_site', config('firefly.configuration.is_demo_site'))->data;
app('view')->share('IS_DEMO_SITE', $isDemoSite);
$isDemoSite = app('fireflyconfig')->get('is_demo_site', config('firefly.configuration.is_demo_site', ), )->data;
app('view')->share('IS_DEMO_SITE', $isDemoSite, );
app('view')->share('DEMO_USERNAME', config('firefly.demo_username'));
app('view')->share('DEMO_PASSWORD', config('firefly.demo_password'));
app('view')->share('FF_VERSION', config('firefly.version'));

View File

@@ -50,6 +50,7 @@ class ShowController extends Controller
public function __construct()
{
parent::__construct();
app('view')->share('showCategory', true);
// translations:
$this->middleware(

View File

@@ -39,9 +39,9 @@ class SearchController extends Controller
public function __construct()
{
parent::__construct();
app('view')->share('showCategory', true);
$this->middleware(
function ($request, $next) {
static function ($request, $next) {
app('view')->share('mainTitleIcon', 'fa-search');
app('view')->share('title', (string)trans('firefly.search'));

View File

@@ -49,7 +49,6 @@ class TagController extends Controller
public function __construct()
{
parent::__construct();
app('view')->share('hideTags', true);
$this->redirectUri = route('tags.index');
$this->middleware(

View File

@@ -48,7 +48,7 @@ class IndexController extends Controller
public function __construct()
{
parent::__construct();
app('view')->share('showCategory', true);
// translations:
$this->middleware(
function ($request, $next) {