Added hosting report and enabled updating hosting details
This commit is contained in:
parent
edc06e51fb
commit
9659621ba0
@ -35,6 +35,14 @@ class ProductController extends Controller
|
|||||||
->sortBy('name')
|
->sortBy('name')
|
||||||
->values();
|
->values();
|
||||||
|
|
||||||
|
case 'App\Models\Product\Host':
|
||||||
|
return Product\Host::select(['id','supplier_host_id'])
|
||||||
|
->with(['supplied.supplier_detail.supplier'])
|
||||||
|
->get()
|
||||||
|
->map(function($item) { return ['id'=>$item->id,'name'=>sprintf('%s: %s',$item->supplied->supplier_detail->supplier->name,$item->supplied->name)]; })
|
||||||
|
->sortBy('name')
|
||||||
|
->values();
|
||||||
|
|
||||||
default:
|
default:
|
||||||
throw new \Exception('Unknown type: '.$request->type);
|
throw new \Exception('Unknown type: '.$request->type);
|
||||||
}
|
}
|
||||||
|
@ -269,6 +269,20 @@ class ServiceController extends Controller
|
|||||||
->with('o',$o);
|
->with('o',$o);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function hosting_list(): View
|
||||||
|
{
|
||||||
|
// @todo Need to add the with path when calculating next_billed and price
|
||||||
|
$o = Service\Host::serviceActive()
|
||||||
|
->serviceUserAuthorised(Auth::user())
|
||||||
|
->select('ab_service__hosting.*')
|
||||||
|
->join('ab_service',['ab_service.id'=>'ab_service__hosting.service_id'])
|
||||||
|
->with(['service.account','service.product.type.supplied.supplier_detail.supplier','tld'])
|
||||||
|
->get();
|
||||||
|
|
||||||
|
return view('r.service.host.list')
|
||||||
|
->with('o',$o);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update details about a service
|
* Update details about a service
|
||||||
*
|
*
|
||||||
|
@ -245,7 +245,7 @@ class Product extends Model implements IDs
|
|||||||
* Get our product type
|
* Get our product type
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
* @todo is the test of type and type->supplied necessary?
|
* @todo is the test of type and type->supplied necessary? (It seems some hosting entries have no type, are they old?)
|
||||||
*/
|
*/
|
||||||
public function getProductTypeAttribute(): string
|
public function getProductTypeAttribute(): string
|
||||||
{
|
{
|
||||||
@ -257,9 +257,9 @@ class Product extends Model implements IDs
|
|||||||
*
|
*
|
||||||
* @return Model
|
* @return Model
|
||||||
*/
|
*/
|
||||||
public function getSupplierAttribute(): Model
|
public function getSupplierAttribute(): ?Model
|
||||||
{
|
{
|
||||||
return $this->getSuppliedAttribute()->supplier_detail->supplier;
|
return $this->getSuppliedAttribute() ? $this->getSuppliedAttribute()->supplier_detail->supplier : NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -267,9 +267,9 @@ class Product extends Model implements IDs
|
|||||||
*
|
*
|
||||||
* @return Model
|
* @return Model
|
||||||
*/
|
*/
|
||||||
public function getSuppliedAttribute(): Model
|
public function getSuppliedAttribute(): ?Model
|
||||||
{
|
{
|
||||||
return $this->type->supplied;
|
return $this->type && $this->type->supplied ? $this->type->supplied : NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -401,7 +401,7 @@ class Product extends Model implements IDs
|
|||||||
*/
|
*/
|
||||||
public function hasUsage(): bool
|
public function hasUsage(): bool
|
||||||
{
|
{
|
||||||
return $this->type->hasUsage();
|
return $this->type && $this->type->hasUsage();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2,15 +2,18 @@
|
|||||||
|
|
||||||
namespace App\Models\Service;
|
namespace App\Models\Service;
|
||||||
|
|
||||||
|
use Carbon\Carbon;
|
||||||
|
|
||||||
use App\Interfaces\ServiceItem;
|
use App\Interfaces\ServiceItem;
|
||||||
use App\Models\Base\ServiceType;
|
use App\Models\Base\ServiceType;
|
||||||
use App\Models\DomainTld;
|
use App\Models\DomainTld;
|
||||||
use App\Models\HostServer;
|
use App\Models\HostServer;
|
||||||
use App\Traits\NextKey;
|
use App\Traits\NextKey;
|
||||||
use Carbon\Carbon;
|
use App\Traits\{ScopeServiceActive,ScopeServiceUserAuthorised};
|
||||||
|
|
||||||
class Host extends ServiceType implements ServiceItem
|
class Host extends ServiceType implements ServiceItem
|
||||||
{
|
{
|
||||||
|
use ScopeServiceActive,ScopeServiceUserAuthorised;
|
||||||
use NextKey;
|
use NextKey;
|
||||||
const RECORD_ID = 'service__hosting';
|
const RECORD_ID = 'service__hosting';
|
||||||
|
|
||||||
@ -38,7 +41,7 @@ class Host extends ServiceType implements ServiceItem
|
|||||||
|
|
||||||
public function getServiceExpireAttribute(): Carbon
|
public function getServiceExpireAttribute(): Carbon
|
||||||
{
|
{
|
||||||
// TODO: Implement getServiceExpireAttribute() method.
|
return $this->host_expire;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getServiceNameAttribute(): string
|
public function getServiceNameAttribute(): string
|
||||||
|
@ -149,11 +149,8 @@
|
|||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
$('#registrar_ns').select2({
|
// @todo This is taking up too much width
|
||||||
dropdownAutoWidth: true,
|
//$('#tld_id').select2();
|
||||||
width: 'style',
|
|
||||||
tags: true,
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
@append
|
@append
|
@ -0,0 +1,139 @@
|
|||||||
|
<!-- o = App\Models\Service\Email::class -->
|
||||||
|
<div class="row">
|
||||||
|
<!-- DOMAIN NAME -->
|
||||||
|
<div class="col-6">
|
||||||
|
<div class="form-group has-validation">
|
||||||
|
<label for="domain_name">Domain Name</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fas fa-fw fa-globe-asia"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="text" class="form-control col-9 text-right @error('host.domain_name') is-invalid @enderror" id="domain_name" name="host[domain_name]" placeholder="Domain Name..." value="{{ old('host.domain_name',$o->domain_name) }}" required>
|
||||||
|
<div class="input-group-append">
|
||||||
|
<span class="input-group-text">.</span>
|
||||||
|
</div>
|
||||||
|
<select class="form-control" id="domain_tld_id" name="host[domain_tld_id]">
|
||||||
|
@foreach(\App\Models\DomainTld::active()->orderBy('name')->get() as $oo)
|
||||||
|
<option value="{{ $oo->id }}" @if($oo->id == old('domain.domain_tld_id',$o->domain_tld_id))selected @endif>{{ $oo->name }}</option>
|
||||||
|
@endforeach
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<span class="invalid-feedback" role="alert">
|
||||||
|
@error('host.domain_name')
|
||||||
|
{{ $message }}
|
||||||
|
@else
|
||||||
|
Domain Name is required.
|
||||||
|
@enderror
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<span class="input-helper">Domain Name</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- EXPIRY -->
|
||||||
|
<div class="col-3">
|
||||||
|
<div class="form-group has-validation">
|
||||||
|
<label for="host_expire">Expiry</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fas fa-fw fa-calendar"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="date" class="form-control @error('host.host_expire') is-invalid @enderror" id="host_expire" name="host[host_expire]" value="{{ old('host.host_expire',($o->host_expire ? $o->host_expire->format('Y-m-d') : NULL)) }}">
|
||||||
|
<span class="invalid-feedback" role="alert">
|
||||||
|
@error('host.host_expire')
|
||||||
|
{{ $message }}
|
||||||
|
@enderror
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<span class="input-helper">Hosting Expires</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
{{--
|
||||||
|
<!-- ADMIN URL -->
|
||||||
|
<div class="col-9">
|
||||||
|
<div class="form-group has-validation">
|
||||||
|
<label for="admin_url">Hosting Admin URL</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fab fa-fw fa-safari"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="text" class="form-control @error('host.admin_url') is-invalid @enderror" id="admin_url" name="host[admin_url]" placeholder="Admin URL..." value="{{ old('host.admin_url',$o->admin_url) }}">
|
||||||
|
<span class="invalid-feedback" role="alert">
|
||||||
|
@error('host.admin_url')
|
||||||
|
{{ $message }}
|
||||||
|
@enderror
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<span class="input-helper">Admin URL</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
--}}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<!-- ADMIN USER -->
|
||||||
|
<div class="col-6">
|
||||||
|
<div class="form-group has-validation">
|
||||||
|
<label for="host_username">Admin User</label>
|
||||||
|
<div class="input-group flex-nowrap">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fas fa-fw fa-user"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="text" class="form-control @error('host.host_username') is-invalid @enderror" id="host_username" name="host[host_username]" placeholder="Admin USER" value="{{ old('host.host_username',$o->host_username) }}">
|
||||||
|
<span class="invalid-feedback" role="alert">
|
||||||
|
@error('host.host_username')
|
||||||
|
{{ $message }}
|
||||||
|
@enderror
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<span class="input-helper">Admin USER</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- ADMIN PASS -->
|
||||||
|
<div class="col-6">
|
||||||
|
<div class="form-group has-validation">
|
||||||
|
<label for="host_password">Admin Pass</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fas fa-fw fa-lock"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="text" class="form-control @error('host.host_password') is-invalid @enderror" id="host_password" name="host[host_password]" value="{{ old('host.host_password',$o->host_password) }}">
|
||||||
|
<span class="invalid-feedback" role="alert">
|
||||||
|
@error('host.host_password')
|
||||||
|
{{ $message }}
|
||||||
|
@enderror
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<span class="input-helper">Admin PASSWORD</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@section('page-scripts')
|
||||||
|
@css(select2)
|
||||||
|
@js(select2,autofocus)
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.select2-selection.select2-selection--single {
|
||||||
|
height: calc(2.25rem + 2px) !important;
|
||||||
|
}
|
||||||
|
.select2.select2-container.select2-container--default {
|
||||||
|
display: flex;
|
||||||
|
flex: 1 1 auto;
|
||||||
|
}
|
||||||
|
.select2.select2-container.select2-container--default .selection {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
$(document).ready(function() {
|
||||||
|
// @todo This is taking up too much width
|
||||||
|
//$('#domain_tld_id').select2();
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
@append
|
@ -80,7 +80,7 @@
|
|||||||
],
|
],
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#invoices_due tbody').on('click','tr', function () {
|
$('tbody').on('click','tr', function () {
|
||||||
$(this).toggleClass('selected');
|
$(this).toggleClass('selected');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -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_domain">
|
<table class="table table-hover" id="service_email">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Service ID</tH>
|
<th>Service ID</tH>
|
||||||
@ -71,7 +71,7 @@
|
|||||||
</style>
|
</style>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
$('#service_domain').DataTable({
|
$('#service_email').DataTable({
|
||||||
order: [[4,'asc'],[1,'asc'],[2,'desc']],
|
order: [[4,'asc'],[1,'asc'],[2,'desc']],
|
||||||
rowGroup: {
|
rowGroup: {
|
||||||
dataSrc: 4,
|
dataSrc: 4,
|
||||||
@ -84,7 +84,7 @@
|
|||||||
],
|
],
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#invoices_due tbody').on('click','tr', function () {
|
$('tbody').on('click','tr', function () {
|
||||||
$(this).toggleClass('selected');
|
$(this).toggleClass('selected');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -0,0 +1,88 @@
|
|||||||
|
@extends('adminlte::layouts.app')
|
||||||
|
|
||||||
|
@section('htmlheader_title')
|
||||||
|
Email Hosting
|
||||||
|
@endsection
|
||||||
|
@section('page_title')
|
||||||
|
Email Hosting
|
||||||
|
@endsection
|
||||||
|
|
||||||
|
@section('contentheader_title')
|
||||||
|
Email Hosting
|
||||||
|
@endsection
|
||||||
|
@section('contentheader_description')
|
||||||
|
Email Hosting currently managed.
|
||||||
|
@endsection
|
||||||
|
|
||||||
|
@section('main-content')
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-12">
|
||||||
|
<div class="card card-dark">
|
||||||
|
<div class="card-body">
|
||||||
|
<table class="table table-hover" id="service_host">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Service ID</tH>
|
||||||
|
<th>Account</th>
|
||||||
|
<th>Product</th>
|
||||||
|
<th>Domain</th>
|
||||||
|
<th>Expires</th>
|
||||||
|
<th>Supplier</th>
|
||||||
|
<th>Next Billed</th>
|
||||||
|
<th>Price</th>
|
||||||
|
<th>Term</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
|
||||||
|
<tbody>
|
||||||
|
@foreach ($o as $oo)
|
||||||
|
<tr @if ($oo->service_expire->isPast()) class="table-danger" @endif>
|
||||||
|
<td><a href="{{ url('u/service',[$oo->service_id]) }}">{{ $oo->service->sid }}</td>
|
||||||
|
<td>{{ $oo->service->account->name }}</td>
|
||||||
|
<td>{{ $oo->service->product->name }}</td>
|
||||||
|
<td>{{ $oo->service_name }}</td>
|
||||||
|
<td>{{ $oo->service_expire->format('Y-m-d') }}</td>
|
||||||
|
<td>{{ ($x=$oo->service->product->supplier) ? $x->name : 'Unknown' }}</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>{{ $oo->service->billing_interval_string }}</td>
|
||||||
|
</tr>
|
||||||
|
@endforeach
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endsection
|
||||||
|
|
||||||
|
@section('page-scripts')
|
||||||
|
@css(datatables,bootstrap4|rowgroup)
|
||||||
|
@js(datatables,bootstrap4|rowgroup)
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.strike {
|
||||||
|
text-decoration: line-through;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<script type="text/javascript">
|
||||||
|
$(document).ready(function() {
|
||||||
|
$('#service_host').DataTable({
|
||||||
|
order: [[5,'asc'],[1,'asc'],[2,'desc']],
|
||||||
|
rowGroup: {
|
||||||
|
dataSrc: 5,
|
||||||
|
},
|
||||||
|
columnDefs: [
|
||||||
|
{
|
||||||
|
targets: [5],
|
||||||
|
visible: false,
|
||||||
|
}
|
||||||
|
],
|
||||||
|
});
|
||||||
|
|
||||||
|
$('tbody').on('click','tr', function () {
|
||||||
|
$(this).toggleClass('selected');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
@append
|
@ -107,8 +107,8 @@
|
|||||||
@can('reseller')
|
@can('reseller')
|
||||||
<li class="nav-header">RESELLER</li>
|
<li class="nav-header">RESELLER</li>
|
||||||
|
|
||||||
<li class="nav-item has-treeview @if(preg_match('#^r/report/(domain|email)#',request()->path()))menu-open @else menu-closed @endif">
|
<li class="nav-item has-treeview @if(preg_match('#^r/report/(domain|email|hosting)#',request()->path()))menu-open @else menu-closed @endif">
|
||||||
<a href="#" class="nav-link @if(preg_match('#^r/report/(domain|email)#',request()->path())) active @endif">
|
<a href="#" class="nav-link @if(preg_match('#^r/report/(domain|email|hosting)#',request()->path())) active @endif">
|
||||||
<i class="nav-icon fas fa-list"></i> <p>REPORT<i class="fas fa-angle-left right"></i></p>
|
<i class="nav-icon fas fa-list"></i> <p>REPORT<i class="fas fa-angle-left right"></i></p>
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
@ -124,6 +124,12 @@
|
|||||||
<i class="nav-icon fas fa-envelope"></i> <p>Email Hosting</p>
|
<i class="nav-icon fas fa-envelope"></i> <p>Email Hosting</p>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
|
<li class="nav-item">
|
||||||
|
<a href="{{ url('r/report/hosting') }}" class="nav-link @if(preg_match('#^r/report/hosting#',request()->path()))active @endif">
|
||||||
|
<i class="nav-icon fas fa-sitemap"></i> <p>Web Hosting</p>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
@endcan
|
@endcan
|
@ -81,6 +81,7 @@ Route::group(['middleware'=>['theme:adminlte-be','auth','role:reseller'],'prefix
|
|||||||
Route::group(['middleware'=>['theme:adminlte-be','auth','role:reseller'],'prefix'=>'report'],function() {
|
Route::group(['middleware'=>['theme:adminlte-be','auth','role:reseller'],'prefix'=>'report'],function() {
|
||||||
Route::get('domain',[ServiceController::class,'domain_list']);
|
Route::get('domain',[ServiceController::class,'domain_list']);
|
||||||
Route::get('email',[ServiceController::class,'email_list']);
|
Route::get('email',[ServiceController::class,'email_list']);
|
||||||
|
Route::get('hosting',[ServiceController::class,'hosting_list']);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Charges on an account
|
// Charges on an account
|
||||||
|
Loading…
Reference in New Issue
Block a user