Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Some formatting, cleanup, and a new chart.
James Coleeebac2a66dbc
diff --git a/app/controllers/BudgetController.php b/app/controllers/BudgetController.phpindex 9900f994b2..e0455fc708 100644--- a/app/controllers/BudgetController.php+++ b/app/controllers/BudgetController.php@@ -40,7 +40,7 @@ class BudgetController extends BaseController/** A newly stored limit also created a limit repetition.*/- Event::fire('limits.store', [$limit]); // TODO Nothing responds here!+ Event::fire('limits.store', [$limit]);} else {if ($amount > 0) {@@ -49,7 +49,7 @@ class BudgetController extends BaseController/** An updated limit also updates the associated limit repetitions.*/- Event::fire('limits.update', [$limit]); // TODO Nothing responds here!+ Event::fire('limits.update', [$limit]);} else {$limit->delete();}diff --git a/app/controllers/TransactionController.php b/app/controllers/TransactionController.phpindex a66077f179..10ce039b17 100644--- a/app/controllers/TransactionController.php+++ b/app/controllers/TransactionController.php@@ -132,9 +132,6 @@ class TransactionController extends BaseController*/public function edit(TransactionJournal $journal){- /*- * TODO the piggybank id must be filled in when relevant.- *//** All the repositories we need:*/@@ -178,7 +175,12 @@ class TransactionController extends BaseController/** Data to properly display the edit form.*/- $prefilled = ['date' => $journal->date->format('Y-m-d'), 'category' => '', 'budget_id' => 0, 'piggybank_id' => $piggyBankId];+ $prefilled = [+ 'date' => $journal->date->format('Y-m-d'),+ 'category' => '',+ 'budget_id' => 0,+ 'piggybank_id' => $piggyBankId+ ];/** Fill in the category.@@ -219,6 +221,9 @@ class TransactionController extends BaseController$prefilled['account_to_id'] = $journal->transactions[0]->account->id;$prefilled['amount'] = floatval($journal->transactions[0]->amount);}+ if ($journal->piggybankevents()->count() > 0) {+ $prefilled['piggybank_id'] = $journal->piggybankevents()->first()->piggybank_id;+ }break;}@@ -348,6 +353,9 @@ class TransactionController extends BaseController*/public function update(TransactionJournal $journal){+ /*+ * TODO if the piggybank_id is set to 0, does this undo all piggy bank event(s)?+ *//** @var \FireflyIII\Database\TransactionJournal $repos */$repos = App::make('FireflyIII\Database\TransactionJournal');diff --git a/app/lib/FireflyIII/Shared/Toolkit/Reminders.php b/app/lib/FireflyIII/Shared/Toolkit/Reminders.phpindex bce30705e6..7e4dbcae30 100644--- a/app/lib/FireflyIII/Shared/Toolkit/Reminders.php+++ b/app/lib/FireflyIII/Shared/Toolkit/Reminders.php@@ -66,24 +66,6 @@ class Reminders->get();return $reminders;- // $reminders = \Auth::user()->reminders()->where('active', true)->get();- // $return = [];- // /** @var \Reminder $reminder */- // foreach ($reminders as $reminder) {- // $set = ['id' => $reminder->id];- // switch ($reminder->data->type) {- // case 'Test':- // case 'Piggybank':- // $set['title'] = $reminder->title;- // $set['icon'] = $reminder->data->icon;- // $set['text'] = mf(floatval($reminder->data->amount));- // break;- //- // }- // $return[] = $set;- // }- //- // return $return;}public function updateReminders()diff --git a/app/models/Account.php b/app/models/Account.phpindex 47e4a0594f..9e71a5444d 100644--- a/app/models/Account.php+++ b/app/models/Account.php@@ -5,6 +5,7 @@ use LaravelBook\Ardent\Builder;/**+ ** Account** @property integer $iddiff --git a/app/views/recurring/show.blade.php b/app/views/recurring/show.blade.phpindex ff82f65402..e41636106c 100644--- a/app/views/recurring/show.blade.php+++ b/app/views/recurring/show.blade.php@@ -82,7 +82,6 @@</div><div class="panel-body"><div id="recurring-overview"></div>- <!-- TODO chart with hits, grouped by repeat_freq and two lines with max/min amount --></div></div></div>diff --git a/app/views/reminders/show.blade.php b/app/views/reminders/show.blade.phpindex 156897a1e5..26c2b27b25 100644--- a/app/views/reminders/show.blade.php+++ b/app/views/reminders/show.blade.php@@ -18,6 +18,7 @@@endif</p><p>+ <!-- TODO implement all options --><a href="#" class="btn btn-primary"><i class="fa fa-fw fa-thumbs-o-up"></i> I want to do this</a><a href="#" class="btn btn-success"><i class="fa fa-smile-o fa-fw"></i> I already did this</a><a href="#" class="btn btn-danger"><i class="fa fa-fw fa-clock-o"></i> Not this time</a>diff --git a/bootstrap/start.php b/bootstrap/start.phpindex 45ff16c5da..0881f3fc03 100644--- a/bootstrap/start.php+++ b/bootstrap/start.php@@ -93,7 +93,7 @@ Event::subscribe('FireflyIII\Event\Budget');// TODO event that creates a relationship between transaction journals and recurring events when created.// TODO event that updates the relationship between transaction journals and recurring events when edited.-// TODO event that creates a LimitRepetition when a Limit is created.+// event that creates a LimitRepetition when a Limit is created.// event for when a transfer gets created and set an associated piggy bank; save as Piggy bank event.// when this transfer gets edited, retro-actively edit the event and THUS also the piggy bank.// event for when a transfer gets deleted; also delete related piggy bank event.@@ -105,4 +105,9 @@ Event::subscribe('FireflyIII\Event\Budget');// TODO think about reminders.// TODO an event that triggers and creates a limit + limit repetition when a budget is created, or something?// TODO has many through needs to be added wherever relevant. Account > journals, etc.+// TODO check all models for "external" methods once more.+// TODO Auth::user() should be used very sparsely.+// TODO direct calls to models are BAD+// TODO cleanup everything related to reminders because it still feels a bit sloppy.+// TODO use a Database\Reminder thing instead of self-made ORM.return $app;diff --git a/public/assets/javascript/firefly/gcharts.js b/public/assets/javascript/firefly/gcharts.jsindex f11341d821..3636599c68 100644--- a/public/assets/javascript/firefly/gcharts.js+++ b/public/assets/javascript/firefly/gcharts.js@@ -1,5 +1,8 @@google.load('visualization', '1.1', {'packages': ['corechart', 'bar', 'sankey', 'table']});+/*+TODO manage the combination of default options AND custom options.+ */function googleLineChart(URL, container) {if ($('#' + container).length == 1) {$.getJSON(URL).success(function (data) {@@ -150,6 +153,43 @@ function googleStackedColumnChart(URL, container) {}}+function googleComboChart(URL, container) {+ if ($('#' + container).length == 1) {+ $.getJSON(URL).success(function (data) {+ /*+ Get the data from the JSON+ */+ gdata = new google.visualization.DataTable(data);++ /*+ Format as money+ */+ var money = new google.visualization.NumberFormat({+ decimalSymbol: ',',+ groupingSymbol: '.',+ prefix: '\u20AC '+ });+ for (i = 1; i < gdata.getNumberOfColumns(); i++) {+ money.format(gdata, i);+ }++ /*+ Create a new google charts object.+ */+ var chart = new google.visualization.ComboChart(document.getElementById(container));+ /*+ Draw it:+ */+ chart.draw(gdata, defaultComboChartOptions);++ }).fail(function () {+ $('#' + container).addClass('google-chart-error');+ });+ } else {+ console.log('No container found called "' + container + '"');+ }+}+function googlePieChart(URL, container) {if ($('#' + container).length == 1) {$.getJSON(URL).success(function (data) {diff --git a/public/assets/javascript/firefly/gcharts.options.js b/public/assets/javascript/firefly/gcharts.options.jsindex e4d983a85b..dc18206bd1 100644--- a/public/assets/javascript/firefly/gcharts.options.js+++ b/public/assets/javascript/firefly/gcharts.options.js@@ -51,6 +51,29 @@ var defaultBarChartOptions = {},};+var defaultComboChartOptions = {+ height: 300,+ chartArea: {+ left: 75,+ top: 10,+ width: '100%',+ height: '90%'+ },+ vAxis: {+ minValue: 0,+ format: '\u20AC #'+ },+ legend: {+ position: 'none'+ },+ series: {+ 0: {type: 'line'},+ 1: {type: 'line'},+ 2: {type: 'bars'}+ },+ bar: {groupWidth: 20}+};+var defaultColumnChartOptions = {height: 400,chartArea: {diff --git a/public/assets/javascript/firefly/recurring.js b/public/assets/javascript/firefly/recurring.jsindex 177dada460..b0857f6629 100644--- a/public/assets/javascript/firefly/recurring.js+++ b/public/assets/javascript/firefly/recurring.js@@ -7,8 +7,8 @@ $(document).ready(function () {googleTable('table/recurring/' + recurringID + '/transactions', 'transaction-table');}}- if (typeof(googleLineChart) == 'function' && typeof(recurringID) != 'undefined') {- googleLineChart('chart/recurring/' + recurringID, 'recurring-overview');+ if (typeof(googleComboChart) == 'function' && typeof(recurringID) != 'undefined') {+ googleComboChart('chart/recurring/' + recurringID, 'recurring-overview');}});\ No newline at end of file