Work on VOIP and Domain products
This commit is contained in:
parent
910edfd89f
commit
8311bfc268
@ -17,4 +17,11 @@ interface ServiceItem
|
|||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getServiceNameAttribute():string;
|
public function getServiceNameAttribute():string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Is this service in a contract
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function inContract(): bool;
|
||||||
}
|
}
|
@ -17,7 +17,7 @@ abstract class ServiceType extends Model
|
|||||||
*/
|
*/
|
||||||
public function service()
|
public function service()
|
||||||
{
|
{
|
||||||
return $this->morphOne(Service::class,'type','model','id');
|
return $this->morphOne(Service::class,'type','model','id','service_id');
|
||||||
}
|
}
|
||||||
|
|
||||||
/** SCOPES */
|
/** SCOPES */
|
||||||
|
@ -2,11 +2,32 @@
|
|||||||
|
|
||||||
namespace App\Models\Product;
|
namespace App\Models\Product;
|
||||||
|
|
||||||
|
use Illuminate\Support\Collection;
|
||||||
|
|
||||||
|
use App\Interfaces\ProductSupplier;
|
||||||
|
use App\Models\Base\ProductType;
|
||||||
use App\Traits\NextKey;
|
use App\Traits\NextKey;
|
||||||
|
|
||||||
class Domain extends \App\Models\Base\ProductType
|
class Domain extends ProductType implements ProductSupplier
|
||||||
{
|
{
|
||||||
use NextKey;
|
use NextKey;
|
||||||
|
|
||||||
const RECORD_ID = '';
|
const RECORD_ID = '';
|
||||||
|
|
||||||
|
public function allowance(): Collection
|
||||||
|
{
|
||||||
|
// N/A
|
||||||
|
return collect();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function allowance_string(): string
|
||||||
|
{
|
||||||
|
// N/A
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getCostAttribute(): float
|
||||||
|
{
|
||||||
|
// N/A
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
@ -15,22 +15,11 @@ class Adsl extends ServiceType implements ServiceItem
|
|||||||
use NextKey;
|
use NextKey;
|
||||||
const RECORD_ID = 'service__adsl';
|
const RECORD_ID = 'service__adsl';
|
||||||
|
|
||||||
// @todo column service_id can be removed.
|
|
||||||
protected $table = 'ab_service__adsl';
|
|
||||||
protected $dates = [
|
protected $dates = [
|
||||||
'service_connect_date',
|
'service_connect_date',
|
||||||
'service_contract_date'
|
'service_contract_date'
|
||||||
];
|
];
|
||||||
|
protected $table = 'ab_service__adsl';
|
||||||
/**
|
|
||||||
* The service this belongs to
|
|
||||||
*
|
|
||||||
* @return BelongsTo|MorphOne
|
|
||||||
*/
|
|
||||||
public function service()
|
|
||||||
{
|
|
||||||
return $this->belongsTo(Service::class);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** SCOPES */
|
/** SCOPES */
|
||||||
|
|
||||||
|
@ -2,23 +2,46 @@
|
|||||||
|
|
||||||
namespace App\Models\Service;
|
namespace App\Models\Service;
|
||||||
|
|
||||||
|
use App\Models\Base\ServiceType;
|
||||||
|
use App\Models\DomainRegistrar;
|
||||||
|
use App\Models\DomainTld;
|
||||||
|
use App\Interfaces\ServiceItem;
|
||||||
use App\Traits\NextKey;
|
use App\Traits\NextKey;
|
||||||
|
|
||||||
class Domain extends \App\Models\Base\ServiceType
|
class Domain extends ServiceType implements ServiceItem
|
||||||
{
|
{
|
||||||
use NextKey;
|
use NextKey;
|
||||||
const RECORD_ID = 'service__domain';
|
const RECORD_ID = 'service__domain';
|
||||||
|
|
||||||
|
protected $dates = [
|
||||||
|
'domain_expire',
|
||||||
|
];
|
||||||
protected $table = 'ab_service__domain';
|
protected $table = 'ab_service__domain';
|
||||||
protected $with = ['tld'];
|
protected $with = ['tld'];
|
||||||
|
|
||||||
public function tld()
|
public function registrar()
|
||||||
{
|
{
|
||||||
return $this->belongsTo(\App\Models\DomainTld::class,'domain_tld_id');
|
return $this->belongsTo(DomainRegistrar::class,'domain_registrar_id');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getNameAttribute()
|
public function tld()
|
||||||
{
|
{
|
||||||
return sprintf('%s.%s',$this->domain_name,$this->tld->name);
|
return $this->belongsTo(DomainTld::class,'domain_tld_id');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getServiceDescriptionAttribute(): string
|
||||||
|
{
|
||||||
|
// N/A
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getServiceNameAttribute(): string
|
||||||
|
{
|
||||||
|
return sprintf('%s.%s',strtoupper($this->domain_name),strtoupper($this->tld->name));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function inContract(): bool
|
||||||
|
{
|
||||||
|
return $this->domain_expire->isFuture();
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -11,6 +11,10 @@ class Voip extends ServiceType implements ServiceItem
|
|||||||
use NextKey;
|
use NextKey;
|
||||||
const RECORD_ID = 'service__adsl';
|
const RECORD_ID = 'service__adsl';
|
||||||
|
|
||||||
|
protected $dates = [
|
||||||
|
'service_connect_date',
|
||||||
|
'service_contract_date',
|
||||||
|
];
|
||||||
protected $table = 'ab_service__voip';
|
protected $table = 'ab_service__voip';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -32,4 +36,9 @@ class Voip extends ServiceType implements ServiceItem
|
|||||||
{
|
{
|
||||||
return $this->service_number;
|
return $this->service_number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function inContract(): bool
|
||||||
|
{
|
||||||
|
return $this->service_contract_date AND $this->service_contract_date->addMonths($this->contract_term)->isFuture();
|
||||||
|
}
|
||||||
}
|
}
|
@ -1,28 +1,32 @@
|
|||||||
<table class="table table-sm">
|
<table class="table table-sm">
|
||||||
<tr>
|
<tr>
|
||||||
<th>Supplier</th><td>{{ $o->product->type->supplier->name }}</td>
|
<th>Supplier</th><td>{{ $o->product->type ? $o->product->type->supplier->name : 'Supplier Unknown' }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Supplier Product</th><td>#{{ $o->product_id }}: {{ $o->product->type->product->product_id }}</td>
|
<th>Supplier Product</th><td>#{{ $o->product_id }}: {{ $o->product->type ? $o->product->type->product->product_id : 'Product Unknown' }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@if($o->product->type)
|
||||||
|
<tr>
|
||||||
|
<!-- @todo Tax shouldnt be hard coded -->
|
||||||
|
<th>Supplier Setup</th><td>${{ number_format($o->product->type->product->setup_cost*1.1,2) }}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>Supplier Cost</th><td>${{ number_format($o->product->type->cost,2) }}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>Supplier Contract</th><td>{{ $o->product->type->product->contract_term }} months</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<!-- @todo Tax shouldnt be hard coded -->
|
||||||
|
<th>Supplier Min Cost</th><td>${{ number_format((($x=$o->product->type->product)->setup_cost+$x->base_cost*$x->contract_term)*1.1,2) }}</td>
|
||||||
|
</tr>
|
||||||
|
@endif
|
||||||
<tr>
|
<tr>
|
||||||
<!-- @todo Tax shouldnt be hard coded -->
|
<th>Price</th><td>${{ number_format($o->billing_monthly_price,2) }} <small>(${{ number_format($o->billing_monthly_price*12,2) }} Annually)</small></td>
|
||||||
<th>Supplier Setup</th><td>${{ number_format($o->product->type->product->setup_cost*1.1,2) }}</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th>Supplier Cost</th><td>${{ number_format($o->product->type->cost,2) }}</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th>Supplier Contract</th><td>{{ $o->product->type->product->contract_term }} months</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<!-- @todo Tax shouldnt be hard coded -->
|
|
||||||
<th>Supplier Min Cost</th><td>${{ number_format((($x=$o->product->type->product)->setup_cost+$x->base_cost*$x->contract_term)*1.1,2) }}</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th>Price</th><td>${{ number_format($o->billing_monthly_price,2) }}</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th>Markup</th><td>{{ number_format(($o->billing_monthly_price/$o->product->type->cost-1)*100,2) }}%</td>
|
|
||||||
</tr>
|
</tr>
|
||||||
|
@if($o->product->type)
|
||||||
|
<tr>
|
||||||
|
<th>Markup</th><td>{{ number_format(($o->billing_monthly_price/$o->product->type->cost-1)*100,2) }}%</td>
|
||||||
|
</tr>
|
||||||
|
@endif
|
||||||
</table>
|
</table>
|
@ -0,0 +1,59 @@
|
|||||||
|
<div class="card">
|
||||||
|
@if($o->service->isPending())
|
||||||
|
<div class="ribbon-wrapper ribbon-lg">
|
||||||
|
<div class="ribbon bg-warning">
|
||||||
|
Pending
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
<div class="card-header bg-gray-dark">
|
||||||
|
<h3 class="card-title">Domain Details</h3>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="card-body bg-gray-dark">
|
||||||
|
<table class="table table-sm">
|
||||||
|
<tr>
|
||||||
|
<th>Domain Name</th>
|
||||||
|
<td>{{ $o->service_name }}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>Registrar URL</th>
|
||||||
|
<td><a href="{{ $o->registrar->whitelabel_url }}" target="_blank" class="text-white">{{ $o->registrar->whitelabel_url }}</a></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>Registrar Username</th>
|
||||||
|
<td>{{ $o->registrar_username }}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>Registrar Password</th>
|
||||||
|
<td>{{ $o->registrar_password }}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>Domain Auth</th>
|
||||||
|
<td>{{ $o->registrar_auth_password }}</td>
|
||||||
|
</tr>
|
||||||
|
@if($o->service_connect_date)
|
||||||
|
<tr>
|
||||||
|
<th>Connected</th>
|
||||||
|
<td>{{ $o->service_connect_date->format('Y-m-d') }}</td>
|
||||||
|
</tr>
|
||||||
|
@endif
|
||||||
|
@if ($o->inContract())
|
||||||
|
<tr>
|
||||||
|
<th>Contract</th>
|
||||||
|
<!-- @todo -->
|
||||||
|
<td>12 months <small>({{ ($x=$o->domain_expire)->diffForHumans() }})</small></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>Contract End</th>
|
||||||
|
<td>{{ $x->format('Y-m-d') }}</td>
|
||||||
|
</tr>
|
||||||
|
@endif
|
||||||
|
<tr>
|
||||||
|
<th>Cancel Notice</th>
|
||||||
|
<td>Before renewal</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
@ -0,0 +1,68 @@
|
|||||||
|
<div class="card">
|
||||||
|
@if($o->service->isPending())
|
||||||
|
<div class="ribbon-wrapper ribbon-lg">
|
||||||
|
<div class="ribbon bg-warning">
|
||||||
|
Pending
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
<div class="card-header bg-gray-dark">
|
||||||
|
<h3 class="card-title">VOIP Details</h3>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="card-body bg-gray-dark">
|
||||||
|
<table class="table table-sm">
|
||||||
|
<tr>
|
||||||
|
<th>Address</th>
|
||||||
|
<td>{{ $o->service_description }}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>Service Number</th>
|
||||||
|
<td>{{ $o->service_name }}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>Service Username</th>
|
||||||
|
<td>{{ $o->service_username }}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>Service Password</th>
|
||||||
|
<td>{{ $o->service_password }}</td>
|
||||||
|
</tr>
|
||||||
|
@if($o->service_connect_date)
|
||||||
|
<tr>
|
||||||
|
<th>Connected</th>
|
||||||
|
<td>{{ $o->service_connect_date->format('Y-m-d') }}</td>
|
||||||
|
</tr>
|
||||||
|
@endif
|
||||||
|
<!-- @todo -->
|
||||||
|
@if($o->technology)
|
||||||
|
<tr>
|
||||||
|
<th>Technology</th>
|
||||||
|
<td>{{ $o->technology }}</td>
|
||||||
|
</tr>
|
||||||
|
@endif
|
||||||
|
<!-- @todo -->
|
||||||
|
@if($o->service->product->type)
|
||||||
|
<tr>
|
||||||
|
<th>Traffic</th>
|
||||||
|
<td>{{ $o->service->product->type->allowance_string() }} GB @if(FALSE)(YY GB used month)@endif</td>
|
||||||
|
</tr>
|
||||||
|
@endif
|
||||||
|
@if ($o->inContract())
|
||||||
|
<tr>
|
||||||
|
<th>Contract</th>
|
||||||
|
<td>{{ $o->contract_term }} months <small>({{ ($x=$o->service_contract_date->addMonths($o->contract_term))->diffForHumans() }})</small></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>Contract End</th>
|
||||||
|
<td>{{ $x->format('Y-m-d') }}</td>
|
||||||
|
</tr>
|
||||||
|
@endif
|
||||||
|
<tr>
|
||||||
|
<th>Cancel Notice</th>
|
||||||
|
<td>1 month @if($o->inContract())<small>(after {{ $o->service_contract_date->addMonths($o->contract_term-1)->format('Y-m-d') }})</small>@endif</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
Loading…
Reference in New Issue
Block a user