diff --git a/app/Http/Controllers/Account/ShowController.php b/app/Http/Controllers/Account/ShowController.php index d349f6a818..ff2c715d86 100644 --- a/app/Http/Controllers/Account/ShowController.php +++ b/app/Http/Controllers/Account/ShowController.php @@ -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')]); diff --git a/app/Http/Controllers/BillController.php b/app/Http/Controllers/BillController.php index ea42c54ff2..006163607b 100644 --- a/app/Http/Controllers/BillController.php +++ b/app/Http/Controllers/BillController.php @@ -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) { diff --git a/app/Http/Controllers/Budget/AvailableBudgetController.php b/app/Http/Controllers/Budget/AvailableBudgetController.php index bdfb94c125..3ca5f7d7c4 100644 --- a/app/Http/Controllers/Budget/AvailableBudgetController.php +++ b/app/Http/Controllers/Budget/AvailableBudgetController.php @@ -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')); diff --git a/app/Http/Controllers/Budget/CreateController.php b/app/Http/Controllers/Budget/CreateController.php index eb930fba73..61db789ee0 100644 --- a/app/Http/Controllers/Budget/CreateController.php +++ b/app/Http/Controllers/Budget/CreateController.php @@ -46,7 +46,6 @@ class CreateController extends Controller { parent::__construct(); - app('view')->share('hideBudgets', true); $this->middleware( function ($request, $next) { diff --git a/app/Http/Controllers/Budget/DeleteController.php b/app/Http/Controllers/Budget/DeleteController.php index 0b913ed23d..4b40d92b2b 100644 --- a/app/Http/Controllers/Budget/DeleteController.php +++ b/app/Http/Controllers/Budget/DeleteController.php @@ -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')); diff --git a/app/Http/Controllers/Budget/EditController.php b/app/Http/Controllers/Budget/EditController.php index d74c8b7479..1d02d1bc42 100644 --- a/app/Http/Controllers/Budget/EditController.php +++ b/app/Http/Controllers/Budget/EditController.php @@ -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')); diff --git a/app/Http/Controllers/Budget/IndexController.php b/app/Http/Controllers/Budget/IndexController.php index e2cae5f065..d8292f71ef 100644 --- a/app/Http/Controllers/Budget/IndexController.php +++ b/app/Http/Controllers/Budget/IndexController.php @@ -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')); diff --git a/app/Http/Controllers/Budget/ShowController.php b/app/Http/Controllers/Budget/ShowController.php index 1fb7370ac7..7c09722e6f 100644 --- a/app/Http/Controllers/Budget/ShowController.php +++ b/app/Http/Controllers/Budget/ShowController.php @@ -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 */ diff --git a/app/Http/Controllers/Category/NoCategoryController.php b/app/Http/Controllers/Category/NoCategoryController.php index aa8df71950..c63bd85d0c 100644 --- a/app/Http/Controllers/Category/NoCategoryController.php +++ b/app/Http/Controllers/Category/NoCategoryController.php @@ -51,6 +51,7 @@ class NoCategoryController extends Controller public function __construct() { parent::__construct(); + app('view')->share('showBudget', true); $this->middleware( function ($request, $next) { diff --git a/app/Http/Controllers/Category/ShowController.php b/app/Http/Controllers/Category/ShowController.php index 2c48b9d429..bf6b8e327e 100644 --- a/app/Http/Controllers/Category/ShowController.php +++ b/app/Http/Controllers/Category/ShowController.php @@ -50,6 +50,7 @@ class ShowController extends Controller public function __construct() { parent::__construct(); + app('view')->share('showBudget', true); $this->middleware( function ($request, $next) { diff --git a/app/Http/Controllers/Controller.php b/app/Http/Controllers/Controller.php index 269b21e90b..1a8c733fc1 100644 --- a/app/Http/Controllers/Controller.php +++ b/app/Http/Controllers/Controller.php @@ -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')); diff --git a/app/Http/Controllers/Recurring/ShowController.php b/app/Http/Controllers/Recurring/ShowController.php index bccf857f46..c0892aafe5 100644 --- a/app/Http/Controllers/Recurring/ShowController.php +++ b/app/Http/Controllers/Recurring/ShowController.php @@ -50,6 +50,7 @@ class ShowController extends Controller public function __construct() { parent::__construct(); + app('view')->share('showCategory', true); // translations: $this->middleware( diff --git a/app/Http/Controllers/SearchController.php b/app/Http/Controllers/SearchController.php index e93eb9833f..13d8f325ba 100644 --- a/app/Http/Controllers/SearchController.php +++ b/app/Http/Controllers/SearchController.php @@ -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')); diff --git a/app/Http/Controllers/TagController.php b/app/Http/Controllers/TagController.php index 798a6b2c45..30224198b3 100644 --- a/app/Http/Controllers/TagController.php +++ b/app/Http/Controllers/TagController.php @@ -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( diff --git a/app/Http/Controllers/Transaction/IndexController.php b/app/Http/Controllers/Transaction/IndexController.php index 251d01d124..59bcafcebb 100644 --- a/app/Http/Controllers/Transaction/IndexController.php +++ b/app/Http/Controllers/Transaction/IndexController.php @@ -48,7 +48,7 @@ class IndexController extends Controller public function __construct() { parent::__construct(); - + app('view')->share('showCategory', true); // translations: $this->middleware( function ($request, $next) { diff --git a/resources/views/v1/list/groups.twig b/resources/views/v1/list/groups.twig index dc56e482c4..692378fb7d 100644 --- a/resources/views/v1/list/groups.twig +++ b/resources/views/v1/list/groups.twig @@ -5,13 +5,31 @@ TODO: hide and show columns - + {% if showCategory or showBudget %} + + {% else %} + + {% endif %} + + + + + + + + {% if showCategory %} + + {% endif %} + {% if showBudget %} + + {% endif %} + {% for group in groups %} @@ -35,9 +53,14 @@ TODO: hide and show columns {% endif %} {% endfor %} - - + {% else %} + + {% endif %} + + {% endif %} {% for index, transaction in group.transactions %} @@ -81,11 +105,11 @@ TODO: hide and show columns {% endif %} {% if group.count == 1 %} - - {% endif %} - {{ transaction.description }} - {% if group.count == 1 %} - + + {% endif %} + {{ transaction.description }} + {% if group.count == 1 %} + {% endif %} - + {% endif %} + {% if showBudget %} + + {% endif %} + diff --git a/resources/views/v1/recurring/show.twig b/resources/views/v1/recurring/show.twig index b60f10377d..c60c054988 100644 --- a/resources/views/v1/recurring/show.twig +++ b/resources/views/v1/recurring/show.twig @@ -159,7 +159,7 @@

- {{ ('created_'~array.transaction_type~'s')|_ }} + {{ ('created_'~array.type~'s')|_ }}

{{ groups.render|raw }}{{ groups.render|raw }}{{ groups.render|raw }}
 {{ trans('list.description') }}{{ trans('list.amount') }}{{ trans('list.date') }}{{ trans('list.source_account') }}{{ trans('list.destination_account') }}{{ trans('list.category') }}{{ trans('list.budget') }}
  -
+ + {% if showCategory or showBudget %} +
   +
 
@@ -97,15 +121,15 @@ TODO: hide and show columns {% elseif transaction.transaction_type_type == 'Transfer' %} {{ formatAmountBySymbol(transaction.amount*-1, transaction.currency_symbol, transaction.currency_decimal_places, false) }} - {% if null != transaction.foreign_amount %} - ({{ formatAmountBySymbol(transaction.foreign_amount*-1, transaction.foreign_currency_symbol, transaction.foreign_currency_decimal_places, false) }}) - {% endif %} - - {% 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) }}) + ({{ formatAmountBySymbol(transaction.foreign_amount*-1, transaction.foreign_currency_symbol, transaction.foreign_currency_decimal_places, false) }}) {% endif %} + + {% 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 %} {% endif %} @@ -119,7 +143,23 @@ TODO: hide and show columns {{ transaction.destination_account_name }} + {% if showCategory %} + + {% if transaction.category_id %} + {{ transaction.category_name }} + {% endif %} + + {% if transaction.budget_id %} + {{ transaction.budget_name }} + {% endif %} + {% if group.count == 1 %}
-