Optimise Service model

This commit is contained in:
2024-07-07 15:02:02 +10:00
parent b4f3db04fc
commit 0d9dbafcf1
10 changed files with 153 additions and 242 deletions

View File

@@ -24,7 +24,7 @@
<td>{{ $so->stop_at ? $so->stop_at->format('Y-m-d') : '-' }}</td>
<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->charge_normalized(),2) }}</td>
<td class="text-right">{{ $a=number_format($so->billing_charge_normalised,2) }}</td>
<td class="text-right">{{ $b=number_format($so->product->cost_normalized(),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>

View File

@@ -33,7 +33,7 @@
@if (! $o->suspend_billing AND ! $o->external_billing)
<li class="nav-item"><a class="nav-link {{ (! session()->has('service_update')) ? 'active' : '' }}" href="#pending_items" data-toggle="tab">Pending Items</a></li>
@endif
@if ($o->hasUsage())
@if ($o->product->hasUsage())
<li class="nav-item"><a class="nav-link {{ (! $o->isBilled() && (! session()->has('service_update'))) ? 'active' : '' }}" href="#traffic" data-toggle="tab">Traffic</a></li>
@endif
@@ -74,7 +74,7 @@
@include('theme.backend.adminlte.service.widget.invoice')
</div>
@endif
@if ($o->hasUsage())
@if ($o->product->hasUsage())
<div class="tab-pane fade {{ (! $o->isBilled() && (! session()->has('service_update'))) ? 'active show' : '' }}" id="traffic" role="tabpanel">
@if ($o->type->usage(30)->count())
@include('theme.backend.adminlte.service.widget.'.$o->product->category.'.usagegraph',['o'=>$o->type])

View File

@@ -1,3 +1,4 @@
<!-- $o=Service::class -->
<table class="table table-sm" id="svc_bill_hist">
<thead>
<tr>

View File

@@ -20,7 +20,7 @@
</tr>
<tr>
<th>Status</th>
<td>{!! $o->status_html !!}</td>
<td>@include('theme.backend.adminlte.service.widget.status')</td>
</tr>
@if ($o->order_status == 'ORDER-SENT')
<tr>
@@ -47,7 +47,7 @@
</tr>
<tr>
<th>Amount</th>
@if($o->isChargeOverriden())
@if($o->isChargeOverridden())
<td>@if ($o->billing_charge < $o->charge_orig)<del>${{ number_format($o->charge_orig,2) }}</del> @endif${{ number_format($o->billing_charge,2) }}</td>
@else
<td>${{ number_format($o->billing_charge,2) }}</td>

View File

@@ -61,11 +61,11 @@
<tr>
<th>Billing Price</th>
<td @if($o->isChargeOverriden())class="text-danger"@endif>${{ number_format($b=$o->billing_charge,2) }}</td>
<td @if($o->isChargeOverridden())class="text-danger"@endif>${{ number_format($b=$o->billing_charge,2) }}</td>
<td>${{ number_format($a=$o->account->taxed($c->base_cost),2) }}</td>
<td>{!! markup($a,$b) !!}</td>
@if ($p->exists)
<td @if($o->isChargeOverriden())class="text-danger"@endif>${{ number_format($b=$o->account->taxed($p->base_charge),2) }}</td>
<td @if($o->isChargeOverridden())class="text-danger"@endif>${{ number_format($b=$o->account->taxed($p->base_charge),2) }}</td>
<td>${{ number_format($a=$o->account->taxed($p->base_cost),2) }}</td>
<td>{!! markup($a,$b) !!}</td>
@endif
@@ -73,7 +73,7 @@
<tr>
<th>Monthly Price</th>
<td @if($x=$o->isChargeOverriden()) class="text-danger" @endif>
<td @if($x=$o->isChargeOverridden()) class="text-danger" @endif>
@if($x)
<abbr title="${{ number_format($b=$o->account->taxed($c->base_charge)*\App\Models\Invoice::billing_change($o->billing_interval,\App\Models\Invoice::BILL_MONTHLY),2) }}">${{ number_format($b=$o->billing_monthly_price,2) }}
@else
@@ -83,7 +83,7 @@
<td>${{ number_format($a=$o->account->taxed($c->base_cost)*\App\Models\Invoice::billing_change($o->billing_interval,\App\Models\Invoice::BILL_MONTHLY),2) }}</td>
<td>{!! markup($a,$b) !!}</td>
@if ($p->exists)
<td @if($x=$o->isChargeOverriden()) class="text-danger" @endif>${{ number_format($b=$o->account->taxed($p->base_charge)*\App\Models\Invoice::billing_change($o->billing_interval,\App\Models\Invoice::BILL_MONTHLY),2) }}</td>
<td @if($x=$o->isChargeOverridden()) class="text-danger" @endif>${{ number_format($b=$o->account->taxed($p->base_charge)*\App\Models\Invoice::billing_change($o->billing_interval,\App\Models\Invoice::BILL_MONTHLY),2) }}</td>
<td>${{ number_format($a=$o->account->taxed($p->base_cost)*\App\Models\Invoice::billing_change($o->billing_interval,\App\Models\Invoice::BILL_MONTHLY),2) }}</td>
<td>{!! markup($a,$b) !!}</td>
@endif

View File

@@ -0,0 +1,12 @@
<!-- $o=Service::class -->
<span class="badge @if($o->isPending())badge-warning @else
@switch ($o->status)
@case('ACTIVE')
badge-success
@break;
@case('INACTIVE')
badge-danger
@break;
@endswitch
@endif
">{{ $o->status }}</span>