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:
* + lid : Local ID for product (part number)
* + sid : System ID for product (part number)
* + category : Type of product supplied
* + 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)
* + base_charge : Default billing amount
* + billing_interval : Default Billing Interval
* + billing_interval_string: Default Billing Interval in human-readable form
* + setup_charge : Charge to setup this product
* + base_charge : Default billing amount
* + category : Type of product supplied
* + 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
* + 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/*)
* + name : Short Name for our Product
@ -259,16 +258,6 @@ class Product extends Model implements IDs
* @return 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;
}
@ -278,7 +267,7 @@ class Product extends Model implements IDs
*
* @return string
*/
public function getNameShortAttribute(): string
public function getPIDAttribute(): string
{
return $this->translate->name_short;
}

View File

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

View File

@ -16,7 +16,7 @@
'id'=>'translate.name_short',
'old'=>'translate.name_short',
'name'=>'translate[name_short]',
'value'=>$o->name_short ?? '',
'value'=>$o->pid,
])
</div>
@ -28,7 +28,7 @@
'id'=>'translate.name_detail',
'old'=>'translate.name_detail',
'name'=>'translate[name_detail]',
'value'=>$o->name_detail ?? '',
'value'=>$o->name,
])
</div>
</div>
@ -53,7 +53,7 @@
</div>
<div class="row">
<div class="col-12 col-md-3">
<div class="col-12 col-md-4">
<div class="row">
<!-- Active -->
<div class="col-6">
@ -117,7 +117,7 @@
</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>
<hr>

View File

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

View File

@ -1,13 +1,13 @@
<!-- $o=App\Models\User -->
<!-- $o = User::class -->
<!-- Show active services -->
<div class="card card-dark">
<div class="card card-light">
<div class="card-header">
<h3 class="card-title">Active Services</h3>
</div>
<div class="card-body">
@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>
<tr>
<th>ID</th>
@ -24,7 +24,7 @@
<td><a href="{{ url('u/service',[$oo->id]) }}">{{ $oo->sid }}</a></td>
<td>{{ $oo->product->category_name }}</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>
</tr>
@endforeach
@ -67,6 +67,12 @@
return rows.count()+' x ' + group;
},
},
columnDefs: [
{
targets: [1],
visible: false,
},
],
});
$('#services_active tbody').on('click','tr', function () {

View File

@ -38,7 +38,7 @@
@foreach($oo->products->pluck('products')->flatten()->filter() as $po)
<tr>
<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 class="text-right">{{ $po->active ? 'YES' : 'NO' }}</td>
<td class="text-right">{{ $po->billing_interval_string }}</td>

View File

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