Skip to content

Firefly III: a personal finances manager

Better mostly report lists.

James Colefd57086ffd87
diff --git a/app/Helpers/Report/ReportHelper.php b/app/Helpers/Report/ReportHelper.php
index e8677d01d0..9c4a4c4ad7 100644
--- a/app/Helpers/Report/ReportHelper.php
+++ b/app/Helpers/Report/ReportHelper.php
@@ -99,7 +99,8 @@ class ReportHelper implements ReportHelperInterface
$end = Carbon::now();
$months = [];
while ($start <= $end) {
- $months[] = [
+ $year = $start->format('Y');
+ $months[$year][] = [
'formatted' => $start->format('F Y'),
'month' => intval($start->format('m')),
'year' => intval($start->format('Y')),
diff --git a/resources/views/reports/index.blade.php b/resources/views/reports/index.blade.php
index 13cc5236e3..4705417029 100644
--- a/resources/views/reports/index.blade.php
+++ b/resources/views/reports/index.blade.php
@@ -23,11 +23,16 @@
Monthly reports
</div>
<div class="panel-body">
- <ul>
- @foreach($months as $month)
- <li><a href="{{route('reports.month',[$month['year'],$month['month']])}}">{{$month['formatted']}}</a></li>
+
+ @foreach($months as $year => $entries)
+ <h5>{{$year}}</h5>
+ <ul>
+ @foreach($entries as $month)
+ <li><a href="{{route('reports.month',[$month['year'],$month['month']])}}">{{$month['formatted']}}</a></li>
+ @endforeach
+ </ul>
@endforeach
- </ul>
+
</div>
</div>
</div>
@@ -38,9 +43,13 @@
Budget reports
</div>
<div class="panel-body">
- <ul>
- @foreach($months as $month)
- <li><a href="{{route('reports.budget',[$month['year'],$month['month']])}}">{{$month['formatted']}}</a></li>
+ @foreach($months as $year => $entries)
+ <h5>{{$year}}</h5>
+ <ul>
+ @foreach($entries as $month)
+ <li><a href="{{route('reports.budget',[$month['year'],$month['month']])}}">{{$month['formatted']}}</a></li>
+ @endforeach
+ </ul>
@endforeach
</ul>
</div>