records_in_out.blade.php 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275
  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="1">Gennaio</option>
  14. <option value="2">Febbraio</option>
  15. <option value="3">Marzo</option>
  16. <option value="4">Aprile</option>
  17. <option value="5">Maggio</option>
  18. <option value="6">Giugno</option>
  19. <option value="7">Luglio</option>
  20. <option value="8">Agosto</option>
  21. <option value="9">Settembre</option>
  22. <option value="10">Ottobre</option>
  23. <option value="11">Novembre</option>
  24. <option value="12">Dicembre</option>
  25. </select>
  26. <select class="form-select " style="width:100px !important;" id="year">
  27. @for($y=date("Y"); $y>date("Y") - 2; $y--)
  28. <option value="{{$y}}">{{$y}}</option>
  29. @endfor
  30. </select>
  31. </form>
  32. @if(sizeof($columns) < 6)
  33. <button class="btn--ui show" style="margin-left:5px;">aggiungi</button>
  34. @endif
  35. <button class="btn--ui reset" wire:click="clear()" style="margin-left:5px;">reset</button>
  36. @if($showData)
  37. <button class="btn--ui reset" wire:click="export()" style="margin-left:5px;">esporta</button>
  38. <button class="btn--ui reset" wire:click="exportYear()" style="margin-left:5px;">esporta anno selezionato</button>
  39. @endif
  40. </section>
  41. <section id="resume-table">
  42. <div class="compare--chart_wrapper d-none"></div>
  43. <div class="row ">
  44. <div class="col-md-12">
  45. <h1>Entrate</h1>
  46. <table class="table tablesaw tablesaw-stack collaptableIN" >
  47. <thead>
  48. <tr>
  49. <th scope="col" style="width:20%;text-align:left"></th>
  50. @foreach($columns as $idx => $column)
  51. <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>
  52. @endforeach
  53. @for($j=sizeof($columns);$j<6;$j++)
  54. <th scope="col cellBorder" style="width:13%;text-align:center">&nbsp;</th>
  55. @endfor
  56. </tr>
  57. </thead>
  58. <tbody id="checkall-target">
  59. @foreach($rows_in as $in)
  60. <tr data-id="{{$in["id"]}}" data-parent="{{$in["parent_id"]}}">
  61. <td>{!!str_repeat("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;", $in["level"])!!}{{$in["name"]}}</td>
  62. @foreach($columns as $column)
  63. <td class="cellBorder" style="text-align:center">
  64. @if(isset($records_in[$column][$in["id"]]))
  65. <span class="tablesaw-cell-content {{$in["level"] == 0 ? 'primary' : ''}}">
  66. {{formatPrice($records_in[$column][$in["id"]])}}
  67. </span>
  68. @else
  69. &nbsp;
  70. @endif
  71. </td>
  72. @endforeach
  73. @for($j=sizeof($columns);$j<6;$j++)
  74. <td class="cellBorder">&nbsp;</th>
  75. @endfor
  76. </tr>
  77. @endforeach
  78. <tr>
  79. <td><b>Totale entrate mensili</b></td>
  80. @foreach($columns as $column)
  81. <td class="cellBorder" style="text-align:center">
  82. @php
  83. $total = 0;
  84. @endphp
  85. @foreach($rows_in as $in)
  86. @if(isset($records_in[$column][$in["id"]]) && $in["level"] == 0)
  87. @php
  88. $total += $records_in[$column][$in["id"]];
  89. @endphp
  90. @endif
  91. @endforeach
  92. <span class="tablesaw-cell-content primary" style="color:green"><b>{{formatPrice($total)}}</b></span>
  93. </td>
  94. @endforeach
  95. @for($j=sizeof($columns);$j<6;$j++)
  96. <td class="cellBorder">&nbsp;</th>
  97. @endfor
  98. </tr>
  99. </tbody>
  100. <tfoot>
  101. </tfoot>
  102. </table>
  103. </div>
  104. </div>
  105. <div class="row ">
  106. <div class="col-md-12">
  107. <h1>Uscite</h1>
  108. <table class="table tablesaw tablesaw-stack collaptableOUT">
  109. <thead>
  110. <tr>
  111. <th scope="col" style="width:20%;text-align:left"></th>
  112. @foreach($columns as $idx => $column)
  113. <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>
  114. @endforeach
  115. @for($j=sizeof($columns);$j<6;$j++)
  116. <th scope="col cellBorder" style="width:13%;text-align:center">&nbsp;</th>
  117. @endfor
  118. </tr>
  119. </thead>
  120. <tbody id="checkall-target">
  121. @foreach($rows_out as $out)
  122. <tr data-id="{{$out["id"] + 1000}}" data-parent="{{$out["parent_id"] != null ? ($out["parent_id"] + 1000) : 0}}">
  123. <td>{!!str_repeat("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;", $out["level"])!!}{{$out["name"]}}</td>
  124. @foreach($columns as $column)
  125. <td class="cellBorder" style="text-align:center">
  126. @if(isset($records_out[$column][$out["id"]]))
  127. <span class="tablesaw-cell-content {{$out["level"] == 0 ? 'primary' : ''}}">
  128. {{formatPrice($records_out[$column][$out["id"]])}}
  129. </span>
  130. @else
  131. &nbsp;
  132. @endif
  133. </td>
  134. @endforeach
  135. @for($j=sizeof($columns);$j<6;$j++)
  136. <td class="cellBorder">&nbsp;</th>
  137. @endfor
  138. </tr>
  139. @endforeach
  140. <tr>
  141. <td><b>Totale uscite mensili</b></td>
  142. @foreach($columns as $column)
  143. <td class="cellBorder" style="text-align:center">
  144. @php
  145. $total = 0;
  146. @endphp
  147. @foreach($rows_out as $out)
  148. @if(isset($records_out[$column][$out["id"]]) && $out["level"] == 0)
  149. @php
  150. $total += $records_out[$column][$out["id"]];
  151. @endphp
  152. @endif
  153. @endforeach
  154. <span class="tablesaw-cell-content primary" style="color:red"><b>{{formatPrice($total)}}</b></span>
  155. </td>
  156. @endforeach
  157. @for($j=sizeof($columns);$j<6;$j++)
  158. <td class="cellBorder">&nbsp;</th>
  159. @endfor
  160. </tr>
  161. </tbody>
  162. <tfoot>
  163. </tfoot>
  164. </table>
  165. </div>
  166. </div>
  167. </section>
  168. </div>
  169. </div>
  170. </div>
  171. @push('scripts')
  172. <link href="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/css/select2.min.css" rel="stylesheet" />
  173. <style>
  174. .select2-container--default .select2-selection--single{
  175. background-color: #E9F0F5;
  176. border: 0.0625rem solid #DFE5EB;
  177. font-size: 0.75rem;
  178. }
  179. .select2-selection
  180. {
  181. height: 38px !important;
  182. }
  183. .select2-selection__rendered
  184. {
  185. padding-top:3px;
  186. }
  187. .select2 {
  188. width:100% !important;
  189. }
  190. .i{
  191. font-size:16px;
  192. font-weight:bold;
  193. }
  194. .cellBorder
  195. {
  196. border-left: 1px solid grey;
  197. }
  198. </style>
  199. <script src="https://code.jquery.com/jquery-2.2.4.min.js" integrity="sha256-BbhdlvQf/xTY9gja0Dq3HiwQF8LaCRTXxZKRutelT44=" crossorigin="anonymous"></script>
  200. <script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js"></script>
  201. <script src="/assets/js/aCollapTable.js"></script>
  202. @endpush
  203. @push('scripts')
  204. <script>
  205. Livewire.on('load-table', () => {
  206. load();
  207. });
  208. function load()
  209. {
  210. $(document).ready(function(){
  211. $('.collaptableIN').aCollapTable({
  212. startCollapsed: true,
  213. addColumn: false,
  214. plusButton: '<span class="i"> + </span>',
  215. minusButton: '<span class="i"> - </span>'
  216. });
  217. $('.collaptableOUT').aCollapTable({
  218. startCollapsed: true,
  219. addColumn: false,
  220. plusButton: '<span class="i"> + </span>',
  221. minusButton: '<span class="i"> - </span>'
  222. });
  223. $(".act-button-collapse-all").trigger('click');
  224. });
  225. }
  226. load();
  227. $(document).on("click", ".show", function () {
  228. var m = $('#month').val();
  229. var y = $('#year').val();
  230. @this.show(m, y);
  231. });
  232. </script>
  233. @endpush