Some service host/domain updates, including schema updates

This commit is contained in:
Deon George 2022-08-02 19:16:52 +10:00
parent 06b1eca306
commit 2bac177618
13 changed files with 283 additions and 340 deletions

View File

@ -228,41 +228,6 @@ class ServiceController extends Controller
} }
} }
/**
* Edit a domain service details
*
* @param Request $request
* @param Service $o
* @return RedirectResponse
* @deprecated - use update()
*/
public function domain_edit(Request $request,Service $o)
{
session()->flash('service_update',TRUE);
$validation = $request->validate([
'service.domain_name' => ['required',function($attribute,$value,$fail) use ($request,$o) {
if (Service\Domain::where('domain_name',$value)
->where('domain_tld_id',Arr::get($request,'service.domain_tld_id'))
->when($o->type,function($q) use ($o) { return $q->where('id','<>',$o->type->id); })
->count() > 0)
{
$fail('Domain already exists.');
}
}],
'service.domain_expire' => 'required|date',
'service.domain_tld_id' => 'required|exists:ab_domain_tld,id',
'service.domain_registrar_id' => 'required|exists:ab_domain_registrar,id',
'service.registrar_account' => 'required',
'service.registrar_username' => 'required|string|min:5',
'service.registrar_ns' => 'required|string|min:5',
]);
$o->type->forceFill($validation['service'])->save();
return redirect()->back()->with('success','Record updated.');
}
/** /**
* List all the domains managed by the user * List all the domains managed by the user
* *

View File

@ -5,12 +5,7 @@ namespace App\Models;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
use Leenooks\Traits\ScopeActive; use Leenooks\Traits\ScopeActive;
/**
* @deprecated
*/
class DomainRegistrar extends Model class DomainRegistrar extends Model
{ {
use ScopeActive; use ScopeActive;
protected $table = 'ab_domain_registrar';
} }

View File

@ -1,35 +0,0 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Leenooks\Traits\ScopeActive;
/**
* @deprecated
*/
class DomainTld extends Model
{
use ScopeActive;
protected $table = 'ab_domain_tld';
/* RELATIONS */
public function services()
{
return $this->hasMany(Service::class);
}
/* ATTRIBUTES */
public function getNameAttribute($value): string
{
return strtoupper($value);
}
public function getPriceGroupAttribute($value): array
{
return unserialize($value);
}
}

View File

@ -1,10 +0,0 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class HostServer extends Model
{
protected $table = 'ab_host_server';
}

View File

@ -16,6 +16,26 @@ class Domain extends Type
protected $table = 'service_domain'; protected $table = 'service_domain';
protected $with = ['tld']; protected $with = ['tld'];
/* OVERRIDES */
/**
* Service update validation
*
* @return array
*/
public function validation(): array
{
return [
'domain_name' => 'nullable|string|min:2',
'tld_id' => 'required|exists:tlds,id',
'expire_at' => 'required|date',
'domain_registrar_id' => 'required|exists:domain_registrars,id',
'registrar_account' => 'nullable|string',
'registrar_ns' => 'nullable|string',
'registrar_username' => 'nullable|string',
];
}
/* RELATIONS */ /* RELATIONS */
public function registrar() public function registrar()

View File

@ -2,7 +2,7 @@
namespace App\Models\Service; namespace App\Models\Service;
use App\Models\HostServer; use App\Models\SupplierHostServer;
use App\Traits\ServiceDomains; use App\Traits\ServiceDomains;
/** /**
@ -20,6 +20,25 @@ class Host extends Type
public function provider() public function provider()
{ {
return $this->belongsTo(HostServer::class,'host_server_id'); return $this->belongsTo(SupplierHostServer::class,'supplier_host_server_id');
}
/* OVERRIDES */
/**
* Service update validation
*
* @return array
*/
public function validation(): array
{
return [
'domain_name' => 'nullable|string|min:2',
'tld_id' => 'required|exists:tlds,id',
'expire_at' => 'required|date',
'supplier_host_server_id' => 'required|exists:supplier_host_servers,id',
'host_username' => 'nullable|string',
'host_password' => 'nullable|string',
];
} }
} }

