More Product Model optimisation
This commit is contained in:
@@ -29,13 +29,14 @@
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
@foreach (\App\Models\Service::active()->get() as $o)
|
||||
{{-- @todo This query is expensive still --}}
|
||||
@foreach (\App\Models\Service::active()->with(['type','product.type.supplied.supplier_detail.supplier','product.translate'])->get() as $o)
|
||||
<tr>
|
||||
<td><a href="{{ url('u/service',[$o->id]) }}">{{ $o->id }}</a></td>
|
||||
<td>{{ $o->name }}</td>
|
||||
<td>{{ $o->product->name }}</td>
|
||||
<td class="text-right">{{ number_format($o->billing_monthly_price,2) }}</td>
|
||||
<td class="text-right">{{ number_format(\App\Models\Tax::tax_calc(($s=$o->supplied)->base_cost*\App\Models\Invoice::billing_change($s->billing_interval,1),$o->account->taxes),2) }}</td>
|
||||
<td class="text-right">{{ number_format($o->product->cost_normalized(),2) }}</td>
|
||||
<td class="text-right">{{ $o->category == 'broadband' ? number_format($o->type->usage_summary(0)->sum()/1000,1) : '-' }}</td>
|
||||
<td>{{ $o->product->supplier->name }}</td>
|
||||
</tr>
|
||||
|
@@ -27,13 +27,14 @@
|
||||
<tr>
|
||||
<th>Setup</th>
|
||||
@if ($s->exists)
|
||||
<td>${{ number_format($a=\App\Models\Tax::tax_calc($s->setup_cost,$o->account->taxes),2) }}</td>
|
||||
<td>${{ number_format($b=\App\Models\Tax::tax_calc($p->setup_charge,$o->account->taxes),2) }}</td>
|
||||
<td>${{ number_format($a=$o->account->taxed($s->setup_cost),2) }}</td>
|
||||
<td>${{ number_format($b=$o->account->taxed($p->setup_charge),2) }}</td>
|
||||
<td>{!! markup($a,$b) !!}</td>
|
||||
@else
|
||||
<td>-</td>
|
||||
@endif
|
||||
</tr>
|
||||
{{--
|
||||
<tr>
|
||||
<th>Billed</th>
|
||||
@if ($s->exists)
|
||||
@@ -47,7 +48,7 @@
|
||||
<tr>
|
||||
<th>Billing Price</th>
|
||||
@if ($s->exists)
|
||||
<td>${{ number_format($a=\App\Models\Tax::tax_calc($s->base_cost*\App\Models\Invoice::billing_change($s->billing_interval,$p->billing_interval),$o->account->taxes),2) }}</td>
|
||||
<td>${{ number_format($a=$o->account->taxed($s->base_cost*\App\Models\Invoice::billing_change($s->billing_interval,$p->billing_interval)),2) }}</td>
|
||||
@endif
|
||||
<td>${{ number_format($b=$o->billing_charge,2) }}</td>
|
||||
@if ($s->exists)
|
||||
@@ -57,9 +58,9 @@
|
||||
<tr>
|
||||
<th>Monthly Price</th>
|
||||
@if ($s->exists)
|
||||
<td>${{ number_format($a=\App\Models\Tax::tax_calc($s->base_cost*\App\Models\Invoice::billing_change($s->billing_interval,1),$o->account->taxes),2) }}</td>
|
||||
<td>${{ number_format($a=$o->account->taxed($s->base_cost*\App\Models\Invoice::billing_change($s->billing_interval,1)),2) }}</td>
|
||||
@endif
|
||||
<td @if($x=$o->isChargeOverriden()) class="text-danger" @endif>${{ number_format($b=($x ? $p->base_charge_taxable : $o->billing_monthly_price),2) }}</td>
|
||||
<td @if($x=$o->isChargeOverriden()) class="text-danger" @endif>${{ number_format($b=($x ? $o->account->taxed($p->base_charge) : $o->billing_monthly_price),2) }}</td>
|
||||
@if ($s->exists)
|
||||
<td>{!! markup($a,$b) !!}</td>
|
||||
@endif
|
||||
@@ -77,12 +78,13 @@
|
||||
<tr>
|
||||
<th>Min Price</th>
|
||||
@if ($s->exists)
|
||||
<td>${{ number_format($a=\App\Models\Tax::tax_calc($s->min_cost,$o->account->taxes),2) }}</td>
|
||||
<td>${{ number_format($b=\App\Models\Tax::tax_calc($p->getMinChargeAttribute($o->billing_interval),$o->account->taxes),2) }}</td>
|
||||
<td>${{ number_format($a=$o->account->taxed($s->min_cost),2) }}</td>
|
||||
<td>${{ number_format($b=$o->account->taxed($p->getMinChargeAttribute($o->billing_interval)),2) }}</td>
|
||||
<td>{!! markup($a,$b) !!}</td>
|
||||
@else
|
||||
<td>-</td>
|
||||
@endif
|
||||
</tr>
|
||||
--}}
|
||||
</tbody>
|
||||
</table>
|
@@ -39,8 +39,8 @@
|
||||
<td>{{ $oo->name }}</td>
|
||||
<td>{{ $oo->name_long }}</td>
|
||||
<td class="text-right">{{ $oo->active ? 'YES' : 'NO' }}</td>
|
||||
<td class="text-right">{{ number_format($oo->setup_cost_taxable,2) }}</td>
|
||||
<td class="text-right">{{ number_format($oo->base_cost_taxable,2) }}</td>
|
||||
<td class="text-right">{{ number_format($site->taxed($oo->setup_cost),2) }}</td>
|
||||
<td class="text-right">{{ number_format($site->taxed($oo->base_cost),2) }}</td>
|
||||
<td class="text-right">{{ number_format($oo->products->count()) }}</td>
|
||||
<td class="text-right">{{ number_format($oo->products->pluck('products')->filter()->count()) }}</td>
|
||||
<td class="text-right">{{ number_format(($x=$oo->products->pluck('products')->flatten()->pluck('services')->flatten()->filter())->count()) }}</td>
|
||||
|
@@ -42,10 +42,10 @@
|
||||
<td>{{ $po->name }}</td>
|
||||
<td class="text-right">{{ $po->active ? 'YES' : 'NO' }}</td>
|
||||
<td class="text-right">{{ $po->billing_interval_string }}</td>
|
||||
<td class="text-right">{{ number_format($po->setup_cost_taxable,2) }}</td>
|
||||
<td class="text-right">{{ number_format($po->base_cost_taxable,2) }}</td>
|
||||
<td class="text-right">{{ number_format($po->setup_charge_taxable,2) }}</td>
|
||||
<td class="text-right">{{ number_format($po->base_charge_taxable,2) }}</td>
|
||||
<td class="text-right">{{ number_format($site->taxed($po->setup_cost),2) }}</td>
|
||||
<td class="text-right">{{ number_format($site->taxed($po->base_cost),2) }}</td>
|
||||
<td class="text-right">{{ number_format($site->taxed($po->setup_charge),2) }}</td>
|
||||
<td class="text-right">{{ number_format($site->taxed($po->base_charge),2) }}</td>
|
||||
<td class="text-right">{{ number_format($po->services->count()) }}</td>
|
||||
<td class="text-right">{{ number_format($po->services->where('active')->count()) }}</td>
|
||||
</tr>
|
||||
|
@@ -29,7 +29,7 @@
|
||||
|
||||
<div id="accordion">
|
||||
<!-- Reseller Choose Client -->
|
||||
@if ($user && $user->isReseller())
|
||||
@if ($user && $user->exists && $user->isReseller())
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<h4 class="panel-title">Account</h4>
|
||||
@@ -78,7 +78,7 @@
|
||||
</div>
|
||||
|
||||
<!-- Non-Authed User -->
|
||||
@elseif ($user)
|
||||
@elseif ($user && $user->exists)
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<h4 class="panel-title">
|
||||
|
@@ -8,13 +8,15 @@
|
||||
<th>Type</th>
|
||||
<td class="text-right">{{ $o->category_name }}</td>
|
||||
</tr>
|
||||
@if ($o->setup_charge)
|
||||
<tr>
|
||||
<th>Setup Charges <sup>*</sup></th>
|
||||
<td class="text-right">${{ number_format($o->setup_charge_taxable,2) }}</td>
|
||||
<td class="text-right">${{ number_format($user->exists ? $user->taxed($o->setup_charge) : Config::get('site')->taxed($o->setup_charge),2) }}</td>
|
||||
</tr>
|
||||
@endif
|
||||
<tr>
|
||||
<th>Cost <sup>+</sup></th>
|
||||
<td class="text-right">${{ number_format($o->base_charge_taxable,2) }}</td>
|
||||
<td class="text-right">${{ number_format($user->exists ? $user->taxed($o->base_charge) : Config::get('site')->taxed($o->base_charge),2) }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Default Billing</th>
|
||||
@@ -26,8 +28,14 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Minimum Costs <sup>+*</sup></th>
|
||||
<td class="text-right">${{ number_format($o->min_charge_taxable,2) }}</td>
|
||||
<td class="text-right">${{ number_format($user->exists ? $user->taxed($o->min_charge) : Config::get('site')->taxed($o->min_charge),2) }}</td>
|
||||
</tr>
|
||||
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
{!! $footer !!}
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
@@ -1,42 +1,7 @@
|
||||
<!-- $o = Product::class -->
|
||||
<div class="col-md-12">
|
||||
<p>{!! $o->name_detail !!}</p>
|
||||
</div>
|
||||
|
||||
<table class="table table-condensed">
|
||||
<tr>
|
||||
<th>Type</th>
|
||||
<td class="text-right">{{ $o->category_name }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Setup Charges <sup>*</sup></th>
|
||||
<td class="text-right">${{ number_format($o->setup_charge_taxable,2) }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Cost <sup>+</sup></th>
|
||||
<td class="text-right">${{ number_format($o->base_charge_taxable,2) }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Default Billing</th>
|
||||
<td class="text-right">{{ $o->billing_interval_string }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Contract Term</th>
|
||||
<td class="text-right">{{ $o->contract_term }} mths</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Minimum Costs <sup>+*</sup></th>
|
||||
<td class="text-right">${{ number_format($o->min_charge_taxable,2) }}</td>
|
||||
</tr>
|
||||
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<sup>
|
||||
* Additional setup charges may apply for complex installations.<br>
|
||||
+ Additional charges may apply for regional installations.
|
||||
</sup>
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
@include('order.widget.info.base',['footer'=>'
|
||||
<sup>
|
||||
* Additional setup charges may apply for complex installations.<br>
|
||||
+ Additional charges may apply for regional installations.
|
||||
</sup>
|
||||
'])
|
@@ -1,33 +1,6 @@
|
||||
<!-- $o = Product::class -->
|
||||
<div class="col-md-12">
|
||||
<p>{!! $o->name_detail !!}</p>
|
||||
</div>
|
||||
|
||||
<table class="table table-condensed">
|
||||
<tr>
|
||||
<th>Type</th>
|
||||
<td class="text-right">{{ $o->category_name }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Setup Charges <sup>*</sup></th>
|
||||
<td class="text-right">${{ number_format($o->setup_charge_taxable,2) }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Cost <sup>+</sup></th>
|
||||
<td class="text-right">${{ number_format($o->base_charge_taxable,2) }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Default Billing</th>
|
||||
<td class="text-right">{{ $o->billing_interval_string }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Contract Term</th>
|
||||
<td class="text-right">{{ $o->contract_term }} mths</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Minimum Costs <sup>+*</sup></th>
|
||||
<td class="text-right">${{ number_format($o->min_charge_taxable,2) }}</td>
|
||||
</tr>
|
||||
|
||||
<tfoot>
|
||||
</table>
|
||||
@include('order.widget.info.base',['footer'=>'
|
||||
<sup>
|
||||
* Depends on domain availability.<br>
|
||||
+ Domain availability may change the initial cost.
|
||||
</sup>'])
|
@@ -1,33 +1,6 @@
|
||||
<!-- $o = Product::class -->
|
||||
<div class="col-md-12">
|
||||
<p>{!! $o->name_detail !!}</p>
|
||||
</div>
|
||||
|
||||
<table class="table table-condensed">
|
||||
<tr>
|
||||
<th>Type</th>
|
||||
<td class="text-right">{{ $o->category_name }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Setup Charges <sup>*</sup></th>
|
||||
<td class="text-right">${{ number_format($o->setup_charge_taxable,2) }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Cost <sup>+</sup></th>
|
||||
<td class="text-right">${{ number_format($o->base_charge_taxable,2) }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Default Billing</th>
|
||||
<td class="text-right">{{ $o->billing_interval_string }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Contract Term</th>
|
||||
<td class="text-right">{{ $o->contract_term }} mths</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Minimum Costs <sup>+*</sup></th>
|
||||
<td class="text-right">${{ number_format($o->min_charge_taxable,2) }}</td>
|
||||
</tr>
|
||||
|
||||
<tfoot>
|
||||
</table>
|
||||
@include('order.widget.info.base',['footer'=>'
|
||||
<sup>
|
||||
* Depends on domain availability.<br>
|
||||
+ Domain availability may change the initial cost.
|
||||
</sup>'])
|
@@ -0,0 +1,6 @@
|
||||
<!-- $o = Product::class -->
|
||||
@include('order.widget.info.base',['footer'=>'
|
||||
<sup>
|
||||
* Depends on domain availability.<br>
|
||||
+ Domain availability may change the initial cost.
|
||||
</sup>'])
|
@@ -1,31 +1,6 @@
|
||||
<!-- $o = Product::class -->
|
||||
<div class="col-md-12">
|
||||
<p>{!! $o->name_detail !!}</p>
|
||||
</div>
|
||||
|
||||
<table class="table table-condensed">
|
||||
<tr>
|
||||
<th>Type</th>
|
||||
<td class="text-right">{{ $o->category_name }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Setup Charges</th>
|
||||
<td class="text-right">${{ number_format($o->setup_charge_taxable,2) }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Cost</th>
|
||||
<td class="text-right">${{ number_format($o->base_charge_taxable,2) }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Default Billing</th>
|
||||
<td class="text-right">{{ $o->billing_interval_string }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Contract Term</th>
|
||||
<td class="text-right">{{ $o->contract_term }} mths</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Minimum Costs</th>
|
||||
<td class="text-right">${{ number_format($o->min_charge_taxable,2) }}</td>
|
||||
</tr>
|
||||
</table>
|
||||
@include('order.widget.info.base',['footer'=>'
|
||||
<sup>
|
||||
* Depends on complex porting.<br>
|
||||
+ Complex porting involves additional charges.
|
||||
</sup>'])
|
Reference in New Issue
Block a user