records.blade.php 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666
  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. <div class="row g-3">
  10. <div class="col-md-3">
  11. Utente
  12. <select name="search_member_id" class="form-select filterMember" wire:model="filterMember">
  13. <option value="">--Seleziona--
  14. @foreach($members as $member)
  15. <option value="{{$member->id}}">{{$member->last_name}} {{$member->first_name}}
  16. @endforeach
  17. </select>
  18. </div>
  19. <div class="col-md-4">
  20. Causale
  21. <select name="search_causal_id[]" class="form-select filterCausals me-2" multiple="multiple" wire:model="filterCausals">
  22. @foreach($causals as $causal)
  23. <option value="{{$causal["id"]}}">{!!$causal["name"]!!}
  24. @endforeach
  25. </select>
  26. </div>
  27. <div class="col-md-3">
  28. Periodo
  29. <select wire:model="selectedPeriod" class="form-select" @if($isFiltering) disabled @endif style="height: 38px;">
  30. <option value="OGGI">Oggi</option>
  31. <option value="IERI">Ieri</option>
  32. <option value="MESE CORRENTE">Mese Corrente</option>
  33. <option value="MESE PRECEDENTE">Mese Precedente</option>
  34. <option value="ULTIMO TRIMESTRE">Ultimo Trimestre</option>
  35. <option value="ULTIMO QUADRIMESTRE">Ultimo Quadrimestre</option>
  36. </select>
  37. </div>
  38. <div class="col-md-2">
  39. <div class="prima--nota_buttons ms-auto" style="float:right; margin-top:25px;">
  40. <button class="btn--ui primary" wire:click="applyFilters" style="margin-right:5px;" @if($isFiltering) disabled @endif>
  41. @if($isFiltering)
  42. <i class="fas fa-spinner fa-spin"></i> CARICAMENTO...
  43. @else
  44. FILTRA
  45. @endif
  46. </button>
  47. <button class="btn--ui lightGrey reset reset" style="margin-left:5px;color:#10172A;" wire:click="resetFilters" @if($isFiltering) disabled @endif>RESET</button>
  48. </div>
  49. </div>
  50. </div>
  51. <div style="float:left; margin-top:10px; margin-bottom:10px;">
  52. <div class="dropdown">
  53. <button class="btn--ui_outline light dropdown-toggle" type="button" id="exportDropdown" data-bs-toggle="dropdown" aria-expanded="false"
  54. style="color:#10172A;" @if($isFiltering) disabled @endif>
  55. ESPORTA
  56. </button>
  57. <ul class="dropdown-menu" aria-labelledby="exportDropdown">
  58. <li><a class="dropdown-item" href="#" wire:click="export()">Excel</a></li>
  59. <li><a class="dropdown-item" href="#" id="print">Stampa</a></li>
  60. </ul>
  61. </div>
  62. </div>
  63. </section>
  64. <section id="resume-table" class="scrollTable records-table" style="position: relative;">
  65. @if($isFiltering)
  66. <div class="loading-overlay">
  67. <div class="loading-content">
  68. <i class="fas fa-spinner fa-spin fa-3x"></i>
  69. <p>Caricamento dati in corso...</p>
  70. </div>
  71. </div>
  72. @endif
  73. <table class="table tablesaw tableHead tablesaw-stack" id="tablesaw-350" width="100%">
  74. <thead>
  75. <tr>
  76. <th scope="col">Data</th>
  77. <th scope="col" style="border-left:3px solid white;">Tipo</th>
  78. <th scope="col" style="border-left:3px solid white;">Causale</th>
  79. <th scope="col" style="border-left:3px solid white;">Stato</th>
  80. <th scope="col" style="border-left:3px solid white;">Nominativo</th>
  81. @foreach($payments as $p)
  82. <th colspan="2" scope="col" style="text-align:center; border-left:3px solid white;">{{$p->name}}</th>
  83. @endforeach
  84. </tr>
  85. <tr>
  86. <th scope="col"></th>
  87. <th scope="col" style="border-left:3px solid white;"></th>
  88. <th scope="col" style="border-left:3px solid white;"></th>
  89. <th scope="col" style="border-left:3px solid white;"></th>
  90. <th scope="col" style="border-left:3px solid white;"></th>
  91. @foreach($payments as $p)
  92. @if($p->type == 'ALL')
  93. <th scope="col" style="text-align:center; border-left:3px solid white;">Entrate</th>
  94. <th scope="col" style="text-align:center">Uscite</th>
  95. @elseif($p->type == 'IN')
  96. <th scope="col" style="text-align:center; border-left:3px solid white;">Entrate</th>
  97. <th scope="col" style="text-align:center;"></th>
  98. @elseif($p->type == 'OUT')
  99. <th style="border-left:3px solid white;"></th>
  100. <th scope="col" style="text-align:center;">Uscite</th>
  101. @endif
  102. @endforeach
  103. </tr>
  104. </thead>
  105. <tbody id="checkall-target">
  106. @php $count = 0; @endphp
  107. @foreach($records as $causal => $record)
  108. <tr>
  109. @php
  110. $parts = explode("§", $causal);
  111. $d = $parts[0] ?? '';
  112. $c = $parts[1] ?? '';
  113. $n = $parts[2] ?? '';
  114. $det = $parts[3] ?? '';
  115. $del = $parts[4] ?? '';
  116. $detailParts = explode('|', $det);
  117. $isMultiple = count($detailParts) > 1;
  118. $displayDetail = $isMultiple ? 'Varie' : $det;
  119. @endphp
  120. <td style="background-color:{{$count % 2 == 0 ? 'white' : '#f2f4f7'}}">{{date("d/m/Y", strtotime($d))}}</td>
  121. <td style="border-left:3px solid white !important;background-color:{{$count % 2 == 0 ? 'white' : '#f2f4f7'}}">{{$c}}</td>
  122. <td style="border-left:3px solid white !important;background-color:{{$count % 2 == 0 ? 'white' : '#f2f4f7'}}">
  123. @if($isMultiple)
  124. <span class="varie-link" data-causals="{{implode('|', array_slice($detailParts, 1))}}" style="color: #0C6197; cursor: pointer; text-decoration: underline;">
  125. {{$displayDetail}}
  126. </span>
  127. @else
  128. {{$displayDetail}}
  129. @endif
  130. </td>
  131. <td style="border-left:3px solid white !important;background-color:{{$count % 2 == 0 ? 'white' : '#f2f4f7'}}">
  132. @if($del == 'DELETED')
  133. <span style='color:red'>Annullata</span>
  134. @endif
  135. </td>
  136. <td style="border-left:3px solid white !important;background-color:{{$count % 2 == 0 ? 'white' : '#f2f4f7'}}">{{$n}}</td>
  137. @foreach($payments as $p)
  138. @if(isset($record[$p->name]))
  139. <td style="text-align:right; border-left:3px solid white !important;background-color:{{$count % 2 == 0 ? 'white' : '#f2f4f7'}}">
  140. @if(isset($record[$p->name]["IN"]))
  141. <span class="tablesaw-cell-content " style="color:green">{{formatPrice($record[$p->name]["IN"])}}</span>
  142. @endif
  143. </td>
  144. <td style="text-align:right;background-color:{{$count % 2 == 0 ? 'white' : '#f2f4f7'}}">
  145. @if(isset($record[$p->name]["OUT"]))
  146. <span class="tablesaw-cell-content " style="color:red">{{formatPrice($record[$p->name]["OUT"])}}</span>
  147. @endif
  148. </td>
  149. @else
  150. <td style="border-left:3px solid white !important;background-color:{{$count % 2 == 0 ? 'white' : '#f2f4f7'}}"></td>
  151. <td style="background-color:{{$count % 2 == 0 ? 'white' : '#f2f4f7'}}"></td>
  152. @endif
  153. @endforeach
  154. </tr>
  155. @php $count++; @endphp
  156. @endforeach
  157. </tbody>
  158. <tfoot>
  159. <tr>
  160. <td></td>
  161. <td></td>
  162. <td></td>
  163. <td></td>
  164. <td><b>Totale</b></td>
  165. @foreach($payments as $p)
  166. @if(isset($totals[$p->name]))
  167. @if($p->type == 'ALL')
  168. <td style="text-align:right"><span class="tablesaw-cell-content primary" style="color:green; font-size:18px;"><b>{{formatPrice(isset($totals[$p->name]) ? $totals[$p->name]["IN"] : 0)}}</b></span></td>
  169. <td style="text-align:right"><span class="tablesaw-cell-content primary" style="color:red; font-size:18px;"><b>{{formatPrice(isset($totals[$p->name]) ? $totals[$p->name]["OUT"] : 0)}}</b></span></td>
  170. @elseif($p->type == 'IN')
  171. <td style="text-align:right"><span class="tablesaw-cell-content primary" style="color:green; font-size:18px;"><b>{{formatPrice(isset($totals[$p->name]) ? $totals[$p->name]["IN"] : 0)}}</b></span></td>
  172. <td style="text-align:right"><span class="tablesaw-cell-content primary" style="color:red; font-size:18px;"><b>&nbsp;</b></span></td>
  173. @elseif($p->type == 'OUT')
  174. <td style="text-align:right"><span class="tablesaw-cell-content primary" style="color:green; font-size:18px;"><b>&nbsp;</b></span></td>
  175. <td style="text-align:right"><span class="tablesaw-cell-content primary" style="color:red; font-size:18px;"><b>{{formatPrice(isset($totals[$p->name]) ? $totals[$p->name]["OUT"] : 0)}}</b></span></td>
  176. @endif
  177. @else
  178. @if($p->type == 'ALL')
  179. <td style="text-align:right"><span class="tablesaw-cell-content primary" style="color:green; font-size:18px;"><b>{{formatPrice(isset($totals[$p->name]) ? $totals[$p->name]["IN"] : 0)}}</b></span></td>
  180. <td style="text-align:right"><span class="tablesaw-cell-content primary" style="color:red; font-size:18px;"><b>{{formatPrice(isset($totals[$p->name]) ? $totals[$p->name]["OUT"] : 0)}}</b></span></td>
  181. @elseif($p->type == 'IN')
  182. <td style="text-align:right"><span class="tablesaw-cell-content primary" style="color:green; font-size:18px;"><b>{{formatPrice(isset($totals[$p->name]) ? $totals[$p->name]["IN"] : 0)}}</b></span></td>
  183. <td style="text-align:center"><span class="tablesaw-cell-content primary" style="color:red; font-size:18px;"><b>&nbsp;</b></span></td>
  184. @elseif($p->type == 'OUT')
  185. <td style="text-align:right"><span class="tablesaw-cell-content primary" style="color:green; font-size:18px;"><b>&nbsp;</b></span></td>
  186. <td style="text-align:center"><span class="tablesaw-cell-content primary" style="color:red; font-size:18px;"><b>{{formatPrice(isset($totals[$p->name]) ? $totals[$p->name]["OUT"] : 0)}}</b></span></td>
  187. @endif
  188. @endif
  189. @endforeach
  190. </tr>
  191. <tr style="display:none">
  192. <td></td>
  193. <td><b>Differenza</b></td>
  194. @foreach($payments as $p)
  195. @if(isset($totals[$p->name]))
  196. @php
  197. $diff = $totals[$p->name]["IN"] - $totals[$p->name]["OUT"];
  198. @endphp
  199. @if($diff < 0)
  200. <td></td>
  201. @endif
  202. <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>
  203. @if($diff > 0)
  204. <td></td>
  205. @endif
  206. @else
  207. <td colspan="2" style="text-align:right"><b>{{formatPrice(0)}}</b></td>
  208. @endif
  209. @endforeach
  210. </tr>
  211. </tfoot>
  212. </table>
  213. <button type="button" class="btn btn-floating btn-lg" id="btn-back-to-bottom"><i class="fas fa-arrow-down"></i></button>
  214. <button type="button" class="btn btn-floating btn-lg" id="btn-back-to-top"><i class="fas fa-arrow-up"></i></button>
  215. </section>
  216. <div class="modal fade" id="causalsModal" tabindex="-1" aria-labelledby="causalsModalLabel" aria-hidden="true">
  217. <div class="modal-dialog modal-lg">
  218. <div class="modal-content">
  219. <div class="modal-header" style="background-color: #0C6197!important;">
  220. <h5 class="modal-title" id="causalsModalLabel">Dettaglio Causali</h5>
  221. <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="CHIUDI"></button>
  222. </div>
  223. <div class="modal-body">
  224. <div class="row">
  225. <div class="col-12">
  226. <h6>Causali incluse:</h6>
  227. <ul id="causalsList" class="list-group list-group-flush">
  228. </ul>
  229. </div>
  230. </div>
  231. </div>
  232. <div class="modal-footer" style="background-color: #FFF!important;">
  233. <button type="button" class="btn--ui lightGrey me-2" data-bs-dismiss="modal">CHIUDI</button>
  234. </div>
  235. </div>
  236. </div>
  237. </div>
  238. </div>
  239. @push('scripts')
  240. <script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
  241. @endpush
  242. @push('scripts')
  243. <link href="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/css/select2.min.css" rel="stylesheet" />
  244. <style>
  245. .loading-overlay {
  246. position: absolute;
  247. top: 0;
  248. left: 0;
  249. right: 0;
  250. bottom: 0;
  251. background-color: rgba(255, 255, 255, 0.9);
  252. display: flex;
  253. justify-content: center;
  254. align-items: center;
  255. z-index: 1000;
  256. border-radius: 4px;
  257. }
  258. .loading-content {
  259. text-align: center;
  260. color: #0C6197;
  261. }
  262. .loading-content i {
  263. margin-bottom: 15px;
  264. color: #0C6197;
  265. }
  266. .loading-content p {
  267. margin: 0;
  268. font-size: 16px;
  269. font-weight: 500;
  270. color: #10172A;
  271. }
  272. .modal {
  273. z-index: 9999 !important;
  274. }
  275. .modal-backdrop {
  276. z-index: 9998 !important;
  277. background-color: rgba(0, 0, 0, 0.6) !important;
  278. }
  279. .modal-content {
  280. border-radius: 8px;
  281. border: none;
  282. box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  283. z-index: 10000 !important;
  284. }
  285. .modal-header {
  286. color: white;
  287. border-bottom: none;
  288. border-radius: 8px 8px 0 0;
  289. }
  290. .modal-header .btn-close {
  291. filter: invert(1);
  292. }
  293. .modal-title {
  294. font-weight: 600;
  295. }
  296. .varie-link:hover {
  297. color: #084c6b !important;
  298. text-decoration: underline !important;
  299. }
  300. #btn-back-to-top {
  301. background-color: #0C6197;
  302. color: white;
  303. position: fixed;
  304. display: none;
  305. }
  306. #btn-back-to-bottom {
  307. background-color: #0C6197;
  308. color: white;
  309. position: fixed;
  310. z-index: 9999;
  311. display: none;
  312. }
  313. button[disabled] {
  314. opacity: 0.7;
  315. cursor: not-allowed;
  316. }
  317. .btn--ui .fa-spinner {
  318. margin-right: 5px;
  319. }
  320. .scrollTable {
  321. margin-left: 0px;
  322. margin-right: 0px;
  323. padding: 15px;
  324. overflow-x: auto;
  325. overflow-y: auto;
  326. white-space: nowrap;
  327. border: 1px solid #ddd;
  328. }
  329. ::-webkit-scrollbar-thumb {
  330. background: #e4e4e4;
  331. border-radius: 10px;
  332. }
  333. table thead {
  334. position: sticky;
  335. z-index: 100;
  336. top: 0;
  337. }
  338. .select2-container--default .select2-selection--single {
  339. background-color: #E9F0F5;
  340. border: 0.0625rem solid #DFE5EB;
  341. font-size: 0.75rem;
  342. height: 38px !important;
  343. }
  344. .select2-selection__rendered {
  345. padding-top: 3px;
  346. }
  347. .select2 {
  348. width: 100% !important;
  349. }
  350. .select2-selection--multiple {
  351. overflow: hidden !important;
  352. height: auto !important;
  353. }
  354. .select2-container {
  355. box-sizing: border-box;
  356. display: inline-block;
  357. margin: 0;
  358. position: relative;
  359. vertical-align: middle;
  360. z-index: 999 !important;
  361. }
  362. .select2-dropdown {
  363. z-index: 999 !important;
  364. }
  365. .select2-container .select2-selection--single {
  366. box-sizing: border-box;
  367. cursor: pointer;
  368. display: block;
  369. height: 38px;
  370. user-select: none;
  371. -webkit-user-select: none;
  372. }
  373. .select2-container .select2-selection--single .select2-selection__rendered {
  374. display: block;
  375. padding-left: 8px;
  376. padding-right: 20px;
  377. overflow: hidden;
  378. text-overflow: ellipsis;
  379. white-space: nowrap;
  380. }
  381. button#exportDropdown.btn--ui_outline.light {
  382. font-weight: normal !important;
  383. }
  384. .btn--ui_outline.light.dropdown-toggle:active,
  385. .btn--ui_outline.light.dropdown-toggle:focus,
  386. .btn--ui_outline.light.dropdown-toggle.show {
  387. background-color: transparent !important;
  388. color: #10172A !important;
  389. box-shadow: none !important;
  390. }
  391. .btn--ui_outline.light.dropdown-toggle:hover {
  392. background-color: transparent !important;
  393. color: #10172A !important;
  394. }
  395. .form-select {
  396. height: 38px !important;
  397. }
  398. body.modal-open {
  399. overflow: hidden;
  400. }
  401. .modal-dialog {
  402. z-index: 10001 !important;
  403. margin: 1.75rem auto;
  404. }
  405. .list-group-item {
  406. border-left: none;
  407. border-right: none;
  408. border-top: 1px solid #dee2e6;
  409. padding: 12px 15px;
  410. }
  411. .list-group-item:first-child {
  412. border-top: none;
  413. }
  414. .list-group-item:last-child {
  415. border-bottom: none;
  416. }
  417. @media (max-width: 768px) {
  418. .col-md-2, .col-md-3, .col-md-4 {
  419. margin-bottom: 10px;
  420. }
  421. .prima--nota_buttons {
  422. float: none !important;
  423. margin-top: 10px !important;
  424. text-align: center;
  425. }
  426. }
  427. </style>
  428. <script src="https://code.jquery.com/jquery-2.2.4.min.js" integrity="sha256-BbhdlvQf/xTY9gja0Dq3HiwQF8LaCRTXxZKRutelT44=" crossorigin="anonymous"></script>
  429. <script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js"></script>
  430. <script src="/assets/js/aCollapTable.js"></script>
  431. @endpush
  432. @push('scripts')
  433. <script>
  434. function closeSelect2Dropdowns() {
  435. $('.filterCausals').each(function() {
  436. if ($(this).hasClass('select2-hidden-accessible')) {
  437. $(this).select2('close');
  438. }
  439. });
  440. $('.filterMember').each(function() {
  441. if ($(this).hasClass('select2-hidden-accessible')) {
  442. $(this).select2('close');
  443. }
  444. });
  445. }
  446. function load() {
  447. $(document).ready(function(){
  448. $(document).on("keypress", $('.filterCausals'), function (e) {
  449. setTimeout(() => {
  450. $(".select2-results__option").each(function(){
  451. var txt = $(this).html();
  452. var count = (txt.match(/-/g) || []).length;
  453. $(this).addClass('paddingLeftSelect' + count);
  454. });
  455. }, 100);
  456. });
  457. if (!$('.filterCausals').hasClass('select2-hidden-accessible')) {
  458. $('.filterCausals').select2({
  459. "language": {"noResults": function(){return "Nessun risultato";}},
  460. "dropdownParent": $('body'),
  461. "width": "100%"
  462. });
  463. }
  464. $('.filterCausals').off('change.customHandler').on('change.customHandler', function (e) {
  465. var data = $('.filterCausals').select2("val");
  466. @this.set('filterCausals', data);
  467. });
  468. $('.filterCausals').off('select2:open.customHandler').on('select2:open.customHandler', function (e) {
  469. if ($('#causalsModal').hasClass('show')) {
  470. $('#causalsModal').modal('hide');
  471. }
  472. setTimeout(() => {
  473. $(".select2-results__option").each(function(){
  474. var txt = $(this).html();
  475. var count = (txt.match(/-/g) || []).length;
  476. $(this).addClass('paddingLeftSelect' + count);
  477. });
  478. }, 100);
  479. });
  480. if (!$('.filterMember').hasClass('select2-hidden-accessible')) {
  481. $('.filterMember').select2({
  482. "language": {"noResults": function(){return "Nessun risultato";}},
  483. "dropdownParent": $('body'),
  484. "width": "100%"
  485. });
  486. }
  487. $('.filterMember').off('change.customHandler').on('change.customHandler', function (e) {
  488. var data = $('.filterMember').select2("val");
  489. @this.set('filterMember', data);
  490. });
  491. $('.filterMember').off('select2:open.customHandler').on('select2:open.customHandler', function (e) {
  492. if ($('#causalsModal').hasClass('show')) {
  493. $('#causalsModal').modal('hide');
  494. }
  495. });
  496. });
  497. }
  498. function printData() {
  499. var divToPrint = document.getElementById("tablesaw-350");
  500. newWin = window.open("");
  501. var htmlToPrint = '' +
  502. '<style type="text/css">' +
  503. 'table th, table td {' +
  504. 'border:1px solid #000;' +
  505. 'padding:0.5em;' +
  506. '}' +
  507. '</style>';
  508. htmlToPrint += divToPrint.outerHTML;
  509. newWin.document.write(htmlToPrint);
  510. newWin.document.close();
  511. newWin.print();
  512. newWin.close();
  513. }
  514. function scrollFunction() {
  515. const element = document.getElementById('resume-table');
  516. const mybuttonBottom = document.getElementById("btn-back-to-bottom");
  517. const mybutton = document.getElementById("btn-back-to-top");
  518. if (element.scrollTop > 20) {
  519. mybutton.style.display = "block";
  520. mybuttonBottom.style.display = "block";
  521. } else {
  522. mybutton.style.display = "none";
  523. mybuttonBottom.style.display = "none";
  524. }
  525. }
  526. function backToTop() {
  527. $('#resume-table').scrollTop(0);
  528. }
  529. function backToBottom() {
  530. $('#resume-table').scrollTop($('#resume-table')[0].scrollHeight);
  531. }
  532. $(document).ready(function() {
  533. load();
  534. document.querySelector("#print").addEventListener("click", function(){
  535. printData();
  536. });
  537. const element = document.getElementById('resume-table');
  538. element.onscroll = scrollFunction;
  539. const mybuttonBottom = document.getElementById("btn-back-to-bottom");
  540. const mybutton = document.getElementById("btn-back-to-top");
  541. mybutton.addEventListener("click", backToTop);
  542. mybuttonBottom.addEventListener("click", backToBottom);
  543. $(document).on('click', '.varie-link', function(e) {
  544. e.preventDefault();
  545. e.stopPropagation();
  546. closeSelect2Dropdowns();
  547. const causalsData = $(this).data('causals');
  548. if (causalsData) {
  549. const causals = causalsData.split('|');
  550. $('#causalsList').empty();
  551. causals.forEach(function(causal) {
  552. if (causal.trim()) {
  553. $('#causalsList').append(
  554. '<li class="list-group-item">' +
  555. '<i class="fas fa-tags me-2" style="color: #0C6197;"></i>' +
  556. causal.trim() +
  557. '</li>'
  558. );
  559. }
  560. });
  561. $('#causalsModal').modal('show');
  562. $('#causalsModal').on('shown.bs.modal', function () {
  563. $(this).find('.btn-close').focus();
  564. });
  565. }
  566. });
  567. $('#causalsModal').on('show.bs.modal', function () {
  568. closeSelect2Dropdowns();
  569. $('body').addClass('modal-open');
  570. });
  571. $('#causalsModal').on('hidden.bs.modal', function () {
  572. $('body').removeClass('modal-open');
  573. });
  574. });
  575. Livewire.on('load-table', () => {
  576. load();
  577. });
  578. Livewire.on('load-select', () => {
  579. load();
  580. });
  581. Livewire.on('filters-reset', () => {
  582. $('.filterMember').val('').trigger('change');
  583. $('.filterCausals').val('').trigger('change');
  584. load();
  585. });
  586. </script>
  587. @endpush