course_list.blade.php 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587
  1. <div class="col">
  2. <div class="row h-100">
  3. <div class="col card--ui" id="card--dashboard">
  4. <header id="title--section" style="display:none !important" 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">Pagamento corsi</h2>
  8. </div>
  9. </header>
  10. <div class="showFilter" style="display:none" wire:ignore.self>
  11. <hr size="1">
  12. <div class="row g-3">
  13. <div class="col-md-2">
  14. <div class="row">
  15. <div class="col-md-12" style="margin-bottom:10px;">
  16. <b>Corso</b>
  17. </div>
  18. <div class="col-12" >
  19. <select class="form-select filterCourse" wire:model="filterCourse" onchange="destroyDataTable()" multiple="multiple">
  20. @foreach($courses as $c)
  21. <option value="{{$c}}">{{$c}}
  22. @endforeach
  23. </select>
  24. </div>
  25. </div>
  26. </div>
  27. <div class="col-md-2">
  28. <div class="row">
  29. <div class="col-md-12" style="margin-bottom:10px;">
  30. <b>Livello</b>
  31. </div>
  32. <div class="col-12">
  33. <select class="form-select filterLevel" wire:model="filterLevel" onchange="destroyDataTable()" multiple="multiple">
  34. @foreach($course_levels as $c)
  35. <option value="{{$c->id}}">{{$c->name}}
  36. @endforeach
  37. </select>
  38. </div>
  39. </div>
  40. </div>
  41. <div class="col-md-2">
  42. <div class="row">
  43. <div class="col-md-12" style="margin-bottom:10px;">
  44. <b>Frequenza</b>
  45. </div>
  46. <div class="col-12">
  47. <select class="form-select filterFrequency" wire:model="filterFrequency" onchange="destroyDataTable()" multiple="multiple">
  48. @foreach($course_frequencies as $c)
  49. <option value="{{$c->id}}">{{$c->name}}
  50. @endforeach
  51. </select>
  52. </div>
  53. </div>
  54. </div>
  55. <div class="col-md-2">
  56. <div class="row">
  57. <div class="col-md-12" style="margin-bottom:10px;">
  58. <b>Tipologia</b>
  59. </div>
  60. <div class="col-12">
  61. <select class="form-select filterType" wire:model="filterType" onchange="destroyDataTable()" multiple="multiple">
  62. @foreach($course_types as $c)
  63. <option value="{{$c->id}}">{{$c->name}}
  64. @endforeach
  65. </select>
  66. </div>
  67. </div>
  68. </div>
  69. <div class="col-md-2">
  70. <div class="row">
  71. <div class="col-md-12" style="margin-bottom:10px;">
  72. <b>Durata</b>
  73. </div>
  74. <div class="col-12">
  75. <select class="form-select filterDuration" wire:model="filterDuration" onchange="destroyDataTable()" multiple="multiple">
  76. @foreach($course_durations as $c)
  77. <option value="{{$c->id}}">{{$c->name}}
  78. @endforeach
  79. </select>
  80. </div>
  81. </div>
  82. </div>
  83. </div>
  84. <div class="row g-3" style="margin-top:20px;">
  85. <div class="col-md-12" style="text-align:right">
  86. <button class="btn--ui_outline light" wire:click.prevent="disableSearch()" onclick="destroyDataTable()">CANCELLA</button>
  87. <button class="btn--ui" onclick="searchAction()">FILTRA</button>
  88. </div>
  89. </div>
  90. <hr size="1">
  91. </div>
  92. <section id="resume-table">
  93. <div class="compare--chart_wrapper d-none"></div>
  94. <table class="table tablesaw tablesaw-stack pagamento--corsi" id="tablesaw-350">
  95. <thead>
  96. <tr>
  97. <th scope="col">Cognome</th>
  98. <th scope="col">Nome</th>
  99. <th scope="col">Iscrizione</th>
  100. @foreach($months as $m)
  101. <th scope="col">&nbsp;&nbsp;&nbsp;&nbsp;{{$m}}</th>
  102. @endforeach
  103. </tr>
  104. </thead>
  105. <tbody id="checkall-target">
  106. @foreach($records as $record)
  107. <tr>
  108. @php
  109. list($id, $first_name, $last_name) = explode("§", $record[0]);
  110. @endphp
  111. <td><a href="/members?member_detail={{$id}}">{{$last_name}}</a></td>
  112. <td><a href="/members?member_detail={{$id}}">{{$first_name}}</a></td>
  113. @php
  114. list($subscribed, $subPrice) = explode("§", $record[15]);
  115. @endphp
  116. <td><a class="{{$subscribed ? 'green' : 'orange'}}" wire:click="newSubscription({{$record[13]}}, {{$id}}, {{$record[14]}})" style="cursor: pointer;"><small>{{formatPrice($subPrice)}}</small></a></td>
  117. @for($x=1; $x<=12; $x++)
  118. <td>
  119. @php
  120. list($color, $price) = explode("§", $record[$x]);
  121. @endphp
  122. @if($color == 'orange')
  123. <a class="{{$color}}" wire:click="newPayment({{$record[13]}}, {{$x}}, {{$id}}, {{$record[14]}})" style="cursor: pointer;"><small>{{formatPrice($price)}}</small></a>
  124. @else
  125. <a class="{{$color}}"><small>{{formatPrice($price)}}</small></a>
  126. @endif
  127. </td>
  128. @endfor
  129. </tr>
  130. @endforeach
  131. </tbody>
  132. <tfoot id="checkall-target">
  133. <tr>
  134. <th colspan="2"></th>
  135. <th></th>
  136. <th></th>
  137. <th></th>
  138. <th></th>
  139. <th></th>
  140. <th></th>
  141. <th></th>
  142. <th></th>
  143. <th></th>
  144. <th></th>
  145. <th></th>
  146. <th></th>
  147. <th></th>
  148. </tr>
  149. </tfoot>
  150. </table>
  151. </section>
  152. </div>
  153. @push('scripts')
  154. <!-- <style>
  155. a.grey
  156. {
  157. display: flex;
  158. margin-right:10px;
  159. float:left;
  160. height: 2.5rem !important;
  161. width:50px;
  162. align-items: center;
  163. justify-content: center;
  164. color: #006099;
  165. background-color: #d3dce1 !important;
  166. padding: 0 1.25rem;
  167. font-size: 0.875rem;
  168. font-family: greycliff-cf, sans-serif;
  169. border-radius: 1.875rem !important;
  170. -webkit-border-radius: 1.875rem !important;
  171. -moz-border-radius: 1.875rem !important;
  172. -webkit-transition: all 0.3s ease-in-out;
  173. -moz-transition: all 0.3s ease-in-out;
  174. -o-transition: all 0.3s ease-in-out;
  175. transition: all 0.3s ease-in-out;
  176. border: none;
  177. }
  178. a.blue
  179. {
  180. display: flex;
  181. margin-right:10px;
  182. float:left;
  183. height: 2.5rem !important;
  184. width:50px;
  185. align-items: center;
  186. justify-content: center;
  187. color: #fff;
  188. background-color: #006099 !important;
  189. padding: 0 1.25rem;
  190. font-size: 0.875rem;
  191. font-family: greycliff-cf, sans-serif;
  192. border-radius: 1.875rem !important;
  193. -webkit-border-radius: 1.875rem !important;
  194. -moz-border-radius: 1.875rem !important;
  195. -webkit-transition: all 0.3s ease-in-out;
  196. -moz-transition: all 0.3s ease-in-out;
  197. -o-transition: all 0.3s ease-in-out;
  198. transition: all 0.3s ease-in-out;
  199. border: none;
  200. }
  201. a.yellow
  202. {
  203. display: flex;
  204. margin-right:10px;
  205. float:left;
  206. height: 2.5rem !important;
  207. width:50px;
  208. align-items: center;
  209. justify-content: center;
  210. color: #fff;
  211. background-color: #ffe238;
  212. padding: 0 1.25rem;
  213. font-size: 0.875rem;
  214. font-family: greycliff-cf, sans-serif;
  215. border-radius: 1.875rem !important;
  216. -webkit-border-radius: 1.875rem !important;
  217. -moz-border-radius: 1.875rem !important;
  218. -webkit-transition: all 0.3s ease-in-out;
  219. -moz-transition: all 0.3s ease-in-out;
  220. -o-transition: all 0.3s ease-in-out;
  221. transition: all 0.3s ease-in-out;
  222. border: none;
  223. }
  224. a.orange
  225. {
  226. display: flex;
  227. margin-right:10px;
  228. float:left;
  229. height: 2.5rem !important;
  230. width:50px;
  231. align-items: center;
  232. justify-content: center;
  233. color: #fff;
  234. background-color: #FF7E38;
  235. padding: 0 1.25rem;
  236. font-size: 0.875rem;
  237. font-family: greycliff-cf, sans-serif;
  238. border-radius: 1.875rem !important;
  239. -webkit-border-radius: 1.875rem !important;
  240. -moz-border-radius: 1.875rem !important;
  241. -webkit-transition: all 0.3s ease-in-out;
  242. -moz-transition: all 0.3s ease-in-out;
  243. -o-transition: all 0.3s ease-in-out;
  244. transition: all 0.3s ease-in-out;
  245. border: none;
  246. }
  247. a.green
  248. {
  249. display: flex;
  250. margin-right:10px;
  251. float:left;
  252. height: 2.5rem !important;
  253. width:50px;
  254. align-items: center;
  255. justify-content: center;
  256. color: #fff;
  257. background-color: green;
  258. padding: 0 1.25rem;
  259. font-size: 0.875rem;
  260. font-family: greycliff-cf, sans-serif;
  261. border-radius: 1.875rem !important;
  262. -webkit-border-radius: 1.875rem !important;
  263. -moz-border-radius: 1.875rem !important;
  264. -webkit-transition: all 0.3s ease-in-out;
  265. -moz-transition: all 0.3s ease-in-out;
  266. -o-transition: all 0.3s ease-in-out;
  267. transition: all 0.3s ease-in-out;
  268. border: none;
  269. }
  270. </style> -->
  271. @endpush
  272. @push('scripts')
  273. <link href="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/css/select2.min.css" rel="stylesheet" />
  274. <style>
  275. .select2-container--default .select2-selection--single{
  276. background-color: #E9F0F5;
  277. border: 0.0625rem solid #DFE5EB;
  278. font-size: 0.75rem;
  279. }
  280. .select2-selection
  281. {
  282. height: 38px !important;
  283. }
  284. .select2-selection__rendered
  285. {
  286. padding-top:3px;
  287. }
  288. .select2 {
  289. width:100% !important;
  290. }
  291. </style>
  292. <script src="https://code.jquery.com/jquery-2.2.4.min.js" integrity="sha256-BbhdlvQf/xTY9gja0Dq3HiwQF8LaCRTXxZKRutelT44=" crossorigin="anonymous"></script>
  293. <script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js"></script>
  294. @endpush
  295. @push('scripts')
  296. <link href="/css/datatables.css" rel="stylesheet" />
  297. <script src="https://code.jquery.com/jquery-2.2.4.min.js" integrity="sha256-BbhdlvQf/xTY9gja0Dq3HiwQF8LaCRTXxZKRutelT44=" crossorigin="anonymous"></script>
  298. <link href="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/css/select2.min.css" rel="stylesheet" />
  299. <style>
  300. .select2-container--default .select2-selection--single{
  301. background-color: #E9F0F5;
  302. border: 0.0625rem solid #DFE5EB;
  303. font-size: 0.75rem;
  304. }
  305. .select2-selection
  306. {
  307. height: 38px !important;
  308. }
  309. .select2-selection__rendered
  310. {
  311. padding-top:3px;
  312. }
  313. .select2 {
  314. width:100% !important;
  315. }
  316. .select2-selection--multiple{
  317. overflow: hidden !important;
  318. height: auto !important;
  319. }
  320. .select2-container {
  321. box-sizing: border-box;
  322. display: inline-block;
  323. margin: 0;
  324. position: relative;
  325. vertical-align: middle;
  326. }
  327. .select2-container .select2-selection--single {
  328. box-sizing: border-box;
  329. cursor: pointer;
  330. display: block;
  331. height: 38px;
  332. user-select: none;
  333. -webkit-user-select: none;
  334. }
  335. .select2-container .select2-selection--single .select2-selection__rendered {
  336. display: block;
  337. padding-left: 8px;
  338. padding-right: 20px;
  339. overflow: hidden;
  340. text-overflow: ellipsis;
  341. white-space: nowrap;
  342. }
  343. .select2-selection__choice__display{
  344. color:#000000 !important;
  345. }
  346. </style>
  347. <script src="https://code.jquery.com/jquery-2.2.4.min.js" integrity="sha256-BbhdlvQf/xTY9gja0Dq3HiwQF8LaCRTXxZKRutelT44=" crossorigin="anonymous"></script>
  348. <script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js"></script>
  349. <script src="/assets/js/datatables.js"></script>
  350. <script src="https://cdn.datatables.net/buttons/3.0.2/js/buttons.dataTables.js"></script>
  351. <script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.10.1/jszip.min.js"></script>
  352. <script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.2.7/pdfmake.min.js"></script>
  353. <script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.2.7/vfs_fonts.js"></script>
  354. @endpush
  355. @push('scripts')
  356. <script>
  357. $(document).ready(function() {
  358. loadDataTable();
  359. } );
  360. $('.filterCourse').select2();
  361. $('.filterCourse').on('change', function (e) {
  362. var data = $('.filterCourse').select2("val");
  363. if (data == null) data = [];
  364. @this.set('filterCourse', data);
  365. //@this.search();
  366. });
  367. $('.filterLevel').select2();
  368. $('.filterLevel').on('change', function (e) {
  369. var data = $('.filterLevel').select2("val");
  370. if (data == null) data = [];
  371. @this.set('filterLevel', data);
  372. //@this.search();
  373. });
  374. $('.filterFrequency').select2();
  375. $('.filterFrequency').on('change', function (e) {
  376. var data = $('.filterFrequency').select2("val");
  377. if (data == null) data = [];
  378. @this.set('filterFrequency', data);
  379. //@this.search();
  380. });
  381. $('.filterType').select2();
  382. $('.filterType').on('change', function (e) {
  383. var data = $('.filterType').select2("val");
  384. if (data == null) data = [];
  385. @this.set('filterType', data);
  386. //@this.search();
  387. });
  388. $('.filterDuration').select2();
  389. $('.filterDuration').on('change', function (e) {
  390. var data = $('.filterDuration').select2("val");
  391. if (data == null) data = [];
  392. @this.set('filterDuration', data);
  393. //@this.search();
  394. });
  395. Livewire.on('load-data-table', () => {
  396. $('.filterCourse').select2();
  397. $('.filterLevel').select2();
  398. $('.filterFrequency').select2();
  399. $('.filterType').select2();
  400. $('.filterDuration').select2();
  401. loadDataTable();
  402. });
  403. Livewire.on('destroy-data-table', () => {
  404. $('#tablesaw-350').DataTable().destroy();
  405. });
  406. function destroyDataTable()
  407. {
  408. $('#tablesaw-350').DataTable().destroy();
  409. }
  410. var isFilter = false;
  411. $(document).ready(function() {
  412. $(document).on("click",".showHideFilter",function() {
  413. if (isFilter)
  414. {
  415. isFilter = false;
  416. $(".showFilter").hide();
  417. }
  418. else
  419. {
  420. isFilter = true;
  421. $(".showFilter").show();
  422. }
  423. });
  424. } );
  425. function searchAction()
  426. {
  427. //destroyDataTable();
  428. //@this.search();
  429. }
  430. function loadDataTable(){
  431. $('#tablesaw-350').DataTable({
  432. scrollX: true,
  433. thead: {
  434. 'th': {'background-color': 'blue'}
  435. },
  436. layout: {
  437. topStart : null,
  438. topEnd : null,
  439. top1A: {
  440. buttons: [
  441. {
  442. extend: 'collection',
  443. text: 'Esporta',
  444. buttons: [
  445. {
  446. extend: 'excelHtml5',
  447. title: 'Pagamento corsi',
  448. exportOptions: {
  449. columns: ":not(':last')"
  450. }
  451. },
  452. {
  453. extend: 'pdfHtml5',
  454. title: 'Pagamento corsi',
  455. exportOptions: {
  456. columns: ":not(':last')"
  457. }
  458. },
  459. {
  460. extend: 'print',
  461. text: 'Stampa',
  462. title: 'Pagamento corsi',
  463. exportOptions: {
  464. columns: ":not(':last')"
  465. }
  466. }
  467. ],
  468. dropup: true
  469. }
  470. ]
  471. },
  472. top1B : {
  473. pageLength: {
  474. menu: [[10, 25, 50, 100, 100000], [10, 25, 50, 100, "Tutti"]]
  475. }
  476. },
  477. top1C :'search',
  478. },
  479. order: [[0, 'asc'], [1, 'asc']],
  480. pagingType: 'numbers',
  481. "language": {
  482. "url": "/assets/js/Italian.json"
  483. },
  484. "fnInitComplete": function (oSettings, json) {
  485. var html = '&nbsp;<a href="#" class="showHideFilter btn--ui"><i class="fa-solid fa-sliders"></i></a>';
  486. $(".dt-search").append(html);
  487. },
  488. "footerCallback": function (row, data, start, end, display) {
  489. let api = this.api();
  490. @php
  491. $xx = 2;
  492. $str = '';
  493. $str .= "<a class=green><small>" . (isset($totalIsc["Y"]) ? formatPrice($totalIsc["Y"]) : 0) . "</small></a><br>";
  494. $str .= "<a class=orange><small>" . (isset($totalIsc["N"]) ? formatPrice($totalIsc["N"]) : 0) . "</small></a><br>";
  495. $str .= "<a class=yellow><small>0</small></a><br>";
  496. print "api.column(2).footer().innerHTML = '" . $str . "';";
  497. $str = "";
  498. foreach($totals as $z => $t)
  499. {
  500. if ($z == 1) $xx = 7;
  501. if ($z == 2) $xx = 8;
  502. if ($z == 3) $xx = 9;
  503. if ($z == 4) $xx = 10;
  504. if ($z == 5) $xx = 11;
  505. if ($z == 6) $xx = 12;
  506. if ($z == 7) $xx = 13;
  507. if ($z == 8) $xx = 14;
  508. if ($z == 9) $xx = 3;
  509. if ($z == 10) $xx = 4;
  510. if ($z == 11) $xx = 5;
  511. if ($z == 12) $xx = 6;
  512. $str = '';
  513. foreach($t as $x => $c)
  514. {
  515. $y = $x == 'yellow' ? $c : formatPrice($c);
  516. $str .= "<a class=" . $x . "><small>" . $y . "</small></a><br>";
  517. }
  518. print "api.column(" . $xx . ").footer().innerHTML = '" . $str . "';";
  519. $xx += 1;
  520. }
  521. @endphp
  522. /*for(var i = 2; i<15; i++)
  523. {
  524. api.column(i).footer().innerHTML = "ciccio"; //"€ " + api.column(i).data().sum().toFixed(2);
  525. }*/
  526. }
  527. });
  528. $('#tablesaw-350 thead tr th').addClass('col');
  529. $('#tablesaw-350 thead tr th').css("background-color", "#f6f8fa");
  530. jQuery.fn.dataTable.Api.register( 'sum()', function ( ) {
  531. return this.flatten().reduce( function ( a, b ) {
  532. if ( typeof a === 'string') {
  533. start = a.indexOf("€");
  534. a = a.substr(start + 2).replace("</small></a>", "").replace(",",".") * 1;
  535. }
  536. if ( typeof b === 'string' && b.indexOf('green') > 0) {
  537. start = b.indexOf("€");
  538. b = b.substr(start + 2).replace("</small></a>", "").replace(",",".") * 1;
  539. }
  540. else
  541. {
  542. b = 0;
  543. }
  544. return a + b;
  545. }, 0 );
  546. } );
  547. }
  548. </script>
  549. @endpush