Home page performance optimisations
This commit is contained in:
@@ -1,3 +1,8 @@
|
||||
@php
|
||||
use App\Models\{Account,Service};
|
||||
$acts = $o->accounts_all->pluck('id');
|
||||
@endphp
|
||||
|
||||
@if($user->isReseller() && ($o->accounts->count() <= 2) && ($x=$o->accounts->pluck('providers')->flatten())->count())
|
||||
<div class="col-12 col-sm-4 col-md-2">
|
||||
<div class="info-box">
|
||||
@@ -31,7 +36,7 @@
|
||||
|
||||
<div class="info-box-content">
|
||||
<span class="info-box-text">Active Services</span>
|
||||
<span class="info-box-number">{{ $o->accounts_all->map(fn($item)=>$item->services->where('active',TRUE)->count())->sum() }} <small>/{{ $o->accounts_all->map(fn($item)=>$item->services->count())->sum() }}</small></span>
|
||||
<span class="info-box-number">{{ Service::active()->whereIn('account_id',$acts)->count() }} <small>/{{ Service::whereIn('account_id',$acts)->count() }}</small></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -42,7 +47,7 @@
|
||||
|
||||
<div class="info-box-content">
|
||||
<span class="info-box-text">Account Balance</span>
|
||||
<span class="info-box-number"><small>$</small> {{ number_format(($x=$o->accounts_all->map(fn($item)=>$item->invoiceSummaryDue()->get()->pluck('_balance'))->flatten())->sum(),2) }}</span>
|
||||
<span class="info-box-number"><small>$</small> {{ number_format(($x=Account::InvoicesDue()->filter(fn($item)=>$acts->contains($item->account_id)))->sum('_balance'),2) }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
Reference in New Issue
Block a user