mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-20 11:48:27 -06:00
Implemented some todo's.
This commit is contained in:
parent
6381408fba
commit
f0f965421c
@ -277,6 +277,21 @@ class TransactionController extends BaseController
|
||||
*/
|
||||
public function show(TransactionJournal $journal)
|
||||
{
|
||||
$journal->transactions->each(
|
||||
function(\Transaction $t) use ($journal) {
|
||||
$t->before = floatval(
|
||||
$t->account->transactions()->leftJoin(
|
||||
'transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id'
|
||||
)->where('transaction_journals.date', '<=', $journal->date->format('Y-m-d'))->where(
|
||||
'transaction_journals.created_at', '<=', $journal->created_at->format('Y-m-d H:i:s')
|
||||
)->where('transaction_journals.id', '!=', $journal->id)->sum('transactions.amount')
|
||||
);
|
||||
$t->after = $t->before + $t->amount;
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
|
||||
return View::make('transactions.show')->with('journal', $journal)->with(
|
||||
'subTitle', $journal->transactionType->type . ' "' . $journal->description . '"'
|
||||
);
|
||||
|
@ -66,26 +66,6 @@ class Account extends Ardent
|
||||
{
|
||||
return $this->hasMany('Transaction');
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* TODO remove this method in favour of something in the FireflyIII libraries.
|
||||
*
|
||||
* @param TransactionJournal $journal
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
public function balanceBeforeJournal(TransactionJournal $journal)
|
||||
{
|
||||
return floatval(
|
||||
$this->transactions()->leftJoin(
|
||||
'transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id'
|
||||
)->where('transaction_journals.date', '<=', $journal->date->format('Y-m-d'))->where(
|
||||
'transaction_journals.created_at', '<=', $journal->created_at->format('Y-m-d H:i:s')
|
||||
)->where('transaction_journals.id', '!=', $journal->id)->sum('transactions.amount')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO remove this method in favour of something in the FireflyIII libraries.
|
||||
*
|
||||
|
@ -19,7 +19,6 @@
|
||||
@endif
|
||||
</p>
|
||||
<p>
|
||||
<!-- TODO implement all options -->
|
||||
<a href="{{route('reminders.act',$reminder->id)}}" class="btn btn-primary"><i class="fa fa-fw fa-thumbs-o-up"></i> I want to do this</a>
|
||||
<a href="{{route('reminders.dismiss',$reminder->id)}}" class="btn btn-success"><i class="fa fa-smile-o fa-fw"></i> I already did this</a>
|
||||
<a href="{{route('reminders.dismiss',$reminder->id)}}" class="btn btn-danger"><i class="fa fa-fw fa-clock-o"></i> Not this time</a>
|
||||
|
@ -74,7 +74,7 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td>New balance</td>
|
||||
<td>{{mf($t->account->balanceBeforeJournal($journal))}} → {{mf($t->account->balanceBeforeJournal($journal) + $t->amount)}}</td>
|
||||
<td>{{mf($t->before)}} → {{mf($t->after)}}</td>
|
||||
</tr>
|
||||
@if(!is_null($t->description))
|
||||
<tr>
|
||||
|
@ -115,4 +115,6 @@ Event::subscribe('FireflyIII\Event\TransactionJournal');
|
||||
// see if the various has-many-throughs actually get used.
|
||||
// set very tight rules on all models
|
||||
// create custom uniquely rules.
|
||||
// TODO add "Create new X" button to any list there is: categories, accounts, piggies, etc.
|
||||
// TODO Install PHP5 and code thing and create very small methods.
|
||||
return $app;
|
||||
|
@ -1,9 +1,6 @@
|
||||
google.load('visualization', '1.1', {'packages': ['corechart', 'bar', 'sankey', 'table']});
|
||||
|
||||
/*
|
||||
TODO manage the combination of default options AND custom options.
|
||||
*/
|
||||
function googleLineChart(URL, container) {
|
||||
function googleLineChart(URL, container, options) {
|
||||
if ($('#' + container).length == 1) {
|
||||
$.getJSON(URL).success(function (data) {
|
||||
/*
|
||||
@ -31,7 +28,7 @@ function googleLineChart(URL, container) {
|
||||
/*
|
||||
Draw it:
|
||||
*/
|
||||
chart.draw(gdata, defaultLineChartOptions);
|
||||
chart.draw(gdata, options || defaultLineChartOptions);
|
||||
|
||||
}).fail(function () {
|
||||
$('#' + container).addClass('google-chart-error');
|
||||
@ -41,7 +38,7 @@ function googleLineChart(URL, container) {
|
||||
}
|
||||
}
|
||||
|
||||
function googleBarChart(URL, container) {
|
||||
function googleBarChart(URL, container, options) {
|
||||
if ($('#' + container).length == 1) {
|
||||
$.getJSON(URL).success(function (data) {
|
||||
/*
|
||||
@ -69,7 +66,7 @@ function googleBarChart(URL, container) {
|
||||
/*
|
||||
Draw it:
|
||||
*/
|
||||
chart.draw(gdata, defaultBarChartOptions);
|
||||
chart.draw(gdata, options || defaultBarChartOptions);
|
||||
|
||||
}).fail(function () {
|
||||
$('#' + container).addClass('google-chart-error');
|
||||
@ -79,7 +76,7 @@ function googleBarChart(URL, container) {
|
||||
}
|
||||
}
|
||||
|
||||
function googleColumnChart(URL, container) {
|
||||
function googleColumnChart(URL, container, options) {
|
||||
if ($('#' + container).length == 1) {
|
||||
$.getJSON(URL).success(function (data) {
|
||||
/*
|
||||
@ -106,7 +103,7 @@ function googleColumnChart(URL, container) {
|
||||
/*
|
||||
Draw it:
|
||||
*/
|
||||
chart.draw(gdata, defaultColumnChartOptions);
|
||||
chart.draw(gdata, options || defaultColumnChartOptions);
|
||||
|
||||
}).fail(function () {
|
||||
$('#' + container).addClass('google-chart-error');
|
||||
@ -116,7 +113,7 @@ function googleColumnChart(URL, container) {
|
||||
}
|
||||
}
|
||||
|
||||
function googleStackedColumnChart(URL, container) {
|
||||
function googleStackedColumnChart(URL, container, options) {
|
||||
if ($('#' + container).length == 1) {
|
||||
$.getJSON(URL).success(function (data) {
|
||||
/*
|
||||
@ -143,7 +140,7 @@ function googleStackedColumnChart(URL, container) {
|
||||
/*
|
||||
Draw it:
|
||||
*/
|
||||
chart.draw(gdata, defaultStackedColumnChartOptions);
|
||||
chart.draw(gdata, options || defaultStackedColumnChartOptions);
|
||||
|
||||
}).fail(function () {
|
||||
$('#' + container).addClass('google-chart-error');
|
||||
@ -153,7 +150,7 @@ function googleStackedColumnChart(URL, container) {
|
||||
}
|
||||
}
|
||||
|
||||
function googleComboChart(URL, container) {
|
||||
function googleComboChart(URL, container, options) {
|
||||
if ($('#' + container).length == 1) {
|
||||
$.getJSON(URL).success(function (data) {
|
||||
/*
|
||||
@ -180,7 +177,7 @@ function googleComboChart(URL, container) {
|
||||
/*
|
||||
Draw it:
|
||||
*/
|
||||
chart.draw(gdata, defaultComboChartOptions);
|
||||
chart.draw(gdata, options || defaultComboChartOptions);
|
||||
|
||||
}).fail(function () {
|
||||
$('#' + container).addClass('google-chart-error');
|
||||
@ -190,7 +187,7 @@ function googleComboChart(URL, container) {
|
||||
}
|
||||
}
|
||||
|
||||
function googlePieChart(URL, container) {
|
||||
function googlePieChart(URL, container, options) {
|
||||
if ($('#' + container).length == 1) {
|
||||
$.getJSON(URL).success(function (data) {
|
||||
/*
|
||||
@ -218,7 +215,7 @@ function googlePieChart(URL, container) {
|
||||
/*
|
||||
Draw it:
|
||||
*/
|
||||
chart.draw(gdata, defaultPieChartOptions);
|
||||
chart.draw(gdata, options || defaultPieChartOptions);
|
||||
|
||||
}).fail(function () {
|
||||
$('#' + container).addClass('google-chart-error');
|
||||
@ -228,7 +225,7 @@ function googlePieChart(URL, container) {
|
||||
}
|
||||
}
|
||||
|
||||
function googleSankeyChart(URL, container) {
|
||||
function googleSankeyChart(URL, container, options) {
|
||||
if ($('#' + container).length == 1) {
|
||||
$.getJSON(URL).success(function (data) {
|
||||
/*
|
||||
@ -258,7 +255,7 @@ function googleSankeyChart(URL, container) {
|
||||
/*
|
||||
Draw it:
|
||||
*/
|
||||
chart.draw(gdata, defaultSankeyChartOptions);
|
||||
chart.draw(gdata, options || defaultSankeyChartOptions);
|
||||
|
||||
}).fail(function () {
|
||||
$('#' + container).addClass('google-chart-error');
|
||||
|
@ -20,9 +20,7 @@
|
||||
|
||||
require __DIR__.'/../bootstrap/autoload.php';
|
||||
|
||||
/*
|
||||
* TODO: add "Create new X" button to any list there is: categories, accounts, piggies, etc.
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user