mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-04 19:53:44 +00:00
Some bug fixes and a new view for piggy banks. [skip ci]
This commit is contained in:
@@ -43,6 +43,10 @@ class HomeController extends BaseController
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
|
||||
\Event::fire('limits.check');
|
||||
\Event::fire('piggybanks.check');
|
||||
|
||||
// count, maybe we need some introducing text to show:
|
||||
$count = $this->_accounts->count();
|
||||
$start = Session::get('start');
|
||||
|
@@ -125,7 +125,7 @@ class EloquentPiggybankTrigger
|
||||
{
|
||||
|
||||
if (\Auth::check()) {
|
||||
$piggies = \Auth::user()->piggybanks()->whereNotNull('repeats')->get();
|
||||
$piggies = \Auth::user()->piggybanks()->where('repeats',1)->get();
|
||||
} else {
|
||||
$piggies = [];
|
||||
}
|
||||
|
@@ -12,7 +12,8 @@
|
||||
<p class="lead">Save money for large expenses</p>
|
||||
<p class="text-info">
|
||||
Saving money is <em>hard</em>. Firefly's piggy banks can help you to save money. Simply set the amount
|
||||
of money you want to save, set an optional target date and whether or not Firefly should remind you to add money
|
||||
of money you want to save, set an optional target date and whether or not
|
||||
Firefly should remind you to add money
|
||||
to the piggy bank.
|
||||
</p>
|
||||
<p>
|
||||
@@ -32,58 +33,177 @@
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-6 col-md-6 col-sm-12">
|
||||
<div class="col-lg-12 col-md-12 col-sm-12">
|
||||
<h3>Current piggy banks</h3>
|
||||
@if($countNonRepeating == 0)
|
||||
<p class="text-warning">No piggy banks found.</p>
|
||||
@else
|
||||
<table class="table table-bordered">
|
||||
@foreach($piggybanks as $piggyBank)
|
||||
@if($piggyBank->repeats == 0)
|
||||
<!-- display piggy bank -->
|
||||
<h4><a href="{{route('piggybanks.show',$piggyBank->id)}}">{{{$piggyBank->name}}}</a></h4>
|
||||
<table class="table">
|
||||
<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>
|
||||
<h4><a href="{{route('piggybanks.show',$piggyBank->id)}}">{{{$piggyBank->name}}}</a> <small> <span class="label label-default">{{$piggyBank->currentRelevantRep()->pct()}}%</span></small></h4>
|
||||
<p>
|
||||
<!-- target amount -->
|
||||
Saving up to {{mf($piggyBank->targetamount)}}.
|
||||
<!-- currently saved -->
|
||||
Currently saved
|
||||
{{mf($piggyBank->currentRelevantRep()->currentamount)}}.
|
||||
|
||||
<!-- start date (if any) -->
|
||||
@if(!is_null($piggyBank->startdate))
|
||||
Start date: {{$piggyBank->currentRelevantRep()->startdate->format('d M Y')}}.
|
||||
@endif
|
||||
|
||||
<!-- target date (if any) -->
|
||||
@if(!is_null($piggyBank->targetdate))
|
||||
Target date: {{$piggyBank->currentRelevantRep()->targetdate->format('d M Y')}}.
|
||||
@endif
|
||||
|
||||
@if(!is_null($piggyBank->reminder))
|
||||
Next reminder: {{$piggyBank->nextReminderDate()->format('d M Y')}}
|
||||
@endif
|
||||
|
||||
</p>
|
||||
<div class="btn-group-sm btn-group">
|
||||
<a href="{{route('piggybanks.edit',$piggyBank->id)}}" class="btn btn-default"><span class="glyphicon glyphicon-pencil"></span></a>
|
||||
</td>
|
||||
<td style="width:40%;">
|
||||
<div class="btn-group-xs btn-group">
|
||||
@if($piggyBank->leftInAccount > 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
|
||||
<a href="{{route('piggybanks.delete',$piggyBank->id)}}" class="btn btn-danger"><span class="glyphicon glyphicon-trash"></span></a>
|
||||
|
||||
|
||||
</div>
|
||||
</td>
|
||||
<td style="width:40%;">
|
||||
<div class="btn-group-xs btn-group">
|
||||
<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>
|
||||
<td></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">
|
||||
<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($repeated->leftInAccount > 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%;">
|
||||
<div class="btn-group-xs btn-group">
|
||||
<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>
|
||||
<td></td>
|
||||
</tr>
|
||||
</table>
|
||||
@endif
|
||||
@endforeach
|
||||
@endif
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
{{--
|
||||
<table class="table table-bordered">
|
||||
<tr>
|
||||
<td style="width:40%;">Target amount</td>
|
||||
<td style="width:40%;">{{mf($piggyBank->targetamount)}}</td>
|
||||
<td><span class="text-muted">{{100-$piggyBank->currentRelevantRep()->pct()}}%</span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Saved so far</td>
|
||||
<td>{{mf($piggyBank->currentRelevantRep()->currentamount)}}</td>
|
||||
<td><span class="text-muted">{{$piggyBank->currentRelevantRep()->pct()}}%</span></td>
|
||||
</tr>
|
||||
@if(!is_null($piggyBank->targetdate))
|
||||
<tr>
|
||||
<td>Target date</td>
|
||||
<td>{{$piggyBank->currentRelevantRep()->targetdate->format('M jS, Y')}}</td>
|
||||
<td><span class="text-muted">Time diff</span></td>
|
||||
</tr>
|
||||
@endif
|
||||
@if(!is_null($piggyBank->reminder))
|
||||
<tr>
|
||||
<td>Next reminder</td>
|
||||
<td colspan="2">{{$piggyBank->nextReminderDate()->format('M jS, Y')}}</td>
|
||||
</tr>
|
||||
|
||||
@endif
|
||||
@endforeach
|
||||
<tr>
|
||||
<td colspan="3">
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<!--
|
||||
<p>
|
||||
target amount --
|
||||
Saving up to {{mf($piggyBank->targetamount)}}.
|
||||
-- currently saved --
|
||||
Currently saved
|
||||
|
||||
|
||||
-- start date (if any) --
|
||||
@if(!is_null($piggyBank->startdate))
|
||||
Started saving on {{$piggyBank->currentRelevantRep()->startdate->format('M jS, Y')}}.
|
||||
@endif
|
||||
|
||||
-- target date (if any) --
|
||||
@if(!is_null($piggyBank->targetdate))
|
||||
Target date is .
|
||||
@endif
|
||||
|
||||
|
||||
|
||||
</p>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
-->
|
||||
|
||||
@endif
|
||||
@endforeach
|
||||
@endif
|
||||
|
||||
</div>
|
||||
@@ -157,6 +277,8 @@
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
--}}
|
||||
|
||||
|
||||
<!-- MODAL -->
|
||||
<div class="modal fade" id="modal" tabindex="-1" role="dialog" aria-labelledby="modal" aria-hidden="true">
|
||||
|
Reference in New Issue
Block a user