calendar_remove.blade.php 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. <div class="col card--ui" id="card--dashboard">
  2. <a class="btn--ui lightGrey" href="/presence_reports"><i class="fa-solid fa-arrow-left"></i></a><br>
  3. <header id="title--section" style="display:none !important" class="d-flex align-items-center justify-content-between">
  4. <div class="title--section_name d-flex align-items-center justify-content-between">
  5. <i class="ico--ui title_section utenti me-2"></i>
  6. <h2 class="primary">Lezioni da rimuovere</h2>
  7. </div>
  8. </header>
  9. <br>
  10. <div class="row">
  11. <div class="col-12 mb-3">
  12. <h3 class="primary">Lezioni inserite senza nessun iscritto</h3>
  13. </div>
  14. <div class="col-12">
  15. @foreach($groups as $idx => $grp)
  16. <a onclick="checkAll('{{$grp}}', {{$idx}})" class="btn btn-light bt{{$idx}}">{{$grp}}</a>
  17. @endforeach
  18. </div>
  19. <div class="col-12">
  20. <table class="report-table">
  21. <thead>
  22. <tr>
  23. <td></td>
  24. <td>Data</td>
  25. <td>Ora</td>
  26. <td>Corso</td>
  27. <td></td>
  28. </tr>
  29. </thead>
  30. <tbody>
  31. @foreach($records as $record)
  32. <tr>
  33. <td><input type="checkbox" value="{{$record["id"]}}" class="chk when_{{$record["name"]}}_{{$record["day"]}}_{{str_replace(":", "", $record["hour"])}}"></td>
  34. <td>{{$record["date"]}}</td>
  35. <td>{{$record["hour"]}}</td>
  36. <td>{{$record["name"]}}</td>
  37. <td><a href="/presences?calendarId={{$record["id"]}}" target="_blank">Visualizza</a></td>
  38. </tr>
  39. @endforeach
  40. </tbody>
  41. <span id="deleting" style="display:none">Eliminazione in corso...</span>
  42. <input type="button" class="btDelete btn--ui" value="Elimina selezionati">
  43. </table>
  44. </div>
  45. </div>
  46. </div>
  47. @push('css')
  48. <link href="/css/presence_report.css" rel="stylesheet" />
  49. @endpush
  50. @push('scripts')
  51. <link href="/css/datatables.css" rel="stylesheet" />
  52. <script src="https://code.jquery.com/jquery-2.2.4.min.js" integrity="sha256-BbhdlvQf/xTY9gja0Dq3HiwQF8LaCRTXxZKRutelT44=" crossorigin="anonymous"></script>
  53. @endpush
  54. @push('scripts')
  55. <script>
  56. var ids = [];
  57. var xxx = [];
  58. $(document).ready(function() {
  59. $('.chk').change(function() {
  60. if(this.checked)
  61. {
  62. ids.push($(this).val());
  63. }
  64. else
  65. {
  66. var index = ids.indexOf($(this).val());
  67. if (index > -1)
  68. {
  69. ids.splice(index, 1);
  70. }
  71. }
  72. });
  73. $(".btDelete").click(function(){
  74. $("#deleting").show();
  75. //$(this).hide();
  76. @this.removeSelected(ids);
  77. });
  78. });
  79. function checkAll(x, idx)
  80. {
  81. var checked = true;
  82. if ($(".bt" + idx).hasClass("btn-primary"))
  83. {
  84. $(".bt" + idx).removeClass("btn-primary");
  85. $(".bt" + idx).addClass("btn-light");
  86. checked = false;
  87. }
  88. else
  89. {
  90. $(".bt" + idx).removeClass("btn-light");
  91. $(".bt" + idx).addClass("btn-primary");
  92. }
  93. /*var index = xxx.indexOf(x);
  94. if (index > -1)
  95. {
  96. xxx.splice(index, 1);
  97. checked = false;
  98. }*/
  99. x = x.replaceAll(" ", "_");
  100. x = x.replaceAll(":", "");
  101. console.log(x);
  102. var xxx = $(".when_" + x).map(function() {
  103. console.log("CIAO");
  104. var val = $(this).val();
  105. $(this).prop('checked', checked);
  106. if (checked)
  107. ids.push(val);
  108. else
  109. {
  110. var index = ids.indexOf(val);
  111. if (index > -1)
  112. {
  113. ids.splice(index, 1);
  114. }
  115. }
  116. //return this.innerHTML;
  117. }).get();
  118. }
  119. </script>
  120. @endpush