Added a show piggybank view, removed some others.

This commit is contained in:
James Cole 2014-11-13 07:50:55 +01:00
parent 2597633b0e
commit 981ffe4194
11 changed files with 223 additions and 1046 deletions

View File

@ -56,8 +56,8 @@ class PiggybankController extends BaseController
$accounts = $toolkit->makeSelectList($acct->getAssetAccounts());
return View::make('piggybanks.create', compact('accounts', 'periods'))->with('title', 'Piggy banks')->with('mainTitleIcon', 'fa-sort-amount-asc')->with(
'subTitle', 'Create new piggy bank'
)->with('subTitleIcon', 'fa-plus');
'subTitle', 'Create new piggy bank'
)->with('subTitleIcon', 'fa-plus');
}
/**
@ -68,8 +68,8 @@ class PiggybankController extends BaseController
public function delete(Piggybank $piggybank)
{
return View::make('piggybanks.delete')->with('piggybank', $piggybank)->with('subTitle', 'Delete "' . $piggybank->name . '"')->with(
'title', 'Piggy banks'
)->with('mainTitleIcon', 'fa-sort-amount-asc');
'title', 'Piggy banks'
)->with('mainTitleIcon', 'fa-sort-amount-asc');
}
/**
@ -212,9 +212,12 @@ class PiggybankController extends BaseController
return View::make('piggybanks.remove', compact('piggybank'));
}
public function show(Piggybank $piggyBank)
public function show(Piggybank $piggybank)
{
throw new NotImplementedException;
return View::make('piggybanks.show', compact('piggybank'))->with('title', 'Piggy banks')->with('mainTitleIcon', 'fa-sort-amount-asc')->with(
'subTitle', $piggybank->name
);
}

View File

@ -1,123 +0,0 @@
@extends('layouts.default')
@section('content')
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12">
<p class="lead">Use piggy banks to save for a one-time goal.</p>
</div>
<!-- TODO cleanup for new forms and layout. -->
{{Form::open(['class' => 'form-horizontal','url' => route('piggybanks.store.piggybank')])}}
<div class="row">
<div class="col-lg-6 col-md-12 col-sm-6">
<h4>Mandatory fields</h4>
<div class="form-group">
<label for="name" class="col-sm-4 control-label">Name</label>
<div class="col-sm-8">
<input type="text" name="name" class="form-control" id="name" value="{{Input::old('name')}}" placeholder="Name">
@if($errors->has('name'))
<p class="text-danger">{{$errors->first('name')}}</p>
@else
<span class="help-block">For example: new bike, new camera</span>
@endif
</div>
</div>
<div class="form-group">
<label for="account_id" class="col-sm-4 control-label">
Saving account
</label>
<div class="col-sm-8">
{{Form::select('account_id',$accounts,Input::old('account_id') ?: Input::get('account_id'),['class' => 'form-control'])}}
@if($errors->has('account_id'))
<p class="text-danger">{{$errors->first('account_id')}}</p>
@else
<span class="help-block">Indicate on which account you've got your savings.</span>
@endif
</div>
</div>
<div class="form-group">
{{ Form::label('targetamount', 'Target amount', ['class' => 'col-sm-4 control-label'])}}
<div class="col-sm-8">
<div class="input-group">
<span class="input-group-addon">&euro;</span>
{{Form::input('number','targetamount', Input::old('targetamount'), ['step' => 'any', 'min' => '1', 'class' => 'form-control'])}}
</div>
@if($errors->has('targetamount'))
<p class="text-danger">{{$errors->first('targetamount')}}</p>
@else
<span class="help-block">How much money do you need to save?</span>
@endif
</div>
</div>
</div>
<div class="col-lg-6 col-md-12 col-sm-6">
<h4>Optional fields</h4>
<div class="form-group">
{{ Form::label('startdate', 'Start date', ['class' => 'col-sm-4 control-label'])}}
<div class="col-sm-8">
<input type="date" name="startdate" value="{{Input::old('startdate') ?: date('Y-m-d')}}"
class="form-control"/>
@if($errors->has('startdate'))
<p class="text-danger">{{$errors->first('startdate')}}</p>
@else
<span class="help-block">This date indicates when you start(ed) saving money for this piggy bank. This field defaults to today and you should keep it on today.</span>
@endif
</div>
</div>
<div class="form-group">
{{ Form::label('targetdate', 'Target date', ['class' => 'col-sm-4 control-label'])}}
<div class="col-sm-8">
<input type="date" name="targetdate" value="{{Input::old('targetdate') ?: ''}}"
class="form-control"/>
@if($errors->has('targetdate'))
<p class="text-danger">{{$errors->first('targetdate')}}</p>
@else
<span class="help-block">If this piggy bank has a dead line, enter it here.</span>
@endif
</div>
</div>
<div class="form-group">
{{ Form::label('reminder', 'Remind you every', ['class' => 'col-sm-4 control-label'])}}
<div class="col-sm-8">
<input type="number" step="1" min="1" value="{{Input::old('reminder_skip') ?: 1}}" style="width:50px;display:inline;" max="100" name="reminder_skip" class="form-control" />
<select class="form-control" name="reminder" style="width:150px;display: inline">
<option value="none" label="do not remind me">do not remind me</option>
@foreach($periods as $period)
<option value="{{$period}}" label="{{$period}}">{{$period}}</option>
@endforeach
</select>
@if($errors->has('reminder'))
<p class="text-danger">{{$errors->first('reminder')}}</p>
@else
<span class="help-block">Enter a number and a period and Firefly will remind you to add money
to this piggy bank every now and then.</span>
@endif
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-6 col-md-12 col-sm-6">
<div class="form-group">
<div class="col-sm-offset-4 col-sm-8">
<button type="submit" class="btn btn-default btn-success">Create the piggy bank</button>
</div>
</div>
</div>
</div>
{{Form::close()}}
@stop

View File

@ -1,166 +0,0 @@
@extends('layouts.default')
@section('content')
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12">
<p class="lead">Create repeated expenses to keep track of long-term planned expenses</p>
</div><!-- TODO cleanup for new forms and layout. -->
</div>
{{Form::open(['class' => 'form-horizontal','url' => route('piggybanks.store.repeated')])}}
<div class="row">
<div class="col-lg-6 col-md-12 col-sm-6">
<h4>Mandatory fields</h4>
<div class="form-group">
<label for="name" class="col-sm-4 control-label">Name</label>
<div class="col-sm-8">
<input type="text" name="name" class="form-control" id="name" value="{{Input::old('name')}}" placeholder="Name">
@if($errors->has('name'))
<p class="text-danger">{{$errors->first('name')}}</p>
@else
<span class="help-block">For example: new bike, new camera</span>
@endif
</div>
</div>
<div class="form-group">
<label for="account_id" class="col-sm-4 control-label">
Saving account
</label>
<div class="col-sm-8">
{{Form::select('account_id',$accounts,Input::old('account_id') ?: Input::get('account_id'),['class' => 'form-control'])}}
@if($errors->has('account_id'))
<p class="text-danger">{{$errors->first('account_id')}}</p>
@else
<span class="help-block">Indicate on which account you've got your savings.</span>
@endif
</div>
</div>
<div class="form-group">
{{ Form::label('targetamount', 'Target amount', ['class' => 'col-sm-4 control-label'])}}
<div class="col-sm-8">
<div class="input-group">
<span class="input-group-addon">&euro;</span>
{{Form::input('number','targetamount', Input::old('targetamount'), ['step' => 'any', 'min' => '1', 'class' => 'form-control'])}}
</div>
@if($errors->has('targetamount'))
<p class="text-danger">{{$errors->first('targetamount')}}</p>
@else
<span class="help-block">How much money do you need to save?</span>
@endif
</div>
</div>
<div class="form-group">
{{ Form::label('targetdate', 'Target date', ['class' => 'col-sm-4 control-label'])}}
<div class="col-sm-8">
<input type="date" name="targetdate" value="{{Input::old('targetdate') ?: ''}}"
class="form-control"/>
@if($errors->has('targetdate'))
<p class="text-danger">{{$errors->first('targetdate')}}</p>
@else
<span class="help-block">A deadline is needed to properly repeat this repeated expesnse.</span>
@endif
</div>
</div>
<div class="form-group">
{{ Form::label('rep_every', 'Repeat every', ['class' => 'col-sm-4 control-label'])}}
<div class="col-sm-8">
<input type="number" step="1" min="1" value="{{Input::old('rep_every') ?: 1}}" style="width:50px;display:inline;" max="100" name="rep_every" class="form-control" />
<select class="form-control" name="rep_length" style="width:150px;display: inline">
@foreach($periods as $period)
@if($period == 'month' || Input::old('reminder') == $period)
<option value="{{$period}}" label="{{$period}}" selected="selected">{{$period}}</option>
@else
<option value="{{$period}}" label="{{$period}}">{{$period}}</option>
@endif
@endforeach
</select>
@if($errors->has('rep_length'))
<p class="text-danger">{{$errors->first('rep_length')}}</p>
@else
<span class="help-block">Something about every X years bla bla bla.</span>
@endif
</div>
</div>
</div>
<div class="col-lg-6 col-md-12 col-sm-6">
<h4>Optional fields</h4>
<div class="form-group">
{{ Form::label('startdate', 'Start date', ['class' => 'col-sm-4 control-label'])}}
<div class="col-sm-8">
<input type="date" name="startdate" value="{{Input::old('startdate') ?: date('Y-m-d')}}"
class="form-control"/>
@if($errors->has('startdate'))
<p class="text-danger">{{$errors->first('startdate')}}</p>
@else
<span class="help-block">This date indicates when you start(ed) saving money for this piggy bank. This field defaults to today and you should keep it on today.</span>
@endif
</div>
</div>
<div class="form-group">
{{ Form::label('reminder', 'Remind you every', ['class' => 'col-sm-4 control-label'])}}
<div class="col-sm-8">
<input type="number" step="1" min="1" value="{{Input::old('reminder_skip') ?: 1}}" style="width:50px;display:inline;" max="100" name="reminder_skip" class="form-control" />
<select class="form-control" name="reminder" style="width:150px;display: inline">
<option value="none" label="do not remind me">do not remind me</option>
@foreach($periods as $period)
<option value="{{$period}}" label="{{$period}}">{{$period}}</option>
@endforeach
</select>
@if($errors->has('reminder'))
<p class="text-danger">{{$errors->first('reminder')}}</p>
@else
<span class="help-block">Enter a number and a period and Firefly will remind you to save money
for this repeated expense every now and then.</span>
@endif
</div>
</div>
<!--
<div class="form-group">
{{ Form::label('targetdate', 'Target date', ['class' => 'col-sm-4 control-label'])}}
<div class="col-sm-8">
{{ Form::input('date','targetdate', Input::old('targetdate') ?: '', ['class'
=> 'form-control']) }}
@if($errors->has('targetdate'))
<p class="text-danger">{{$errors->first('targetdate')}}</p>
@else
<span class="help-block">
If you want to, set a target date. This will inform you how much money you should save to
get to the target amount.
</span>
@endif
</div>
</div>
-->
</div>
</div>
<div class="row">
<div class="col-lg-6 col-md-12 col-sm-6">
<div class="form-group">
<div class="col-sm-offset-4 col-sm-8">
<button type="submit" class="btn btn-default btn-success">Create the repeated expense</button>
</div>
</div>
</div>
</div>
{{Form::close()}}
@stop

View File

@ -1,42 +0,0 @@
@extends('layouts.default')
@section('content')
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12">
<p class="lead">Remember that deleting something is permanent.</p>
</div>
<!-- TODO cleanup for new forms and layout. -->
</div>
{{Form::open(['class' => 'form-horizontal','url' => route('piggybanks.destroy',$piggybank->id)])}}
<div class="row">
<div class="col-lg-6">
<h4>&nbsp;</h4>
<p class="text-info">
This form allows you to delete the piggy bank "{{{$piggybank->name}}}".
</p>
<p class="text-info">
Destroying an envelope does not remove any transactions or accounts.
</p>
<p class="text-danger">
Are you sure?
</p>
<div class="form-group">
<div class="col-sm-8">
<input type="submit" name="submit" value="Remove piggy bank" class="btn btn-danger" />
@if($piggybank->repeats == 1)
<a href="{{route('piggybanks.index.repeated')}}" class="btn-default btn">Cancel</a>
@else
<a href="{{route('piggybanks.index.piggybanks')}}" class="btn-default btn">Cancel</a>
@endif
</div>
</div>
</div>
</div>
{{Form::close()}}
@stop

View File

@ -1,137 +0,0 @@
@extends('layouts.default')
@section('content')
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12">
<p class="lead">Use piggy banks to save for a one-time goal.</p>
</div>
</div><!-- TODO cleanup for new forms and layout. -->
{{Form::open(['class' => 'form-horizontal','url' => route('piggybanks.update',$piggybank->id)])}}
<div class="row">
<div class="col-lg-6 col-md-12 col-sm-6">
<h4>Mandatory fields</h4>
<div class="form-group">
<label for="name" class="col-sm-4 control-label">Name</label>
<div class="col-sm-8">
<input type="text" name="name" class="form-control" id="name" value="{{Input::old('name') ?: $piggybank->name}}" placeholder="{{{$piggybank->name}}}">
@if($errors->has('name'))
<p class="text-danger">{{$errors->first('name')}}</p>
@else
<span class="help-block">For example: new bike, new camera</span>
@endif
</div>
</div>
<div class="form-group">
<label for="account_id" class="col-sm-4 control-label">
Saving account
</label>
<div class="col-sm-8">
{{Form::select('account_id',$accounts,Input::old('account_id') ?: $piggybank->account_id,['class' => 'form-control'])}}
@if($errors->has('account_id'))
<p class="text-danger">{{$errors->first('account_id')}}</p>
@else
<span class="help-block">Indicate on which account you've got your savings.</span>
@endif
</div>
</div>
<div class="form-group">
{{ Form::label('targetamount', 'Target amount', ['class' => 'col-sm-4 control-label'])}}
<div class="col-sm-8">
<div class="input-group">
<span class="input-group-addon">&euro;</span>
{{Form::input('number','targetamount', Input::old('targetamount') ?: $piggybank->targetamount, ['step' => 'any', 'min' => '1', 'class' => 'form-control'])}}
</div>
@if($errors->has('targetamount'))
<p class="text-danger">{{$errors->first('targetamount')}}</p>
@else
<span class="help-block">How much money do you need to save?</span>
@endif
</div>
</div>
</div>
<div class="col-lg-6 col-md-12 col-sm-6">
<h4>Optional fields</h4>
<div class="form-group">
{{ Form::label('startdate', 'Start date', ['class' => 'col-sm-4 control-label'])}}
<div class="col-sm-8">
@if(is_null($piggybank->startdate))
<input type="date" name="startdate" value="{{Input::old('startdate') ?: ''}}"
class="form-control"/>
@else
<input type="date" name="startdate" value="{{Input::old('startdate') ?: $piggybank->startdate->format('Y-m-d')}}"
class="form-control"/>
@endif
@if($errors->has('startdate'))
<p class="text-danger">{{$errors->first('startdate')}}</p>
@else
<span class="help-block">This date indicates when you start(ed) saving money for this piggy bank. This field defaults to today and you should keep it on today.</span>
@endif
</div>
</div>
<div class="form-group">
{{ Form::label('targetdate', 'Target date', ['class' => 'col-sm-4 control-label'])}}
<div class="col-sm-8">
@if(is_null($piggybank->targetdate))
<input type="date" name="targetdate" value="{{Input::old('targetdate') ?: ''}}"
class="form-control"/>
@else
<input type="date" name="targetdate" value="{{Input::old('targetdate') ?: $piggybank->targetdate->format('Y-m-d')}}"
class="form-control"/>
@endif
@if($errors->has('targetdate'))
<p class="text-danger">{{$errors->first('targetdate')}}</p>
@else
<span class="help-block">If this piggy bank has a dead line, enter it here.</span>
@endif
</div>
</div>
<div class="form-group">
{{ Form::label('reminder', 'Remind you every', ['class' => 'col-sm-4 control-label'])}}
<div class="col-sm-8">
<input type="number" step="1" min="1" value="{{Input::old('reminder_skip') ?: $piggybank->reminder_skip}}" style="width:50px;display:inline;" max="100" name="reminder_skip" class="form-control" />
<select class="form-control" name="reminder" style="width:150px;display: inline">
<option value="none" label="do not remind me">do not remind me</option>
@foreach($periods as $period)
@if($period == $piggybank->reminder)
<option value="{{$period}}" label="{{$period}}" selected="selected">{{$period}}</option>
@else
<option value="{{$period}}" label="{{$period}}">{{$period}}</option>
@endif
@endforeach
</select>
@if($errors->has('reminder'))
<p class="text-danger">{{$errors->first('reminder')}}</p>
@else
<span class="help-block">Enter a number and a period and Firefly will remind you to add money
to this piggy bank every now and then.</span>
@endif
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-6 col-md-12 col-sm-6">
<div class="form-group">
<div class="col-sm-offset-4 col-sm-8">
<button type="submit" class="btn btn-default btn-success">Update the piggy bank</button>
</div>
</div>
</div>
</div>
{{Form::close()}}
@stop

View File

@ -1,160 +0,0 @@
@extends('layouts.default')
@section('content')
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12">
<p class="lead">Create repeated expenses to keep track of long-term planned expenses</p>
</div>
</div>
<!-- TODO cleanup for new forms and layout. -->
{{Form::open(['class' => 'form-horizontal','url' => route('piggybanks.update',$piggybank->id)])}}
<div class="row">
<div class="col-lg-6 col-md-12 col-sm-6">
<h4>Mandatory fields</h4>
<div class="form-group">
<label for="name" class="col-sm-4 control-label">Name</label>
<div class="col-sm-8">
<input type="text" name="name" class="form-control" id="name" value="{{Input::old('name') ?: $piggybank->name}}" placeholder="Name">
@if($errors->has('name'))
<p class="text-danger">{{$errors->first('name')}}</p>
@else
<span class="help-block">For example: new bike, new camera</span>
@endif
</div>
</div>
<div class="form-group">
<label for="account_id" class="col-sm-4 control-label">
Saving account
</label>
<div class="col-sm-8">
{{Form::select('account_id',$accounts,Input::old('account_id') ?: $piggybank->account_id,['class' => 'form-control'])}}
@if($errors->has('account_id'))
<p class="text-danger">{{$errors->first('account_id')}}</p>
@else
<span class="help-block">Indicate on which account you've got your savings.</span>
@endif
</div>
</div>
<div class="form-group">
{{ Form::label('targetamount', 'Target amount', ['class' => 'col-sm-4 control-label'])}}
<div class="col-sm-8">
<div class="input-group">
<span class="input-group-addon">&euro;</span>
{{Form::input('number','targetamount', Input::old('targetamount') ?: $piggybank->targetamount, ['step' => 'any', 'min' => '1', 'class' => 'form-control'])}}
</div>
@if($errors->has('targetamount'))
<p class="text-danger">{{$errors->first('targetamount')}}</p>
@else
<span class="help-block">How much money do you need to save?</span>
@endif
</div>
</div>
<div class="form-group">
{{ Form::label('targetdate', 'Target date', ['class' => 'col-sm-4 control-label'])}}
<div class="col-sm-8">
@if(is_null($piggybank->targetdate))
<input type="date" name="targetdate" value="{{Input::old('targetdate') ?: ''}}"
class="form-control"/>
@else
<input type="date" name="targetdate" value="{{Input::old('targetdate') ?: $piggybank->targetdate->format('Y-m-d')}}"
class="form-control"/>
@endif
@if($errors->has('targetdate'))
<p class="text-danger">{{$errors->first('targetdate')}}</p>
@else
<span class="help-block">A deadline is needed to properly repeat this repeated expesnse.</span>
@endif
</div>
</div>
<div class="form-group">
{{ Form::label('rep_every', 'Repeat every', ['class' => 'col-sm-4 control-label'])}}
<div class="col-sm-8">
<input type="number" step="1" min="1" value="{{Input::old('rep_every') ?: $piggybank->rep_every}}" style="width:50px;display:inline;" max="100" name="rep_every" class="form-control" />
<select class="form-control" name="rep_length" style="width:150px;display: inline">
@foreach($periods as $period)
@if($period == $piggybank->rep_length || Input::old('reminder') == $period)
<option value="{{$period}}" label="{{$period}}" selected="selected">{{$period}}</option>
@else
<option value="{{$period}}" label="{{$period}}">{{$period}}</option>
@endif
@endforeach
</select>
@if($errors->has('rep_length'))
<p class="text-danger">{{$errors->first('rep_length')}}</p>
@else
<span class="help-block">Something about every X years bla bla bla.</span>
@endif
</div>
</div>
</div>
<div class="col-lg-6 col-md-12 col-sm-6">
<h4>Optional fields</h4>
<div class="form-group">
{{ Form::label('startdate', 'Start date', ['class' => 'col-sm-4 control-label'])}}
<div class="col-sm-8">
@if(is_null($piggybank->startdate))
<input type="date" name="startdate" value="{{Input::old('startdate') ?: ''}}"
class="form-control"/>
@else
<input type="date" name="startdate" value="{{Input::old('startdate') ?: $piggybank->startdate->format('Y-m-d')}}"
class="form-control"/>
@endif
@if($errors->has('startdate'))
<p class="text-danger">{{$errors->first('startdate')}}</p>
@else
<span class="help-block">This date indicates when you start(ed) saving money for this piggy bank. This field defaults to today and you should keep it on today.</span>
@endif
</div>
</div>
<div class="form-group">
{{ Form::label('reminder', 'Remind you every', ['class' => 'col-sm-4 control-label'])}}
<div class="col-sm-8">
<input type="number" step="1" min="1" value="{{Input::old('reminder_skip') ?: $piggybank->reminder_skip}}" style="width:50px;display:inline;" max="100" name="reminder_skip" class="form-control" />
<select class="form-control" name="reminder" style="width:150px;display: inline">
<option value="none" label="do not remind me">do not remind me</option>
@foreach($periods as $period)
@if($period == $piggybank->reminder)
<option value="{{$period}}" label="{{$period}}" selected="selected">{{$period}}</option>
@else
<option value="{{$period}}" label="{{$period}}">{{$period}}</option>
@endif
@endforeach
</select>
@if($errors->has('reminder'))
<p class="text-danger">{{$errors->first('reminder')}}</p>
@else
<span class="help-block">Enter a number and a period and Firefly will remind you to save money
for this repeated expense every now and then.</span>
@endif
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-6 col-md-12 col-sm-6">
<div class="form-group">
<div class="col-sm-offset-4 col-sm-8">
<button type="submit" class="btn btn-default btn-success">Update the repeated expense</button>
</div>
</div>
</div>
</div>
{{Form::close()}}
@stop

View File

@ -1,223 +0,0 @@
@extends('layouts.default')
@section('content')
@if($countNonRepeating > 0)
<div class="row">
@foreach($piggybanks as $piggyBank)
@if($piggyBank->repeats == 0)
<div class="col-lg-2 col-md-4 col-sm-6">
<div class="panel panel-default">
<div class="panel-heading">
<a href="{{route('piggybanks.show',$piggyBank->id)}}">{{{$piggyBank->name}}}</a>
</div>
<div class="panel-body">
<div class="progress" style="height:3px;">
<div class="progress-bar @if($piggyBank->currentRelevantRep()->pct() == 100)progress-bar-success @endif " role="progressbar" aria-valuenow="{{$piggyBank->currentRelevantRep()->pct()}}" aria-valuemin="0" aria-valuemax="100" style="width: {{$piggyBank->currentRelevantRep()->pct()}}%">
</div>
</div>
<p class="small">
{{mf($piggyBank->currentRelevantRep()->currentamount)}} of {{mf($piggyBank->targetamount)}}<br />
@if($piggyBank->targetamount-$piggyBank->currentRelevantRep()->currentamount > 0)
{{mf($piggyBank->targetamount-$piggyBank->currentRelevantRep()->currentamount)}} to go.
@endif
</p>
<div class="btn-group btn-group-xs">
<a href="{{route('piggybanks.edit',$piggyBank->id)}}" class="btn btn-default"><span class="glyphicon glyphicon-pencil"></span></a>
<a href="{{route('piggybanks.delete',$piggyBank->id)}}" class="btn btn-danger"><span class="glyphicon glyphicon-trash"></span></a>
@if($accounts[$piggyBank->account_id]['account']->leftOnAccount > 0)
<a data-toggle="modal" href="{{route('piggybanks.amount.add',$piggyBank->id)}}" data-target="#modal" class="btn btn-default"><span class="glyphicon glyphicon-plus-sign"></span></a>
@endif
@if($piggyBank->currentRelevantRep()->currentamount > 0)
<a data-toggle="modal" href="{{route('piggybanks.amount.remove',$piggyBank->id)}}" data-target="#modal" class="btn btn-default"><span class="glyphicon glyphicon-minus-sign"></span></a>
@endif
</div>
</div>
</div>
</div>
@endif
@endforeach
<div class="col-lg-2 col-md-4 col-sm-6">
<div class="panel panel-default">
<div class="panel-heading">
&nbsp;
</div>
<div class="panel-body">
<a href="{{route('piggybanks.create.piggybank')}}" class="btn btn-success btn-block">Add new piggybank</a>
</div>
</div>
</div>
</div>
@endif
{{--
<h3>Current piggy banks</h3>
@if($countNonRepeating == 0)
<p class="text-warning">No piggy banks found.</p>
@else
@foreach($piggybanks as $piggyBank)
@if($piggyBank->repeats == 0)
<h4></h4>
<table class="table table-bordered">
<tr>
<td style="width:10%;">{{mf($piggyBank->currentRelevantRep()->currentamount)}}</td>
<td colspan="2">
<div class="progress">
<div class="progress-bar
@if($piggyBank->currentRelevantRep()->pct() == 100)
progress-bar-success
@endif
" role="progressbar" aria-valuenow="{{$piggyBank->currentRelevantRep()->pct()}}" aria-valuemin="0" aria-valuemax="100" style="width: {{$piggyBank->currentRelevantRep()->pct()}}%;min-width: 30px;">
{{$piggyBank->currentRelevantRep()->pct()}}%
</div>
</div>
</td>
<td style="width:10%;">{{mf($piggyBank->targetamount)}}</td>
</tr>
<tr>
<td>
</td>
<td style="width:40%;">
<div class="btn-group-xs btn-group">
@if($accounts[$piggyBank->account_id]['account']->leftOnAccount > 0)
<a data-toggle="modal" href="{{route('piggybanks.amount.add',$piggyBank->id)}}" data-target="#modal" class="btn btn-default"><span class="glyphicon glyphicon-plus-sign"></span> Add money</a>
@endif
@if($piggyBank->currentRelevantRep()->currentamount > 0)
<a data-toggle="modal" href="{{route('piggybanks.amount.remove',$piggyBank->id)}}" data-target="#modal" class="btn btn-default"><span class="glyphicon glyphicon-minus-sign"></span> Remove money</a>
@endif
</div>
</td>
<td style="width:40%;">
<p class="small">
@if(!is_null($piggyBank->targetdate))
Target date: {{$piggyBank->targetdate->format('M jS, Y')}}<br />
@endif
@if(!is_null($piggyBank->reminder))
Next reminder: TODO
@endif
</p>
</td>
<td>
<div class="btn-group btn-group-xs">
<a href="{{route('piggybanks.edit',$piggyBank->id)}}" class="btn btn-default"><span class="glyphicon glyphicon-pencil"></span></a>
<a href="{{route('piggybanks.delete',$piggyBank->id)}}" class="btn btn-danger"><span class="glyphicon glyphicon-trash"></span></a>
</div>
</td>
</tr>
</table>
@endif
@endforeach
@endif
</div>
</div>
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12">
<h3>Current repeated expenses</h3>
@if($countRepeating == 0)
<p class="text-warning">No repeated expenses found.</p>
@else
@foreach($piggybanks as $repeated)
@if($repeated->repeats == 1)
<h4><a href="{{route('piggybanks.show',$repeated->id)}}">{{{$repeated->name}}}</a></h4>
<table class="table table-bordered">
<tr>
<td style="width:10%;">{{mf($repeated->currentRelevantRep()->currentamount)}}</td>
<td colspan="2">
<div class="progress">
<div class="progress-bar
@if($repeated->currentRelevantRep()->pct() == 100)
progress-bar-success
@endif
" role="progressbar" aria-valuenow="{{$repeated->currentRelevantRep()->pct()}}" aria-valuemin="0" aria-valuemax="100" style="width: {{$repeated->currentRelevantRep()->pct()}}%;min-width: 30px;">
{{$repeated->currentRelevantRep()->pct()}}%
</div>
</div>
</td>
<td style="width:10%;">{{mf($repeated->targetamount)}}</td>
</tr>
<tr>
<td>
</td>
<td style="width:40%;">
<div class="btn-group-xs btn-group">
@if($accounts[$repeated->account_id]['account']->leftOnAccount > 0)
<a data-toggle="modal" href="{{route('piggybanks.amount.add',$repeated->id)}}" data-target="#modal" class="btn btn-default"><span class="glyphicon glyphicon-plus-sign"></span> Add money</a>
@endif
@if($repeated->currentRelevantRep()->currentamount > 0)
<a data-toggle="modal" href="{{route('piggybanks.amount.remove',$repeated->id)}}" data-target="#modal" class="btn btn-default"><span class="glyphicon glyphicon-minus-sign"></span> Remove money</a>
@endif
</div>
</td>
<td style="width:40%;">
@if(!is_null($repeated->reminder))
<small>
Next reminder: TODO
</small>
@endif
</td>
<td>
<div class="btn-group btn-group-xs">
<a href="{{route('piggybanks.edit',$repeated->id)}}" class="btn btn-default"><span class="glyphicon glyphicon-pencil"></span></a>
<a href="{{route('piggybanks.delete',$repeated->id)}}" class="btn btn-danger"><span class="glyphicon glyphicon-trash"></span></a>
</div>
</td>
</tr>
</table>
@endif
@endforeach
@endif
</div>
</div>
--}}
<div class="row">
<div class="col-lg-12">
<h4>Account information</h4>
<table class="table">
<tr>
<th>Account</th>
<th>Left for piggy banks</th>
<th>Total planned savings</th>
<th>Saved so far</th>
<th>Left to save</th>
</tr>
@foreach($accounts as $account)
<tr>
<td>{{{$account['account']->name}}}</td>
<td>{{mf($account['left'])}}</td>
<td>{{mf($account['tosave'])}}</td>
<td>{{mf($account['saved'])}}</td>
<td>{{mf($account['tosave']-$account['saved'])}}</td>
</tr>
@endforeach
</table>
</div>
</div>
<!-- MODAL -->
<div class="modal fade" id="modal" tabindex="-1" role="dialog" aria-labelledby="modal" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
</div>
</div>
</div>
@stop

View File

@ -5,7 +5,7 @@
<div class="col-lg-6 col-md-6 col-sm-12">
<div class="panel panel-default">
<div class="panel-heading">
<i class="fa fa-fw fa-rocket"></i> <a href="#" title="{{{$piggybank->name}}}">{{{$piggybank->name}}}</a>
<i class="fa fa-fw fa-rocket"></i> <a href="{{route('piggybanks.show',$piggybank->id)}}" title="{{{$piggybank->name}}}">{{{$piggybank->name}}}</a>
</div>
<div class="panel-body">
<div class="row">

View File

@ -1,61 +0,0 @@
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
<h4 class="modal-title" id="myModalLabel">
@if($what == 'add')
Add money to "{{{$piggybank->name}}}"
@else
Remove money from "{{{$piggybank->name}}}"
@endif
</h4>
</div><!-- TODO cleanup for new forms and layout. -->
<form style="display: inline;" action="{{route('piggybanks.modMoney',$piggybank->id)}}" method="POST">
<input type="hidden" name="what" value="{{$what}}" />
{{Form::token()}}
<div class="modal-body">
<p class="text-info">
@if($what == 'add')
Usually you would add money to this
@if($piggybank->repeated == 1)
repeated expense
@else
piggy bank
@endif
by transferring it from one of your accounts to "{{{$piggybank->account->name}}}". However,
since there is still {{mf($maxAdd)}} you can add manually.
@else
If you need the money in this
@if($piggybank->repeated == 1)
repeated expense
@else
piggy bank
@endif
for something else, you can opt to remove it using this form. Since there is {{mf($maxRemove)}} in this
@if($piggybank->repeated == 1)
repeated expense
@else
piggy bank
@endif
that is the maximum amount of money you can remove using this form.
@endif
</p>
<div class="form-group">
<label for="amount">Amount to {{$what}}</label>
<div class="input-group">
<div class="input-group-addon">&euro;</div>
@if($what == 'add')
<input type="number" step="any" max="{{round(min($maxAdd,$piggybank->targetamount),2)}}" min="0.01" class="form-control" id="amount" name="amount">
@else
<input type="number" step="any" max="{{round($maxRemove,2)}}" min="0.01" class="form-control" id="amount" name="amount">
@endif
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<input type="submit" class="btn btn-primary" value="Submit" name="submit" />
</div>
</form>

View File

@ -1,127 +0,0 @@
@extends('layouts.default')
@section('content')
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12">
<div class="btn-group">
<a href="{{route('piggybanks.edit',$piggyBank->id)}}" class="btn btn-default"><span class="glyphicon glyphicon-pencil"></span> Edit</a>
<a href="{{route('piggybanks.delete',$piggyBank->id)}}" class="btn btn-danger"><span class="glyphicon glyphicon-trash"></span> Delete</a>
@if(min(max($balance,$leftOnAccount),$piggyBank->targetamount) > 0)
<a data-toggle="modal" href="{{route('piggybanks.amount.add',$piggyBank->id)}}" data-target="#modal" class="btn btn-default"><span class="glyphicon glyphicon-plus-sign"></span> Add money</a>
@endif
@if($piggyBank->currentRelevantRep()->currentamount > 0)
<a data-toggle="modal" href="{{route('piggybanks.amount.remove',$piggyBank->id)}}" data-target="#modal" class="btn btn-default"><span class="glyphicon glyphicon-minus-sign"></span> Remove money</a>
@endif
</div>
</div>
</div><!-- TODO cleanup for new forms and layout. -->
<div class="row">
<div class="col-lg-6 col-md-6 col-sm-12">
<h3>General information</h3>
<table class="table table-bordered table-striped">
<tr>
<th>Field</th>
<th>Value</th>
</tr>
<tr>
<td>Account</td>
<td><a href="{{route('accounts.show',$piggyBank->account_id)}}">{{{$piggyBank->account->name}}}</a></td>
</tr>
<tr>
<td>Target amount</td>
<td>{{mf($piggyBank->targetamount)}}</td>
</tr>
<tr>
<td>Start date</td>
<td>
@if(is_null($piggyBank->startdate))
<em>No start date</em>
@else
{{$piggyBank->startdate->format('jS F Y')}}
@endif
</td>
</tr>
<tr>
<td>Target date</td>
<td>
@if(is_null($piggyBank->targetdate))
<em>No target date</em>
@else
{{$piggyBank->targetdate->format('jS F Y')}}
@endif
</td>
</tr>
<tr>
<td>Repeats every</td>
<td>
@if(!is_null($piggyBank->rep_length))
Every {{$piggyBank->rep_every}} {{$piggyBank->rep_length}}(s)
@if(!is_null($piggyBank->rep_times))
({{$piggyBank->rep_times}} times)
@else
(indefinitely)
@endif
@else
<em>Does not repeat</em>
@endif
</td>
</tr>
<tr>
<td>Reminder</td>
<td>
@if(is_null($piggyBank->reminder))
<em>(no reminder)</em>
@else
Every {{$piggyBank->reminder_skip}} {{$piggyBank->reminder}}(s)
@endif
</td>
</tr>
</table>
</div>
<div class="col-lg-6 col-md-6 col-sm-12">
<h3>Piggy bank instances info</h3>
@foreach($piggyBank->piggybankrepetitions()->orderBy('startdate')->get() as $rep)
<table class="table table-bordered table-striped">
<tr>
<th style="width:50%;">Field</th>
<th>Value</th>
</tr>
<tr>
<td>ID</td>
<td>#{{$rep->id}}</td>
</tr>
<tr>
<td>Current amount</td>
<td>{{mf($rep->currentamount)}} of {{mf($piggyBank->targetamount)}}</td>
</tr>
<tr>
<td>Start date</td>
<td>
@if(is_null($rep->startdate))
<em>No start date</em>
@else
{{$rep->startdate->format('jS F Y')}}
@endif
</td>
</tr>
<tr>
<td>Target date</td>
<td>
@if(is_null($rep->targetdate))
<em>No target date</em>
@else
{{$rep->targetdate->format('jS F Y')}}
@endif
</td>
</tr>
</table>
@endforeach
</div>
</div>
@stop
@section('scripts')
@stop

View File

@ -0,0 +1,213 @@
@extends('layouts.default')
@section('content')
<div class="row">
<div class="col-lg-8 col-md-8 col-sm-6">
<div class="panel panel-default">
<div class="panel-heading">
<i class="fa fa-fw fa-clock-o"></i> Events
</div>
<div class="panel-body">
<div id="piggybank-history"></div> <!-- TODO -->
</div>
</div>
</div>
<div class="col-lg-4 col-md-4 col-sm-6">
<div class="panel panel-default">
<div class="panel-heading">
<i class="fa fa-fw fa-info-circle"></i> Details
</div>
<div class="panel-body">
<table class="table table-bordered table-striped">
<tr>
<td>Account</td>
<td><a href="{{route('accounts.show',$piggybank->account_id)}}">{{{$piggybank->account->name}}}</a></td>
</tr>
<tr>
<td>Target amount</td>
<td>{{mf($piggybank->targetamount)}}</td>
</tr>
<tr>
<td>Saved so far</td>
<td>{{mf(0)}}</td> <!-- TODO -->
</tr>
<tr>
<td>Left to save</td>
<td>{{mf(0)}}</td> <!-- TODO -->
</tr>
<tr>
<td>Start date</td>
<td>
@if(is_null($piggybank->startdate))
<em>No start date</em>
@else
{{$piggybank->startdate->format('jS F Y')}}
@endif
</td>
</tr>
<tr>
<td>Target date</td>
<td>
@if(is_null($piggybank->targetdate))
<em>No target date</em>
@else
{{$piggybank->targetdate->format('jS F Y')}}
@endif
</td>
</tr>
<tr>
<td>Reminder</td>
<td>
@if(intval($piggybank->remind_me) == 0)
<em>(no reminder)</em>
@else
Every
@if($piggybank->reminder_skip != 0)
{{$piggybank->reminder_skip}}
@endif
{{$piggybank->reminder}}(s)
@endif
</td>
</tr>
<tr>
<td>Reminders left</td>
<td>12</td> <!-- TODO -->
</tr>
<tr>
<td>Expected amount per reminder</td>
<td>{{mf(0)}}</td> <!-- TODO -->
</tr>
</table>
</div>
</div>
</div>
</div>
{{--
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12">
<div class="btn-group">
<a href="{{route('piggybanks.edit',$piggybank->id)}}" class="btn btn-default"><span class="glyphicon glyphicon-pencil"></span> Edit</a>
<a href="{{route('piggybanks.delete',$piggybank->id)}}" class="btn btn-danger"><span class="glyphicon glyphicon-trash"></span> Delete</a>
@if(min(max($balance,$leftOnAccount),$piggybank->targetamount) > 0)
<a data-toggle="modal" href="{{route('piggybanks.amount.add',$piggybank->id)}}" data-target="#modal" class="btn btn-default"><span class="glyphicon glyphicon-plus-sign"></span> Add money</a>
@endif
@if($piggybank->currentRelevantRep()->currentamount > 0)
<a data-toggle="modal" href="{{route('piggybanks.amount.remove',$piggybank->id)}}" data-target="#modal" class="btn btn-default"><span class="glyphicon glyphicon-minus-sign"></span> Remove money</a>
@endif
</div>
</div>
</div><!-- TODO cleanup for new forms and layout. -->
<div class="row">
<div class="col-lg-6 col-md-6 col-sm-12">
<h3>General information</h3>
<table class="table table-bordered table-striped">
<tr>
<th>Field</th>
<th>Value</th>
</tr>
<tr>
<td>Account</td>
<td><a href="{{route('accounts.show',$piggybank->account_id)}}">{{{$piggybank->account->name}}}</a></td>
</tr>
<tr>
<td>Target amount</td>
<td>{{mf($piggybank->targetamount)}}</td>
</tr>
<tr>
<td>Start date</td>
<td>
@if(is_null($piggybank->startdate))
<em>No start date</em>
@else
{{$piggybank->startdate->format('jS F Y')}}
@endif
</td>
</tr>
<tr>
<td>Target date</td>
<td>
@if(is_null($piggybank->targetdate))
<em>No target date</em>
@else
{{$piggybank->targetdate->format('jS F Y')}}
@endif
</td>
</tr>
<tr>
<td>Repeats every</td>
<td>
@if(!is_null($piggybank->rep_length))
Every {{$piggybank->rep_every}} {{$piggybank->rep_length}}(s)
@if(!is_null($piggybank->rep_times))
({{$piggybank->rep_times}} times)
@else
(indefinitely)
@endif
@else
<em>Does not repeat</em>
@endif
</td>
</tr>
<tr>
<td>Reminder</td>
<td>
@if(is_null($piggybank->reminder))
<em>(no reminder)</em>
@else
Every {{$piggybank->reminder_skip}} {{$piggybank->reminder}}(s)
@endif
</td>
</tr>
</table>
</div>
<div class="col-lg-6 col-md-6 col-sm-12">
<h3>Piggy bank instances info</h3>
@foreach($piggybank->piggybankrepetitions()->orderBy('startdate')->get() as $rep)
<table class="table table-bordered table-striped">
<tr>
<th style="width:50%;">Field</th>
<th>Value</th>
</tr>
<tr>
<td>ID</td>
<td>#{{$rep->id}}</td>
</tr>
<tr>
<td>Current amount</td>
<td>{{mf($rep->currentamount)}} of {{mf($piggybank->targetamount)}}</td>
</tr>
<tr>
<td>Start date</td>
<td>
@if(is_null($rep->startdate))
<em>No start date</em>
@else
{{$rep->startdate->format('jS F Y')}}
@endif
</td>
</tr>
<tr>
<td>Target date</td>
<td>
@if(is_null($rep->targetdate))
<em>No target date</em>
@else
{{$rep->targetdate->format('jS F Y')}}
@endif
</td>
</tr>
</table>
@endforeach
</div>
</div>
--}}
@stop
@section('scripts')
@stop