presence.blade.php 28 KB

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