Change product name_detail, name to name, pid

This commit is contained in:
Deon George 2023-05-09 17:08:31 +09:00
parent 45dd74aad4
commit 790ece14d1
7 changed files with 29 additions and 32 deletions

View File

@ -31,18 +31,17 @@ use App\Traits\{ProductDetails,SiteID};
* Attributes for products: * Attributes for products:
* + lid : Local ID for product (part number) * + lid : Local ID for product (part number)
* + sid : System ID for product (part number) * + sid : System ID for product (part number)
* + category : Type of product supplied * + base_charge : Default billing amount
* + category_name : Type of product supplied (Friendly Name for display, not for internal logic)
* + supplier : Supplier for this offering
* + name : Brief Name for our product with name_detail
* + name_short : Product ID for our Product (description.name => name_short)
* + name_detail : Details of our product (description.description_short => name_detail)
* + description : Product description (description.description_full => description_full)
* + billing_interval : Default Billing Interval * + billing_interval : Default Billing Interval
* + billing_interval_string: Default Billing Interval in human-readable form * + billing_interval_string: Default Billing Interval in human-readable form
* + setup_charge : Charge to setup this product * + category : Type of product supplied
* + base_charge : Default billing amount * + category_name : Type of product supplied (Friendly Name for display, not for internal logic)
* + description : Product description (description.description_full => description_full)
* + min_charge : Minimum charge taking into account billing interval and setup charges * + min_charge : Minimum charge taking into account billing interval and setup charges
* + name : Details of our product (description.description_short => name_detail)
* + pid : Product ID for our Product (description.name => name_short)
* + setup_charge : Charge to setup this product
* + supplier : Supplier for this offering
* *
* Attributes for product types (type - Product/*) * Attributes for product types (type - Product/*)
* + name : Short Name for our Product * + name : Short Name for our Product
@ -259,16 +258,6 @@ class Product extends Model implements IDs
* @return string * @return string
*/ */
public function getNameAttribute(): string public function getNameAttribute(): string
{
return $this->getNameShortAttribute().(($x=$this->getNameDetailAttribute()) ? ': '.$x : '');
}
/**
* Our products Long Name
*
* @return string
*/
public function getNameDetailAttribute(): string
{ {
return $this->translate->name_detail; return $this->translate->name_detail;
} }
@ -278,7 +267,7 @@ class Product extends Model implements IDs
* *
* @return string * @return string
*/ */
public function getNameShortAttribute(): string public function getPIDAttribute(): string
{ {
return $this->translate->name_short; return $this->translate->name_short;
} }

View File

@ -22,6 +22,7 @@
<tr> <tr>
<th>ID</th> <th>ID</th>
<th>Type</th> <th>Type</th>
<th>PID</th>
<th>Product</th> <th>Product</th>
<th class="text-right">Services</th> <th class="text-right">Services</th>
</tr> </tr>
@ -32,6 +33,7 @@
<tr> <tr>
<td><a href="{{ url('a/product/details',[($x=$s->first())->product_id]) }}">{{ $x->id }}</a></td> <td><a href="{{ url('a/product/details',[($x=$s->first())->product_id]) }}">{{ $x->id }}</a></td>
<td>{{ $x->category_name }}</td> <td>{{ $x->category_name }}</td>
<td>{{ $x->product->pid }}</td>
<td>{{ $x->product->name }}</td> <td>{{ $x->product->name }}</td>
<td class="text-right">{{ $s->count() }}</td> <td class="text-right">{{ $s->count() }}</td>
</tr> </tr>
@ -75,7 +77,7 @@
fixedHeader: true, fixedHeader: true,
order: [ order: [
[1,'asc'], [1,'asc'],
[2,'asc'], [3,'asc'],
], ],
rowGroup: { rowGroup: {
dataSrc: [1], dataSrc: [1],

View File

@ -16,7 +16,7 @@
'id'=>'translate.name_short', 'id'=>'translate.name_short',
'old'=>'translate.name_short', 'old'=>'translate.name_short',
'name'=>'translate[name_short]', 'name'=>'translate[name_short]',
'value'=>$o->name_short ?? '', 'value'=>$o->pid,
]) ])
</div> </div>
@ -28,7 +28,7 @@
'id'=>'translate.name_detail', 'id'=>'translate.name_detail',
'old'=>'translate.name_detail', 'old'=>'translate.name_detail',
'name'=>'translate[name_detail]', 'name'=>'translate[name_detail]',
'value'=>$o->name_detail ?? '', 'value'=>$o->name,
]) ])
</div> </div>
</div> </div>
@ -53,7 +53,7 @@
</div> </div>
<div class="row"> <div class="row">
<div class="col-12 col-md-3"> <div class="col-12 col-md-4">
<div class="row"> <div class="row">
<!-- Active --> <!-- Active -->
<div class="col-6"> <div class="col-6">
@ -117,7 +117,7 @@
</div> </div>
</div> </div>
<div class="col-12 offset-md-4 col-md-5"> <div class="col-12 offset-md-3 col-md-5">
<span class="h5">Pricing</span><small> Ex Taxes</small> <span class="h5">Pricing</span><small> Ex Taxes</small>
<hr> <hr>

