Move charge to under service
This commit is contained in:
@@ -29,17 +29,20 @@
|
||||
<div class="card-header bg-dark d-flex p-0">
|
||||
<ul class="nav nav-pills w-100 p-2">
|
||||
@if($x=! ($o->suspend_billing || $o->external_billing))
|
||||
<li class="nav-item"><a @class(['nav-link','active'=>! session()->has('service_update')]) href="#pending_items" data-toggle="tab">Pending Items</a></li>
|
||||
<li class="nav-item"><a @class(['nav-link','active'=>! (session()->has('service_update') || session()->has('charge_add'))]) href="#pending_items" data-toggle="tab">Pending Items</a></li>
|
||||
@endif
|
||||
|
||||
@if($o->product->hasUsage())
|
||||
<li class="nav-item"><a @class(['nav-link','active'=>! ($x || session()->has('service_update'))]) href="#traffic" data-toggle="tab">Traffic</a></li>
|
||||
<li class="nav-item"><a @class(['nav-link','active'=>! ($x || (session()->has('service_update') || session()->has('charge_add')))]) href="#traffic" data-toggle="tab">Traffic</a></li>
|
||||
@endif
|
||||
|
||||
@can('wholesaler')
|
||||
<li class="nav-item ml-auto"><a class="nav-link" href="#billing" data-toggle="tab">Billing History</a></li>
|
||||
<li class="nav-item"><a class="nav-link" href="#internal" data-toggle="tab">Internal</a></li>
|
||||
<li class="nav-item"><a @class(['nav-link','active'=>session()->has('service_update')]) href="#update" data-toggle="tab">Update</a></li>
|
||||
@if($o->active || $o->isPending())
|
||||
<li class="nav-item"><a @class(['nav-link','active'=>session()->has('charge_add')]) href="#charge" data-toggle="tab">Charge</a></li>
|
||||
@endif
|
||||
@endcan
|
||||
</ul>
|
||||
|
||||
@@ -59,16 +62,16 @@
|
||||
@endcan
|
||||
</div>
|
||||
|
||||
<div class="card-body">
|
||||
<div class="card-body pt-2 pl-2 pr-2 pb-0">
|
||||
<div class="tab-content">
|
||||
@if($x=! ($o->suspend_billing || $o->external_billing))
|
||||
<div @class(['tab-pane','fade','show active'=>! session()->has('service_update')]) id="pending_items">
|
||||
<div @class(['tab-pane','fade','show active'=>! (session()->has('service_update') || session()->has('charge_add'))]) id="pending_items">
|
||||
@include('theme.backend.adminlte.service.widget.invoice')
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@if($o->product->hasUsage())
|
||||
<div @class(['tab-pane','fade','show active'=>! ($x || session()->has('service_update'))]) id="traffic">
|
||||
<div @class(['tab-pane','fade','show active'=>! ($x || (session()->has('service_update') || session()->has('charge_add')))]) id="traffic">
|
||||
@if($o->type->usage(30)->count())
|
||||
@include('theme.backend.adminlte.service.widget.'.$o->product->category.'.usagegraph',['o'=>$o->type])
|
||||
@endif
|
||||
@@ -88,9 +91,15 @@
|
||||
@endif
|
||||
</div>
|
||||
|
||||
<div @class(['tab-pane','fade','show active'=>session()->pull('service_update')]) id="update">
|
||||
<div @class(['tab-pane','fade','show active'=>session()->pull('service_update'),'p-2']) id="update">
|
||||
@include('theme.backend.adminlte.service.widget.update')
|
||||
</div>
|
||||
|
||||
@if($o->active || $o->isPending())
|
||||
<div @class(['tab-pane','fade','show active'=>session()->pull('charge_add')]) id="charge">
|
||||
@include('theme.backend.adminlte.service.widget.charge')
|
||||
</div>
|
||||
@endif
|
||||
@endcan
|
||||
</div>
|
||||
</div>
|
||||
|
@@ -0,0 +1,102 @@
|
||||
@use(App\Models\Charge)
|
||||
|
||||
<div class="card card-secondary card-outline card-outline-tabs">
|
||||
<div class="card-header p-0 border-bottom-0">
|
||||
<ul class="nav nav-tabs">
|
||||
<li class="nav-item"><a class="nav-link active" href="#charge_add" data-toggle="tab">Charge</a></li>
|
||||
<li class="nav-item"><a class="nav-link" href="#charge_pending" data-toggle="tab">Pending</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="card-body">
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane fade show active" id="charge_add">
|
||||
@include('theme.backend.adminlte.charge.widget.addedit',['o'=>NULL,'so'=>$o])
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="charge_pending">
|
||||
<table class="table table-sm" id="svc_bill_hist">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>Created</th>
|
||||
<th>Charge</th>
|
||||
<th>Type</th>
|
||||
<th class="text-right">Q</th>
|
||||
<th class="text-right">Total</th>
|
||||
<th>Processed</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
@forelse(Charge::where('service_id',$o->id)->active()->orderBy('charge_at','DESC')->with(['account'])->get() as $oo)
|
||||
<tr>
|
||||
<td>{{ $oo->id }}</td>
|
||||
<td>{{ $oo->created_at->format('Y-m-d') }}</td>
|
||||
<td>{{ $oo->charge_at?->format('Y-m-d') }}</td>
|
||||
<td>{{ $oo->type_name }}</td>
|
||||
<td class="text-right">{{ number_format($oo->quantity) }}</td>
|
||||
<td class="text-right">{{ number_format($oo->total,2) }}</td>
|
||||
<td>
|
||||
{{ $oo->processed ? 'YES' : 'NO' }}
|
||||
@if(! $oo->processed)
|
||||
<span class="float-right">
|
||||
<a class="charge_edit" id="{{ $oo->id }}" href="#"><i class="fas fa-fw fa-edit"></i></a>
|
||||
<a class="charge_delete" id="{{ $oo->id }}" href="#"><i class="fas fa-fw fa-trash"></i></a>
|
||||
</span>
|
||||
@endif
|
||||
</td>
|
||||
</tr>
|
||||
@empty
|
||||
<tr>
|
||||
<td colspan="7">No Charges for this Service</td>
|
||||
</tr>
|
||||
@endforelse
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<x-leenooks::modal.delete trigger="charge_delete"/>
|
||||
|
||||
@section('page-scripts')
|
||||
<script type="text/javascript">
|
||||
function total() {
|
||||
$('#total').val(($('#quantity').val()*$('#amount').val()).toFixed(2));
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
var loaded = [];
|
||||
|
||||
$('.charge_edit').on('click',function(item) {
|
||||
// Open our charge add tab automatically
|
||||
$('.nav-item a[href="#charge_add"]').tab('show');
|
||||
|
||||
if (loaded[item.currentTarget.id])
|
||||
return false;
|
||||
|
||||
console.log(item.currentTarget.id);
|
||||
// Prepopulate with the details of the charge
|
||||
$.ajax({
|
||||
url: '{{ url('r/charge/edit') }}',
|
||||
method: 'POST',
|
||||
data: { id: item.currentTarget.id },
|
||||
dataType: 'html',
|
||||
|
||||
}).done(function(html) {
|
||||
$('div[id="charge_add"]').empty().append(html);
|
||||
loaded[item.currentTarget.id] = true;
|
||||
|
||||
}).fail(function() {
|
||||
alert('Failed');
|
||||
});
|
||||
|
||||
return false;
|
||||
});
|
||||
});
|
||||
|
||||
//<a href="{{ url('/api/charge/delete',$o->id) }}">
|
||||
</script>
|
||||
@append
|
Reference in New Issue
Block a user