Enable creation of domains and domain service editing
This commit is contained in:
parent
0b4e3a9341
commit
c96d264c8f
@ -108,6 +108,7 @@ class OrderController extends Controller
|
|||||||
$so->ordered_by = Auth::id();
|
$so->ordered_by = Auth::id();
|
||||||
$so->active = FALSE;
|
$so->active = FALSE;
|
||||||
$so->model = $order ? get_class($order) : NULL;
|
$so->model = $order ? get_class($order) : NULL;
|
||||||
|
$so->recur_schedule = $po->price_recur_default;
|
||||||
|
|
||||||
if ($order && $order->order_info) {
|
if ($order && $order->order_info) {
|
||||||
$so->order_info = $order->order_info;
|
$so->order_info = $order->order_info;
|
||||||
|
@ -28,6 +28,14 @@ class ProductController extends Controller
|
|||||||
->sortBy('name')
|
->sortBy('name')
|
||||||
->values();
|
->values();
|
||||||
|
|
||||||
|
case 'App\Models\Product\Domain':
|
||||||
|
return Product\Domain::select(['id','supplier_item_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();
|
||||||
|
|
||||||
case 'App\Models\Product\Email':
|
case 'App\Models\Product\Email':
|
||||||
return Product\Email::select(['id','supplier_item_id'])
|
return Product\Email::select(['id','supplier_item_id'])
|
||||||
->with(['supplied.supplier_detail.supplier'])
|
->with(['supplied.supplier_detail.supplier'])
|
||||||
|
@ -415,10 +415,12 @@ class ServiceController extends Controller
|
|||||||
|
|
||||||
$o->type->save();
|
$o->type->save();
|
||||||
|
|
||||||
// @todo create a validator for service
|
|
||||||
if ($request->post('invoice_next_at'))
|
if ($request->post('invoice_next_at'))
|
||||||
$o->invoice_next_at = $request->invoice_next_at;
|
$o->invoice_next_at = $request->invoice_next_at;
|
||||||
|
|
||||||
|
if ($request->post('recur_schedule'))
|
||||||
|
$o->recur_schedule = $request->recur_schedule;
|
||||||
|
|
||||||
// Also update our service start_at date.
|
// Also update our service start_at date.
|
||||||
// @todo We may want to make start_at/stop_at dynamic values calculated by the type records
|
// @todo We may want to make start_at/stop_at dynamic values calculated by the type records
|
||||||
if ($request->post('start_at'))
|
if ($request->post('start_at'))
|
||||||
|
@ -32,7 +32,7 @@ class ProductAddEdit extends FormRequest
|
|||||||
'active' => 'sometimes|accepted',
|
'active' => 'sometimes|accepted',
|
||||||
'model' => 'sometimes|string', // @todo Check that it is a valid model type
|
'model' => 'sometimes|string', // @todo Check that it is a valid model type
|
||||||
'model_id' => 'sometimes|int', // @todo Check that it is a valid model type
|
'model_id' => 'sometimes|int', // @todo Check that it is a valid model type
|
||||||
'accounting' => 'sometimes|string',
|
'accounting' => 'nullable|string',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -12,6 +12,22 @@ final class Domain extends Type implements ProductItem
|
|||||||
{
|
{
|
||||||
protected $table = 'product_domain';
|
protected $table = 'product_domain';
|
||||||
|
|
||||||
|
// Information required during the order process
|
||||||
|
protected array $order_attributes = [
|
||||||
|
'options.domain'=>[
|
||||||
|
'request'=>'options.domain',
|
||||||
|
'key'=>'domain_name',
|
||||||
|
'validation'=>'required|min:3',
|
||||||
|
'validation_message'=>'Domain Name is a required field.',
|
||||||
|
],
|
||||||
|
'options.tld_id'=>[
|
||||||
|
'request'=>'options.tld_id',
|
||||||
|
'key'=>'tld_id',
|
||||||
|
'validation'=>'required|exists:tlds,id',
|
||||||
|
'validation_message'=>'Domain TLD is a required field.',
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
// The model that is referenced when this product is ordered
|
// The model that is referenced when this product is ordered
|
||||||
protected string $order_model = ServiceDomain::class;
|
protected string $order_model = ServiceDomain::class;
|
||||||
|
|
||||||
|
@ -800,7 +800,7 @@ class Service extends Model implements IDs
|
|||||||
*/
|
*/
|
||||||
public function getNameDetailAttribute()
|
public function getNameDetailAttribute()
|
||||||
{
|
{
|
||||||
return ($this->type && $this->type->getServiceDescriptionAttribute()) ? $this->type->getServiceDescriptionAttribute() : 'No Description';
|
return ($this->type && ($this->type->getServiceDescriptionAttribute() !== NULL)) ? $this->type->getServiceDescriptionAttribute() : 'No Description';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -28,11 +28,14 @@ class Domain extends Type
|
|||||||
return [
|
return [
|
||||||
'domain_name' => 'nullable|string|min:2',
|
'domain_name' => 'nullable|string|min:2',
|
||||||
'tld_id' => 'required|exists:tlds,id',
|
'tld_id' => 'required|exists:tlds,id',
|
||||||
'expire_at' => 'required|date',
|
|
||||||
'domain_registrar_id' => 'required|exists:domain_registrars,id',
|
'domain_registrar_id' => 'required|exists:domain_registrars,id',
|
||||||
'registrar_account' => 'nullable|string',
|
'registrar_account' => 'nullable|string',
|
||||||
'registrar_ns' => 'nullable|string',
|
'registrar_ns' => 'nullable|string',
|
||||||
'registrar_username' => 'nullable|string',
|
'registrar_username' => 'nullable|string',
|
||||||
|
'connect_at' => 'nullable|date',
|
||||||
|
'start_at' => 'nullable|date',
|
||||||
|
'expire_at' => 'nullable|date|after:start_at',
|
||||||
|
'recur_schedule' => 'nullable|int', // @todo insure value is at least 1 yr and not higher than Invoice::billing_periods
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1,28 @@
|
|||||||
|
<?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('ALTER TABLE service_domain MODIFY domain_registrar_id INT UNSIGNED DEFAULT NULL');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
DB::statement('ALTER TABLE service_domain MODIFY domain_registrar_id INT UNSIGNED NOT NULL');
|
||||||
|
}
|
||||||
|
};
|
@ -18,22 +18,24 @@
|
|||||||
<th>Domain Name</th>
|
<th>Domain Name</th>
|
||||||
<td>{{ $o->service->name }}</td>
|
<td>{{ $o->service->name }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
@if($o->registrar)
|
||||||
<th>Registrar URL</th>
|
<tr>
|
||||||
<td><a href="{{ $o->registrar->whitelabel_url }}" target="_blank" class="text-white">{{ $o->registrar->whitelabel_url }}</a></td>
|
<th>Registrar URL</th>
|
||||||
</tr>
|
<td><a href="{{ $o->registrar->whitelabel_url }}" target="_blank" class="text-white">{{ $o->registrar->whitelabel_url }}</a></td>
|
||||||
<tr>
|
</tr>
|
||||||
<th>Registrar Username</th>
|
<tr>
|
||||||
<td>{{ $o->registrar_username }}</td>
|
<th>Registrar Username</th>
|
||||||
</tr>
|
<td>{{ $o->registrar_username }}</td>
|
||||||
<tr>
|
</tr>
|
||||||
<th>Registrar Password</th>
|
<tr>
|
||||||
<td>{{ $o->registrar_password }}</td>
|
<th>Registrar Password</th>
|
||||||
</tr>
|
<td>{{ $o->registrar_password }}</td>
|
||||||
<tr>
|
</tr>
|
||||||
<th>Domain Auth</th>
|
<tr>
|
||||||
<td>{{ $o->registrar_auth_password }}</td>
|
<th>Domain Auth</th>
|
||||||
</tr>
|
<td>{{ $o->registrar_auth_password }}</td>
|
||||||
|
</tr>
|
||||||
|
@endif
|
||||||
@if($o->service_connect_date)
|
@if($o->service_connect_date)
|
||||||
<tr>
|
<tr>
|
||||||
<th>Connected</th>
|
<th>Connected</th>
|
||||||
@ -41,10 +43,12 @@
|
|||||||
</tr>
|
</tr>
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
<tr>
|
@if ($o->active)
|
||||||
<th>Expires</th>
|
<tr>
|
||||||
<td>{{ $o->expire_at->format('Y-m-d') }} <small>({{ $o->expire_at->diffInMonths() }} months) </small></td>
|
<th>Expires</th>
|
||||||
</tr>
|
<td>{{ $o->expire_at->format('Y-m-d') }} <small>({{ $o->expire_at->diffInMonths() }} months) </small></td>
|
||||||
|
</tr>
|
||||||
|
@endif
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
@ -95,6 +95,43 @@
|
|||||||
</div>
|
</div>
|
||||||
</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',
|
||||||
|
'id'=>'connect_at',
|
||||||
|
'old'=>'phone.connect_at',
|
||||||
|
'name'=>'phone[connect_at]',
|
||||||
|
'value'=>$o->connect_at ? $o->connect_at->format('Y-m-d') : '',
|
||||||
|
])
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-12 col-sm-9 col-md-6 col-xl-5">
|
||||||
|
@include('adminlte::widget.form_date',[
|
||||||
|
'label'=>'Billing Start Date',
|
||||||
|
'id'=>'invoice_next_at',
|
||||||
|
'old'=>'invoice_next_at',
|
||||||
|
'name'=>'invoice_next_at',
|
||||||
|
'value'=>$o->service->invoice_next_at ? $o->service->invoice_next_at->format('Y-m-d') : ($o->connect_at ? $o->connect_at->format('Y-m-d') : ''),
|
||||||
|
])
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-12 col-sm-9 col-md-6 col-xl-5">
|
||||||
|
@include('adminlte::widget.form_select',[
|
||||||
|
'label'=>'Renew Term',
|
||||||
|
'icon'=>'fas fa-calendar',
|
||||||
|
'id'=>'recur_schedule',
|
||||||
|
'old'=>'recur_schedule',
|
||||||
|
'name'=>'recur_schedule',
|
||||||
|
'options'=>collect(\App\Models\Invoice::billing_periods)->filter(function ($item) { return $item['interval'] >= 12; })->transform(function($item,$key) { return ['id'=>$key,'value'=>$item['name']]; }),
|
||||||
|
'value'=>$o->service->recur_schedule ?? '',
|
||||||
|
])
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
@section('page-scripts')
|
@section('page-scripts')
|
||||||
@css(select2)
|
@css(select2)
|
||||||
@js(select2,autofocus)
|
@js(select2,autofocus)
|
||||||
|
@ -43,7 +43,7 @@
|
|||||||
@if (($o->active OR $o->isPending()) AND ! $o->external_billing)
|
@if (($o->active OR $o->isPending()) AND ! $o->external_billing)
|
||||||
<tr>
|
<tr>
|
||||||
<th>Billed</th>
|
<th>Billed</th>
|
||||||
<td>{{ $o->billing_period }}</td>
|
<td>{{ $o->billing_interval_string }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
@if($o->active AND $o->invoice_to)
|
@if($o->active AND $o->invoice_to)
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -0,0 +1,19 @@
|
|||||||
|
<fieldset class="form-group">
|
||||||
|
<label class="col-md-12">DOMAIN</label>
|
||||||
|
|
||||||
|
<div class="form-group col-sm-6 {{ $errors->has('options.domain') ? 'has-error' : '' }}">
|
||||||
|
<label for="options.domain">Domain Name</label>
|
||||||
|
<input type="text" class="form-control" id="options.domain" name="options[domain]" placeholder="Domain Name" value="{{ old('options.domain') }}">
|
||||||
|
<span class="help-block">{{ $errors->first('options.domain') }}</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group col-sm-6 {{ $errors->has('options.tld_id') ? 'has-error' : '' }}">
|
||||||
|
<label for="options.tld_id">Domain TLD</label>
|
||||||
|
<select style="width:25%;" class="form-control @error('options.tld_id') is-invalid @enderror" id="options.tld_id" name="options[tld_id]">
|
||||||
|
@foreach(\App\Models\TLD::orderBy('name')->get() as $oo)
|
||||||
|
<option value="{{ $oo->id }}" @if($oo->id == old('options.tld_id',$o->tld_id))selected @endif>{{ $oo->name }}</option>
|
||||||
|
@endforeach
|
||||||
|
</select>
|
||||||
|
<span class="help-block">{{ $errors->first('options.tld') }}</span>
|
||||||
|
</div>
|
||||||
|
</fieldset>
|
Loading…
Reference in New Issue
Block a user