records.blade.php 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428
  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" class="scrollTable">
  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. .scrollTable {
  193. margin-left: 0px ;
  194. margin-right: 0px ;
  195. padding: 15px;
  196. /*max-width: 800px !important;*/
  197. overflow-x: auto;
  198. overflow-y: hidden;
  199. white-space: nowrap;
  200. border: 1px solid #ddd;
  201. }
  202. ::-webkit-scrollbar-thumb {
  203. background: #EDF0F2;
  204. border-radius: 10px;
  205. }
  206. table thead {
  207. /* Important */
  208. position: sticky;
  209. z-index: 100;
  210. top: 0;
  211. }
  212. .select2-container--default .select2-selection--single{
  213. background-color: #E9F0F5;
  214. border: 0.0625rem solid #DFE5EB;
  215. font-size: 0.75rem;
  216. }
  217. .select2-selection
  218. {
  219. height: 38px !important;
  220. }
  221. .select2-selection__rendered
  222. {
  223. padding-top:3px;
  224. }
  225. .select2 {
  226. width:100% !important;
  227. }
  228. .i{
  229. font-size:16px;
  230. font-weight:bold;
  231. }
  232. .cellBorder
  233. {
  234. border-left: 1px solid grey;
  235. }
  236. .select2-selection--multiple{
  237. overflow: hidden !important;
  238. height: auto !important;
  239. }
  240. .select2-container {
  241. box-sizing: border-box;
  242. display: inline-block;
  243. margin: 0;
  244. position: relative;
  245. vertical-align: middle;
  246. }
  247. .select2-container .select2-selection--single {
  248. box-sizing: border-box;
  249. cursor: pointer;
  250. display: block;
  251. height: 38px;
  252. user-select: none;
  253. -webkit-user-select: none;
  254. }
  255. .select2-container .select2-selection--single .select2-selection__rendered {
  256. display: block;
  257. padding-left: 8px;
  258. padding-right: 20px;
  259. overflow: hidden;
  260. text-overflow: ellipsis;
  261. white-space: nowrap;
  262. }
  263. </style>
  264. <script src="https://code.jquery.com/jquery-2.2.4.min.js" integrity="sha256-BbhdlvQf/xTY9gja0Dq3HiwQF8LaCRTXxZKRutelT44=" crossorigin="anonymous"></script>
  265. <script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js"></script>
  266. <script src="/assets/js/aCollapTable.js"></script>
  267. @endpush
  268. @push('scripts')
  269. <script>
  270. Livewire.on('load-table', () => {
  271. load();
  272. });
  273. function load()
  274. {
  275. $(document).ready(function(){
  276. $(document).on("keypress", $('.filterCausals'), 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. $('.filterCausals').select2({"language": {"noResults": function(){return "Nessun risultato";}}});
  286. $('.filterCausals').on('change', function (e) {
  287. var data = $('.filterCausals').select2("val");
  288. @this.set('filterCausals', data);
  289. });
  290. $('.filterCausals').on('select2:open', function (e) {
  291. setTimeout(() => {
  292. $(".select2-results__option").each(function(){
  293. var txt = $(this).html();
  294. var count = (txt.match(/-/g) || []).length;
  295. $(this).addClass('paddingLeftSelect' + count);
  296. });
  297. }, 100);
  298. });
  299. $('.filterMember').select2({"language": {"noResults": function(){return "Nessun risultato";}}});
  300. $('.filterMember').on('change', function (e) {
  301. var data = $('.filterMember').select2("val");
  302. @this.set('filterMember', data);
  303. });
  304. });
  305. }
  306. Livewire.on('load-select', () => {
  307. $('.filterCausals').select2({"language": {"noResults": function(){return "Nessun risultato";}}});
  308. $('.filterCausals').on('change', function (e) {
  309. var data = $('.filterCausals').select2("val");
  310. @this.set('filterCausals', data);
  311. });
  312. $('.filterMember').select2({"language": {"noResults": function(){return "Nessun risultato";}}});
  313. $('.filterMember').on('change', function (e) {
  314. var data = $('.filterMember').select2("val");
  315. @this.set('filterMember', data);
  316. });
  317. setMaxWidth();
  318. });
  319. load();
  320. </script>
  321. @endpush
  322. @push('scripts')
  323. <script>
  324. function printData()
  325. {
  326. var divToPrint=document.getElementById("tablesaw-350");
  327. newWin= window.open("");
  328. var htmlToPrint = '' +
  329. '<style type="text/css">' +
  330. 'table th, table td {' +
  331. 'border:1px solid #000;' +
  332. 'padding:0.5em;' +
  333. '}' +
  334. '</style>';
  335. htmlToPrint += divToPrint.outerHTML;
  336. newWin.document.write(htmlToPrint);
  337. newWin.document.close();
  338. newWin.print();
  339. newWin.close();
  340. }
  341. document.querySelector("#print").addEventListener("click", function(){
  342. printData();
  343. });
  344. $( document ).ready( function(){
  345. setMaxWidth();
  346. $( window ).bind( "resize", setMaxWidth ); //Remove this if it's not needed. It will react when window changes size.
  347. $(".open-filter").click(function(){
  348. setMaxWidth();
  349. });
  350. });
  351. function setMaxWidth() {
  352. $("#resume-table").width( Math.round( $(window ).width() - size ) ) ;
  353. }
  354. /*
  355. const chart = new Chart(
  356. document.getElementById('recordChart'), {
  357. type: 'line',
  358. data: {
  359. labels: @json($labels),
  360. datasets: @json($recordDatas)
  361. },
  362. options: {
  363. height:200,
  364. plugins: {
  365. legend: {
  366. position: 'bottom'
  367. }
  368. },
  369. responsive: true,
  370. elements: {
  371. line: {
  372. tension : 0.4 // smooth lines
  373. },
  374. },
  375. }
  376. }
  377. );
  378. Livewire.on('updateChart', data => {
  379. chart.data = data;
  380. chart.update();
  381. });
  382. */
  383. </script>
  384. @endpush