Update and create transactions.

This commit is contained in:
James Cole
2015-02-27 14:27:04 +01:00
parent e685d262cc
commit 75aa3abcae
6 changed files with 299 additions and 34 deletions

View File

@@ -1,7 +1,7 @@
@extends('layouts.default')
@section('content')
{{ Breadcrumbs::renderIfExists(Route::getCurrentRoute()->getName(), $journal) }}
{{Form::open(['class' => 'form-horizontal','id' => 'destroy','url' => route('transactions.destroy',$journal->id)])}}
{!! Breadcrumbs::renderIfExists(Route::getCurrentRoute()->getName(), $journal) !!}
{!! Form::open(['class' => 'form-horizontal','id' => 'destroy','url' => route('transactions.destroy',$journal->id)]) !!}
<div class="row">
<div class="col-lg-6 col-md-6 col-sm-12">
@@ -38,6 +38,6 @@
</div>
</div>
{{Form::close()}}
{!! Form::close() !!}
@stop

View File

@@ -1,8 +1,10 @@
@extends('layouts.default')
@section('content')
{{ Breadcrumbs::renderIfExists(Route::getCurrentRoute()->getName(), $journal) }}
{{Form::open(['class' => 'form-horizontal','id' => 'update','url' => route('transactions.update',$journal->id)])}}
{!! Breadcrumbs::renderIfExists(Route::getCurrentRoute()->getName(), $journal) !!}
{!! Form::open(['class' => 'form-horizontal','id' => 'update','url' => route('transactions.update',$journal->id)]) !!}
<input type="hidden" name="id" value="{{$journal->id}}" />
<input type="hidden" name="what" value="{{$what}}" />
<div class="row">
<div class="col-lg-6 col-md-12 col-sm-12">
@@ -13,33 +15,33 @@
</div>
<div class="panel-body">
<!-- ALWAYS AVAILABLE -->
{{Form::ffText('description',$journal->description)}}
{!! ExpandedForm::text('description',$journal->description) !!}
<!-- SHOW ACCOUNT (FROM) ONLY FOR WITHDRAWALS AND DEPOSITS -->
@if($what == 'deposit' || $what == 'withdrawal')
{{Form::ffSelect('account_id',$accounts,$data['account_id'])}}
{!! ExpandedForm::select('account_id',$accounts,$data['account_id']) !!}
@endif
<!-- SHOW EXPENSE ACCOUNT ONLY FOR WITHDRAWALS -->
@if($what == 'withdrawal')
{{Form::ffText('expense_account',$data['expense_account'])}}
{!! ExpandedForm::text('expense_account',$data['expense_account']) !!}
@endif
<!-- SHOW REVENUE ACCOUNT ONLY FOR DEPOSITS -->
@if($what == 'deposit')
{{Form::ffText('revenue_account',$data['revenue_account'])}}
{!! ExpandedForm::text('revenue_account',$data['revenue_account']) !!}
@endif
<!-- ONLY SHOW FROM/TO ACCOUNT WHEN CREATING TRANSFER -->
@if($what == 'transfer')
{{Form::ffSelect('account_from_id',$accounts,$data['account_from_id'])}}
{{Form::ffSelect('account_to_id',$accounts,$data['account_to_id'])}}
{!! ExpandedForm::select('account_from_id',$accounts,$data['account_from_id']) !!}
{!! ExpandedForm::select('account_to_id',$accounts,$data['account_to_id']) !!}
@endif
<!-- ALWAYS SHOW AMOUNT -->
{{Form::ffAmount('amount',$data['amount'],['currency' => $journal->transactionCurrency])}}
{!! ExpandedForm::amount('amount',$data['amount'],['currency' => $journal->transactionCurrency]) !!}
<!-- ALWAYS SHOW DATE -->
{{Form::ffDate('date',$data['date'])}}
{!! ExpandedForm::date('date',$data['date']) !!}
</div>
</div> <!-- close panel -->
@@ -59,16 +61,16 @@
<div class="panel-body">
<!-- BUDGET ONLY WHEN CREATING A WITHDRAWAL -->
@if($what == 'withdrawal')
{{Form::ffSelect('budget_id',$budgets,$data['budget_id'])}}
{!! ExpandedForm::select('budget_id',$budgets,$data['budget_id']) !!}
@endif
<!-- CATEGORY ALWAYS -->
{{Form::ffText('category',$data['category'])}}
{!! ExpandedForm::text('category',$data['category']) !!}
<!-- TAGS -->
<!-- RELATE THIS TRANSFER TO A PIGGY BANK -->
@if($what == 'transfer' && count($piggies) > 0)
{{Form::ffSelect('piggy_bank_id',$piggies,$data['piggy_bank_id'])}}
{!! ExpandedForm::select('piggy_bank_id',$piggies,$data['piggy_bank_id']) !!}
@endif
</div>
</div><!-- end of panel for options-->
@@ -79,18 +81,16 @@
<i class="fa fa-bolt"></i> Options
</div>
<div class="panel-body">
{{Form::ffOptionsList('update','transaction')}}
{!! ExpandedForm::optionsList('update','transaction') !!}
</div>
</div>
</div>
</div>
</div>
</div>
{{Form::close()}}
{!! Form::close() !!}
@stop
@section('scripts')
{{HTML::script('assets/javascript/typeahead/bootstrap3-typeahead.min.js')}}
{{HTML::script('assets/javascript/firefly/transactions.js')}}
<script type="text/javascript" src="js/bootstrap3-typeahead.min.js"></script>
<script type="text/javascript" src="js/transactions.js"></script>
@stop