table.blade.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <table id="datatable" class="table table-striped">
  2. <thead>
  3. <tr>
  4. <th width="20"></th>
  5. <th>Name</th>
  6. <th>User</th>
  7. <th>Config</th>
  8. <th>Suspended At</th>
  9. <th>Created At</th>
  10. <th></th>
  11. </tr>
  12. </thead>
  13. <tbody>
  14. </tbody>
  15. </table>
  16. <script>
  17. function submitResult() {
  18. return confirm("Are you sure you wish to delete?") !== false;
  19. }
  20. document.addEventListener("DOMContentLoaded", function () {
  21. $('#datatable').DataTable({
  22. processing: true,
  23. serverSide: true,
  24. stateSave: true,
  25. ajax: "{{route('admin.servers.datatable')}}{{$filter ?? ''}}",
  26. order: [[ 5, "desc" ]],
  27. columns: [
  28. {data: 'status' , name : 'servers.suspended'},
  29. {data: 'name'},
  30. {data: 'user' , name : 'user.name'},
  31. {data: 'resources' , name : 'product.name'},
  32. {data: 'suspended'},
  33. {data: 'created_at'},
  34. {data: 'actions' , sortable : false},
  35. ],
  36. fnDrawCallback: function( oSettings ) {
  37. $('[data-toggle="popover"]').popover();
  38. }
  39. });
  40. });
  41. </script>