Expand account controller with meta data (edit / update routine).

This commit is contained in:
James Cole 2014-12-05 21:39:04 +01:00
parent 7cbd41137d
commit 0d37288129

View File

@ -131,11 +131,13 @@ class AccountController extends BaseController
*/
public function edit(Account $account)
{
$prefilled = [];
switch ($account->accountType->type) {
case 'Asset account':
case 'Default account':
$subTitleIcon = 'fa-money';
$subTitleIcon = 'fa-money';
$prefilled['account_role'] = $account->getMeta('accountRole');
break;
case 'Expense account':
case 'Beneficiary account':
@ -154,14 +156,14 @@ class AccountController extends BaseController
if (!is_null($openingBalance)) {
$prefilled['openingbalancedate'] = $openingBalance->date->format('Y-m-d');
$prefilled['openingbalance'] = floatval($openingBalance->transactions()->where('account_id', $account->id)->first()->amount);
Session::flash('prefilled', $prefilled);
}
Session::flash('prefilled', $prefilled);
return View::make('accounts.edit')->with('account', $account)->with('openingBalance', $openingBalance)->with(compact('subTitleIcon'))->with(
return View::make('accounts.edit', compact('account', 'openingBalance', 'subTitleIcon'))->with(
'subTitle', 'Edit ' . strtolower(
$account->accountType->type
) . ' "' . $account->name . '"'
);
)->with('roles', Config::get('firefly.accountRoles'));
}
/**