Show Client running out of Credits in Admin overview
This commit is contained in:
parent
3fac4f87c0
commit
88944235f2
|
@ -251,7 +251,7 @@ class UserController extends Controller
|
||||||
return '<i class="fas fa-coins mr-2"></i> ' . $user->credits();
|
return '<i class="fas fa-coins mr-2"></i> ' . $user->credits();
|
||||||
})
|
})
|
||||||
->addColumn('usage', function (User $user) {
|
->addColumn('usage', function (User $user) {
|
||||||
return '<i class="fas fa-coins mr-2"></i> ' . $user->creditUsage();
|
return '<i class="fas fa-coins mr-2"></i> ' . $user->creditUsage(). ' ('.$user->outOfCredits().')';
|
||||||
})
|
})
|
||||||
->addColumn('verified', function (User $user) {
|
->addColumn('verified', function (User $user) {
|
||||||
return $user->getVerifiedStatus();
|
return $user->getVerifiedStatus();
|
||||||
|
|
|
@ -242,6 +242,20 @@ class User extends Authenticatable implements MustVerifyEmail
|
||||||
return number_format($usage, 2, '.', '');
|
return number_format($usage, 2, '.', '');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function outOfCredits()
|
||||||
|
{
|
||||||
|
$usage = $this->creditUsage();
|
||||||
|
$credits = $this->credits;
|
||||||
|
$timeLeft = number_format(($credits*30)/$usage);
|
||||||
|
$unit = "days";
|
||||||
|
|
||||||
|
if($timeLeft < 1){
|
||||||
|
$timeLeft = number_format(($credits*30)/$usage*24,2);
|
||||||
|
$unit = "hours";
|
||||||
|
}
|
||||||
|
return $timeLeft." ".$unit;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return array|string|string[]
|
* @return array|string|string[]
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -46,7 +46,7 @@
|
||||||
<th>Role</th>
|
<th>Role</th>
|
||||||
<th>Email</th>
|
<th>Email</th>
|
||||||
<th>{{CREDITS_DISPLAY_NAME}}</th>
|
<th>{{CREDITS_DISPLAY_NAME}}</th>
|
||||||
<th>Usage</th>
|
<th>Usage (Out of Credits in..)</th>
|
||||||
<th>Servers</th>
|
<th>Servers</th>
|
||||||
<th>Verified</th>
|
<th>Verified</th>
|
||||||
<th>Last seen</th>
|
<th>Last seen</th>
|
||||||
|
|
|
@ -184,6 +184,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="col-lg-6">
|
<div class="col-lg-6">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-lg-4">
|
<div class="col-lg-4">
|
||||||
|
@ -197,6 +198,19 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="col-lg-6">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-lg-4">
|
||||||
|
<label>Out of Credits in</label>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-8">
|
||||||
|
<span style="max-width: 250px;" class="d-inline-block text-truncate">
|
||||||
|
<i class="fas fa-clock mr-2"></i>{{$user->OutOfCredits()}}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="col-lg-6">
|
<div class="col-lg-6">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-lg-4">
|
<div class="col-lg-4">
|
||||||
|
|
Loading…
Reference in a new issue