presence.blade.php 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692
  1. @php
  2. $last_date = explode(" ", $this->calendar->from)[0];
  3. @endphp
  4. <div class="col card--ui" id="card--dashboard">
  5. <a class="btn--ui lightGrey" href="/calendar?last_date={{$last_date}}"><i class="fa-solid fa-arrow-left"></i></a><br><br>
  6. <div class="compare--chart_wrapper d-none"></div>
  7. <div class="row">
  8. <div class="col-sm-12">
  9. <div class="row">
  10. <div class="col-auto">
  11. <h3 class="text-primary">{{$calendar->course ? $calendar->course->name : $calendar->name}}</h3>
  12. </div>
  13. <div class="col"></div>
  14. <div class="col-auto text-end">
  15. <h4>{!!$this->getDateX()!!}<br>ora inizio {{date("H:i", strtotime($calendar->from))}}</h4>
  16. </div>
  17. </div>
  18. </div>
  19. {{-- @if($manual)
  20. <div class="col-md-6">
  21. <label for="court_id" class="form-label">Motivazione</label>
  22. <select class="form-select form-select-lg me-1 " id="motivation_manual_id">
  23. <option value="">
  24. @foreach($motivations_add as $m)
  25. <option value="{{$m->id}}" {{$motivation_manual_id==$m->id ? 'selected' : ''}}>{{$m->name}}</option>
  26. @endforeach
  27. </select>
  28. </div>
  29. @else
  30. <div class="col-md-6">
  31. <label for="court_id" class="form-label">Campo</label>
  32. <select class="form-select form-select-lg me-1 " wire:model="court_id">
  33. <option value="">
  34. @foreach($courts as $c)
  35. <option value="{{$c["id"]}}">{{$c["name"]}}</option>
  36. @endforeach
  37. </select>
  38. </div>
  39. <div class="col">
  40. <label for="instructor_id" class="form-label">Istruttore</label>
  41. <select class="form-select form-select-lg me-1 " wire:model="instructor_id">
  42. <option value="">
  43. @foreach($instructors as $i)
  44. <option value="{{$i["id"]}}">{{$i["name"]}}</option>
  45. @endforeach
  46. </select>
  47. </div>
  48. <div class="col-auto mt-2">
  49. <br>
  50. <button type="button" class="btn--ui primary" data-bs-toggle="modal" data-bs-target="#instructorModal" style="width:50px">&nbsp;<i class="fa-solid fa-plus"></i></button>
  51. </div>
  52. <div class="col-md-12 mt-3">
  53. <textarea class="form-control" id="note" placeholder="Note" wire:model="note"></textarea>
  54. </div>
  55. @endif --}}
  56. </div>
  57. <div id="resume-table" class="mt-3">
  58. <div class="compare--chart_wrapper d-none"></div>
  59. <div class="row">
  60. <div class="col-md-8 col-sm-6"></div>
  61. <div class="col-md-4 col-sm-6 mb-3">
  62. <input type="text" class="form-control" placeholder="Cerca utente" wire:model="filter">
  63. </div>
  64. </div>
  65. </div>
  66. <table class="table tablesaw tableHead tablesaw-stack" id="tablesaw-350" width="100%">
  67. <thead>
  68. <tr>
  69. <th scope="col" class="annulla-lezione" style="display: none;">Annullamento</th>
  70. <th scope="col">#</th>
  71. <th scope="col">Cognome</th>
  72. <th scope="col">Nome</th>
  73. <th scope="col">Certificato</th>
  74. <th scope="col">Campo</th>
  75. <th scope="col">Istruttore</th>
  76. <th scope="col">Presenza</th>
  77. <th scope="col">Motivazione</th>
  78. <th scope="col">Note</th>
  79. </tr>
  80. </thead>
  81. <tbody id="checkall-target">
  82. @foreach($records as $idx => $record)
  83. <tr>
  84. <td class="annulla-lezione" style="display: none;">
  85. @if ($record["status"] != 99)
  86. <input name="annulla_lezione" class="member chkM" type="checkbox" value="{{$record["id"]}}">
  87. @endif
  88. </td>
  89. <td>{{$idx + 1}}</td>
  90. <td>{{$record["last_name"]}}</td>
  91. <td>{{$record["first_name"]}}</td>
  92. <td>
  93. <span class="tablesaw-cell-content d-flex align-items-center">
  94. @php
  95. list($status, $date) = explode("|", $record["certificate"]);
  96. @endphp
  97. @if($status == 0)
  98. <i class="ico--ui check suspended me-2"></i>Scaduto
  99. @endif
  100. @if($status == 1)
  101. <i class="ico--ui check due me-2"></i>In scadenza
  102. @endif
  103. @if($status == 2)
  104. <i class="ico--ui check active me-2"></i> Scadenza
  105. @endif
  106. @if(is_null($status) || $status == '')
  107. <i class="ico--ui check due me-2"></i> Sospeso
  108. @endif
  109. {{$date}}
  110. </span>
  111. </td>
  112. <td>{{$record["court"]}}</td>
  113. <td>{{$record["instructor"]}}</td>
  114. <td>
  115. @if ($record["status"] != 99)
  116. @if ($record["presence"])
  117. @if ($record["my_presence"])
  118. @if($manual)
  119. <a onclick="removeSingle({{$record['id']}})"><i class="fas fa-trash"></i></a>
  120. @else
  121. <input name="presence" class="member chkM" type="checkbox" value="{{$record["id"]}}" {{$record["presence"] ? 'checked' : '' }}>
  122. @endif
  123. @else
  124. <span style="color:#0C6197;font-size:25px;">&#10003;</span>
  125. @endif
  126. @else
  127. <input name="presence" class="member chkM" type="checkbox" value="{{$record["id"]}}" {{$record["presence"] ? 'checked' : '' }}>
  128. @endif
  129. @else
  130. Annullata &nbsp;&nbsp;-&nbsp;&nbsp; <a href="#" wire:click="revert({{$record["id"]}})" style="text-decoration: underline;color: #0c6197;"><small><i class="fa-solid fa-arrow-left-rotate"></i></small> Ripristina</a>
  131. @endif
  132. </td>
  133. <td>
  134. {{$record["motivation"]}}
  135. </td>
  136. <td>{{$record["notes"]}}</td>
  137. </tr>
  138. @endforeach
  139. </tbody>
  140. </table>
  141. @if($calendar->status == 0)
  142. <div class="row">
  143. <div class="col">
  144. <button type="button" class="btn--ui primary btSave btAdd" data-bs-toggle="modal" data-bs-target="#userModal" onclick="addUser()">Aggiungi utente</button>
  145. </div>
  146. </div>
  147. @endif
  148. <br>
  149. <br>
  150. <div class="row">
  151. @if($calendar->status == 0)
  152. <div class="col">
  153. @if(!$manual)
  154. <div class="col-lg-4 col-md-7 col-sm-12 showDelete" style="display:none">
  155. <label for="newMotivation" class="form-label">Motivazione</label>
  156. <select class="form-select form-select-lg me-1 " id="motivation_id">
  157. <option value="">
  158. @foreach($motivations as $m)
  159. <option value="{{$m["id"]}}">{{$m["name"]}}</option>
  160. @endforeach
  161. </select>
  162. </div>
  163. <button type="button" class="btn--ui lightGrey btSave" {{-- style="background-color:rgb(111, 31, 31) !important" --}} onclick="showHideDelete()">Annulla lezione per selezionati</button>
  164. <button type="button" class="btn--ui btSave" onclick="saveAndStay()">Salva presenze</button>
  165. @endif
  166. </div>
  167. @if(!$manual)
  168. <div class="col-auto mt-2 text-end">
  169. <button type="button" class="btn--ui btSave" onclick="saveAndQuit()">Salva e chiudi</button>
  170. </div>
  171. <div class="col-xs-12 mt-2">
  172. <div class="showDelete" style="float:left;display:none;">
  173. <button type="button" class="btn--ui lightGrey btSaveDelete" onclick="hideShowDelete()">Indietro</button>
  174. <button type="button" class="btn--ui btSaveDelete" onclick="cancel()">Conferma</button>
  175. </div>
  176. </div>
  177. @endif
  178. @endif
  179. </div>
  180. <div class="row mt-3">
  181. @if($calendar->status == 0)
  182. @if(!$manual)
  183. <div class="col-md-6">
  184. </div>
  185. @endif
  186. @else
  187. LEZIONE ANNULLATA ({{$calendar->motivation ? $calendar->motivation->name : ''}})
  188. @endif
  189. </div>
  190. <div wire:ignore.self class="modal modal-lg fade" id="userModal" tabindex="-1" aria-labelledby="userModalLabel" aria-hidden="true">
  191. <div class="modal-dialog">
  192. <div class="modal-content">
  193. <div class="modal-header">
  194. <h5 class="modal-title text-primary" id="userModalLabel">Aggiungi persone al corso</h5>
  195. <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
  196. </div>
  197. <div class="modal-body">
  198. <h3 class="text-primary"><input type="radio" name="chkType" value="1" checked onchange="change(1)"> Utente già registrato</h3>
  199. <div class="existUser">
  200. <div class="row mt-2 ">
  201. <div class="col-md-6">
  202. <label for="member_id" class="form-label">Aggiungere una o più persone</label>
  203. <select name="member_id" class="form-select memberClass" aria-label="Seleziona una persona" multiple>
  204. <option value="">--Seleziona--
  205. @foreach($members as $member)
  206. <option value="{{$member->id}}">{{$member->last_name}} {{$member->first_name}} ({{$member->fiscal_code}})
  207. @endforeach
  208. </select>
  209. </div>
  210. <div class="col-md-6">
  211. <label for="newMotivation" class="form-label">Motivazione</label>
  212. <select class="form-select form-select-lg me-1 @error('newMemberMotivationId') is-invalid @enderror" id="newMemberMotivationId">
  213. <option value="">
  214. @foreach($motivations_add as $m)
  215. <option value="{{$m["id"]}}">{{$m["name"]}}</option>
  216. @endforeach
  217. </select>
  218. </div>
  219. </div>
  220. </div>
  221. <br>
  222. <hr>
  223. <br>
  224. <h3 class="text-primary"><input type="radio" name="chkType" value="2" onchange="change(2)"> Inserimento nuovo utente</h3>
  225. <br>
  226. <div class="newUser">
  227. @if($newMemberFiscalCodeExist)
  228. <span style="color:red">Attenzione, utente esistente</span>
  229. @endif
  230. <div class="row ">
  231. <div class="col-md-6">
  232. <label for="newMemberFirstName" class="form-label">Nome</label>
  233. <input class="form-control @error('newMemberFirstName') is-invalid @enderror" type="text" id="newMemberFirstName" placeholder="Nome">
  234. </div>
  235. <div class="col-md-6">
  236. <label for="newMemberLastName" class="form-label">Cognome</label>
  237. <input class="form-control @error('newMemberLastName') is-invalid @enderror" type="text" id="newMemberLastName" placeholder="Cognome">
  238. </div>
  239. </div>
  240. <div class="row mt-2">
  241. <div class="col-md-6">
  242. <label for="newMemberEmail" class="form-label">Email</label>
  243. <input class="form-control @error('newMemberEmail') is-invalid @enderror" type="text" id="newMemberEmail" placeholder="Email">
  244. </div>
  245. <div class="col-md-6">
  246. <label for="newMemberFiscalCode" class="form-label">Codice fiscale</label>
  247. <input class="form-control @error('newMemberFiscalCode') is-invalid @enderror" type="text" id="newMemberFiscalCode" placeholder="Codice fiscale" maxlength="16">
  248. </div>
  249. </div>
  250. <div class="row mt-2 ">
  251. <div class="col-md-6 d-flex gap-1 pt-3">
  252. <input type="checkbox" id="newMemberToComplete" wire:model="newMemberToComplete">
  253. <label for="newMemberToComplete" class="form-label">Tesserato</label>
  254. </div>
  255. <div class="col-md-6">
  256. <label for="newMotivation" class="form-label">Motivazione</label>
  257. <select class="form-select form-select-lg me-1 @error('newMemberMotivationId') is-invalid @enderror" id="newMemberMotivationIdX">
  258. <option value="">
  259. @foreach($motivations_add as $m)
  260. <option value="{{$m["id"]}}">{{$m["name"]}}</option>
  261. @endforeach
  262. </select>
  263. </div>
  264. </div>
  265. </div>
  266. </div>
  267. <div class="modal-footer">
  268. <button class="btn--ui lightGrey" onclick="annulla()">annulla</a>
  269. <button type="button" class="btn--ui btn-primary" onclick="createMember()">Salva</button>
  270. </div>
  271. </div>
  272. </div>
  273. </div>
  274. <div wire:ignore.self class="modal fade" id="instructorModal" tabindex="-1" aria-labelledby="instructorModalLabel" aria-hidden="true">
  275. <div class="modal-dialog">
  276. <div class="modal-content">
  277. <div class="modal-header">
  278. <h5 class="modal-title text-primary" id="instructorModalLabel">Inserimento nuovo istruttore</h5>
  279. <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
  280. </div>
  281. <div class="modal-body">
  282. <div class="row">
  283. <div class="col-md-6">
  284. <label for="userName" class="form-label">Nome</label>
  285. <input class="form-control @error('userName') is-invalid @enderror" type="text" id="userName" placeholder="Nome" wire:model="userName">
  286. </div>
  287. <div class="col-md-6">
  288. <label for="userEmail" class="form-label">Email</label>
  289. <input class="form-control @error('userEmail') is-invalid @enderror" type="text" id="userEmail" placeholder="Email" wire:model="userEmail">
  290. </div>
  291. </div>
  292. </div>
  293. <div class="modal-footer">
  294. <button class="btn--ui lightGrey" onclick="annulla()">annulla</a>
  295. <button type="button" class="btn--ui btn-primary" wire:click.prevent="createInstructor()">Salva</button>
  296. </div>
  297. </div>
  298. </div>
  299. </div>
  300. <div wire:ignore.self class="modal fade saved-modal" id="editPresencesModal" tabindex="-1" role="dialog" aria-labelledby="editPresencesModal" aria-hidden="true">
  301. <div class="modal-dialog">
  302. <div class="modal-content">
  303. <div class="modal-header">
  304. <h5 class="modal-title text-primary" id="instructorModalLabel">Modifica presenza</h5>
  305. <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
  306. </div>
  307. <div class="modal-body">
  308. <div class="row">
  309. <div class="col-md-12">
  310. <label for="save_court_id" class="form-label">Campo</label>
  311. <select id="save_court_id" class="form-select form-select-lg me-1">
  312. <option value="0">
  313. @foreach($courts as $c)
  314. <option value="{{$c["id"]}}">{{$c["name"]}}</option>
  315. @endforeach
  316. </select>
  317. </div>
  318. <div class="col">
  319. <label for="save_instructor_id" class="form-label">Istruttore</label>
  320. <select id="save_instructor_id" class="form-select form-select-lg me-1">
  321. <option value="0">
  322. @foreach($instructors as $i)
  323. <option value="{{$i["id"]}}" {{\Auth::user()->id == $i["id"] ? "selected" : ""}}>{{$i["name"]}}</option>
  324. @endforeach
  325. </select>
  326. </div>
  327. <div class="col-auto mt-2">
  328. <br>
  329. <button type="button" class="btn--ui primary" data-bs-toggle="modal" data-bs-target="#instructorModal" style="width:50px">&nbsp;<i class="fa-solid fa-plus"></i></button>
  330. </div>
  331. <div class="col-md-12">
  332. <label for="save_notes" class="form-label">Note</label>
  333. <textarea class="form-control" id="save_notes"></textarea>
  334. </div>
  335. </div>
  336. </div>
  337. <div class="modal-footer">
  338. <button class="btn--ui lightGrey" onclick="annulla()">annulla</a>
  339. <button type="button" class="btn--ui btn-primary" onclick="save()">Salva</button>
  340. </div>
  341. </div>
  342. </div>
  343. </div>
  344. <div wire:ignore.self class="modal fade saved-modal" id="savedModal" tabindex="-1" role="dialog" aria-labelledby="savedModal" aria-hidden="true">
  345. <div class="modal-dialog">
  346. <div class="modal-content">
  347. <div class="modal-header"></div>
  348. <div class="modal-body pt-4 pb-4 text-center fw-bold">Presenze salvate con successo</div>
  349. </div>
  350. </div>
  351. </div>
  352. </div>
  353. @push('scripts')
  354. <link href="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/css/select2.min.css" rel="stylesheet" />
  355. <style>
  356. table.tableHead thead {
  357. /* Important */
  358. position: sticky;
  359. z-index: 100;
  360. top: 0;
  361. }
  362. .select2-container--default .select2-selection--single {
  363. background-color: #E9F0F5;
  364. border: 0.0625rem solid #DFE5EB;
  365. font-size: 0.75rem;
  366. }
  367. .select2-selection {
  368. height: 38px !important;
  369. }
  370. .select2-selection__rendered {
  371. padding-top: 3px;
  372. }
  373. .select2 {
  374. width: 100% !important;
  375. }
  376. .page-link.active,
  377. .active>.page-link {
  378. background-color: #006099 !important;
  379. }
  380. .select2-selection--multiple {
  381. overflow: hidden !important;
  382. height: auto !important;
  383. }
  384. .select2-container {
  385. box-sizing: border-box;
  386. display: inline-block;
  387. margin: 0;
  388. position: relative;
  389. vertical-align: middle;
  390. }
  391. .select2-container .select2-selection--single {
  392. box-sizing: border-box;
  393. cursor: pointer;
  394. display: block;
  395. height: 38px;
  396. user-select: none;
  397. -webkit-user-select: none;
  398. }
  399. .select2-container .select2-selection--single .select2-selection__rendered {
  400. display: block;
  401. padding-left: 8px;
  402. padding-right: 20px;
  403. overflow: hidden;
  404. text-overflow: ellipsis;
  405. white-space: nowrap;
  406. }
  407. /* .total.primary
  408. {
  409. font-size:38px !important;
  410. } */
  411. /* .total.primary.comp
  412. {
  413. font-size:32px !important;
  414. } */
  415. </style>
  416. <script src="https://code.jquery.com/jquery-2.2.4.min.js" integrity="sha256-BbhdlvQf/xTY9gja0Dq3HiwQF8LaCRTXxZKRutelT44=" crossorigin="anonymous"></script>
  417. <script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js"></script>
  418. @endpush
  419. @push('scripts')
  420. <script>
  421. var type = 1;
  422. var showAlert = false;
  423. var isSaving = false;
  424. $(document).ready(function() {
  425. setTimeout(() => {
  426. $('.memberClass').select2({
  427. tags: false
  428. });
  429. /*$('.memberClass').on('change', function (e) {
  430. var data = $('.memberClass').select2("val");
  431. @this.addMember(data);
  432. }); */
  433. }, 100);
  434. $(".btAdd").click(function(){
  435. showAlert = true;
  436. });
  437. $(".form-select").change(function(){
  438. showAlert = true;
  439. });
  440. $(".chkM").click(function(){
  441. showAlert = true;
  442. });
  443. } );
  444. Livewire.on('reload', () => {
  445. setTimeout(() => {
  446. $('.memberClass').select2({
  447. tags: false
  448. });
  449. /*$('.memberClass').on('change', function (e) {
  450. var data = $('.memberClass').select2("val");
  451. @this.addMember(data);
  452. }); */
  453. }, 100);
  454. $(".showDelete").hide();
  455. $(".btSave").show();
  456. });
  457. window.livewire.on('saved', () => {
  458. $('#userModal').modal('hide');
  459. $('#deleteModal').modal('hide');
  460. $('#instructorModal').modal('hide');
  461. $('#editPresencesModal').modal('hide');
  462. });
  463. window.livewire.on('deleteSaved', () => {
  464. $('#deleteModal').modal('hide');
  465. });
  466. window.livewire.on('setSaving', () => {
  467. isSaving = true;
  468. showSavedAlert();
  469. });
  470. let saved_alert_timeout;
  471. function showSavedAlert() {
  472. $('#savedModal').modal("show");
  473. clearTimeout(saved_alert_timeout);
  474. saved_alert_timeout = setTimeout(() => {
  475. $('#savedModal').modal("hide");
  476. }, 3000);
  477. }
  478. let stay = false;
  479. function saveAndQuit()
  480. {
  481. stay = false;
  482. $('#editPresencesModal').modal("show");
  483. }
  484. function saveAndStay()
  485. {
  486. stay = true;
  487. $('#editPresencesModal').modal("show");
  488. }
  489. function save()
  490. {
  491. let presence_ids = [];
  492. $('input[name="presence"][type="checkbox"]').each(function () {
  493. if ($(this).is(":checked"))
  494. {
  495. var val = $(this).val();
  496. presence_ids.push(val);
  497. }
  498. });
  499. @if($manual)
  500. var motivation_manual_id = $("#motivation_manual_id").val();
  501. @this.set('motivation_manual_id', motivation_manual_id);
  502. @endif
  503. var save_court_id = $("#save_court_id").val();
  504. @this.set('save_court_id', save_court_id);
  505. var save_instructor_id = $("#save_instructor_id").val();
  506. @this.set('save_instructor_id', save_instructor_id);
  507. var save_notes = $("#save_notes").val();
  508. @this.set('save_notes', save_notes);
  509. if (stay == true) {
  510. @this.saveAndStay(presence_ids);
  511. } else {
  512. @this.save(presence_ids);
  513. }
  514. $('#editPresencesModal').modal("hide");
  515. }
  516. function cancel()
  517. {
  518. var ids = [];
  519. $('input[name="annulla_lezione"][type="checkbox"]').each(function () {
  520. if ($(this).is(":checked"))
  521. {
  522. var val = $(this).val();
  523. ids.push(val);
  524. }
  525. });
  526. var motivation_id = $("#motivation_id").val();
  527. @this.cancel(ids, motivation_id);
  528. }
  529. function createMember()
  530. {
  531. var ids = [];
  532. /*$('input[type=checkbox]').each(function () {
  533. if ($(this).is(":checked"))
  534. {
  535. var val = $(this).val();
  536. ids.push(val);
  537. }
  538. });*/
  539. if (type == 1)
  540. {
  541. var data = $('.memberClass').select2("val");
  542. @this.addMember(data);
  543. @this.set('newMemberMotivationId', $("#newMemberMotivationId").val());
  544. }
  545. else
  546. {
  547. @this.set('newMemberMotivationId', $("#newMemberMotivationIdX").val());
  548. @this.set('newMemberFirstName', $("#newMemberFirstName").val());
  549. @this.set('newMemberLastName', $("#newMemberLastName").val());
  550. @this.set('newMemberEmail', $("#newMemberEmail").val());
  551. @this.set('newMemberFiscalCode', $("#newMemberFiscalCode").val());
  552. }
  553. @this.createMember();
  554. }
  555. function removeSingle(id)
  556. {
  557. if (confirm('Sei sicuro?'))
  558. @this.removeSingle(id);
  559. }
  560. function annulla()
  561. {
  562. $('#userModal').modal('hide');
  563. $('#deleteModal').modal('hide');
  564. $('#instructorModal').modal('hide');
  565. $('#editPresencesModal').modal('hide');
  566. }
  567. function togglePresenceCheckboxDisabled(disabled = false) {
  568. let presence_checkboxes = document.querySelectorAll("input[name='presence'][type='checkbox']");
  569. presence_checkboxes.forEach((presence_checkbox) => {
  570. presence_checkbox.disabled = disabled;
  571. });
  572. }
  573. function showHideDelete()
  574. {
  575. togglePresenceCheckboxDisabled(true);
  576. $(".annulla-lezione").show();
  577. $(".showDelete").show();
  578. $(".btSave").hide();
  579. }
  580. function hideShowDelete()
  581. {
  582. togglePresenceCheckboxDisabled(false);
  583. $(".annulla-lezione").hide();
  584. $(".showDelete").hide();
  585. $(".btSave").show();
  586. }
  587. window.onbeforeunload = function(){
  588. if (showAlert && !isSaving)
  589. return 'Sei sicuro';
  590. };
  591. function addUser()
  592. {
  593. $("#newMemberMotivationId").val('');
  594. $("#newMemberMotivationIdX").val('');
  595. $("#newMemberFirstName").val('');
  596. $("#newMemberLastName").val('');
  597. $("#newMemberEmail").val('');
  598. $("#newMemberFiscalCode").val('');
  599. $(".existUser").show();
  600. $(".newUser").hide();
  601. let radioOption = jQuery("input:radio[value=1]");
  602. radioOption.prop("checked", true);
  603. }
  604. function change(val) {
  605. if (val == 1) {
  606. $(".existUser").css("display", "block");
  607. $(".newUser").css("display", "none");
  608. } else if (val == 2) {
  609. $(".newUser").css("display", "block");
  610. $(".existUser").css("display", "none");
  611. }
  612. type = val;
  613. }
  614. </script>
  615. @endpush
  616. @push("css")
  617. <link href="/css/calendar.css" rel="stylesheet" />
  618. @endpush