diff --git a/app/Http/Controllers/AccountController.php b/app/Http/Controllers/AccountController.php index a0be3ef501..e5e2e8a919 100644 --- a/app/Http/Controllers/AccountController.php +++ b/app/Http/Controllers/AccountController.php @@ -7,7 +7,6 @@ use FireflyIII\Http\Requests; use FireflyIII\Http\Requests\AccountFormRequest; use FireflyIII\Models\Account; use FireflyIII\Repositories\Account\AccountRepositoryInterface; -use Illuminate\Pagination\LengthAwarePaginator; use Input; use Redirect; use Session; @@ -123,18 +122,14 @@ class AccountController extends Controller $subTitle = Config::get('firefly.subTitlesByIdentifier.' . $what); $subTitleIcon = Config::get('firefly.subIconsByIdentifier.' . $what); $types = Config::get('firefly.accountTypesByIdentifier.' . $what); - $size = 50; - $page = intval(Input::get('page')) == 0 ? 1 : intval(Input::get('page')); - $set = $repository->getAccounts($types, $page); - $total = $repository->countAccounts($types); - + $accounts = $repository->getAccounts($types); // last activity: /** * HERE WE ARE */ $start = clone Session::get('start', Carbon::now()->startOfMonth()); $start->subDay(); - $set->each( + $accounts->each( function (Account $account) use ($start, $repository) { $account->lastActivityDate = $repository->getLastActivity($account); $account->startBalance = Steam::balance($account, $start); @@ -142,10 +137,6 @@ class AccountController extends Controller } ); - $accounts = new LengthAwarePaginator($set, $total, $size, $page); - $accounts->setPath(route('accounts.index', $what)); - - return view('accounts.index', compact('what', 'subTitleIcon', 'subTitle', 'accounts')); } diff --git a/app/Http/Controllers/BillController.php b/app/Http/Controllers/BillController.php index f269af2954..d605b3d0ba 100644 --- a/app/Http/Controllers/BillController.php +++ b/app/Http/Controllers/BillController.php @@ -45,7 +45,7 @@ class BillController extends Controller $expense = null; // get users expense accounts: - $accounts = $repository->getAccounts(Config::get('firefly.accountTypesByIdentifier.expense'), -1); + $accounts = $repository->getAccounts(Config::get('firefly.accountTypesByIdentifier.expense')); foreach ($matches as $match) { $match = strtolower($match); diff --git a/app/Repositories/Account/AccountRepository.php b/app/Repositories/Account/AccountRepository.php index 50e4004f15..ba5a88fea7 100644 --- a/app/Repositories/Account/AccountRepository.php +++ b/app/Repositories/Account/AccountRepository.php @@ -53,26 +53,16 @@ class AccountRepository implements AccountRepositoryInterface /** * @param array $types - * @param int $page * * @return Collection */ - public function getAccounts(array $types, $page) + public function getAccounts(array $types) { - $query = Auth::user()->accounts()->with( + $result = Auth::user()->accounts()->with( ['accountmeta' => function (HasMany $query) { $query->where('name', 'accountRole'); }] - )->accountTypeIn($types)->orderBy('accounts.name', 'ASC'); - - if ($page == -1) { - $result = $query->get(['accounts.*']); - } else { - $size = 50; - $offset = ($page - 1) * $size; - - $result = $query->take($size)->offset($offset)->get(['accounts.*']); - } + )->accountTypeIn($types)->orderBy('accounts.name', 'ASC')->get(['accounts.*'])->sortBy('name'); return $result; } diff --git a/app/Repositories/Account/AccountRepositoryInterface.php b/app/Repositories/Account/AccountRepositoryInterface.php index a8dad3c2eb..0d533a0970 100644 --- a/app/Repositories/Account/AccountRepositoryInterface.php +++ b/app/Repositories/Account/AccountRepositoryInterface.php @@ -33,11 +33,10 @@ interface AccountRepositoryInterface /** * @param array $types - * @param int $page * * @return mixed */ - public function getAccounts(array $types, $page); + public function getAccounts(array $types); /** * @param TransactionJournal $journal diff --git a/resources/views/accounts/index.blade.php b/resources/views/accounts/index.blade.php index 09cdafce86..8f52cbd9ca 100644 --- a/resources/views/accounts/index.blade.php +++ b/resources/views/accounts/index.blade.php @@ -22,13 +22,16 @@ -
- @include('list.accounts') -
+ @include('list.accounts') @stop + +@section('styles') + +@stop + @section('scripts') + @stop diff --git a/resources/views/list/accounts.blade.php b/resources/views/list/accounts.blade.php index 11f60e0eea..2755b01252 100644 --- a/resources/views/list/accounts.blade.php +++ b/resources/views/list/accounts.blade.php @@ -1,18 +1,18 @@ -@if(is_object($accounts) && method_exists($accounts, 'render')) - {!! $accounts->render() !!} -@endif - +
+ - + @if(isset($what) && $what == 'asset') @endif - + + + @foreach($accounts as $account) @endif - - + - @else - Never + @endif - - @endforeach -
   NameRoleCurrent balance ActiveLast activityLast activity Balance difference between {{Session::get('start')->format('jS F Y')}} and {{Session::get('end')->format('jS F Y')}}
@@ -31,29 +31,30 @@ @endforeach {!! Amount::format(Steam::balance($account)) !!} + + {!! Amount::format($balance) !!} @if($account->active) @else @endif @if($account->lastActivityDate) - {{{$account->lastActivityDate->format('j F Y')}}} + + {{{$account->lastActivityDate->format('j F Y')}}} + + Never + + {!! Amount::format($account->endBalance - $account->startBalance) !!}
-@if(is_object($accounts) && method_exists($accounts, 'render')) - {!! $accounts->render() !!} -@endif + + \ No newline at end of file