View File

@ -8,7 +8,7 @@
@endsection @endsection
@section('contentheader_title') @section('contentheader_title')
Service: {{ $o->sid }} <strong>{{ $o->product->name_detail }}</strong> Service: {{ $o->sid }} <strong>{{ $o->product->name }}</strong>
@endsection @endsection
@section('contentheader_description') @section('contentheader_description')
{{ $o->name }} {{ $o->name }}

View File

@ -1,13 +1,13 @@
<!-- $o=App\Models\User --> <!-- $o = User::class -->
<!-- Show active services --> <!-- Show active services -->
<div class="card card-dark"> <div class="card card-light">
<div class="card-header"> <div class="card-header">
<h3 class="card-title">Active Services</h3> <h3 class="card-title">Active Services</h3>
</div> </div>
<div class="card-body"> <div class="card-body">
@if ($o->services->count()) @if ($o->services->count())
<table class="table table-striped table-hover" id="services_active"> <table class="table table-striped table-hover w-100" id="services_active">
<thead> <thead>
<tr> <tr>
<th>ID</th> <th>ID</th>
@ -24,7 +24,7 @@
<td><a href="{{ url('u/service',[$oo->id]) }}">{{ $oo->sid }}</a></td> <td><a href="{{ url('u/service',[$oo->id]) }}">{{ $oo->sid }}</a></td>
<td>{{ $oo->product->category_name }}</td> <td>{{ $oo->product->category_name }}</td>
<td>{{ $oo->name_short }}</td> <td>{{ $oo->name_short }}</td>
<td>{{ $oo->product->name_short }}</td> <td>{{ $oo->product->name }}</td>
<td>{{ $oo->external_billing ? '-' : $oo->invoice_next->format('Y-m-d') }}</td> <td>{{ $oo->external_billing ? '-' : $oo->invoice_next->format('Y-m-d') }}</td>
</tr> </tr>
@endforeach @endforeach
@ -67,6 +67,12 @@
return rows.count()+' x ' + group; return rows.count()+' x ' + group;
}, },
}, },
columnDefs: [
{
targets: [1],
visible: false,
},
],
}); });
$('#services_active tbody').on('click','tr', function () { $('#services_active tbody').on('click','tr', function () {

View File

@ -38,7 +38,7 @@
@foreach($oo->products->pluck('products')->flatten()->filter() as $po) @foreach($oo->products->pluck('products')->flatten()->filter() as $po)
<tr> <tr>
<td><a href="{{ url('a/supplier/product/addedit',[$po->supplier->id,$po->supplied->id,$po->supplied->category]) }}">{{ $po->lid }}</a></td> <td><a href="{{ url('a/supplier/product/addedit',[$po->supplier->id,$po->supplied->id,$po->supplied->category]) }}">{{ $po->lid }}</a></td>
<td>{{ $po->name_short }}</td> <td>{{ $po->pid }}</td>
<td>{{ $po->name }}</td> <td>{{ $po->name }}</td>
<td class="text-right">{{ $po->active ? 'YES' : 'NO' }}</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_string }}</td>

View File

@ -1,6 +1,6 @@
<!-- $o = Product::class --> <!-- $o = Product::class -->
<div class="col-md-12"> <div class="col-md-12">
<p>{!! $o->name_detail !!}</p> <p>{!! $o->name !!}</p>
</div> </div>
<table class="table table-condensed"> <table class="table table-condensed">