Mobile add money to piggy routine

This commit is contained in:
James Cole
2016-06-16 20:52:59 +02:00
parent 6267930938
commit ae649223d8
8 changed files with 88 additions and 15 deletions

View File

@@ -251,6 +251,7 @@ class AccountController extends Controller
$end = Navigation::subtractPeriod($end, $range, 1);
}
$cache->store($entries);
return view('accounts.show', compact('account', 'what', 'entries', 'subTitleIcon', 'journals', 'subTitle'));
}

View File

@@ -48,6 +48,26 @@ class PiggyBankController extends Controller
View::share('mainTitleIcon', 'fa-sort-amount-asc');
}
/**
* Add money to piggy bank (for mobile devices)
*
* @param ARI $repository
* @param PiggyBank $piggyBank
*
* @return $this
*/
public function addMobile(ARI $repository, PiggyBank $piggyBank)
{
/** @var Carbon $date */
$date = session('end', Carbon::now()->endOfMonth());
$leftOnAccount = $repository->leftOnAccount($piggyBank->account, $date);
$savedSoFar = $piggyBank->currentRelevantRep()->currentamount;
$leftToSave = bcsub($piggyBank->targetamount, $savedSoFar);
$maxAmount = min($leftOnAccount, $leftToSave);
return view('piggy-banks.add-mobile', compact('piggyBank', 'maxAmount'));
}
/**
* Add money to piggy bank
*

View File

@@ -320,9 +320,7 @@ class ReportController extends Controller
$incomes = $this->helper->getIncomeReport($start, $end, $accounts);
$expenses = $this->helper->getExpenseReport($start, $end, $accounts);
$tags = $this->helper->tagReport($start, $end, $accounts);
// find the budgets we've spent money on this period with these accounts:
$budgets = $this->budgetHelper->getBudgetsWithExpenses($start, $end, $accounts);
$budgets = $this->budgetHelper->budgetYearOverview($start, $end, $accounts);
Session::flash('gaEventCategory', 'report');
Session::flash('gaEventAction', 'year');