Fixed budget controller. [skip ci]

This commit is contained in:
James Cole
2014-07-28 21:33:32 +02:00
parent b0ddc04a0d
commit 1b919b1dab
20 changed files with 540 additions and 217 deletions

View File

@@ -74,7 +74,7 @@
</div>
<div class="col-sm-3">
<small>
CLOSURE TODO
{{$rep->periodShow()}}
</small>
</div>
@if($limit->repeats == 1)
@@ -94,7 +94,7 @@
@endforeach
@endforeach
<p style="margin-top:5px;">
<a href="{{route('budgets.limits.create',$budget->id)}}" class="btn btn-default btn-xs"><span
<a href="{{route('budgets.limits.create',$budget->id)}}?from=budget" class="btn btn-default btn-xs"><span
class="glyphicon-plus-sign glyphicon"></span> Add another envelope</a>
</p>
</td>

View File

@@ -53,7 +53,7 @@
</div>
</td>
<td>
<a href="{{route('budgets.show',$repetition->limit->budget->id)}}#transactions-in-this-period">
<a href="{{route('budgets.show',$repetition->limit->budget->id)}}?rep={{$repetition->id}}">
{{{$repetition->limit->budget->name}}}
</a>
</td>

View File

@@ -1,4 +1,69 @@
@extends('layouts.default')
@section('content')
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12">
<h1>Firefly
<small>Overview for budget "{{{$budget->name}}}"</small>
</h1>
@if(count($filters) == 0)
<p class="lead">Budgets can help you cut back on spending.</p>
@else
<p class="lead">
@if(isset($filters[0]) && is_object($filters[0]) && get_class($filters[0]) == 'Limit')
{{{$repetitions[0]['limitrepetition']->periodShow()}}}, {{mf($repetitions[0]['limit']->amount,false)}}
@elseif(isset($filters[0]) && $filters[0] == 'no_envelope')
These transactions are not caught in an envelope.
@endif
</p>
<p class="text-info">
<a href="{{route('budgets.show',$budget->id)}}">See the whole picture</a>
</p>
@endif
</div>
</div>
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12">
<p class="small text-center">(Some sort of chart here)</p>
</div>
</div>
@foreach($repetitions as $repetition)
@if(isset($repetition['journals']) && count($repetition['journals']) > 0)
<div class="row">
<div class="col-lg-12">
@if($repetition['paginated'] == true)
<h4>
<a href="{{route('budgets.show',$budget->id)}}?noenvelope=true">
{{$repetition['date']}}</a> <small>paginated</small></h4>
@else
<h4>
<a href="{{route('budgets.show',$budget->id)}}?rep={{$repetition['limitrepetition']->id}}">
{{$repetition['date']}}
</a>
</h4>
<small>{{mf($repetition['limit']->amount,false)}} (left: {{mf($repetition['limitrepetition']->left(),false)}})</small>
@endif
</h4>
@if($repetition['paginated'] == true)
@include('paginated.transactions',['journals' => $repetition['journals']])
@else
@include('lists.transactions',['journals' => $repetition['journals'],'sum' => true])
@endif
</div>
</div>
@else
<div class="row">
<div class="col-lg-12">
<h4>{{$repetition['date']}}
</h4>
<p><em>No transactions</em></p>
</div>
</div>
@endif
@endforeach
@stop

View File

