motivation.blade.php 9.4 KB

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