motivation.blade.php 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  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. <a class="btn--ui lightGrey" href="/motivations"><i class="fa-solid fa-arrow-left"></i></a><br><br>
  45. <div class="container">
  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 class="col">
  81. <div class="form--item">
  82. <label for="show_in_member_presences" class="form-label">Visualizza in Presenze Utente</label>
  83. <input class="form-check-input form-control" style="width:22px; height:22px;" type="checkbox" id="show_in_member_presences" wire:model="show_in_member_presences">
  84. </div>
  85. </div>
  86. </div>
  87. <!-- // inline input field -->
  88. <div class="form--item">
  89. <button type="button" class="btn--ui lightGrey" wire:click="cancel()">Annulla</button>
  90. @if($add)
  91. <button type="submit" class="btn--ui" wire:click.prevent="store()">Salva</button>
  92. @endif
  93. @if($update)
  94. <button type="submit" class="btn--ui" wire:click.prevent="update()">Salva</button>
  95. @endif
  96. </div>
  97. </form>
  98. </div>
  99. </div>
  100. </div>
  101. @endif
  102. </div>
  103. @push('scripts')
  104. <link href="/css/datatables.css" rel="stylesheet" />
  105. <script src="https://code.jquery.com/jquery-2.2.4.min.js" integrity="sha256-BbhdlvQf/xTY9gja0Dq3HiwQF8LaCRTXxZKRutelT44=" crossorigin="anonymous"></script>
  106. <script src="/assets/js/datatables.js"></script>
  107. <script src="https://cdn.datatables.net/buttons/3.0.2/js/buttons.dataTables.js"></script>
  108. <script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.10.1/jszip.min.js"></script>
  109. <script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.2.7/pdfmake.min.js"></script>
  110. <script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.2.7/vfs_fonts.js"></script>
  111. @endpush
  112. @push('scripts')
  113. <script>
  114. $(document).ready(function() {
  115. loadDataTable();
  116. } );
  117. Livewire.on('load-data-table', () => {
  118. loadDataTable();
  119. });
  120. function loadDataTable(){
  121. let date = new Date();
  122. let date_export = `${date.getFullYear()}${date.getMonth()}${date.getDate()}_`;
  123. if ( $.fn.DataTable.isDataTable('#tablesaw-350') ) {
  124. $('#tablesaw-350').DataTable().destroy();
  125. }
  126. $('#tablesaw-350').DataTable({
  127. thead: {
  128. 'th': {'background-color': 'blue'}
  129. },
  130. layout: {
  131. topStart : null,
  132. topEnd : null,
  133. top1A: {
  134. // buttons: [
  135. // {
  136. // extend: 'collection',
  137. // text: 'ESPORTA',
  138. buttons: [
  139. {
  140. extend: 'excelHtml5',
  141. text: '<i class="fa-solid fa-file-excel"></i>',
  142. action: newexportaction,
  143. title: date_export + 'Motivazioni',
  144. exportOptions: {
  145. columns: ":not(':last')"
  146. }
  147. },
  148. {
  149. extend: 'pdfHtml5',
  150. text: '<i class="fa-solid fa-file-pdf"></i>',
  151. action: newexportaction,
  152. title: date_export + 'Motivazioni',
  153. exportOptions: {
  154. columns: ":not(':last')"
  155. }
  156. },
  157. {
  158. extend: 'print',
  159. text: '<i class="fa-solid fa-print"></i>',
  160. action: newexportaction,
  161. title: date_export + 'Motivazioni',
  162. exportOptions: {
  163. columns: ":not(':last')"
  164. }
  165. }
  166. ],
  167. // dropup: true
  168. // }
  169. // ]
  170. },
  171. top1B : {
  172. pageLength: {
  173. menu: [[10, 25, 50, 100, 100000], [10, 25, 50, 100, "Tutti"]]
  174. }
  175. },
  176. top1C :'search',
  177. },
  178. pagingType: 'numbers',
  179. "language": {
  180. "url": "/assets/js/Italian.json"
  181. },
  182. "fnInitComplete": function (oSettings, json) {
  183. var html = '&nbsp;<a href="#" class="addData btn--ui"><i class="fa-solid fa-plus"></i></a>';
  184. $(".dt-search").append(html);
  185. }
  186. });
  187. $('#tablesaw-350 thead tr th').addClass('col');
  188. $('#tablesaw-350 thead tr th').css("background-color", "#f6f8fa");
  189. $(document).ready(function() {
  190. $(document).on("click",".addData",function() {
  191. $(".title--section_addButton").trigger("click")
  192. });
  193. } );
  194. }
  195. </script>
  196. @endpush