mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-04 11:48:05 +00:00
Add percentage to piggy bank view.
This commit is contained in:
@@ -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
|
* @return array
|
||||||
*/
|
*/
|
||||||
|
@@ -43,7 +43,7 @@
|
|||||||
<!-- display piggy bank -->
|
<!-- display piggy bank -->
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<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>
|
<p>
|
||||||
<!-- target amount -->
|
<!-- target amount -->
|
||||||
Saving up to {{mf($piggyBank->targetamount)}}.
|
Saving up to {{mf($piggyBank->targetamount)}}.
|
||||||
@@ -97,7 +97,7 @@
|
|||||||
@if($repeated->repeats == 1)
|
@if($repeated->repeats == 1)
|
||||||
<!-- display repeated expense -->
|
<!-- display repeated expense -->
|
||||||
<tr><td>
|
<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>
|
<p>
|
||||||
<!-- target amount -->
|
<!-- target amount -->
|
||||||
Saving up to {{mf($repeated->targetamount)}}.
|
Saving up to {{mf($repeated->targetamount)}}.
|
||||||
|
Reference in New Issue
Block a user