<div class="card card-dark card-outline"> <div class="card-header"> <h4 class="card-title">Invoices Due</h4> </div> <div class="card-body"> @if ($o->invoices_due->count()) <table class="table table-striped table-hover" id="invoices" style="width: 100%;"> <thead> <tr> <th>Invoice</th> <th>Total</th> <th>Due</th> <th>Date Date</th> </tr> </thead> <tfoot> <tr> <th>Count {{ $o->invoices_due->count() }}</th> {{-- @todo Number format should configured by currency --}} <th class="right">{{ number_format($o->invoices_due->sum('total'),2) }}</th> <th class="right">{{ number_format($o->invoices_due->sum('due'),2) }}</th> <th> </th> </tr> </tfoot> </table> @else <p>No invoices due</p> @endif </div> </div> @section('page-scripts') @css('//cdn.datatables.net/1.10.19/css/jquery.dataTables.min.css','jq-dt-css','jquery') @js('//cdn.datatables.net/1.10.19/js/jquery.dataTables.min.js','jq-dt-js','jquery') @css('//cdn.datatables.net/responsive/2.2.1/css/responsive.dataTables.min.css','dt-responsive-css','jq-dt-css') @js('//cdn.datatables.net/responsive/2.2.1/js/dataTables.responsive.min.js','dt-responsive-js','jq-dt-js') @css('/plugin/dataTables/dataTables.bootstrap4.css','dt-bootstrap4-css','jq-dt-css') @js('/plugin/dataTables/dataTables.bootstrap4.js','dt-bootstrap4-js','jq-dt-js') <script type="text/javascript"> $(document).ready(function() { $('#invoices').DataTable( { responsive: true, ajax: { url: "/api/u/invoices/{{ $o->id }}" }, columns: [ { data: "invoice_id_url" }, { data: "total" }, { data: "due" }, { data: "date_due" } ], language: { emptyTable: "No Invoices Due" }, order: [3, 'asc'] }); $('#invoices tbody').on('click','tr', function () { $(this).toggleClass('selected'); }); }); </script> @append