Start work on updating services

This commit is contained in:
Deon George 2022-04-19 17:07:39 +10:00
parent ebf08ea414
commit 621a132e35
63 changed files with 1038 additions and 612 deletions

View File

@ -33,7 +33,7 @@ class ServiceList extends Command
*/ */
public function handle() public function handle()
{ {
$header = '|%13s|%-10s|%-35s|%-40s|%8s|%10s|%15s|%10s|%10s|%12s|%14s|'; $header = '|%13s|%-14s|%-35s|%-40s|%8s|%17s|%12s|%12s|%12s|%12s|%14s|';
$this->warn(sprintf($header, $this->warn(sprintf($header,
'ID', 'ID',
@ -58,24 +58,24 @@ class ServiceList extends Command
if ($this->option('type') AND ($o->product->getProductTypeAttribute() !== $this->option('type'))) if ($this->option('type') AND ($o->product->getProductTypeAttribute() !== $this->option('type')))
continue; continue;
$c = $o->invoice_items->filter(function($item) {return $item->item_type === 0; })->sortby('date_start')->first(); $c = $o->invoice_items->filter(function($item) {return $item->item_type === 0; })->sortby('start_at')->first();
if ($this->option('fix') AND ! $o->date_start AND $c AND $c->date_start AND $o->type AND $o->type->service_connect_date AND $c->date_start->format('Y-m-d') == $o->type->service_connect_date->format('Y-m-d')) { if ($this->option('fix') AND ! $o->start_at AND $c AND $c->start_at AND $o->type AND $o->type->connect_at AND $c->start_at->format('Y-m-d') == $o->type->connect_at->format('Y-m-d')) {
$o->date_start = $o->type->service_connect_date; $o->start_at = $o->type->connect_at;
$o->save(); $o->save();
} }
$this->info(sprintf($header, $this->info(sprintf($header,
$o->sid, $o->sid,
$o->product->getProductTypeAttribute(), $o->product->getProductTypeAttribute(),
$o->product->getNameAttribute(), substr($o->product->getNameAttribute(),0,35),
$o->name_short, substr($o->name_short,0,40),
$o->active ? 'active' : 'inactive', $o->active ? 'active' : 'inactive',
$o->status, $o->status,
$o->invoice_next ? $o->invoice_next->format('Y-m-d') : NULL, $o->invoice_next ? $o->invoice_next->format('Y-m-d') : NULL,
$o->date_start ? $o->date_start->format('Y-m-d') : NULL, $o->start_at ? $o->start_at->format('Y-m-d') : NULL,
$o->date_end ? $o->date_end->format('Y-m-d') : NULL, $o->stop_at ? $o->stop_at->format('Y-m-d') : NULL,
($o->type AND $o->type->service_connect_date) ? $o->type->service_connect_date->format('Y-m-d') : NULL, ($o->type AND $o->type->connect_at) ? $o->type->connect_at->format('Y-m-d') : NULL,
($c && $c->date_start) ? $c->date_start->format('Y-m-d') : NULL, ($c && $c->date_start) ? $c->date_start->format('Y-m-d') : NULL,
)); ));
} }

View File

@ -28,7 +28,7 @@ class AdminController extends Controller
$request->validate([ $request->validate([
'account_id' => 'required|exists:accounts,id', 'account_id' => 'required|exists:accounts,id',
'charge_date' => 'required|date', 'charge_date' => 'required|date',
'service_id' => 'required|exists:ab_service,id', 'service_id' => 'required|exists:services,id',
'quantity' => 'required|numeric|not_in:0', 'quantity' => 'required|numeric|not_in:0',
'amount' => 'required|numeric|min:0.01', 'amount' => 'required|numeric|min:0.01',
'sweep_type' => 'required|numeric|in:'.implode(',',array_keys(Charge::sweep)), 'sweep_type' => 'required|numeric|in:'.implode(',',array_keys(Charge::sweep)),

View File

@ -20,7 +20,7 @@ class ProductController extends Controller
{ {
switch ($request->type) { switch ($request->type) {
case 'App\Models\Product\Broadband': case 'App\Models\Product\Broadband':
return Product\Broadband::select(['id','supplier_broadband_id']) return Product\Broadband::select(['id','supplier_item_id'])
->with(['supplied.supplier_detail.supplier']) ->with(['supplied.supplier_detail.supplier'])
->get() ->get()
->map(function($item) { return ['id'=>$item->id,'name'=>sprintf('%s: %s',$item->supplied->supplier_detail->supplier->name,$item->supplied->name)]; }) ->map(function($item) { return ['id'=>$item->id,'name'=>sprintf('%s: %s',$item->supplied->supplier_detail->supplier->name,$item->supplied->name)]; })
@ -28,7 +28,7 @@ class ProductController extends Controller
->values(); ->values();
case 'App\Models\Product\Email': case 'App\Models\Product\Email':
return Product\Email::select(['id','supplier_email_id']) return Product\Email::select(['id','supplier_item_id'])
->with(['supplied.supplier_detail.supplier']) ->with(['supplied.supplier_detail.supplier'])
->get() ->get()
->map(function($item) { return ['id'=>$item->id,'name'=>sprintf('%s: %s',$item->supplied->supplier_detail->supplier->name,$item->supplied->name)]; }) ->map(function($item) { return ['id'=>$item->id,'name'=>sprintf('%s: %s',$item->supplied->supplier_detail->supplier->name,$item->supplied->name)]; })
@ -36,7 +36,7 @@ class ProductController extends Controller
->values(); ->values();
case 'App\Models\Product\Host': case 'App\Models\Product\Host':
return Product\Host::select(['id','supplier_host_id']) return Product\Host::select(['id','supplier_item_id'])
->with(['supplied.supplier_detail.supplier']) ->with(['supplied.supplier_detail.supplier'])
->get() ->get()
->map(function($item) { return ['id'=>$item->id,'name'=>sprintf('%s: %s',$item->supplied->supplier_detail->supplier->name,$item->supplied->name)]; }) ->map(function($item) { return ['id'=>$item->id,'name'=>sprintf('%s: %s',$item->supplied->supplier_detail->supplier->name,$item->supplied->name)]; })

View File

@ -7,7 +7,7 @@ use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Gate; use Illuminate\Support\Facades\Gate;
use App\Models\{Account,Invoice,Payment,Service,Service\Adsl,Service\Voip,User}; use App\Models\{Account,Invoice,Payment,Service,Service\Broadband,Service\Phone,User};
class SearchController extends Controller class SearchController extends Controller
{ {
@ -65,8 +65,8 @@ class SearchController extends Controller
$result->push(['name'=>sprintf('%s: %s',$o->sid,$o->account->name),'value'=>'/u/invoice/'.$o->id,'category'=>'Invoices']); $result->push(['name'=>sprintf('%s: %s',$o->sid,$o->account->name),'value'=>'/u/invoice/'.$o->id,'category'=>'Invoices']);
} }
# Look for an ADSL/NBN Service # Look for an Broadband Service
foreach (Service\Broadband::Search($request->input('term')) foreach (Broadband::Search($request->input('term'))
->whereIN('account_id',$accounts) ->whereIN('account_id',$accounts)
->orderBy('service_number') ->orderBy('service_number')
->limit(10)->get() as $o) ->limit(10)->get() as $o)
@ -74,13 +74,13 @@ class SearchController extends Controller
$result->push(['name'=>sprintf('%s (%s)',$o->service_name,$o->service->sid),'value'=>'/u/service/'.$o->id,'category'=>'Broadband']); $result->push(['name'=>sprintf('%s (%s)',$o->service_name,$o->service->sid),'value'=>'/u/service/'.$o->id,'category'=>'Broadband']);
} }
# Look for an VOIP Service # Look for an Phone Service
foreach (Voip::Search($request->input('term')) foreach (Phone::Search($request->input('term'))
->whereIN('account_id',$accounts) ->whereIN('account_id',$accounts)
->orderBy('service_number') ->orderBy('service_number')
->limit(10)->get() as $o) ->limit(10)->get() as $o)
{ {
$result->push(['name'=>sprintf('%s (%s)',$o->service_name,$o->service->sid),'value'=>'/u/service/'.$o->id,'category'=>'VOIP']); $result->push(['name'=>sprintf('%s (%s)',$o->service_name,$o->service->sid),'value'=>'/u/service/'.$o->id,'category'=>'Phone']);
} }
# Look for Domain Name # Look for Domain Name

View File

@ -246,8 +246,8 @@ class ServiceController extends Controller
{ {
$o = Service\Domain::serviceActive() $o = Service\Domain::serviceActive()
->serviceUserAuthorised(Auth::user()) ->serviceUserAuthorised(Auth::user())
->select('service_domains.*') ->select('service_domain.*')
->join('ab_service',['ab_service.id'=>'service_domains.service_id']) ->join('services',['services.id'=>'service_domain.service_id'])
->with(['service.account','registrar']) ->with(['service.account','registrar'])
->get(); ->get();
@ -260,8 +260,8 @@ class ServiceController extends Controller
// @todo Need to add the with path when calculating next_billed and price // @todo Need to add the with path when calculating next_billed and price
$o = Service\Email::serviceActive() $o = Service\Email::serviceActive()
->serviceUserAuthorised(Auth::user()) ->serviceUserAuthorised(Auth::user())
->select('service_emails.*') ->select('service_email.*')
->join('ab_service',['ab_service.id'=>'service_emails.service_id']) ->join('services',['services.id'=>'service_email.service_id'])
->with(['service.account','service.product.type.supplied.supplier_detail.supplier','tld']) ->with(['service.account','service.product.type.supplied.supplier_detail.supplier','tld'])
->get(); ->get();
@ -274,8 +274,8 @@ class ServiceController extends Controller
// @todo Need to add the with path when calculating next_billed and price // @todo Need to add the with path when calculating next_billed and price
$o = Service\Host::serviceActive() $o = Service\Host::serviceActive()
->serviceUserAuthorised(Auth::user()) ->serviceUserAuthorised(Auth::user())
->select('ab_service__hosting.*') ->select('service_host.*')
->join('ab_service',['ab_service.id'=>'ab_service__hosting.service_id']) ->join('services',['services.id'=>'service_host.service_id'])
->with(['service.account','service.product.type.supplied.supplier_detail.supplier','tld']) ->with(['service.account','service.product.type.supplied.supplier_detail.supplier','tld'])
->get(); ->get();

View File

@ -6,6 +6,13 @@ use Carbon\Carbon;
interface ServiceItem interface ServiceItem
{ {
/**
* Months the service is contracted for.
*
* @return int
*/
public function getContractTermAttribute(): int;
/** /**
* Return the Service Description. * Return the Service Description.
* *
@ -16,7 +23,7 @@ interface ServiceItem
/** /**
* Date the service expires * Date the service expires
*/ */
public function getServiceExpireAttribute(): Carbon; public function getServiceExpireAttribute(): ?Carbon;
/** /**
* Return the Service Name. * Return the Service Name.
@ -25,6 +32,13 @@ interface ServiceItem
*/ */
public function getServiceNameAttribute(): string; public function getServiceNameAttribute(): string;
/**
* Has this service expired
*
* @return bool
*/
public function hasExpired(): bool;
/** /**
* Is this service in a contract * Is this service in a contract
* *

View File

@ -90,11 +90,11 @@ final class BroadbandTraffic implements ShouldQueue
// Find the right service dependant on the dates we supplied the service // Find the right service dependant on the dates we supplied the service
$oo = Adsl::where('service_username',$row[$o->getColumnKey('Login')]) $oo = Adsl::where('service_username',$row[$o->getColumnKey('Login')])
->select(DB::raw('ab_service__adsl.*')) ->select(DB::raw('ab_service__adsl.*'))
->join('ab_service','ab_service.id','=','service_id') ->join('services','services.id','=','service_id')
->where('ab_service.date_start','<=',$date->format('U')) ->where('services.start_at','<=',$date)
->where(function($query) use ($date) { ->where(function($query) use ($date) {
$query->whereNULL('ab_service.date_end') $query->whereNULL('services.stop_at')
->orWhere('ab_service.date_end','<=',$date->format('U')); ->orWhere('services.stop_at','<=',$date);
}) })
->get(); ->get();

View File

@ -36,12 +36,12 @@ class CancelRequest extends Mailable
public function build() public function build()
{ {
switch (get_class($this->service->type)) { switch (get_class($this->service->type)) {
case 'App\Models\Service\Adsl': case 'App\Models\Service\Broadband':
$subject = sprintf('CANCEL NBN: %s',$this->service->type->service_address); $subject = sprintf('Cancel BROADBAND: %s',$this->service->type->service_address);
break; break;
case 'App\Models\Service\Voip': case 'App\Models\Service\Phone':
$subject = sprintf('CANCEL VOIP: %s',$this->service->type->service_number); $subject = sprintf('Cancel PHONE: %s',$this->service->type->service_number);
break; break;
default: default:

View File

@ -36,12 +36,12 @@ class ChangeRequest extends Mailable
public function build() public function build()
{ {
switch (get_class($this->service->type)) { switch (get_class($this->service->type)) {
case 'App\Models\Service\Adsl': case 'App\Models\Service\Broadband':
$subject = sprintf('Change NBN: %s',$this->service->type->service_address); $subject = sprintf('Change BROADBAND: %s',$this->service->type->service_address);
break; break;
case 'App\Models\Service\Voip': case 'App\Models\Service\Phone':
$subject = sprintf('Change VOIP: %s',$this->service->type->service_number); $subject = sprintf('Change PHONE: %s',$this->service->type->service_number);
break; break;
default: default:

View File

@ -36,12 +36,12 @@ class OrderRequest extends Mailable
public function build() public function build()
{ {
switch (get_class($this->service->type)) { switch (get_class($this->service->type)) {
case 'App\Models\Service\Adsl': case 'App\Models\Service\Broadband':
$subject = sprintf('NBN: %s',$this->service->type->service_address); $subject = sprintf('Order BROADBAND: %s',$this->service->type->service_address);
break; break;
case 'App\Models\Service\Voip': case 'App\Models\Service\Phone':
$subject = sprintf('VOIP: %s',$this->service->type->service_number); $subject = sprintf('Order PHONE: %s',$this->service->type->service_number);
break; break;
default: default:

View File

@ -35,11 +35,12 @@ class OrderRequestApprove extends Mailable
*/ */
public function build() public function build()
{ {
// @todo This is not consistent with Cancel/Change Request
switch ($this->service->category) { switch ($this->service->category) {
case 'ADSL': $subject = sprintf('%s: %s',$this->service->category,$this->service->service_adsl->service_address); case 'BROADBAND': $subject = sprintf('%s: %s',$this->service->category,$this->service->type->service_address);
break; break;
case 'VOIP': $subject = sprintf('%s: %s',$this->service->category,$this->service->service_voip->service_number); case 'PHONE': $subject = sprintf('%s: %s',$this->service->category,$this->service->type->service_number);
break; break;
default: default:

View File

@ -2,14 +2,34 @@
namespace App\Models\Base; namespace App\Models\Base;
use Carbon\Carbon;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
use App\Models\Service; use App\Interfaces\ServiceItem;
use App\Models\{Account,Service};
use App\Models\Supplier\Type;
use App\Traits\{ScopeServiceActive,ScopeServiceUserAuthorised};
abstract class ServiceType extends Model abstract class ServiceType extends Model implements ServiceItem
{ {
use ScopeServiceActive,ScopeServiceUserAuthorised;
protected $dates = [
'expire_at',
];
public $timestamps = FALSE; public $timestamps = FALSE;
/* RELATIONS */
/**
* Account this service belongs to
* @return \Illuminate\Database\Eloquent\Relations\HasOneThrough
*/
public function account()
{
return $this->hasOneThrough(Account::class,Service::class);
}
/** /**
* @NOTE: The service_id column could be discarded, if the id column=service_id * @NOTE: The service_id column could be discarded, if the id column=service_id
* @return \Illuminate\Database\Eloquent\Relations\MorphOne * @return \Illuminate\Database\Eloquent\Relations\MorphOne
@ -19,27 +39,61 @@ abstract class ServiceType extends Model
return $this->morphOne(Service::class,'type','model','id','service_id'); return $this->morphOne(Service::class,'type','model','id','service_id');
} }
/** SCOPES */ /* SCOPES */
/** /**
* Search for a record * Search for a record
* *
* @param $query * @param $query
* @param string $term * @param string $term
* @return * @return mixed
*/ */
public function scopeSearch($query,string $term) public function scopeSearch($query,string $term)
{ {
return $query return $query
->with(['service']) ->with(['service'])
->join('ab_service','ab_service.id','=',$this->getTable().'.service_id') ->join('services','services.id','=',$this->getTable().'.service_id')
->Where('ab_service.id','like','%'.$term.'%'); ->Where('services.id','like','%'.$term.'%');
} }
/** ATTRIBUTES **/ /* INTERFACE */
public function getContractTermAttribute(): int
{
return $this->service->offering->contract_term;
}
public function getServiceExpireAttribute(): ?Carbon
{
return $this->expire_at ?: $this->service->invoice_next_at;
}
public function hasExpired(): bool
{
return (! $this->inContract()) && ($this->service->invoice_next_at && $this->service->invoice_next_at->isPast());
}
public function inContract(): bool
{
return $this->expire_at && $this->expire_at->isFuture();
}
/* ATTRIBUTES */
public function getTypeAttribute() public function getTypeAttribute()
{ {
return strtolower((new \ReflectionClass($this))->getShortName()); return strtolower((new \ReflectionClass($this))->getShortName());
} }
/* METHODS */
/**
* The supplier's service that we provide
*
* @return Type
*/
public function supplied(): Type
{
return $this->service->product->type->supplied;
}
} }

View File

@ -163,7 +163,8 @@ class Invoice extends Model implements IDs
public function items() public function items()
{ {
return $this->hasMany(InvoiceItem::class) return $this->hasMany(InvoiceItem::class)
->where('active',TRUE); ->where('active',TRUE)
->with(['taxes','product']);
} }
public function payments() public function payments()
@ -402,8 +403,7 @@ class Invoice extends Model implements IDs
$return->push($po); $return->push($po);
} }
$lo = $this->account->user->language; return $return->sortBy(function ($item) {
return $return->sortBy(function ($item) use ($lo) {
return $item->name; return $item->name;
}); });
} }

View File

@ -10,6 +10,7 @@ use App\Models\Supplier;
use App\Models\Service\Broadband as ServiceBroadband; use App\Models\Service\Broadband as ServiceBroadband;
use App\Models\Supplier\Broadband as SupplierBroadband; use App\Models\Supplier\Broadband as SupplierBroadband;
// @todo does this need to extend Type? Perhaps have a ProductType consistent with ServiceType.
final class Broadband extends Type implements ProductItem final class Broadband extends Type implements ProductItem
{ {
use ScopeActive; use ScopeActive;
@ -44,7 +45,7 @@ final class Broadband extends Type implements ProductItem
*/ */
public function supplied() public function supplied()
{ {
return $this->hasOne(SupplierBroadband::class,'id','supplier_broadband_id'); return $this->hasOne(SupplierBroadband::class,'id','supplier_item_id');
} }
/* INTERFACES */ /* INTERFACES */

View File

@ -24,7 +24,7 @@ final class Domain extends Type implements ProductItem
*/ */
public function supplied() public function supplied()
{ {
return $this->hasOne(SupplierDomain::class,'id','supplier_domain_id'); return $this->hasOne(SupplierDomain::class,'id','supplier_item_id');
} }
/* INTERFACES */ /* INTERFACES */

View File

@ -24,7 +24,7 @@ final class Email extends Type implements ProductItem
*/ */
public function supplied() public function supplied()
{ {
return $this->hasOne(SupplierEmail::class,'id','supplier_email_id'); return $this->hasOne(SupplierEmail::class,'id','supplier_item_id');
} }
/* INTERFACES */ /* INTERFACES */

View File

@ -24,7 +24,7 @@ final class Generic extends Type implements ProductItem
*/ */
public function supplied() public function supplied()
{ {
return $this->hasOne(SupplierGeneric::class,'id','supplier_generic_id'); return $this->hasOne(SupplierGeneric::class,'id','supplier_item_id');
} }
/* INTERFACES */ /* INTERFACES */

View File

@ -24,7 +24,7 @@ final class Host extends Type implements ProductItem
*/ */
public function supplied() public function supplied()
{ {
return $this->hasOne(SupplierHost::class,'id','supplier_host_id'); return $this->hasOne(SupplierHost::class,'id','supplier_item_id');
} }
/* INTERFACES */ /* INTERFACES */

View File

@ -5,18 +5,18 @@ namespace App\Models\Product;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
use App\Interfaces\ProductItem; use App\Interfaces\ProductItem;
use App\Models\Service\Voip as ServiceVoip; use App\Models\Service\Phone as ServicePhone;
use App\Models\Supplier\Voip as SupplierVoip; use App\Models\Supplier\Phone as SupplierPhone;
final class Voip extends Type implements ProductItem final class Phone extends Type implements ProductItem
{ {
protected $table = 'product_voip'; protected $table = 'product_phone';
protected array $order_attributes = [ protected array $order_attributes = [
'options.phonenumber'=>[ 'options.phonenumber'=>[
'request'=>'options.phonenumber', 'request'=>'options.phonenumber',
'key'=>'service_number', 'key'=>'service_number',
'validation'=>'nullable|size:10|unique:ab_service__voip,service_number', 'validation'=>'nullable|size:10|unique:service_phone,service_number',
'validation_message'=>'Phone Number is a required field.', 'validation_message'=>'Phone Number is a required field.',
], ],
'options.supplier'=>[ 'options.supplier'=>[
@ -40,7 +40,7 @@ final class Voip extends Type implements ProductItem
]; ];
// The model that is referenced when this product is ordered // The model that is referenced when this product is ordered
protected string $order_model = ServiceVoip::class; protected string $order_model = ServicePhone::class;
/* RELATIONS */ /* RELATIONS */
@ -51,19 +51,20 @@ final class Voip extends Type implements ProductItem
*/ */
public function supplied() public function supplied()
{ {
return $this->hasOne(SupplierVoip::class,'id','supplier_voip_id'); return $this->hasOne(SupplierPhone::class,'id','supplier_item_id');
} }
/* INTERFACES */ /* INTERFACES */
public function getContractTermAttribute(): int public function getContractTermAttribute(): int
{ {
// @todo Get this from the DB
return 12; return 12;
} }
public function getTypeAttribute() public function getTypeAttribute()
{ {
return 'VOIP'; return 'PHONE';
} }
public function hasUsage(): bool public function hasUsage(): bool

View File

@ -24,7 +24,7 @@ final class SSL extends Type implements ProductItem
*/ */
public function supplied() public function supplied()
{ {
return $this->hasOne(SupplierSSL::class,'id','supplier_ssl_id'); return $this->hasOne(SupplierSSL::class,'id','supplier_item_id');
} }
/* INTERFACES */ /* INTERFACES */
@ -52,19 +52,9 @@ final class SSL extends Type implements ProductItem
return 0; return 0;
} }
public function getProductAttribute()
{
$o = new \stdClass();
$o->product_id = 'INT';
$o->setup_cost = 0;
$o->base_cost = 0;
$o->contract_term = 0; // @todo
return $o;
}
public function getSupplierAttribute() public function getSupplierAttribute()
{ {
abort(500,'deprecated');
$o = new \stdClass(); $o = new \stdClass();
$o->name = 'Internal'; $o->name = 'Internal';

View File

@ -7,6 +7,10 @@ use Illuminate\Database\Eloquent\Model;
use App\Models\Product; use App\Models\Product;
use App\Traits\{OrderServiceOptions,SiteID}; use App\Traits\{OrderServiceOptions,SiteID};
/**
* @todo These tables have a base_cost/setup_cost/contract_term columns - how is that different to the supplier_tables?
* @todo Ensure our terminology is consistent - we have a "cost", we "charge" clients.
*/
abstract class Type extends Model abstract class Type extends Model
{ {
use SiteID,OrderServiceOptions; use SiteID,OrderServiceOptions;

View File

@ -18,35 +18,35 @@ use Leenooks\Carbon;
use Symfony\Component\HttpKernel\Exception\HttpException; use Symfony\Component\HttpKernel\Exception\HttpException;
use App\Interfaces\IDs; use App\Interfaces\IDs;
use App\Traits\NextKey;
/** /**
* Class Service * Class Service
* Services that belong to an account * Services that belong to an account
* *
* Attributes for services: * Attributes for services:
* + additional_cost : Pending additional charges for this service (excluding setup) * + additional_cost : Pending additional charges for this service (excluding setup) //@todo check all these are still valid
* + billing_cost : Charge for this service each invoice period * + billing_cost : Charge for this service each invoice period
* + billing_interval : The period that this service is billed for by default * + billing_interval : The period that this service is billed for by default
* + billing_interval_string : The period that this service is billed for by default as a name * + billing_interval_string : The period that this service is billed for by default as a name
* + contract_term : The term that this service must be active
* + contract_end : The date that the contract ends for this service
* + name : Service short name with service address * + 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 * + name_detail : Service Detail, eg: service_address
* + sid : System ID for service * + sid : System ID for service
* *
* = Terminology:
* - Offering, what product we supply (we make offerings from supplier's supplied products) - in the DB these are products/*
* - Supplied, our supplier's product that is providing the service - in the DB these are supplier/*
* - Type, what service we are providing, made up of a product we supply - in the DB these are service/*
*
* @package App\Models * @package App\Models
* @todo "Billing Start Date" = "connection date" for sub types??
*/ */
// @todo All the methods/attributes in this file need to be checked. // @todo All the methods/attributes in this file need to be checked.
class Service extends Model implements IDs class Service extends Model implements IDs
{ {
use HasFactory,NextKey; use HasFactory;
const RECORD_ID = 'service';
public $incrementing = FALSE;
protected $table = 'ab_service';
const CREATED_AT = 'date_orig';
const UPDATED_AT = 'date_last';
protected $appends = [ protected $appends = [
'account_name', 'account_name',
@ -59,17 +59,16 @@ class Service extends Model implements IDs
'status', 'status',
]; ];
protected $dates = [
'date_last_invoice',
'date_next_invoice',
'date_start',
'date_end',
];
protected $casts = [ protected $casts = [
'order_info'=>AsCollection::class, 'order_info'=>AsCollection::class,
]; ];
public $dateFormat = 'U';
protected $dates = [
'invoice_last_at',
'invoice_next_at',
'start_at',
'stop_at',
];
protected $visible = [ protected $visible = [
'account_name', 'account_name',
@ -484,7 +483,6 @@ class Service extends Model implements IDs
* Return the auto billing details * Return the auto billing details
* *
* @return mixed * @return mixed
* @deprecated use billing directly?
*/ */
public function getAutoPayAttribute() public function getAutoPayAttribute()
{ {
@ -536,6 +534,33 @@ class Service extends Model implements IDs
return Invoice::billing_name($this->getBillingIntervalAttribute()); return Invoice::billing_name($this->getBillingIntervalAttribute());
} }
/**
* The date the contract ends
*
* Service contracts end the later of the start_date + contract_term or the expire date.
*
* @return Carbon
*/
public function getContractEndAttribute(): ?\Carbon\Carbon
{
// If we have no start date or expire date, then NULL;
if (! $this->start_at && ! $this->type->expire_at)
return NULL;
// If we dont have a start date, use the expire date
if (! $this->start_at)
return $this->type->expire_at;
$end = $this->start_at->addMonths($this->getContractTermAttribute());
// If we dont have an expire date, use the start date + contract_term
if (! $this->type->expire_at)
return $end;
// We have both, so it's the later of the two.
return ($end < $this->type->expire_at) ? $this->type->expire_at : $end;
}
/** /**
* This function will determine the minimum contract term for a service, which is the maximum of * This function will determine the minimum contract term for a service, which is the maximum of
* this::type->contract_term, or the product->type->contract_term(); * this::type->contract_term, or the product->type->contract_term();
@ -544,7 +569,7 @@ class Service extends Model implements IDs
*/ */
public function getContractTermAttribute(): int public function getContractTermAttribute(): int
{ {
abort(500,'To implement (Dec 2021)'); return $this->product->type->supplied->contract_term ?: 0;
} }
/** /**
@ -570,7 +595,7 @@ class Service extends Model implements IDs
$date = $last $date = $last
? $last->addDay() ? $last->addDay()
: ($this->date_next_invoice ? $this->date_next_invoice->clone() : ($this->date_next_invoice ? $this->date_next_invoice->clone()
: ($this->date_start ?: Carbon::now())); : ($this->start_at ?: Carbon::now()));
return request()->wantsJson() ? $date->format('Y-m-d') : $date; return request()->wantsJson() ? $date->format('Y-m-d') : $date;
} }
@ -705,8 +730,9 @@ class Service extends Model implements IDs
: NULL; : NULL;
// For SSL Certificates, the invoice_to date is the expiry date of the Cert // For SSL Certificates, the invoice_to date is the expiry date of the Cert
if (is_null($result) AND $this->type AND $this->type->type == 'ssl' AND $this->type->valid_to) // @todo can we use the expire_at attribute?
return $this->type->valid_to; if (is_null($result) AND $this->type AND $this->type->type == 'ssl' AND $this->type->expire_at)
return $this->type->expire_at;
return $result; return $result;
} }
@ -751,6 +777,17 @@ class Service extends Model implements IDs
return $this->getInvoiceNextAttribute(); return $this->getInvoiceNextAttribute();
} }
/**
* The product we supply for this service
*
* @return Model
* @todo Remove all references to product->type to use this method
*/
public function getOfferingAttribute(): Model
{
return $this->product->type;
}
public function getOrderInfoNotesAttribute(): ?string public function getOrderInfoNotesAttribute(): ?string
{ {
return $this->getOrderInfoValue('notes'); return $this->getOrderInfoValue('notes');
@ -954,6 +991,16 @@ class Service extends Model implements IDs
return ($this->product->type && $this->product->type->supplied) ? $this->product->type->supplied->getTypeAttribute() : '** TBA **'; return ($this->product->type && $this->product->type->supplied) ? $this->product->type->supplied->getTypeAttribute() : '** TBA **';
} }
/**
* Get the service providers offering that we are providing for this service
*
* @return Model|null
*/
public function getSupplierProductAttribute(): ?Model
{
dd($this->product,$this->product->type,$this->product->type->supplied);
}
/** /**
* URL used by an admin to administer the record * URL used by an admin to administer the record
* *
@ -1397,11 +1444,11 @@ class Service extends Model implements IDs
switch ($this->product->prod_plugin_file) switch ($this->product->prod_plugin_file)
{ {
case 'ADSL': return $this->service_adsl; case 'BROADBAND': return $this->service_broadband;
case 'DOMAIN': return $this->service_domain; case 'DOMAIN': return $this->service_domain;
case 'HOST': return $this->service_host; case 'HOST': return $this->service_host;
case 'SSL': return $this->service_ssl; case 'SSL': return $this->service_ssl;
case 'VOIP': return $this->service_voip; case 'PHONE': return $this->service_voip;
default: return NULL; default: return NULL;
} }

View File

@ -6,24 +6,64 @@ use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Log;
use Leenooks\Carbon; use Leenooks\Carbon;
use App\Interfaces\{ServiceItem,ServiceUsage}; use App\Interfaces\ServiceUsage;
use App\Models\Base\ServiceType; use App\Models\Base\ServiceType;
use App\Models\Supplier\Broadband as SupplierBroadband; use App\Models\Supplier\Broadband as SupplierBroadband;
use App\Traits\NextKey; use App\Models\Supplier\Type;
class Broadband extends ServiceType implements ServiceItem,ServiceUsage /**
* Class Broadband (Service)
* Services that are Internet Broadband
*/
class Broadband extends ServiceType implements ServiceUsage
{ {
private const LOGKEY = 'MSA'; private const LOGKEY = 'MSB';
use NextKey;
const RECORD_ID = 'service__adsl';
protected $dates = [ protected $dates = [
'service_connect_date', 'connect_at',
'service_contract_date' 'expire_at',
]; ];
public $dateFormat = 'U'; protected $table = 'service_broadband';
protected $table = 'ab_service__adsl';
/* ABSTRACT */
/**
* Search for a record
*
* @param $query
* @param string $term
* @return mixed
*/
public function scopeSearch($query,string $term)
{
// Build our where clause
return parent::scopeSearch($query,$term)
->orwhere('service_number','like','%'.$term.'%')
->orWhere('service_address','like','%'.$term.'%')
->orWhere('ipaddress','like','%'.$term.'%');
}
/* INTERFACES */
/**
* Return the service address
*
* @return string
*/
public function getServiceDescriptionAttribute(): string
{
return strtoupper($this->service_address) ?: '-';
}
/**
* Return the service number
*
* @return string
*/
public function getServiceNameAttribute(): string
{
return $this->service_number ?: ($this->service_address ?: '-');
}
/* RELATIONS */ /* RELATIONS */
@ -38,79 +78,37 @@ class Broadband extends ServiceType implements ServiceItem,ServiceUsage
return $this->hasMany(AdslTraffic::class,'ab_service_adsl_id'); return $this->hasMany(AdslTraffic::class,'ab_service_adsl_id');
} }
/* SCOPES */ /* ATTRIBUTES */
/**
* Search for a record
*
* @param $query
* @param string $term
* @return
*/
public function scopeSearch($query,string $term)
{
// Build our where clause
return parent::scopeSearch($query,$term)
->orwhere('service_number','like','%'.$term.'%')
->orWhere('service_address','like','%'.$term.'%')
->orWhere('ipaddress','like','%'.$term.'%');
}
/** /**
* @deprecated use $o->service_name; * @deprecated use $o->service_name;
* @return mixed|string * @return mixed|string
*/ */
/* ATTRIBUTES */
public function getNameAttribute() public function getNameAttribute()
{ {
abort(500,'deprecated - use $o->service_name');
return $this->service_number ?: $this->service_address; return $this->service_number ?: $this->service_address;
} }
/** /**
* Return the service address * The type of technology used to provide this Internet Service
* *
* @return string * @param $value
* @return null|string
*/ */
public function getServiceDescriptionAttribute(): string public function getTechnologyAttribute($value): ?string
{ {
return strtoupper($this->service_address) ?: 'NO Service Address'; return $value ?: $this->supplied()->technology;
}
public function getServiceExpireAttribute(): \Carbon\Carbon
{
// TODO: Implement getServiceExpireAttribute() method.
}
/**
* Return the service number
*
* @return string
*/
public function getServiceNameAttribute(): string
{
return $this->service_number ?: $this->service_address;
} }
/* METHODS */ /* METHODS */
/**
* Is this service currently in a contract
*
* @return bool
*/
public function inContract(): bool
{
return $this->service_contract_date AND $this->service_contract_date->addMonths($this->contract_term)->isFuture();
}
/** /**
* Return the suppliers offering that this service is providing * Return the suppliers offering that this service is providing
* *
* @return SupplierBroadband * @return Type
*/ */
public function supplied(): SupplierBroadband public function supplied(): Type
{ {
return $this->provided_adsl_plan_id return $this->provided_adsl_plan_id
? SupplierBroadband::findOrFail($this->provided_adsl_plan_id) ? SupplierBroadband::findOrFail($this->provided_adsl_plan_id)

View File

@ -2,97 +2,25 @@
namespace App\Models\Service; namespace App\Models\Service;
use Carbon\Carbon;
use App\Models\Base\ServiceType; use App\Models\Base\ServiceType;
use App\Models\{Account,DomainRegistrar,DomainTld,Service}; use App\Traits\ServiceDomains;
use App\Interfaces\ServiceItem; use App\Models\DomainRegistrar;
use App\Traits\{NextKey,ScopeServiceActive,ScopeServiceUserAuthorised};
/** /**
* Class Domain (Service) * Class Domain (Service)
* Services that domain names * Services that are managed Domain Names
*
* Attributes for services:
* + service_description : Description as shown in a Service Context
* + service_expire : The date the service expires
* + service_name : Name as shown in a Service Context
*
* @package App\Models\Service
*/ */
class Domain extends ServiceType implements ServiceItem class Domain extends ServiceType
{ {
use ScopeServiceActive,ScopeServiceUserAuthorised; use ServiceDomains;
protected $dates = [ protected $table = 'service_domain';
'domain_expire',
];
public $dateFormat = 'U';
protected $table = 'service_domains';
protected $with = ['tld']; protected $with = ['tld'];
/* INTERFACES */
public function getServiceDescriptionAttribute(): string
{
// N/A
return 'Domain Name';
}
public function getServiceExpireAttribute(): Carbon
{
return $this->domain_expire;
}
/**
* The name of the domain with its TLD
*
* @return string
*/
public function getServiceNameAttribute(): string
{
return strtoupper(sprintf('%s.%s',$this->domain_name,$this->tld->name));
}
public function inContract(): bool
{
return $this->domain_expire->isFuture();
}
/* RELATIONS */ /* RELATIONS */
public function account()
{
return $this->hasOneThrough(Account::class,Service::class);
}
public function registrar() public function registrar()
{ {
return $this->belongsTo(DomainRegistrar::class,'domain_registrar_id'); return $this->belongsTo(DomainRegistrar::class,'domain_registrar_id');
} }
public function tld()
{
return $this->belongsTo(DomainTld::class,'domain_tld_id');
}
/* SCOPES */
/**
* Search for a record
*
* @param $query
* @param string $term
* @return mixed
*/
public function scopeSearch($query,string $term)
{
// If we have a period in the name, we'll ignore everything after it.
$term = strstr($term,'.',TRUE) ?: $term;
// Build our where clause
return parent::scopeSearch($query,$term)
->orwhere('domain_name','like','%'.$term.'%');
}
/* ATTRIBUTES */
} }

View File

@ -2,64 +2,17 @@
namespace App\Models\Service; namespace App\Models\Service;
use Carbon\Carbon;
use App\Models\Base\ServiceType; use App\Models\Base\ServiceType;
use App\Models\{Account, DomainRegistrar, DomainTld, Service, TLD}; use App\Traits\ServiceDomains;
use App\Interfaces\ServiceItem;
use App\Traits\{NextKey,ScopeServiceActive,ScopeServiceUserAuthorised};
/** /**
* Class Email (Service) * Class Email (Service)
* Services that email hostings * Services that are Email Hosting
*
* Attributes for services:
* + service_description : Description as shown in a Service Context
* + service_expire : The date the service expires
* + service_name : Name as shown in a Service Context
*
* @package App\Models\Service
*/ */
class Email extends ServiceType implements ServiceItem class Email extends ServiceType
{ {
use ScopeServiceActive,ScopeServiceUserAuthorised; use ServiceDomains;
protected $dates = ['expire_at']; protected $table = 'service_email';
protected $table = 'service_emails'; protected $with = ['tld'];
/* INTERFACES */
public function getServiceDescriptionAttribute(): string
{
// N/A
return 'Email Hosting';
}
public function getServiceExpireAttribute(): Carbon
{
return $this->expire_at ?: $this->service->next_invoice;
}
/**
* The name of the domain with its TLD
*
* @return string
* // @todo
*/
public function getServiceNameAttribute(): string
{
return strtoupper(sprintf('%s.%s',$this->domain_name,$this->tld->name));
}
public function inContract(): bool
{
return $this->expire_at && $this->expire_at->isFuture();
}
/* RELATIONS */
public function tld()
{
return $this->belongsTo(TLD::class);
}
} }

View File

@ -4,8 +4,21 @@ namespace App\Models\Service;
use App\Models\Base\ServiceType; use App\Models\Base\ServiceType;
// @todo Document how this is used.
class Generic extends ServiceType class Generic extends ServiceType
{ {
protected $table = 'service__generic'; protected $table = 'service__generic';
public $timestamps = FALSE; public $timestamps = FALSE;
/* INTERFACE */
public function getServiceDescriptionAttribute(): string
{
return 'Generic';
}
public function getServiceNameAttribute(): string
{
return 'Generic';
}
} }

View File

@ -2,55 +2,25 @@
namespace App\Models\Service; namespace App\Models\Service;
use Carbon\Carbon;
use App\Interfaces\ServiceItem;
use App\Models\Base\ServiceType; use App\Models\Base\ServiceType;
use App\Models\DomainTld; use App\Traits\ServiceDomains;
use App\Models\HostServer; use App\Models\HostServer;
use App\Traits\NextKey;
use App\Traits\{ScopeServiceActive,ScopeServiceUserAuthorised};
class Host extends ServiceType implements ServiceItem /**
* Class Host (Service)
* Services that are Web Hosting
*/
class Host extends ServiceType
{ {
use ScopeServiceActive,ScopeServiceUserAuthorised; use ServiceDomains;
use NextKey;
const RECORD_ID = 'service__hosting';
protected $dates = [ protected $table = 'service_host';
'host_expire', protected $with = ['tld'];
];
public $dateFormat = 'U'; /* RELATIONS */
protected $table = 'ab_service__hosting';
public function provider() public function provider()
{ {
return $this->belongsTo(HostServer::class,'host_server_id'); return $this->belongsTo(HostServer::class,'host_server_id');
} }
public function tld()
{
return $this->belongsTo(DomainTld::class,'domain_tld_id');
}
public function getServiceDescriptionAttribute(): string
{
// N/A
return 'Hosting';
}
public function getServiceExpireAttribute(): Carbon
{
return $this->host_expire;
}
public function getServiceNameAttribute(): string
{
return sprintf('%s.%s',strtoupper($this->domain_name),strtoupper($this->tld->name));
}
public function inContract(): bool
{
return $this->host_expire->isFuture();
}
} }

View File

@ -0,0 +1,70 @@
<?php
namespace App\Models\Service;
use App\Models\Base\ServiceType;
/**
* Class Phone (Service)
* Services that are Voice Telephony
*/
class Phone extends ServiceType
{
protected $dates = [
'connect_at',
'expire_at',
];
protected $table = 'service_phone';
/* ABSTRACT */
/**
* Search for a record
*
* @param $query
* @param string $term
* @return mixed
*/
public function scopeSearch($query,string $term)
{
// Build our where clause
return parent::scopeSearch($query,$term)
->orwhere('service_number','like','%'.$term.'%')
->orWhere('service_address','like','%'.$term.'%');
}
/* INTERFACES */
/**
* Return the service address
*
* @return string
*/
public function getServiceDescriptionAttribute(): string
{
return strtoupper($this->service_address) ?: '-';
}
/**
* Return the service number
*
* @return string
*/
public function getServiceNameAttribute(): string
{
return $this->service_number ?: ($this->service_address ?: '-');
}
/* ATTRIBUTES */
/**
* The type of technology used to provide this Internet Service
*
* @param $value
* @return null|string
*/
public function getTechnologyAttribute($value): ?string
{
return $value ?: $this->supplied()->technology;
}
}

View File

@ -5,19 +5,20 @@ namespace App\Models\Service;
use Illuminate\Support\Arr; use Illuminate\Support\Arr;
use Carbon\Carbon; use Carbon\Carbon;
use App\Interfaces\ServiceItem;
use App\Models\Base\ServiceType; use App\Models\Base\ServiceType;
use App\Traits\NextKey;
class SSL extends ServiceType implements ServiceItem /**
* Class SSL (Service)
* Services that are provide an SSL Certificate
*/
class SSL extends ServiceType
{ {
use NextKey; protected $table = 'service_ssl';
const RECORD_ID = 'service__ssl';
protected $table = 'ab_service__ssl';
protected $crt_parse = NULL;
protected $public_key = NULL; protected $public_key = NULL;
protected $crt_parse = NULL;
/* STATIC */
public static function boot() public static function boot()
{ {
@ -33,11 +34,27 @@ class SSL extends ServiceType implements ServiceItem
}); });
} }
public function getValidToAttribute() /* ABSTRACT */
/**
* Search for a record
*
* @param $query
* @param string $term
* @return mixed
*/
public function scopeSearch($query,string $term)
{ {
return $this->cert ? Carbon::createFromTimestamp($this->crt_parse->get('validTo_time_t')) : NULL; // @todo
} }
/* INTERFACES */
/**
* Return the Cert DN
*
* @return string
*/
public function getServiceDescriptionAttribute(): string public function getServiceDescriptionAttribute(): string
{ {
if ($this->cert) if ($this->cert)
@ -58,11 +75,19 @@ class SSL extends ServiceType implements ServiceItem
} }
} }
public function getServiceExpireAttribute(): Carbon /**
* Return the Certificate Expiry Date
*/
public function getServiceExpireAttribute(): ?Carbon
{ {
// TODO: Implement getServiceExpireAttribute() method. return $this->cert ? Carbon::createFromTimestamp($this->crt_parse->get('validTo_time_t')) : NULL;
} }
/**
* Return the Cert Name
*
* @return string
*/
public function getServiceNameAttribute(): string public function getServiceNameAttribute(): string
{ {
return $this->cert return $this->cert
@ -70,9 +95,24 @@ class SSL extends ServiceType implements ServiceItem
: Arr::get(openssl_csr_get_subject($this->csr),'CN',''); : Arr::get(openssl_csr_get_subject($this->csr),'CN','');
} }
/**
* Certificates have no contract and can be cancelled anytime.
*
* @return bool
*/
public function inContract(): bool public function inContract(): bool
{ {
// N/A
return FALSE; return FALSE;
} }
/* METHODS */
/**
* @return Carbon|null
* @deprecated use getServiceExpireAttribute()
*/
public function getValidToAttribute()
{
abort(500,'use getServiceExpireAttribute');
}
} }

View File

@ -1,72 +0,0 @@
<?php
namespace App\Models\Service;
use App\Interfaces\ServiceItem;
use App\Models\Base\ServiceType;
use App\Traits\NextKey;
use Carbon\Carbon;
class Voip extends ServiceType implements ServiceItem
{
use NextKey;
const RECORD_ID = 'service__adsl';
protected $dates = [
'service_connect_date',
'service_contract_date',
];
public $dateFormat = 'U';
protected $table = 'ab_service__voip';
/* SCOPES */
/**
* Search for a record
*
* @param $query
* @param string $term
* @return
*/
public function scopeSearch($query,string $term)
{
// Build our where clause
return parent::scopeSearch($query,$term)
->orwhere('service_number','like','%'.$term.'%')
->orWhere('service_address','like','%'.$term.'%');
}
/* ATTRIBUTES */
/**
* Return the service address
*
* @return string
*/
public function getServiceDescriptionAttribute(): string
{
return $this->service_address ?: 'VOIP';
}
public function getServiceExpireAttribute(): Carbon
{
// TODO: Implement getServiceExpireAttribute() method.
}
/**
* Return the service number
*
* @return string
*/
public function getServiceNameAttribute(): string
{
return $this->service_number ?: ($this->service_address ?: 'Unknown');
}
/* METHODS */
public function inContract(): bool
{
return $this->service_contract_date AND $this->service_contract_date->addMonths($this->contract_term)->isFuture();
}
}

View File

@ -0,0 +1,16 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
/**
* This model records the changes made to services
*
* @package App\Models
*/
class ServiceChange extends Model
{
protected $table = 'service__change';
public $timestamps = FALSE;
}

View File

@ -7,7 +7,7 @@ use Illuminate\Support\Arr;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
use Leenooks\Traits\ScopeActive; use Leenooks\Traits\ScopeActive;
use App\Models\Supplier\{Broadband,Domain,Email,Ethernet,Generic,Host,HSPA,Voip}; use App\Models\Supplier\{Broadband,Domain,Email,Ethernet,Generic,Host,HSPA,Phone,SSL};
class Supplier extends Model class Supplier extends Model
{ {
@ -45,14 +45,21 @@ class Supplier extends Model
'name' => 'Hosting', 'name' => 'Hosting',
'class' => Host::class, 'class' => Host::class,
], ],
'voip' => [ 'phone' => [
'name' => 'VOIP Telephone', 'name' => 'Phone',
'class' => Voip::class, 'class' => Phone::class,
],
'ssl' => [
'name' => 'SSL',
'class' => SSL::class,
], ],
]; ];
/* RELATIONS */ /* RELATIONS */
// @todo Need to put in an integrity constraint to support the hasOne()
// @todo Some suppliers have multiple different configuration urls/passwords and contacts for different types of services, perhaps this should be hasMany()?
// EG: Crazy Domains, "domains" and "hosting".
public function detail() public function detail()
{ {
return $this->hasOne(SupplierDetail::class); return $this->hasOne(SupplierDetail::class);

View File

@ -8,6 +8,7 @@ use Illuminate\Support\Collection;
use App\Interfaces\SupplierItem; use App\Interfaces\SupplierItem;
use App\Models\Product\Broadband as ProductBroadband; use App\Models\Product\Broadband as ProductBroadband;
// @todo does this need to extend Type? Perhaps have a SupplierType consistent with ServiceType.
class Broadband extends Type implements SupplierItem class Broadband extends Type implements SupplierItem
{ {
protected $casts = [ protected $casts = [
@ -37,7 +38,7 @@ class Broadband extends Type implements SupplierItem
public function types() public function types()
{ {
return $this->belongsToMany(ProductBroadband::class,$this->table,'id','id','id',$this->table.'_id'); return $this->belongsToMany(ProductBroadband::class,$this->table,'id','id','id','supplier_item_id');
} }
public function getBillingIntervalAttribute(): int public function getBillingIntervalAttribute(): int

View File

@ -24,7 +24,7 @@ final class Domain extends Type implements SupplierItem
public function types() public function types()
{ {
return $this->belongsToMany(ProductDomain::class,$this->table,'id','id','id',$this->table.'_id'); return $this->belongsToMany(ProductDomain::class,$this->table,'id','id','id','supplier_item_id');
} }
/* RELATIONS */ /* RELATIONS */

View File

@ -18,6 +18,6 @@ final class Email extends Type implements SupplierItem
public function types() public function types()
{ {
return $this->belongsToMany(ProductEmail::class,$this->table,'id','id','id',$this->table.'_id'); return $this->belongsToMany(ProductEmail::class,$this->table,'id','id','id','supplier_item_id');
} }
} }

View File

@ -13,7 +13,7 @@ final class Generic extends Type implements SupplierItem
public function types() public function types()
{ {
return $this->belongsToMany(ProductGeneric::class,$this->table,'id','id','id',$this->table.'_id'); return $this->belongsToMany(ProductGeneric::class,$this->table,'id','id','id','supplier_item_id');
} }
public function getBillingIntervalAttribute(): int public function getBillingIntervalAttribute(): int

View File

@ -13,7 +13,7 @@ final class Host extends Type implements SupplierItem
public function types() public function types()
{ {
return $this->belongsToMany(ProductHost::class,$this->table,'id','id','id',$this->table.'_id'); return $this->belongsToMany(ProductHost::class,$this->table,'id','id','id','supplier_item_id');
} }
public function getBillingIntervalAttribute(): int public function getBillingIntervalAttribute(): int

View File

@ -3,17 +3,17 @@
namespace App\Models\Supplier; namespace App\Models\Supplier;
use App\Interfaces\SupplierItem; use App\Interfaces\SupplierItem;
use App\Models\Product\Voip as ProductVoip; use App\Models\Product\Phone as ProductVoip;
final class Voip extends Type implements SupplierItem final class Phone extends Type implements SupplierItem
{ {
protected $table = 'supplier_voip'; protected $table = 'supplier_phone';
/* INTERFACES */ /* INTERFACES */
public function types() public function types()
{ {
return $this->belongsToMany(ProductVoip::class,$this->table,'id','id','id',$this->table.'_id'); return $this->belongsToMany(ProductVoip::class,$this->table,'id','id','id','supplier_item_id');
} }
public function getBillingIntervalAttribute(): int public function getBillingIntervalAttribute(): int

View File

@ -13,7 +13,7 @@ final class SSL extends Type implements SupplierItem
public function types() public function types()
{ {
return $this->belongsToMany(ProductSSL::class,$this->table,'id','id','id',$this->table.'_id'); return $this->belongsToMany(ProductSSL::class,$this->table,'id','id','id','supplier_item_id');
} }
public function getBillingIntervalAttribute(): int public function getBillingIntervalAttribute(): int

View File

@ -15,10 +15,10 @@ trait ScopeServiceActive
public function scopeServiceActive($query) public function scopeServiceActive($query)
{ {
return $query->where(function($q) { return $query->where(function($q) {
return $q->where('ab_service.active',TRUE) return $q->where('services.active',TRUE)
->orWhere(function($q) { ->orWhere(function($q) {
return $q->whereNotNull('order_status') return $q->whereNotNull('order_status')
->whereNotIn('ab_service.order_status',Service::INACTIVE_STATUS); ->whereNotIn('services.order_status',Service::INACTIVE_STATUS);
}); });
}); });
} }

View File

@ -16,6 +16,6 @@ trait ScopeServiceUserAuthorised
public function scopeServiceUserAuthorised($query,User $uo) public function scopeServiceUserAuthorised($query,User $uo)
{ {
return $query return $query
->whereIN('ab_service.account_id',$uo->all_accounts()->pluck('id')->unique()->toArray()); ->whereIN('services.account_id',$uo->all_accounts()->pluck('id')->unique()->toArray());
} }
} }

View File

@ -0,0 +1,59 @@
<?php
/**
* Service Types that have a domain name attribute.
*/
namespace App\Traits;
use App\Models\TLD;
trait ServiceDomains
{
/* INTERFACES */
/**
* There is no detailed description for domain services
*
* @return string
*/
public function getServiceDescriptionAttribute(): string
{
return '';
}
/**
* The name of the domain with its TLD
*
* @return string
*/
public function getServiceNameAttribute(): string
{
return strtoupper(sprintf('%s.%s',$this->domain_name,$this->tld->name));
}
/* RELATIONS */
public function tld()
{
return $this->belongsTo(TLD::class);
}
/* SCOPES */
/**
* Search for a record
*
* @param $query
* @param string $term
* @return mixed
*/
public function scopeSearch($query,string $term)
{
// If we have a period in the name, we'll ignore everything after it.
$term = strstr($term,'.',TRUE) ?: $term;
// Build our where clause
return parent::scopeSearch($query,$term)
->orwhere('domain_name','like','%'.$term.'%');
}
}

View File

@ -570,7 +570,7 @@ class OptimizeProduct extends Migration
$sdo->site_id = $site->site_id; $sdo->site_id = $site->site_id;
$so->detail()->save($sdo); $so->detail()->save($sdo);
$o = new \App\Models\Supplier\Voip; $o = new \App\Models\Supplier\Phone;
$o->site_id = $sdo->site_id; $o->site_id = $sdo->site_id;
$o->active = TRUE; $o->active = TRUE;
$o->product_id = 'VOIP $10'; $o->product_id = 'VOIP $10';
@ -579,13 +579,13 @@ class OptimizeProduct extends Migration
$o->supplier_detail_id = $sdo->id; $o->supplier_detail_id = $sdo->id;
$o->save(); $o->save();
$oo = new \App\Models\Product\Voip; $oo = new \App\Models\Product\Phone;
$oo->site_id = $sdo->site_id; $oo->site_id = $sdo->site_id;
$oo->supplier_voip_id = $o->id; $oo->supplier_voip_id = $o->id;
$oo->name = 'VOIP $10'; $oo->name = 'VOIP $10';
$oo->save(); $oo->save();
$o = new \App\Models\Supplier\Voip; $o = new \App\Models\Supplier\Phone;
$o->site_id = $sdo->site_id; $o->site_id = $sdo->site_id;
$o->active = TRUE; $o->active = TRUE;
$o->product_id = 'VOIP'; $o->product_id = 'VOIP';
@ -594,13 +594,13 @@ class OptimizeProduct extends Migration
$o->supplier_detail_id = $sdo->id; $o->supplier_detail_id = $sdo->id;
$o->save(); $o->save();
$oo = new \App\Models\Product\Voip; $oo = new \App\Models\Product\Phone;
$oo->site_id = $sdo->site_id; $oo->site_id = $sdo->site_id;
$oo->supplier_voip_id = $o->id; $oo->supplier_voip_id = $o->id;
$oo->name = 'VOIP'; $oo->name = 'VOIP';
$oo->save(); $oo->save();
$o = new \App\Models\Supplier\Voip; $o = new \App\Models\Supplier\Phone;
$o->site_id = $sdo->site_id; $o->site_id = $sdo->site_id;
$o->active = TRUE; $o->active = TRUE;
$o->product_id = 'VOIP B-100'; $o->product_id = 'VOIP B-100';
@ -610,7 +610,7 @@ class OptimizeProduct extends Migration
$o->supplier_detail_id = $sdo->id; $o->supplier_detail_id = $sdo->id;
$o->save(); $o->save();
$oo = new \App\Models\Product\Voip; $oo = new \App\Models\Product\Phone;
$oo->site_id = $sdo->site_id; $oo->site_id = $sdo->site_id;
$oo->supplier_voip_id = $o->id; $oo->supplier_voip_id = $o->id;
$oo->name = 'VOIP B-10'; $oo->name = 'VOIP B-10';

View File

@ -0,0 +1,337 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class RenameServiceTables extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('ab_service', function (Blueprint $table) {
$table->dropPrimary();
$table->dropForeign('ab_service_site_id_foreign');
$table->primary(['id','site_id']);
$table->dropIndex('ab_service_site_id_foreign');
$table->dropIndex('ab_service_id_site_id_index');
$table->datetime('created_at')->nullable()->after('id');
$table->datetime('updated_at')->nullable()->after('created_at');
$table->date('invoice_last_at')->nullable()->after('date_last_invoice');
$table->date('invoice_next_at')->nullable()->after('date_next_invoice');
$table->date('start_at')->nullable()->after('date_start');
$table->date('stop_at')->nullable()->after('date_end');
});
DB::statement('ALTER TABLE ab_service RENAME TO services');
DB::statement('ALTER TABLE services MODIFY account_id int unsigned NOT NULL');
DB::statement('ALTER TABLE services MODIFY account_billing_id int unsigned DEFAULT NULL');
DB::statement('ALTER TABLE services MODIFY product_id int unsigned NOT NULL');
DB::statement('UPDATE services SET taxable=1');
DB::statement('UPDATE services SET active=0 WHERE active IS NULL');
DB::statement('ALTER TABLE services MODIFY active tinyint(1) NOT NULL,MODIFY suspend_billing tinyint(1) DEFAULT NULL,MODIFY external_billing tinyint(1) DEFAULT NULL,MODIFY taxable tinyint(1) DEFAULT NULL');
DB::statement('ALTER TABLE services RENAME COLUMN orderby_id TO ordered_by');
DB::statement('ALTER TABLE services MODIFY ordered_by int unsigned');
// Convert out dates
foreach (\App\Models\Service::withoutGlobalScope(\App\Models\Scopes\SiteScope::class)->cursor() as $o) {
if ($o->date_orig)
$o->created_at = \Carbon\Carbon::createFromTimestamp($o->date_orig);
if ($o->date_last)
$o->updated_at = \Carbon\Carbon::createFromTimestamp($o->date_last);
if ($o->date_last_invoice)
$o->invoice_last_at = \Carbon\Carbon::createFromTimestamp($o->date_last_invoice);
if ($o->date_next_invoice)
$o->invoice_next_at = \Carbon\Carbon::createFromTimestamp($o->date_next_invoice);
if ($o->date_start)
$o->start_at = \Carbon\Carbon::createFromTimestamp($o->date_start);
if ($o->date_end)
$o->stop_at = \Carbon\Carbon::createFromTimestamp($o->date_end);
$o->save();
}
Schema::table('services', function (Blueprint $table) {
$table->dropColumn(['date_orig','date_last','date_last_invoice','date_next_invoice','date_start','date_end','queue','price_group']);
$table->foreign(['account_id','site_id'])->references(['id','site_id'])->on('accounts');
$table->foreign(['product_id','site_id'])->references(['id','site_id'])->on('products');
$table->foreign(['ordered_by','site_id'])->references(['id','site_id'])->on('users');
$table->foreign(['site_id'])->references(['id'])->on('sites');
});
DB::statement('ALTER TABLE service_domains RENAME TO service_domain');
DB::statement('ALTER TABLE service_emails RENAME TO service_email');
Schema::table('ab_service_change', function (Blueprint $table) {
$table->dropPrimary();
$table->primary(['id','site_id']);
$table->dropForeign('ab_service_change_site_id_foreign');
$table->dropIndex('ab_service_change_site_id_foreign');
$table->dropIndex('ab_service_change_id_site_id_index');
});
DB::statement('ALTER TABLE ab_service_change RENAME TO service__change');
DB::statement('ALTER TABLE service__change MODIFY service_id int unsigned');
DB::statement('ALTER TABLE service__change MODIFY product_id int unsigned');
DB::statement('ALTER TABLE service__change MODIFY ordered_by int unsigned');
Schema::table('service__change', function (Blueprint $table) {
$table->date('ordered_at')->nullable()->after('ordered_by');
$table->date('effective_at')->nullable()->after('ordered_at');
$table->foreign(['product_id','site_id'])->references(['id','site_id'])->on('products');
$table->foreign(['service_id','site_id'])->references(['id','site_id'])->on('services');
$table->foreign(['ordered_by','site_id'])->references(['id','site_id'])->on('users');
});
// Convert out dates
foreach (\App\Models\ServiceChange::withoutGlobalScope(\App\Models\Scopes\SiteScope::class)->cursor() as $o) {
if ($o->date_ordered)
$o->ordered_at = \Carbon\Carbon::createFromTimestamp($o->date_ordered);
if ($o->date_effective)
$o->effective_at = \Carbon\Carbon::createFromTimestamp($o->date_effective);
$o->save();
}
DB::statement('ALTER TABLE service__change MODIFY ordered_at int unsigned NOT NULL');
DB::statement('ALTER TABLE service__change MODIFY effective_at int unsigned NOT NULL');
Schema::table('service__change', function (Blueprint $table) {
$table->dropColumn(['date_ordered','date_effective']);
});
DB::statement('ALTER TABLE service__generic MODIFY service_id int unsigned NOT NULL');
DB::statement('ALTER TABLE service__generic MODIFY product_id int unsigned DEFAULT NULL');
DB::statement('UPDATE service__generic SET product_id=NULL WHERE product_id=0');
Schema::table('service__generic', function (Blueprint $table) {
$table->dropPrimary();
$table->primary(['id','site_id']);
$table->dropForeign('service__generic_site_id_foreign');
$table->dropIndex('service__generic_site_id_foreign');
$table->dropIndex('service__generic_id_site_id_index');
$table->foreign(['product_id','site_id'])->references(['id','site_id'])->on('products');
$table->foreign(['service_id','site_id'])->references(['id','site_id'])->on('services');
});
DB::statement('ALTER TABLE service_domain MODIFY service_id int unsigned NOT NULL');
DB::statement('ALTER TABLE service_domain MODIFY domain_tld_id int unsigned NOT NULL');
DB::statement('ALTER TABLE service_domain MODIFY domain_registrar_id int unsigned DEFAULT NULL');
DB::statement('ALTER TABLE service_domain MODIFY domain_name varchar(128) NOT NULL');
DB::statement('ALTER TABLE service_domain RENAME COLUMN domain_tld_id TO tld_id');
Schema::table('service_domain', function (Blueprint $table) {
$table->dropPrimary();
$table->primary(['id','site_id']);
$table->dropForeign('service_domains_site_id_foreign');
$table->dropIndex('service_domains_site_id_foreign');
$table->dropIndex('service_domains_id_site_id_index');
$table->foreign(['service_id','site_id'])->references(['id','site_id'])->on('services');
$table->foreign(['tld_id'])->references(['id'])->on('tlds');
$table->date('expire_at')->nullable()->after('domain_expire');
});
// Convert out dates
foreach (\App\Models\Service\Domain::withoutGlobalScope(\App\Models\Scopes\SiteScope::class)->cursor() as $o) {
if ($o->domain_expire)
$o->expire_at = \Carbon\Carbon::createFromTimestamp($o->domain_expire);
$o->save();
}
Schema::table('service_domain', function (Blueprint $table) {
$table->dropColumn(['registrar_lastsync','domain_expire']);
});
DB::statement('ALTER TABLE service_email DROP PRIMARY KEY,ADD PRIMARY KEY (id,site_id)');
Schema::table('service_email', function (Blueprint $table) {
$table->unique(['domain_name','tld_id']);
$table->dropForeign('service_emails_site_id_foreign');
$table->dropForeign('service_emails_service_id_foreign');
$table->dropForeign('service_emails_tld_id_foreign');
$table->foreign(['tld_id'])->references(['id'])->on('tlds');
$table->foreign(['service_id','site_id'])->references(['id','site_id'])->on('services');
});
DB::statement('ALTER TABLE ab_service__hosting RENAME TO service_host');
DB::statement('ALTER TABLE service_host RENAME COLUMN domain_tld_id TO tld_id');
DB::statement('ALTER TABLE service_host MODIFY service_id int unsigned NOT NULL');
DB::statement('ALTER TABLE service_host MODIFY tld_id int unsigned NOT NULL');
DB::statement('ALTER TABLE service_host MODIFY host_server_id int unsigned DEFAULT NULL');
DB::statement('ALTER TABLE service_host MODIFY domain_name varchar(128) NOT NULL');
Schema::table('service_host', function (Blueprint $table) {
$table->dropPrimary();
$table->primary(['id','site_id']);
$table->dropForeign('ab_service__hosting_site_id_foreign');
$table->dropIndex('ab_service__hosting_site_id_foreign');
$table->dropIndex('ab_service__hosting_id_site_id_index');
$table->foreign(['service_id','site_id'])->references(['id','site_id'])->on('services');
$table->foreign(['tld_id'])->references(['id'])->on('tlds');
$table->date('expire_at')->nullable()->after('host_expire');
});
// Convert our dates
foreach (\App\Models\Service\Host::withoutGlobalScope(\App\Models\Scopes\SiteScope::class)->cursor() as $o) {
if ($o->server_data && (strlen($o->server_data) > 8) && gzuncompress($o->server_data))
$o->server_data = NULL;
if ($o->host_expire)
$o->expire_at = \Carbon\Carbon::createFromTimestamp($o->host_expire);
$o->save();
}
Schema::table('service_host', function (Blueprint $table) {
$table->dropColumn(['host_expire','server_data_date']);
});
DB::statement('ALTER TABLE product_broadband RENAME COLUMN supplier_broadband_id TO supplier_item_id');
DB::statement('ALTER TABLE product_domain RENAME COLUMN supplier_domain_id TO supplier_item_id');
DB::statement('ALTER TABLE product_email RENAME COLUMN supplier_email_id TO supplier_item_id');
DB::statement('ALTER TABLE product_host RENAME COLUMN supplier_host_id TO supplier_item_id');
DB::statement('ALTER TABLE product_ssl RENAME COLUMN supplier_ssl_id TO supplier_item_id');
DB::statement('ALTER TABLE product_generic RENAME COLUMN supplier_generic_id TO supplier_item_id');
DB::statement('ALTER TABLE product_voip RENAME TO product_phone');
DB::statement('ALTER TABLE product_phone RENAME COLUMN supplier_voip_id TO supplier_item_id');
Schema::table('product_phone', function (Blueprint $table) {
$table->dropPrimary();
$table->primary(['id','site_id']);
$table->dropForeign('product_voip_supplier_voip_id_site_id_foreign');
$table->dropForeign('product_voip_site_id_foreign');
$table->dropIndex('product_voip_supplier_voip_id_site_id_foreign');
$table->dropIndex('product_voip_site_id_foreign');
$table->dropIndex('product_voip_id_site_id_index');
});
DB::statement('ALTER TABLE supplier_voip RENAME TO supplier_phone');
Schema::table('supplier_phone', function (Blueprint $table) {
$table->dropPrimary();
$table->primary(['id','site_id']);
$table->dropForeign('supplier_voip_supplier_detail_id_site_id_foreign');
$table->dropForeign('supplier_voip_site_id_foreign');
$table->dropIndex('supplier_voip_id_site_id_index');
$table->foreign(['supplier_detail_id','site_id'])->references(['id','site_id'])->on('supplier_details');
$table->string('technology')->nullable();
});
Schema::table('product_phone', function (Blueprint $table) {
$table->foreign(['supplier_item_id','site_id'])->references(['id','site_id'])->on('supplier_phone');
$table->string('technology')->nullable();
});
DB::statement('ALTER TABLE ab_service__voip RENAME TO service_phone');
DB::statement('ALTER TABLE service_phone MODIFY service_id int unsigned NOT NULL');
DB::statement('ALTER TABLE service_phone MODIFY service_number varchar(10) NOT NULL');
DB::statement('ALTER TABLE service_phone MODIFY site_id int unsigned NOT NULL');
Schema::table('service_phone', function (Blueprint $table) {
$table->primary(['id','site_id']);
$table->date('connect_at')->nullable()->after('contract_term');
$table->date('expire_at')->nullable()->after('connect_at');
$table->foreign(['service_id','site_id'])->references(['id','site_id'])->on('services');
$table->string('technology')->nullable();
});
DB::statement('ALTER TABLE service_phone MODIFY id int unsigned auto_increment');
// Convert our dates
foreach (\App\Models\Service\Phone::withoutGlobalScope(\App\Models\Scopes\SiteScope::class)->cursor() as $o) {
if ($o->service_connect_date)
$o->connect_at = \Carbon\Carbon::createFromTimestamp($o->service_connect_date);
if ($o->getRawOriginal('contract_term') === 0)
$o->contract_term = NULL;
if ($o->service_contract_date && $o->getRawOriginal('contract_term'))
$o->expire_at = \Carbon\Carbon::createFromTimestamp($o->service_contract_date)->addMonths($o->getRawOriginal('contract_term'));
$o->save();
}
Schema::table('service_phone', function (Blueprint $table) {
$table->dropColumn(['service_connect_date','service_contract_date','contract_term']);
});
DB::statement('ALTER TABLE ab_service__adsl RENAME TO service_broadband');
DB::statement('ALTER TABLE service_broadband MODIFY service_id int unsigned NOT NULL');
DB::statement('ALTER TABLE service_broadband MODIFY service_stats_collect tinyint(1) DEFAULT NULL');
DB::statement('ALTER TABLE service_broadband RENAME COLUMN service_stats_lastupdate TO service_stats_at');
// @todo drop column provided_adsl_plan_id
Schema::table('service_broadband', function (Blueprint $table) {
$table->dropPrimary();
$table->primary(['id','site_id']);
$table->date('connect_at')->nullable()->after('contract_term');
$table->date('expire_at')->nullable()->after('connect_at');
$table->ipAddress('ip6address')->nullable()->after('ipaddress');
$table->string('technology')->nullable();
$table->dropForeign('ab_service__adsl_site_id_foreign');
$table->dropIndex('ab_service__adsl_site_id_foreign');
$table->dropIndex('ab_service__adsl_id_site_id_index');
$table->foreign(['service_id','site_id'])->references(['id','site_id'])->on('services');
});
// Convert our dates
foreach (\App\Models\Service\Broadband::withoutGlobalScope(\App\Models\Scopes\SiteScope::class)->cursor() as $o) {
if ($o->service_connect_date)
$o->connect_at = \Carbon\Carbon::createFromTimestamp($o->service_connect_date);
if ($o->getRawOriginal('contract_term') === 0)
$o->contract_term = NULL;
if ($o->service_contract_date && $o->getRawOriginal('contract_term'))
$o->expire_at = \Carbon\Carbon::createFromTimestamp($o->service_contract_date)->addMonths($o->getRawOriginal('contract_term'));
$o->save();
}
Schema::table('service_broadband', function (Blueprint $table) {
$table->dropColumn(['service_connect_date','service_contract_date','contract_term']);
});
Schema::table('supplier_broadband', function (Blueprint $table) {
$table->string('technology')->nullable();
});
DB::select("UPDATE services SET model='App\\\\Models\\\\Service\\\\Phone' where model='App\\\\Models\\\\Service\\\\Voip'");
DB::select("UPDATE products SET model='App\\\\Models\\\\Product\\\\Phone' where model='App\\\\Models\\\\Product\\\\Voip'");
DB::statement('ALTER TABLE ab_service__ssl RENAME TO service_ssl');
DB::statement('ALTER TABLE service_ssl MODIFY service_id int unsigned NOT NULL');
DB::statement('ALTER TABLE service_ssl MODIFY ssl_ca_id int unsigned DEFAULT NULL');
Schema::table('service_ssl', function (Blueprint $table) {
$table->dropPrimary();
$table->primary(['id','site_id']);
$table->dropForeign('ab_service__ssl_site_id_foreign');
$table->dropIndex('ab_service__ssl_site_id_foreign');
$table->dropIndex('ab_service__ssl_id_site_id_index');
$table->foreign(['service_id','site_id'])->references(['id','site_id'])->on('services');
});
foreach (DB::select('SELECT * FROM products where model="App\\\\Models\\\\Product\\\\SSL"') as $o) {
DB::select('UPDATE services set model="App\\\\Models\\\\Service\\\\SSL" WHERE product_id='.$o->id);
};
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
abort(500,'Cant go back');
}
}

View File

@ -9,17 +9,16 @@ Please order the following...
| Service ID | {!! $service->service_id_url !!} | | Service ID | {!! $service->service_id_url !!} |
| Product | {{ $service->product_name }} | | Product | {{ $service->product_name }} |
@switch($service->product_category) @switch($service->product_category)
@case('ADSL') @case('BROADBAND')
| Address | {{ $service->type->service_address }} | | Address | {{ $service->type->service_address }} |
@break; @break;
@case('VOIP') @case('PHONE')
| Number | {{ $service->type->service_number }} | | Number | {{ $service->type->service_number }} |
| Supplier Details | {{ $service->order_info->join(':') }} | | Supplier Details | {{ $service->order_info->join(':') }} |
@break; @break;
@endswitch @endswitch
@endcomponent @endcomponent
**NOTES:** {{ $notes }} **NOTES:** {{ $notes }}
Thanks,<br> Thanks,<br>

View File

@ -4,21 +4,20 @@
@component('mail::panel') @component('mail::panel')
@component('mail::table') @component('mail::table')
| Service | Details | | Service | Details |
| :---------- | :---------------- | | :---------- | :---------------- |
| Account | {{ $service->account_name }} ({!! $service->account->account_id_url !!}) | | Account | {{ $service->account_name }} ({!! $service->account->account_id_url !!}) |
| Service ID | {!! $service->service_id_url !!} | | Service ID | {!! $service->service_id_url !!} |
| Product | {{ $service->product_name }} | | Product | {{ $service->product_name }} |
@switch($service->category) @switch($service->category)
@case('ADSL') @case('BROADBAND')
| Address | {{ is_object($service->service_voip) ? $service->service_voip->service_address : 'Not Supplied' }} | | Address | {{ is_object($service->type) ? $service->type->service_address : 'Not Supplied' }} |
@break; @break;
@case('VOIP') @case('PHONE')
| Address | {{ is_object($service->service_voip) ? $service->service_voip->service_address : 'Not Supplied' }} | | Address | {{ is_object($service->type) ? $service->type->service_address : 'Not Supplied' }} |
| Supplier Details | {{ join(':',$service->order_info) }} | | Supplier Details | {{ join(':',$service->order_info) }} |
@break; @break;
@endswitch @endswitch
@endcomponent @endcomponent
**REASON:** {{ $reason }} **REASON:** {{ $reason }}

View File

@ -9,17 +9,16 @@ Please cancel the following...
| Service ID | {!! $service->service_id_url !!} | | Service ID | {!! $service->service_id_url !!} |
| Product | {{ $service->product_name }} | | Product | {{ $service->product_name }} |
@switch($service->product_category) @switch($service->product_category)
@case('ADSL') @case('BROADBAND')
| Address | {{ $service->type->service_address }} | | Address | {{ $service->type->service_address }} |
@break; @break;
@case('VOIP') @case('PHONE')
| Number | {{ $service->type->service_number }} | | Number | {{ $service->type->service_number }} |
| Supplier Details | {{ $service->order_info->join(':') }} | | Supplier Details | {{ $service->order_info->join(':') }} |
@break; @break;
@endswitch @endswitch
@endcomponent @endcomponent
**NOTES:** {{ $notes }} **NOTES:** {{ $notes }}
Thanks,<br> Thanks,<br>

View File

@ -9,17 +9,16 @@ Please change the following...
| Service ID | {!! $service->service_id_url !!} | | Service ID | {!! $service->service_id_url !!} |
| Product | {{ $service->product_name }} | | Product | {{ $service->product_name }} |
@switch($service->product_category) @switch($service->product_category)
@case('ADSL') @case('BROADBAND')
| Address | {{ $service->type->service_address }} | | Address | {{ $service->type->service_address }} |
@break; @break;
@case('VOIP') @case('PHONE')
| Number | {{ $service->type->service_number }} | | Number | {{ $service->type->service_number }} |
| Supplier Details | {{ $service->order_info->join(':') }} | | Supplier Details | {{ $service->order_info->join(':') }} |
@break; @break;
@endswitch @endswitch
@endcomponent @endcomponent
**NOTES:** {{ $notes }} **NOTES:** {{ $notes }}
Thanks,<br> Thanks,<br>

View File

@ -0,0 +1,72 @@
<!-- $o = App\Models\Service\Phone::class -->
<div class="form-group row">
<label for="service_number" class="col-sm-3 col-form-label text-right">Service Number</label>
<div class="col-sm-6">
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text"><i class="fa fa-fw fa-phone"></i></span>
</div>
<input type="text" class="form-control" name="phone[service_number]" value="{{ $o->service_number ?? '' }}">
</div>
</div>
</div>
<div class="form-group row">
<label for="service_username" class="col-sm-3 col-form-label text-right">Service Username</label>
<div class="col-sm-6">
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text"><i class="fa fa-fw fa-user"></i></span>
</div>
<input type="text" class="form-control" name="phone[service_username]" value="{{ $o->service_username ?? '' }}">
</div>
</div>
</div>
<div class="form-group row">
<label for="service_password" class="col-sm-3 col-form-label text-right">Service Password</label>
<div class="col-sm-6">
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text"><i class="fa fa-fw fa-lock"></i></span>
</div>
<input type="text" class="form-control" name="phone[service_password]" value="{{ $o->service_password ?? '' }}">
</div>
</div>
</div>
<div class="form-group row">
<label for="connect_at" class="col-sm-3 col-form-label text-right">Service Connect Date</label>
<div class="col-sm-6">
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text"><i class="fa fa-fw fa-calendar"></i></span>
</div>
<input type="date" class="form-control" name="phone[connect_at]" value="{{ $o->connect_at ? $o->connect_at->format('Y-m-d') : '' }}">
</div>
</div>
</div>
<div class="form-group row">
<label for="expire_at" class="col-sm-3 col-form-label text-right">Service Expires (Contracted Till)</label>
<div class="col-sm-6">
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text"><i class="fa fa-fw fa-calendar"></i></span>
</div>
<input type="date" class="form-control" name="phone[expire_at]" value="{{ $o->expire_at ? $o->expire_at->format('Y-m-d') : '' }}">
</div>
</div>
</div>
<div class="form-group row">
<label for="start_at" class="col-sm-3 col-form-label text-right">Service Billing Start Date</label>
<div class="col-sm-6">
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text"><i class="fa fa-fw fa-calendar"></i></span>
</div>
<input type="date" class="form-control" name="start_at" value="{{ $o->service->start_at ? $o->service->start_at->format('Y-m-d') : '' }}">
</div>
</div>
</div>

View File

@ -1,72 +0,0 @@
<!-- $o = App\Models\Service\Voip::class -->
<div class="form-group row">
<label for="reference" class="col-sm-3 col-form-label text-right">Service Number</label>
<div class="col-sm-6">
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text"><i class="fa fa-fw fa-phone"></i></span>
</div>
<input type="text" class="form-control" name="voip[service_number]" value="{{ $o->service_number ?? '' }}">
</div>
</div>
</div>
<div class="form-group row">
<label for="reference" class="col-sm-3 col-form-label text-right">Service Username</label>
<div class="col-sm-6">
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text"><i class="fa fa-fw fa-user"></i></span>
</div>
<input type="text" class="form-control" name="voip[service_username]" value="{{ $o->service_username ?? '' }}">
</div>
</div>
</div>
<div class="form-group row">
<label for="reference" class="col-sm-3 col-form-label text-right">Service Password</label>
<div class="col-sm-6">
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text"><i class="fa fa-fw fa-lock"></i></span>
</div>
<input type="text" class="form-control" name="voip[service_password]" value="{{ $o->service_password ?? '' }}">
</div>
</div>
</div>
<div class="form-group row">
<label for="reference" class="col-sm-3 col-form-label text-right">Service Connect Date</label>
<div class="col-sm-6">
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text"><i class="fa fa-fw fa-calendar"></i></span>
</div>
<input type="date" class="form-control" name="voip[service_connect_date]" value="{{ $o->service_connect_date ? $o->service_connect_date->format('Y-m-d') : '' }}">
</div>
</div>
</div>
<div class="form-group row">
<label for="reference" class="col-sm-3 col-form-label text-right">Service Contract Date</label>
<div class="col-sm-6">
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text"><i class="fa fa-fw fa-calendar"></i></span>
</div>
<input type="date" class="form-control" name="voip[service_contract_date]" value="{{ $o->service_contract_date ? $o->service_contract_date->format('Y-m-d') : '' }}">
</div>
</div>
</div>
<div class="form-group row">
<label for="reference" class="col-sm-3 col-form-label text-right">Service Billing Start Date</label>
<div class="col-sm-6">
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text"><i class="fa fa-fw fa-calendar"></i></span>
</div>
<input type="date" class="form-control" name="date_start" value="{{ $o->service->date_start ? $o->service->date_start->format('Y-m-d') : '' }}">
</div>
</div>
</div>

View File

@ -19,11 +19,12 @@
<div class="col-12"> <div class="col-12">
<div class="card card-dark"> <div class="card card-dark">
<div class="card-body"> <div class="card-body">
<table class="table table-hover" id="service_domain"> <table class="table table-hover" id="services">
<thead> <thead>
<tr> <tr>
<th>Service ID</tH> <th>Service ID</tH>
<th>Account</th> <th>Account</th>
<th>Product</th>
<th>Domain</th> <th>Domain</th>
<th>Expires</th> <th>Expires</th>
<th>Registrar</th> <th>Registrar</th>
@ -36,11 +37,12 @@
<tbody> <tbody>
@foreach ($o as $oo) @foreach ($o as $oo)
<tr @if ($oo->service_expire->isPast()) class="table-danger" @endif> <tr @if ($oo->hasExpired()) class="table-danger" @endif>
<td><a href="{{ url('u/service',[$oo->service_id]) }}">{{ $oo->service->sid }}</td> <td><a href="{{ url('u/service',[$oo->service_id]) }}">{{ $oo->service->sid }}</td>
<td>{{ $oo->service->account->name }}</td> <td>{{ $oo->service->account->name }}</td>
<td>{{ $oo->service->product->name }}</td>
<td>{{ $oo->service_name }}</td> <td>{{ $oo->service_name }}</td>
<td>{{ $oo->service_expire->format('Y-m-d') }}</td> <td>{{ $oo->service_expire ? $oo->service_expire->format('Y-m-d') : '-' }}</td>
<td>{{ $oo->registrar->name }}</td> <td>{{ $oo->registrar->name }}</td>
<td>{{ $oo->registrar_ns }}</td> <td>{{ $oo->registrar_ns }}</td>
<td>@if ($oo->service->isBilled()) <span class="@if($oo->service->suspend_billing)strike @endif">{{ $oo->service->invoice_next->format('Y-m-d') }}</span> @else - @endif</td> <td>@if ($oo->service->isBilled()) <span class="@if($oo->service->suspend_billing)strike @endif">{{ $oo->service->invoice_next->format('Y-m-d') }}</span> @else - @endif</td>
@ -67,14 +69,14 @@
</style> </style>
<script type="text/javascript"> <script type="text/javascript">
$(document).ready(function() { $(document).ready(function() {
$('#service_domain').DataTable({ $('#services').DataTable({
order: [[4,'asc'],[1,'asc'],[2,'desc']], order: [[5,'asc'],[1,'asc'],[2,'desc']],
rowGroup: { rowGroup: {
dataSrc: 4, dataSrc: 5,
}, },
columnDefs: [ columnDefs: [
{ {
targets: [4], targets: [5],
visible: false, visible: false,
} }
], ],

View File

@ -19,11 +19,12 @@
<div class="col-12"> <div class="col-12">
<div class="card card-dark"> <div class="card card-dark">
<div class="card-body"> <div class="card-body">
<table class="table table-hover" id="service_email"> <table class="table table-hover" id="services">
<thead> <thead>
<tr> <tr>
<th>Service ID</tH> <th>Service ID</tH>
<th>Account</th> <th>Account</th>
<th>Product</th>
<th>Domain</th> <th>Domain</th>
<th>Expires</th> <th>Expires</th>
<th>Supplier</th> <th>Supplier</th>
@ -38,11 +39,12 @@
<tbody> <tbody>
@foreach ($o as $oo) @foreach ($o as $oo)
<tr @if ($oo->service_expire->isPast()) class="table-danger" @endif> <tr @if ($oo->hasExpired()) class="table-danger" @endif>
<td><a href="{{ url('u/service',[$oo->service_id]) }}">{{ $oo->service->sid }}</td> <td><a href="{{ url('u/service',[$oo->service_id]) }}">{{ $oo->service->sid }}</td>
<td>{{ $oo->service->account->name }}</td> <td>{{ $oo->service->account->name }}</td>
<td>{{ $oo->service->product->name }}</td>
<td>{{ $oo->service_name }}</td> <td>{{ $oo->service_name }}</td>
<td>{{ $oo->service_expire->format('Y-m-d') }}</td> <td>{{ $oo->service_expire ? $oo->service_expire->format('Y-m-d') : '-' }}</td>
<td>{{ $oo->service->product->supplier->name }}</td> <td>{{ $oo->service->product->supplier->name }}</td>
<td>{{ $oo->admin_url }}</td> <td>{{ $oo->admin_url }}</td>
<td>@if($oo->admin_user){{ $oo->admin_user }}/{{ $oo->admin_pass }}@else &nbsp; @endif</td> <td>@if($oo->admin_user){{ $oo->admin_user }}/{{ $oo->admin_pass }}@else &nbsp; @endif</td>
@ -71,14 +73,14 @@
</style> </style>
<script type="text/javascript"> <script type="text/javascript">
$(document).ready(function() { $(document).ready(function() {
$('#service_email').DataTable({ $('#services').DataTable({
order: [[4,'asc'],[1,'asc'],[2,'desc']], order: [[5,'asc'],[1,'asc'],[2,'desc']],
rowGroup: { rowGroup: {
dataSrc: 4, dataSrc: 5,
}, },
columnDefs: [ columnDefs: [
{ {
targets: [4], targets: [5],
visible: false, visible: false,
} }
], ],

View File

@ -1,17 +1,17 @@
@extends('adminlte::layouts.app') @extends('adminlte::layouts.app')
@section('htmlheader_title') @section('htmlheader_title')
Email Hosting Web Hosting
@endsection @endsection
@section('page_title') @section('page_title')
Email Hosting Web Hosting
@endsection @endsection
@section('contentheader_title') @section('contentheader_title')
Email Hosting Web Hosting
@endsection @endsection
@section('contentheader_description') @section('contentheader_description')
Email Hosting currently managed. Web Hosting currently managed.
@endsection @endsection
@section('main-content') @section('main-content')
@ -19,7 +19,7 @@
<div class="col-12"> <div class="col-12">
<div class="card card-dark"> <div class="card card-dark">
<div class="card-body"> <div class="card-body">
<table class="table table-hover" id="service_host"> <table class="table table-hover" id="services">
<thead> <thead>
<tr> <tr>
<th>Service ID</tH> <th>Service ID</tH>
@ -36,13 +36,13 @@
<tbody> <tbody>
@foreach ($o as $oo) @foreach ($o as $oo)
<tr @if ($oo->service_expire->isPast()) class="table-danger" @endif> <tr @if ($oo->hasExpired()) class="table-danger" @endif>
<td><a href="{{ url('u/service',[$oo->service_id]) }}">{{ $oo->service->sid }}</td> <td><a href="{{ url('u/service',[$oo->service_id]) }}">{{ $oo->service->sid }}</td>
<td>{{ $oo->service->account->name }}</td> <td>{{ $oo->service->account->name }}</td>
<td>{{ $oo->service->product->name }}</td> <td>{{ $oo->service->product->name }}</td>
<td>{{ $oo->service_name }}</td> <td>{{ $oo->service_name }}</td>
<td>{{ $oo->service_expire->format('Y-m-d') }}</td> <td>{{ $oo->service_expire ? $oo->service_expire->format('Y-m-d') : '-' }}</td>
<td>{{ ($x=$oo->service->product->supplier) ? $x->name : 'Unknown' }}</td> <td>{{ $oo->service->product->supplier->name }}</td>
<td>@if ($oo->service->isBilled()) <span class="@if($oo->service->suspend_billing)strike @endif">{{ $oo->service->invoice_next->format('Y-m-d') }}</span> @else - @endif</td> <td>@if ($oo->service->isBilled()) <span class="@if($oo->service->suspend_billing)strike @endif">{{ $oo->service->invoice_next->format('Y-m-d') }}</span> @else - @endif</td>
<td>@if (! $oo->service->external_billing)${{ number_format($oo->service->next_invoice_items(TRUE)->sum('total'),2) }}@else - @endif</td> <td>@if (! $oo->service->external_billing)${{ number_format($oo->service->next_invoice_items(TRUE)->sum('total'),2) }}@else - @endif</td>
<td>{{ $oo->service->billing_interval_string }}</td> <td>{{ $oo->service->billing_interval_string }}</td>
@ -67,7 +67,7 @@
</style> </style>
<script type="text/javascript"> <script type="text/javascript">
$(document).ready(function() { $(document).ready(function() {
$('#service_host').DataTable({ $('#services').DataTable({
order: [[5,'asc'],[1,'asc'],[2,'desc']], order: [[5,'asc'],[1,'asc'],[2,'desc']],
rowGroup: { rowGroup: {
dataSrc: 5, dataSrc: 5,

View File

@ -30,10 +30,10 @@
<br>(#{{ $o->order_info_reference }}) <br>(#{{ $o->order_info_reference }})
@break; @break;
@case ('PROVISION-PLANNED') @case ('PROVISION-PLANNED')
<br>({{ ($xx=$o->date_start) ? $xx->format('Y-m-d') : 'No Date' }}) <br>({{ ($xx=$o->start_at) ? $xx->format('Y-m-d') : 'No Date' }})
@break; @break;
@case ('CANCEL-PENDING') @case ('CANCEL-PENDING')
<br>({{ ($xx=$o->date_end) ? $xx->format('Y-m-d') : 'No Date' }}) <br>({{ ($xx=$o->stop_at) ? $xx->format('Y-m-d') : 'No Date' }})
@break; @break;
@endswitch @endswitch
</td> </td>

View File

@ -60,7 +60,7 @@
<script type="text/javascript"> <script type="text/javascript">
$(document).ready(function() { $(document).ready(function() {
$('#services_active').DataTable( { $('#services_active').DataTable( {
order: [4,'asc'], order: [[1,'asc'],[2,'asc']],
rowGroup: { rowGroup: {
dataSrc: 1, dataSrc: 1,
endRender: function ( rows, group ) { endRender: function ( rows, group ) {

View File

@ -1,4 +1,4 @@
<!-- $o = Service\Broadband::class --> <!-- $o = App\Models\Service\Broadband::class -->
<div class="card"> <div class="card">
@if($o->service->isPending()) @if($o->service->isPending())
<div class="ribbon-wrapper ribbon-lg"> <div class="ribbon-wrapper ribbon-lg">
@ -30,17 +30,16 @@
<th>Service Password</th> <th>Service Password</th>
<td>{{ $o->service_password }}</td> <td>{{ $o->service_password }}</td>
</tr> </tr>
@if($o->service_connect_date) @if($o->connect_at)
<tr> <tr>
<th>Connected</th> <th>Connected</th>
<td>{{ $o->service_connect_date->format('Y-m-d') }}</td> <td>{{ $o->connect_at->format('Y-m-d') }}</td>
</tr> </tr>
@endif @endif
<!-- @todo --> @if($x=$o->technology)
@if($o->technology)
<tr> <tr>
<th>Technology</th> <th>Technology</th>
<td>{{ $o->technology }}</td> <td>{{ $x }}</td>
</tr> </tr>
@endif @endif
<tr> <tr>
@ -50,25 +49,29 @@
<!-- @todo --> <!-- @todo -->
<tr> <tr>
<th>Traffic</th> <th>Traffic</th>
<td>{{ $o->service->product->type->allowance_string() }} GB @if(FALSE)(YY GB used month)@endif</td> <td>{{ $o->service->offering->allowance_string() }} GB @if(FALSE)(YY GB used month)@endif</td>
</tr> </tr>
<tr> <tr>
<th>IP Address</th> <th>IP4 Address</th>
<td>{{ $o->ipaddress ?: 'Dynamic' }}</td> <td>{{ $o->ipaddress ?: 'Dynamic' }}</td>
</tr> </tr>
<tr>
<th>IP6 Address</th>
<td>{{ $o->ip6address ?: '-' }}</td>
</tr>
@if ($o->inContract()) @if ($o->inContract())
<tr> <tr>
<th>Contract</th> <th>Contract</th>
<td>{{ $o->contract_term }} months <small>({{ ($x=$o->service_contract_date->addMonths($o->contract_term))->diffForHumans() }})</small></td> <td>{{ $o->contract_term }} months</td>
</tr> </tr>
<tr> <tr>
<th>Contract End</th> <th>Contract End</th>
<td>{{ $x->format('Y-m-d') }}</td> <td>{{ $o->service_expire->format('Y-m-d') }} <small>({{ $o->service_expire->diffForHumans() }})</small></td>
</tr> </tr>
@endif @endif
<tr> <tr>
<th>Cancel Notice</th> <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> <td>1 month @if($o->inContract())<small>(after {{ $o->service_expire->subMonth()->format('Y-m-d') }})</small>@endif</td>
</tr> </tr>
</table> </table>
</div> </div>

View File

@ -1,3 +1,4 @@
<!-- $o = App\Models\Service\Domain::class -->
<div class="card"> <div class="card">
@if($o->service->isPending()) @if($o->service->isPending())
<div class="ribbon-wrapper ribbon-lg"> <div class="ribbon-wrapper ribbon-lg">
@ -39,20 +40,10 @@
<td>{{ $o->service_connect_date->format('Y-m-d') }}</td> <td>{{ $o->service_connect_date->format('Y-m-d') }}</td>
</tr> </tr>
@endif @endif
@if ($o->inContract())
<tr> <tr>
<th>Contract</th> <th>Expires</th>
<!-- @todo --> <td>{{ $o->expire_at->format('Y-m-d') }} <small>({{ $o->expire_at->diffInMonths() }} months) </small></td>
<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> </tr>
</table> </table>
</div> </div>

View File

@ -1,5 +1,4 @@
<!-- $o = App\Models\Service\Host::class --> <!-- $o = App\Models\Service\Email::class -->
{{-- @todo Change this to App\Models\Service\Email --}}
<div class="card"> <div class="card">
@if($o->service->isPending()) @if($o->service->isPending())
<div class="ribbon-wrapper ribbon-lg"> <div class="ribbon-wrapper ribbon-lg">
@ -27,13 +26,12 @@
@endif @endif
@if ($o->inContract()) @if ($o->inContract())
<tr> <tr>
<th>Contract</th> <th>Contract Term</th>
<!-- @todo --> <td>{{ $o->service->contract_term }} months</td>
<td>12 months <small>({{ ($x=$o->domain_expire)->diffForHumans() }})</small></td>
</tr> </tr>
<tr> <tr>
<th>Contract End</th> <th>Contract End</th>
<td>{{ $x->format('Y-m-d') }}</td> <td>{{ $o->service->contract_end->format('Y-m-d') }} <small>({{ $o->service->contract_end->diffForHumans() }})</small></td>
</tr> </tr>
@endif @endif
<tr> <tr>

View File

@ -1,3 +1,4 @@
<!-- $o = App\Models\Service\Host::class -->
<div class="card"> <div class="card">
@if($o->service->isPending()) @if($o->service->isPending())
<div class="ribbon-wrapper ribbon-lg"> <div class="ribbon-wrapper ribbon-lg">
@ -39,13 +40,12 @@
@endif @endif
@if ($o->inContract()) @if ($o->inContract())
<tr> <tr>
<th>Contract</th> <th>Contract Term</th>
<!-- @todo --> <td>{{ $o->service->contract_term }} months</td>
<td>12 months <small>({{ ($x=$o->domain_expire)->diffForHumans() }})</small></td>
</tr> </tr>
<tr> <tr>
<th>Contract End</th> <th>Contract End</th>
<td>{{ $x->format('Y-m-d') }}</td> <td>{{ $o->service->contract_end->format('Y-m-d') }} <small>({{ $o->service->contract_end->diffForHumans() }})</small></td>
</tr> </tr>
@endif @endif
<tr> <tr>

View File

@ -1,3 +1,4 @@
<!-- $o = App\Models\Service -->
<div class="card"> <div class="card">
@if($o->external_billing) @if($o->external_billing)
<div class="ribbon-wrapper ribbon-lg"> <div class="ribbon-wrapper ribbon-lg">
@ -15,7 +16,7 @@
<table class="table table-sm"> <table class="table table-sm">
<tr> <tr>
<th>Account</th> <th>Account</th>
<td><a href="{{url('u/home/',$o->account_id)}}">{{ $o->account->aid }}</a></td> <td><a href="{{url('u/home/',$o->account->user_id)}}">{{ $o->account->aid }}</a></td>
</tr> </tr>
<tr> <tr>
<th>Status</th> <th>Status</th>

View File

@ -1,3 +1,4 @@
<!-- $o = App\Models\Service\Phone::class -->
<div class="card"> <div class="card">
@if($o->service->isPending()) @if($o->service->isPending())
<div class="ribbon-wrapper ribbon-lg"> <div class="ribbon-wrapper ribbon-lg">
@ -8,7 +9,7 @@
@endif @endif
<div class="card-header bg-gray-dark"> <div class="card-header bg-gray-dark">
<h3 class="card-title">VOIP Details</h3> <h3 class="card-title">Phone Details</h3>
</div> </div>
<div class="card-body bg-gray-dark"> <div class="card-body bg-gray-dark">
@ -29,10 +30,10 @@
<th>Service Password</th> <th>Service Password</th>
<td>{{ $o->service_password }}</td> <td>{{ $o->service_password }}</td>
</tr> </tr>
@if($o->service_connect_date) @if($o->connect_at)
<tr> <tr>
<th>Connected</th> <th>Connected</th>
<td>{{ $o->service_connect_date->format('Y-m-d') }}</td> <td>{{ $o->connect_at->format('Y-m-d') }}</td>
</tr> </tr>
@endif @endif
<!-- @todo --> <!-- @todo -->

View File

@ -1,5 +1,5 @@
<fieldset class="form-group"> <fieldset class="form-group">
<label class="col-md-12">VOIP</label> <label class="col-md-12">PHONE</label>
<div class="form-group col-sm-6 {{ $errors->has('options.phonenumber') ? 'has-error' : '' }}"> <div class="form-group col-sm-6 {{ $errors->has('options.phonenumber') ? 'has-error' : '' }}">
<label for="options.phonenumber">Phone Number</label> <label for="options.phonenumber">Phone Number</label>