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) {

View File

@ -5,13 +5,31 @@ TODO: hide and show columns
<table class="table table-condensed table-hover">
<thead>
<tr>
<td colspan="7" class="no-margin-pagination">{{ groups.render|raw }}</td>
{% if showCategory or showBudget %}
<td colspan="8" class="no-margin-pagination">{{ groups.render|raw }}</td>
{% else %}
<td colspan="7" class="no-margin-pagination">{{ groups.render|raw }}</td>
{% endif %}
<td colspan="1">
<div class="pull-right">
<input id="list_ALL" value="1" name="select-all" type="checkbox" class="select-all form-check-inline"/>
</div>
</td>
</tr>
<tr>
<th>&nbsp;</th>
<th>{{ trans('list.description') }}</th>
<th>{{ trans('list.amount') }}</th>
<th>{{ trans('list.date') }}</th>
<th>{{ trans('list.source_account') }}</th>
<th>{{ trans('list.destination_account') }}</th>
{% if showCategory %}
<th>{{ trans('list.category') }}</th>
{% endif %}
{% if showBudget %}
<th>{{ trans('list.budget') }}</th>
{% endif %}
</tr>
</thead>
<tbody>
{% for group in groups %}
@ -35,9 +53,14 @@ TODO: hide and show columns
{% endif %}
{% endfor %}
</td>
<td colspan="2" style="border-top:1px #aaa solid;">&nbsp;</td>
<td style="border-top:1px #aaa solid;" colspan="2">
<div class="btn-group btn-group-xs">
<!-- column to span accounts + extra fields -->
{% if showCategory or showBudget %}
<td style="border-top:1px #aaa solid;" colspan="3">&nbsp;</td>
{% else %}
<td style="border-top:1px #aaa solid;" colspan="2">&nbsp;</td>
{% endif %}
<td style="border-top:1px #aaa solid;">
<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">
{{ 'actions'|_ }} <span class="caret"></span></button>
<ul class="dropdown-menu dropdown-menu-right" role="menu">
@ -47,6 +70,7 @@ TODO: hide and show columns
</ul>
</div>
</td>
<td style="border-top:1px #aaa solid;">&nbsp;</td>
</tr>
{% endif %}
{% for index, transaction in group.transactions %}
@ -81,11 +105,11 @@ TODO: hide and show columns
<i class="fa fa-check"></i>
{% endif %}
{% if group.count == 1 %}
<a href="{{ route('transactions.show', [group.id]) }}" title="{{ transaction.description }}">
{% endif %}
{{ transaction.description }}
{% if group.count == 1 %}
</a>
<a href="{{ route('transactions.show', [group.id]) }}" title="{{ transaction.description }}">
{% endif %}
{{ transaction.description }}
{% if group.count == 1 %}
</a>
{% endif %}
</td>
<td style=" {{ style|raw }}">
@ -97,15 +121,15 @@ TODO: hide and show columns
{% elseif transaction.transaction_type_type == 'Transfer' %}
<span class="text-info">
{{ 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 %}
</span>
{% 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 %}
</span>
{% 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 %}
</td>
<td style=" {{ style|raw }}">
@ -119,7 +143,23 @@ TODO: hide and show columns
<a href="{{ route('accounts.show', [transaction.destination_account_id]) }}"
title="{{ transaction.destination_account_iban|default(transaction.destination_account_name) }}">{{ transaction.destination_account_name }}</a>
</td>
<td style=" {{ style|raw }}">
{% if showCategory %}
<td style=" {{ style|raw }}">
{% if transaction.category_id %}
<a href="{{ route('categories.show', [transaction.category_id]) }}"
title="{{ transaction.category_name }}">{{ transaction.category_name }}</a>
{% endif %}
</td>
{% endif %}
{% if showBudget %}
<td style=" {{ style|raw }}">
{% if transaction.budget_id %}
<a href="{{ route('budgets.show', [transaction.budget_id]) }}"
title="{{ transaction.budget_name }}">{{ transaction.budget_name }}</a>
{% endif %}
</td>
{% endif %}
<td style=" {{ style|raw }};" class="pull-right">
{% if group.count == 1 %}
<div class="btn-group btn-group-xs">
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
@ -134,7 +174,8 @@ TODO: hide and show columns
</td>
<td style="{{ style|raw }}">
<div class="pull-right">
<input id="list_{{ transaction.transaction_journal_id }}" value="{{ transaction.transaction_journal_id }}" name="journals[{{ transaction.transaction_journal_id }}]"
<input id="list_{{ transaction.transaction_journal_id }}" value="{{ transaction.transaction_journal_id }}"
name="journals[{{ transaction.transaction_journal_id }}]"
type="checkbox" class="mass-select form-check-inline" data-value="{{ transaction.transaction_journal_id }}"/>
</div>
</td>

View File

@ -159,7 +159,7 @@
<div class="box">
<div class="box-header with-border">
<h3 class="box-title">
{{ ('created_'~array.transaction_type~'s')|_ }}
{{ ('created_'~array.type~'s')|_ }}
</h3>
</div>
<div class="box-body">