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,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