User optimisation and code cleanup
This commit is contained in:
@@ -1,27 +1,25 @@
|
||||
@if(Auth::user()->isReseller() && $o->my_accounts->count() <= 2 && $o->my_accounts->pluck('providers')->flatten()->count())
|
||||
@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">
|
||||
<span class="info-box-icon bg-dark elevation-1"><i class="fas fa-file-invoice"></i></span>
|
||||
<div class="info-box-content">
|
||||
<span class="info-box-text">Accounting</span>
|
||||
@foreach ($o->my_accounts as $ao)
|
||||
@foreach($ao->providers as $po)
|
||||
<span class="info-box-number"><a href="{{ url(($po->api_class())::url().'/customerdetail?nameId='.$po->pivot->ref) }}" target="{{ $po->name }}">{{ ucfirst($po->name) }}</a></span>
|
||||
@endforeach
|
||||
@foreach($x as $po)
|
||||
<span class="info-box-number"><a href="{{ url(($po->api_class())::url().'/customerdetail?nameId='.$po->pivot->ref) }}" target="{{ $po->name }}">{{ ucfirst($po->name) }}</a></span>
|
||||
@endforeach
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@if ($o->accounts->count() > 1)
|
||||
@if ($o->accounts_all->count() > 1)
|
||||
<div class="col-12 col-sm-4 col-md-2">
|
||||
<div class="info-box">
|
||||
<span class="info-box-icon bg-primary elevation-1"><i class="fas fa-user"></i></span>
|
||||
|
||||
<div class="info-box-content">
|
||||
<span class="info-box-text">Linked Accounts</span>
|
||||
<span class="info-box-number">{{ number_format($o->my_accounts->count()) }}</span>
|
||||
<span class="info-box-number">{{ number_format($o->accounts_all->count()) }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -33,8 +31,7 @@
|
||||
|
||||
<div class="info-box-content">
|
||||
<span class="info-box-text">Active Services</span>
|
||||
<!-- @todo This should count of inactive services too -->
|
||||
<span class="info-box-number">{{ $o->services->count() }} <small>/{{ $o->services->count() }}</small></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>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -45,7 +42,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->map(fn($item)=>$item->invoiceSummaryDue()->get()->pluck('_balance'))->flatten())->sum(),2) }}</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>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
Reference in New Issue
Block a user