Changed service movements rendering

This commit is contained in:
Deon George
2020-04-14 17:40:47 +10:00
parent 4dfa8f1122
commit 3784de855a
4 changed files with 38 additions and 44 deletions

View File

@@ -1,3 +1,4 @@
<!-- Show client movements -->
<div class="card card-warning card-outline">
<div class="card-header">
<h4 class="card-title">Service Movements</h4>
@@ -9,7 +10,7 @@
</div>
<div class="card-body">
@if ($user->all_client_service_movements()->count())
@if (($x=$user->client_service_movements())->count())
<table class="table table-striped table-hover" id="service_movements" style="width: 100%;">
<thead>
<tr>
@@ -20,9 +21,20 @@
<th>Product</th>
</tr>
</thead>
<tbody>
@foreach ($x as $o)
<tr>
<td><a href="{{ url('u/service',$o->id) }}">{{ $o->id }}</a></td>
<td>{{ $o->account->name }}</td>
<td>{{ $o->name }}</td>
<td>{{ $o->status }}</td>
<td>{{ $o->product->name }}</td>
</tr>
@endforeach
</tbody>
<tfoot>
<tr>
<th>Count {{ $user->all_client_service_movements()->count() }}</th>
<th>Count {{ $x->count() }}</th>
<th colspan="4">&nbsp;</th>
</tr>
</tfoot>
@@ -47,31 +59,11 @@
$(document).ready(function() {
$('#service_movements').DataTable( {
responsive: true,
ajax: {
url: "/api/r/service_movements"
},
columns: [
{ data:
@if($user->isWholesaler())
"admin_service_id_url"
@else
"service_id_url"
@endif
},
{ data: "account_name" },
{ data: "name_short" },
{ data: "status" },
{ data: "product_name" }
],
language: {
emptyTable: "No Service Movements"
},
order: [3, 'asc'],
rowGroup: {
dataSrc: 'account_name',
startRender: null,
endRender: function ( rows, group ) {
return rows.count()+' x ' + group;
dataSrc: 1,
startRender: function ( rows, group ) {
return group+': '+rows.count()+' Services';
},
},
orderFixed: [1, 'asc']