diff --git a/app/config/homestead/mail.php b/app/config/homestead/mail.php
index 79a8bf2536..35d92d7f92 100644
--- a/app/config/homestead/mail.php
+++ b/app/config/homestead/mail.php
@@ -4,10 +4,10 @@ return [
'driver' => 'smtp',
'host' => 'smtp.gmail.com',
'port' => 587,
- 'from' => ['address' => '@gmail.com', 'name' => 'Firefly III'],
+ 'from' => ['address' => 'thegrumpydictator@gmail.com', 'name' => 'Firefly III'],
'encryption' => 'tls',
- 'username' => '@gmail.com',
- 'password' => '',
+ 'username' => 'thegrumpydictator@gmail.com',
+ 'password' => 'eyp-ort-ab-ig-york-ig-e-kne',
'sendmail' => '/usr/sbin/sendmail -bs',
'pretend' => false,
];
diff --git a/app/controllers/AccountController.php b/app/controllers/AccountController.php
index 8efebdd130..8844503c13 100644
--- a/app/controllers/AccountController.php
+++ b/app/controllers/AccountController.php
@@ -224,7 +224,7 @@ class AccountController extends BaseController
/** @var \FireflyIII\Database\Account $acct */
$acct = App::make('FireflyIII\Database\Account');
- $journals = $acct->getTransactionJournals($account, 50);
+ $journals = $acct->getTransactionJournals($account, 10);
//$data = $this->_accounts->show($account, 40);
diff --git a/app/controllers/BudgetController.php b/app/controllers/BudgetController.php
index 977cfcdb0d..0e7de74c14 100644
--- a/app/controllers/BudgetController.php
+++ b/app/controllers/BudgetController.php
@@ -191,17 +191,28 @@ class BudgetController extends BaseController
if (!is_null($repetition) && $repetition->limit->budget->id != $budget->id) {
App::abort(500);
}
+ /** @var \FireflyIII\Database\Budget $repos */
+ $repos = App::make('FireflyIII\Database\Budget');
if (is_null($repetition)) {
// get all other repetitions:
$limits = $budget->limits()->orderBy('startdate', 'DESC')->get();
+ // get all transaction journals for this budget.
+ $journals = $repos->getTransactionJournals($budget, 50);
+ $subTitle = $budget->name;
} else {
// get nothing? i dunno
$limits = [$repetition->limit];
+ // get all transaction journals for this budget and limit repetition.
+ $journals = [];
+ $subTitle = $budget->name.' in ' . $repetition->startdate->format('F Y');
+ $journals = $repos->getTransactionJournalsInRepetition($budget, $repetition, 50);
}
+ $hideBudget = true;
- return View::make('budgets.show', compact('limits', 'budget', 'repetition'));
+
+ return View::make('budgets.show', compact('limits', 'budget', 'repetition', 'journals','subTitle','hideBudget'));
}
/**
diff --git a/app/controllers/CategoryController.php b/app/controllers/CategoryController.php
index 220f476dcb..19ca21766f 100644
--- a/app/controllers/CategoryController.php
+++ b/app/controllers/CategoryController.php
@@ -65,7 +65,10 @@ class CategoryController extends BaseController
*/
public function index()
{
- return View::make('categories.index');
+ /** @var \FireflyIII\Database\Category $repos */
+ $repos = App::make('FireflyIII\Database\Category');
+ $categories = $repos->get();
+ return View::make('categories.index',compact('categories'));
}
/**
diff --git a/app/lib/FireflyIII/Database/Budget.php b/app/lib/FireflyIII/Database/Budget.php
index 03aa341f7b..98c1ab8b14 100644
--- a/app/lib/FireflyIII/Database/Budget.php
+++ b/app/lib/FireflyIII/Database/Budget.php
@@ -182,6 +182,36 @@ class Budget implements CUD, CommonDatabaseCalls, BudgetInterface
throw new NotImplementedException;
}
+ public function getTransactionJournals(\Budget $budget, $limit = 50)
+ {
+ $offset = intval(\Input::get('page')) > 0 ? intval(\Input::get('page')) * $limit : 0;
+ $set = $budget->transactionJournals()->withRelevantData()->take($limit)->offset($offset)->orderBy('date', 'DESC')->get(['transaction_journals.*']);
+ $count = $budget->transactionJournals()->count();
+ $items = [];
+ foreach ($set as $entry) {
+ $items[] = $entry;
+ }
+
+ return \Paginator::make($items, $count, $limit);
+
+ }
+
+ public function getTransactionJournalsInRepetition(\Budget $budget, \LimitRepetition $repetition, $limit = 50)
+ {
+ $start = $repetition->startdate;
+ $end = $repetition->enddate;
+
+ $offset = intval(\Input::get('page')) > 0 ? intval(\Input::get('page')) * $limit : 0;
+ $set = $budget->transactionJournals()->withRelevantData()->before($end)->after($start)->take($limit)->offset($offset)->orderBy('date', 'DESC')->get(['transaction_journals.*']);
+ $count = $budget->transactionJournals()->before($end)->after($start)->count();
+ $items = [];
+ foreach ($set as $entry) {
+ $items[] = $entry;
+ }
+
+ return \Paginator::make($items, $count, $limit);
+ }
+
/**
* @param \Budget $budget
* @param Carbon $date
@@ -210,10 +240,10 @@ class Budget implements CUD, CommonDatabaseCalls, BudgetInterface
return \Auth::user()->transactionjournals()->whereNotIn(
'transaction_journals.id', function ($query) use ($start, $end) {
$query->select('transaction_journals.id')->from('transaction_journals')->leftJoin(
- 'component_transaction_journal', 'component_transaction_journal.transaction_journal_id', '=', 'transaction_journals.id'
- )->leftJoin('components', 'components.id', '=', 'component_transaction_journal.component_id')->where(
- 'transaction_journals.date', '>=', $start->format('Y-m-d')
- )->where('transaction_journals.date', '<=', $end->format('Y-m-d'))->where('components.class', 'Budget');
+ 'component_transaction_journal', 'component_transaction_journal.transaction_journal_id', '=', 'transaction_journals.id'
+ )->leftJoin('components', 'components.id', '=', 'component_transaction_journal.component_id')->where(
+ 'transaction_journals.date', '>=', $start->format('Y-m-d')
+ )->where('transaction_journals.date', '<=', $end->format('Y-m-d'))->where('components.class', 'Budget');
}
)->before($end)->after($start)->lessThan(0)->transactionTypes(['Withdrawal'])->get();
}
diff --git a/app/models/Category.php b/app/models/Category.php
index c39e0642f6..e02cd71dac 100644
--- a/app/models/Category.php
+++ b/app/models/Category.php
@@ -31,4 +31,16 @@ class Category extends Component
{
return $this->belongsToMany('TransactionJournal', 'component_transaction_journal', 'component_id');
}
+ /**
+ * @return Carbon
+ */
+ public function lastActionDate()
+ {
+ $transaction = $this->transactionjournals()->orderBy('updated_at', 'DESC')->first();
+ if(is_null($transaction)) {
+ return null;
+ }
+
+ return $transaction->date;
+ }
}
\ No newline at end of file
diff --git a/app/views/budgets/show.blade.php b/app/views/budgets/show.blade.php
index dbf08c7f45..4af1bea550 100644
--- a/app/views/budgets/show.blade.php
+++ b/app/views/budgets/show.blade.php
@@ -17,7 +17,7 @@
Transactions
-
+ @include('list.journals-full')
diff --git a/app/views/categories/index.blade.php b/app/views/categories/index.blade.php
index 86cb093906..7731f88fe6 100644
--- a/app/views/categories/index.blade.php
+++ b/app/views/categories/index.blade.php
@@ -22,7 +22,7 @@
-
+ @include('list.categories')
diff --git a/app/views/list/accounts.blade.php b/app/views/list/accounts.blade.php
index 54f4ac7ecd..263a88aa32 100644
--- a/app/views/list/accounts.blade.php
+++ b/app/views/list/accounts.blade.php
@@ -26,7 +26,7 @@
lastActionDate(); ?>
@if($active)
- {{{$active->format('j F Y @ H:i')}}}
+ {{{$active->format('j F Y')}}}
@else
Never
@endif
diff --git a/app/views/list/categories.blade.php b/app/views/list/categories.blade.php
new file mode 100644
index 0000000000..ea64100e01
--- /dev/null
+++ b/app/views/list/categories.blade.php
@@ -0,0 +1,28 @@
+
+
+ | |
+ Name |
+ Last activity |
+
+ @foreach($categories as $category)
+
+ |
+
+ |
+
+ {{{$category->name}}}
+ |
+
+ lastActionDate(); ?>
+ @if($active)
+ {{{$active->format('j F Y')}}}
+ @else
+ Never
+ @endif
+ |
+
+ @endforeach
+
\ No newline at end of file
diff --git a/app/views/list/journals-full.blade.php b/app/views/list/journals-full.blade.php
index c07e757bda..768c7b1178 100644
--- a/app/views/list/journals-full.blade.php
+++ b/app/views/list/journals-full.blade.php
@@ -1,3 +1,6 @@
+@if(is_object($journals))
+{{$journals->links()}}
+@endif
| |
@@ -7,7 +10,9 @@
Date |
From |
To |
- |
+ @if(!isset($hideBudget) || (isset($hideBudget) && $hideBudget=== false))
+ |
+ @endif
|
|
@@ -64,12 +69,14 @@
{{{$journal->transactions[1]->account->name}}}
@endif
-
- budgets[0]) ? $journal->budgets[0] : null; ?>
- @if($budget)
- {{{$budget->name}}}
- @endif
- |
+ @if(!isset($hideBudget) || (isset($hideBudget) && $hideBudget=== false))
+
+ budgets[0]) ? $journal->budgets[0] : null; ?>
+ @if($budget)
+ {{{$budget->name}}}
+ @endif
+ |
+ @endif
categories[0]) ? $journal->categories[0] : null; ?>
@if($category)
@@ -87,4 +94,6 @@
@endforeach
|
-{{$journals->links()}}
\ No newline at end of file
+@if(is_object($journals))
+{{$journals->links()}}
+@endif
\ No newline at end of file
|