Move category/category_name product::class methods into __get(), no functional changes

This commit is contained in:
2025-05-22 12:01:31 +10:00
parent 04ae35b1dd
commit 5ef1a27a64
23 changed files with 63 additions and 85 deletions

View File

@@ -8,7 +8,7 @@ Please order the following...
| Account | {{ $service->account->name }} |
| Service ID | {{ $service->sid }} |
| Product | {{ $service->product->name }} |
@switch($service->product->category)
@switch($service->product->category_lc)
@case('broadband')
| Address | {{ $service->type->service_address }} |
@break;

View File

@@ -7,7 +7,7 @@
| Account | {{ $service->account->name }} |
| Service ID | {{ $service->sid }} |
| Product | {{ $service->product->name }} |
@switch($service->product->category)
@switch($service->product->category_lc)
@case('broadband')
| Address | {{ is_object($service->type) ? $service->type->service_address : 'Not Supplied' }} |
@break;

View File

@@ -9,7 +9,7 @@ Please cancel the following...
| Service ID | {{ $service->sid }} |
| Cancel Date | {{ $service->stop_at->format('Y-m-d') }} |
| Product | {{ $service->product->name }} |
@switch($service->product->category)
@switch($service->product->category_lc)
@case('broadband')
| Address | {{ $service->type->service_address }} |
@break;

View File

@@ -8,7 +8,7 @@ Please change the following...
| Account | {{ $service->account->name }} |
| Service ID | {{ $service->sid }} |
| Product | {{ $service->product->name }} |
@switch($service->product->category)
@switch($service->product->category_lc)
@case('broadband')
| Address | {{ $service->type->service_address }} |
@break;

View File

@@ -42,7 +42,7 @@
<!-- PRODUCT -->
<x-leenooks::form.select id="product_id" name="broadband[product_id]" icon="fa-list" label="Product" :helper="$o->product->category_name" groupby="active"
:value="$np->id"
:options="Product::get()->filter(fn($item)=>$item->category === $np->category)->sortBy('name')->sortByDesc('active')->map(fn($item)=>['id'=>$item->id,'active'=>$item->active,'value'=>$item->name])" required/>
:options="Product::get()->filter(fn($item)=>$item->category_lc === $np->category_lc)->sortBy('name')->sortByDesc('active')->map(fn($item)=>['id'=>$item->id,'active'=>$item->active,'value'=>$item->name])" required/>
</div>
</div>

View File

@@ -41,7 +41,7 @@
<div class="row">
<div class="col">
@includeIf('theme.backend.adminlte.service.widget.'.$so->product->category.'.change',['o'=>$so->type])
@includeIf('theme.backend.adminlte.service.widget.'.$so->product->category_lc.'.change',['o'=>$so->type])
</div>
</div>

View File

@@ -20,7 +20,7 @@
<div class="row">
<!-- Service Details -->
<div class="col-12 col-md-5">
@includeIf('theme.backend.adminlte.service.widget.'.$o->product->category.'.details',['o'=>$o->type])
@includeIf('theme.backend.adminlte.service.widget.'.$o->product->category_lc.'.details',['o'=>$o->type])
@include('theme.backend.adminlte.service.widget.information')
</div>
@@ -73,7 +73,7 @@
@if($o->product->hasUsage())
<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.'.usagegraph',['o'=>$o->type])
@include('theme.backend.adminlte.service.widget.'.$o->product->category_lc.'.usagegraph',['o'=>$o->type])
@endif
</div>
@endif

View File

@@ -38,7 +38,7 @@
</div>
</div>
@includeIf('theme.backend.adminlte.service.widget.'.$o->product->category.'.order',['o'=>$o->type])
@includeIf('theme.backend.adminlte.service.widget.'.$o->product->category_lc.'.order',['o'=>$o->type])
<div class="form-group row">
<label for="notes" class="col-sm-2 col-form-label text-right">Notes</label>

View File

@@ -38,7 +38,7 @@
</div>
</div>
@includeIf('theme.backend.adminlte.service.widget.'.$o->product->category.'.order',['o'=>$o->type])
@includeIf('theme.backend.adminlte.service.widget.'.$o->product->category_lc.'.order',['o'=>$o->type])
<div class="form-group row">
<label for="notes" class="col-sm-2 col-form-label text-right">Notes</label>

View File