View File

@ -0,0 +1,11 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Leenooks\Traits\ScopeActive;
class SupplierHostServer extends Model
{
use ScopeActive;
}

View File

@ -20,7 +20,7 @@
"laravel/passport": "^10.1", "laravel/passport": "^10.1",
"laravel/socialite": "^5.2", "laravel/socialite": "^5.2",
"laravel/ui": "^3.2", "laravel/ui": "^3.2",
"leenooks/laravel": "^9.2.2", "leenooks/laravel": "^9.2.3",
"leenooks/laravel-theme": "^v2.0.18", "leenooks/laravel-theme": "^v2.0.18",
"nunomaduro/laravel-console-summary": "^1.8", "nunomaduro/laravel-console-summary": "^1.8",
"paypal/paypal-checkout-sdk": "^1.0", "paypal/paypal-checkout-sdk": "^1.0",

22
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "3306c0a2c799a142669bda57f369316a", "content-hash": "63cb7a16dfcfeae281a7caa276f1c73f",
"packages": [ "packages": [
{ {
"name": "asm89/stack-cors", "name": "asm89/stack-cors",
@ -3295,11 +3295,11 @@
}, },
{ {
"name": "leenooks/laravel", "name": "leenooks/laravel",
"version": "9.2.2", "version": "9.2.3",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://dev.leenooks.net/leenooks/laravel", "url": "https://dev.leenooks.net/leenooks/laravel",
"reference": "2e512cc3edc913e59726a93c248e76705ff44daa" "reference": "8e9ca4c531311da5e329cdf9647ca193915167cf"
}, },
"require": { "require": {
"creativeorange/gravatar": "^1.0", "creativeorange/gravatar": "^1.0",
@ -3338,7 +3338,7 @@
"laravel", "laravel",
"leenooks" "leenooks"
], ],
"time": "2022-08-01T10:29:57+00:00" "time": "2022-08-02T12:34:20+00:00"
}, },
{ {
"name": "leenooks/laravel-theme", "name": "leenooks/laravel-theme",
@ -3885,16 +3885,16 @@
}, },
{ {
"name": "nunomaduro/termwind", "name": "nunomaduro/termwind",
"version": "v1.13.0", "version": "v1.14.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/nunomaduro/termwind.git", "url": "https://github.com/nunomaduro/termwind.git",
"reference": "132a24bd3e8c559e7f14fa14ba1b83772a0f97f8" "reference": "10065367baccf13b6e30f5e9246fa4f63a79eb1d"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/nunomaduro/termwind/zipball/132a24bd3e8c559e7f14fa14ba1b83772a0f97f8", "url": "https://api.github.com/repos/nunomaduro/termwind/zipball/10065367baccf13b6e30f5e9246fa4f63a79eb1d",
"reference": "132a24bd3e8c559e7f14fa14ba1b83772a0f97f8", "reference": "10065367baccf13b6e30f5e9246fa4f63a79eb1d",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -3906,7 +3906,7 @@
"ergebnis/phpstan-rules": "^1.0.", "ergebnis/phpstan-rules": "^1.0.",
"illuminate/console": "^8.0|^9.0", "illuminate/console": "^8.0|^9.0",
"illuminate/support": "^8.0|^9.0", "illuminate/support": "^8.0|^9.0",
"laravel/pint": "^0.2.0", "laravel/pint": "^1.0.0",
"pestphp/pest": "^1.21.0", "pestphp/pest": "^1.21.0",
"pestphp/pest-plugin-mock": "^1.0", "pestphp/pest-plugin-mock": "^1.0",
"phpstan/phpstan": "^1.4.6", "phpstan/phpstan": "^1.4.6",
@ -3951,7 +3951,7 @@
], ],
"support": { "support": {
"issues": "https://github.com/nunomaduro/termwind/issues", "issues": "https://github.com/nunomaduro/termwind/issues",
"source": "https://github.com/nunomaduro/termwind/tree/v1.13.0" "source": "https://github.com/nunomaduro/termwind/tree/v1.14.0"
}, },
"funding": [ "funding": [
{ {
@ -3967,7 +3967,7 @@
"type": "github" "type": "github"
} }
], ],
"time": "2022-07-01T15:06:55+00:00" "time": "2022-08-01T11:03:24+00:00"
}, },
{ {
"name": "nyholm/psr7", "name": "nyholm/psr7",

View File

@ -0,0 +1,70 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
DB::statement('RENAME TABLE ab_domain_registrar TO domain_registrars');
DB::statement('ALTER TABLE domain_registrars MODIFY active tinyint(1) NOT NULL');
Schema::table('domain_registrars', function (Blueprint $table) {
$table->datetime('created_at')->nullable()->after('id');
$table->datetime('updated_at')->nullable()->after('created_at');
$table->dropForeign('ab_domain_registrar_site_id_foreign');
$table->dropIndex('ab_domain_registrar_id_site_id_index');
$table->foreign(['site_id'])->references(['id'])->on('sites');
});
Schema::table('service_domain', function (Blueprint $table) {
$table->foreign(['domain_registrar_id','site_id'])->references(['id','site_id'])->on('domain_registrars');
});
DB::statement('RENAME TABLE ab_host_server TO supplier_host_servers');
DB::statement('ALTER TABLE supplier_host_servers MODIFY active tinyint(1) DEFAULT NULL,MODIFY debug tinyint(1) DEFAULT NULL');
DB::statement('ALTER TABLE supplier_host_servers MODIFY id int unsigned auto_increment,MODIFY site_id int unsigned NOT NULL,MODIFY max_accounts int unsigned DEFAULT NULL');
DB::statement('ALTER TABLE supplier_host_servers MODIFY notes longtext DEFAULT NULL');
Schema::table('supplier_host_servers', function (Blueprint $table) {
$table->datetime('created_at')->nullable()->after('id');
$table->datetime('updated_at')->nullable()->after('created_at');
$table->integer('supplier_id')->unsigned()->nullable();
$table->foreign(['site_id'])->references(['id'])->on('sites');
$table->foreign(['supplier_id'])->references(['id'])->on('suppliers');
});
DB::statement('ALTER TABLE service_host RENAME COLUMN host_server_id TO supplier_host_server_id');
DB::statement('ALTER TABLE service_host MODIFY supplier_host_server_id int unsigned DEFAULT NULL');
Schema::table('service_host', function (Blueprint $table) {
$table->foreign(['supplier_host_server_id','site_id'])->references(['id','site_id'])->on('supplier_host_servers');
});
DB::statement('DROP TABLE ab_domain_tld');
//delete from ab_host_server where id=0;
//alter table service_host modify host_server_id int unsigned default null;
//update service_host set host_server_id=NULL where host_server_id=0
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
abort(500,'Cant go back');
}
};

