Basic code for tracking liabilities.

This commit is contained in:
James Cole
2018-08-04 17:30:47 +02:00
parent f0d3ca5d53
commit 8dbc846314
17 changed files with 161 additions and 43 deletions

View File

@@ -78,6 +78,26 @@ class CreateController extends Controller
$roles[$role] = (string)trans('firefly.account_role_' . $role);
}
// types of liability:
$debt = $this->repository->getAccountTypeByType(AccountType::DEBT);
$loan = $this->repository->getAccountTypeByType(AccountType::LOAN);
$mortgage = $this->repository->getAccountTypeByType(AccountType::MORTGAGE);
$creditCard = $this->repository->getAccountTypeByType(AccountType::CREDITCARD);
$liabilityTypes = [
$debt->id => (string)trans('firefly.account_type_' . AccountType::DEBT),
$loan->id => (string)trans('firefly.account_type_' . AccountType::LOAN),
$mortgage->id => (string)trans('firefly.account_type_' . AccountType::MORTGAGE),
$creditCard->id => (string)trans('firefly.account_type_' . AccountType::CREDITCARD),
];
asort($liabilityTypes);
// interest calculation periods:
$interestPeriods = [
'daily' => (string)trans('firefly.interest_calc_daily'),
'monthly' => (string)trans('firefly.interest_calc_monthly'),
'yearly' => (string)trans('firefly.interest_calc_yearly'),
];
// pre fill some data
$request->session()->flash('preFilled', ['currency_id' => $defaultCurrency->id]);
@@ -87,7 +107,7 @@ class CreateController extends Controller
}
$request->session()->forget('accounts.create.fromStore');
return view('accounts.create', compact('subTitleIcon', 'what', 'subTitle', 'roles'));
return view('accounts.create', compact('subTitleIcon', 'what','interestPeriods', 'subTitle', 'roles', 'liabilityTypes'));
}
@@ -100,6 +120,7 @@ class CreateController extends Controller
*/
public function store(AccountFormRequest $request)
{
$data = $request->getAccountData();
$account = $this->repository->store($data);
$request->session()->flash('success', (string)trans('firefly.stored_new_account', ['name' => $account->name]));