mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-01-24 15:26:33 -06:00
Some formatting, cleanup, and a new chart.
This commit is contained in:
parent
7e8f5c9548
commit
eebac2a66d
@ -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();
|
||||
}
|
||||
|
@ -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');
|
||||
|
||||
|
@ -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()
|
||||
|
@ -5,6 +5,7 @@ use LaravelBook\Ardent\Builder;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* Account
|
||||
*
|
||||
* @property integer $id
|
||||
|
@ -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>
|
||||
|
@ -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>
|
||||
|
@ -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;
|
||||
|
@ -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) {
|
||||
|
@ -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: {
|
||||
|
@ -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');
|
||||
}
|
||||
}
|
||||
);
|
Loading…
Reference in New Issue
Block a user