18
public/css/fixes.css vendored
View File

@ -111,3 +111,21 @@ span.select2-selection.select2-selection--single > span.select2-selection__rende
background-color: #6c757d; background-color: #6c757d;
color: #ffffff; color: #ffffff;
} }
/* Fixes to select2, to make sure col-x widths are honoured */
.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%;
}
/* Render the invalid red when a select container fails validation */
.is-invalid + .select2-container--default .select2-selection--single,
.is-invalid + .select2-container--default .select2-selection--multiple {
border: 1px solid #dc3545;
}

View File

@ -1,145 +1,97 @@
<div class="row"> <div class="row">
<div class="col-6"> <div class="col-12 col-sm-9 col-md-12 col-xl-7">
<div class="form-group has-validation"> <div class="form-group">
<label for="domain_name">Domain Name</label> <label for="domain_name">Domain Name</label>
<div class="input-group"> <div class="input-group">
<div class="input-group-prepend"> <div class="input-group-prepend">
<span class="input-group-text"><i class="fas fa-fw fa-globe-asia"></i></span> <span class="input-group-text"><i class="fas fa-fw fa-globe-asia"></i></span>
</div> </div>
<input type="text" class="form-control text-right @error('domain.domain_name') is-invalid @enderror" id="domain_name" name="domain[domain_name]" placeholder="Domain Name..." value="{{ old('domain.domain_name',$o->domain_name) }}" required> <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"> <div class="input-group-append">
<span class="input-group-text">.</span> <span class="input-group-text">.</span>
</div> </div>
<select class="form-control" id="domain_tld_id" name="domain[domain_tld_id]">
@foreach(\App\Models\DomainTld::active()->orderBy('name')->get() as $oo) <select style="width:25%;" class="form-control @error('tld_id') is-invalid @enderror" id="tld_id" name="domain[tld_id]">
<option value="{{ $oo->id }}" @if($oo->id == old('domain.domain_tld_id',$o->domain_tld_id))selected @endif>{{ $oo->name }}</option> @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 @endforeach
</select> </select>
<span class="invalid-feedback" role="alert"> <span class="invalid-feedback" role="alert">
@error('domain.domain_name') @error('domain_name')
{{ $message }}
@enderror
@error('tld_id')
{{ $message }} {{ $message }}
@else
Domain Name is required.
@enderror @enderror
</span> </span>
</div> </div>
<span class="input-helper">Licensed Domain Name.</span>
</div> </div>
</div> </div>
<div class="col-3"> <div class="col-12 col-sm-9 col-md-6 col-xl-5">
<div class="form-group has-validation"> @include('adminlte::widget.form_date',[
<label for="domain_expire">Expiry</label> 'label'=>'Expiry',
<div class="input-group"> 'id'=>'expire_at',
<div class="input-group-prepend"> 'old'=>'domain.expire_at',
<span class="input-group-text"><i class="fas fa-fw fa-calendar"></i></span> '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') : ''),
])
</div> </div>
<input type="date" class="form-control @error('domain.domain_expire') is-invalid @enderror" id="domain_expire" name="domain[domain_expire]" value="{{ old('domain.domain_expire',$o->service_expire->format('Y-m-d')) }}" required> </div>
<span class="invalid-feedback" role="alert">
@error('domain.domain_expire') <hr>
{{ $message }} <p class="h6">Registrar Details</p>
@else
Domain Expiry is required. <div class="row">
@enderror <div class="col-12 col-sm-9 col-md-6 col-xl-5">
</span> @include('adminlte::widget.form_select',[
</div> 'label'=>'Registrar',
<span class="input-helper">Date Domain Expires.</span> '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 ?? '',
])
</div> </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 ?? '',
])
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-6"> <div class="col-12 col-sm-9 col-md-6 col-xl-5">
<div class="form-group has-validation"> @include('adminlte::widget.form_select',[
<label for="domain_registrar_id">Registrar</label> 'label'=>'DNS Location',
<div class="input-group"> 'icon'=>'fas fa-project-diagram',
<div class="input-group-prepend"> 'id'=>'registrar_ns',
<span class="input-group-text"><i class="fas fa-fw fa-handshake"></i></span> 'old'=>'domain.registrar_ns',
</div> 'name'=>'domain[registrar_ns]',
<select class="form-control @error('domain.domain_registrar_id') is-invalid @enderror" id="domain_registrar_id" name="domain[domain_registrar_id]"> '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]; }),
<option></option> 'value'=>$o->registrar_ns ?? '',
@foreach(\App\Models\DomainRegistrar::active()->orderBy('name')->get() as $oo) 'addvalues'=>TRUE,
<option value="{{ $oo->id }}" @if($oo->id == old('domain.domain_registrar_id',$o->domain_registrar_id))selected @endif>{{ $oo->name }}</option> ])
@endforeach
</select>
<span class="invalid-feedback" role="alert">
@error('domain.domain_registrar_id')
{{ $message }}
@else
Domain Registrar is required.
@enderror
</span>
</div>
<span class="input-helper">Domain Name Registrar.</span>
</div>
</div> </div>
<div class="col-3"> <div class="col-12 col-sm-9 col-md-12 col-xl-6">
<div class="form-group has-validation"> @include('adminlte::widget.form_text',[
<label for="registrar_account">Registrar Account</label> 'label'=>'Registrar Username',
<div class="input-group"> 'icon'=>'fas fa-user',
<div class="input-group-prepend"> 'id'=>'registrar_username',
<span class="input-group-text"><i class="fas fa-fw fa-user"></i></span> 'old'=>'domain.registrar_username',
</div> 'name'=>'domain[registrar_username]',
<input type="text" class="form-control @error('domain.registrar_account') is-invalid @enderror" id="registrar_account" name="domain[registrar_account]" value="{{ old('domain.registrar_account',$o->registrar_account) }}"> 'value'=>$o->registrar_username ?? '',
<span class="invalid-feedback" role="alert"> ])
@error('domain.registrar_account')
{{ $message }}
@else
Registrar Account ID is required.
@enderror
</span>
</div>
<span class="input-helper">Registrar Account ID.</span>
</div>
</div>
</div>
<div class="row">
<div class="col-6">
<div class="form-group has-validation">
<label for="registrar_ns">DNS Location</label>
<div class="input-group flex-nowrap">
<div class="input-group-prepend">
<span class="input-group-text"><i class="fas fa-fw fa-project-diagram"></i></span>
</div>
<select class="form-control @error('domain.registrar_ns') is-invalid @enderror" id="registrar_ns" name="domain[registrar_ns]">
@foreach(\App\Models\Service\Domain::select('registrar_ns')->distinct()->get() as $oo)
<option value="{{ $oo->registrar_ns }}" @if($oo->registrar_ns == old('domain.registrar_ns',$o->registrar_ns))selected @endif>{{ $oo->registrar_ns }}</option>
@endforeach
</select>
<span class="invalid-feedback" role="alert">
@error('domain.registrar_ns')
{{ $message }}
@else
DNS Details is required.
@enderror
</span>
</div>
<span class="input-helper">Domain DNS details.</span>
</div>
</div>
<div class="col-3">
<div class="form-group has-validation">
<label for="registrar_username">Registrar Username</label>
<div class="input-group">
<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('domain.registrar_username') is-invalid @enderror" id="registrar_username" name="domain[registrar_username]" value="{{ old('domain.registrar_username',$o->registrar_username) }}">
<span class="invalid-feedback" role="alert">
@error('domain.registrar_username')
{{ $message }}
@else
Registrar Username is required.
@enderror
</span>
</div>
<span class="input-helper">Registrar Username ID.</span>
</div>
</div> </div>
</div> </div>
@ -147,32 +99,11 @@
@css(select2) @css(select2)
@js(select2,autofocus) @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"> <script type="text/javascript">
$(document).ready(function() { $(document).ready(function() {
// @todo This is taking up too much width $('#tld_id').select2({
//$('#domain_tld_id').select2();
$('#domain_registrar_id').select2({
dropdownAutoWidth: true,
});
$('#registrar_ns').select2({
dropdownAutoWidth: true, dropdownAutoWidth: true,
width: 'style', width: 'style',
tags: true,
}); });
}); });
</script> </script>

