<!-- Show client movements --> <div class="card card-dark"> <div class="card-header"> <h3 class="card-title">Service Movements</h3> </div> <div class="card-body"> @if (($x=$user->client_service_movements())->count()) <table class="table table-striped table-hover" id="service_movements"> <thead> <tr> <th>ID</th> <th>Account</th> <th>Name</th> <th>Status</th> <th>Product</th> </tr> </thead> <tbody> @foreach ($x as $o) <tr> <td><a href="{{ url('u/service',$o->id) }}">{{ $o->sid }}</a></td> <td>{{ $o->account->name }}</td> <td>{{ $o->name_short }}</td> <td> {{ $o->status }} @switch($o->status) @case ('ORDER-SENT') <br>(#{{ $o->order_info_reference }}) @break; @case ('PROVISION-PLANNED') <br>({{ ($xx=$o->start_at) ? $xx->format('Y-m-d') : 'No Date' }}) @break; @case ('CANCEL-PENDING') <br>({{ ($xx=$o->stop_at) ? $xx->format('Y-m-d') : 'No Date' }}) @break; @endswitch </td> <td>{{ $o->product->name }}</td> </tr> @endforeach </tbody> <tfoot> <tr> <th>Count {{ $x->count() }}</th> <th colspan="4"> </th> </tr> </tfoot> </table> @else <p>No Service Movements</p> @endif </div> </div> @section('page-scripts') @css(datatables,bootstrap4|rowgroup) @js(datatables,bootstrap4|rowgroup) <script type="text/javascript"> $(document).ready(function() { $('#service_movements').DataTable( { order: [3, 'asc'], rowGroup: { dataSrc: 1, startRender: function ( rows, group ) { return group+': '+rows.count()+' Services'; }, }, orderFixed: [1, 'asc'] }); $('#service_movements tbody').on('click','tr', function () { $(this).toggleClass('selected'); }); }); </script> @append