table.blade.php 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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>{{ __('Server id') }}</th>
  8. <th>{{ __('Config') }}</th>
  9. <th>{{ __('Suspended at') }}</th>
  10. <th>{{ __('Created at') }}</th>
  11. <th></th>
  12. </tr>
  13. </thead>
  14. <tbody>
  15. </tbody>
  16. </table>
  17. <script>
  18. function submitResult() {
  19. return confirm("{{ __('Are you sure you wish to delete?') }}") !== false;
  20. }
  21. document.addEventListener("DOMContentLoaded", function() {
  22. $('#datatable').DataTable({
  23. language: {
  24. url: '//cdn.datatables.net/plug-ins/1.11.3/i18n/{{ config('SETTINGS::LOCALE:DATATABLES') }}.json'
  25. },
  26. processing: true,
  27. serverSide: true,
  28. stateSave: true,
  29. ajax: "{{ route('admin.servers.datatable') }}{{ $filter ?? '' }}",
  30. order: [
  31. [6, "desc"]
  32. ],
  33. columns: [{
  34. data: 'status',
  35. name: 'servers.suspended',
  36. sortable: false
  37. },
  38. {
  39. data: 'name'
  40. },
  41. {
  42. data: 'user',
  43. name: 'user.name',
  44. },
  45. {
  46. data: 'identifier'
  47. },
  48. {
  49. data: 'resources',
  50. name: 'product.name',
  51. sortable: false
  52. },
  53. {
  54. data: 'suspended'
  55. },
  56. {
  57. data: 'created_at'
  58. },
  59. {
  60. data: 'actions',
  61. sortable: false
  62. },
  63. ],
  64. fnDrawCallback: function(oSettings) {
  65. $('[data-toggle="popover"]').popover();
  66. }
  67. });
  68. });
  69. </script>