formatting?
This commit is contained in:
parent
ed3edd181b
commit
70b937324e
|
@ -31,46 +31,47 @@ class HomeController extends Controller
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function CreditsLeftBox(){
|
public static function CreditsLeftBox(){
|
||||||
$usage = 0;
|
$usage = 0;
|
||||||
$CREDITS_DISPLAY_NAME = Configuration::getValueByKey('CREDITS_DISPLAY_NAME');
|
|
||||||
foreach (Auth::user()->servers as $server){
|
foreach (Auth::user()->servers as $server){
|
||||||
$usage += $server->product->price;
|
$usage += $server->product->price;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(Auth::user()->Credits() > 0.01 and $usage > 0){
|
if(Auth::user()->Credits() > 0.01 and $usage > 0){
|
||||||
$Days = number_format((Auth::user()->Credits()*30)/$usage,2,'.','');
|
$days = number_format((Auth::user()->Credits()*30)/$usage,2,'.','');
|
||||||
$Hours = number_format(Auth::user()->Credits()/($usage/30/24),2,'.','');
|
$hours = number_format(Auth::user()->Credits()/($usage/30/24),2,'.','');
|
||||||
echo '
|
echo '
|
||||||
<div class="col-12 col-sm-6 col-md-3">
|
<div class="col-12 col-sm-6 col-md-3">
|
||||||
<div class="info-box mb-3">';
|
<div class="info-box mb-3">';
|
||||||
if($Days >= 15){
|
if($days >= 15){
|
||||||
echo '<span class="info-box-icon bg-success elevation-1">';
|
echo '<span class="info-box-icon bg-success elevation-1">';
|
||||||
}
|
|
||||||
elseif ($Days >= 8 && $Days <= 14){
|
|
||||||
echo '<span class="info-box-icon bg-warning elevation-1">';
|
|
||||||
}
|
|
||||||
elseif ($Days <= 7){
|
|
||||||
echo '<span class="info-box-icon bg-danger elevation-1">';
|
|
||||||
}
|
|
||||||
|
|
||||||
echo '<i class="fas fa-hourglass-half"></i></span>
|
|
||||||
|
|
||||||
<div class="info-box-content">
|
|
||||||
<span class="info-box-text">Out of '.$CREDITS_DISPLAY_NAME.' in </span>';
|
|
||||||
if($Days < "1"){
|
|
||||||
if($Hours < "1"){
|
|
||||||
echo '<span class="info-box-number">You ran out of Credits </span>';
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
echo '<span class="info-box-number"> '.$Hours.' <sup> hours</sup></span>';
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
echo '<span class="info-box-number">'.number_format($Days,0).' <sup> days</sup></span>';
|
|
||||||
}
|
}
|
||||||
}
|
elseif ($days >= 8 && $days <= 14){
|
||||||
echo'
|
echo '<span class="info-box-icon bg-warning elevation-1">';
|
||||||
</div>
|
}
|
||||||
</div> ';
|
elseif ($days <= 7){
|
||||||
}
|
echo '<span class="info-box-icon bg-danger elevation-1">';
|
||||||
|
}
|
||||||
|
|
||||||
|
echo '<i class="fas fa-hourglass-half"></i></span>
|
||||||
|
|
||||||
|
<div class="info-box-content">
|
||||||
|
<span class="info-box-text">Out of '. Configuration::getValueByKey('CREDITS_DISPLAY_NAME').' in </span>';
|
||||||
|
//IF TIME IS LESS THAN 1 DAY CHANGE TO "hours"
|
||||||
|
if($days < "1"){
|
||||||
|
if($hours < "1"){
|
||||||
|
echo '<span class="info-box-number">You ran out of Credits </span>';
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
echo '<span class="info-box-number"> '.$hours.' <sup> hours</sup></span>';
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
echo '<span class="info-box-number">'.number_format($days,0).' <sup> days</sup></span>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
echo'
|
||||||
|
</div>
|
||||||
|
</div>';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue