More work on moving service updates to use components, move 'host' to 'hosting', move some redundant views

This commit is contained in:
Deon George 2024-08-01 17:34:31 +10:00
parent 078dc6ab39
commit f8453ae391
18 changed files with 120 additions and 476 deletions

View File

@ -8,7 +8,6 @@ use Illuminate\Http\Request;
use Illuminate\Support\Arr;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Gate;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Mail;
use Illuminate\Support\Facades\Session;
@ -18,7 +17,7 @@ use Illuminate\Validation\ValidationException;
use Illuminate\View\View;
use Symfony\Component\HttpKernel\Exception\HttpException;
use App\Http\Requests\{ChargeAdd,ServiceChangeRequest};
use App\Http\Requests\ServiceChangeRequest;
use App\Mail\{CancelRequest,ChangeRequest};
use App\Models\{Charge,Invoice,Product,Service};
@ -274,7 +273,7 @@ class ServiceController extends Controller
*/
public function domain_list(): View
{
$o = Service\Domain::serviceActive()
$o = Service\Domain::ServiceActive()
->serviceUserAuthorised(Auth::user())
->select('service_domain.*')
->join('services',['services.id'=>'service_domain.service_id'])
@ -287,8 +286,7 @@ class ServiceController extends Controller
public function email_list(): View
{
// @todo Need to add the with path when calculating next_billed and price
$o = Service\Email::serviceActive()
$o = Service\Email::ServiceActive()
->serviceUserAuthorised(Auth::user())
->select('service_email.*')
->join('services',['services.id'=>'service_email.service_id'])
@ -314,15 +312,14 @@ class ServiceController extends Controller
public function hosting_list(): View
{
// @todo Need to add the with path when calculating next_billed and price
$o = Service\Host::serviceActive()
$o = Service\Host::ServiceActive()
->serviceUserAuthorised(Auth::user())
->select('service_host.*')
->join('services',['services.id'=>'service_host.service_id'])
->with(['service.account','service.product.type.supplied.supplier_detail.supplier','tld'])
->get();
return view('theme.backend.adminlte.service.host.list')
return view('theme.backend.adminlte.service.hosting.list')
->with('o',$o);
}
@ -471,7 +468,7 @@ class ServiceController extends Controller
$o->type->save();
if ($validated->has('invoice_next_at'))
$o->invoice_next_at = $validated->get('invoice_next_at');
$o->invoice_next_at = $validated?->get('invoice_next_at');
if ($validated->has('recur_schedule'))
$o->recur_schedule = $validated->get('recur_schedule');

View File

@ -64,12 +64,14 @@ abstract class Type extends Model implements ServiceItem
public function hasExpired(): bool
{
return (! $this->inContract()) && ($this->service->invoice_next_at && $this->service->invoice_next_at->isPast());
return (! $this->inContract())
&& ($this->service->invoice_next && $this->service->invoice_next->isPast());
}
public function inContract(): bool
{
return $this->expire_at && $this->expire_at->isFuture();
return $this->expire_at
&& $this->expire_at->isFuture();
}
/* ATTRIBUTES */

6
composer.lock generated
View File

@ -3056,11 +3056,11 @@
},
{
"name": "leenooks/laravel",
"version": "11.1.8",
"version": "11.1.9",
"source": {
"type": "git",
"url": "https://gitea.dege.au/laravel/leenooks.git",
"reference": "8acc3a91af7e4ce622aec60934a2f942b4a19eda"
"reference": "293d9913c65143f00e3051bff32d15c97644bd15"
},
"type": "library",
"extra": {
@ -3093,7 +3093,7 @@
"laravel",
"leenooks"
],
"time": "2024-07-31T12:40:35+00:00"
"time": "2024-08-01T07:32:20+00:00"
},
{
"name": "leenooks/passkey",

View File

@ -0,0 +1,30 @@
@use(App\Models\TLD)
<div class="form-group has-validation">
@if(isset($label))
<label for="domain_name">{{ $label }}</label>
@endif
<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($name.'.domain_name')is-invalid @enderror" id="domain_name" name="{{ $name }}[domain_name]" placeholder="Domain Name..." value="{{ old($name.'.domain_name',$nameValue ?? '') }}" required>
<div class="input-group-append">
<span class="input-group-text">.</span>
</div>
<select class="form-control col-3" name="{{ $name }}[tld_id]">
@foreach(TLD::orderBy('name')->get() as $oo)
<option value="{{ $oo->id }}" @selected($oo->id == old($name.'.tld_id',$tldValue ?? ''))>{{ $oo->name }}</option>
@endforeach
</select>
<span class="invalid-feedback" role="alert">
@error($name.'.domain_name')
{{ $message }}
@else
Domain Name is required.
@enderror
</span>
</div>
<span class="input-helper">Domain Name</span>
</div>

View File

@ -1,37 +0,0 @@
@if(($x=$list)->count())
<div class="card card-light">
<div class="card-header">
<h1 class="card-title">Pending Charges</h1>
</div>
<div class="card-body">
<table class="table table-hover">
<thead>
<tr>
<th>ID</th>
<th>Date Created</th>
<th>Date Charge</th>
<th>Service</th>
<th>Type</th>
<th>Description</th>
<th class="text-right">Total</th>
</tr>
</thead>
<tbody>
@foreach ($x as $co)
<tr>
<td><a href="{{ url('a/charge/addedit',[$co->id]) }}">{{ $co->id }}</a></td>
<td>{{ $co->created_at->format('Y-m-d') }}</td>
<td>{{ $co->charge_at ? $co->charge_at->format('Y-m-d') : '-' }}</td>
<td>{{ $co->service->sid }}</td>
<td>{{ $co->type }}</td>
<td>{{ $co->description }}</td>
<td class="text-right">{{ number_format($co->quantity*$co->amount,2) }}</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
@endif

View File

@ -1,19 +0,0 @@
<!-- Terms and conditions modal -->
<div class="modal fade" id="termsModal" tabindex="-1" role="dialog" aria-labelledby="Terms and conditions" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h3 class="modal-title">Terms and conditions</h3>
</div>
<div class="modal-body">
<p>Lorem ipsum dolor sit amet, veniam numquam has te. No suas nonumes recusabo mea, est ut graeci definitiones. His ne melius vituperata scriptorem, cum paulo copiosae conclusionemque at. Facer inermis ius in, ad brute nominati referrentur vis. Dicat erant sit ex. Phaedrum imperdiet scribentur vix no, ad latine similique forensibus vel.</p>
<p>Dolore populo vivendum vis eu, mei quaestio liberavisse ex. Electram necessitatibus ut vel, quo at probatus oportere, molestie conclusionemque pri cu. Brute augue tincidunt vim id, ne munere fierent rationibus mei. Ut pro volutpat praesent qualisque, an iisque scripta intellegebat eam.</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary" data-dismiss="modal">OK</button>
</div>
</div>
</div>
</div>

View File

@ -1,43 +0,0 @@
<table class="table table-bordered w-100" id="invoices">
<thead>
<tr>
<th class="text-right">#</th>
<th class="text-right">Issued</th>
<th class="text-right">Due</th>
<th class="text-right">Total</th>
<th class="text-right">Payments</th>
<th class="text-right">Outstanding</th>
</tr>
</thead>
<tbody>
@foreach ($o->invoices as $io)
<tr>
<td class="text-right"><a href="{{ url('u/invoice',$io->id) }}">{{ $io->id }}</a></td>
<td class="text-right">{{ $io->created_at->format('Y-m-d') }}</td>
<td class="text-right">{{ $io->due_at->format('Y-m-d') }}</td>
<td class="text-right">${{ number_format($io->total,2) }}</td>
<td class="text-right">${{ number_format($io->paid,2) }}</td>
<td class="text-right">${{ number_format($io->due,2) }}</td>
</tr>
@endforeach
</tbody>
</table>
@section('page-scripts')
@css(datatables,bootstrap4)
@js(datatables,bootstrap4|responsive)
<script type="text/javascript">
$(document).ready(function() {
$('#invoices').DataTable( {
responsive: true,
order: [1, 'desc']
});
$('#invoices tbody').on('click','tr', function () {
$(this).toggleClass('selected');
});
});
</script>
@append

View File

@ -46,7 +46,7 @@
<td>{{ $oo->registrar->name }}</td>
<td>{{ $oo->registrar_ns }}</td>
<td>@if ($oo->service->isBilled()) {{ $oo->service->invoice_next->format('Y-m-d') }}@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()->sum('total'),2) }}@else - @endif</td>
<td>{{ $oo->service->billing_interval_string }}</td>
</tr>
@endforeach
@ -58,15 +58,9 @@
</div>
@endsection
@section('page-scripts')
@css(datatables,bootstrap4|rowgroup)
@js(datatables,bootstrap4|rowgroup)
@pa(datatables,rowgroup)
<style>
.strike {
text-decoration: line-through;
}
</style>
@section('page-scripts')
<script type="text/javascript">
$(document).ready(function() {
$('#services').DataTable({
@ -81,10 +75,6 @@
}
],
});
$('tbody').on('click','tr', function () {
$(this).toggleClass('selected');
});
});
</script>
@append

View File

@ -50,7 +50,7 @@
<td>@if($oo->admin_user){{ $oo->admin_user }}/{{ $oo->admin_pass }}@else &nbsp; @endif</td>
<td class="text-right">{{ number_format($oo->accounts ?: 0) }}</td>
<td>@if ($oo->service->isBilled()) {{ $oo->service->invoice_next->format('Y-m-d') }} @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()->sum('total'),2) }}@else - @endif</td>
<td>{{ $oo->service->billing_interval_string }}</td>
</tr>
@endforeach
@ -62,15 +62,9 @@
</div>
@endsection
@section('page-scripts')
@css(datatables,bootstrap4|rowgroup)
@js(datatables,bootstrap4|rowgroup)
@pa(datatables,rowgroup)
<style>
.strike {
text-decoration: line-through;
}
</style>
@section('page-scripts')
<script type="text/javascript">
$(document).ready(function() {
$('#services').DataTable({
@ -85,10 +79,6 @@
}
],
});
$('tbody').on('click','tr', function () {
$(this).toggleClass('selected');
});
});
</script>
@append

View File

@ -44,7 +44,7 @@
<td>{{ $oo->service_expire ? $oo->service_expire->format('Y-m-d') : '-' }}</td>
<td>{{ $oo->service->product->supplier->name }}</td>
<td>@if ($oo->service->isBilled()) {{ $oo->service->invoice_next->format('Y-m-d') }}@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()->sum('total'),2) }}@else - @endif</td>
<td>{{ $oo->service->billing_interval_string }}</td>
</tr>
@endforeach
@ -56,15 +56,9 @@
</div>
@endsection
@section('page-scripts')
@css(datatables,bootstrap4|rowgroup)
@js(datatables,bootstrap4|rowgroup)
@pa(datatables,rowgroup)
<style>
.strike {
text-decoration: line-through;
}
</style>
@section('page-scripts')
<script type="text/javascript">
$(document).ready(function() {
$('#services').DataTable({
@ -79,10 +73,6 @@
}
],
});
$('tbody').on('click','tr', function () {
$(this).toggleClass('selected');
});
});
</script>
@append

View File

@ -72,10 +72,6 @@
},
orderFixed: [1, 'asc']
});
$('#service_movements tbody').on('click','tr', function () {
$(this).toggleClass('selected');
});
});
</script>
@append

View File

@ -26,6 +26,7 @@
<strong>NOTE</strong>: A plan setup fee is normally not applicable to Broadband changes, but a plan change fee normally is.
</div>
</div>
@section('page-scripts')
<script>
$(document).ready(function() {

View File

@ -35,7 +35,7 @@
</div>
<div class="col-12 col-sm-9 col-md-6 col-xl-5">
<x-leenooks::form.date id="expire_at" name="broadband[expire_at]" icon="fa-calendar" label="Contract End" old="broadband.expire_at" :value="$o->expire_at?->format('Y-m-d') ?: ($o->connect_at?->addMonths($o->contract_term)->format('Y-m-d'))"/>
<x-leenooks::form.date id="expire_at" name="broadband[expire_at]" icon="fa-calendar" label="Contract End" old="broadband.expire_at" :value="($o->expire_at ?: $o->connect_at?->addMonths($o->contract_term))?->format('Y-m-d')"/>
</div>
</div>

View File

@ -1,44 +1,15 @@
@use(App\Models\Domain)
@use(App\Models\DomainRegistrar)
@use(App\Models\Service\Domain,ServiceDomain)
<!-- o=Service\Domain::class -->
<div class="row">
<div class="col-12 col-sm-9 col-md-12 col-xl-7">
<div class="form-group">
<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" style="width:55%;" class="form-control text-right @error('domain_name') is-invalid @enderror" id="domain_name" name="domain[domain_name]" placeholder="Domain Name..." value="{{ old('domain.domain_name',$o->domain_name) }}" required>
<div class="input-group-append">
<span class="input-group-text">.</span>
</div>
<select style="width:25%;" class="form-control @error('tld_id') is-invalid @enderror" id="tld_id" name="domain[tld_id]">
@foreach(\App\Models\TLD::orderBy('name')->get() as $oo)
<option value="{{ $oo->id }}" @if($oo->id == old('domain.tld_id',$o->tld_id))selected @endif>{{ $oo->name }}</option>
@endforeach
</select>
<span class="invalid-feedback" role="alert">
@error('domain_name')
{{ $message }}
@enderror
@error('tld_id')
{{ $message }}
@enderror
</span>
</div>
</div>
<x-form.domain name="domain" label="Domain Name" :name_value="$o->domain_name" :tld_value="$o->tld_id"/>
</div>
<div class="col-12 col-sm-9 col-md-6 col-xl-5">
@include('adminlte::widget.form_date',[
'label'=>'Expiry',
'icon'=>'fas fa-calendar',
'id'=>'expire_at',
'old'=>'domain.expire_at',
'name'=>'domain[expire_at]',
'value'=>$o->expire_at ? $o->expire_at->format('Y-m-d') : ($o->connect_at ? $o->connect_at->addMonths($o->contract_term)->format('Y-m-d') : ''),
])
<x-leenooks::form.date id="expire_at" name="domain[expire_at]" icon="fa-calendar" label="Expiry" old="domain.expire_at" :value="$o->expire_at?->format('Y-m-d')"/>
</div>
</div>
@ -47,77 +18,27 @@
<div class="row">
<div class="col-12 col-sm-9 col-md-6 col-xl-5">
@include('adminlte::widget.form_select',[
'label'=>'Registrar',
'icon'=>'fas fa-handshake',
'id'=>'domain_registrar_id',
'old'=>'domain.domain_registrar_id',
'name'=>'domain[domain_registrar_id]',
'options'=>\App\Models\DomainRegistrar::active()->orderBy('name')->get()->transform(function($item) { return ['id'=>$item->id,'value'=>$item->name]; }),
'value'=>$o->domain_registrar_id ?? '',
])
<x-leenooks::form.select id="domain_registrar_id" name="domain[domain_registrar_id]" icon="fa-handshake" label="Registrar" :value="$o->domain_registrar_id" :options="DomainRegistrar::active()->orderBy('name')->get()->transform(fn($item)=>['id'=>$item->id,'value'=>$item->name])"/>
</div>
<div class="col-12 col-sm-9 col-md-12 col-xl-6">
@include('adminlte::widget.form_text',[
'label'=>'Registrar Account',
'icon'=>'fas fa-user-circle',
'id'=>'registrar_account',
'old'=>'domain.registrar_account',
'name'=>'domain[registrar_account]',
'value'=>$o->registrar_account ?? '',
])
<x-leenooks::form.text id="registrar_account" name="domain[registrar_account]" icon="fa-user-circle" label="Registrar Username" :value="$o->registrar_account"/>
</div>
</div>
<div class="row">
<div class="col-12 col-sm-9 col-md-6 col-xl-5">
@include('adminlte::widget.form_select',[
'label'=>'DNS Location',
'icon'=>'fas fa-project-diagram',
'id'=>'registrar_ns',
'old'=>'domain.registrar_ns',
'name'=>'domain[registrar_ns]',
'options'=>\App\Models\Service\Domain::select('registrar_ns')->distinct()->orderBy('registrar_ns')->get()->transform(function($item) { return ['id'=>$item->registrar_ns,'value'=>$item->registrar_ns]; }),
'value'=>$o->registrar_ns ?? '',
'addvalues'=>TRUE,
])
<x-leenooks::form.select id="registrar_ns" name="domain[registrar_ns]" icon="fa-project-diagram" label="DNS Location" :value="$o->registrar_ns" :options="ServiceDomain::select('registrar_ns')->distinct()->orderBy('registrar_ns')->get()->transform(fn($item)=>['id'=>$item->registrar_ns,'value'=>$item->registrar_ns])"/>
</div>
<div class="col-12 col-sm-9 col-md-12 col-xl-6">
@include('adminlte::widget.form_text',[
'label'=>'Registrar Username',
'icon'=>'fas fa-user',
'id'=>'registrar_username',
'old'=>'domain.registrar_username',
'name'=>'domain[registrar_username]',
'value'=>$o->registrar_username ?? '',
])
<x-leenooks::form.text id="registrar_username" name="domain[registrar_username]" icon="fa-user" label="Registrar Username" :value="$o->registrar_username"/>
</div>
</div>
<hr>
<p class="h6">Service Dates</p>
<div class="row">
<div class="col-12 col-sm-9 col-md-6 col-xl-5">
@include('adminlte::widget.form_date',[
'label'=>'Registered Date',
'icon'=>'fas fa-calendar',
'id'=>'start_at',
'old'=>'start_at',
'name'=>'start_at',
'value'=>$o->service->start_at ? $o->service->start_at->format('Y-m-d') : '',
])
</div>
</div>
@pa(select2,autofocus)
@section('page-scripts')
@css(select2)
@js(select2,autofocus)
<script type="text/javascript">
$(document).ready(function() {
$('#tld_id').select2({

View File

@ -1,156 +1,36 @@
<!-- o = App\Models\Service\Email::class -->
<!-- o=Service\Email::class -->
<div class="row">
<!-- DOMAIN NAME -->
<div class="col-6">
<div class="form-group has-validation">
<label for="domain_name">Email 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('email.domain_name') is-invalid @enderror" id="domain_name" name="email[domain_name]" placeholder="Domain Name..." value="{{ old('email.domain_name',$o->domain_name) }}" required>
<div class="input-group-append">
<span class="input-group-text">.</span>
</div>
<select class="form-control col-3" name="email[tld_id]">
@foreach(\App\Models\TLD::orderBy('name')->get() as $oo)
<option value="{{ $oo->id }}" @if($oo->id == old('email.tld_id',$o->tld_id))selected @endif>{{ $oo->name }}</option>
@endforeach
</select>
<span class="invalid-feedback" role="alert">
@error('email.domain_name')
{{ $message }}
@else
Domain Name is required.
@enderror
</span>
</div>
<span class="input-helper">Domain Name</span>
</div>
<div class="col-12 col-sm-9 col-md-12 col-xl-7">
<x-form.domain name="email" label="Email Domain Name" :name_value="$o->domain_name" :tld_value="$o->tld_id"/>
</div>
<!-- EXPIRY -->
<div class="col-3">
<div class="form-group has-validation">
<label for="expire_at">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('email.expire_at') is-invalid @enderror" id="expire_at" name="email[expire_at]" value="{{ old('email.expire_at',($o->expire_at ? $o->expire_at->format('Y-m-d') : NULL)) }}">
<span class="invalid-feedback" role="alert">
@error('email.expire_at')
{{ $message }}
@enderror
</span>
</div>
<span class="input-helper">Email Hosting Expires</span>
</div>
<div class="col-12 col-sm-9 col-md-6 col-xl-5">
<x-leenooks::form.date id="expire_at" name="email[expire_at]" icon="fa-calendar" label="Expiry" old="email.expire_at" :value="($o->expire_at ?: $o->connect_at?->addMonths($o->contract_term))?->format('Y-m-d')"/>
</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('email.admin_url') is-invalid @enderror" id="admin_url" name="email[admin_url]" placeholder="Admin URL..." value="{{ old('email.admin_url',$o->admin_url) }}">
<span class="invalid-feedback" role="alert">
@error('email.admin_url')
{{ $message }}
@enderror
</span>
</div>
<span class="input-helper">Admin URL</span>
</div>
<x-leenooks::form.text id="admin_url" name="email[admin_url]" icon="fa-user" label="Hosting Admin URL" placeholder="Admin URL..." old="email.admin_url" :value="$o->admin_url"/>
</div>
<!-- ACCOUNTS -->
<div class="col-3">
<div class="form-group has-validation">
<label for="accounts">Accounts</label>
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text"><i class="fas fa-fw fa-hashtag"></i></span>
</div>
<input type="text" class="form-control @error('email.accounts') is-invalid @enderror" id="accounts" name="email[accounts]" placeholder="Accounts" value="{{ old('email.accounts',$o->accounts) }}">
<span class="invalid-feedback" role="alert">
@error('email.accounts')
{{ $message }}
@enderror
</span>
</div>
<span class="input-helper"># Accounts</span>
</div>
<x-leenooks::form.text id="accounts" name="email[accounts]" icon="fa-user" label="Accounts" placeholder="Admin URL..." helper="# Accounts" old="email.accounts" :value="$o->accounts"/>
</div>
</div>
<div class="row">
<!-- ADMIN USER -->
<div class="col-6">
<div class="form-group has-validation">
<label for="admin_user">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('email.admin_user') is-invalid @enderror" id="admin_user" name="email[admin_user]" placeholder="Admin USER" value="{{ old('email.admin_user',$o->admin_user) }}">
<span class="invalid-feedback" role="alert">
@error('email.admin_user')
{{ $message }}
@enderror
</span>
</div>
<span class="input-helper">Admin USER</span>
</div>
<x-leenooks::form.text id="admin_user" name="email[admin_user]" icon="fa-user" label="Admin Username" old="email.admin_user" :value="$o->admin_user"/>
</div>
<!-- ADMIN PASS -->
<div class="col-6">
<div class="form-group has-validation">
<label for="admin_pass">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('email.admin_pass') is-invalid @enderror" id="admin_pass" name="email[admin_pass]" value="{{ old('email.admin_pass',$o->admin_pass) }}">
<span class="invalid-feedback" role="alert">
@error('email.admin_pass')
{{ $message }}
@enderror
</span>
</div>
<span class="input-helper">Admin PASSWORD</span>
</div>
<x-leenooks::form.text id="admin_pass" name="email[admin_pass]" icon="fa-lock" label="Admin Password" :value="$o->admin_pass"/>
</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
//$('#tld_id').select2();
});
</script>
@append
</div>

View File

@ -1,98 +0,0 @@
<!-- o = App\Models\Service\Host::class -->
<div class="row">
<div class="col-12 col-sm-9 col-md-12 col-xl-7">
<div class="form-group">
<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" style="width:55%;" class="form-control text-right @error('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 style="width:25%;" class="form-control @error('tld_id') is-invalid @enderror" id="tld_id" name="host[tld_id]">
@foreach(\App\Models\TLD::orderBy('name')->get() as $oo)
<option value="{{ $oo->id }}" @if($oo->id == old('host.tld_id',$o->tld_id))selected @endif>{{ $oo->name }}</option>
@endforeach
</select>
<span class="invalid-feedback" role="alert">
@error('domain_name')
{{ $message }}
@enderror
@error('tld_id')
{{ $message }}
@enderror
</span>
</div>
</div>
</div>
<div class="col-12 col-sm-9 col-md-6 col-xl-5">
@include('adminlte::widget.form_date',[
'label'=>'Expiry',
'id'=>'expire_at',
'old'=>'host.expire_at',
'name'=>'host[expire_at]',
'value'=>$o->expire_at ? $o->expire_at->format('Y-m-d') : ($o->connect_at ? $o->connect_at->addMonths($o->contract_term)->format('Y-m-d') : ''),
])
</div>
</div>
<hr>
<p class="h6">Hosting Details</p>
<div class="row">
<div class="col-12 col-sm-9 col-md-6 col-xl-5">
@include('adminlte::widget.form_select',[
'label'=>'Hosting Server',
'icon'=>'fas fa-handshake',
'id'=>'supplier_host_server_id',
'old'=>'host.supplier_host_server_id',
'name'=>'host[supplier_host_server_id]',
'options'=>\App\Models\SupplierHostServer::active()->orderBy('name')->get()->transform(function($item) { return ['id'=>$item->id,'value'=>$item->name]; }),
'value'=>$o->supplier_host_server_id ?? '',
])
</div>
</div>
<div class="row">
<div class="col-12 col-sm-9 col-md-12 col-xl-7">
@include('adminlte::widget.form_text',[
'label'=>'Admin User',
'icon'=>'fas fa-user',
'id'=>'host_username',
'old'=>'host.host_username',
'name'=>'host[host_username]',
'value'=>$o->host_username ?? '',
])
</div>
<div class="col-12 col-sm-9 col-md-5 col-xl-5">
@include('adminlte::widget.form_text',[
'label'=>'Admin Password',
'icon'=>'fas fa-lock',
'id'=>'host_password',
'old'=>'host.host_password',
'name'=>'host[host_password]',
'value'=>$o->host_password ?? '',
])
</div>
</div>
@section('page-scripts')
@css(select2)
@js(select2,autofocus)
<script type="text/javascript">
$(document).ready(function() {
$('#tld_id').select2({
dropdownAutoWidth: true,
width: 'style',
});
});
</script>
@append

View File

@ -0,0 +1,44 @@
@use(App\Models\SupplierHostServer)
<!-- o=Service\Host::class -->
<div class="row">
<div class="col-12 col-sm-9 col-md-12 col-xl-7">
<x-form.domain name="hosting" label="Domain Name" :name_value="$o->domain_name" :tld_value="$o->tld_id"/>
</div>
<div class="col-12 col-sm-9 col-md-6 col-xl-5">
<x-leenooks::form.date id="expire_at" name="hosting[expire_at]" icon="fa-calendar" label="Expiry" old="hosting.expire_at" :value="($o->expire_at ?: $o->connect_at?->addMonths($o->contract_term))?->format('Y-m-d')"/>
</div>
</div>
<hr>
<p class="h6">Hosting Details</p>
<div class="row">
<div class="col-12 col-sm-9 col-md-6 col-xl-5">
<x-leenooks::form.select id="supplier_host_server_id" name="hosting[supplier_host_server_id]" icon="fa-handshake" label="Registrar" :value="$o->supplier_host_server_id" :options="SupplierHostServer::active()->orderBy('name')->get()->transform(fn($item)=>['id'=>$item->id,'value'=>$item->name])"/>
</div>
</div>
<div class="row">
<div class="col-12 col-sm-9 col-md-12 col-xl-7">
<x-leenooks::form.text id="host_username" name="hosting[host_username]" icon="fa-user" label="Admin Username" :value="$o->host_username"/>
</div>
<div class="col-12 col-sm-9 col-md-5 col-xl-5">
<x-leenooks::form.text id="host_password" name="hosting[host_password]" icon="fa-lock" label="Admin Password" :value="$o->host_password"/>
</div>
</div>
@pa(select2,autofocus)
@section('page-scripts')
<script type="text/javascript">
$(document).ready(function() {
$('#tld_id').select2({
dropdownAutoWidth: true,
width: 'style',
});
});
</script>
@append