records.blade.php 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260
  1. <div class="col card--ui" id="card--dashboard">
  2. <header id="title--section" style="display:none !important" class="d-flex align-items-center justify-content-between">
  3. <div class="title--section_name d-flex align-items-center justify-content-between">
  4. <i class="ico--ui title_section utenti me-2"></i>
  5. <h2 class="primary">Prima nota</h2>
  6. </div>
  7. </header>
  8. <section id="subheader" class="d-flex align-items-center ">
  9. <!--
  10. <form action="" class="group--action d-flex align-items-center">
  11. <select class="form-select form-select-lg me-1" aria-label=".form-select-lg example">
  12. <option selected>Open this select menu</option>
  13. <option value="1">One</option>
  14. <option value="2">Two</option>
  15. <option value="3">Three</option>
  16. </select>
  17. <button type="submit" class="btn--ui">applica</button>
  18. </form>
  19. -->
  20. Dal&nbsp;<input type="date" wire:model="fromDate" class="form-control" style="width:200px;">
  21. &nbsp;&nbsp;&nbsp;
  22. al&nbsp;<input type="date" wire:model="toDate" class="form-control" style="width:200px;">
  23. @if(false)
  24. Da&nbsp;<select class="form-select form-select-lg me-1" wire:model="selectedFilterFromDay" style="width:150px">
  25. @foreach($days as $p)
  26. <option value="{{$p["value"]}}">{{$p["text"]}}</option>
  27. @endforeach
  28. </select>
  29. <select class="form-select form-select-lg me-1" wire:model="selectedFilterFromMonth" style="width:150px">
  30. @foreach($months as $p)
  31. <option value="{{$p["value"]}}">{{$p["text"]}}</option>
  32. @endforeach
  33. </select>
  34. <select class="form-select form-select-lg me-1" wire:model="selectedFilterFromYear" style="width:100px">
  35. @foreach($years as $p)
  36. <option value="{{$p["value"]}}">{{$p["text"]}}</option>
  37. @endforeach
  38. </select>
  39. a&nbsp;&nbsp;<select class="form-select form-select-lg me-1" wire:model="selectedFilterToDay" style="width:150px">
  40. @foreach($days as $p)
  41. <option value="{{$p["value"]}}">{{$p["text"]}}</option>
  42. @endforeach
  43. </select>
  44. <select class="form-select form-select-lg me-1" wire:model="selectedFilterToMonth" style="width:150px">
  45. @foreach($months as $p)
  46. <option value="{{$p["value"]}}">{{$p["text"]}}</option>
  47. @endforeach
  48. </select>
  49. <select class="form-select form-select-lg me-1" wire:model="selectedFilterToYear" style="width:100px">
  50. @foreach($years as $p)
  51. <option value="{{$p["value"]}}">{{$p["text"]}}</option>
  52. @endforeach
  53. </select>
  54. @endif
  55. <button class="btn--ui reset" wire:click="export()" style="margin-left:5px;"><i class="fa-solid fa-download"></i></button>
  56. <button class="btn--ui reset " style="margin-left:5px;" id="print"><i class="fa-solid fa-print"></i></button>
  57. </section>
  58. <section id="resume-table">
  59. <!--
  60. <canvas id="recordChart"></canvas>
  61. -->
  62. <table class="table tablesaw tablesaw-stack" id="tablesaw-350">
  63. <thead>
  64. <tr>
  65. <th scope="col">Data</th>
  66. <th scope="col" style="border-left:3px solid white;">Causale</th>
  67. <th scope="col" style="border-left:3px solid white;">Dettaglio Causale</th>
  68. <th scope="col" style="border-left:3px solid white;">Nominativo</th>
  69. @foreach($payments as $p)
  70. <th colspan="2" scope="col" style="text-align:center; border-left:3px solid white;">{{$p->name}}</th>
  71. @endforeach
  72. </tr>
  73. <tr>
  74. <th scope="col"></th>
  75. <th scope="col" style="border-left:3px solid white;"></th>
  76. <th scope="col" style="border-left:3px solid white;"></th>
  77. <th scope="col" style="border-left:3px solid white;"></th>
  78. @foreach($payments as $p)
  79. <th scope="col" style="text-align:center; border-left:3px solid white;">Entrate</th>
  80. <th scope="col" style="text-align:center">Uscite</th>
  81. @endforeach
  82. </tr>
  83. </thead>
  84. <tbody id="checkall-target">
  85. @php
  86. $count = 0;
  87. @endphp
  88. @foreach($records as $causal => $record)
  89. <tr>
  90. @php
  91. $check = strpos($causal, "$") ? explode("$", $causal)[1] : $causal;
  92. list($d, $c, $n, $det) = explode("§", $check);
  93. @endphp
  94. <td style="background-color:{{$count % 2 == 0 ? 'white' : '#f2f4f7'}}">{{date("d/m/Y", strtotime($d))}}</td>
  95. <td style="border-left:3px solid white !important;background-color:{{$count % 2 == 0 ? 'white' : '#f2f4f7'}}">{{$c}}</td>
  96. <td style="border-left:3px solid white !important;background-color:{{$count % 2 == 0 ? 'white' : '#f2f4f7'}}">{{$det}}</td>
  97. <td style="border-left:3px solid white !important;background-color:{{$count % 2 == 0 ? 'white' : '#f2f4f7'}}">{{$n}}</td>
  98. @foreach($payments as $p)
  99. @if(isset($record[$p->name]))
  100. <td style="text-align:center; border-left:3px solid white !important;background-color:{{$count % 2 == 0 ? 'white' : '#f2f4f7'}}">
  101. @if(isset($record[$p->name]["IN"]))
  102. <span class="tablesaw-cell-content " style="color:green">{{formatPrice($record[$p->name]["IN"])}}</span>
  103. @endif
  104. </td>
  105. <td style="text-align:center;background-color:{{$count % 2 == 0 ? 'white' : '#f2f4f7'}}">
  106. @if(isset($record[$p->name]["OUT"]))
  107. <span class="tablesaw-cell-content " style="color:red">{{formatPrice($record[$p->name]["OUT"])}}</span>
  108. @endif
  109. </td>
  110. @else
  111. <td style="border-left:3px solid white !important;background-color:{{$count % 2 == 0 ? 'white' : '#f2f4f7'}}"></td>
  112. <td style="background-color:{{$count % 2 == 0 ? 'white' : '#f2f4f7'}}"></td>
  113. @endif
  114. @endforeach
  115. </tr>
  116. @php
  117. $count++;
  118. @endphp
  119. @endforeach
  120. </tbody>
  121. <tfoot>
  122. <tr>
  123. <td></td>
  124. <td></td>
  125. <td></td>
  126. <td><b>Totale</b></td>
  127. @foreach($payments as $p)
  128. @if(isset($totals[$p->name]))
  129. <td style="text-align:center"><span class="tablesaw-cell-content primary" style="color:green; font-size:18px;"><b>{{formatPrice($totals[$p->name]["IN"])}}</b></span></td>
  130. <td style="text-align:center"><span class="tablesaw-cell-content primary" style="color:red; font-size:18px;"><b>{{formatPrice($totals[$p->name]["OUT"])}}</b></span></td>
  131. @else
  132. <td style="text-align:center"><span class="tablesaw-cell-content primary" style="color:green; font-size:18px;"><b>{{formatPrice(0)}}</b></span></td>
  133. <td style="text-align:center"><span class="tablesaw-cell-content primary" style="color:red; font-size:18px;"><b>{{formatPrice(0)}}</b></span></td>
  134. @endif
  135. @endforeach
  136. </tr>
  137. <tr style="display:none">
  138. <td></td>
  139. <td><b>Differenza</b></td>
  140. @foreach($payments as $p)
  141. @if(isset($totals[$p->name]))
  142. @php
  143. $diff = $totals[$p->name]["IN"] - $totals[$p->name]["OUT"];
  144. @endphp
  145. @if($diff < 0)
  146. <td></td>
  147. @endif
  148. <td style="text-align:center"><span class="tablesaw-cell-content primary" style="color:{{$diff > 0 ? 'green' : 'red'}}; font-size:18px;"><b>{{formatPrice($diff)}}</b></span></td>
  149. @if($diff > 0)
  150. <td></td>
  151. @endif
  152. @else
  153. <td colspan="2" style="text-align:center"><b>{{formatPrice(0)}}</b></td>
  154. @endif
  155. @endforeach
  156. </tr>
  157. </tfoot>
  158. </table>
  159. <!--
  160. <div class="paginator d-flex justify-content-center">
  161. <nav aria-label="Page navigation example">
  162. <ul class="pagination">
  163. <li class="page-item">
  164. <a class="page-link" href="#" aria-label="Previous">
  165. <span aria-hidden="true"></span>
  166. </a>
  167. </li>
  168. <li class="page-item"><a class="page-link" href="#">1</a></li>
  169. <li class="page-item"><a class="page-link" href="#">2</a></li>
  170. <li class="page-item"><a class="page-link" href="#">3</a></li>
  171. <li class="page-item"><a class="page-link" href="#">3</a></li>
  172. <li class="page-item"><span class="more-page">...</span></li>
  173. <li class="page-item">
  174. <a class="page-link" href="#" aria-label="Next">
  175. <span aria-hidden="true"></span>
  176. </a>
  177. </li>
  178. </ul>
  179. </nav>
  180. </div>
  181. -->
  182. </section>
  183. </div>
  184. @push('scripts')
  185. <script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
  186. @endpush
  187. @push('scripts')
  188. <script>
  189. function printData()
  190. {
  191. var divToPrint=document.getElementById("tablesaw-350");
  192. newWin= window.open("");
  193. var htmlToPrint = '' +
  194. '<style type="text/css">' +
  195. 'table th, table td {' +
  196. 'border:1px solid #000;' +
  197. 'padding:0.5em;' +
  198. '}' +
  199. '</style>';
  200. htmlToPrint += divToPrint.outerHTML;
  201. newWin.document.write(htmlToPrint);
  202. newWin.document.close();
  203. newWin.print();
  204. newWin.close();
  205. }
  206. document.querySelector("#print").addEventListener("click", function(){
  207. printData();
  208. });
  209. /*
  210. const chart = new Chart(
  211. document.getElementById('recordChart'), {
  212. type: 'line',
  213. data: {
  214. labels: @json($labels),
  215. datasets: @json($recordDatas)
  216. },
  217. options: {
  218. height:200,
  219. plugins: {
  220. legend: {
  221. position: 'bottom'
  222. }
  223. },
  224. responsive: true,
  225. elements: {
  226. line: {
  227. tension : 0.4 // smooth lines
  228. },
  229. },
  230. }
  231. }
  232. );
  233. Livewire.on('updateChart', data => {
  234. chart.data = data;
  235. chart.update();
  236. });
  237. */
  238. </script>
  239. @endpush