receipt.blade.php 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. <div class="col">
  2. <div class="row h-100">
  3. <div class="col-auto filterWrapper" id="filter--section" wire:ignore.self>
  4. <aside>
  5. <header>
  6. <h2>Filtra Ricevute</h2>
  7. </header>
  8. <form action="" id="filter--form" class="dark-form row">
  9. <div class="filter--item">
  10. <span class="filter--item_title">Stato</span>
  11. <div class="filter--item_formElement">
  12. <select class="form-select" wire:model="filterStatus" onchange="destroyDataTable()">
  13. <option value="">--Seleziona--
  14. <option value="1">Attiva
  15. <option value="99">Annullata
  16. </select>
  17. </div>
  18. </div>
  19. <div class="filter--item">
  20. <span class="filter--item_title">Periodo</span>
  21. <div class="filter--item_formElement">
  22. <input id="date" type="date" class="form-control" wire:model="filterFrom" style="background-color:white">
  23. </div>
  24. <div class="filter--item_formElement">
  25. <input id="date" type="date" class="form-control" wire:model="filterTo" style="background-color:white" >
  26. </div>
  27. </div>
  28. </form>
  29. <footer>
  30. <div class="filter--buttons d-flex align-items-center justify-content-between">
  31. <button class="btn--ui small dark disable" wire:click.prevent="disableSearch()" onclick="destroyDataTable()">cancella</button>
  32. <button class="btn--ui small white" wire:click.prevent="search()" onclick="destroyDataTable()">filtra</button>
  33. </div>
  34. </footer>
  35. </aside>
  36. </div>
  37. <div class="col card--ui" id="card--dashboard">
  38. <header id="title--section" class="d-flex align-items-center justify-content-between">
  39. <div class="title--section_name d-flex align-items-center justify-content-between">
  40. <i class="ico--ui title_section utenti me-2"></i>
  41. <h2 class="primary">Ricevute</h2>
  42. </div>
  43. <!--
  44. <div class="title--section_addButton" wire:click="add()" style="cursor: pointer;">
  45. <div class="card--ui card--ui_btnAddHeaderUser entrata d-flex justify-items-between">
  46. <header class="d-flex justify-content-between"><div class="card-title d-flex align-items-start"><h2>Aggiungi&nbsp;&nbsp;&nbsp;</h2></div><a href="#" wire:click="add()"><i class="ico--ui big add primary"></i></a></header>
  47. </div>
  48. </div>
  49. -->
  50. </header>
  51. <button id="open-filter" onclick="pcsh1()"></button>
  52. <button id="close-filter" onclick="pcsh2()"></button>
  53. <section id="resume-table">
  54. <div class="compare--chart_wrapper d-none"></div>
  55. <table class="table tablesaw tablesaw-stack" id="tablesaw-350">
  56. <thead>
  57. <tr>
  58. <th scope="col">Anno</th>
  59. <th scope="col">Numero</th>
  60. <th scope="col">Nome</th>
  61. <th scope="col">Cognome</th>
  62. <th scope="col">Stato</th>
  63. <th scope="col">Data</th>
  64. <th scope="col">...</th>
  65. </tr>
  66. </thead>
  67. <tbody id="checkall-target">
  68. @foreach($records as $record)
  69. <tr>
  70. <td>{{$record->year}}</td>
  71. <td>{{$record->number}}</td>
  72. <td>{{$record->type == 'IN' ? ($record->member->last_name) : 'Uscita'}}</td>
  73. <td>{{$record->type == 'IN' ? ($record->member->first_name) : ''}}</td>
  74. <td>
  75. <span class="tablesaw-cell-content">
  76. <span class="badge tessera-badge {{$record->status == 1 ? 'active' : 'suspended'}}">{{$record->status == 1 ? 'Attivo' : 'Annullata'}}</span>
  77. </span>
  78. </td>
  79. <td>{{date("d/m/Y", strtotime($record->date))}}</td>
  80. <td>
  81. <button type="button" class="btn btn-outline-primary btn-sm" onclick="document.location.href='/in?id={{$record->record_id}}'">Dettaglio</button>
  82. <a target="_blank" class="btn btn-outline-primary btn-sm" href="/receipt/{{$record->id}}">Stampa</a>
  83. <a target="_blank" class="btn btn-outline-primary btn-sm" onclick="sendMail({{$record->id}})">Invia tramite mail</a>
  84. </td>
  85. </tr>
  86. @endforeach
  87. </tbody>
  88. </table>
  89. </section>
  90. </div>
  91. @push('scripts')
  92. <link href="/css/datatables.css" rel="stylesheet" />
  93. <script src="https://code.jquery.com/jquery-2.2.4.min.js" integrity="sha256-BbhdlvQf/xTY9gja0Dq3HiwQF8LaCRTXxZKRutelT44=" crossorigin="anonymous"></script>
  94. <script src="/assets/js/datatables.js"></script>
  95. <script src="https://cdn.datatables.net/buttons/3.0.2/js/buttons.dataTables.js"></script>
  96. <script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.10.1/jszip.min.js"></script>
  97. <script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.2.7/pdfmake.min.js"></script>
  98. <script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.2.7/vfs_fonts.js"></script>
  99. @endpush
  100. @push('scripts')
  101. <script>
  102. $(document).ready(function() {
  103. loadDataTable();
  104. } );
  105. Livewire.on('load-data-table', () => {
  106. setTimeout(function() {loadDataTable()}, 100);
  107. });
  108. Livewire.on('destroy-data-table', () => {
  109. $('#tablesaw-350').DataTable().destroy();
  110. });
  111. function destroyDataTable()
  112. {
  113. $('#tablesaw-350').DataTable().destroy();
  114. }
  115. function sendMail(id)
  116. {
  117. $.get("/receipt/mail/" + id, function(data, status){
  118. alert('Mail inviata');
  119. });
  120. }
  121. function loadDataTable(){
  122. $('#tablesaw-350').DataTable({
  123. thead: {
  124. 'th': {'background-color': 'blue'}
  125. },
  126. layout: {
  127. topStart: {
  128. buttons: [
  129. {
  130. extend: 'excelHtml5',
  131. title: 'Ricevute',
  132. exportOptions: {
  133. columns: ":not(':last')"
  134. }
  135. },
  136. {
  137. extend: 'pdfHtml5',
  138. title: 'Ricevute',
  139. exportOptions: {
  140. columns: ":not(':last')"
  141. }
  142. },
  143. {
  144. extend: 'print',
  145. text: 'Stampa',
  146. title: 'Ricevute',
  147. exportOptions: {
  148. columns: ":not(':last')"
  149. }
  150. }
  151. ]
  152. }
  153. },
  154. order: [[0, 'desc'], [1, 'desc']],
  155. pagingType: 'numbers',
  156. "language": {
  157. "url": "/assets/js/Italian.json"
  158. }
  159. });
  160. $('#tablesaw-350 thead tr th').addClass('col');
  161. $('#tablesaw-350 thead tr th').css("background-color", "#EDF0F2");
  162. }
  163. </script>
  164. @endpush