Update service update to use components, enhanced form handling and submission. Added pppoe to broadband and changed validation to allow for longer service number.
This commit is contained in:
@@ -1,49 +1,28 @@
|
||||
<!-- $o=Service\Broadband::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'=>'broadband.service_number',
|
||||
'name'=>'broadband[service_number]',
|
||||
'value'=>$o->service_number ?? '',
|
||||
])
|
||||
<x-leenooks::form.text id="service_number" name="broadband[service_number]" icon="fa-phone" label="Service Number" old="broadband.service_number" :value="$o->service_number"/>
|
||||
</div>
|
||||
|
||||
<div class="col-12 col-sm-9 col-md-6 col-xl-7">
|
||||
@include('adminlte::widget.form_text',[
|
||||
'label'=>'Service Address',
|
||||
'icon'=>'fas fa-map',
|
||||
'id'=>'service_address',
|
||||
'old'=>'broadband.service_address',
|
||||
'name'=>'broadband[service_address]',
|
||||
'value'=>$o->service_address ?? '',
|
||||
])
|
||||
<x-leenooks::form.text id="service_address" name="broadband[service_address]" icon="fa-map" label="Service Address" old="broadband.service_address" :value="$o->service_address"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
Connection Type
|
||||
<x-leenooks::form.toggle id="pppoe" name="broadband[pppoe]" label="PPPoE" old="broadband.pppoe" :value="$o->pppoe"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12 col-sm-9 col-md-12 col-xl-7">
|
||||
@include('adminlte::widget.form_text',[
|
||||
'label'=>'Service Username',
|
||||
'icon'=>'fas fa-user',
|
||||
'id'=>'service_username',
|
||||
'old'=>'broadband.service_username',
|
||||
'name'=>'broadband[service_username]',
|
||||
'value'=>$o->service_username ?? '',
|
||||
])
|
||||
<x-leenooks::form.text id="service_username" name="broadband[service_username]" icon="fa-user" label="Service Username" old="broadband.service_username" :value="$o->service_username"/>
|
||||
</div>
|
||||
|
||||
<div class="col-12 col-sm-9 col-md-5 col-xl-5">
|
||||
@include('adminlte::widget.form_text',[
|
||||
'label'=>'Service Password',
|
||||
'icon'=>'fas fa-lock',
|
||||
'id'=>'service_password',
|
||||
'old'=>'broadband.service_password',
|
||||
'name'=>'broadband[service_password]',
|
||||
'value'=>$o->service_password ?? '',
|
||||
])
|
||||
<x-leenooks::form.text id="service_password" name="broadband[service_password]" icon="fa-lock" label="Service Password" old="broadband.service_password" :value="$o->service_password"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -52,25 +31,11 @@
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12 col-sm-9 col-md-6 col-xl-5">
|
||||
@include('adminlte::widget.form_date',[
|
||||
'label'=>'Connect Date',
|
||||
'icon'=>'fas fa-calendar',
|
||||
'id'=>'connect_at',
|
||||
'old'=>'broadband.connect_at',
|
||||
'name'=>'broadband[connect_at]',
|
||||
'value'=>$o->connect_at ? $o->connect_at->format('Y-m-d') : '',
|
||||
])
|
||||
<x-leenooks::form.date id="connect_at" name="broadband[connect_at]" icon="fa-calendar" label="Connect Date" old="broadband.connect_at" :value="$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'=>'Contract End',
|
||||
'icon'=>'fas fa-calendar',
|
||||
'id'=>'expire_at',
|
||||
'old'=>'broadband.expire_at',
|
||||
'name'=>'broadband[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="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'))"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -78,26 +43,39 @@
|
||||
<p class="h6">IP Address</p>
|
||||
<div class="row">
|
||||
<div class="col-12 col-lg-5">
|
||||
@include('adminlte::widget.form_text',[
|
||||
'label'=>'IPv4 Address',
|
||||
'icon'=>'fas fa-map-marker',
|
||||
'id'=>'ipaddress',
|
||||
'old'=>'broadband.ipaddress',
|
||||
'name'=>'broadband[ipaddress]',
|
||||
'value'=>$o->ipaddress ?? '',
|
||||
])
|
||||
<x-leenooks::form.text id="ipaddress" name="broadband[ipaddress]" icon="fa-map-marker" label="IPv4 Address" old="broadband.ipaddress" :value="$o->ipaddress"/>
|
||||
</div>
|
||||
|
||||
<div class="col-12 col-lg-7">
|
||||
<div class="form-group">
|
||||
@include('adminlte::widget.form_text',[
|
||||
'label'=>'IPv6 Address',
|
||||
'icon'=>'fas fa-map-marker-alt',
|
||||
'id'=>'ip6address',
|
||||
'old'=>'broadband.ip6address',
|
||||
'name'=>'broadband[ip6address]',
|
||||
'value'=>$o->ip6address ?? '',
|
||||
])
|
||||
<x-leenooks::form.text id="ip6address" name="broadband[ip6address]" icon="fa-map-marker-alt" label="IPv6 Address" :value="$o->ip6address"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@section('page-scripts')
|
||||
<script type="text/javascript">
|
||||
function toggle_pppoe(item) {
|
||||
if (item.is(':checked')) {
|
||||
$('#service_username').closest('.form-group').parent().removeClass('d-none');
|
||||
$('#service_password').closest('.form-group').parent().removeClass('d-none');
|
||||
|
||||
item.closest('.form-group').removeClass('mb-0');
|
||||
|
||||
} else {
|
||||
$('#service_username').closest('.form-group').parent().addClass('d-none');
|
||||
$('#service_password').closest('.form-group').parent().addClass('d-none');
|
||||
|
||||
item.closest('.form-group').addClass('mb-0');
|
||||
}
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
toggle_pppoe($('#pppoe'));
|
||||
|
||||
$('#pppoe').on('click',function(item) {
|
||||
toggle_pppoe($(this));
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@append
|
@@ -1,56 +1,30 @@
|
||||
<!-- $o=Service::class -->
|
||||
@use(App\Models\Invoice)
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<h4>Update Service details</h4>
|
||||
|
||||
<form class="g-0 needs-validation" method="POST" action="{{ url('a/service/update',[$o->id]) }}">
|
||||
@include('adminlte::widget.success')
|
||||
<h4>Update Service details <x-leenooks::button.success class="float-right"/></h4>
|
||||
<hr>
|
||||
|
||||
<form method="POST" action="{{ url('a/service/update',[$o->id]) }}">
|
||||
@csrf
|
||||
|
||||
<div class="row">
|
||||
<!-- External Billing -->
|
||||
<div class="col-2">
|
||||
@include('adminlte::widget.form_toggle',[
|
||||
'label'=>'External Billing',
|
||||
'id'=>'external_billing',
|
||||
'old'=>'external_billing',
|
||||
'name'=>'external_billing',
|
||||
'value'=>$o->external_billing ?? '',
|
||||
])
|
||||
|
||||
<!-- Suspend Billing -->
|
||||
@include('adminlte::widget.form_toggle',[
|
||||
'label'=>'Suspend Billing',
|
||||
'id'=>'suspend_billing',
|
||||
'old'=>'suspend_billing',
|
||||
'name'=>'suspend_billing',
|
||||
'value'=>$o->suspend_billing ?? '',
|
||||
])
|
||||
<x-leenooks::form.toggle id="external_billing" name="external_billing" label="External Billing" :value="$o->external_billing"/>
|
||||
<x-leenooks::form.toggle id="suspend_billing" name="suspend_billing" label="Suspend Billing" :value="$o->suspend_billing"/>
|
||||
</div>
|
||||
|
||||
<div class="col-1"></div>
|
||||
|
||||
<div class="col-12 col-sm-9 col-md-6 col-xl-5">
|
||||
@include('adminlte::widget.form_date',[
|
||||
'label'=>'Billing Start Date',
|
||||
'icon'=>'fas fa-calendar',
|
||||
'id'=>'invoice_next_at',
|
||||
'old'=>'invoice_next_at',
|
||||
'name'=>'invoice_next_at',
|
||||
'value'=>$o->invoice_next_at ? $o->invoice_next_at->format('Y-m-d') : ($o->connect_at ? $o->connect_at->format('Y-m-d') : ''),
|
||||
])
|
||||
<x-leenooks::form.date id="invoice_next_at" name="invoice_next_at" icon="fa-calendar" label="Billing Start Date" :value="($o->invoice_next_at ?: $o->connect_at)?->format('Y-m-d')"/>
|
||||
</div>
|
||||
|
||||
<!-- Price -->
|
||||
<div class="col-12 col-sm-9 col-md-12 col-xl-3">
|
||||
@include('adminlte::widget.form_text',[
|
||||
'label'=>'Price',
|
||||
'icon'=>'fas fa-dollar-sign',
|
||||
'id'=>'price',
|
||||
'old'=>'price',
|
||||
'name'=>'price',
|
||||
'value'=>$o->price ?? '',
|
||||
])
|
||||
<x-leenooks::form.text name="price" icon="fa-dollar-sign" label="Price" :value="$o->price"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -58,15 +32,7 @@
|
||||
<div class="col-3"></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-redo',
|
||||
'id'=>'recur_schedule',
|
||||
'old'=>'recur_schedule',
|
||||
'name'=>'recur_schedule',
|
||||
'options'=>collect(\App\Models\Invoice::billing_periods)->transform(function($item,$key) { return ['id'=>$key,'value'=>$item['name']]; }),
|
||||
'value'=>$o->recur_schedule ?? '',
|
||||
])
|
||||
<x-leenooks::form.select id="recur_schedule" name="recur_schedule" icon="fa-redo" label="Renew Term" :value="$o->recur_schedule" :options="collect(Invoice::billing_periods)->map(fn($item,$key)=>['id'=>$key,'value'=>$item['name']])"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -75,12 +41,64 @@
|
||||
@includeIf('theme.backend.adminlte.service.widget.'.$o->product->category.'.update',['o'=>$o->type])
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="col">
|
||||
@can('wholesaler')
|
||||
<button type="submit" name="submit" class="btn btn-success mr-0 float-right">@if ($site->exists)Save @else Add @endif</button>
|
||||
<x-leenooks::button.reset/>
|
||||
<x-leenooks::button.submit class="float-right">Save</x-leenooks::button.submit>
|
||||
@endcan
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@section('page-scripts')
|
||||
<script type="text/javascript">
|
||||
function toggle_billing_external(item) {
|
||||
if (item.is(':checked')) {
|
||||
$('#suspend_billing').closest('.form-group').addClass('d-none');
|
||||
$('#invoice_next_at').closest('.form-group').parent().addClass('d-none');
|
||||
$('#price').closest('.form-group').parent().addClass('d-none');
|
||||
$('#recur_schedule').closest('.form-group').parent().addClass('d-none');
|
||||
|
||||
item.closest('.form-group').addClass('mb-0');
|
||||
|
||||
} else {
|
||||
$('#suspend_billing').closest('.form-group').removeClass('d-none');
|
||||
$('#invoice_next_at').closest('.form-group').parent().removeClass('d-none');
|
||||
$('#price').closest('.form-group').parent().removeClass('d-none');
|
||||
$('#recur_schedule').closest('.form-group').parent().removeClass('d-none');
|
||||
|
||||
item.closest('.form-group').removeClass('mb-0');
|
||||
}
|
||||
}
|
||||
|
||||
function toggle_billing_suspend(item) {
|
||||
if (item.is(':checked')) {
|
||||
$('#invoice_next_at').prop('readonly',true);
|
||||
$('#price').prop('readonly',true);
|
||||
|
||||
recur_schedule_readonly(true);
|
||||
|
||||
} else {
|
||||
$('#invoice_next_at').prop('readonly',false);
|
||||
$('#price').prop('readonly',false);
|
||||
|
||||
recur_schedule_readonly(false);
|
||||
}
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
toggle_billing_external($('#external_billing'));
|
||||
toggle_billing_suspend($('#suspend_billing'));
|
||||
|
||||
$('#external_billing').on('click',function(item) {
|
||||
toggle_billing_external($(this));
|
||||
});
|
||||
|
||||
$('#suspend_billing').on('click',function(item) {
|
||||
toggle_billing_suspend($(this));
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@append
|
Reference in New Issue
Block a user