@@ -34,11 +34,11 @@
<tr>
<th>Product</th>
<td><a href="{{ route('product',['pdo'=>$o->product_id]) }}">#{{ $o->product_id }}: {{ $o->product->name }}</a></td>
<td><a href="{{ route('supplier.product.type',['id'=>$c->supplied->id,'spo'=>$c->supplied->supplier_detail_id,'type'=>$c->supplied->category]) }}">#{{ $c->supplied->id }}: {{ $c->supplied->name_long }}</a></td>
<td><a href="{{ route('supplier.product.type',['id'=>$c->supplied->id,'spo'=>$c->supplied->supplier_detail_id,'type'=>$c->category_lc]) }}">#{{ $c->supplied->id }}: {{ $c->supplied->name_long }}</a></td>
<td>{{ $c->category_name }}</td>
@if($p->exists)
<th><a href="{{ route('product',['pdo'=>$p->id]) }}">#{{ $p->id }}: {{ $p->name }}</a></th>
<td class="text-center"><a href="{{ route('supplier.product.type',['id'=>$p->supplied->id,'spo'=>$p->supplied->supplier_detail_id,'type'=>$p->supplied->category]) }}">#{{ $p->supplied->id }}: {{ $p->supplied->name_long }}</a></td>
<td class="text-center"><a href="{{ route('supplier.product.type',['id'=>$p->supplied->id,'spo'=>$p->supplied->supplier_detail_id,'type'=>$p->category_lc]) }}">#{{ $p->supplied->id }}: {{ $p->supplied->name_long }}</a></td>
<td>&nbsp;</td>
@endif
</tr>

View File

@@ -51,7 +51,7 @@
:value="$o->product_id"
:options="Product::with(['type.supplied','translate'])
->get()
->filter(fn($item)=>($item->category === $o->product->category))
->filter(fn($item)=>($item->category_lc === $o->product->category_lc))
->sortBy('name')
->map(fn($item)=>[
'id'=>$item->id,
@@ -65,7 +65,7 @@
</div>
<hr>
@includeIf('theme.backend.adminlte.service.widget.'.$o->product->category.'.update',['o'=>$o->type])
@includeIf('theme.backend.adminlte.service.widget.'.$o->product->category_lc.'.update',['o'=>$o->type])
<div class="row">
<div class="col">

View File

@@ -53,7 +53,7 @@ if(isset($spo)) {
<div class="col-4">
<!-- Offering Type -->
<x-leenooks::form.select name="offering_type" icon="fa-cogs" label="Type" helper="Offering Type" :choose="true" :value="$oo?->category ?? ''" :options="Supplier::offeringTypes()->sortBy(fn($item)=>$item->category_name)->map(fn($item)=>['id'=>$item->category,'value'=>$item->category_name])"/>
<x-leenooks::form.select name="offering_type" icon="fa-cogs" label="Type" helper="Offering Type" :choose="true" :value="$oo?->category_lc ?? ''" :options="Supplier::offeringTypes()->sortBy(fn($item)=>$item->category_name)->map(fn($item)=>['id'=>$item->category_lc,'value'=>$item->category_name])"/>
</div>
</div>
@@ -180,7 +180,7 @@ if(isset($spo)) {
$(document).ready(function() {
@if(isset($oo) && $oo->exists)
$('#offering_type').attr('style','pointer-events: none;');
load_type('{{$oo->category}}',{{$oo->id}})
load_type('{{$oo->category_lc}}',{{$oo->id}})
@endif
$('#offering_type').on('change',function() {

View File

@@ -37,7 +37,7 @@
<tbody>
@foreach($xx=$offering->items->with(['products.products.services'])->get() as $oo)
<tr>
<td><a href="{{ route('supplier.product.type',['id'=>$oo->id,'spo'=>$oo->supplier_detail_id,'type'=>$oo->category]) }}">{{ $oo->id }}</a></td>
<td><a href="{{ route('supplier.product.type',['id'=>$oo->id,'spo'=>$oo->supplier_detail_id,'type'=>$oo->category_lc]) }}">{{ $oo->id }}</a></td>
<td>{{ $oo->name }}</td>
<td>{{ $oo->name_long }}</td>
<td class="text-right">{{ $oo->active ? 'YES' : 'NO' }}</td>

View File

@@ -40,7 +40,7 @@
@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]) }}">{{ $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->supplied->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>

View File

@@ -1,9 +1,9 @@
<!-- $pdo=Product::class [{{$pdo->category}}]-->
@if(View::exists('theme.frontend.metronic.order.widget.info.'.$pdo->category))
@if(View::exists('theme.frontend.metronic.order.widget.info.'.$pdo->category_lc))
<div class="box box-primary">
<div class="box-body">
{{-- Return Category Requirements --}}
@include('theme.frontend.metronic.order.widget.info.'.$pdo->category)
@include('theme.frontend.metronic.order.widget.info.'.$pdo->category_lc)
{{-- Return Supplier Requirements --}}
{{-- Return Product Requirements --}}

View File

@@ -1,5 +1,5 @@
<!-- $pdo=Product::class [{{$pdo->category}}] -->
@if(View::exists('theme.frontend.metronic.order.widget.order.'.$pdo->category))
@if(View::exists('theme.frontend.metronic.order.widget.order.'.$pdo->category_lc))
<div class="box box-primary">
<div class="box-header with-border">
<h3 class="box-title">Order Configuration</h3>
@@ -7,7 +7,7 @@
<div class="box-body">
{{-- Return Category Requirements --}}
@include('theme.frontend.metronic.order.widget.order.'.$pdo->category)
@include('theme.frontend.metronic.order.widget.order.'.$pdo->category_lc)
{{-- Return Supplier Requirements --}}
{{-- Return Product Requirements --}}