@@ -0,0 +1,79 @@
<table class="table table-striped table-condensed">
<tr>
<th colspan="2"></th>
<th>Date</th>
<th>Description</th>
<th>Amount (&euro;)</th>
<th>From</th>
<th>To</th>
<th></th>
</tr>
<?php $total = 0; ?>
@foreach($journals as $journal)
<tr>
<td>
@if($journal->transactiontype->type == 'Withdrawal')
<span class="glyphicon glyphicon-arrow-left" title="Withdrawal"></span>
@endif
@if($journal->transactiontype->type == 'Deposit')
<span class="glyphicon glyphicon-arrow-right" title="Deposit"></span>
@endif
@if($journal->transactiontype->type == 'Transfer')
<span class="glyphicon glyphicon-resize-full" title="Transfer"></span>
@endif
@if($journal->transactiontype->type == 'Opening balance')
<span class="glyphicon glyphicon-ban-circle" title="Opening balance"></span>
@endif
</td>
<td>
@foreach($journal->components as $component)
@if($component->class == 'Budget')
<a href="#budget-overview"><span class="glyphicon glyphicon-tasks" title="Budget: {{{$component->name}}}"></span></a>
@endif
@if($component->class == 'Category')
<a href="#category-overview"><span class="glyphicon glyphicon-tag" title="Category: {{{$component->name}}}"></span></a>
@endif
@endforeach
</td>
<td>
{{$journal->date->format('d F Y')}}
</td>
<td><a href="{{route('transactions.show',$journal->id)}}" title="{{{$journal->description}}}">{{{$journal->description}}}</a></td>
<td>
@if($journal->transactiontype->type == 'Withdrawal')
<span class="text-danger">{{mf($journal->transactions[1]->amount,false)}}</span>
<?php $total -= $journal->transactions[1]->amount;?>
@endif
@if($journal->transactiontype->type == 'Deposit')
<span class="text-success">{{mf($journal->transactions[1]->amount,false)}}</span>
@endif
@if($journal->transactiontype->type == 'Transfer')
<span class="text-info">{{mf($journal->transactions[1]->amount,false)}}</span>
@endif
</td>
<td>
<a href="{{route('accounts.show',$journal->transactions[0]->account_id)}}">{{{$journal->transactions[0]->account->name}}}</a>
</td>
<td>
<a href="{{route('accounts.show',$journal->transactions[1]->account_id)}}">{{{$journal->transactions[1]->account->name}}}</a>
</td>
<td>
<div class="btn-group btn-group-xs">
<a href="{{route('transactions.edit',$journal->id)}}" class="btn btn-default">
<span class="glyphicon glyphicon-pencil"></span>
<a href="{{route('transactions.delete',$journal->id)}}" class="btn btn-danger">
<span class="glyphicon glyphicon-trash"></span>
</a>
</div>
</td>
</tr>
@endforeach
@if(isset($sum) && $sum == true)
<tr>
<td colspan="4">Sum:</td>
<td colspan="4">{{mf($total)}}</td>
</tr>
@endif
</table>

View File

@@ -1,71 +1,3 @@
<table class="table table-striped table-condensed">
<tr>
<th colspan="2"></th>
<th>Date</th>
<th>Description</th>
<th>Amount (&euro;)</th>
<th>From</th>
<th>To</th>
<th></th>
</tr>
@foreach($journals as $journal)
<tr>
<td>
@if($journal->transactiontype->type == 'Withdrawal')
<span class="glyphicon glyphicon-arrow-left" title="Withdrawal"></span>
@endif
@if($journal->transactiontype->type == 'Deposit')
<span class="glyphicon glyphicon-arrow-right" title="Deposit"></span>
@endif
@if($journal->transactiontype->type == 'Transfer')
<span class="glyphicon glyphicon-resize-full" title="Transfer"></span>
@endif
@if($journal->transactiontype->type == 'Opening balance')
<span class="glyphicon glyphicon-ban-circle" title="Opening balance"></span>
@endif
</td>
<td>
@foreach($journal->components as $component)
@if($component->class == 'Budget')
<a href="#budget-overview"><span class="glyphicon glyphicon-tasks" title="Budget: {{{$component->name}}}"></span></a>
@endif
@if($component->class == 'Category')
<a href="#category-overview"><span class="glyphicon glyphicon-tag" title="Category: {{{$component->name}}}"></span></a>
@endif
@endforeach
</td>
<td>
{{$journal->date->format('d F Y')}}
</td>
<td><a href="{{route('transactions.show',$journal->id)}}" title="{{{$journal->description}}}">{{{$journal->description}}}</a></td>
<td>
@if($journal->transactiontype->type == 'Withdrawal')
<span class="text-danger">{{mf($journal->transactions[1]->amount,false)}}</span>
@endif
@if($journal->transactiontype->type == 'Deposit')
<span class="text-success">{{mf($journal->transactions[1]->amount,false)}}</span>
@endif
@if($journal->transactiontype->type == 'Transfer')
<span class="text-info">{{mf($journal->transactions[1]->amount,false)}}</span>
@endif
</td>
<td>
<a href="{{route('accounts.show',$journal->transactions[0]->account_id)}}">{{{$journal->transactions[0]->account->name}}}</a>
</td>
<td>
<a href="{{route('accounts.show',$journal->transactions[1]->account_id)}}">{{{$journal->transactions[1]->account->name}}}</a>
</td>
<td>
<div class="btn-group btn-group-xs">
<a href="{{route('transactions.edit',$journal->id)}}" class="btn btn-default">
<span class="glyphicon glyphicon-pencil"></span>
<a href="{{route('transactions.delete',$journal->id)}}" class="btn btn-danger">
<span class="glyphicon glyphicon-trash"></span>
</a>
</div>
</td>
</tr>
@endforeach
</table>
{{$journals->links()}}
@include('lists.transactions')
{{$journals->links()}}