First basic version that "works". Now it's time to do some code cleanup. [skip ci]

This commit is contained in:
James Cole
2014-07-25 12:12:08 +02:00
parent 8338606db5
commit bcd48f2e49
6 changed files with 168 additions and 53 deletions

View File

@@ -65,50 +65,10 @@
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12">
<h4>Budgets</h4>
@foreach($budgets as $budget)
<h5><a href="{{route('budgets.show',$budget->id)}}">{{{$budget->name}}}</a>
@if($budget->count > 0)
@foreach($budget->limits as $limit)
@foreach($limit->limitrepetitions as $rep)
<small>{{mf($rep->amount,false)}}</small>
@endforeach
@endforeach
@endif
</h5>
@if($budget->count == 0)
<p>
<a href="{{route('budgets.limits.create',[$budget->id])}}?startdate={{\Session::get('start')->format('Y-m-d')}}&amp;repeat_freq={{\Config::get('firefly.range_to_repeat_freq.' . \Session::get('range'))}}" class="btn btn-xs btn-default"><span class="glyphicon glyphicon-envelope"></span> Add a new envelope</a>
</p>
@else
@foreach($budget->limits as $limit)
@foreach($limit->limitrepetitions as $rep)
@if($rep->left() < 0)
<!-- bar to display when over budget -->
<div class="progress progress-striped">
<div class="progress-bar progress-bar-warning" role="progressbar" aria-valuenow="{{$rep->spent_pct}}" aria-valuemin="0"
aria-valuemax="100" style="width: {{$rep->spent_pct}}%;min-width:30px;">{{mf($rep->amount,false)}}</div>
<div class="progress-bar progress-bar-danger" role="progressbar" aria-valuenow="{{$rep->overspent_pct}}" aria-valuemin="0"
aria-valuemax="100" style="width: {{$rep->overspent_pct}}%;min-width:30px;">{{mf($rep->overspent,false)}}
</div>
<div id="budgets">
</div>
@else
<!-- bar to display when UNDER budget -->
<div class="progress progress-striped">
<div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="{{$rep->spent_pct}}" aria-valuemin="0"
aria-valuemax="100" style="width: {{$rep->spent_pct}}%;min-width:80px;">{{mf($rep->spent,false)}}
</div>
<div class="progress-bar progress-bar-info" role="progressbar" aria-valuenow="{{$rep->left_pct}}" aria-valuemin="0"
aria-valuemax="100" style="width: {{$rep->left_pct}}%;min-width:30px;">{{mf($rep->left,false)}}
</div>
</div>
@endif
@endforeach
@endforeach
@endif
@endforeach
</div>
</div>

View File

@@ -53,7 +53,7 @@
@endif
</label>
<div class="col-sm-8">
{{Form::select('account_id',$accounts,Input::old('account_id'),['class' => 'form-control'])}}
{{Form::select('account_id',$accounts,Input::old('account_id') ?: Input::get('account'),['class' => 'form-control'])}}
</div>
</div>
@endif
@@ -107,7 +107,7 @@
@endif
</label>
<div class="col-sm-8">
<input type="number" name="amount" min="0.01" value="{{Input::old('amount') or 0}}" step="any" class="form-control" />
<input type="number" name="amount" min="0.01" value="{{Input::old('amount')}}" step="any" class="form-control" />
</div>
</div>
@@ -123,7 +123,7 @@
<div class="col-lg-6 col-md-12 col-sm-12">
<h4>Optional fields</h4>
<!-- ONLY WHEN CREATING A WITHDRAWAL -->
<!-- BUDGET ONLY WHEN CREATING A WITHDRAWAL -->
@if($what == 'withdrawal')
<div class="form-group">
<label for="budget_id" class="col-sm-4 control-label">Budget</label>
@@ -133,11 +133,11 @@
</div>
</div>
@endif
<!-- CATEGORY ALWAYS -->
<div class="form-group">
<label for="category" class="col-sm-4 control-label">Category</label>
<div class="col-sm-8">
<input type="text" name="category" value="" autocomplete="off" class="form-control" placeholder="Category" />
<input type="text" name="category" value="{{Input::old('category')}}" autocomplete="off" class="form-control" placeholder="Category" />
<span class="help-block">Add more fine-grained information to this transaction by entering a category.
Like the beneficiary-field, this field will auto-complete existing categories but can also be used
to create new ones.
@@ -156,7 +156,7 @@
<div class="col-sm-8">
<div class="checkbox">
<label>
<input type="checkbox" value="1" name="create">
<input type="checkbox" value="1" name="create" @if(Input::old('create') == '1') checked @endif>
Create another (return to this form)
</label>
</div>