Show service detail on invoices

This commit is contained in:
Deon George 2021-09-30 12:54:44 +10:00
parent 5be4fe6784
commit c0ad46ba65
No known key found for this signature in database
GPG Key ID: 7670E8DC27415254
2 changed files with 11 additions and 2 deletions

View File

@ -26,7 +26,9 @@ use App\Traits\NextKey;
* *
* Attributes for services: * Attributes for services:
* + billing_period : The period that this service is billed for by default * + billing_period : The period that this service is billed for by default
* + name : Service short name with service address
* + name_short : Service Product short name, eg: phone number, domain name, certificate CN * + name_short : Service Product short name, eg: phone number, domain name, certificate CN
* + name_detail : Service Detail, eg: service_address
* + sid : System ID for service * + sid : System ID for service
* *
* @package App\Models * @package App\Models
@ -697,7 +699,7 @@ class Service extends Model implements IDs
public function getNameAttribute(): string public function getNameAttribute(): string
{ {
return $this->product->name_short.': '.$this->getNameShortAttribute(); return $this->getNameShortAttribute().(($x=$this->getNameDetailAttribute()) ? ': '.$x : '');
} }
/** /**
@ -712,6 +714,11 @@ class Service extends Model implements IDs
return $this->type ? $this->type->service_name : $this->id; return $this->type ? $this->type->service_name : $this->id;
} }
public function getNameDetailAttribute()
{
return $this->type ? $this->type->service_address : $this->id;
}
/** /**
* @deprecated see getInvoiceNextAttribute() * @deprecated see getInvoiceNextAttribute()
*/ */

View File

@ -109,7 +109,7 @@
@foreach ($o->product_services($po) as $so) @foreach ($o->product_services($po) as $so)
<tr id="invoice-service-items" class="invoice-services @if($o->products()->count() > 1) d-print-table-row @endif"> <tr id="invoice-service-items" class="invoice-services @if($o->products()->count() > 1) d-print-table-row @endif">
<td colspan="2">&nbsp;</td> <td colspan="2">&nbsp;</td>
<td colspan="2">Service: <strong>{{ $so->sid }}: {{ $so->name }}</strong></td> <td colspan="2">Service: <strong>{{ $so->sid }}: [{{ $so->name }}]</strong></td>
<td>&nbsp;</td> <td>&nbsp;</td>
<td class="text-right">${{ number_format($o->product_service_items($po,$so)->sum('total'),$o->currency()->rounding) }}</td> <td class="text-right">${{ number_format($o->product_service_items($po,$so)->sum('total'),$o->currency()->rounding) }}</td>
<td>&nbsp;</td> <td>&nbsp;</td>
@ -205,9 +205,11 @@
<a href="{{ url('u/invoice/cart',$o->id) }}" class="btn btn-success float-right"> <a href="{{ url('u/invoice/cart',$o->id) }}" class="btn btn-success float-right">
<i class="fas fa-credit-card"></i> Pay <i class="fas fa-credit-card"></i> Pay
</a> </a>
{{--
<a href="{{ url(sprintf('u/invoice/%s/pdf',$o->id)) }}" class="btn btn-primary float-right mr-2"> <a href="{{ url(sprintf('u/invoice/%s/pdf',$o->id)) }}" class="btn btn-primary float-right mr-2">
<i class="fas fa-download"></i> Download PDF <i class="fas fa-download"></i> Download PDF
</a> </a>
--}}
@endif @endif
</div> </div>
</div> </div>