mirror of
				https://github.com/firefly-iii/firefly-iii.git
				synced 2025-10-31 02:36:28 +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 | ||||
|      */ | ||||
|   | ||||
| @@ -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)}}. | ||||
|   | ||||
		Reference in New Issue
	
	Block a user