records.blade.php 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  1. <div class="col card--ui" id="card--dashboard">
  2. <header id="title--section" 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;">esporta</button>
  56. <button class="btn--ui reset " style="margin-left:5px;" id="print">stampa</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;">Nominativo</th>
  68. @foreach($payments as $p)
  69. <th colspan="2" scope="col" style="text-align:center; border-left:3px solid white;">{{$p->name}}</th>
  70. @endforeach
  71. </tr>
  72. <tr>
  73. <th scope="col"></th>
  74. <th scope="col" style="border-left:3px solid white;"></th>
  75. <th scope="col" style="border-left:3px solid white;"></th>
  76. @foreach($payments as $p)
  77. <th scope="col" style="text-align:center; border-left:3px solid white;">Entrate</th>
  78. <th scope="col" style="text-align:center">Uscite</th>
  79. @endforeach
  80. </tr>
  81. </thead>
  82. <tbody id="checkall-target">
  83. @php
  84. $count = 0;
  85. @endphp
  86. @foreach($records as $causal => $record)
  87. <tr>
  88. @php
  89. $check = strpos($causal, "$") ? explode("$", $causal)[1] : $causal;
  90. list($d, $c, $n) = explode("§", $check);
  91. @endphp
  92. <td style="background-color:{{$count % 2 == 0 ? 'white' : '#f2f4f7'}}">{{date("d/m/Y", strtotime($d))}}</td>
  93. <td style="border-left:3px solid white !important;background-color:{{$count % 2 == 0 ? 'white' : '#f2f4f7'}}">{{$c}}</td>
  94. <td style="border-left:3px solid white !important;background-color:{{$count % 2 == 0 ? 'white' : '#f2f4f7'}}">{{$n}}</td>
  95. @foreach($payments as $p)
  96. @if(isset($record[$p->name]))
  97. <td style="text-align:center; border-left:3px solid white !important;background-color:{{$count % 2 == 0 ? 'white' : '#f2f4f7'}}">
  98. @if(isset($record[$p->name]["IN"]))
  99. <span class="tablesaw-cell-content " style="color:green">{{formatPrice($record[$p->name]["IN"])}}</span>
  100. @endif
  101. </td>
  102. <td style="text-align:center;background-color:{{$count % 2 == 0 ? 'white' : '#f2f4f7'}}">
  103. @if(isset($record[$p->name]["OUT"]))
  104. <span class="tablesaw-cell-content " style="color:red">{{formatPrice($record[$p->name]["OUT"])}}</span>
  105. @endif
  106. </td>
  107. @else
  108. <td style="border-left:3px solid white !important;background-color:{{$count % 2 == 0 ? 'white' : '#f2f4f7'}}"></td>
  109. <td style="background-color:{{$count % 2 == 0 ? 'white' : '#f2f4f7'}}"></td>
  110. @endif
  111. @endforeach
  112. </tr>
  113. @php
  114. $count++;
  115. @endphp
  116. @endforeach
  117. </tbody>
  118. <tfoot>
  119. <tr>
  120. <td></td>
  121. <td></td>
  122. <td><b>Totale</b></td>
  123. @foreach($payments as $p)
  124. @if(isset($totals[$p->name]))
  125. <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>
  126. <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>
  127. @else
  128. <td style="text-align:center"><span class="tablesaw-cell-content primary" style="color:green; font-size:18px;"><b>{{formatPrice(0)}}</b></span></td>
  129. <td style="text-align:center"><span class="tablesaw-cell-content primary" style="color:red; font-size:18px;"><b>{{formatPrice(0)}}</b></span></td>
  130. @endif
  131. @endforeach
  132. </tr>
  133. <tr style="display:none">
  134. <td></td>
  135. <td><b>Differenza</b></td>
  136. @foreach($payments as $p)
  137. @if(isset($totals[$p->name]))
  138. @php
  139. $diff = $totals[$p->name]["IN"] - $totals[$p->name]["OUT"];
  140. @endphp
  141. @if($diff < 0)
  142. <td></td>
  143. @endif
  144. <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>
  145. @if($diff > 0)
  146. <td></td>
  147. @endif
  148. @else
  149. <td colspan="2" style="text-align:center"><b>{{formatPrice(0)}}</b></td>
  150. @endif
  151. @endforeach
  152. </tr>
  153. </tfoot>
  154. </table>
  155. <!--
  156. <div class="paginator d-flex justify-content-center">
  157. <nav aria-label="Page navigation example">
  158. <ul class="pagination">
  159. <li class="page-item">
  160. <a class="page-link" href="#" aria-label="Previous">
  161. <span aria-hidden="true"></span>
  162. </a>
  163. </li>
  164. <li class="page-item"><a class="page-link" href="#">1</a></li>
  165. <li class="page-item"><a class="page-link" href="#">2</a></li>
  166. <li class="page-item"><a class="page-link" href="#">3</a></li>
  167. <li class="page-item"><a class="page-link" href="#">3</a></li>
  168. <li class="page-item"><span class="more-page">...</span></li>
  169. <li class="page-item">
  170. <a class="page-link" href="#" aria-label="Next">
  171. <span aria-hidden="true"></span>
  172. </a>
  173. </li>
  174. </ul>
  175. </nav>
  176. </div>
  177. -->
  178. </section>
  179. </div>
  180. @push('scripts')
  181. <script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
  182. @endpush
  183. @push('scripts')
  184. <script>
  185. function printData()
  186. {
  187. var divToPrint=document.getElementById("tablesaw-350");
  188. newWin= window.open("");
  189. var htmlToPrint = '' +
  190. '<style type="text/css">' +
  191. 'table th, table td {' +
  192. 'border:1px solid #000;' +
  193. 'padding:0.5em;' +
  194. '}' +
  195. '</style>';
  196. htmlToPrint += divToPrint.outerHTML;
  197. newWin.document.write(htmlToPrint);
  198. newWin.document.close();
  199. newWin.print();
  200. newWin.close();
  201. }
  202. document.querySelector("#print").addEventListener("click", function(){
  203. printData();
  204. });
  205. /*
  206. const chart = new Chart(
  207. document.getElementById('recordChart'), {
  208. type: 'line',
  209. data: {
  210. labels: @json($labels),
  211. datasets: @json($recordDatas)
  212. },
  213. options: {
  214. height:200,
  215. plugins: {
  216. legend: {
  217. position: 'bottom'
  218. }
  219. },
  220. responsive: true,
  221. elements: {
  222. line: {
  223. tension : 0.4 // smooth lines
  224. },
  225. },
  226. }
  227. }
  228. );
  229. Livewire.on('updateChart', data => {
  230. chart.data = data;
  231. chart.update();
  232. });
  233. */
  234. </script>
  235. @endpush