Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Some refactoring.
James Colec4c3d0f07fc3
diff --git a/app/Http/Controllers/ReportController.php b/app/Http/Controllers/ReportController.phpindex 19e5bcbe36..2113cf7329 100644--- a/app/Http/Controllers/ReportController.php+++ b/app/Http/Controllers/ReportController.php@@ -68,7 +68,7 @@ class ReportController extends Controller** @return View*/- public function year($report_type, Carbon $start, Carbon $end, Collection $accounts)+ public function defaultYear($report_type, Carbon $start, Carbon $end, Collection $accounts){$subTitle = trans('firefly.reportForYear', ['year' => $start->year]);$subTitleIcon = 'fa-bar-chart';@@ -92,7 +92,7 @@ class ReportController extends Controller$accountIds = join(';', $accountIds);return view(- 'reports.year',+ 'reports.default.year',compact('start', 'accountReport', 'incomes', 'report_type', 'accountIds', 'end','expenses', 'subTitle', 'subTitleIcon', 'incomeTopLength', 'expenseTopLength'@@ -109,7 +109,7 @@ class ReportController extends Controller** @return View*/- public function month($report_type, Carbon $start, Carbon $end, Collection $accounts)+ public function defaultMonth($report_type, Carbon $start, Carbon $end, Collection $accounts){// some fields for translation:$subTitle = trans('firefly.reportForMonth', ['month' => $start->formatLocalized($this->monthFormat)]);@@ -136,7 +136,7 @@ class ReportController extends Controller// continue!return view(- 'reports.default',+ 'reports.default.month',compact('start', 'end', 'report_type','subTitle', 'subTitleIcon',@@ -168,10 +168,10 @@ class ReportController extends Controller// more than two months date difference means year report.if ($start->diffInMonths($end) > 1) {- return $this->year($report_type, $start, $end, $accounts);+ return $this->defaultYear($report_type, $start, $end, $accounts);}- return $this->month($report_type, $start, $end, $accounts);+ return $this->defaultMonth($report_type, $start, $end, $accounts);}diff --git a/resources/twig/reports/default.twig b/resources/twig/reports/default.twigdeleted file mode 100644index d2347b4391..0000000000--- a/resources/twig/reports/default.twig+++ /dev/null@@ -1,105 +0,0 @@-{% extends "./layout/default.twig" %}--{% block breadcrumbs %}- {{ Breadcrumbs.renderIfExists(Route.getCurrentRoute.getName, start, shared) }}-{% endblock %}--{% block content %}-- <div class="row">- <div class="col-lg-12 col-md-12 col-sm-12">- <div class="box">- <div class="box-header with-border">- <h3 class="box-title">{{ 'accountBalances'|_ }}</h3>- </div>- <div class="box-body">- {% if Config.get('firefly.chart') == 'google' %}- <div id="account-balances-chart"></div>- {% endif %}- {% if Config.get('firefly.chart') == 'chartjs' %}- <canvas id="account-balances-chart" style="width:100%;height:400px;"></canvas>- {% endif %}- </div>- </div>- </div>- </div>-- <div class="row">- <div class="col-lg-6 col-md-6 col-sm-6">- {% include 'partials/reports/accounts.twig' %}- {% include 'partials/reports/income-vs-expenses.twig' %}- </div>- <div class="col-lg-3 col-md-3 col-sm-3">- <!-- income -->- {% include 'partials/reports/income.twig' %}- </div>- <div class="col-lg-3 col-md-3 col-sm-3">- <!-- expenses -->- {% include 'partials/reports/expenses.twig' %}- </div>- </div>- <div class="row">- <div class="col-lg-8 col-md-8 col-sm-12">- <!-- budgets -->- {% include 'partials/reports/budgets.twig' %}- </div>- <div class="col-lg-4 col-md-4 col-sm-12">- <!-- categories -->- {% include 'partials/reports/categories.twig' %}- </div>- </div>- <div class="row">- <div class="col-lg-12 col-md-12 col-sm-12">-- </div>- </div>- <div class="row">- <div class="col-lg-12 col-md-12 col-sm-12">- {% include 'partials/reports/balance.twig' %}- </div>- </div>- <div class="row">- <div class="col-lg-12 col-md-12 col-sm-12">- {% include 'partials/reports/bills.twig' %}-- </div>- </div>-{% endblock %}-{% block styles %}- <link rel="stylesheet" href="css/bootstrap-sortable.css" type="text/css" media="all"/>-{% endblock %}-{% block scripts %}-- <script type="text/javascript" src="js/bootstrap-sortable.js"></script>-- <!-- load the libraries and scripts necessary for Google Charts: -->- {% if Config.get('firefly.chart') == 'google' %}- <script type="text/javascript" src="https://www.google.com/jsapi"></script>- <script type="text/javascript" src="js/gcharts.js"></script>- {% endif %}- {% if Config.get('firefly.chart') == 'chartjs' %}- <script type="text/javascript" src="js/Chart.min.js"></script>- <script type="text/javascript" src="js/charts.js"></script>- {% endif %}-- <script type="text/javascript">- var year = {{ start.year }};- var month = {{ start.month }};-- // to report another URL:- var startDate = '{{ start.format('Ymd') }}';- var endDate = '{{ end.format('Ymd') }}';- var reportType = '{{ report_type }}';- var accountIds = '{{ accountIds }}';-- var incomeTopLength = {{ incomeTopLength }};- var expenseTopLength = {{ expenseTopLength }};- var incomeRestShow = false; // starts hidden.- var expenseRestShow = false; // starts hidden.- var showTheRest = '{{ trans('firefly.showTheRest',{number:incomeTopLength}) }}';- var hideTheRest = '{{ trans('firefly.hideTheRest',{number:incomeTopLength}) }}';- var showTheRestExpense = '{{ trans('firefly.showTheRest',{number:expenseTopLength}) }}';- var hideTheRestExpense = '{{ trans('firefly.hideTheRest',{number:expenseTopLength}) }}';- </script>- <script type="text/javascript" src="js/reports.js"></script>-{% endblock %}diff --git a/resources/twig/reports/month.twig b/resources/twig/reports/default/month.twigsimilarity index 82%rename from resources/twig/reports/month.twigrename to resources/twig/reports/default/month.twigindex 0b9111669b..6330b99266 100644--- a/resources/twig/reports/month.twig+++ b/resources/twig/reports/default/month.twig@@ -26,26 +26,26 @@<div class="row"><div class="col-lg-6 col-md-6 col-sm-6">- {% include 'partials/reports/accounts.twig' %}- {% include 'partials/reports/income-vs-expenses.twig' %}+ {% include 'reports/partials/accounts.twig' %}+ {% include 'reports/partials/income-vs-expenses.twig' %}</div><div class="col-lg-3 col-md-3 col-sm-3"><!-- income -->- {% include 'partials/reports/income.twig' %}+ {% include 'reports/partials/income.twig' %}</div><div class="col-lg-3 col-md-3 col-sm-3"><!-- expenses -->- {% include 'partials/reports/expenses.twig' %}+ {% include 'reports/partials/expenses.twig' %}</div></div><div class="row"><div class="col-lg-8 col-md-8 col-sm-12"><!-- budgets -->- {% include 'partials/reports/budgets.twig' %}+ {% include 'reports/partials/budgets.twig' %}</div><div class="col-lg-4 col-md-4 col-sm-12"><!-- categories -->- {% include 'partials/reports/categories.twig' %}+ {% include 'reports/partials/categories.twig' %}</div></div><div class="row">@@ -55,12 +55,12 @@</div><div class="row"><div class="col-lg-12 col-md-12 col-sm-12">- {% include 'partials/reports/balance.twig' %}+ {% include 'reports/partials/balance.twig' %}</div></div><div class="row"><div class="col-lg-12 col-md-12 col-sm-12">- {% include 'partials/reports/bills.twig' %}+ {% include 'reports/partials/bills.twig' %}</div></div>@@ -85,8 +85,13 @@<script type="text/javascript">var year = {{ start.year }};var month = {{ start.month }};- var shared = {% if shared %}'/shared'- {% else %}''{% endif %};++ // to report another URL:+ var startDate = '{{ start.format('Ymd') }}';+ var endDate = '{{ end.format('Ymd') }}';+ var reportType = '{{ report_type }}';+ var accountIds = '{{ accountIds }}';+var incomeTopLength = {{ incomeTopLength }};var expenseTopLength = {{ expenseTopLength }};var incomeRestShow = false; // starts hidden.diff --git a/resources/twig/reports/year.twig b/resources/twig/reports/default/year.twigsimilarity index 95%rename from resources/twig/reports/year.twigrename to resources/twig/reports/default/year.twigindex 02e236b75b..af52b11b2f 100644--- a/resources/twig/reports/year.twig+++ b/resources/twig/reports/default/year.twig@@ -41,15 +41,15 @@<div class="row"><div class="col-lg-6 col-md-6 col-sm-6">- {% include 'partials/reports/accounts.twig' %}- {% include 'partials/reports/income-vs-expenses.twig' %}+ {% include 'reports/partials/accounts.twig' %}+ {% include 'reports/partials/income-vs-expenses.twig' %}</div><div class="col-lg-3 col-md-3 col-sm-3">- {% include 'partials/reports/income.twig' %}+ {% include 'reports/partials/income.twig' %}</div><div class="col-lg-3 col-md-3 col-sm-3">- {% include 'partials/reports/expenses.twig' %}+ {% include 'reports/partials/expenses.twig' %}</div></div><div class="row">diff --git a/resources/twig/partials/reports/accounts.twig b/resources/twig/reports/partials/accounts.twigsimilarity index 100%rename from resources/twig/partials/reports/accounts.twigrename to resources/twig/reports/partials/accounts.twigdiff --git a/resources/twig/partials/reports/balance.twig b/resources/twig/reports/partials/balance.twigsimilarity index 100%rename from resources/twig/partials/reports/balance.twigrename to resources/twig/reports/partials/balance.twigdiff --git a/resources/twig/partials/reports/bills.twig b/resources/twig/reports/partials/bills.twigsimilarity index 100%rename from resources/twig/partials/reports/bills.twigrename to resources/twig/reports/partials/bills.twigdiff --git a/resources/twig/partials/reports/budgets.twig b/resources/twig/reports/partials/budgets.twigsimilarity index 100%rename from resources/twig/partials/reports/budgets.twigrename to resources/twig/reports/partials/budgets.twigdiff --git a/resources/twig/partials/reports/categories.twig b/resources/twig/reports/partials/categories.twigsimilarity index 100%rename from resources/twig/partials/reports/categories.twigrename to resources/twig/reports/partials/categories.twigdiff --git a/resources/twig/partials/reports/expenses.twig b/resources/twig/reports/partials/expenses.twigsimilarity index 100%rename from resources/twig/partials/reports/expenses.twigrename to resources/twig/reports/partials/expenses.twigdiff --git a/resources/twig/partials/reports/income-vs-expenses.twig b/resources/twig/reports/partials/income-vs-expenses.twigsimilarity index 100%rename from resources/twig/partials/reports/income-vs-expenses.twigrename to resources/twig/reports/partials/income-vs-expenses.twigdiff --git a/resources/twig/partials/reports/income.twig b/resources/twig/reports/partials/income.twigsimilarity index 100%rename from resources/twig/partials/reports/income.twigrename to resources/twig/reports/partials/income.twig