diff --git a/app/controllers/HomeController.php b/app/controllers/HomeController.php index cc531aa560..86eb6feb1b 100644 --- a/app/controllers/HomeController.php +++ b/app/controllers/HomeController.php @@ -44,7 +44,8 @@ class HomeController extends BaseController /** @var \Firefly\Helper\Toolkit\ToolkitInterface $toolkit */ $toolkit = App::make('Firefly\Helper\Toolkit\ToolkitInterface'); $toolkit->prev(); - return Redirect::route('index'); + return Redirect::back(); + //return Redirect::route('index'); } /* @@ -54,7 +55,8 @@ class HomeController extends BaseController /** @var \Firefly\Helper\Toolkit\ToolkitInterface $toolkit */ $toolkit = App::make('Firefly\Helper\Toolkit\ToolkitInterface'); $toolkit->next(); - return Redirect::route('index'); + return Redirect::back(); + //return Redirect::route('index'); } /** diff --git a/app/lib/Firefly/Helper/Controllers/Json.php b/app/lib/Firefly/Helper/Controllers/Json.php index 25be47a7b4..91476fab0d 100644 --- a/app/lib/Firefly/Helper/Controllers/Json.php +++ b/app/lib/Firefly/Helper/Controllers/Json.php @@ -167,10 +167,13 @@ class Json implements JsonInterface /* * Loop set and create entries to return. */ + /** @var \TransactionJournal $entry */ foreach ($set as $entry) { $from = $entry->transactions[0]->account; $to = $entry->transactions[1]->account; - $data['data'][] = [ + $budget = $entry->budgets()->first(); + $category = $entry->categories()->first(); + $arr = [ 'date' => $entry->date->format('j F Y'), 'description' => [ 'description' => $entry->description, @@ -179,11 +182,31 @@ class Json implements JsonInterface 'amount' => floatval($entry->amount), 'from' => ['name' => $from->name, 'url' => route('accounts.show', $from->id)], 'to' => ['name' => $to->name, 'url' => route('accounts.show', $to->id)], + 'components' => [ + 'budget_id' => 0, + 'budget_url' => '', + 'budget_name' => '', + 'category_id' => 0, + 'category_url' => '', + 'category_name' => '' + ], 'id' => [ 'edit' => route('transactions.edit', $entry->id), 'delete' => route('transactions.delete', $entry->id) ] ]; + if($budget) { + $arr['components']['budget_id'] = $budget->id; + $arr['components']['budget_name'] = $budget->name; + $arr['components']['budget_url'] = route('budgets.show',$budget->id); + } + if($category) { + $arr['components']['category_id'] = $category->id; + $arr['components']['category_name'] = $category->name; + $arr['components']['category_url'] = route('categories.show',$category->id); + } + + $data['data'][] = $arr; } return $data; diff --git a/app/views/accounts/show.blade.php b/app/views/accounts/show.blade.php index 7142cb8109..f3148e26f8 100644 --- a/app/views/accounts/show.blade.php +++ b/app/views/accounts/show.blade.php @@ -1,88 +1,105 @@ @extends('layouts.default') @section('content')
-
-
+
+
+
+ {{{$account->name}}} +
+
+
+
- -
-
-

Summary For selected account and period

