course_subscription.blade.php 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. <div class="col card--ui" id="card--dashboard">
  2. @if(!$add && !$update)
  3. <header id="title--section" style="display:none !important" class="d-flex align-items-center justify-content-between">
  4. <div class="title--section_name d-flex align-items-center justify-content-between">
  5. <i class="ico--ui title_section utenti me-2"></i>
  6. <h2 class="primary">Abbonamento corsi</h2>
  7. </div>
  8. <div class="title--section_addButton" wire:click="add()" style="cursor: pointer;">
  9. <div class="btn--ui entrata d-flex justify-items-between">
  10. <a href="#" wire:click="add()" style="color:white">Aggiungi</a>
  11. </div>
  12. </div>
  13. </header>
  14. <section id="resume-table">
  15. <div class="compare--chart_wrapper d-none"></div>
  16. <table class="table tablesaw tablesaw-stack" id="tablesaw-350">
  17. <thead>
  18. <tr>
  19. <th scope="col">Nome</th>
  20. <th scope="col">Abilitato</th>
  21. <th scope="col">...</th>
  22. </tr>
  23. </thead>
  24. <tbody id="checkall-target">
  25. @foreach($records as $record)
  26. <tr>
  27. <td>{{$record->name}}</td>
  28. <td> <span class="tablesaw-cell-content"><span class="badge tessera-badge {{$record->enabled ? 'active' : 'suspended'}}">{{$record->enabled ? 'attivo' : 'disattivo'}}</span></span></td>
  29. <td>
  30. <button type="button" class="btn" wire:click="edit({{ $record->id }})"><i class="fa-regular fa-pen-to-square"></i></button>
  31. <button type="button" class="btn" onclick="confirm('Sei sicuro?') || event.stopImmediatePropagation()" wire:click="delete({{ $record->id }})"><i class="fa-regular fa-trash-can"></i></button>
  32. </td>
  33. </tr>
  34. @endforeach
  35. </tbody>
  36. </table>
  37. </section>
  38. @else
  39. <div class="container">
  40. @if (session()->has('error'))
  41. <div class="alert alert-danger" role="alert">
  42. {{ session()->get('error') }}
  43. </div>
  44. @endif
  45. <div class="row">
  46. <div class="col">
  47. <form action="">
  48. <div class="row mb-3">
  49. <div class="col">
  50. <div class="form--item">
  51. <label for="inputName" class="form-label">Nome</label>
  52. <input class="form-control js-keyupTitle @error('name') is-invalid @enderror" type="text" id="name" placeholder="Nome" wire:model="name">
  53. @error('name')
  54. <div class="invalid-feedback">{{ $message }}</div>
  55. @enderror
  56. </div>
  57. </div>
  58. <div class="col">
  59. <div class="form-check form-check-inline">
  60. <label class="form-check-label" for="enabled">Abilitato</label><br>
  61. <input class="form-check-input" type="checkbox" id="enabled" wire:model="enabled">
  62. </div>
  63. </div>
  64. </div>
  65. <!-- // inline input field -->
  66. <div class="form--item">
  67. @if($add)
  68. <button type="submit" class="btn--ui" wire:click.prevent="store()">Salva</button>
  69. @endif
  70. @if($update)
  71. <button type="submit" class="btn--ui" wire:click.prevent="update()">Salva</button>
  72. @endif
  73. <button type="button" class="btn--ui lightGrey" wire:click="cancel()">Annulla</button>
  74. </div>
  75. </form>
  76. </div>
  77. </div>
  78. </div>
  79. @endif
  80. </div>
  81. @push('scripts')
  82. <link href="/css/datatables.css" rel="stylesheet" />
  83. <script src="https://code.jquery.com/jquery-2.2.4.min.js" integrity="sha256-BbhdlvQf/xTY9gja0Dq3HiwQF8LaCRTXxZKRutelT44=" crossorigin="anonymous"></script>
  84. <script src="/assets/js/datatables.js"></script>
  85. <script src="https://cdn.datatables.net/buttons/3.0.2/js/buttons.dataTables.js"></script>
  86. <script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.10.1/jszip.min.js"></script>
  87. <script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.2.7/pdfmake.min.js"></script>
  88. <script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.2.7/vfs_fonts.js"></script>
  89. @endpush
  90. @push('scripts')
  91. <script>
  92. $(document).ready(function() {
  93. loadDataTable();
  94. } );
  95. Livewire.on('load-data-table', () => {
  96. loadDataTable();
  97. });
  98. function loadDataTable(){
  99. $('#tablesaw-350').DataTable({
  100. fixedHeader: true,
  101. thead: {
  102. 'th': {'background-color': 'blue'}
  103. },
  104. layout: {
  105. topStart : null,
  106. topEnd : null,
  107. top1A: {
  108. buttons: [
  109. {
  110. extend: 'collection',
  111. text: 'Esporta',
  112. buttons: [
  113. {
  114. extend: 'excelHtml5',
  115. title: 'Iscritti corsi',
  116. exportOptions: {
  117. columns: ":not(':last')"
  118. }
  119. },
  120. {
  121. extend: 'pdfHtml5',
  122. title: 'Iscritti corsi',
  123. exportOptions: {
  124. columns: ":not(':last')"
  125. }
  126. },
  127. {
  128. extend: 'print',
  129. text: 'Stampa',
  130. title: 'Iscritti corsi',
  131. exportOptions: {
  132. columns: ":not(':last')"
  133. }
  134. }
  135. ],
  136. dropup: true
  137. }
  138. ]
  139. },
  140. top1B : {
  141. pageLength: {
  142. menu: [[10, 25, 50, 100, 100000], [10, 25, 50, 100, "Tutti"]]
  143. }
  144. },
  145. top1C :'search',
  146. },
  147. pagingType: 'numbers',
  148. "language": {
  149. "url": "/assets/js/Italian.json"
  150. },
  151. "fnInitComplete": function (oSettings, json) {
  152. var html = '&nbsp;<a href="#" class="addData btn--ui"><i class="fa-solid fa-plus"></i></a>';
  153. $(".dt-search").append(html);
  154. }
  155. });
  156. $('#tablesaw-350 thead tr th').addClass('col');
  157. $('#tablesaw-350 thead tr th').css("background-color", "#f6f8fa");
  158. $(document).ready(function() {
  159. $(document).on("click",".addData",function() {
  160. $(".title--section_addButton").trigger("click")
  161. });
  162. } );
  163. }
  164. </script>
  165. @endpush