mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Some preliminary work on issue #6. Breaks a lot of tests. [skip ci]
This commit is contained in:
101
app/views/piggybanks/create-piggybank.blade.php
Normal file
101
app/views/piggybanks/create-piggybank.blade.php
Normal file
@@ -0,0 +1,101 @@
|
||||
@extends('layouts.default')
|
||||
@section('content')
|
||||
<div class="row">
|
||||
<div class="col-lg-12 col-md-12 col-sm-12">
|
||||
<h1>Firefly
|
||||
<small>Create a new piggy bank</small>
|
||||
</h1>
|
||||
<p class="lead">Use piggy banks to save for a one-time goal.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{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'),['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">€</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"/>
|
||||
<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>
|
||||
</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"/>
|
||||
<span class="help-block">This field indicates when you want to have saved the indicated amount.</span>
|
||||
</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
|
||||
@section('scripts')
|
||||
<?php echo javascript_include_tag('piggybanks-create'); ?>
|
||||
@stop
|
||||
@@ -16,152 +16,37 @@
|
||||
to the piggy bank.
|
||||
</p>
|
||||
<p>
|
||||
<a href="{{route('piggybanks.create')}}" class="btn btn-success">Create new piggy bank</a>
|
||||
<a href="{{route('piggybanks.create.piggybank')}}" class="btn btn-success">Create new piggy bank</a>
|
||||
</p>
|
||||
</div>
|
||||
<div class="col-lg-6 col-md-6 col-sm-12">
|
||||
<p class="lead">Repeated expenses</p>
|
||||
<p class="lead">Save money for repeated expenses</p>
|
||||
<p class="text-info">
|
||||
Taxes are due every year. Or maybe you want to save up for your yearly fireworks-binge. Buy a new smart
|
||||
phone every three years. Firefly can help you organize these repeated expenses.
|
||||
</p>
|
||||
<p>
|
||||
<a href="{{route('piggybanks.create')}}" class="btn btn-success">Create new repeated expense</a>
|
||||
<a href="{{route('piggybanks.create.repeated')}}" class="btn btn-success">Create new repeated expense</a>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
{{--
|
||||
|
||||
<p class="text-info">
|
||||
Saving money is <em>hard</em>. Firefly's piggy banks can help you to save money. You can do two things using
|
||||
these piggy banks:
|
||||
</p>
|
||||
<ol class="text-info">
|
||||
<li>Save money towards a singular goal such as a new bike or a new car.</li>
|
||||
<li>Save money repeatedly, for yearly expenses or long-term recurring investments. One example may be buying
|
||||
a new phone every three year.</li>
|
||||
</ol>
|
||||
@if($count == 0)
|
||||
<p>
|
||||
<a href="{{route('piggybanks.create')}}" class="btn btn-success">Create new piggy bank</a>
|
||||
</p>
|
||||
<div class="row">
|
||||
<div class="col-lg-6 col-md-6 col-sm-12">
|
||||
<h3>Current piggy banks</h3>
|
||||
@if($countNonRepeating == 0)
|
||||
<p class="text-warning">No piggy banks found.</p>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@if($count > 0)
|
||||
<div class="row">
|
||||
<div class="col-lg-12 col-md-12 col-sm-12">
|
||||
<h4>Accounts used for piggy banks</h4>
|
||||
<p class="text-info">
|
||||
@if(count($accounts) != 1)
|
||||
These (savings) accounts have
|
||||
@else
|
||||
This (savings) account has
|
||||
@endif
|
||||
@if(count($piggybanks) == 1)
|
||||
a piggy bank
|
||||
@else
|
||||
piggy banks
|
||||
@endif
|
||||
associated to
|
||||
@if(count($piggybanks) != 1)
|
||||
them.
|
||||
@else
|
||||
it.
|
||||
@endif
|
||||
If you transfer money to or from
|
||||
@if(count($accounts) != 1)
|
||||
these accounts,
|
||||
@else
|
||||
this account,
|
||||
@endif
|
||||
you may associate it with your @if(count($piggybanks) != 1)
|
||||
piggy banks.
|
||||
@else
|
||||
piggy bank.
|
||||
@endif
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-lg-6 col-md-6 col-sm-12">
|
||||
<table class="table table-striped">
|
||||
<tr>
|
||||
<th>Account</th>
|
||||
<th>Current balance</th>
|
||||
<th>Left for (other) piggy banks</th>
|
||||
<th>Total target</th>
|
||||
</tr>
|
||||
@foreach($accounts as $account)
|
||||
<tr>
|
||||
<td>{{{$account->name}}}</td>
|
||||
<td id="account_{{$account->id}}_total" data-raw="{{$account->balance}}">{{mf($account->balance)}}</td>
|
||||
<td id="account_{{$account->id}}_left" data-raw="{{$account->left}}">{{mf($account->left)}}</td>
|
||||
<td>{{mf($account->total)}}</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</table>
|
||||
<h3>Current repeated expenses</h3>
|
||||
@if($countRepeating == 0)
|
||||
<p class="text-warning">No repeated expenses found.</p>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-12 col-md-6 col-sm-12">
|
||||
<h3>Piggy banks</h3>
|
||||
|
||||
@foreach($piggybanks as $piggybank)
|
||||
<h4>
|
||||
<a href="{{route('piggybanks.show',$piggybank->id)}}">{{{$piggybank->name}}}</a>
|
||||
</h4>
|
||||
@endforeach
|
||||
|
||||
|
||||
@foreach($piggybanks as $piggybank)
|
||||
|
||||
@if(!is_null($piggybank->targetdate))
|
||||
<p>
|
||||
Target date: {{$piggybank->targetdate->format('jS F Y')}}
|
||||
</p>
|
||||
@endif
|
||||
<table class="table table-bordered">
|
||||
<tr>
|
||||
<td style="width:15%;">
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon">€</span>
|
||||
<input class="form-control" type="number" data-piggy="{{$piggybank->id}}" data-account="{{$piggybank->account_id}}" step="any" min="0" max="{{$piggybank->target}}" id="piggy_{{$piggybank->id}}_amount" value="{{$piggybank->amount}}" />
|
||||
</div>
|
||||
</td>
|
||||
<td><input type="range" data-account="{{$piggybank->account_id}}" name="piggy_{{$piggybank->id}}" min="0" max="{{$piggybank->target}}" step="any" value="{{$piggybank->amount}}" /></td>
|
||||
<td style="width: 10%;"><span id="piggy_{{$piggybank->id}}_pct">{{$piggybank->pct}}</span></td>
|
||||
<td style="width:8%;">
|
||||
<div class="btn-group btn-group-xs">
|
||||
<a href="{{route('piggybanks.edit',$piggybank->id)}}" class="btn btn-default btn-xs"><span class="glyphicon glyphicon-pencil"></span></a>
|
||||
<a href="{{route('piggybanks.delete',$piggybank->id)}}" class="btn btn-danger btn-xs"><span class="glyphicon glyphicon-trash"></span></a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
@endforeach
|
||||
<p>
|
||||
<a href="{{route('piggybanks.create')}}" class="btn btn-success">Create new piggy bank</a>
|
||||
</p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
--}}
|
||||
|
||||
@stop
|
||||
@section('scripts')
|
||||
<script type="text/javascript">
|
||||
var accountBalances = [];
|
||||
var accountLeft = [];
|
||||
@foreach($accounts as $account)
|
||||
accountBalances[{{$account->id}}] = {{$account->balance()}};
|
||||
accountLeft[{{$account->id}}] = {{$account->left}};
|
||||
@endforeach
|
||||
</script>
|
||||
|
||||
<?php echo javascript_include_tag('piggybanks'); ?>
|
||||
@stop
|
||||
Reference in New Issue
Block a user