Skip to content

Firefly III: a personal finances manager

Fix views.

James Colee948fa09649f
diff --git a/app/Http/Controllers/Report/BalanceController.php b/app/Http/Controllers/Report/BalanceController.php
index 5c46b25b57..286d1e0622 100644
--- a/app/Http/Controllers/Report/BalanceController.php
+++ b/app/Http/Controllers/Report/BalanceController.php
@@ -134,7 +134,8 @@ final class BalanceController extends Controller
// get transactions in budget
}
-
+// echo '<pre>';
+// print_r($report);exit;
try {
$result = view('reports.partials.balance', ['report' => $report])->render();
} catch (Throwable $e) {
diff --git a/app/Http/Controllers/Report/CategoryController.php b/app/Http/Controllers/Report/CategoryController.php
index 11d6b70de6..834473d94b 100644
--- a/app/Http/Controllers/Report/CategoryController.php
+++ b/app/Http/Controllers/Report/CategoryController.php
@@ -602,6 +602,7 @@ final class CategoryController extends Controller
*/
public function operations(Collection $accounts, Carbon $start, Carbon $end): string
{
+ $incomeTopLength = 0;
// chart properties for cache:
$cache = new CacheProperties();
$cache->addProperty($start);
@@ -621,7 +622,7 @@ final class CategoryController extends Controller
$report = $generator->getReport();
try {
- $result = view('reports.partials.categories', ['report' => $report])->render();
+ $result = view('reports.partials.categories', ['report' => $report,'incomeTopLength' => $incomeTopLength])->render();
$cache->store($result);
} catch (Throwable $e) {
Log::error(sprintf('Could not render category::expenses: %s', $e->getMessage()));
diff --git a/app/Support/Http/Controllers/RenderPartialViews.php b/app/Support/Http/Controllers/RenderPartialViews.php
index 4f638000eb..3490d6db8e 100644
--- a/app/Support/Http/Controllers/RenderPartialViews.php
+++ b/app/Support/Http/Controllers/RenderPartialViews.php
@@ -73,7 +73,7 @@ trait RenderPartialViews
$view = view('popup.report.balance-amount', ['journals' => $journals, 'budget' => $budget, 'account' => $account])->render();
} catch (Throwable $e) {
Log::error(sprintf('Could not render: %s', $e->getMessage()));
- $view = 'Firefly III could not render the view. Please see the log files.';
+ $view = sprintf('Firefly III could not render the view: %s', $e->getMessage());
throw new FireflyException($view, 0, $e);
}
@@ -128,7 +128,7 @@ trait RenderPartialViews
$view = view('popup.report.budget-spent-amount', ['journals' => $journals, 'budget' => $budget])->render();
} catch (Throwable $e) {
Log::error(sprintf('Could not render: %s', $e->getMessage()));
- $view = 'Firefly III could not render the view. Please see the log files.';
+ $view = sprintf('Firefly III could not render the view: %s', $e->getMessage());
throw new FireflyException($view, 0, $e);
}
@@ -155,7 +155,7 @@ trait RenderPartialViews
$view = view('popup.report.category-entry', ['journals' => $journals, 'category' => $category])->render();
} catch (Throwable $e) {
Log::error(sprintf('Could not render: %s', $e->getMessage()));
- $view = 'Firefly III could not render the view. Please see the log files.';
+ $view = sprintf('Firefly III could not render the view: %s', $e->getMessage());
throw new FireflyException($view, 0, $e);
}
@@ -264,7 +264,7 @@ trait RenderPartialViews
$view = view('popup.report.expense-entry', ['journals' => $journals, 'account' => $account])->render();
} catch (Throwable $e) {
Log::error(sprintf('Could not render: %s', $e->getMessage()));
- $view = 'Firefly III could not render the view. Please see the log files.';
+ $view = sprintf('Firefly III could not render the view: %s', $e->getMessage());
throw new FireflyException($view, 0, $e);
}
@@ -385,7 +385,7 @@ trait RenderPartialViews
$view = view('popup.report.income-entry', ['journals' => $journals, 'account' => $account])->render();
} catch (Throwable $e) {
Log::error(sprintf('Could not render: %s', $e->getMessage()));
- $view = 'Firefly III could not render the view. Please see the log files.';
+ $view = sprintf('Firefly III could not render the view: %s', $e->getMessage());
throw new FireflyException($view, 0, $e);
}
diff --git a/resources/views/accounts/show.blade.php b/resources/views/accounts/show.blade.php
index 64ed58e0e0..e8124da462 100644
--- a/resources/views/accounts/show.blade.php
+++ b/resources/views/accounts/show.blade.php
@@ -62,7 +62,7 @@
</h3>
</div>
<div class="card-body p-0">
- {% include 'list.attachments' %}
+ <x-lists.attachments attachments="$attachments" />
</div>
</div>
</div>
diff --git a/resources/views/bills/show.blade.php b/resources/views/bills/show.blade.php
index 5b1f25537b..c260cd05d8 100644
--- a/resources/views/bills/show.blade.php
+++ b/resources/views/bills/show.blade.php
@@ -145,7 +145,7 @@
<h3 class="card-title">{{ __('firefly.attachments') }}</h3>
</div>
<div class="card-body p-0">
- {% include 'list.attachments' %}
+ <x-lists.attachments attachments="$attachments" />
</div>
</div>
@endif
diff --git a/resources/views/budgets/show.blade.php b/resources/views/budgets/show.blade.php
index e2e6f0d3c2..3a66159397 100644
--- a/resources/views/budgets/show.blade.php
+++ b/resources/views/budgets/show.blade.php
@@ -46,7 +46,7 @@
</h3>
</div>
<div class="card-body p-0">
- {% include 'list.attachments' %}
+ <x-lists.attachments attachments="$attachments" />
</div>
</div>
</div>
diff --git a/resources/views/categories/show.blade.php b/resources/views/categories/show.blade.php
index 93ecfbb5dc..7cdde33bb2 100644
--- a/resources/views/categories/show.blade.php
+++ b/resources/views/categories/show.blade.php
@@ -52,7 +52,7 @@
</h3>
</div>
<div class="card-body p-0">
- {% include 'list.attachments' %}
+ <x-lists.attachments attachments="$attachments" />
</div>
</div>
</div>
diff --git a/resources/views/popup/list/journals.blade.php b/resources/views/popup/list/journals.blade.php
index 5b87b99e7a..fd22035e5b 100644
--- a/resources/views/popup/list/journals.blade.php
+++ b/resources/views/popup/list/journals.blade.php
@@ -1,3 +1,10 @@
+@php
+$hideDestination = $hideDestination ?? false;
+$hideSource = $hideSource ?? false;
+$hideBudget = $hideBudget ?? false;
+$hideCategory = $hideCategory ?? false;
+@endphp
+
<table class="table table-hover table-sm">
<thead>
<tr>
@@ -40,7 +47,7 @@
$symbol = $transaction['currency_symbol'];
$decimal_places = $transaction['currency_decimal_places'];
@endphp
- <tr class="drag" data-date="{{ $transaction['date']->format('Y-m-d') }}" data-id="{{ $transaction['journal_id'] }}">
+ <tr class="drag" data-date="{{ $transaction['date']->format('Y-m-d') }}" data-id="{{ $transaction['journal_id'] ?? 0 }}">
<td class="hidden-xs">
<x-elements.transaction-type-icon type="$transaction['transaction_type_type']" />
</td>
diff --git a/resources/views/popup/report/budget-spent-amount.blade.php b/resources/views/popup/report/budget-spent-amount.blade.php
index 62d272d7be..e44563a123 100644
--- a/resources/views/popup/report/budget-spent-amount.blade.php
+++ b/resources/views/popup/report/budget-spent-amount.blade.php
@@ -7,8 +7,10 @@
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="{{ __('firefly.close') }}"></button>
</div>
<div class="modal-body">
- {% set hideBudget = true %}
- {% include 'popup.list.journals' %}
+ @php
+ $hideBudget = true;
+ @endphp
+ @include('popup.list.journals')
</div>
<div class="modal-footer">
<button type="button" class="btn btn-outline-secondary" data-bs-dismiss="modal">{{ __('firefly.close') }}</button>
diff --git a/resources/views/popup/report/expense-entry.blade.php b/resources/views/popup/report/expense-entry.blade.php
index 34d301b246..2ba34ddbf4 100644
--- a/resources/views/popup/report/expense-entry.blade.php
+++ b/resources/views/popup/report/expense-entry.blade.php
@@ -6,8 +6,10 @@
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="{{ __('firefly.close') }}"></button>
</div>
<div class="modal-body">
- {% set hideDestination = true %}
- {% include 'popup.list.journals' %}
+ @php
+ $hideDestination = true;
+ @endphp
+ @include('popup.list.journals')
</div>
<div class="modal-footer">
<button type="button" class="btn btn-outline-secondary" data-bs-dismiss="modal">{{ __('firefly.close') }}</button>
diff --git a/resources/views/popup/report/income-entry.blade.php b/resources/views/popup/report/income-entry.blade.php
index 5065e292cd..d3ebd10c38 100644
--- a/resources/views/popup/report/income-entry.blade.php
+++ b/resources/views/popup/report/income-entry.blade.php
@@ -6,11 +6,13 @@
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="{{ __('firefly.close') }}"></button>
</div>
<div class="modal-body">
- {% set hideBudget = true %}
- {% set hideSource = true %}
- {% set accountPerspective = account %}
- {% set inverseAmount = true %}
- {% include 'popup.list.journals' %}
+ @php
+ $hideSource = true;
+ $hideBudget = true;
+ $accountPerspective = $account;
+ $inverseAmount = true;
+ @endphp
+ @include('popup.list.journals')
</div>
<div class="modal-footer">
<button type="button" class="btn btn-outline-secondary" data-bs-dismiss="modal">{{ __('firefly.close') }}</button>
diff --git a/resources/views/reports/partials/balance.blade.php b/resources/views/reports/partials/balance.blade.php
index 28b68eca82..4b4862f1c3 100644
--- a/resources/views/reports/partials/balance.blade.php
+++ b/resources/views/reports/partials/balance.blade.php
@@ -12,19 +12,22 @@
</thead>
<tbody>
@foreach($report['budgets'] as $budget)
- @if($budget['spent'] > 0)
+ @if(count($budget['spent']) > 0)
<tr>
<td>
<a href="{{ route('budgets.show', [$budget['budget_id']]) }}">{{ $budget['budget_name'] }}</a>
</td>
@foreach($report['accounts'] as $account)
@if(array_key_exists($account['id'], $budget['spent']))
+ @php
+ $array = $budget['spent'][$account['id']];
+ @endphp
<td class="text-end">
- {!! format_amount_by_symbol($budget['spent'][$account['id']]['spent'], $budget['spent'][$account['id']]['currency_symbol'], $budget['spent'][$account['id']]['currency_decimal_places']) !!}
+ {!! format_amount_by_symbol($array['spent'], $array['currency_symbol'], $array['currency_decimal_places']) !!}
<span data-location="budget-entry"
data-budget-id="{{ $budget['budget_id'] }}"
data-account-id="{{ $account['id'] }}"
- data-currency-id="{{ $budget['spent'][$account['id']]['currency_id'] }}"
+ data-currency-id="{{ $array['currency_id'] }}"
class="bi bi-info-circle text-muted firefly-info-button"></span>
</td>
@else
@@ -36,11 +39,11 @@
@endforeach
<td class="text-end">
@if(array_key_exists($budget['budget_id'], $report['sums']))
- @foreach($report['sums'][$budget['budget_id']] as $sum)
- {!! format_amount_by_symbol($sum['sum'], $sum['currency_symbol'], $sum['currency_decimal_places']) !!}
- <br/>
- @endforeach
- @endif
+ @foreach($report['sums'][$budget['budget_id']] as $sum)
+ {!! format_amount_by_symbol($sum['sum'], $sum['currency_symbol'], $sum['currency_decimal_places']) !!}
+ <br/>
+ @endforeach
+ @endif
</td>
</tr>
@endif
@@ -50,7 +53,7 @@
<tr>
<td><em>{{ __('firefly.sum') }}</em></td>
@foreach($report['accounts'] as $account)
- @if($account['sum'] !== 0)
+ @if($account['sum'] !== '0')
<td class="text-end">
{!! format_amount_by_symbol($account['sum'], $account['currency_symbol'], $account['currency_decimal_places']) !!}
</td>