mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Expand account controller with meta data (edit / update routine).
This commit is contained in:
@@ -131,11 +131,13 @@ class AccountController extends BaseController
|
|||||||
*/
|
*/
|
||||||
public function edit(Account $account)
|
public function edit(Account $account)
|
||||||
{
|
{
|
||||||
|
$prefilled = [];
|
||||||
|
|
||||||
switch ($account->accountType->type) {
|
switch ($account->accountType->type) {
|
||||||
case 'Asset account':
|
case 'Asset account':
|
||||||
case 'Default account':
|
case 'Default account':
|
||||||
$subTitleIcon = 'fa-money';
|
$subTitleIcon = 'fa-money';
|
||||||
|
$prefilled['account_role'] = $account->getMeta('accountRole');
|
||||||
break;
|
break;
|
||||||
case 'Expense account':
|
case 'Expense account':
|
||||||
case 'Beneficiary account':
|
case 'Beneficiary account':
|
||||||
@@ -154,14 +156,14 @@ class AccountController extends BaseController
|
|||||||
if (!is_null($openingBalance)) {
|
if (!is_null($openingBalance)) {
|
||||||
$prefilled['openingbalancedate'] = $openingBalance->date->format('Y-m-d');
|
$prefilled['openingbalancedate'] = $openingBalance->date->format('Y-m-d');
|
||||||
$prefilled['openingbalance'] = floatval($openingBalance->transactions()->where('account_id', $account->id)->first()->amount);
|
$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(
|
'subTitle', 'Edit ' . strtolower(
|
||||||
$account->accountType->type
|
$account->accountType->type
|
||||||
) . ' "' . $account->name . '"'
|
) . ' "' . $account->name . '"'
|
||||||
);
|
)->with('roles', Config::get('firefly.accountRoles'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user