More views and options for limits [skip ci]

This commit is contained in:
James Cole
2014-07-24 06:47:28 +02:00
parent 30553ed7a3
commit 36901359d0
13 changed files with 280 additions and 82 deletions

View File

@@ -13,6 +13,7 @@
<tr>
<td>
<a href="{{route('budgets.show',$rep->limit->budget->id)}}">{{{$rep->limit->budget->name}}}</a>
</td>
<td>
<span class="label label-primary">
@@ -30,10 +31,15 @@
@endif
</td>
<td>
<a href="{{route('budgets.limits.delete',$rep->limit->id)}}" class="btn btn-xs btn-danger"><span class="glyphicon glyphicon-trash"></span></a>
<div class="btn-group">
<a href="{{route('budgets.limits.edit',$rep->limit->id)}}" class="btn btn-default btn-xs"><span class="glyphicon glyphicon-pencil"></span></a>
<a href="{{route('budgets.limits.delete',$rep->limit->id)}}" class="btn btn-xs btn-danger"><span class="glyphicon glyphicon-trash"></span></a>
</div>
@if($rep->limit->repeats == 1)
<span class="label label-warning">auto repeats</span>
@endif
<a href="{{route('budgets.limits.create',$rep->limit->budget->id)}}" class="btn btn-default btn-xs"><span
class="glyphicon-plus-sign glyphicon"></span> Add another limit</a>
</td>
</tr>
@endforeach

View File

@@ -9,20 +9,34 @@
</h1>
@if($count > 0)
<form role="form" class="form-horizontal">
<div class="input-group">
<div class="input-group">
<?php $r = Session::get('range','1M');?>
<span class="input-group-btn input-group-btn">
<button name="range" value="1D" class="btn btn-default @if($r=='1D') btn-info @endif btn-sm" type="submit">1D</button>
<button name="range" value="1W" class="btn btn-default @if($r=='1W') btn-info @endif btn-sm" type="submit">1W</button>
<button name="range" value="1M" class="btn btn-default @if($r=='1M') btn-info @endif btn-sm" type="submit">1M</button>
<button name="range" value="3M" class="btn btn-default @if($r=='3M') btn-info @endif btn-sm" type="submit">3M</button>
<button name="range" value="6M" class="btn btn-default @if($r=='6M') btn-info @endif btn-sm" type="submit">6M</button>
<?php $r = Session::get('range', '1M'); ?>
<span class="input-group-btn input-group-btn">
<button name="range" value="1D" class="btn btn-default @if($r=='1D') btn-info @endif btn-sm"
type="submit">1D
</button>
<button name="range" value="1W" class="btn btn-default @if($r=='1W') btn-info @endif btn-sm"
type="submit">1W
</button>
<button name="range" value="1M" class="btn btn-default @if($r=='1M') btn-info @endif btn-sm"
type="submit">1M
</button>
<button name="range" value="3M" class="btn btn-default @if($r=='3M') btn-info @endif btn-sm"
type="submit">3M
</button>
<button name="range" value="6M" class="btn btn-default @if($r=='6M') btn-info @endif btn-sm"
type="submit">6M
</button>
</span>
<input value="{{Session::get('start')->format('Y-m-d')}}" name="start" type="date" style="width:15%;border-right:0;" class="form-control input-sm">
<input value="{{Session::get('end')->format('Y-m-d')}}" name="end" type="date" style="width:15%;border-right:0;" class="form-control input-sm">
<button class="btn btn-default btn-sm @if($r=='custom') btn-info @endif" type="submit" name="range" value="custom">Custom</button>
</div>
<input value="{{Session::get('start')->format('Y-m-d')}}" name="start" type="date"
style="width:15%;border-right:0;" class="form-control input-sm">
<input value="{{Session::get('end')->format('Y-m-d')}}" name="end" type="date"
style="width:15%;border-right:0;" class="form-control input-sm">
<button class="btn btn-default btn-sm @if($r=='custom') btn-info @endif" type="submit" name="range"
value="custom">Custom
</button>
</div>
</form>
@endif
@@ -32,6 +46,7 @@
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12">
<p class="lead">Welcome to Firefly III.</p>
<p>
To get get started, choose below:
</p>
@@ -41,18 +56,19 @@
<div class="row">
<div class="col-lg-6 col-md-6 col-sm-12">
<h2><a href="{{route('migrate')}}">Migrate from Firefly II</a></h2>
<p>
Use this option if you have a JSON file from your current Firefly II installation.
</p>
</div>
<div class="col-lg-6 col-md-6 col-sm-12">
<h2><a href="#">Start from scratch</a></h2>
<p>
Use this option if you are new to Firefly (III).
</p>
</div>
@else
@else
<!-- ACCOUNTS -->
@@ -78,35 +94,44 @@
@endif
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12">
<h4>Budgets</h4>
<table class="table table-bordered">
@foreach($budgets as $budget)
<tr>
<td>
<a href="{{route('budgets.show',$budget->id)}}">{{{$budget->name}}}</a>
</td>
@if($budget->count == 0)
<td colspan="2">
<em>No budget set for this period.</em>
</td>
@else
@foreach($budget->limits as $limit)
@foreach($limit->limitrepetitions as $rep)
<td>
{{mf($rep->amount)}}
</td>
<td>
{{mf($rep->left())}}
</td>
@endforeach
@endforeach
@endif
</tr>
<h5><a href="{{route('budgets.show',$budget->id)}}">{{{$budget->name}}}</a></h5>
@if($budget->count == 0)
<p>
<small><em>No budget set for this period.</em></small>
</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>
@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
</table>
</div>
</div>
@@ -117,17 +142,16 @@
</div>
@endif
@endif
@stop
@section('scripts')
@stop
@section('scripts')
<script src="assets/javascript/highcharts.js"></script>
<script src="assets/javascript/highcharts-more.js"></script>
<script src="assets/javascript/highslide-full.min.js"></script>
<script src="assets/javascript/highslide.config.js"></script>
<script src="assets/javascript/index.js"></script>
@stop
@section('styles')
@stop
@section('styles')
<link href="assets/css/highslide.css" rel="stylesheet">
@stop
@stop

