records_in_out.blade.php 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373
  1. <div class="col">
  2. <div class="row h-100">
  3. <div class="col card--ui" id="card--dashboard">
  4. <header id="title--section" class="d-flex align-items-center justify-content-between">
  5. <div class="title--section_name d-flex align-items-center justify-content-between">
  6. <i class="ico--ui title_section utenti me-2"></i>
  7. <h2 class="primary">Entrate/uscite gestionale</h2>
  8. </div>
  9. </header>
  10. <section id="subheader" class="d-flex align-items-center ">
  11. <form action="" class=" d-flex align-items-center ">
  12. <select class="form-select form-select-lg me-1 " id="month" style="width:150px !important;">
  13. <option value="x" {{$month == "x" ? 'selected' : ""}}>Anno completo</option>
  14. <option value="1" {{$month == "1" ? 'selected' : ""}}>Gennaio</option>
  15. <option value="2" {{$month == "2" ? 'selected' : ""}}>Febbraio</option>
  16. <option value="3" {{$month == "3" ? 'selected' : ""}}>Marzo</option>
  17. <option value="4" {{$month == "4" ? 'selected' : ""}}>Aprile</option>
  18. <option value="5" {{$month == "5" ? 'selected' : ""}}>Maggio</option>
  19. <option value="6" {{$month == "6" ? 'selected' : ""}}>Giugno</option>
  20. <option value="7" {{$month == "7" ? 'selected' : ""}}>Luglio</option>
  21. <option value="8" {{$month == "8" ? 'selected' : ""}}>Agosto</option>
  22. <option value="9" {{$month == "9" ? 'selected' : ""}}>Settembre</option>
  23. <option value="10" {{$month == "10" ? 'selected' : ""}}>Ottobre</option>
  24. <option value="11" {{$month == "11" ? 'selected' : ""}}>Novembre</option>
  25. <option value="12" {{$month == "12" ? 'selected' : ""}}>Dicembre</option>
  26. </select>
  27. <select class="form-select " style="width:100px !important;" id="year">
  28. @for($y=date("Y"); $y>date("Y") - 2; $y--)
  29. <option value="{{$y}}">{{$y}}</option>
  30. @endfor
  31. </select>
  32. </form>
  33. @if(sizeof($columns) < 6)
  34. <button class="btn--ui show" style="margin-left:5px;">aggiungi</button>
  35. @endif
  36. <button class="btn--ui reset" wire:click="clear()" style="margin-left:5px;">reset</button>
  37. @if($showData)
  38. <button class="btn--ui reset" wire:click="export()" style="margin-left:5px;">esporta</button>
  39. <button class="btn--ui reset exportYear" style="margin-left:5px;">esporta anno fiscale selezionato</button>
  40. @endif
  41. </section>
  42. <section id="resume-table">
  43. <div class="compare--chart_wrapper d-none"></div>
  44. <div class="row ">
  45. <div class="col-md-12">
  46. <h1>Entrate</h1>
  47. <div class="row ">
  48. <div class="col-md-2">
  49. Filtra per causale
  50. </div>
  51. <div class="col-md-4 m-1">
  52. <select name="search_causal_id[]" class="form-select filterCausalsIn" multiple="multiple" wire:model="filterCausalsIn">
  53. @foreach($causalsIn as $causal)
  54. <option value="{{$causal["id"]}}">{!!$causal["name"]!!}
  55. @endforeach
  56. </select>
  57. </div>
  58. </div>
  59. <table class="table tablesaw tablesaw-stack collaptableIN" >
  60. <thead>
  61. <tr>
  62. <th scope="col" style="width:20%;text-align:left"></th>
  63. @foreach($columns as $idx => $column)
  64. <th scope="col cellBorder" style="width:13%;text-align:center">{{$this->getMonth($column)}} <br><a href="#" wire:click="remove({{$idx}})"><i class="fa fa-trash" aria-hidden="true" style="color:red"></i></a></th>
  65. @endforeach
  66. @for($j=sizeof($columns);$j<6;$j++)
  67. <th scope="col cellBorder" style="width:13%;text-align:center">&nbsp;</th>
  68. @endfor
  69. </tr>
  70. </thead>
  71. <tbody id="checkall-target">
  72. @foreach($rows_in as $in)
  73. @if($filterCausalsIn == null || (sizeof($filterCausalsIn) == 0 || in_array($in["id"], $filterCausalsIn) || in_array($in["parent_id"], $filterCausalsIn) || in_array($in["first_parent_id"], $filterCausalsIn)))
  74. <tr data-id="{{$in["id"]}}" data-parent="{{$in["parent_id"]}}">
  75. <td>{!!str_repeat("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;", $in["level"])!!}{{$in["name"]}}</td>
  76. @foreach($columns as $column)
  77. <td class="cellBorder" style="text-align:center">
  78. @if(isset($records_in[$column][$in["id"]]))
  79. <span class="tablesaw-cell-content {{$in["level"] == 0 ? 'primary' : ''}}" {{$in["level"] == 0 ? 'style=""' : 'font-weight:bold;'}}>
  80. {{formatPrice($records_in[$column][$in["id"]])}}
  81. </span>
  82. @else
  83. &nbsp;
  84. @endif
  85. </td>
  86. @endforeach
  87. @for($j=sizeof($columns);$j<6;$j++)
  88. <td class="cellBorder">&nbsp;</th>
  89. @endfor
  90. </tr>
  91. @endif
  92. @endforeach
  93. <tr>
  94. <td><b>Totale entrate mensili</b></td>
  95. @foreach($columns as $column)
  96. <td class="cellBorder" style="text-align:center">
  97. @php
  98. $total = 0;
  99. @endphp
  100. @foreach($rows_in as $in)
  101. @if($filterCausalsIn == null || (sizeof($filterCausalsIn) == 0 || in_array($in["id"], $filterCausalsIn)))
  102. @if(isset($records_in[$column][$in["id"]]) && $in["level"] == 0)
  103. @php
  104. $total += $records_in[$column][$in["id"]];
  105. @endphp
  106. @endif
  107. @endif
  108. @endforeach
  109. <span class="tablesaw-cell-content primary" style="color:green; font-size:18px;"><b>{{formatPrice($total)}}</b></span>
  110. </td>
  111. @endforeach
  112. @for($j=sizeof($columns);$j<6;$j++)
  113. <td class="cellBorder">&nbsp;</th>
  114. @endfor
  115. </tr>
  116. </tbody>
  117. <tfoot>
  118. </tfoot>
  119. </table>
  120. </div>
  121. </div>
  122. <div class="row ">
  123. <div class="col-md-12">
  124. <h1>Uscite</h1>
  125. <div class="row ">
  126. <div class="col-md-2">
  127. <label class="form-label">Filtra per causale</label>
  128. </div>
  129. <div class="col-md-4 m-1">
  130. <select name="search_causal_id_x[]" class="form-select filterCausalsOut" multiple="multiple" wire:model="filterCausalsOut">
  131. @foreach($causalsOut as $causal)
  132. <option value="{{$causal["id"]}}">{!!$causal["name"]!!}
  133. @endforeach
  134. </select>
  135. </div>
  136. </div>
  137. <table class="table tablesaw tablesaw-stack collaptableOUT">
  138. <thead>
  139. <tr>
  140. <th scope="col" style="width:20%;text-align:left"></th>
  141. @foreach($columns as $idx => $column)
  142. <th scope="col cellBorder" style="width:13%;text-align:center">{{$this->getMonth($column)}} <br><a href="#" wire:click="remove({{$idx}})"><i class="fa fa-trash" aria-hidden="true" style="color:red"></i></a></th>
  143. @endforeach
  144. @for($j=sizeof($columns);$j<6;$j++)
  145. <th scope="col cellBorder" style="width:13%;text-align:center">&nbsp;</th>
  146. @endfor
  147. </tr>
  148. </thead>
  149. <tbody id="checkall-target">
  150. @foreach($rows_out as $out)
  151. @if($filterCausalsOut == null || (sizeof($filterCausalsOut) == 0 || in_array($out["id"], $filterCausalsOut)))
  152. <tr data-id="{{$out["id"] + 1000}}" data-parent="{{$out["parent_id"] != null ? ($out["parent_id"] + 1000) : 0}}">
  153. <td>{!!str_repeat("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;", $out["level"])!!}{{$out["name"]}}</td>
  154. @foreach($columns as $column)
  155. <td class="cellBorder" style="text-align:center">
  156. @if(isset($records_out[$column][$out["id"]]))
  157. <span class="tablesaw-cell-content {{$out["level"] == 0 ? 'primary' : ''}}" {{$out["level"] == 0 ? 'style=""' : 'font-weight:bold;'}}>
  158. {{formatPrice($records_out[$column][$out["id"]])}}
  159. </span>
  160. @else
  161. &nbsp;
  162. @endif
  163. </td>
  164. @endforeach
  165. @for($j=sizeof($columns);$j<6;$j++)
  166. <td class="cellBorder">&nbsp;</th>
  167. @endfor
  168. </tr>
  169. @endif
  170. @endforeach
  171. <tr>
  172. <td><b>Totale uscite mensili</b></td>
  173. @foreach($columns as $column)
  174. <td class="cellBorder" style="text-align:center">
  175. @php
  176. $total = 0;
  177. @endphp
  178. @foreach($rows_out as $out)
  179. @if($filterCausalsOut == null || (sizeof($filterCausalsOut) == 0 || in_array($out["id"], $filterCausalsOut)))
  180. @if(isset($records_out[$column][$out["id"]]) && $out["level"] == 0)
  181. @php
  182. $total += $records_out[$column][$out["id"]];
  183. @endphp
  184. @endif
  185. @endif
  186. @endforeach
  187. <span class="tablesaw-cell-content primary" style="color:red; font-size:18px;"><b>{{formatPrice($total)}}</b></span>
  188. </td>
  189. @endforeach
  190. @for($j=sizeof($columns);$j<6;$j++)
  191. <td class="cellBorder">&nbsp;</th>
  192. @endfor
  193. </tr>
  194. </tbody>
  195. <tfoot>
  196. </tfoot>
  197. </table>
  198. </div>
  199. </div>
  200. </section>
  201. <a style="display:none" href="javascript:void(0);" id="collapseAll" class="act-button-collapse-all">Collapse All</a>
  202. </div>
  203. </div>
  204. </div>
  205. @push('scripts')
  206. <link href="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/css/select2.min.css" rel="stylesheet" />
  207. <style>
  208. .select2-container--default .select2-selection--single{
  209. background-color: #E9F0F5;
  210. border: 0.0625rem solid #DFE5EB;
  211. font-size: 0.75rem;
  212. }
  213. .select2-selection
  214. {
  215. height: 38px !important;
  216. }
  217. .select2-selection__rendered
  218. {
  219. padding-top:3px;
  220. }
  221. .select2 {
  222. width:100% !important;
  223. }
  224. .i{
  225. font-size:16px;
  226. font-weight:bold;
  227. }
  228. .cellBorder
  229. {
  230. border-left: 1px solid grey;
  231. }
  232. .select2-selection--multiple{
  233. overflow: hidden !important;
  234. height: auto !important;
  235. }
  236. .select2-container {
  237. box-sizing: border-box;
  238. display: inline-block;
  239. margin: 0;
  240. position: relative;
  241. vertical-align: middle;
  242. }
  243. .select2-container .select2-selection--single {
  244. box-sizing: border-box;
  245. cursor: pointer;
  246. display: block;
  247. height: 38px;
  248. user-select: none;
  249. -webkit-user-select: none;
  250. }
  251. .select2-container .select2-selection--single .select2-selection__rendered {
  252. display: block;
  253. padding-left: 8px;
  254. padding-right: 20px;
  255. overflow: hidden;
  256. text-overflow: ellipsis;
  257. white-space: nowrap;
  258. }
  259. </style>
  260. <script src="https://code.jquery.com/jquery-2.2.4.min.js" integrity="sha256-BbhdlvQf/xTY9gja0Dq3HiwQF8LaCRTXxZKRutelT44=" crossorigin="anonymous"></script>
  261. <script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js"></script>
  262. <script src="/assets/js/aCollapTable.js"></script>
  263. @endpush
  264. @push('scripts')
  265. <script>
  266. Livewire.on('load-table', () => {
  267. load();
  268. });
  269. function load()
  270. {
  271. $(document).ready(function(){
  272. $('.filterCausalsIn').select2();
  273. $('.filterCausalsIn').on('change', function (e) {
  274. var data = $('.filterCausalsIn').select2("val");
  275. @this.set('filterCausalsIn', data);
  276. });
  277. $('.filterCausalsOut').select2();
  278. $('.filterCausalsOut').on('change', function (e) {
  279. var data = $('.filterCausalsOut').select2("val");
  280. @this.set('filterCausalsOut', data);
  281. });
  282. $('.collaptableIN').aCollapTable({
  283. startCollapsed: true,
  284. addColumn: false,
  285. plusButton: '<span class="i"> + </span>',
  286. minusButton: '<span class="i"> - </span>'
  287. });
  288. $('.collaptableOUT').aCollapTable({
  289. startCollapsed: true,
  290. addColumn: false,
  291. plusButton: '<span class="i"> + </span>',
  292. minusButton: '<span class="i"> - </span>'
  293. });
  294. $("#collapseAll").trigger("click")
  295. });
  296. }
  297. Livewire.on('load-select', () => {
  298. $('.filterCausalsIn').select2();
  299. $('.filterCausalsIn').on('change', function (e) {
  300. var data = $('.filterCausalsIn').select2("val");
  301. @this.set('filterCausalsIn', data);
  302. });
  303. $('.filterCausalsOut').select2();
  304. $('.filterCausalsOut').on('change', function (e) {
  305. var data = $('.filterCausalsOut').select2("val");
  306. @this.set('filterCausalsOut', data);
  307. });
  308. });
  309. load();
  310. $(document).on("click", ".show", function () {
  311. var m = $('#month').val();
  312. var y = $('#year').val();
  313. @this.show(m, y);
  314. });
  315. $(document).on("click", ".exportYear", function () {
  316. var y = $('#year').val();
  317. @this.exportYear(y);
  318. });
  319. </script>
  320. @endpush