Updates to service updating - phone

This commit is contained in:
Deon George 2022-08-02 08:49:17 +10:00
parent 360182b6bb
commit 06b1eca306
2 changed files with 82 additions and 61 deletions

View File

@ -48,4 +48,23 @@ class Phone extends Type
{
return $value ?: $this->supplied()->technology;
}
/* OVERRIDES */
/**
* Service update validation
*
* @return array
*/
public function validation(): array
{
return [
'service_number' => 'nullable|string|min:10|max:10',
'service_username' => 'nullable|string',
'service_password' => 'nullable|string',
'connect_at' => 'nullable|date',
'start_at' => 'nullable|date',
'expire_at' => 'nullable|date|after:start_at',
];
}
}

View File

@ -1,72 +1,74 @@
<!-- $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>
<!-- $o=Service\Phone::class -->
<div class="row">
<div class="col-12 col-sm-9 col-md-6 col-xl-5">
@include('adminlte::widget.form_text',[
'label'=>'Service Number',
'icon'=>'fas fa-phone',
'id'=>'service_number',
'old'=>'phone.service_number',
'name'=>'phone[service_number]',
'value'=>$o->service_number ?? '',
])
</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 class="row">
<div class="col-12 col-sm-9 col-md-12 col-xl-6">
@include('adminlte::widget.form_text',[
'label'=>'Service Username',
'icon'=>'fas fa-user',
'id'=>'service_username',
'old'=>'phone.service_username',
'name'=>'phone[service_username]',
'value'=>$o->service_username ?? '',
])
</div>
<div class="col-12 col-sm-9 col-md-5 col-xl-6">
@include('adminlte::widget.form_text',[
'label'=>'Service Password',
'icon'=>'fas fa-lock',
'id'=>'service_password',
'old'=>'phone.service_password',
'name'=>'phone[service_password]',
'value'=>$o->service_password ?? '',
])
</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 ?? '' }}">
<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'=>'Connect 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'=>'start_at',
'old'=>'phone.start_at',
'name'=>'phone[start_at]',
'value'=>$o->start_at ? $o->start_at->format('Y-m-d') : ($o->connect_at ? $o->connect_at->format('Y-m-d') : ''),
])
</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 class="row">
<div class="col-12 col-sm-9 col-md-6 col-xl-5">
@include('adminlte::widget.form_date',[
'label'=>'Contract End',
'id'=>'expire_at',
'old'=>'phone.expire_at',
'name'=>'phone[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>