course_duration.blade.php 9.4 KB

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