Move more product::class methods into __get(), no functional changes
All checks were successful
Create Docker Image / Build Docker Image (x86_64) (push) Successful in 43s
Create Docker Image / Final Docker Image Manifest (push) Successful in 10s

This commit is contained in:
2025-05-22 14:01:17 +10:00
parent 5ef1a27a64
commit a988720340
13 changed files with 84 additions and 167 deletions

View File

@@ -59,10 +59,12 @@
<span class="h5">Accounting</span>
<hr>
<!-- @todo When returning with a bad value old() is not selecting the previous value, may need to have the full html here instead of a component -->
@foreach (ProviderOauth::providers() as $apo)
<x-leenooks::form.select :id="sprintf('acc_%d',$apo->id)" :name="sprintf('accounting[%d]',$apo->id)" icon="fa-calculator" :label="ucfirst($apo->name)" :choose="true" :value="$pdo->provider_ref($apo)" old="accounting" :options="$pdo->accounting($apo->name)"/>
@endforeach
@production
<!-- @todo When returning with a bad value old() is not selecting the previous value, may need to have the full html here instead of a component -->
@foreach (ProviderOauth::providers() as $apo)
<x-leenooks::form.select :id="sprintf('acc_%d',$apo->id)" :name="sprintf('accounting[%d]',$apo->id)" icon="fa-calculator" :label="ucfirst($apo->name)" :choose="true" :value="$pdo->provider_ref($apo)" old="accounting" :options="$pdo->accounting($apo->name)"/>
@endforeach
@endproduction
</div>
</div>
</div>

View File

@@ -25,7 +25,7 @@
<td>{{ $so->invoice_to ? $so->invoice_to->format('Y-m-d') : '-' }}</td>
<td>{{ $so->active ? 'YES' : 'NO' }}</td>
<td class="text-right">{{ $a=number_format($so->billing_charge_normalised_taxed,2) }}</td>
<td class="text-right">{{ $b=number_format($so->product->cost_normalized(),2) }}</td>
<td class="text-right">{{ $b=number_format($so->billing_cost_normalised_taxed,2) }}</td>
<td><button class="btn btn-sm @if($a<$b)btn-danger @else btn-success @endif"><small>@if($a<$b)<i class="fas fa-fw fa-exclamation"></i> @else <i class="fas fa-fw fa-check"></i> @endif</small></button></td>
</tr>
@endforeach

View File

@@ -32,7 +32,7 @@
<li class="nav-item"><a @class(['nav-link','active'=>! (session()->has('service_update') || session()->has('charge_add'))]) href="#pending_items" data-toggle="tab">Pending Items</a></li>
@endif
@if($o->product->hasUsage())
@if($o->product->has_usage)
<li class="nav-item"><a @class(['nav-link','active'=>! ($x || (session()->has('service_update') || session()->has('charge_add')))]) href="#traffic" data-toggle="tab">Traffic</a></li>
@endif
@@ -70,7 +70,7 @@
</div>
@endif
@if($o->product->hasUsage())
@if($o->product->has_usage)
<div @class(['tab-pane','fade','show active'=>! ($x || (session()->has('service_update') || session()->has('charge_add')))]) id="traffic">
@if($o->type->usage(30)->count())
@include('theme.backend.adminlte.service.widget.'.$o->product->category_lc.'.usagegraph',['o'=>$o->type])

View File

@@ -42,7 +42,7 @@
<td>{{ $o->supplierid }}</td>
<td class="text-right">{{ number_format($o->billing_charge_normalised_taxed,2) }}</td>
<td class="text-right">{{ number_format($o->billing_cost_normalised_taxed,2) }}</td>
<td class="text-right">{{ $o->product->hasUsage() ? number_format($o->type->usage_summary(0)->sum()/1000,1) : '-' }}</td>
<td class="text-right">{{ $o->product->has_usage ? number_format($o->type->usage_summary(0)->sum()/1000,1) : '-' }}</td>
<td>{{ $o->product->supplier->name }}</td>
</tr>
@endforeach

View File

