Fix charts for #595, account overview.

This commit is contained in:
James Cole
2017-02-25 13:19:42 +01:00
parent de9ef20014
commit 2e637031ac
3 changed files with 61 additions and 117 deletions

View File

@@ -295,103 +295,6 @@ class AccountController extends Controller
return view('accounts.show', compact('account', 'accountType', 'periods', 'subTitleIcon', 'journals', 'subTitle', 'start', 'end', 'chartUri'));
}
// /**
// * @param Request $request
// * @param JournalCollectorInterface $collector
// * @param Account $account
// *
// * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|View
// */
// public function show(Request $request, JournalCollectorInterface $collector, Account $account)
// {
// if ($account->accountType->type === AccountType::INITIAL_BALANCE) {
// return $this->redirectToOriginalAccount($account);
// }
// // show journals from current period only:
// $subTitleIcon = config('firefly.subIconsByIdentifier.' . $account->accountType->type);
// $subTitle = $account->name;
// $range = Preferences::get('viewRange', '1M')->data;
// $start = session('start', Navigation::startOfPeriod(new Carbon, $range));
// $end = session('end', Navigation::endOfPeriod(new Carbon, $range));
// $page = intval($request->get('page')) === 0 ? 1 : intval($request->get('page'));
// $pageSize = intval(Preferences::get('transactionPageSize', 50)->data);
// $chartUri = route('chart.account.single', [$account->id]);
// $accountType = $account->accountType->type;
//
// // grab those journals:
// $collector->setAccounts(new Collection([$account]))->setRange($start, $end)->setLimit($pageSize)->setPage($page);
// $journals = $collector->getPaginatedJournals();
// $journals->setPath('accounts/show/' . $account->id);
//
// // generate entries for each period (and cache those)
// $entries = $this->periodEntries($account);
//
// return view('accounts.show', compact('account', 'accountType', 'entries', 'subTitleIcon', 'journals', 'subTitle', 'start', 'end', 'chartUri'));
// }
//
// /**
// * @param Request $request
// * @param AccountRepositoryInterface $repository
// * @param Account $account
// *
// * @return View
// */
// public function showAll(Request $request, AccountRepositoryInterface $repository, Account $account)
// {
// $subTitle = sprintf('%s (%s)', $account->name, strtolower(trans('firefly.everything')));
// $page = intval($request->get('page')) === 0 ? 1 : intval($request->get('page'));
// $pageSize = intval(Preferences::get('transactionPageSize', 50)->data);
// $chartUri = route('chart.account.all', [$account->id]);
//
// // replace with journal collector:
// /** @var JournalCollectorInterface $collector */
// $collector = app(JournalCollectorInterface::class);
// $collector->setUser(auth()->user());
// $collector->setAccounts(new Collection([$account]))->setLimit($pageSize)->setPage($page);
// $journals = $collector->getPaginatedJournals();
// $journals->setPath('accounts/show/' . $account->id . '/all');
//
// // get oldest and newest journal for account:
// $start = $repository->oldestJournalDate($account);
// $end = $repository->newestJournalDate($account);
//
// // same call, except "entries".
// return view('accounts.show', compact('account', 'subTitleIcon', 'journals', 'subTitle', 'start', 'end', 'chartUri'));
// }
//
// /**
// * @param Request $request
// * @param Account $account
// * @param string $date
// *
// * @return View
// */
// public function showByDate(Request $request, Account $account, string $date)
// {
// $carbon = new Carbon($date);
// $range = Preferences::get('viewRange', '1M')->data;
// $start = Navigation::startOfPeriod($carbon, $range);
// $end = Navigation::endOfPeriod($carbon, $range);
// $subTitle = $account->name . ' (' . Navigation::periodShow($start, $range) . ')';
// $page = intval($request->get('page')) === 0 ? 1 : intval($request->get('page'));
// $pageSize = intval(Preferences::get('transactionPageSize', 50)->data);
// $chartUri = route('chart.account.period', [$account->id, $carbon->format('Y-m-d')]);
// $accountType = $account->accountType->type;
//
// // replace with journal collector:
// /** @var JournalCollectorInterface $collector */
// $collector = app(JournalCollectorInterface::class);
// $collector->setAccounts(new Collection([$account]))->setRange($start, $end)->setLimit($pageSize)->setPage($page);
// $journals = $collector->getPaginatedJournals();
// $journals->setPath('accounts/show/' . $account->id . '/' . $date);
//
// // generate entries for each period (and cache those)
// $entries = $this->periodEntries($account);
//
// // same call, except "entries".
// return view('accounts.show', compact('account', 'accountType', 'entries', 'subTitleIcon', 'journals', 'subTitle', 'start', 'end', 'chartUri'));
// }
/**
* @param AccountFormRequest $request
* @param AccountRepositoryInterface $repository