New buttons.

This commit is contained in:
Sander Dorigo 2014-10-08 21:04:31 +02:00
parent 1fbdb3d0ae
commit 1e76a5fc3f
3 changed files with 39 additions and 0 deletions

View File

@ -67,6 +67,18 @@ class TransactionController extends BaseController
$piggies = $toolkit->makeSelectList($piggyRepository->get());
$piggies[0] = '(no piggy bank)';
/*
* respond to a possible given values in the URL.
*/
$prefilled = Session::has('prefilled') ? Session::get('prefilled') : [];
$respondTo = ['account_id', 'account_from_id'];
foreach ($respondTo as $r) {
if (!is_null(Input::get($r))) {
$prefilled[$r] = Input::get($r);
}
}
Session::put('prefilled', $prefilled);
return View::make('transactions.create')->with('accounts', $assetAccounts)->with('budgets', $budgets)->with(
'what', $what
)->with('piggies', $piggies)->with('subTitle', 'Add a new ' . $what);

View File

@ -190,6 +190,14 @@ class Form
*/
$options['placeholder'] = ucfirst($name);
/*
* Get prefilled value:
*/
if(\Session::has('prefilled')) {
$prefilled = \Session::get('prefilled');
$value = isset($prefilled[$name]) ? $prefilled[$name] : null;
}
/*
* Get the value.
*/

View File

@ -82,6 +82,25 @@
<div class="panel-heading">
<i class="fa fa-money fa-fw"></i>
<a href="{{route('accounts.show',$data[1]->id)}}">{{{$data[1]->name}}}</a>
<!-- ACTIONS MENU -->
<div class="pull-right">
<div class="btn-group">
<button type="button" class="btn btn-default btn-xs dropdown-toggle" data-toggle="dropdown">
Actions
<span class="caret"></span>
</button>
<ul class="dropdown-menu pull-right" role="menu">
<li><a href="{{route('transactions.create','withdrawal')}}?account_id={{{$data[1]->id}}}"><i class="fa fa-long-arrow-left fa-fw"></i> New withdrawal</a></li>
<li><a href="{{route('transactions.create','deposit')}}?account_id={{{$data[1]->id}}}"><i class="fa fa-long-arrow-right fa-fw"></i> New deposit</a></li>
<li><a href="{{route('transactions.create','transfer')}}?account_from_id={{{$data[1]->id}}}"><i class="fa fa-arrows-h fa-fw"></i> New transfer</a></li>
</ul>
</div>
</div>
</div>
<div class="panel-body">
@include('transactions.journals-small-index',['transactions' => $data[0],'account' => $data[1]])