View File

@@ -0,0 +1,110 @@
@extends('layouts.default')
@section('content')
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12">
<h1>Firefly
<small>Edit limit of {{mf($limit->amount,false)}}
for budget {{{$limit->budget->name}}}
@if($limit->repeats == 0)
in {{$limit->limitrepetitions[0]->startdate->format('M Y')}} ({{$limit->repeat_freq}})
@endif
</small>
</h1>
<p class="text-info">
Firefly uses an "<a href="http://en.wikipedia.org/wiki/Envelope_System" class="text-success">envelope
system</a>" for your budgets, which means that for each period of time (for example a month) a virtual
"envelope" can be created containing a certain amount of money. Money spent within a budget is removed from
the envelope.
</p>
<p class="text-info">
Firefly gives you the opportunity to create such an envelope when you create a budget. However, you can
always add more of them.
</p>
</div>
</div>
{{Form::open(['class' => 'form-horizontal','url' => route('budgets.limits.update',$limit->id)])}}
<div class="row">
<div class="col-lg-6 col-md-12 col-sm-6">
<h4>Mandatory fields</h4>
<div class="form-group">
{{ Form::label('budget_id', 'Budget', ['class' => 'col-sm-3 control-label'])}}
<div class="col-sm-9">
{{Form::select('budget_id',$budgets,Input::old('budget_id') ?: $limit->component_id, ['class' =>
'form-control'])}}
@if($errors->has('budget_id'))
<p class="text-danger">{{$errors->first('name')}}</p>
@else
<span class="help-block">Select one of your existing budgets.</span>
@endif
</div>
</div>
<div class="form-group">
{{ Form::label('startdate', 'Start date', ['class' => 'col-sm-3 control-label'])}}
<div class="col-sm-9">
<input type="date" name="startdate" value="{{Input::old('startdate') ?: $limit->startdate->format('Y-m-d')}}"
class="form-control"/>
<span class="help-block">This date indicates when the envelope "starts". The date you select
here will correct itself to the nearest [period] you select below.</span>
</div>
</div>
<div class="form-group">
<label for="period" class="col-sm-3 control-label">Spending period</label>
<div class="col-sm-9">
{{Form::select('period',$periods,Input::old('period') ?: $limit->repeat_freq,['class' => 'form-control'])}}
<span class="help-block">How long will the envelope last? A week, a month, or even longer?</span>
</div>
</div>
<div class="form-group">
<label for="period" class="col-sm-3 control-label">Repeat</label>
<div class="col-sm-9">
<div class="checkbox">
<label>
<input type="checkbox" value="1" name="repeats" @if(intval(Input::old('repeats')) == 1 || intval($limit->repeats) == 1) checked @endif>
Repeat
</label>
</div>
<span class="help-block">If you want, Firefly can automatically recreate the "envelope" and fill it again
when the timespan above has expired. Be careful with this option though. It makes it easier
to <a href="http://en.wikipedia.org/wiki/Personal_budget#Concepts">fall back to old habits</a>.
Instead, you should recreate the envelope yourself each [period].</span>
</div>
</div>
<div class="form-group">
{{ Form::label('amount', 'Amount', ['class' => 'col-sm-3 control-label'])}}
<div class="col-sm-9">
<input type="number" value="{{Input::old('amount') ?: $limit->amount}}" name="amount" min="0.01" step="any" class="form-control"/>
<span class="help-block">Of course, there needs to be money in the envelope.</span>
</div>
</div>
<div class="form-group">
{{ Form::label('submit', '&nbsp;', ['class' => 'col-sm-3 control-label'])}}
<div class="col-sm-9">
<input type="submit" name="submit" value="Save new limit" class="btn btn-default"/>
</div>
</div>
</div>
</div>
{{Form::open()}}
@stop
@section('scripts')
<script type="text/javascript" src="assets/javascript/moment.min.js"></script>
<script type="text/javascript" src="assets/javascript/limits.js"></script>
@stop

View File

@@ -1,9 +1,9 @@
<table class="table table-bordered table-striped table-condensed">
<tr>
<th>&nbsp;</th>
<th>Description</th>
<th>Date</th>
<th>Amount</th>
<th><small>&nbsp;</small></th>
<th><small>Description</small></th>
<th style="min-width:100px;"><small>Date</small></th>
<th style="min-width:80px;"><small>Amount</small></th>
</tr>
@foreach($transactions as $journal)
<tr>
@@ -20,14 +20,15 @@
@endif
</td>
<td><a href="{{route('transactions.show',$journal->id)}}">{{{$journal->description}}}</a></td>
<td>{{$journal->date->format('jS M Y')}}</td>
<td>
<td><small><a href="{{route('transactions.show',$journal->id)}}">{{{$journal->description}}}</a></small></td>
<td><small>{{$journal->date->format('jS M Y')}}</small></td>
<td><small>
@foreach($journal->transactions as $t)
@if($t->account_id == $account->id)
{{mf($t->amount)}}
@endif
@endforeach
</small>
</td>
</tr>
@endforeach