records.blade.php 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386
  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 filtri-prima_nota">
  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. <div class="prima--nota_date">
  21. <span class="date_span">Dal</span><input type="date" wire:model="fromDate" class="form-control">
  22. <span class="date_span ms-2">al</span><input type="date" wire:model="toDate" class="form-control">
  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. </div>
  56. <div class="prima--nota_tipology">
  57. <select name="search_causal_id[]" class="form-select filterCausals me-2" multiple="multiple" wire:model="filterCausals">
  58. @foreach($causals as $causal)
  59. <option value="{{$causal["id"]}}">{!!$causal["name"]!!}
  60. @endforeach
  61. </select>
  62. <select name="search_member_id" class="form-select filterMember" wire:model="filterMember">
  63. <option value="">--Seleziona--
  64. @foreach($members as $member)
  65. <option value="{{$member->id}}">{{$member->last_name}} {{$member->first_name}}
  66. @endforeach
  67. </select>
  68. </div>
  69. <div class="prima--nota_buttons ms-auto">
  70. <button class="btn--ui_outline light reset" wire:click="export()" style="margin-left:5px;"><i class="fa-solid fa-download"></i></button>
  71. <button class="btn--ui_outline light reset" style="margin-left:5px;" id="print"><i class="fa-solid fa-print"></i></button>
  72. </div>
  73. </section>
  74. <section id="resume-table">
  75. <!--
  76. <canvas id="recordChart"></canvas>
  77. -->
  78. <table class="table tablesaw tablesaw-stack" id="tablesaw-350">
  79. <thead>
  80. <tr>
  81. <th scope="col">Data</th>
  82. <th scope="col" style="border-left:3px solid white;">Causale</th>
  83. <th scope="col" style="border-left:3px solid white;">Dettaglio Causale</th>
  84. <th scope="col" style="border-left:3px solid white;">Nominativo</th>
  85. @foreach($payments as $p)
  86. <th colspan="2" scope="col" style="text-align:center; border-left:3px solid white;">{{$p->name}}</th>
  87. @endforeach
  88. </tr>
  89. <tr>
  90. <th scope="col"></th>
  91. <th scope="col" style="border-left:3px solid white;"></th>
  92. <th scope="col" style="border-left:3px solid white;"></th>
  93. <th scope="col" style="border-left:3px solid white;"></th>
  94. @foreach($payments as $p)
  95. <th scope="col" style="text-align:center; border-left:3px solid white;">Entrate</th>
  96. <th scope="col" style="text-align:center">Uscite</th>
  97. @endforeach
  98. </tr>
  99. </thead>
  100. <tbody id="checkall-target">
  101. @php
  102. $count = 0;
  103. @endphp
  104. @foreach($records as $causal => $record)
  105. <tr>
  106. @php
  107. $check = strpos($causal, "$") ? explode("$", $causal)[1] : $causal;
  108. list($d, $c, $n, $det) = explode("§", $check);
  109. @endphp
  110. <td style="background-color:{{$count % 2 == 0 ? 'white' : '#f2f4f7'}}">{{date("d/m/Y", strtotime($d))}}</td>
  111. <td style="border-left:3px solid white !important;background-color:{{$count % 2 == 0 ? 'white' : '#f2f4f7'}}">{{$c}}</td>
  112. <td style="border-left:3px solid white !important;background-color:{{$count % 2 == 0 ? 'white' : '#f2f4f7'}}">{{$det}}</td>
  113. <td style="border-left:3px solid white !important;background-color:{{$count % 2 == 0 ? 'white' : '#f2f4f7'}}">{{$n}}</td>
  114. @foreach($payments as $p)
  115. @if(isset($record[$p->name]))
  116. <td style="text-align:center; border-left:3px solid white !important;background-color:{{$count % 2 == 0 ? 'white' : '#f2f4f7'}}">
  117. @if(isset($record[$p->name]["IN"]))
  118. <span class="tablesaw-cell-content " style="color:green">{{formatPrice($record[$p->name]["IN"])}}</span>
  119. @endif
  120. </td>
  121. <td style="text-align:center;background-color:{{$count % 2 == 0 ? 'white' : '#f2f4f7'}}">
  122. @if(isset($record[$p->name]["OUT"]))
  123. <span class="tablesaw-cell-content " style="color:red">{{formatPrice($record[$p->name]["OUT"])}}</span>
  124. @endif
  125. </td>
  126. @else
  127. <td style="border-left:3px solid white !important;background-color:{{$count % 2 == 0 ? 'white' : '#f2f4f7'}}"></td>
  128. <td style="background-color:{{$count % 2 == 0 ? 'white' : '#f2f4f7'}}"></td>
  129. @endif
  130. @endforeach
  131. </tr>
  132. @php
  133. $count++;
  134. @endphp
  135. @endforeach
  136. </tbody>
  137. <tfoot>
  138. <tr>
  139. <td></td>
  140. <td></td>
  141. <td></td>
  142. <td><b>Totale</b></td>
  143. @foreach($payments as $p)
  144. @if(isset($totals[$p->name]))
  145. <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>
  146. <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>
  147. @else
  148. <td style="text-align:center"><span class="tablesaw-cell-content primary" style="color:green; font-size:18px;"><b>{{formatPrice(0)}}</b></span></td>
  149. <td style="text-align:center"><span class="tablesaw-cell-content primary" style="color:red; font-size:18px;"><b>{{formatPrice(0)}}</b></span></td>
  150. @endif
  151. @endforeach
  152. </tr>
  153. <tr style="display:none">
  154. <td></td>
  155. <td><b>Differenza</b></td>
  156. @foreach($payments as $p)
  157. @if(isset($totals[$p->name]))
  158. @php
  159. $diff = $totals[$p->name]["IN"] - $totals[$p->name]["OUT"];
  160. @endphp
  161. @if($diff < 0)
  162. <td></td>
  163. @endif
  164. <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>
  165. @if($diff > 0)
  166. <td></td>
  167. @endif
  168. @else
  169. <td colspan="2" style="text-align:center"><b>{{formatPrice(0)}}</b></td>
  170. @endif
  171. @endforeach
  172. </tr>
  173. </tfoot>
  174. </table>
  175. <!--
  176. <div class="paginator d-flex justify-content-center">
  177. <nav aria-label="Page navigation example">
  178. <ul class="pagination">
  179. <li class="page-item">
  180. <a class="page-link" href="#" aria-label="Previous">
  181. <span aria-hidden="true"></span>
  182. </a>
  183. </li>
  184. <li class="page-item"><a class="page-link" href="#">1</a></li>
  185. <li class="page-item"><a class="page-link" href="#">2</a></li>
  186. <li class="page-item"><a class="page-link" href="#">3</a></li>
  187. <li class="page-item"><a class="page-link" href="#">3</a></li>
  188. <li class="page-item"><span class="more-page">...</span></li>
  189. <li class="page-item">
  190. <a class="page-link" href="#" aria-label="Next">
  191. <span aria-hidden="true"></span>
  192. </a>
  193. </li>
  194. </ul>
  195. </nav>
  196. </div>
  197. -->
  198. </section>
  199. </div>
  200. @push('scripts')
  201. <script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
  202. @endpush
  203. @push('scripts')
  204. <link href="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/css/select2.min.css" rel="stylesheet" />
  205. <style>
  206. .select2-container--default .select2-selection--single{
  207. background-color: #E9F0F5;
  208. border: 0.0625rem solid #DFE5EB;
  209. font-size: 0.75rem;
  210. }
  211. .select2-selection
  212. {
  213. height: 38px !important;
  214. }
  215. .select2-selection__rendered
  216. {
  217. padding-top:3px;
  218. }
  219. .select2 {
  220. width:100% !important;
  221. }
  222. .i{
  223. font-size:16px;
  224. font-weight:bold;
  225. }
  226. .cellBorder
  227. {
  228. border-left: 1px solid grey;
  229. }
  230. .select2-selection--multiple{
  231. overflow: hidden !important;
  232. height: auto !important;
  233. }
  234. .select2-container {
  235. box-sizing: border-box;
  236. display: inline-block;
  237. margin: 0;
  238. position: relative;
  239. vertical-align: middle;
  240. }
  241. .select2-container .select2-selection--single {
  242. box-sizing: border-box;
  243. cursor: pointer;
  244. display: block;
  245. height: 38px;
  246. user-select: none;
  247. -webkit-user-select: none;
  248. }
  249. .select2-container .select2-selection--single .select2-selection__rendered {
  250. display: block;
  251. padding-left: 8px;
  252. padding-right: 20px;
  253. overflow: hidden;
  254. text-overflow: ellipsis;
  255. white-space: nowrap;
  256. }
  257. </style>
  258. <script src="https://code.jquery.com/jquery-2.2.4.min.js" integrity="sha256-BbhdlvQf/xTY9gja0Dq3HiwQF8LaCRTXxZKRutelT44=" crossorigin="anonymous"></script>
  259. <script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js"></script>
  260. <script src="/assets/js/aCollapTable.js"></script>
  261. @endpush
  262. @push('scripts')
  263. <script>
  264. Livewire.on('load-table', () => {
  265. load();
  266. });
  267. function load()
  268. {
  269. $(document).ready(function(){
  270. $('.filterCausals').select2();
  271. $('.filterCausals').on('change', function (e) {
  272. var data = $('.filterCausals').select2("val");
  273. @this.set('filterCausals', data);
  274. });
  275. $('.filterMember').select2();
  276. $('.filterMember').on('change', function (e) {
  277. var data = $('.filterMember').select2("val");
  278. @this.set('filterMember', data);
  279. });
  280. });
  281. }
  282. Livewire.on('load-select', () => {
  283. $('.filterCausals').select2();
  284. $('.filterCausals').on('change', function (e) {
  285. var data = $('.filterCausals').select2("val");
  286. @this.set('filterCausals', data);
  287. });
  288. $('.filterMember').select2();
  289. $('.filterMember').on('change', function (e) {
  290. var data = $('.filterMember').select2("val");
  291. @this.set('filterMember', data);
  292. });
  293. });
  294. load();
  295. </script>
  296. @endpush
  297. @push('scripts')
  298. <script>
  299. function printData()
  300. {
  301. var divToPrint=document.getElementById("tablesaw-350");
  302. newWin= window.open("");
  303. var htmlToPrint = '' +
  304. '<style type="text/css">' +
  305. 'table th, table td {' +
  306. 'border:1px solid #000;' +
  307. 'padding:0.5em;' +
  308. '}' +
  309. '</style>';
  310. htmlToPrint += divToPrint.outerHTML;
  311. newWin.document.write(htmlToPrint);
  312. newWin.document.close();
  313. newWin.print();
  314. newWin.close();
  315. }
  316. document.querySelector("#print").addEventListener("click", function(){
  317. printData();
  318. });
  319. /*
  320. const chart = new Chart(
  321. document.getElementById('recordChart'), {
  322. type: 'line',
  323. data: {
  324. labels: @json($labels),
  325. datasets: @json($recordDatas)
  326. },
  327. options: {
  328. height:200,
  329. plugins: {
  330. legend: {
  331. position: 'bottom'
  332. }
  333. },
  334. responsive: true,
  335. elements: {
  336. line: {
  337. tension : 0.4 // smooth lines
  338. },
  339. },
  340. }
  341. }
  342. );
  343. Livewire.on('updateChart', data => {
  344. chart.data = data;
  345. chart.update();
  346. });
  347. */
  348. </script>
  349. @endpush