@@ -45,11 +45,11 @@
<tr>
<th>Setup</th>
<td>${{ number_format($b=$o->account->taxed($c->setup_charge),2) }}</td>
<td>${{ number_format($b=$o->account->taxed($c->setup_charge()),2) }}</td>
<td>${{ number_format($a=$o->account->taxed($c->setup_cost),2) }}</td>
<td>{!! markup($a,$b) !!}</td>
@if($p->exists)
<td>${{ number_format($b=$o->account->taxed($p->setup_charge),2) }}</td>
<td>${{ number_format($b=$o->account->taxed($p->setup_charge()),2) }}</td>
<td>${{ number_format($a=$o->account->taxed($p->setup_cost),2) }}</td>
<td>{!! markup($a,$b) !!}</td>
@endif
@@ -58,11 +58,11 @@
<tr>
<th>Billed</th>
<td>{{ $o->billing_interval_name }}</td>
<td>{{ $c->type->billing_interval_string }}</td>
<td>{{ $c->billing_interval_name }}</td>
<td>&nbsp;</td>
@if($p->exists)
<td>{{ $o->billing_interval_name }}</td>
<td>{{ $p->type->billing_interval_string }}</td>
<td>{{ $p->billing_interval_name }}</td>
<td>&nbsp;</td>
@endif
</tr>
@@ -118,13 +118,13 @@
<tr>
<th>Min Price</th>
<!-- @todo change this to $o->min_charge when implemented -->
<td>${{ number_format($b=$o->account->taxed($o->product->min_charge),2) }}</td>
<td>${{ number_format($a=$o->account->taxed($c->supplied->min_cost),2) }}</td>
<td>${{ number_format($b=$o->account->taxed($o->product->min_charge()),2) }}</td>
<td>${{ number_format($a=$o->account->taxed($c->min_cost),2) }}</td>
<td>{!! markup($a,$b) !!}</td>
@if($p->exists)
<td>${{ number_format($a=$o->account->taxed($p->min_charge),2) }}</td>
<td>${{ number_format($a=$o->account->taxed($p->supplied->min_cost ?? 0),2) }}</td>
<td>${{ number_format($a=$o->account->taxed($p->min_charge()),2) }}</td>
<td>${{ number_format($a=$o->account->taxed($p->min_cost),2) }}</td>
<td>{!! markup($a,$b) !!}</td>
@endif
</tr>

View File

@@ -40,13 +40,13 @@
@foreach($oo->products->pluck('products')->flatten()->filter() as $po)
<tr>
<td><a href="{{ route('product',['pdo'=>$po->id]) }}">{{ $po->lid }}</a></td>
<td>{{ $po->pid }} <small>[<a href="{{ route('supplier.product.type',['id'=>$po->supplied->id,'spo'=>$po->supplier->id,'type'=>$po->supplied->category_lc]) }}">{{ $po->supplied->name }}</a>]</small></td>
<td>{{ $po->pid }} <small>[<a href="{{ route('supplier.product.type',['id'=>$po->supplied->id,'spo'=>$po->supplier->id,'type'=>$po->category_lc]) }}">{{ $po->supplied->name }}</a>]</small></td>
<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">{{ $po->billing_interval_name }}</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->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>

View File

@@ -10,11 +10,11 @@
<th>Type</th>
<td class="text-right">{{ $pdo->category_name }}</td>
</tr>
@if ($pdo->setup_charge)
@if ($pdo->setup_charge())
<tr>
<th>Setup Charges <sup>*</sup></th>
{{-- @todo this should use account::taxed() when the user is known --}}
<td class="text-right">${{ number_format($user->exists ? Config::get('site')->taxed($pdo->setup_charge) : Config::get('site')->taxed($pdo->setup_charge),2) }}</td>
<td class="text-right">${{ number_format($user->exists ? Config::get('site')->taxed($pdo->setup_charge()) : Config::get('site')->taxed($pdo->setup_charge()),2) }}</td>
</tr>
@endif
<tr>
@@ -24,7 +24,7 @@
</tr>
<tr>
<th>Default Billing</th>
<td class="text-right">{{ $pdo->billing_interval_string }}</td>
<td class="text-right">{{ $pdo->billing_interval_name }}</td>
</tr>
<tr>
<th>Contract Term</th>
@@ -33,7 +33,7 @@
<tr>
<th>Minimum Costs <sup>+*</sup></th>
{{-- @todo this should use account::taxed() when the user is known --}}
<td class="text-right">${{ number_format($user->exists ? Config::get('site')->taxed($pdo->min_charge) : Config::get('site')->taxed($pdo->min_charge),2) }}</td>
<td class="text-right">${{ number_format($user->exists ? Config::get('site')->taxed($pdo->min_charge()) : Config::get('site')->taxed($pdo->min_charge()),2) }}</td>
</tr>
<tfoot>