course.blade.php 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601
  1. <div class="col card--ui" id="card--dashboard">
  2. <header id="title--section" style="display:none !important" class="d-flex align-items-center justify-content-between">
  3. <div class="title--section_name d-flex align-items-center justify-content-between">
  4. <i class="ico--ui title_section utenti me-2"></i>
  5. <h2 class="primary">@if(!$add && !$update)Corsi @else Inserimento/modifica corso @endif</h2>
  6. </div>
  7. @if(!$add && !$update)
  8. <div class="title--section_addButton" wire:click="add()" style="cursor: pointer;">
  9. <div class="btn--ui entrata d-flex justify-items-between">
  10. <a href="#" wire:click="add()" style="color:white">Aggiungi</a>
  11. </div>
  12. </div>
  13. @endif
  14. </header>
  15. @if(!$add && !$update)
  16. <a class="btn--ui lightGrey" href="/settings?type=corsi"><i class="fa-solid fa-arrow-left"></i></a><br>
  17. <div class="row mt-3" style="margin-bottom:2rem !important;">
  18. <div class="col-1 mt-4">
  19. <h4>Anno</h4>
  20. </div>
  21. <div class="col-2 mt-4">
  22. <select class="form-select filterYear" onchange="reload()">
  23. <option value="">--Seleziona--
  24. @foreach($course_years as $c)
  25. @php
  26. $selected = '';
  27. if (!isset($_GET["year"]))
  28. {
  29. try
  30. {
  31. list($f, $t) = explode("-", $c);
  32. if ($f == date("Y") - 1)
  33. $selected = 'selected';
  34. } catch (Exception $e) {
  35. }
  36. }
  37. else
  38. {
  39. if ($_GET["year"] == $c)
  40. $selected = 'selected';
  41. }
  42. @endphp
  43. <option value="{{$c}}" {{$selected}}>{{$c}}
  44. @endforeach
  45. </select>
  46. </div>
  47. </div>
  48. <section id="resume-table">
  49. <div class="compare--chart_wrapper d-none"></div>
  50. <table class="table tablesaw tableHead tablesaw-stack" id="tablesaw-350" width="100%">
  51. <thead>
  52. <tr>
  53. <th style="text-align:center" scope="col"><input type="checkbox" class="checkAll"></th>
  54. <th scope="col">Anno</th>
  55. <th scope="col">Nome</th>
  56. <th scope="col">Livello</th>
  57. <th scope="col">Tipologia</th>
  58. <th scope="col">Frequenza</th>
  59. <th scope="col">Prezzo mensile</th>
  60. <th scope="col">N° partecipanti</th>
  61. <th scope="col">...</th>
  62. </tr>
  63. </thead>
  64. <tbody id="checkall-target">
  65. @foreach($records as $record)
  66. <tr>
  67. <td style="text-align:center"><input type="checkbox" class="chkCourse" name="{{$record->id}}"></td>
  68. <td>{{$record->year}}</td>
  69. <td>{{$record->name}}</td>
  70. <td>{{$record->level->name ?? ""}}</td>
  71. <td>{{$record->type->name ?? ""}}</td>
  72. <td>{{$record->frequency->name ?? ""}}</td>
  73. <td>{{formatPrice($record->price)}}</td>
  74. <td>{{$record->getCount()}}</td>
  75. <td>
  76. <button type="button" class="btn" wire:click="edit({{ $record->id }})" data-bs-toggle="popover" data-bs-trigger="hover focus" data-bs-placement="bottom" data-bs-content="Modifica"><i class="fa-regular fa-pen-to-square"></i></button>
  77. <button type="button" class="btn" onclick="confirm('Sei sicuro?') || event.stopImmediatePropagation()" wire:click="delete({{ $record->id }})" data-bs-toggle="popover" data-bs-trigger="hover focus" data-bs-placement="bottom" data-bs-content="Elimina"><i class="fa-regular fa-trash-can"></i></button>
  78. <button type="button" class="btn" wire:click="duplicate({{ $record->id }}, false)" data-bs-toggle="popover" data-bs-trigger="hover focus" data-bs-placement="bottom" data-bs-content="Duplica"><i class="fa-regular fa-copy"></i></button>
  79. </td>
  80. </tr>
  81. @endforeach
  82. </tbody>
  83. </table>
  84. </section>
  85. @else
  86. <a class="btn--ui lightGrey" href="/courses?showFilters=1"><i class="fa-solid fa-arrow-left"></i></a><br>
  87. <div class="container">
  88. @if (session()->has('error'))
  89. <div class="alert alert-danger" role="alert">
  90. {{ session()->get('error') }}
  91. </div>
  92. @endif
  93. <div class="row">
  94. <div class="col">
  95. <form action="">
  96. <div class="row mb-3 ">
  97. <div class="col-12 mt-2">
  98. <input type="radio" name="chkType" value="standard" wire:model="type">&nbsp;Standard
  99. &nbsp;&nbsp;&nbsp;
  100. <input type="radio" name="chkType" value="custom" wire:model="type">&nbsp;Personalizzato
  101. </div>
  102. <div class="col-6 mt-2">
  103. <div class="form--item">
  104. <label for="inputName" class="form-label">Nome</label>
  105. <input class="form-control js-keyupTitle @error('name') is-invalid @enderror" type="text" id="name" placeholder="Nome" wire:model="name">
  106. @error('name')
  107. <div class="invalid-feedback">{{ $message }}</div>
  108. @enderror
  109. </div>
  110. </div>
  111. <div class="col-6 mt-2">
  112. <div class="form--item">
  113. <label for="inputName" class="form-label">Tipologia</label>
  114. <select class="form-select form-select-lg me-1 @error('course_type_id') is-invalid @enderror" wire:model="course_type_id">
  115. <option value="">
  116. @foreach($course_types as $c)
  117. <option value="{{$c["id"]}}">{{$c["name"]}}</option>
  118. @endforeach
  119. </select>
  120. </div>
  121. </div>
  122. <div class="col-6 mt-2">
  123. <div class="form--item">
  124. <label for="inputName" class="form-label">Durata</label>
  125. <select class="form-select form-select-lg me-1 @error('course_duration_id') is-invalid @enderror" wire:model="course_duration_id">
  126. <option value="">
  127. @foreach($course_durations as $c)
  128. <option value="{{$c["id"]}}">{{$c["name"]}}</option>
  129. @endforeach
  130. </select>
  131. </div>
  132. </div>
  133. <div class="col-6 mt-2">
  134. <div class="form--item">
  135. <label for="inputName" class="form-label">Frequenza</label>
  136. <select class="form-select form-select-lg me-1 @error('course_frequency_id') is-invalid @enderror" wire:model="course_frequency_id">
  137. <option value="">
  138. @foreach($course_frequencies as $c)
  139. <option value="{{$c["id"]}}">{{$c["name"]}}</option>
  140. @endforeach
  141. </select>
  142. </div>
  143. </div>
  144. <div class="col-6 mt-2">
  145. <div class="form--item">
  146. <label for="inputName" class="form-label">Livello</label>
  147. <select class="form-select form-select-lg me-1 @error('course_level_id') is-invalid @enderror" wire:model="course_level_id">
  148. <option value="">
  149. @foreach($course_levels as $c)
  150. <option value="{{$c["id"]}}">{{$c["name"]}}</option>
  151. @endforeach
  152. </select>
  153. </div>
  154. </div>
  155. <div class="col-3 mt-2">
  156. <div class="form--item">
  157. <label for="inputName" class="form-label">Data inizio</label>
  158. <input class="form-control" type="date" placeholder="Data inizio" wire:model="date_from">
  159. </div>
  160. </div>
  161. <div class="col-3 mt-2">
  162. <div class="form--item">
  163. <label for="inputName" class="form-label">Data fine</label>
  164. <input class="form-control" type="date" placeholder="Data fine" wire:model="date_to">
  165. </div>
  166. </div>
  167. <div class="col-6 mt-2">
  168. <div class="form--item">
  169. <label for="inputName" class="form-label">Prezzo mensile</label>
  170. <input class="form-control js-keyupTitle @error('price') is-invalid @enderror" type="text" id="price" onkeyup="onlyNumberAmount(this)" placeholder="€ 0,00" wire:model="price">
  171. @error('price')
  172. <div class="invalid-feedback">{{ $message }}</div>
  173. @enderror
  174. </div>
  175. </div>
  176. <div class="col-6 mt-2">
  177. <div class="form--item">
  178. <label for="inputName" class="form-label">Prezzo iscrizione</label>
  179. <input class="form-control js-keyupTitle @error('subscription_price') is-invalid @enderror" type="text" id="subscription_price" onkeyup="onlyNumberAmount(this)" placeholder="€ 0,00" wire:model="subscription_price">
  180. @error('subscription_price')
  181. <div class="invalid-feedback">{{ $message }}</div>
  182. @enderror
  183. </div>
  184. </div>
  185. <div class="col-6 mt-2">
  186. <div class="form--item">
  187. <label for="inputName" class="form-label">Causale</label>
  188. <livewire:causals :type="$typeIN" :idx="0" :causal_id="$causal_id" :wire:key="0" />
  189. @error('causal_id')
  190. <span style="argin-top: 0.25rem; font-size: 0.875em; color: var(--bs-form-invalid-color);">{{ $message }}</span>
  191. @enderror
  192. </div>
  193. </div>
  194. <div class="col-6 mt-2">
  195. <div class="form--item">
  196. <label for="inputName" class="form-label">Causale iscrizione</label>
  197. <livewire:causals :type="$typeIN" :idx="0" :causal_id="$sub_causal_id" :wire:key="0" :emit="$setSubscriptionCausal" />
  198. @error('sub_causal_id')
  199. <span style="argin-top: 0.25rem; font-size: 0.875em; color: var(--bs-form-invalid-color);">{{ $message }}</span>
  200. @enderror
  201. </div>
  202. </div>
  203. <div class="col-6 mt-2">
  204. <div class="form--item">
  205. <label for="inputName" class="form-label">N° partecipanti</label>
  206. <input class="form-control js-keyupTitle @error('max_members') is-invalid @enderror" type="text" id="max_members" placeholder="Numero massimo partecipanti" wire:model="max_members">
  207. @error('max_members')
  208. <div class="invalid-feedback">{{ $message }}</div>
  209. @enderror
  210. </div>
  211. </div>
  212. <div class="col-6 mt-2">
  213. <div class="form--item">
  214. <label for="inputName" class="form-label">Istruttore</label>
  215. <input class="form-control js-keyupTitle @error('instructor') is-invalid @enderror" type="text" id="instructor" placeholder="Istruttore" wire:model="instructor">
  216. @error('instructor')
  217. <div class="invalid-feedback">{{ $message }}</div>
  218. @enderror
  219. </div>
  220. </div>
  221. <div class="col-6 mt-2">
  222. <div class="form--item">
  223. <label for="inputName" class="form-label">Anno</label>
  224. <select class="form-control" wire:model="year">
  225. @for($i=2024; $i<=date("Y") + 1; $i++)
  226. <option value="{{$i . "-" . $i + 1}}">{{$i . "/" . $i + 1}}
  227. @endfor
  228. </select>
  229. @error('year')
  230. <div class="invalid-feedback">{{ $message }}</div>
  231. @enderror
  232. </div>
  233. </div>
  234. <div class="col-6 mt-2">
  235. <div class="form--item">
  236. <label for="inputName" class="form-label">Gruppo di appartenenza</label>
  237. <select class="form-select form-select-lg me-1 @error('category_id') is-invalid @enderror" wire:model="category_id">
  238. <option value="">
  239. @foreach($categories as $category)
  240. <option value="{{$category["id"]}}">{{str_repeat(' ', $category["indentation"])}}{{$category["name"]}}
  241. @endforeach
  242. </select>
  243. </div>
  244. </div>
  245. <div class="col">
  246. <div class="form--item">
  247. <label for="enabled" class="form-label">Abilitato</label>
  248. <input class="form-check-input form-control" style="width:22px; height:22px;" type="checkbox" id="enabled" wire:model="enabled">
  249. </div>
  250. </div>
  251. @foreach($when as $idW => $w)
  252. <div class="col-12">
  253. <div class="day durata--corso d-flex">
  254. <label for="" class="form-label">Giorno</label>
  255. <div class="durata--corso_days mb-3">
  256. <a class="{{in_array('lun', $when[$idW]["day"]) ? 'selected' : 'notSelected'}}" wire:click="setDay({{$idW}}, 'lun')">Lun</a>
  257. <a class="{{in_array('mar', $when[$idW]["day"]) ? 'selected' : 'notSelected'}}" wire:click="setDay({{$idW}}, 'mar')">Mar</a>
  258. <a class="{{in_array('mer', $when[$idW]["day"]) ? 'selected' : 'notSelected'}}" wire:click="setDay({{$idW}}, 'mer')">Mer</a>
  259. <a class="{{in_array('gio', $when[$idW]["day"]) ? 'selected' : 'notSelected'}}" wire:click="setDay({{$idW}}, 'gio')">Gio</a>
  260. <a class="{{in_array('ven', $when[$idW]["day"]) ? 'selected' : 'notSelected'}}" wire:click="setDay({{$idW}}, 'ven')">Ven</a>
  261. <a class="{{in_array('sab', $when[$idW]["day"]) ? 'selected' : 'notSelected'}}" wire:click="setDay({{$idW}}, 'sab')">Sab</a>
  262. <a class="{{in_array('dom', $when[$idW]["day"]) ? 'selected' : 'notSelected'}}" wire:click="setDay({{$idW}}, 'dom')">Dom</a>
  263. </div>
  264. <div class="durata--corso_select">
  265. <div class="from--h me-3">
  266. <label for="" class="form-label">Dalle</label>
  267. <select class="form-select" wire:model="when.{{$idW}}.from">
  268. <option value="">--Seleziona--
  269. @for($c=6;$c<=23;$c++)
  270. <option value="{{str_pad($c, 2, "0", STR_PAD_LEFT)}}:00">{{str_pad($c, 2, "0", STR_PAD_LEFT)}}:00
  271. <option value="{{str_pad($c, 2, "0", STR_PAD_LEFT)}}:30">{{str_pad($c, 2, "0", STR_PAD_LEFT)}}:30
  272. @endfor
  273. </select>
  274. </div>
  275. <div class="to--h">
  276. <label for="" class="form-label">Alle</label>
  277. <select class="form-select" wire:model="when.{{$idW}}.to">
  278. <option value="">--Seleziona--
  279. @for($c=6;$c<=23;$c++)
  280. <option value="{{str_pad($c, 2, "0", STR_PAD_LEFT)}}:00">{{str_pad($c, 2, "0", STR_PAD_LEFT)}}:00
  281. <option value="{{str_pad($c, 2, "0", STR_PAD_LEFT)}}:30">{{str_pad($c, 2, "0", STR_PAD_LEFT)}}:30
  282. @endfor
  283. </select>
  284. </div>
  285. </div>
  286. <button class="btn--ui primary remove--day position-absolute" wire:click.prevent="delRow({{$idW}})"><i class="fa-solid fa-minus"></i></button>
  287. <button class="btn--ui primary add--day position-absolute" wire:click.prevent="addRow()"><i class="fa-solid fa-plus"></i></button>
  288. </div>
  289. </div>
  290. @endforeach
  291. <!--<div class="col-6">
  292. <div class="form--item">
  293. <label for="inputName" class="form-label">Durata</label>
  294. <input class="form-control js-keyupTitle " type="text" id="duration" placeholder="Durata" wire:model="duration">
  295. </div>
  296. </div>-->
  297. @if(false)
  298. <div class="col-12">
  299. <div class="form--item">
  300. <label for="inputName" class="form-label">Seleziona mesi</label>
  301. @foreach($monthList as $idx => $y)
  302. <div class="row">
  303. <div class="col-12">
  304. <b>{{$idx}}</b>
  305. </div>
  306. @foreach($y as $m)
  307. <div class="col-3">{{$m}}</div>
  308. @endforeach
  309. </div>
  310. <div class="row"><br></div>
  311. @endforeach
  312. </div>
  313. </div>
  314. @endif
  315. </div>
  316. <div class="form--item">
  317. <button type="button" class="btn--ui lightGrey" onclick="annulla()">Annulla</button>
  318. @if($add)
  319. <button type="submit" class="btn--ui" wire:click.prevent="store()">Salva</button>
  320. @endif
  321. @if($update)
  322. <button type="submit" class="btn--ui" wire:click.prevent="update()">Salva</button>
  323. @endif
  324. </div>
  325. </form>
  326. </div>
  327. </div>
  328. </div>
  329. @endif
  330. </div>
  331. @push('scripts')
  332. <link href="/css/datatables.css" rel="stylesheet" />
  333. <style>
  334. a.notSelected
  335. {
  336. display: flex;
  337. margin-right:10px;
  338. float:left;
  339. height: 2.5rem !important;
  340. width:50px;
  341. align-items: center;
  342. justify-content: center;
  343. color: #006099;
  344. background-color: #d3dce1 !important;
  345. padding: 0 1.25rem;
  346. font-size: 0.875rem;
  347. font-family: greycliff-cf, sans-serif;
  348. border-radius: 1.875rem !important;
  349. -webkit-border-radius: 1.875rem !important;
  350. -moz-border-radius: 1.875rem !important;
  351. -webkit-transition: all 0.3s ease-in-out;
  352. -moz-transition: all 0.3s ease-in-out;
  353. -o-transition: all 0.3s ease-in-out;
  354. transition: all 0.3s ease-in-out;
  355. border: none;
  356. }
  357. a.selected
  358. {
  359. display: flex;
  360. margin-right:10px;
  361. float:left;
  362. height: 2.5rem !important;
  363. width:50px;
  364. align-items: center;
  365. justify-content: center;
  366. color: #fff;
  367. background-color: #006099 !important;
  368. padding: 0 1.25rem;
  369. font-size: 0.875rem;
  370. font-family: greycliff-cf, sans-serif;
  371. border-radius: 1.875rem !important;
  372. -webkit-border-radius: 1.875rem !important;
  373. -moz-border-radius: 1.875rem !important;
  374. -webkit-transition: all 0.3s ease-in-out;
  375. -moz-transition: all 0.3s ease-in-out;
  376. -o-transition: all 0.3s ease-in-out;
  377. transition: all 0.3s ease-in-out;
  378. border: none;
  379. }
  380. div.day
  381. {
  382. margin-top:20px;
  383. color: #006099;
  384. background-color: #ffffff !important;
  385. padding: 20px;
  386. border-radius: 1.875rem !important;
  387. -webkit-border-radius: 1.875rem !important;
  388. -moz-border-radius: 1.875rem !important;
  389. -webkit-transition: all 0.3s ease-in-out;
  390. -moz-transition: all 0.3s ease-in-out;
  391. -o-transition: all 0.3s ease-in-out;
  392. transition: all 0.3s ease-in-out;
  393. border: 2px solid #d3dce1;
  394. }
  395. </style>
  396. <script src="https://code.jquery.com/jquery-2.2.4.min.js" integrity="sha256-BbhdlvQf/xTY9gja0Dq3HiwQF8LaCRTXxZKRutelT44=" crossorigin="anonymous"></script>
  397. <script src="/assets/js/datatables.js"></script>
  398. <script src="https://cdn.datatables.net/buttons/3.0.2/js/buttons.dataTables.js"></script>
  399. <script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.10.1/jszip.min.js"></script>
  400. <script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.2.7/pdfmake.min.js"></script>
  401. <script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.2.7/vfs_fonts.js"></script>
  402. @endpush
  403. @push('scripts')
  404. <script>
  405. function onlyNumberAmount(input) {
  406. let v = input.value.replace(/\D+/g, '');
  407. if (v.length > 14) v = v.slice(0, 14);
  408. input.value = "€ " + v.replace(/(\d)(\d\d)$/, "$1,$2").replace(/(^\d{1,3}|\d{3})(?=(?:\d{3})+(?:,|$))/g, '$1.');
  409. }
  410. var isEdit = false;
  411. Livewire.on('setEdit', (x) =>
  412. {
  413. isEdit = x;
  414. console.log(isEdit);
  415. });
  416. function annulla()
  417. {
  418. window.onbeforeunload = null;
  419. document.location.href = '/courses';
  420. }
  421. window.onbeforeunload = function(){
  422. if (isEdit)
  423. return 'Cambiando pagina le eventuali modifiche andranno perse';
  424. };
  425. $(document).ready(function() {
  426. loadDataTable();
  427. } );
  428. Livewire.on('load-data-table', () => {
  429. loadDataTable();
  430. });
  431. function reload()
  432. {
  433. console.log($(".filterYear").val());
  434. window.location.href = '/courses?year=' + $(".filterYear").val();
  435. }
  436. function loadDataTable(){
  437. if ( $.fn.DataTable.isDataTable('#tablesaw-350') ) {
  438. $('#tablesaw-350').DataTable().destroy();
  439. }
  440. $('#tablesaw-350').DataTable({
  441. thead: {
  442. 'th': {'background-color': 'blue'}
  443. },
  444. layout: {
  445. topStart : null,
  446. topEnd : null,
  447. top1A: {
  448. buttons: [
  449. {
  450. extend: 'collection',
  451. text: 'Esporta',
  452. buttons: [
  453. {
  454. extend: 'excelHtml5',
  455. title: 'Corsi',
  456. exportOptions: {
  457. columns: ":not(':last')"
  458. }
  459. },
  460. {
  461. extend: 'pdfHtml5',
  462. title: 'Corsi',
  463. exportOptions: {
  464. columns: ":not(':last')"
  465. }
  466. },
  467. {
  468. extend: 'print',
  469. text: 'Stampa',
  470. title: 'Corsi',
  471. exportOptions: {
  472. columns: ":not(':last')"
  473. }
  474. }
  475. ],
  476. dropup: true
  477. }
  478. ]
  479. },
  480. top1B : {
  481. pageLength: {
  482. menu: [[10, 25, 50, 100, 100000], [10, 25, 50, 100, "Tutti"]]
  483. }
  484. },
  485. top1C :'search',
  486. },
  487. "columnDefs": [ {
  488. "targets": 0,
  489. "orderable": false
  490. } ],
  491. pagingType: 'numbers',
  492. "language": {
  493. "url": "/assets/js/Italian.json"
  494. },
  495. "fnInitComplete": function (oSettings, json) {
  496. var html = '&nbsp;<a href="#" class="addData btn--ui"><i class="fa-solid fa-plus"></i></a>';
  497. $(".dt-search").append(html);
  498. html = '&nbsp;<a href="#" class="duplicateData btn--ui" style="display:none"><i class="fa-solid fa-copy fa-lg" style="height:5px;"></i></a>';
  499. $(".dt-buttons").after(html);
  500. }
  501. });
  502. $('#tablesaw-350 thead tr th').addClass('col');
  503. $('#tablesaw-350 thead tr th').css("background-color", "#f6f8fa");
  504. var courses = [];
  505. $(".chkCourse").click(function(){
  506. var id = $(this).attr('name');
  507. if(!courses.includes(id)){
  508. courses.push(id);
  509. }else{
  510. courses.splice(courses.indexOf(id), 1); //deleting
  511. }
  512. if (courses.length > 0)
  513. $(".duplicateData").show();
  514. else
  515. $(".duplicateData").hide();
  516. console.log(courses);
  517. });
  518. $(document).ready(function() {
  519. $(document).on("click",".addData",function() {
  520. $(".title--section_addButton").trigger("click");
  521. });
  522. $(document).on("click",".duplicateData",function() {
  523. @this.duplicateMultiple(courses);
  524. });
  525. } );
  526. var all = false;
  527. $(".checkAll").click(function(){
  528. all = !all;
  529. courses = [];
  530. $('.chkCourse').each(function(){
  531. $(this).prop('checked', all);
  532. if (all)
  533. courses.push($(this).attr('name'));
  534. });
  535. if (courses.length > 0)
  536. $(".duplicateData").show();
  537. else
  538. $(".duplicateData").hide();
  539. console.log(courses);
  540. });
  541. }
  542. </script>
  543. @endpush