presence.blade.php 10.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270
  1. <div class="col card--ui" id="card--dashboard">
  2. <a class="btn--ui lightGrey" href="/calendar"><i class="fa-solid fa-arrow-left"></i></a><br><br>
  3. <section id="resume-table">
  4. <div class="compare--chart_wrapper d-none"></div>
  5. <div class="row">
  6. <div class="col-md-6">
  7. <h3>{{$calendar->course ? $calendar->course->name : $calendar->name}}</h3>
  8. </div>
  9. <div class="col-md-6">
  10. <h3>{{date("l d F", strtotime($calendar->from))}}, ora inizio {{date("H:i", strtotime($calendar->from))}}</h3>
  11. </div>
  12. <div class="col-md-6">
  13. <label for="court_id" class="form-label">Campo</label>
  14. <select class="form-select form-select-lg me-1 " wire:model="court_id">
  15. <option value="">
  16. @foreach($courts as $c)
  17. <option value="{{$c["id"]}}">{{$c["name"]}}</option>
  18. @endforeach
  19. </select>
  20. </div>
  21. <div class="col-md-6">
  22. <label for="instructor_id" class="form-label">Istruttore</label>
  23. <select class="form-select form-select-lg me-1 " wire:model="instructor_id">
  24. <option value="">
  25. @foreach($instructors as $i)
  26. <option value="{{$i["id"]}}">{{$i["name"]}}</option>
  27. @endforeach
  28. </select>
  29. </div>
  30. <div class="col-md-12 mt-3">
  31. <input class="form-control" id="note" placeholder="Note" wire:model="note"></input>
  32. </div>
  33. @if($calendar->status == 0)
  34. <div class="col-md-6">
  35. <label for="member_id" class="form-label">Aggiunge una persona</label>
  36. <select name="member_id" class="form-select memberClass" aria-label="Seleziona una persona" wire:model="member_id">
  37. <option value="">--Seleziona--
  38. @foreach($members as $member)
  39. <option value="{{$member->id}}">{{$member->last_name}} {{$member->first_name}} ({{$member->fiscal_code}})
  40. @endforeach
  41. </select>
  42. </div>
  43. @endif
  44. </div>
  45. <section id="resume-table" class="mt-3">
  46. <div class="compare--chart_wrapper d-none"></div>
  47. <table class="table tablesaw tableHead tablesaw-stack" id="tablesaw-350" width="100%">
  48. <thead>
  49. <tr>
  50. <th scope="col">#</th>
  51. <th scope="col">Cognome</th>
  52. <th scope="col">Nome</th>
  53. <th scope="col">Certificato</th>
  54. <th scope="col">Presenza</th>
  55. </tr>
  56. </thead>
  57. <tbody id="checkall-target">
  58. @foreach($records as $idx => $record)
  59. <tr>
  60. <td>{{$idx}}</td>
  61. <td>{{$record["first_name"]}}</td>
  62. <td>{{$record["last_name"]}}</td>
  63. <td>
  64. <span class="tablesaw-cell-content d-flex align-items-center">
  65. @php
  66. list($status, $date) = explode("|", $record["certificate"]);
  67. @endphp
  68. @if($status == 0)
  69. <i class="ico--ui check suspended me-2"></i>Scaduto
  70. @endif
  71. @if($status == 1)
  72. <i class="ico--ui check due me-2"></i>In scadenza
  73. @endif
  74. @if($status == 2)
  75. <i class="ico--ui check active me-2"></i> Scadenza
  76. @endif
  77. {{$date}}
  78. </span>
  79. <td>
  80. @if ($record["status"] != 99)
  81. @if ($record["presence"])
  82. @if ($record["my_presence"])
  83. <input class="member" type="checkbox" value="{{$record["id"]}}" {{$record["presence"] ? 'checked' : ''}}>
  84. @else
  85. V
  86. @endif
  87. @else
  88. <input class="member" type="checkbox" value="{{$record["id"]}}" {{$record["presence"] ? 'checked' : ''}}>
  89. @endif
  90. @else
  91. Annullata
  92. @endif
  93. </td>
  94. </tr>
  95. @endforeach
  96. </tbody>
  97. </table>
  98. </section>
  99. <div class="row">
  100. <div class="col-md-6">
  101. <label for="motivation_id" class="form-label">Motivazione annullamento</label>
  102. <select class="form-select form-select-lg me-1 " wire:model="motivation_id">
  103. <option value="">
  104. @foreach($motivations as $m)
  105. <option value="{{$m["id"]}}">{{$m["name"]}}</option>
  106. @endforeach
  107. </select>
  108. </div>
  109. </div>
  110. <div class="row mt-3">
  111. @if($calendar->status == 0)
  112. <div class="col-md-6">
  113. <button type="button" class="btn--ui " style="background-color:red !important" wire:click="cancelCalendar()">Annulla Lezione</button>
  114. </div>
  115. <div class="col-md-6 text-end">
  116. <button type="button" class="btn--ui" style="background-color:red !important" onclick="cancel()">Annulla lezione selezionati</button>
  117. <button type="button" class="btn--ui" onclick="save()">Salva</button>
  118. </div>
  119. @else
  120. LEZIONE ANNULLATA
  121. @endif
  122. </div>
  123. </section>
  124. </div>
  125. @push('scripts')
  126. <link href="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/css/select2.min.css" rel="stylesheet" />
  127. <style>
  128. table.tableHead thead {
  129. /* Important */
  130. position: sticky;
  131. z-index: 100;
  132. top: 0;
  133. }
  134. .select2-container--default .select2-selection--single{
  135. background-color: #E9F0F5;
  136. border: 0.0625rem solid #DFE5EB;
  137. font-size: 0.75rem;
  138. }
  139. .select2-selection
  140. {
  141. height: 38px !important;
  142. }
  143. .select2-selection__rendered
  144. {
  145. padding-top:3px;
  146. }
  147. .select2 {
  148. width:100% !important;
  149. }
  150. .page-link.active, .active > .page-link {
  151. background-color:#006099 !important;
  152. }
  153. .select2-selection--multiple{
  154. overflow: hidden !important;
  155. height: auto !important;
  156. }
  157. .select2-container {
  158. box-sizing: border-box;
  159. display: inline-block;
  160. margin: 0;
  161. position: relative;
  162. vertical-align: middle;
  163. }
  164. .select2-container .select2-selection--single {
  165. box-sizing: border-box;
  166. cursor: pointer;
  167. display: block;
  168. height: 38px;
  169. user-select: none;
  170. -webkit-user-select: none;
  171. }
  172. .select2-container .select2-selection--single .select2-selection__rendered {
  173. display: block;
  174. padding-left: 8px;
  175. padding-right: 20px;
  176. overflow: hidden;
  177. text-overflow: ellipsis;
  178. white-space: nowrap;
  179. }
  180. /* .total.primary
  181. {
  182. font-size:38px !important;
  183. } */
  184. /* .total.primary.comp
  185. {
  186. font-size:32px !important;
  187. } */
  188. </style>
  189. <script src="https://code.jquery.com/jquery-2.2.4.min.js" integrity="sha256-BbhdlvQf/xTY9gja0Dq3HiwQF8LaCRTXxZKRutelT44=" crossorigin="anonymous"></script>
  190. <script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js"></script>
  191. @endpush
  192. @push('scripts')
  193. <script>
  194. $(document).ready(function() {
  195. setTimeout(() => {
  196. $('.memberClass').select2({
  197. tags: false
  198. });
  199. $('.memberClass').on('change', function (e) {
  200. var data = $('.memberClass').select2("val");
  201. console.log(data);
  202. @this.addMember(data);
  203. });
  204. }, 100);
  205. } );
  206. Livewire.on('reload', () => {
  207. setTimeout(() => {
  208. $('.memberClass').select2({
  209. tags: false
  210. });
  211. $('.memberClass').on('change', function (e) {
  212. var data = $('.memberClass').select2("val");
  213. console.log(data);
  214. @this.addMember(data);
  215. });
  216. }, 100);
  217. });
  218. function save()
  219. {
  220. var ids = [];
  221. $('input[type=checkbox]').each(function () {
  222. if ($(this).is(":checked"))
  223. {
  224. var val = $(this).val();
  225. ids.push(val);
  226. }
  227. });
  228. @this.save(ids);
  229. }
  230. function cancel()
  231. {
  232. var ids = [];
  233. $('input[type=checkbox]').each(function () {
  234. if ($(this).is(":checked"))
  235. {
  236. var val = $(this).val();
  237. ids.push(val);
  238. }
  239. });
  240. @this.cancel(ids);
  241. }
  242. </script>
  243. @endpush