mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Add percentage to piggy bank view.
This commit is contained in:
parent
71504c76ac
commit
c272d99fa8
@ -50,6 +50,13 @@ class PiggybankRepetition extends Ardent
|
||||
];
|
||||
}
|
||||
|
||||
public function pct() {
|
||||
$total = $this->piggybank->targetamount;
|
||||
$saved = $this->currentamount;
|
||||
$pct = round(($saved / $total) * 100,1);
|
||||
return $pct;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
|
@ -43,7 +43,7 @@
|
||||
<!-- display piggy bank -->
|
||||
<tr>
|
||||
<td>
|
||||
<h4><a href="{{route('piggybanks.show',$piggyBank->id)}}">{{{$piggyBank->name}}}</a></h4>
|
||||
<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)}}.
|
||||
@ -97,7 +97,7 @@
|
||||
@if($repeated->repeats == 1)
|
||||
<!-- display repeated expense -->
|
||||
<tr><td>
|
||||
<h4><a href="{{route('piggybanks.show',$repeated->id)}}">{{{$repeated->name}}}</a></h4>
|
||||
<h4><a href="{{route('piggybanks.show',$repeated->id)}}">{{{$repeated->name}}}</a><small> <span class="label label-default">{{$piggyBank->currentRelevantRep()->pct()}}%</span></small></h4>
|
||||
<p>
|
||||
<!-- target amount -->
|
||||
Saving up to {{mf($repeated->targetamount)}}.
|
||||
|
Loading…
Reference in New Issue
Block a user