- +
+ + @include('partials.date_nav')
- - - - - - - - - - - - - - - - - - - - - - -
Expense / incomeTransfers
Out - {{mf($show['statistics']['period']['out'])}} - - - {{mf($show['statistics']['period']['t_out'])}} - -
In - {{mf($show['statistics']['period']['in'])}} - - - {{mf($show['statistics']['period']['t_in'])}} - -
Difference{{mf($show['statistics']['period']['diff'])}}{{mf($show['statistics']['period']['t_diff'])}}
+
+
+ Summary +
+
+ + + + + + + + + + + + + + + + + + + + + +
Expense / incomeTransfers
Out + {{mf($show['statistics']['period']['out'])}} + + + {{mf($show['statistics']['period']['t_out'])}} + +
In + {{mf($show['statistics']['period']['in'])}} + + + {{mf($show['statistics']['period']['t_in'])}} + +
Difference{{mf($show['statistics']['period']['diff'])}}{{mf($show['statistics']['period']['t_diff'])}}
+
+
- - @if(count($show['statistics']['accounts']) > 0) - - - - - @endif - @if(isset($show['statistics']['Category']) && count($show['statistics']['Category']) > 0) - - - - - @endif - @if(isset($show['statistics']['Budget']) && count($show['statistics']['Budget']) > 0) - - - - - @endif -
Related accounts - @foreach($show['statistics']['accounts'] as $acct) - {{{$acct->name}}} - @endforeach -
Related categories - @foreach($show['statistics']['Category'] as $cat) - {{{$cat->name}}} - @endforeach -
Related budgets - @foreach($show['statistics']['Budget'] as $bud) - {{{$bud->name}}} - @endforeach -
+
+
+ Related +
+
+ + @if(count($show['statistics']['accounts']) > 0) + + + + + @endif + @if(isset($show['statistics']['Category']) && count($show['statistics']['Category']) > 0) + + + + + @endif + @if(isset($show['statistics']['Budget']) && count($show['statistics']['Budget']) > 0) + + + + + @endif +
Related accounts + @foreach($show['statistics']['accounts'] as $acct) + {{{$acct->name}}} + @endforeach +
Related categories + @foreach($show['statistics']['Category'] as $cat) + {{{$cat->name}}} + @endforeach +
Related budgets + @foreach($show['statistics']['Budget'] as $bud) + {{{$bud->name}}} + @endforeach +
+
+
diff --git a/app/views/index.blade.php b/app/views/index.blade.php index de32cdf79a..353d5d703b 100644 --- a/app/views/index.blade.php +++ b/app/views/index.blade.php @@ -63,18 +63,7 @@
-
-
- - {{{\Session::get('period')}}} -
- -
+ @include('partials.date_nav') @foreach($transactions as $data) diff --git a/app/views/lists/transactions.blade.php b/app/views/lists/transactions.blade.php index 7dd5b0ec43..8ce89718cd 100644 --- a/app/views/lists/transactions.blade.php +++ b/app/views/lists/transactions.blade.php @@ -96,18 +96,25 @@ @endif @endforeach @if(isset($sum) && $sum == true) + @if($expenses != 0) Expenses: {{mf($expenses)}} + @endif + @if($incomes != 0) Incomes: {{mf($incomes)}} + @endif + @if($transfers != 0) Transfers: {{mf($transfers,false)}} + @endif @endif + \ No newline at end of file diff --git a/app/views/partials/date_nav.blade.php b/app/views/partials/date_nav.blade.php index 9670c6ac48..b1ee82d51e 100644 --- a/app/views/partials/date_nav.blade.php +++ b/app/views/partials/date_nav.blade.php @@ -1,52 +1,12 @@ -
-
-
- -
-
- -
-
-
- - - - - -
-
-
- -
-
- -
-
- -
-
- -
+
+
+ + {{{\Session::get('period')}}} +
+
\ No newline at end of file diff --git a/app/views/transactions/list.blade.php b/app/views/transactions/list.blade.php index c3610bf4a6..729a7d2263 100644 --- a/app/views/transactions/list.blade.php +++ b/app/views/transactions/list.blade.php @@ -15,6 +15,7 @@ Amount (€) From To + Budget / category ID diff --git a/public/assets/javascript/firefly/transactions.js b/public/assets/javascript/firefly/transactions.js index 7eced49f24..f674ca8222 100644 --- a/public/assets/javascript/firefly/transactions.js +++ b/public/assets/javascript/firefly/transactions.js @@ -81,6 +81,23 @@ $(document).ready(function () { return '' + data.name + ''; } }, + { + name: 'components', + data: 'components', + searchable: true, + sortable: false, + title: '', + render: function (data, type, full, meta) { + var html = ''; + if (data.budget_id > 0) { + html += ' '; + } + if (data.category_id > 0) { + html += ' '; + } + return html; + } + }, { name: 'id', data: 'id',