records.blade.php 16 KB

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