View File

@ -1,115 +1,85 @@
<!-- o = App\Models\Service\Host::class --> <!-- o = App\Models\Service\Host::class -->
<div class="row"> <div class="row">
<!-- DOMAIN NAME --> <div class="col-12 col-sm-9 col-md-12 col-xl-7">
<div class="col-6"> <div class="form-group">
<div class="form-group has-validation">
<label for="domain_name">Domain Name</label> <label for="domain_name">Domain Name</label>
<div class="input-group"> <div class="input-group">
<div class="input-group-prepend"> <div class="input-group-prepend">
<span class="input-group-text"><i class="fas fa-fw fa-globe-asia"></i></span> <span class="input-group-text"><i class="fas fa-fw fa-globe-asia"></i></span>
</div> </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> <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('host.domain_name',$o->domain_name) }}" required>
<div class="input-group-append"> <div class="input-group-append">
<span class="input-group-text">.</span> <span class="input-group-text">.</span>
</div> </div>
<select class="form-control" id="domain_tld_id" name="host[domain_tld_id]">
@foreach(\App\Models\DomainTld::active()->orderBy('name')->get() as $oo) <select style="width:25%;" class="form-control @error('tld_id') is-invalid @enderror" id="tld_id" name="host[tld_id]">
<option value="{{ $oo->id }}" @if($oo->id == old('domain.domain_tld_id',$o->domain_tld_id))selected @endif>{{ $oo->name }}</option> @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 @endforeach
</select> </select>
<span class="invalid-feedback" role="alert"> <span class="invalid-feedback" role="alert">
@error('host.domain_name') @error('domain_name')
{{ $message }}
@enderror
@error('tld_id')
{{ $message }} {{ $message }}
@else
Domain Name is required.
@enderror @enderror
</span> </span>
</div> </div>
<span class="input-helper">Domain Name</span>
</div> </div>
</div> </div>
<!-- EXPIRY --> <div class="col-12 col-sm-9 col-md-6 col-xl-5">
<div class="col-3"> @include('adminlte::widget.form_date',[
<div class="form-group has-validation"> 'label'=>'Expiry',
<label for="host_expire">Expiry</label> 'id'=>'expire_at',
<div class="input-group"> 'old'=>'host.expire_at',
<div class="input-group-prepend"> 'name'=>'host[expire_at]',
<span class="input-group-text"><i class="fas fa-fw fa-calendar"></i></span> '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> ])
<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>
<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> </div>
<div class="row"> <div class="row">
{{-- <div class="col-12 col-sm-9 col-md-12 col-xl-7">
<!-- ADMIN URL --> @include('adminlte::widget.form_text',[
<div class="col-9"> 'label'=>'Admin User',
<div class="form-group has-validation"> 'icon'=>'fas fa-user',
<label for="admin_url">Hosting Admin URL</label> 'id'=>'host_username',
<div class="input-group"> 'old'=>'host.host_username',
<div class="input-group-prepend"> 'name'=>'host[host_username]',
<span class="input-group-text"><i class="fab fa-fw fa-safari"></i></span> 'value'=>$o->host_username ?? '',
</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> </div>
<!-- ADMIN PASS --> <div class="col-12 col-sm-9 col-md-5 col-xl-5">
<div class="col-6"> @include('adminlte::widget.form_text',[
<div class="form-group has-validation"> 'label'=>'Admin Password',
<label for="host_password">Admin Pass</label> 'icon'=>'fas fa-lock',
<div class="input-group"> 'id'=>'host_password',
<div class="input-group-prepend"> 'old'=>'host.host_password',
<span class="input-group-text"><i class="fas fa-fw fa-lock"></i></span> 'name'=>'host[host_password]',
</div> 'value'=>$o->host_password ?? '',
<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>
</div> </div>
@ -117,23 +87,12 @@
@css(select2) @css(select2)
@js(select2,autofocus) @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"> <script type="text/javascript">
$(document).ready(function() { $(document).ready(function() {
// @todo This is taking up too much width $('#tld_id').select2({
//$('#domain_tld_id').select2(); dropdownAutoWidth: true,
width: 'style',
});
}); });
</script> </script>
@append @append