member.blade.php 168 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399
  1. <div>
  2. @if($showDetail)
  3. <a style="margin-top:20px" class="btn--ui lightGrey" href="/{{$from != '' ? ($from . '?showFilters=1') : 'members'}}"><i class="fa-solid fa-arrow-left"></i></a><br><br>
  4. <div class="col col-lg-12" style="margin-bottom:100px;">
  5. <div class="user--profile d-lg-flex" style="margin-top:20px !important">
  6. <div class="user--profile_card d-flex justify-content-between flex-column w-100 w-lg-auto mb-3 mb-lg-0">
  7. <div class="user--details">
  8. <header>
  9. <div class="avatar--wrapper d-flex align-items-center justify-content-between w-50">
  10. <figure class="m-0 avatar--wrapper_img">
  11. @if ($currentMember->image != '')
  12. @php
  13. $fileService = app(App\Services\MemberFileService::class);
  14. $imageUrl = $fileService->getFileUrl($currentMember->image);
  15. @endphp
  16. @if($imageUrl)
  17. <img src="{{ $imageUrl }}" style="max-width:200px" alt="Profile Image">
  18. @else
  19. <div style="width: 200px; height: 150px; background: #f0f0f0; display: flex; align-items: center; justify-content: center;">
  20. <span style="color: #999;">Image not available</span>
  21. </div>
  22. @endif
  23. @endif
  24. </figure>
  25. </div>
  26. </header>
  27. <article>
  28. <header class="title d-flex align-items-center mb-4"><i class="ico--ui borsellino fill me-2"></i>Borsellino</header>
  29. <div class="credito d-flex align-items-center justify-content-between">
  30. <div class="credito_title">
  31. <span>Borsellino MAD: <br></span><span class="value">{{formatPrice($currentMember->getMoney())}}</span>
  32. </div>
  33. <a href="/in?new=1&memberId={{$currentMember->id}}&causalId={{$causalId}}" class="btn--ui white small" style="width:100px">ricarica</a>
  34. </div>
  35. <div class="credito d-flex align-items-center justify-content-between">
  36. <br><br><button type="button" class="btn--ui white small" data-bs-toggle="modal" data-bs-target="#userModal" style="width:100px">Modifica</button>
  37. </div>
  38. </article>
  39. <article>
  40. <header class="title d-flex align-items-center mb-4"><i class="ico--ui corsi fill me-2"></i>Certificato</header>
  41. @if(sizeof($currentMember->certificates) > 0)
  42. @php
  43. $cert = $currentMember->certificates[0]
  44. @endphp
  45. <ul class="course-list m-0 p-0">
  46. <li>
  47. <span class="course_name">
  48. {{$cert->type == 'A' ? 'Agonistico' : 'Non agonistico'}}<br>
  49. Scadenza: <span class="title-detail_date">{{$cert->expire_date ? date("d/m/Y", strtotime($cert->expire_date)) : ''}}
  50. </span>
  51. </span>
  52. <span style="float:right">
  53. @if($cert->expire_date < date("Y-m-d"))
  54. <span class="badge tessera-badge suspended">scaduto</span>
  55. @endif
  56. @if($cert->expire_date . " 23:59:59" >= date("Y-m-d") && $cert->expire_date < date("Y-m-d", strtotime("+1 month")))
  57. <span class="badge tessera-badge due">in scadenza</span>
  58. @endif
  59. @if($cert->expire_date . " 23:59:59" >= date("Y-m-d", strtotime("+1 month")))
  60. <span class="badge tessera-badge active">valido</span>
  61. @endif
  62. </span>
  63. </li>
  64. </ul>
  65. @endif
  66. </article>
  67. <article>
  68. <header class="title d-flex align-items-center mb-4"><i class="ico--ui corsi fill me-2"></i>Tesseramento</header>
  69. @if(sizeof($currentMember->cards) > 0)
  70. @foreach($currentMember->cards as $card)
  71. @php
  72. $active = 'active';
  73. if ($card->expire_date != '' && $card->expire_date < date("Y-m-d 23:59:59"))
  74. {
  75. $active = 'suspended';
  76. }
  77. @endphp
  78. @if($active != 'suspended')
  79. <ul class="course-list m-0 p-0">
  80. <li>
  81. <span class="course_name">
  82. {{$card->card->name}}<br>
  83. Scadenza: <span class="title-detail_date">{{$card->expire_date ? date("d/m/Y", strtotime($card->expire_date)) : ''}}
  84. </span>
  85. </span>
  86. <span style="float:right">
  87. <span class="badge tessera-badge {{$active}}">{{$active == 'active' ? 'ATTIVA' : 'SCADUTA'}}
  88. </span>
  89. </li>
  90. </ul>
  91. @endif
  92. @endforeach
  93. @endif
  94. </article>
  95. </div>
  96. </div>
  97. <div class="user--profile_resume">
  98. <header class="d-flex align-item-center ">
  99. <div class="user_name me-4">
  100. <span class="name">{{$currentMember->first_name}} {{$currentMember->last_name}}</span>
  101. <span class="badge tessera-badge {{$currentStatus["status"] > 0 ? ($currentStatus["status"] == 2 ? 'active' : 'due') : 'suspended'}}">{{$currentStatus["status"] > 0 ? ($currentStatus["status"] == 2 ? 'Tesserato' : 'Sospeso') : 'Non tesserato'}}</span>
  102. </div>
  103. <button class="btn--ui extraLightGrey" wire:click="edit({{ $currentMember->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>
  104. </header>
  105. <ul class="user-address mb-4 p-0">
  106. <li><i class="ico--ui resume--ico phone me-2"></i><span>Tel. {{$currentMember->phone}}</span></li>
  107. <li><i class="ico--ui resume--ico birth me-2"></i><span>Nato/a il {{$currentMember->birth_date ? date("d/m/Y", strtotime($currentMember->birth_date)) : ''}}</span>&nbsp;({{$currentMember->getAge()}} anni)</li>
  108. <li><i class="ico--ui resume--ico mail me-2"></i><span>{{strtolower($currentMember->email)}}</span></li>
  109. </ul>
  110. <ul class="user-residence p-0">
  111. <li><i class="ico--ui residence me-2"></i><span class="title">Residenza</span></li>
  112. <li><i class="ico--ui resume--ico blank me-2"></i>
  113. <span>
  114. @if($currentMember->city_id > 0)
  115. {{$this->getCity($currentMember->city_id)}}
  116. @if($currentMember->province_id > 0)
  117. ( {{$this->getProvince($currentMember->province_id)}} ) -
  118. @endif
  119. @endif
  120. {{ $currentMember->zip_code }}<br>
  121. {{$currentMember->address}}
  122. </span>
  123. </li>
  124. </ul>
  125. <div class="resume--tab_info gruppi">
  126. <h2 class="mb-3">Gruppi di appartenenza</h2>
  127. <div class="resume--info d-flex align-items-start row">
  128. @foreach($currentMember->categories as $member_category)
  129. <div class="col-md-3 mb-3">
  130. <i class="ico--ui gruppi me-2"></i>
  131. <div class="title" style="margin-right:20px">
  132. <h4>{{$member_category->category->getTree()}}</h4>
  133. </div>
  134. </div>
  135. @endforeach
  136. </div>
  137. </div>
  138. <div class="resume--tab_info corsi">
  139. <h2 class="mb-3">Corsi</h2>
  140. @foreach($currentMember->courses as $member_course)
  141. <div class="d-flex align-items-center corsi--user_details">
  142. <div class="title me-3">
  143. <h4>{{$member_course->course->getTree()}}</h4>
  144. </div>
  145. <div class="corsi--mesi me-3">
  146. <span class="corsi_mesi_text">
  147. @php
  148. $aMo = json_decode($member_course->months);
  149. if (sizeof($aMo) == 1)
  150. {
  151. print($this->getMonth($aMo[0]->m));
  152. }
  153. if (sizeof($aMo) > 1)
  154. {
  155. print($this->getMonth($aMo[0]->m) . " - " . $this->getMonth($aMo[sizeof($aMo) - 1]->m));
  156. }
  157. @endphp
  158. </span>
  159. </div>
  160. <div class="title--dettagli corsi--orari me-3">
  161. <span class="corsi--orari_text">
  162. @foreach(json_decode($member_course->when) as $xx => $x)
  163. @if($xx > 0)
  164. @endif
  165. @foreach($x->day as $d)
  166. {{$d}}
  167. @endforeach
  168. h {{$x->from}} - {{$x->to}}
  169. @endforeach
  170. </span>
  171. </div>
  172. </div>
  173. @endforeach
  174. </div>
  175. </div>
  176. </div>
  177. <div class="service--button d-md-flex align-items-center " style="margin-bottom:30px">
  178. <button class="btn--ui lightGrey" onclick="annulla()" style="margin-right:10px">annulla</button>
  179. <div class="payment_btn">
  180. <a href="/in?new=1&memberId={{$currentMember->id}}" class="btn--ui primary">NUOVA ENTRATA</a>
  181. </div>
  182. </div>
  183. </div>
  184. @else
  185. <div class="col card--ui" id="card--dashboard">
  186. <header id="title--section" style="display:none !important" class="d-flex align-items-center justify-content-between" style="display:none !important">
  187. <div class="title--section_name d-flex align-items-center justify-content-between">
  188. <i class="ico--ui title_section utenti me-2 "></i>
  189. <h2 class="primary">@if(!$add && !$update)Utenti @else Inserimento/modifica utente @endif</h2>
  190. </div>
  191. @if(!$add && !$update)
  192. <div class="title--section_addButton" wire:click="add()" style="cursor: pointer;">
  193. <div class="btn--ui entrata d-flex justify-items-between">
  194. <a href="#" style="color:white">Aggiungi</a>
  195. </div>
  196. </div>
  197. @endif
  198. </header>
  199. @if(!$add && !$update)
  200. <section id="subheader" class="d-flex align-items-center justify-content-between">
  201. @if(false)
  202. <form action="" class="search--form d-flex align-items-center">
  203. <div class="input-group mb-3">
  204. <input type="text" class="form-control" placeholder="Cerca utente" aria-label="cerca utent" aria-describedby="button-addon2" wire:model="search">
  205. @if($showReset)
  206. <button class="btn--ui" type="button" id="button-addon2" onclick="reset()"><i class="ico--ui search"></i>Reset</button>
  207. @else
  208. <button class="btn--ui" type="button" id="button-addon2" wire:click="search()"><i class="ico--ui search"></i>Cerca</button>
  209. @endif
  210. </div>
  211. </form>
  212. @endif
  213. </section>
  214. <div class="showFilter" style="display:none">
  215. <hr size="1">
  216. <div class="row g-3">
  217. <div class="col-md-3">
  218. <div class="row">
  219. <div class="col-md-12" style="margin-bottom:10px;">
  220. <b>Età</b>
  221. </div>
  222. <div class="col-12">
  223. <div class="row mb-2">
  224. <div class="col-3"><label class="form-check-label ms-2" >Da</label></div>
  225. <div class="col-9"><input class="form-control " type="number" name="txtFromYear"></div>
  226. </div>
  227. </div>
  228. <div class="col-12">
  229. <div class="row">
  230. <div class="col-3"><label class="form-check-label ms-2" >A</label></div>
  231. <div class="col-9"><input class="form-control " type="number" name="txtToYear"></div>
  232. </div>
  233. </div>
  234. </div>
  235. </div>
  236. <div class="col-md-3">
  237. <div class="row">
  238. <div class="col-md-12" style="margin-bottom:10px;">
  239. <b>Tipologia di tesseramento</b>
  240. </div>
  241. <div class="col-12">
  242. <select name="filterCards" class="form-select filterCards">
  243. <option value="">Tutte
  244. @foreach(getCards() as $card)
  245. <option value="{{$card->id}}">{{$card->name}}
  246. @endforeach
  247. </select>
  248. </div>
  249. </div>
  250. </div>
  251. <div class="col-md-3">
  252. <div class="row">
  253. <div class="col-md-12" style="margin-bottom:10px;">
  254. <b>Stato tesseramento</b>
  255. </div>
  256. <div class="col-12">
  257. <select name="filterStatus" class="form-select filterStatus" multiple="multiple">
  258. <option value="2">Attivo
  259. <option value="1">Sospeso
  260. <option value="0">Non tesserato
  261. </select>
  262. </div>
  263. </div>
  264. </div>
  265. <div class="col-md-3">
  266. <div class="row">
  267. <div class="col-md-12" style="margin-bottom:10px;">
  268. <b>Gruppo di appartenenza</b>
  269. </div>
  270. <div class="col-12">
  271. <select name="filterCategories" class="form-select filterCategories" multiple="multiple">
  272. <option value="">Tutte</option>
  273. @foreach($categories as $category)
  274. <option value="{{$category["id"]}}">
  275. {!! str_repeat('&bull; ', $category["indentation"] ?? 0) !!}{{$category["name"]}}
  276. </option>
  277. @endforeach
  278. </select>
  279. </div>
  280. </div>
  281. </div>
  282. <div class="col-md-3">
  283. <div class="row">
  284. <div class="col-md-12" style="margin-bottom:10px;">
  285. <b>Anno di nascita</b>
  286. </div>
  287. <div class="col-12">
  288. <div class="row mb-2">
  289. <div class="col-3"><label class="form-check-label ms-2" >Da</label></div>
  290. <div class="col-9"><input class="form-control " type="number" name="txtFromYearYear"></div>
  291. </div>
  292. </div>
  293. <div class="col-12">
  294. <div class="row">
  295. <div class="col-3"><label class="form-check-label ms-2" >A</label></div>
  296. <div class="col-9"><input class="form-control " type="number" name="txtToYearYear"></div>
  297. </div>
  298. </div>
  299. </div>
  300. </div>
  301. <div class="col-md-3">
  302. <div class="row">
  303. <div class="col-md-12" style="margin-bottom:10px;">
  304. <b>Scadenza certificato medico</b>
  305. </div>
  306. <div class="col-12">
  307. <select name="filterScadenza" class="form-select filterScadenza" multiple="multiple">
  308. <option value="1">Scaduti
  309. <option value="2">In scadenza
  310. <option value="3">Non consegnato
  311. <option value="4">Validi
  312. </select>
  313. </div>
  314. </div>
  315. </div>
  316. <div class="col-md-3">
  317. <div class="row">
  318. <div class="col-md-12" style="margin-bottom:10px;">
  319. <b>Tipologia certificato medico</b>
  320. </div>
  321. <div class="col-12">
  322. <select name="filterCertificateType" class="form-select filterCertificateType" multiple="multiple">
  323. <option value="">Tutti
  324. <option value="N">Non agonistico
  325. <option value="A">Agonistico
  326. </select>
  327. </div>
  328. </div>
  329. </div>
  330. </div>
  331. <div class="row g-3">
  332. <div class="col-md-12" style="text-align:right">
  333. <button class="btn--ui lightGrey" onclick="reset()" onclick="destroyDataTable()">Reset</button>
  334. <button class="btn--ui" onclick="loadDataTable()">FILTRA</button>
  335. </div>
  336. </div>
  337. <hr size="1">
  338. </div>
  339. <section id="anagrafiche--utenti">
  340. <div class="compare--chart_wrapper d-none"></div>
  341. <table class="table tablesaw tableHead tablesaw-stack table--lista_utenti tableHead" width="100%" id="tablesaw-350" width="100%">
  342. <thead>
  343. <tr>
  344. <th scope="col" style="text-align: center">Cognome</th>
  345. <th scope="col">Nome</th>
  346. <th scope="col">Telefono</th>
  347. <th scope="col" style="text-align: center">Età</th>
  348. <th scope="col" style="text-align: center">Anno</th>
  349. <th scope="col">Stato</th>
  350. <th scope="col">Certificato</th>
  351. <th scope="col">...</th>
  352. </tr>
  353. </thead>
  354. <tbody id="checkall-target">
  355. @if(false)
  356. @foreach($records as $idx => $record)
  357. <tr>
  358. <td> <label><input class="table-check" type="checkbox" wire:model="multipleIds" value="{{$record->id}}"><span class="sr-only d-inline-block d-lg-none ms-2 mobile-row-selector"> Seleziona riga</span></label></td>
  359. <td>{{ ($idx + 1) }}</td>
  360. <td>ID{{str_pad($record->id, 5, "0", STR_PAD_LEFT)}}</td>
  361. <td><a href="#" wire:click="showDetail({{$record->id}})">{{$record->last_name}}</a></td>
  362. <td><a href="#" wire:click="showDetail({{$record->id}})">{{$record->first_name}}</a></td>
  363. <td>
  364. @if($record->phone != '')
  365. <a href="tel:{{$record->phone}}">{{$record->phone}}</a>
  366. @endif
  367. </td>
  368. <td>{{$record->age > 0 ? $record->age : ''}} </td>
  369. <td>
  370. <span class="tablesaw-cell-content"><span class="badge tessera-badge {{$record->state > 0 ? ($record->state == 2 ? 'active' : 'suspended') : 'due'}}">{{$record->state > 0 ? ($record->state == 2 ? 'Tesserato' : 'Sospeso') : 'Non tesserato'}}</span></span>
  371. </td>
  372. <td>
  373. <span class="tablesaw-cell-content"><span class="badge tessera-badge {{$record->status > 0 ? ($record->status == 2 ? 'active' : 'suspended') : ''}}">{{$record->status > 0 ? ($record->status == 2 ? 'Attivo' : 'Sospesa') : ''}}</span></span>
  374. <b class=" tablesaw-cell-label">Scadenza tessera</b>
  375. <span class="tablesaw-cell-content d-flex align-items-center">
  376. {{$record->status ? 'Scadenza : ' : ($record->date != '' ? 'Scaduto : ' : '')}} {{$record->date != '' ? date("d/m/Y", strtotime($record->date)) : ''}}
  377. </span>
  378. </td>
  379. <td>
  380. @if($record->certificate != '')
  381. <b class=" tablesaw-cell-label">Scadenza certificato</b>
  382. <span class="tablesaw-cell-content d-flex align-items-center">
  383. @if($record->certificate < date("Y-m-d"))
  384. <i class="ico--ui check suspended me-2"></i>
  385. Scaduto :
  386. @endif
  387. @if($record->certificate >= date("Y-m-d") && $record->certificate < date("Y-m-d", strtotime("+1 month")))
  388. <i class="ico--ui check due me-2"></i>
  389. In scadenza :
  390. @endif
  391. @if($record->certificate >= date("Y-m-d", strtotime("+1 month")))
  392. <i class="ico--ui check active me-2"></i>
  393. Scadenza :
  394. @endif
  395. {{$record->certificate != '' ? date("d/m/Y", strtotime($record->certificate)) : ''}}
  396. </span>
  397. @endif
  398. </td>
  399. <td>
  400. <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>
  401. <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>
  402. </td>
  403. </tr>
  404. @endforeach
  405. @endif
  406. </tbody>
  407. </table>
  408. </section>
  409. @else
  410. <a name="top"></a>
  411. <a style="margin-top:20px" class="btn--ui lightGrey" href="/{{$from != '' ? ($from . '?showFilters=1') : 'members'}}"><i class="fa-solid fa-arrow-left"></i></a><br><br>
  412. @if (session()->has('success'))
  413. <div class="alert alert-success" role="alert">
  414. {{ session()->get('success') }}
  415. </div>
  416. @endif
  417. @if (session()->has('error'))
  418. <div class="alert alert-danger" role="alert">
  419. {{ session()->get('error') }}
  420. </div>
  421. @endif
  422. <div class="container-fluid">
  423. <div class="row mb-3">
  424. <div class="col-md-7 col-xl-8 p-3">
  425. <div class="section--tab d-flex">
  426. <h4 style="cursor:pointer;{{$type == 'dati' ? 'border-bottom:2px solid #0C6197; color:#0C6197;' : ''}}" wire:click="change('dati')">Anagrafica</h4>
  427. <h4 style="cursor:pointer;{{$type == 'tesseramento' ? 'border-bottom:2px solid #0C6197; color:#0C6197;' : ''}}" wire:click="change('tesseramento')">Tesseramento</h4>
  428. <h4 style="cursor:pointer;{{$type == 'corsi' ? 'border-bottom:2px solid #0C6197; color:#0C6197;' : ''}}" wire:click="change('corsi')">Corsi</h4>
  429. <h4 style="cursor:pointer;{{$type == 'gruppi' ? 'border-bottom:2px solid #0C6197; color:#0C6197;' : ''}}" wire:click="change('gruppi')">Gruppi</h4>
  430. </div>
  431. <div class="row">
  432. @if($type == 'dati')
  433. <div class="form--wrapper d-flex">
  434. <form class="form--utente d-flex">
  435. <div class="form--col" style="width:100%">
  436. <div class="row g-3">
  437. <div class="col-md-6 col-xxl-3">
  438. <label for="first_name" class="form-label">Nome</label>
  439. <input class="form-control @error('first_name') is-invalid @enderror" type="text" id="first_name" placeholder="Nome" wire:model="first_name" style="text-transform:uppercase">
  440. </div>
  441. <div class="col-md-6 col-xxl-3">
  442. <label for="last_name" class="form-label">Cognome</label>
  443. <input class="form-control @error('last_name') is-invalid @enderror" type="text" id="last_name" placeholder="Cognome" wire:model="last_name" style="text-transform:uppercase">
  444. </div>
  445. <div class="col-md-6 col-xxl-3">
  446. <label for="email" class="form-label">Sesso</label>
  447. <select id="gender" class="form-select @error('gender') is-invalid @enderror" aria-label="Sesso" wire:model="gender">
  448. <option value="">
  449. <option value="M">Uomo
  450. <option value="D">Donna
  451. <option value="O">Altro
  452. </select>
  453. </div>
  454. <div class="col-md-6 col-xxl-3">
  455. <label for="inputDate" class="form-label">Data di nascita {!!$age != '' ? ' <b style="font-size:14px;">(' . $age . ')</b>' : ''!!}</label>
  456. <div class="input-group mb-3">
  457. <div style="width:100%">
  458. <input class="form-control @error('birth_date') is-invalid @enderror" type="date" id="birth_date" placeholder="Data di nascita" wire:model="birth_date">
  459. </div>
  460. <div style="width:100%; text-align:center;">{!!$under18 ? '<span style="color:red;font-weight:bold;font-size:12px;">&nbsp;MINORENNE</span>' : ''!!}</div>
  461. </div>
  462. </div>
  463. </div>
  464. <div class="row g-3">
  465. <div class="col-md-6 col-xxl-3">
  466. <label for="birth_nation_id" class="form-label">Nazione di Nascita</label>
  467. <select id="birth_nation_id" class="form-select nationBirthClass @error('birth_nation_id') is-invalid @enderror" aria-label="Nazione di nascita" wire:model="birth_nation_id">
  468. <option value="{{$birth_nation_id}}">{{$this->getNation($birth_nation_id)}}
  469. </select>
  470. </div>
  471. @if($isBirthItaly)
  472. <div class="col-md-6 col-xxl-3">
  473. <label for="birth_province_id" class="form-label">Provincia di Nascita</label>
  474. <select id="birth_province_id" class="form-select provinceBirthClass @error('birth_province_id') is-invalid @enderror" aria-label="Provincia di nascita" wire:model="birth_province_id">
  475. <option value="{{$birth_province_id}}">{{$this->getProvince($birth_province_id)}}
  476. </select>
  477. </div>
  478. <div class="col-xl-6">
  479. <label for="birth_city_id" class="form-label">Comune di Nascita</label>
  480. <select id="birth_city_id" class="form-select cityBirthClass @error('birth_city_id') is-invalid @enderror" aria-label="Comune di nascita" wire:model="birth_city_id" >
  481. <option value="{{$birth_city_id}}">{{$this->getCity($birth_city_id)}}
  482. </select>
  483. </div>
  484. @else
  485. <div class="col-xl-3">
  486. <label for="birth_place" class="form-label">Paese di nascita</label>
  487. <input class="form-control @error('birth_place') is-invalid @enderror" type="text" id="birth_place" placeholder="Paese di nascita" wire:model="birth_place">
  488. </div>
  489. @endif
  490. </div>
  491. <div class="row g-3 mt-1">
  492. <div class="col-xl-6">
  493. <label for="fiscal_code" class="form-label">Codice fiscale (<a wire:click="getFiscalCode()" style="cursor:pointer;font-size:18px;color: #006099;font-weight: bold;">calcola</a>)</label>
  494. <input class="form-control @error('fiscal_code') is-invalid @enderror" type="text" id="fiscal_code" placeholder="Codice fiscale" wire:model="fiscal_code" maxlength="16">
  495. @if($this->error_fc)
  496. <span style="color:red;font-size:12px">Dati mancanti</span>
  497. @endif
  498. @if($this->already_existing)
  499. <span style="color:red;font-size:12px">Codice fiscale già esistente</span>
  500. @endif
  501. </div>
  502. <div class="col-xl-6">
  503. <div class="upload-file">
  504. <label for="formFile" class="form-label">Immagine profilo</label>
  505. @error('image') <span class="error">{{ $message }}</span> @enderror
  506. <input class="form-control" type="file" wire:model="image">
  507. @if ($image)
  508. <img src="{{ $image->temporaryUrl() }}" style="max-width:200px" alt="Preview">
  509. @endif
  510. @if ($image_old)
  511. @php
  512. $fileService = app(App\Services\MemberFileService::class);
  513. $imageUrl = $fileService->getFileUrl($image_old);
  514. @endphp
  515. @if($imageUrl)
  516. <img src="{{ $imageUrl }}" style="max-width:200px" alt="Current Image">
  517. @endif
  518. @endif
  519. </div>
  520. </div>
  521. </div>
  522. <div class="row g-3 mt-1">
  523. <span class="title-form primary d-block w-100">Residenza</span>
  524. <div class="col-xl-3" wire:ignore>
  525. <label for="nation_id" class="form-label">Nazione</label>
  526. <select id="nation_id" class="form-select nationClass @error('nation_id') is-invalid @enderror" aria-label="Nazione" wire:model="nation_id">
  527. <option value="{{$nation_id}}">{{$this->getNation($nation_id)}}
  528. </select>
  529. </div>
  530. @if($isItaly)
  531. <div class="col-xl-3">
  532. <label for="province_id" class="form-label">Provincia</label>
  533. <select id="province_id" class="form-select provinceClass @error('province_id') is-invalid @enderror" aria-label="Provincia" wire:model="province_id">
  534. <option value="{{$province_id}}">{{$this->getProvince($province_id)}}
  535. </select>
  536. </div>
  537. <div class="col-xl-6">
  538. <label for="city_id" class="form-label">Comune</label>
  539. <select id="city_id" class="form-select cityClass @error('city_id') is-invalid @enderror" aria-label="Comune" wire:model="city_id">
  540. <option value="{{$city_id}}">{{$this->getCity($city_id)}}
  541. </select>
  542. </div>
  543. @endif
  544. </div>
  545. <div class="row g-3 mt-1">
  546. <div class="col-xl-6">
  547. <label for="address" class="form-label">Indirizzo</label>
  548. <input class="form-control @error('address') is-invalid @enderror" type="text" id="address" placeholder="Indirizzo" wire:model="address" style="text-transform:uppercase">
  549. </div>
  550. <div class="col-xl-3">
  551. <label for="zip_code" class="form-label">CAP</label>
  552. <input class="form-control @error('zip_code') is-invalid @enderror" type="text" id="zip_code" placeholder="CAP" wire:model="zip_code" maxlength="5" >
  553. </div>
  554. </div>
  555. <div class="row g-3 mt-1">
  556. <span class="title-form primary d-block w-100">Contatti</span>
  557. <div class="col-xl-6">
  558. <label for="email" class="form-label">Email</label>
  559. <input class="form-control @error('email') is-invalid @enderror" type="text" id="email" placeholder="Email" wire:model="email">
  560. </div>
  561. <div class="col-xl-6">
  562. <label for="phone" class="form-label">Telefono/Cellulare</label>
  563. <input class="form-control @error('phone') is-invalid @enderror" type="text" id="phone" placeholder="Telefono" wire:model="phone">
  564. </div>
  565. <div class="col-xl-6">
  566. <label for="phone2" class="form-label">Telefono 2</label>
  567. <input class="form-control" type="text" id="phone2" placeholder="Telefono 2" wire:model="phone2">
  568. </div>
  569. <div class="col-xl-6">
  570. <label for="phone3" class="form-label">Telefono 3</label>
  571. <input class="form-control" type="text" id="phone3" placeholder="Telefono 3" wire:model="phone3">
  572. </div>
  573. </div>
  574. <div class="row g-3 mt-1">
  575. <div class="col-lg-12">
  576. <input type="checkbox" id="no_send_mail" wire:model="no_send_mail">&nbsp;<label for="birth_place" class="form-label">Non inviare mail ricevuta</label>
  577. </div>
  578. <div class="col-lg-12">
  579. <input type="checkbox" id="exclude_from_records" wire:model="exclude_from_records">&nbsp;<label for="birth_place" class="form-label">Escludi da prima nota e entrate/uscite</label>
  580. </div>
  581. @if($dataId > 0)
  582. <span class="title-form primary d-block w-100">Stato</span>
  583. <div class="col-12">
  584. <span class="badge tessera-badge {{$active["status"] == 2 ? 'active' : ($active["status"] == 0 ? 'due' : 'suspended')}}">{{$active["status_text"]}}</span>
  585. </div>
  586. @endif
  587. </div>
  588. <div class="row g-3 mt-1" wire:key='reload-{{$selectId}}'>
  589. <span class="title-form primary d-block w-100">Documento</span>
  590. <div class="col-xl-6 col-xl-3">
  591. <label for="document_type" class="form-label">Tipo</label>
  592. <select class="form-select form-select-lg me-1" aria-label=".form-select-lg example" wire:model="document_type">
  593. <option value="">--Seleziona--</option>
  594. <option value="Carta di identità">Carta di identità</option>
  595. <option value="Passaporto">Passaporto</option>
  596. <option value="Patente">Patente</option>
  597. <option value="Permesso di soggiorno">Permesso di soggiorno</option>
  598. </select>
  599. </div>
  600. <div class="col-xl-6 col-xl-3">
  601. <label for="document_number" class="form-label">Numero</label>
  602. <input class="form-control" type="text" id="document_number" placeholder="Numero" wire:model="document_number">
  603. </div>
  604. <div class="col-xl-6 col-xl-3">
  605. <label for="document_from" class="form-label">Rilasciato da</label>
  606. <select class="form-select form-select-lg me-1" aria-label=".form-select-lg example" wire:model="document_from">
  607. <option value="">--Seleziona--</option>
  608. <option value="Comune">Comune</option>
  609. <option value="Motorizzazione">Motorizzazione</option>
  610. <option value="Ministero degli interni">Ministero degli interni</option>
  611. <option value="Prefettura">Prefettura</option>
  612. </select>
  613. </div>
  614. <div class="col-xl-6 col-xl-3">
  615. <label for="document_expire_date" class="form-label">Scadenza</label>
  616. <input class="form-control" type="date" id="document_expire_date" placeholder="Scadenza" wire:model="document_expire_date">
  617. </div>
  618. <div class="col-12">
  619. <label for="document_files" class="form-label">File</label>
  620. <input class="form-control" type="file" wire:model="documents" multiple><br>
  621. <label for="document_files" class="form-label">Caricati</label>
  622. @if ($document_files !== null && count(array_filter($document_files)) > 0)
  623. @foreach ($document_files as $idx => $d)
  624. @if (!empty($d))
  625. <div class="row">
  626. <div class="col-6">
  627. @php
  628. $fileService = app(App\Services\MemberFileService::class);
  629. $fileUrl = $fileService->getFileUrl($d);
  630. $fileName = basename($d);
  631. @endphp
  632. @if($fileUrl)
  633. <a href="{{ $fileUrl }}" target="_blank" class="form-label">{{ $fileName }}</a>
  634. @else
  635. <span class="form-label text-muted">{{ $fileName }} (not available)</span>
  636. @endif
  637. </div>
  638. <div class="col-6">
  639. <a wire:click="removeDocument({{$idx}},'self')" class="form-label" style="cursor: pointer;">(elimina)</a><br>
  640. </div>
  641. </div>
  642. @endif
  643. @endforeach
  644. @endif
  645. </div>
  646. </div>
  647. @if($under18)
  648. <div class="row g-3 mt-1">
  649. <span class="title-form primary d-block w-100">Genitore 1</span>
  650. <div class="col-xl-6">
  651. <label for="father_name" class="form-label"><b>Nominativo</b></label>
  652. <input class="form-control" type="text" id="father_name" placeholder="Nome" wire:model="father_name">
  653. </div>
  654. <div class="col-xl-6">
  655. <label for="father_name" class="form-label"><b>Email</b></label>
  656. <input class="form-control" type="text" id="father_email" placeholder="Email" wire:model="father_email">
  657. </div>
  658. <div class="col-xl-6">
  659. <label for="father_name" class="form-label"><b>Telefono</b></label>
  660. <input class="form-control" type="text" id="father_phone" placeholder="Telefono" wire:model="father_phone">
  661. </div>
  662. <div class="col-xl-6">
  663. <label for="father_name" class="form-label"><b>Codice fiscale</b></label>
  664. <input class="form-control" type="text" id="father_fiscal_code" placeholder="Codice fiscale" wire:model="father_fiscal_code" maxlength="16">
  665. </div>
  666. <div class="col-xl-6">
  667. <label for="father_name" class="form-label"><b>Numero del documento</b></label>
  668. <input class="form-control" type="text" id="father_doc_number" placeholder="Numero documento" wire:model="father_doc_number">
  669. </div>
  670. <div class="col-xl-6">
  671. <label for="father_name" class="form-label"><b>Tipo documento</b></label>
  672. <select class="form-select form-select-lg me-1" aria-label=".form-select-lg example" wire:model="father_doc_type">
  673. <option value="">Seleziona il tipo documento</option>
  674. <option value="Carta di identità">Carta di identità</option>
  675. <option value="Passaporto">Passaporto</option>
  676. <option value="Patente">Patente</option>
  677. <option value="Permesso di soggiorno">Permesso di soggiorno</option>
  678. </select>
  679. </div>
  680. <div class="col-12">
  681. <label for="father_documents" class="form-label">File</label>
  682. <input class="form-control" type="file" wire:model="father_documents" multiple><br>
  683. <label for="father_documents" class="form-label">Caricati</label>
  684. @if ($father_document_files !== null && count(array_filter($father_document_files)) > 0)
  685. @foreach ($father_document_files as $idx => $d)
  686. @if (!empty($d))
  687. <div class="row">
  688. <div class="col-6">
  689. @php
  690. $fileService = app(App\Services\MemberFileService::class);
  691. $fileUrl = $fileService->getFileUrl($d);
  692. $fileName = basename($d);
  693. @endphp
  694. @if($fileUrl)
  695. <a href="{{ $fileUrl }}" target="_blank" class="form-label">{{ $fileName }}</a>
  696. @else
  697. <span class="form-label text-muted">{{ $fileName }} (not available)</span>
  698. @endif
  699. </div>
  700. <div class="col-6">
  701. <a wire:click="removeDocument({{$idx}},'father')" class="form-label" style="cursor: pointer;">(elimina)</a><br>
  702. </div>
  703. </div>
  704. @endif
  705. @endforeach
  706. @endif
  707. </div>
  708. </div>
  709. <div class="row g-3 mt-1">
  710. <span class="title-form primary d-block w-100">Genitore 2</span>
  711. <div class="col-xl-6">
  712. <label for="mother_name" class="form-label"><b>Nominativo</b></label>
  713. <input class="form-control " type="text" id="mother_name" placeholder="Nome genitore 2" wire:model="mother_name">
  714. </div>
  715. <div class="col-xl-6">
  716. <label for="mother_name" class="form-label"><b>Email</b></label>
  717. <input class="form-control " type="text" id="mother_email" placeholder="Email" wire:model="mother_email">
  718. </div>
  719. <div class="col-xl-6">
  720. <label for="mother_name" class="form-label"><b>Telefono</b></label>
  721. <input class="form-control " type="text" id="mother_phone" placeholder="Telefono" wire:model="mother_phone">
  722. </div>
  723. <div class="col-xl-6">
  724. <label for="mother_name" class="form-label"><b>Codice fiscale</b></label>
  725. <input class="form-control " type="text" id="mother_fiscal_code" placeholder="Codice fiscale" wire:model="mother_fiscal_code" maxlength="16">
  726. </div>
  727. <div class="col-xl-6">
  728. <label for="mother_name" class="form-label"><b>Numero del documento</b></label>
  729. <input class="form-control " type="text" id="mother_doc_number" placeholder="Numero documento" wire:model="mother_doc_number">
  730. </div>
  731. <div class="col-xl-6">
  732. <label for="mother_name" class="form-label"><b>Tipo documento</b></label>
  733. <select class="form-select form-select-lg me-1" aria-label=".form-select-lg example" wire:model="mother_doc_type">
  734. <option value="">Seleziona il tipo documento</option>
  735. <option value="Carta di identità">Carta di identità</option>
  736. <option value="Passaporto">Passaporto</option>
  737. <option value="Patente">Patente</option>
  738. <option value="Permesso di soggiorno">Permesso di soggiorno</option>
  739. </select>
  740. </div>
  741. </div>
  742. <div class="col-12">
  743. <label for="mother_documents" class="form-label">File</label>
  744. <input class="form-control" type="file" wire:model="mother_documents" multiple><br>
  745. <label for="mother_documents" class="form-label">Caricati</label>
  746. @if ($mother_document_files !== null && count(array_filter($mother_document_files)) > 0)
  747. @foreach ($mother_document_files as $idx => $d)
  748. @if (!empty($d))
  749. <div class="row">
  750. <div class="col-6">
  751. @php
  752. $fileService = app(App\Services\MemberFileService::class);
  753. $fileUrl = $fileService->getFileUrl($d);
  754. $fileName = basename($d);
  755. @endphp
  756. @if($fileUrl)
  757. <a href="{{ $fileUrl }}" target="_blank" class="form-label">{{ $fileName }}</a>
  758. @else
  759. <span class="form-label text-muted">{{ $fileName }} (not available)</span>
  760. @endif
  761. </div>
  762. <div class="col-6">
  763. <a wire:click="removeDocument({{$idx}},'mother')" class="form-label" style="cursor: pointer;">(elimina)</a><br>
  764. </div>
  765. </div>
  766. @endif
  767. @endforeach
  768. @endif
  769. </div>
  770. @endif
  771. <div class="row g-3 mt-1">
  772. <span class="title-form primary d-block w-100">Certificato Medico</span>
  773. @if($dataId > -1)
  774. @if(!$addCertificate && !$updateCertificate)
  775. <table class="table tablesaw tableHead tablesaw-stack" >
  776. <thead>
  777. <tr>
  778. <th scope="col">Tipo</th>
  779. <th scope="col">Scadenza</th>
  780. <th scope="col"></th>
  781. <th scope="col">...</th>
  782. </tr>
  783. </thead>
  784. <tbody >
  785. @foreach($member_certificates as $member_certificate)
  786. <tr>
  787. <td>{{$member_certificate->type == 'A' ? 'Agonistico' : 'Non agonistico'}}</td>
  788. <td>{{$member_certificate->expire_date ? date("d/m/Y", strtotime($member_certificate->expire_date)) : ''}}</td>
  789. <td>
  790. @if($member_certificate->filename != '')
  791. @php
  792. $fileService = app(App\Services\MemberFileService::class);
  793. $certificateUrl = $fileService->getFileUrl($member_certificate->filename);
  794. @endphp
  795. @if($certificateUrl)
  796. <a href="{{ $certificateUrl }}" target="_blank">Visualizza</a>
  797. @else
  798. <span class="text-muted">File non disponibile</span>
  799. @endif
  800. @endif
  801. </td>
  802. <td>
  803. <button type="button" class="btn" wire:click="editCertificate({{ $member_certificate->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>
  804. <button type="button" class="btn" onclick="confirm('Sei sicuro?') || event.stopImmediatePropagation()" wire:click="deleteCertificate({{ $member_certificate->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>
  805. </td>
  806. </tr>
  807. @endforeach
  808. </tbody>
  809. </table>
  810. <button class="btn--ui primary"wire:click.prevent="addCertificate()" style="max-width:200px">Aggiungi</button>
  811. @else
  812. <div class="form--wrapper">
  813. <form class="form--utente">
  814. <div class="row ">
  815. <div class="col-md-6">
  816. <label for="certificate_type" class="form-label">Tipo</label>
  817. <select id="certificate_type" class="form-select certificate_type" aria-label="Tessera" wire:model="certificate_type">
  818. <option value="">--Seleziona--
  819. <option value="N">Non agonistico
  820. <option value="A">Agonistico
  821. </select>
  822. </div>
  823. <div class="col-md-6">
  824. <label for="certificate_expire_date" class="form-label">Data scadenza</label>
  825. <input class="form-control @error('certificate_expire_date') is-invalid @enderror" type="date" id="certificate_expire_date" placeholder="Data scadenza" wire:model="certificate_expire_date">
  826. </div>
  827. </div>
  828. <div class="col-12">
  829. <div class="upload--image_box d-flex align-items-center justify-content-center flex-column">
  830. <input class="form-control" type="file" wire:model="certificate_filename">
  831. </div>
  832. <p class="caption text-center mt-1">Formati consentiti: .jpg, .pdf, .docx</p>
  833. @if($certificate_filename_old != '')
  834. @php
  835. $fileService = app(App\Services\MemberFileService::class);
  836. $certificateUrl = $fileService->getFileUrl($certificate_filename_old);
  837. @endphp
  838. @if($certificateUrl)
  839. <br><a href="{{ $certificateUrl }}" target="_blank">Visualizza certificato corrente</a>
  840. @endif
  841. @endif
  842. </div>
  843. </form>
  844. </div>
  845. <div class="d-flex justify-content-end mt-3">
  846. <button class="btn--ui lightGrey me-2" wire:click.prevent="cancelCertificate()">Annulla</button>
  847. @if($addCertificate)
  848. <button class="btn--ui primary" wire:click.prevent="storeCertificate()">Salva</button>
  849. @endif
  850. @if($updateCertificate)
  851. <button class="btn--ui primary" wire:click.prevent="updateCertificate()">Salva</button>
  852. @endif
  853. </div>
  854. @endif
  855. @else
  856. <label for="last_name" class="form-label">Prima di caricare un certificato salva l'utente</label>
  857. @endif
  858. </div>
  859. </div>
  860. </form>
  861. </div>
  862. @endif
  863. @if($type == 'tesseramento')
  864. @if($dataId > 0)
  865. @if(!$addCard && !$updateCard)
  866. <table class="table tablesaw tableHead tablesaw-stack" id="tablesaw-350-1">
  867. <thead>
  868. <tr>
  869. <th scope="col">Carta</th>
  870. <th scope="col">Numero</th>
  871. <th scope="col">Scadenza</th>
  872. <th scope="col">...</th>
  873. </tr>
  874. </thead>
  875. <tbody id="checkall-target">
  876. @foreach($member_cards as $member_card)
  877. <tr>
  878. <td>{{$member_card->card->name}}</td>
  879. <td>{{$member_card->number}}</td>
  880. <td>{{$member_card->expire_date ? date("d/m/Y", strtotime($member_card->expire_date)) : ''}}</td>
  881. <td>
  882. <button type="button" class="btn" wire:click="editCard({{ $member_card->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>
  883. <button type="button" class="btn" onclick="confirm('Sei sicuro?') || event.stopImmediatePropagation()" wire:click="deleteCard({{ $member_card->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>
  884. </td>
  885. </tr>
  886. @endforeach
  887. </tbody>
  888. </table>
  889. <button class="btn--ui primary"wire:click.prevent="addCard()" style="max-width:200px">Aggiungi</button>
  890. @else
  891. <div class="form--wrapper">
  892. <form class="form--utente">
  893. <div class="row ">
  894. <div class="col-md-6">
  895. <label for="card_card_id" class="form-label">Tessera</label>
  896. <select id="card_card_id" class="form-select card_card_id @error('card_card_id') is-invalid @enderror" aria-label="Tessera" wire:model="card_card_id">
  897. <option value="">--Seleziona--
  898. @foreach($cards as $card)
  899. <option value="{{$card->id}}">{{$card->name}}
  900. @endforeach
  901. </select>
  902. </div>
  903. <div class="col-md-6">
  904. <label for="card_number" class="form-label">Numero</label>
  905. <input class="form-control @error('card_number') is-invalid @enderror" type="text" id="card_number" placeholder="Numero" wire:model="card_number">
  906. </div>
  907. </div>
  908. <div class="row ">
  909. <div class="col-md-6">
  910. <label for="card_date" class="form-label">Data rilascio tessera</label>
  911. <input class="form-control" type="date" id="card_date" placeholder="Data" wire:model="card_date">
  912. </div>
  913. <div class="col-md-6">
  914. <label for="card_accept_date" class="form-label">Data accettazione</label>
  915. <input class="form-control" type="date" id="card_accept_date" placeholder="Data accettazione" wire:model="card_accept_date">
  916. </div>
  917. </div>
  918. <div class="row ">
  919. <div class="col-md-6">
  920. <label for="card_date" class="form-label">Disciplina 1</label>
  921. <select id="card_discipline1_id" class="form-select " aria-label="Disciplina 1" wire:model="card_discipline1_id">
  922. <option value="">--Seleziona--
  923. @foreach($disciplines as $d)
  924. <option value="{{$d->id}}">{{$d->name}}
  925. @endforeach
  926. </select>
  927. </div>
  928. <div class="col-md-6">
  929. <label for="card_date" class="form-label">Disciplina 2</label>
  930. <select id="card_discipline2_id" class="form-select " aria-label="Disciplina 2" wire:model="card_discipline2_id">
  931. <option value="">--Seleziona--
  932. @foreach($disciplines as $d)
  933. <option value="{{$d->id}}">{{$d->name}}
  934. @endforeach
  935. </select>
  936. </div>
  937. </div>
  938. @if($card_discipline2_id > 0)
  939. <div class="row ">
  940. <div class="col-md-6">
  941. <label for="card_date" class="form-label">Disciplina 3</label>
  942. <select id="card_discipline3_id" class="form-select " aria-label="Disciplina 3" wire:model="card_discipline3_id">
  943. <option value="">--Seleziona--
  944. @foreach($disciplines as $d)
  945. <option value="{{$d->id}}">{{$d->name}}
  946. @endforeach
  947. </select>
  948. </div>
  949. </div>
  950. @endif
  951. </form>
  952. </div>
  953. <br>
  954. <div class="row mt-2">
  955. <div class="col-md-12">
  956. <button class="btn--ui lightGrey" wire:click.prevent="cancelCard()">Annulla</button>
  957. @if($addCard)
  958. <button class="btn--ui primary" wire:click.prevent="storeCard()">Salva</button>
  959. @endif
  960. @if($updateCard)
  961. <button class="btn--ui primary" wire:click.prevent="updateCard()">Salva</button>
  962. @endif
  963. </div>
  964. </div>
  965. @endif
  966. @endif
  967. @endif
  968. @if($type == 'gruppi')
  969. <form class="form--tesseramento mt-4">
  970. @livewire('categories')
  971. @if(false)
  972. <div class="tessera--added d-flex align-items-center justify-content-between mt-4 mb-3">
  973. <select id="category_category_id" class="form-select categoriesClass @error('category_category') is-invalid @enderror" aria-label="Gruppo" wire:model="category_category_id" style="width:100%;">
  974. <option value="">--Seleziona--
  975. @foreach($categories as $category)
  976. <option value="{{$category["id"]}}">{{$category["name"]}}
  977. @endforeach
  978. </select>
  979. <button class="btn--ui_outline" wire:click.prevent="storeCategory()" style="margin-left:20px"><i class="ico--ui gruppi"></i>aggiungi</button>
  980. </div>
  981. @endif
  982. <span style="color:red">{!!$groupMsg!!}</span>
  983. @foreach($member_categories as $member_category)
  984. <div class="tessera--added d-flex align-items-center justify-content-between mt-4 mb-3">
  985. <div class="tessera--added_name d-flex align-items-start">
  986. <i class="ico--ui gruppi me-2"></i>
  987. <div class="title--tessera_added">
  988. <h4>{{$member_category->category->getTree()}}</h4>
  989. </div>
  990. </div>
  991. <button type="button" class="btn" onclick="confirm('Sei sicuro?') || event.stopImmediatePropagation()" wire:click="deleteCategory({{ $member_category->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>
  992. </div>
  993. @endforeach
  994. </form>
  995. @endif
  996. @if($type == 'corsi')
  997. @if($dataId > 0)
  998. @if(!$addCourse && !$updateCourse)
  999. @if($active["status"] != 1 && !$hasCertificate)
  1000. <div class="alert alert-warning" role="alert">
  1001. <strong>Attenzione:</strong> Per aggiungere corsi è necessario avere un tesseramento attivo o un certificato medico valido.
  1002. </div>
  1003. @elseif($active["status"] != 1)
  1004. <div class="alert alert-info" role="alert">
  1005. <strong>Info:</strong> Il tesseramento non è attivo, ma è presente un certificato medico valido.
  1006. </div>
  1007. @elseif(!$hasCertificate)
  1008. <div class="alert alert-info" role="alert">
  1009. <strong>Info:</strong> Non è presente un certificato medico valido, ma il tesseramento è attivo.
  1010. </div>
  1011. @endif
  1012. <table class="table tablesaw tableHead tablesaw-stack tabella--corsi" id="tablesaw-350-2" style="min-width:800px">
  1013. <tbody id="checkall-target">
  1014. @foreach($member_courses as $member_course)
  1015. <tr>
  1016. <td style="width:20%%;border:0px;" colspan="1">
  1017. <b>{{$member_course->course->name}}</b><br>
  1018. </td>
  1019. <td style="width:20%;border:0px;">
  1020. {{$member_course->course->frequency->name ?? ""}}<br>
  1021. </td>
  1022. <td style="width:20%;border:0px;">
  1023. {{$member_course->course->level->name ?? ""}}<br>
  1024. </td>
  1025. <td style="text-align:right;width:5%;border:0px;">
  1026. @php
  1027. $status = $member_course->getStatus();
  1028. @endphp
  1029. <a href="/rates?member_id={{$member_course->member_id}}&member_course_id={{$member_course->id}}"><span class="badge tessera-badge {{$status == 0 ? 'due' : ($status == 1 ? 'active' : 'suspended')}}">{{$status == 0 ? 'Da pagare' : ($status == 1 ? 'Pagato' : 'Sospeso')}}</span></a>
  1030. </td>
  1031. <td style="text-align:right;width:15%;border:0px;">
  1032. <div class="row">
  1033. <div class="col-4">
  1034. <button style="float:left;" type="button" class="btn" wire:click="editCourse({{ $member_course->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>
  1035. </div>
  1036. <div class="col-4">
  1037. <button type="button" class="btn" onclick="confirm('Sei sicuro?') || event.stopImmediatePropagation()" wire:click="deleteCourse({{ $member_course->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>
  1038. </div>
  1039. </div>
  1040. </td>
  1041. <td style="text-align:left;width:15%;border:0px;padding-top:15px;">
  1042. @if($member_course->notes != '')
  1043. <button type="button" class="btn" wire:click="showHideCourse({{ $member_course->id }})">
  1044. @if(in_array($member_course->id, $showCourse))
  1045. <i class="fa-solid fa-chevron-circle-up"></i>
  1046. @else
  1047. <i class="fa-solid fa-chevron-circle-down"></i>
  1048. @endif
  1049. </button>&nbsp;
  1050. @endif
  1051. </td>
  1052. </tr>
  1053. <tr>
  1054. <td style="width:30%" colspan="2">
  1055. {{date("d/m/Y", strtotime($member_course->date_from))}} - {{date("d/m/Y", strtotime($member_course->date_to))}}
  1056. </td>
  1057. <td style="width:30%"colspan="5">
  1058. @php
  1059. $ok = false;
  1060. @endphp
  1061. @foreach(json_decode($member_course->when) as $xx => $x)
  1062. @if($xx > 0)
  1063. <br>
  1064. @endif
  1065. @foreach($x->day as $zz => $d)
  1066. {{$zz > 0 ? '-' : ''}}{{$d}}
  1067. @endforeach
  1068. @if($x->from != '' && $x->to != '')
  1069. h {{$x->from}} - {{$x->to}}
  1070. @endif
  1071. @php
  1072. $ok = $x->from != '';
  1073. @endphp
  1074. @endforeach
  1075. @if(!$ok && $member_course->course->when != '')
  1076. @foreach(json_decode($member_course->course->when) as $xx => $x)
  1077. @php
  1078. $ok = true;
  1079. @endphp
  1080. @if($xx > 0)
  1081. <br>
  1082. @endif
  1083. @foreach($x->day as $zz => $d)
  1084. {{$zz > 0 ? '-' : ''}}{{$d}}
  1085. @endforeach
  1086. @if($x->from != '')
  1087. h {{$x->from}} - {{$x->to}}
  1088. @endif
  1089. @endforeach
  1090. @endif
  1091. </td>
  1092. </tr>
  1093. @if(in_array($member_course->id, $showCourse))
  1094. @if(false)
  1095. <tr>
  1096. <td colspan="5">
  1097. <a class="{{$this->getSubscriptionStatus($member_course->subscribed, $member_course->id)}}" wire:click="setCreateSubscription({{$member_course->subscribed}}, {{$member_course->id}})" style="float:none; width:150px;{{$this->getSubscriptionStatus($member_course->subscribed,$member_course->id) == 'blue' || $this->getSubscriptionStatus($member_course->subscribed,$member_course->id) == 'orange' || $this->getSubscriptionStatus($member_course->subscribed,$member_course->id) == 'yellow' ? 'cursor:pointer' : ''}}">Iscrizione</a><br>
  1098. <a class="{{$this->getMonthStatus(9, $member_course->months, $member_course->id)}}" wire:click="setPayMonth(9, '{{ $member_course->months }}', {{$member_course->id}})" {{in_array($this->getMonthStatus(9, $member_course->months, $member_course->id), ['blue', 'orange', 'yellow', 'orange half']) ? 'style=cursor:pointer' : ''}}>Set</a>&nbsp;
  1099. <a class="{{$this->getMonthStatus(10, $member_course->months, $member_course->id)}}" wire:click="setPayMonth(10, '{{ $member_course->months }}', {{$member_course->id}})" {{in_array($this->getMonthStatus(10, $member_course->months, $member_course->id), ['blue', 'orange', 'yellow', 'orange half']) ? 'style=cursor:pointer' : ''}}>Ott</a>&nbsp;
  1100. <a class="{{$this->getMonthStatus(11, $member_course->months, $member_course->id)}}" wire:click="setPayMonth(11, '{{ $member_course->months }}', {{$member_course->id}})" {{in_array($this->getMonthStatus(11, $member_course->months, $member_course->id), ['blue', 'orange', 'yellow', 'orange half']) ? 'style=cursor:pointer' : ''}}>Nov</a>&nbsp;
  1101. <a class="{{$this->getMonthStatus(12, $member_course->months, $member_course->id)}}" wire:click="setPayMonth(12, '{{ $member_course->months }}', {{$member_course->id}})" {{in_array($this->getMonthStatus(12, $member_course->months, $member_course->id), ['blue', 'orange', 'yellow', 'orange half']) ? 'style=cursor:pointer' : ''}}>Dic</a>&nbsp;
  1102. <a class="{{$this->getMonthStatus(1, $member_course->months, $member_course->id)}}" wire:click="setPayMonth(1, '{{ $member_course->months }}', {{$member_course->id}})" {{in_array($this->getMonthStatus(1, $member_course->months, $member_course->id), ['blue', 'orange', 'yellow', 'orange half']) ? 'style=cursor:pointer' : ''}}>Gen</a>&nbsp;
  1103. <a class="{{$this->getMonthStatus(2, $member_course->months, $member_course->id)}}" wire:click="setPayMonth(2, '{{ $member_course->months }}', {{$member_course->id}})" {{in_array($this->getMonthStatus(2, $member_course->months, $member_course->id), ['blue', 'orange', 'yellow', 'orange half']) ? 'style=cursor:pointer' : ''}}>Feb</a>&nbsp;
  1104. <a class="{{$this->getMonthStatus(3, $member_course->months, $member_course->id)}}" wire:click="setPayMonth(3, '{{ $member_course->months }}', {{$member_course->id}})" {{in_array($this->getMonthStatus(3, $member_course->months, $member_course->id), ['blue', 'orange', 'yellow', 'orange half']) ? 'style=cursor:pointer' : ''}}>Mar</a>&nbsp;
  1105. <a class="{{$this->getMonthStatus(4, $member_course->months, $member_course->id)}}" wire:click="setPayMonth(4, '{{ $member_course->months }}', {{$member_course->id}})" {{in_array($this->getMonthStatus(4, $member_course->months, $member_course->id), ['blue', 'orange', 'yellow', 'orange half']) ? 'style=cursor:pointer' : ''}}>Apr</a>&nbsp;
  1106. <a class="{{$this->getMonthStatus(5, $member_course->months, $member_course->id)}}" wire:click="setPayMonth(5, '{{ $member_course->months }}', {{$member_course->id}})" {{in_array($this->getMonthStatus(5, $member_course->months, $member_course->id), ['blue', 'orange', 'yellow', 'orange half']) ? 'style=cursor:pointer' : ''}}>Mag</a>&nbsp;
  1107. <a class="{{$this->getMonthStatus(6, $member_course->months, $member_course->id)}}" wire:click="setPayMonth(6, '{{ $member_course->months }}', {{$member_course->id}})" {{in_array($this->getMonthStatus(6, $member_course->months, $member_course->id), ['blue', 'orange', 'yellow', 'orange half']) ? 'style=cursor:pointer' : ''}}>Giu</a>&nbsp;
  1108. <a class="{{$this->getMonthStatus(7, $member_course->months, $member_course->id)}}" wire:click="setPayMonth(7, '{{ $member_course->months }}', {{$member_course->id}})" {{in_array($this->getMonthStatus(7, $member_course->months, $member_course->id), ['blue', 'orange', 'yellow', 'orange half']) ? 'style=cursor:pointer' : ''}}>Lug</a>&nbsp;
  1109. <a class="{{$this->getMonthStatus(8, $member_course->months, $member_course->id)}}" wire:click="setPayMonth(8, '{{ $member_course->months }}', {{$member_course->id}})" {{in_array($this->getMonthStatus(8, $member_course->months, $member_course->id) , ['blue', 'orange', 'yellow', 'orange half']) ? 'style=cursor:pointer' : ''}}>Ago</a>&nbsp;
  1110. </td>
  1111. <td>
  1112. <button type="button" class="btn" wire:click="editCourse({{ $member_course->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>&nbsp;
  1113. <button type="button" class="btn" onclick="confirm('Sei sicuro?') || event.stopImmediatePropagation()" wire:click="deleteCourse({{ $member_course->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>
  1114. </td>
  1115. </tr>
  1116. @endif
  1117. <tr>
  1118. <td colspan="7">
  1119. @if($member_course->notes != '')
  1120. <b>Note</b><br>
  1121. {{$member_course->notes}}
  1122. @endif
  1123. @if($selectedCourseMember == $member_course->id)
  1124. @if(sizeof($payMonths) > 0 || $createSubscription)
  1125. <button class="btn--ui primary" style="color:white" wire:click="newPayment({{$member_course}})">Nuova entrata</button>&nbsp;
  1126. <button class="btn--ui primary" style="color:white" wire:click="block({{$member_course}})">Sospendi</button>
  1127. @endif
  1128. @if(sizeof($suspendedMonths) > 0)
  1129. <button class="btn--ui primary" style="color:white" wire:click="reactivate({{$member_course}})">Riattiva</button>&nbsp;
  1130. @endif<br>
  1131. @endif
  1132. </td>
  1133. </tr>
  1134. @endif
  1135. @endforeach
  1136. </tbody>
  1137. </table>
  1138. @if($dataId > 0)
  1139. @if ($active["status"] == 1 || $hasCertificate)
  1140. <button class="btn--ui primary" wire:click.prevent="addCourse()" style="max-width:200px">Aggiungi</button>
  1141. @else
  1142. <button class="btn--ui lightGrey" disabled style="max-width:200px">Aggiungi corso (non disponibile)</button>
  1143. <small class="text-muted d-block mt-1">Completa prima il tesseramento o carica un certificato medico valido</small>
  1144. @endif
  1145. @endif
  1146. @else
  1147. <div class="form--wrapper">
  1148. <form class="form--utente">
  1149. <div class="row ">
  1150. <div class="col-12 mt-2">
  1151. <label for="course_name" class="form-label">Tipo corso</label><br>
  1152. <input type="radio" name="chkType" value="standard" wire:model="course_course_type">&nbsp;Standard
  1153. &nbsp;&nbsp;&nbsp;
  1154. <input type="radio" name="chkType" value="custom" wire:model="course_course_type">&nbsp;Personalizzato
  1155. </div>
  1156. <div class="row mt-3">
  1157. <div class="col-md-4">
  1158. <label for="course_name" class="form-label">Corso</label>
  1159. <select id="course_name" class="form-select" aria-label="Livello" wire:model="course_name" >
  1160. <option value="">
  1161. @foreach($course_names as $cn)
  1162. <option value="{{$cn}}">{{$cn}}
  1163. @endforeach
  1164. </select>
  1165. </div>
  1166. @if(false)
  1167. <label for="course_name" class="form-label">Corso</label>
  1168. <select id="course_course_id" class="form-select @error('course_course_id') is-invalid @enderror" aria-label="Corso" wire:model="course_course_id" >
  1169. <option value="">
  1170. @foreach($courses as $c)
  1171. <option value="{{$c->id}}">{{$c->name}}
  1172. @endforeach
  1173. </select>
  1174. @endif
  1175. @error('course_course_id')
  1176. <div class="invalid-feedback">Devi selezionare un corso</div>
  1177. @enderror
  1178. @if($course_exist)
  1179. <small style="color:red">Attenzione : il corso selezionato è già associato all'utente</small>
  1180. @endif
  1181. @if($course_name != '')
  1182. <div class="col-md-4">
  1183. <label for="course_level_id" class="form-label">Livello</label>
  1184. <select id="course_level_id" class="form-select" aria-label="Livello" wire:model="course_level_id" >
  1185. <option value="">
  1186. @foreach($course_levels as $l)
  1187. <option value="{{$l->id}}">{{$l->name}}
  1188. @endforeach
  1189. </select>
  1190. </div>
  1191. @endif
  1192. @if($course_level_id != '')
  1193. <div class="col-md-4">
  1194. <label for="course_frequency_id" class="form-label">Frequenza</label>
  1195. <select id="course_frequency_id" class="form-select" aria-label="Tipologia" wire:model="course_frequency_id" >
  1196. <option value="">
  1197. @foreach($course_frequencies as $f)
  1198. <option value="{{$f->id}}">{{$f->name}}
  1199. @endforeach
  1200. </select>
  1201. </div>
  1202. @endif
  1203. </div>
  1204. </div>
  1205. @if($course_course_id > 0)
  1206. <div class="row mt-4">
  1207. <div class="col-md-6">
  1208. <label for="course_course_subscription_id" class="form-label">Abbonamento</label>
  1209. <select id="course_course_subscription_id" class="form-select @error('course_course_subscription_id') is-invalid @enderror" aria-label="Abbonamento" wire:model="course_course_subscription_id">
  1210. <option value="">
  1211. @foreach($course_subscriptions as $t)
  1212. <option value="{{$t["id"]}}">{{$t["name"]}}
  1213. @endforeach
  1214. </select>
  1215. </div>
  1216. <div class="col-md-6">
  1217. <label for="course_price" class="form-label">Costo mensile</label>
  1218. <input class="form-control" type="text" id="course_price" placeholder="Costo mensile" wire:model="course_price" onkeyup="onlyNumberAmount(this)">
  1219. </div>
  1220. </div>
  1221. @if(false)
  1222. <div class="row mt-4 course--duration">
  1223. <div class="col-md-12">
  1224. <label for="duration" class="form-label">Durata del corso</label>
  1225. <div class="d-flex course--duration_mounth">
  1226. @foreach($course_months_list as $cm)
  1227. <a class="{{$this->checkMonth($cm) ? 'selected' : 'notSelected'}}" wire:click="setMonth({{$cm}})">{{getMonthName($cm, true)}}</a>
  1228. @endforeach
  1229. </div>
  1230. </div>
  1231. </div>
  1232. @endif
  1233. <div class="row mt-4">
  1234. <div class="col-md-6">
  1235. <label for="course_date_from" class="form-label">Data inizio</label>
  1236. <input class="form-control" type="date" id="course_date_from" wire:model="course_date_from">
  1237. </div>
  1238. <div class="col-md-6">
  1239. <label for="course_date_to" class="form-label">Data fine</label>
  1240. <input class="form-control" type="date" id="course_date_to" wire:model="course_date_to">
  1241. </div>
  1242. </div>
  1243. <div class="row mt-4">
  1244. <div class="col-md-6">
  1245. <label for="course_subscription_price" class="form-label">Costo iscrizione</label>
  1246. <input class="form-control" type="text" id="course_subscription_price" placeholder="Costo iscrizione" wire:model="course_subscription_price" onkeyup="onlyNumberAmount(this)">
  1247. </div>
  1248. </div>
  1249. @if($course_course_type == 'custom')
  1250. @foreach($course_when as $idW => $when)
  1251. <div class="row">
  1252. <div class="col-12">
  1253. <div class="day durata--corso d-flex">
  1254. <label for="" class="form-label">Giorno</label>
  1255. <div class="durata--corso_days mb-3">
  1256. <a class="{{in_array('lun', $course_when[$idW]["day"]) ? 'selected' : 'notSelected'}}" wire:click="setDay({{$idW}}, 'lun')">Lun</a>
  1257. <a class="{{in_array('mar', $course_when[$idW]["day"]) ? 'selected' : 'notSelected'}}" wire:click="setDay({{$idW}}, 'mar')">Mar</a>
  1258. <a class="{{in_array('mer', $course_when[$idW]["day"]) ? 'selected' : 'notSelected'}}" wire:click="setDay({{$idW}}, 'mer')">Mer</a>
  1259. <a class="{{in_array('gio', $course_when[$idW]["day"]) ? 'selected' : 'notSelected'}}" wire:click="setDay({{$idW}}, 'gio')">Gio</a>
  1260. <a class="{{in_array('ven', $course_when[$idW]["day"]) ? 'selected' : 'notSelected'}}" wire:click="setDay({{$idW}}, 'ven')">Ven</a>
  1261. <a class="{{in_array('sab', $course_when[$idW]["day"]) ? 'selected' : 'notSelected'}}" wire:click="setDay({{$idW}}, 'sab')">Sab</a>
  1262. <a class="{{in_array('dom', $course_when[$idW]["day"]) ? 'selected' : 'notSelected'}}" wire:click="setDay({{$idW}}, 'dom')">Dom</a>
  1263. </div>
  1264. <div class="durata--corso_select">
  1265. <div class="from--h me-3">
  1266. <label for="" class="form-label">Dalle</label>
  1267. <select class="form-select" wire:model="course_when.{{$idW}}.from">
  1268. <option value="">--Seleziona--
  1269. @for($c=6;$c<=23;$c++)
  1270. <option value="{{str_pad($c, 2, "0", STR_PAD_LEFT)}}:00">{{str_pad($c, 2, "0", STR_PAD_LEFT)}}:00
  1271. <option value="{{str_pad($c, 2, "0", STR_PAD_LEFT)}}:30">{{str_pad($c, 2, "0", STR_PAD_LEFT)}}:30
  1272. @endfor
  1273. </select>
  1274. </div>
  1275. <div class="to--h">
  1276. <label for="" class="form-label">Alle</label>
  1277. <select class="form-select" wire:model="course_when.{{$idW}}.to">
  1278. <option value="">--Seleziona--
  1279. @for($c=6;$c<=23;$c++)
  1280. <option value="{{str_pad($c, 2, "0", STR_PAD_LEFT)}}:00">{{str_pad($c, 2, "0", STR_PAD_LEFT)}}:00
  1281. <option value="{{str_pad($c, 2, "0", STR_PAD_LEFT)}}:30">{{str_pad($c, 2, "0", STR_PAD_LEFT)}}:30
  1282. @endfor
  1283. </select>
  1284. </div>
  1285. </div>
  1286. <button class="btn--ui primary remove--day position-absolute" wire:click.prevent="delRow({{$idW}})"><i class="fa-solid fa-minus"></i></button>
  1287. <button class="btn--ui primary add--day position-absolute" wire:click.prevent="addRow()"><i class="fa-solid fa-plus"></i></button>
  1288. </div>
  1289. </div>
  1290. </div>
  1291. @endforeach
  1292. @endif
  1293. <div class="row mt-2">
  1294. <div class="col-md-12">
  1295. <label for="course_date_from" class="form-label">Note</label>
  1296. <input class="form-control" type="text" id="course_note" placeholder="Note" wire:model="course_note">
  1297. </div>
  1298. </div>
  1299. @endif
  1300. </form>
  1301. </div>
  1302. @if($course_course_id > 0)
  1303. <br>
  1304. <div class="row mt-2">
  1305. <div class="col-md-12">
  1306. <button class="btn--ui lightGrey" wire:click.prevent="cancelCourse()">Annulla</button>
  1307. @if($addCourse)
  1308. @if(!$course_exist)
  1309. <button class="btn--ui primary" wire:click.prevent="storeCourse()">Salva corso</button>
  1310. @endif
  1311. @endif
  1312. @if($updateCourse)
  1313. <button class="btn--ui primary" wire:click.prevent="updateCourse()">Salva corso</button>
  1314. @endif
  1315. </div>
  1316. </div>
  1317. @endif
  1318. @endif
  1319. @endif
  1320. @endif
  1321. </div>
  1322. </div>
  1323. <div class="col-md-5 col-xl-4 p-3">
  1324. <div id="card--resume" class="primary card--ui ms-3 user--resume">
  1325. <header>
  1326. <div class="username d-flex align-items-start">
  1327. <i class="ico--ui utenti light me-2"></i>
  1328. <div class="user--resume_name d-flex flex-column">
  1329. <span class="user-name">{{ strtoupper($first_name) }} {{ strtoupper($last_name) }}</span>
  1330. <span class="user-email">{{ $birth_date ? date("d/m/Y", strtotime($birth_date)) : '' }}{!!$age != '' ? ' (' . $age . ')' : ''!!}</span>
  1331. </div>
  1332. </div>
  1333. </header>
  1334. <div class="card--resume_body">
  1335. <ul class="user-address mb-4 p-0">
  1336. <li><i class="ico--ui resume--ico phone me-2"></i><span>Tel. {{ $phone }}</span></li>
  1337. <li><i class="ico--ui resume--ico mail light me-2"></i><span>{{ $email }}</span></li>
  1338. </ul>
  1339. <ul class="user-residence p-0">
  1340. <li><i class="ico--ui resume--ico residence me-2"></i>
  1341. <span>
  1342. @if($city_id > 0)
  1343. {{$this->getCity($city_id)}}
  1344. @if($province_id > 0)
  1345. ( {{$this->getProvince($province_id)}} ) -
  1346. @endif
  1347. @endif
  1348. {{ $zip_code }}<br>
  1349. {{ $address }}
  1350. </span>
  1351. </li>
  1352. </ul>
  1353. <div class="resume--tab_info credito">
  1354. <h2 class="mb-3">Borsellino MAD</h2>
  1355. <span class="value">{{formatPrice($money)}}</span>
  1356. </div>
  1357. <div class="resume--tab_info gruppi corsi">
  1358. <h2 class="mb-3">Corsi</h2>
  1359. @foreach($member_courses as $member_course)
  1360. <div class="resume--info d-flex align-items-center">
  1361. <div class="row" style="margin-top:10px">
  1362. <div class="row">
  1363. <strong>{{$member_course->course->getTree()}}</strong></span><br>
  1364. </div>
  1365. <div class="row">
  1366. <span class="title-detail">
  1367. @php
  1368. $aMo = json_decode($member_course->months);
  1369. if (sizeof($aMo) == 1)
  1370. {
  1371. print($this->getMonth($aMo[0]->m));
  1372. }
  1373. if (sizeof($aMo) > 1)
  1374. {
  1375. print($this->getMonth($aMo[0]->m) . " - " . $this->getMonth($aMo[sizeof($aMo) - 1]->m));
  1376. }
  1377. @endphp
  1378. </span>
  1379. </div>
  1380. <div class="row">
  1381. <span class="title-detail">
  1382. @foreach(json_decode($member_course->when) as $xx => $x)
  1383. @if($xx > 0)
  1384. <br>
  1385. @endif
  1386. @foreach($x->day as $d)
  1387. {{$d}}
  1388. @endforeach
  1389. {{$x->from}} - {{$x->to}}
  1390. @endforeach
  1391. </span>
  1392. </div>
  1393. </div>
  1394. </div>
  1395. @endforeach
  1396. </div>
  1397. <div class="resume--tab_info tesseramento">
  1398. <h2 class="mb-3">Tesseramento</h2>
  1399. @foreach($member_cards as $member_card)
  1400. @if($member_card->expire_date . " 23:59:59" > date("Y-m-d"))
  1401. <div class="resume--wrapper d-flex align-items-start justify-content-between mb-2">
  1402. <div class="resume--info d-flex align-items-start">
  1403. <i class="ico--ui tessera me-2"></i>
  1404. <div class="title--tessera_added">
  1405. <h4>{{$member_card->card->name}}</h4>
  1406. <span class="title-detail">Scadenza: <span class="title-detail_date">{{$member_card->expire_date ? date("d/m/Y", strtotime($member_card->expire_date)) : ''}}</span></span></small>
  1407. @if($member_card->discipline_1)
  1408. </br>
  1409. <span class="title-detail">Disciplina : <b>{{$member_card->discipline_1->name}}</b></span>
  1410. @endif
  1411. @if($member_card->discipline_2)
  1412. </br>
  1413. <span class="title-detail">Disciplina : <b>{{$member_card->discipline_2->name}}</b></span>
  1414. @endif
  1415. @if($member_card->discipline_3)
  1416. </br>
  1417. <span class="title-detail">Disciplina : <b>{{$member_card->discipline_3->name}}</b></span>
  1418. @endif
  1419. </div>
  1420. </div>
  1421. <span class="badge tessera-badge active">attiva</span>
  1422. </div>
  1423. @endif
  1424. @endforeach
  1425. </div>
  1426. <div class="resume--tab_info tesseramento">
  1427. <h2 class="mb-3">Certificato</h2>
  1428. @if(sizeof($member_certificates) > 0)
  1429. @php
  1430. $cert = $member_certificates[0]
  1431. @endphp
  1432. @if($cert->expire_date . " 23:59:59" > date("Y-m-d"))
  1433. <div class="resume--wrapper d-flex align-items-start justify-content-between mb-2">
  1434. <div class="resume--info d-flex align-items-start">
  1435. <i class="fa-regular fa-file-lines me-2"></i>
  1436. <div class="title--tessera_added">
  1437. <h4>{{$cert->type == 'A' ? 'Agonistico' : 'Non agonistico'}}</h4>
  1438. <span class="title-detail">Scadenza: <span class="title-detail_date">{{$cert->expire_date ? date("d/m/Y", strtotime($cert->expire_date)) : ''}}</span></span></small>
  1439. </div>
  1440. </div>
  1441. @if($cert->expire_date . " 23:59:59" < date("Y-m-d"))
  1442. <span class="badge tessera-badge suspended">scaduto</span>
  1443. @endif
  1444. @if($cert->expire_date . " 23:59:59" >= date("Y-m-d") && $cert->expire_date < date("Y-m-d", strtotime("+1 month")))
  1445. <span class="badge tessera-badge due">in scadenza</span>
  1446. @endif
  1447. @if($cert->expire_date . " 23:59:59" >= date("Y-m-d", strtotime("+1 month")))
  1448. <span class="badge tessera-badge active">valido</span>
  1449. @endif
  1450. </div>
  1451. @endif
  1452. @endif
  1453. </div>
  1454. <div class="resume--tab_info gruppi">
  1455. <h2 class="mb-3">Gruppi di appartenenza</h2>
  1456. @foreach($member_categories as $member_category)
  1457. <div class="resume--info d-flex align-items-center">
  1458. <i class="ico--ui gruppi me-2"></i><span><strong>{{$member_category->category->getTree()}}</strong></span>
  1459. </div>
  1460. @endforeach
  1461. </div>
  1462. </div>
  1463. </div>
  1464. </div>
  1465. </div>
  1466. </div>
  1467. <section class="save--section d-flex justify-content-start">
  1468. <div class="container">
  1469. <div class="row">
  1470. <div class="col-md-7 col-xl-8 d-flex gx-0">
  1471. @if($add)
  1472. <button class="btn--ui primary d-flex order-1 me-2" wire:click="store(false)">salva e continua</button>
  1473. <button class="btn--ui primary d-flex order-3 ms-auto" wire:click="store(true)">salva e chiudi</button>
  1474. @endif
  1475. @if($update)
  1476. <button class="btn--ui primary d-flex order-1 me-2" wire:click="updateAAA(false)">salva e continua</button>
  1477. <button class="btn--ui primary d-flex order-3 ms-auto" wire:click="updateAAA(true)">salva e chiudi</button>
  1478. @endif
  1479. <button class="btn--ui lightGrey" onclick="annulla()" style="margin-right:10px">annulla</button><br><br>
  1480. </div>
  1481. <div class="col-md-5 col-xl-4"></div>
  1482. </div>
  1483. </div>
  1484. </section>
  1485. @endif
  1486. </div>
  1487. @endif
  1488. <div wire:ignore.self class="modal fade" id="userModal" tabindex="-1" aria-labelledby="userModalLabel" aria-hidden="true">
  1489. <div class="modal-dialog">
  1490. <div class="modal-content">
  1491. <div class="modal-header">
  1492. <h5 class="modal-title" id="userModalLabel">Modifica borsellino</h5>
  1493. <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
  1494. </div>
  1495. <div class="modal-body">
  1496. <div class="row">
  1497. <div class="col-md-6">
  1498. <label for="newMemberFirstName" class="form-label">Importo</label>
  1499. <input class="form-control " type="text" id="importoBorsellino" >
  1500. </div>
  1501. </div>
  1502. </div>
  1503. <div class="modal-footer">
  1504. <button type="button" class="btn--ui lightGrey" data-bs-dismiss="modal">Annulla</button>
  1505. <button type="button" class="btn--ui btn-primary" onclick="updateBorsellino('-')">Decrementa</button>
  1506. <button type="button" class="btn--ui btn-primary" onclick="updateBorsellino('+')">Aumenta</button>
  1507. </div>
  1508. </div>
  1509. </div>
  1510. </div>
  1511. </div>
  1512. @push('scripts')
  1513. <link href="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/css/select2.min.css" rel="stylesheet" />
  1514. <style>
  1515. table.tableHead thead
  1516. {
  1517. position: sticky;
  1518. z-index: 100;
  1519. top: 0;
  1520. }
  1521. .select2-container--default .select2-selection--single
  1522. {
  1523. background-color: #E9F0F5;
  1524. border: 0.0625rem solid #DFE5EB;
  1525. font-size: 0.75rem;
  1526. }
  1527. .select2-selection
  1528. {
  1529. height: 38px !important;
  1530. }
  1531. .select2-selection__rendered
  1532. {
  1533. padding-top:3px;
  1534. }
  1535. .select2
  1536. {
  1537. width:100% !important;
  1538. }
  1539. a.notSelected
  1540. {
  1541. display: flex;
  1542. margin-right:10px;
  1543. float:left;
  1544. height: 2.5rem !important;
  1545. width:50px;
  1546. align-items: center;
  1547. justify-content: center;
  1548. color: #006099;
  1549. background-color: #d3dce1 !important;
  1550. padding: 0 1.25rem;
  1551. font-size: 0.875rem;
  1552. font-family: greycliff-cf, sans-serif;
  1553. border-radius: 1.875rem !important;
  1554. -webkit-border-radius: 1.875rem !important;
  1555. -moz-border-radius: 1.875rem !important;
  1556. -webkit-transition: all 0.3s ease-in-out;
  1557. -moz-transition: all 0.3s ease-in-out;
  1558. -o-transition: all 0.3s ease-in-out;
  1559. transition: all 0.3s ease-in-out;
  1560. border: none;
  1561. }
  1562. a.selected
  1563. {
  1564. display: flex;
  1565. margin-right:10px;
  1566. float:left;
  1567. height: 2.5rem !important;
  1568. width:50px;
  1569. align-items: center;
  1570. justify-content: center;
  1571. color: #fff;
  1572. background-color: #006099 !important;
  1573. padding: 0 1.25rem;
  1574. font-size: 0.875rem;
  1575. font-family: greycliff-cf, sans-serif;
  1576. border-radius: 1.875rem !important;
  1577. -webkit-border-radius: 1.875rem !important;
  1578. -moz-border-radius: 1.875rem !important;
  1579. -webkit-transition: all 0.3s ease-in-out;
  1580. -moz-transition: all 0.3s ease-in-out;
  1581. -o-transition: all 0.3s ease-in-out;
  1582. transition: all 0.3s ease-in-out;
  1583. border: none;
  1584. }
  1585. div.day
  1586. {
  1587. margin-top:20px;
  1588. color: #006099;
  1589. background-color: #ffffff !important;
  1590. padding: 20px;
  1591. border-radius: 1.875rem !important;
  1592. -webkit-border-radius: 1.875rem !important;
  1593. -moz-border-radius: 1.875rem !important;
  1594. -webkit-transition: all 0.3s ease-in-out;
  1595. -moz-transition: all 0.3s ease-in-out;
  1596. -o-transition: all 0.3s ease-in-out;
  1597. transition: all 0.3s ease-in-out;
  1598. border: 2px solid #d3dce1;
  1599. }
  1600. .btn--ui.lightGrey, .btn--ui.extraLightGrey
  1601. {
  1602. -webkit-border-radius: 0.5rem !important;
  1603. background-color:#ffffff !important;
  1604. border: 1px solid grey;
  1605. color: black;
  1606. font-weight:normal;
  1607. }
  1608. .persistent-invalid
  1609. {
  1610. border-color: #dc3545 !important;
  1611. padding-right: calc(1.5em + 0.75rem) !important;
  1612. background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' width='12' height='12' fill='none' stroke='%23dc3545'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath stroke-linejoin='round' d='M5.8 3.6h.4L6 6.5z'/%3e%3ccircle cx='6' cy='8.2' r='.6' fill='%23dc3545' stroke='none'/%3e%3c/svg%3e") !important;
  1613. background-repeat: no-repeat !important;
  1614. background-position: right calc(0.375em + 0.1875rem) center !important;
  1615. background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem) !important;
  1616. }
  1617. </style>
  1618. <script src="https://code.jquery.com/jquery-2.2.4.min.js" integrity="sha256-BbhdlvQf/xTY9gja0Dq3HiwQF8LaCRTXxZKRutelT44=" crossorigin="anonymous"></script>
  1619. <script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js"></script>
  1620. @endpush
  1621. @push('scripts')
  1622. <script>
  1623. function matchStart(params, data) {
  1624. params.term = params.term || '';
  1625. if (data.text.toUpperCase().indexOf(params.term.toUpperCase()) == 0) {
  1626. return data;
  1627. }
  1628. return false;
  1629. }
  1630. var nation_id = {{$nation_id > 0 ? $nation_id : 0}};
  1631. var province_id = 0;
  1632. var nation_birth_id = 0;
  1633. var province_birth_id = 0;
  1634. Livewire.on('load-select', () => {
  1635. loadCombo();
  1636. });
  1637. function updateBorsellino(verse)
  1638. {
  1639. var importoBorsellino = $("#importoBorsellino").val();
  1640. @this.updateBorsellino(importoBorsellino, verse);
  1641. }
  1642. Livewire.on('load-provinces', (nation_id, element) => {
  1643. $('.' + element).select2({
  1644. ajax: {
  1645. url: '/provinces/' + nation_id,
  1646. dataType: 'json'
  1647. }
  1648. });
  1649. });
  1650. Livewire.on('load-cities', (province_id, element) => {
  1651. $('.' + element).select2({
  1652. ajax: {
  1653. url: '/cities/' + province_id,
  1654. dataType: 'json'
  1655. }
  1656. });
  1657. });
  1658. Livewire.on('hide-search', () => {
  1659. //pcsh2();
  1660. });
  1661. Livewire.on('setIds', (nation_id_x, birth_nation_id_x) => {
  1662. nation_id = nation_id_x;
  1663. nation_birth_id = birth_nation_id_x;
  1664. });
  1665. function loadCombo()
  1666. {
  1667. $('.nationClass').select2({
  1668. ajax: {
  1669. url: '/nations',
  1670. dataType: 'json'
  1671. }
  1672. });
  1673. $('.nationClass').on('change', function (e) {
  1674. nation_id = $('.nationClass').select2("val");
  1675. province_id = 0;
  1676. @this.set('nation_id', nation_id);
  1677. @this.set('province_id', 0);
  1678. @this.set('city_id', 0);
  1679. @this.checkIsItaly();
  1680. });
  1681. $('.provinceClass').select2({
  1682. ajax: {
  1683. url: '/provinces/' + nation_id,
  1684. dataType: 'json'
  1685. }
  1686. });
  1687. $('.provinceClass').on('change', function (e) {
  1688. province_id = $('.provinceClass').select2("val");
  1689. @this.set('province_id', province_id);
  1690. @this.set('city_id', 0);
  1691. });
  1692. $('.cityClass').select2({
  1693. ajax: {
  1694. url: '/cities/' + province_id,
  1695. dataType: 'json'
  1696. }
  1697. });
  1698. $('.cityClass').on('change', function (e) {
  1699. var data = $('.cityClass').select2("val");
  1700. @this.set('city_id', data);
  1701. });
  1702. $('.nationBirthClass').select2({
  1703. ajax: {
  1704. url: '/nations',
  1705. dataType: 'json'
  1706. }
  1707. });
  1708. $('.nationBirthClass').on('change', function (e) {
  1709. nation_birth_id = $('.nationBirthClass').select2("val");
  1710. province_birth_id = 0;
  1711. @this.set('birth_nation_id', nation_birth_id);
  1712. @this.set('birth_province_id', 0);
  1713. @this.set('birth_city_id', 0);
  1714. @this.checkIsBirthItaly();
  1715. });
  1716. $('.provinceBirthClass').select2({
  1717. ajax: {
  1718. url: '/provinces/' + nation_birth_id,
  1719. dataType: 'json'
  1720. }
  1721. });
  1722. $('.provinceBirthClass').on('change', function (e) {
  1723. province_birth_id = $('.provinceBirthClass').select2("val");
  1724. @this.set('birth_province_id', province_birth_id);
  1725. @this.set('birth_city_id', 0);
  1726. });
  1727. $('.cityBirthClass').select2({
  1728. ajax: {
  1729. url: '/cities/' + province_birth_id,
  1730. dataType: 'json'
  1731. }
  1732. });
  1733. $('.cityBirthClass').on('change', function (e) {
  1734. var data = $('.cityBirthClass').select2("val");
  1735. @this.set('birth_city_id', data);
  1736. });
  1737. $('.card_card_id').select2({
  1738. matcher: function(params, data) {
  1739. return matchStart(params, data);
  1740. }
  1741. });
  1742. $('.card_card_id').on('change', function (e) {
  1743. var data = $('.card_card_id').select2("val");
  1744. @this.set('card_card_id', data);
  1745. });
  1746. $('.certificate_type').select2({
  1747. matcher: function(params, data) {
  1748. return matchStart(params, data);
  1749. }
  1750. });
  1751. $('.certificate_type').on('change', function (e) {
  1752. var data = $('.certificate_type').select2("val");
  1753. @this.set('certificate_type', data);
  1754. });
  1755. $('.categoriesClass').select2({
  1756. matcher: function(params, data) {
  1757. return matchStart(params, data);
  1758. }
  1759. });
  1760. $('.categoriesClass').on('change', function (e) {
  1761. var data = $('.categoriesClass').select2("val");
  1762. @this.set('category_category_id', data);
  1763. });
  1764. $('.coursesClass').select2({
  1765. matcher: function(params, data) {
  1766. return matchStart(params, data);
  1767. }
  1768. });
  1769. $('.coursesClass').on('change', function (e) {
  1770. var data = $('.coursesClass').select2("val");
  1771. @this.set('course_course_id', data);
  1772. });
  1773. }
  1774. @if($refreshAfter == 1)
  1775. setTimeout(() => {
  1776. loadCombo();
  1777. }, 100)
  1778. @endif
  1779. function onlyNumberAmount(input) {
  1780. let v = input.value.replace(/\D+/g, '');
  1781. if (v.length > 14) v = v.slice(0, 14);
  1782. input.value = "€ " + v.replace(/(\d)(\d\d)$/, "$1,$2").replace(/(^\d{1,3}|\d{3})(?=(?:\d{3})+(?:,|$))/g, '$1.');
  1783. }
  1784. </script>
  1785. @endpush
  1786. @push('scripts')
  1787. <link href="/css/datatables.css" rel="stylesheet" />
  1788. <script src="/assets/js/datatables.js"></script>
  1789. <script src="https://cdn.datatables.net/buttons/3.0.2/js/buttons.dataTables.js"></script>
  1790. <script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.10.1/jszip.min.js"></script>
  1791. <script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.2.7/pdfmake.min.js"></script>
  1792. <script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.2.7/vfs_fonts.js"></script>
  1793. @endpush
  1794. @push('scripts')
  1795. <script>
  1796. function showData(id)
  1797. {
  1798. @this.showDetailF(id);
  1799. }
  1800. function editData(id) {
  1801. if ($('#tablesaw-350').length && $.fn.DataTable.isDataTable('#tablesaw-350')) {
  1802. const dataTable = $('#tablesaw-350').DataTable();
  1803. const pageLength = dataTable.page.len();
  1804. const currentPage = dataTable.page.info().page;
  1805. const order = dataTable.order();
  1806. if (order && order.length > 0) {
  1807. localStorage.setItem('dtOrderColumn', order[0][0]);
  1808. localStorage.setItem('dtOrderDir', order[0][1]);
  1809. }
  1810. }
  1811. window.scrollTo({
  1812. top: 0,
  1813. behavior: 'smooth'
  1814. });
  1815. @this.edit(id);
  1816. }
  1817. function deleteData(id)
  1818. {
  1819. if (confirm('Sei sicuro?'))
  1820. @this.delete(id);
  1821. }
  1822. var isFilter = false;
  1823. $(document).ready(function() {
  1824. $(document).on("click",".showHideFilter",function() {
  1825. if (isFilter)
  1826. {
  1827. isFilter = false;
  1828. $(".showFilter").hide();
  1829. }
  1830. else
  1831. {
  1832. isFilter = true;
  1833. $(".showFilter").show();
  1834. }
  1835. });
  1836. } );
  1837. $(document).ready(function() {
  1838. loadDataTable();
  1839. } );
  1840. Livewire.on('load-data-table', () => {
  1841. setTimeout(function() {loadDataTable()}, 100);
  1842. });
  1843. Livewire.on('destroy-data-table', () => {
  1844. $('#tablesaw-350').DataTable().destroy();
  1845. });
  1846. function destroyDataTable()
  1847. {
  1848. $('#tablesaw-350').DataTable().destroy();
  1849. }
  1850. $('.filterCards').select2({"language": {"noResults": function(){return "Nessun risultato";}}});
  1851. $('.filterStatus').select2({"language": {"noResults": function(){return "Nessun risultato";}}});
  1852. $('.filterScadenza').select2({"language": {"noResults": function(){return "Nessun risultato";}}});
  1853. $('.filterCertificateType').select2({"language": {"noResults": function(){return "Nessun risultato";}}});
  1854. $('.filterCategories').select2({"language": {"noResults": function(){return "Nessun risultato";}}});
  1855. @if(isset($_GET["showFilters"]))
  1856. var filterStatus = localStorage.getItem("filterStatusMember");
  1857. if (filterStatus)
  1858. {
  1859. $('.filterStatus').val(filterStatus).trigger('change');
  1860. }
  1861. var filterCards = localStorage.getItem("filterCardsMember");
  1862. if (filterCards)
  1863. {
  1864. $('.filterCards').val(filterCards).trigger('change');
  1865. }
  1866. var filterScadenza = localStorage.getItem("filterScadenzaMember");
  1867. if (filterScadenza)
  1868. {
  1869. $('.filterScadenza').val(filterScadenza).trigger('change');
  1870. }
  1871. var filterCertificateType = localStorage.getItem("filterCertificateTypeMember");
  1872. if (filterCertificateType)
  1873. {
  1874. $('.filterCertificateType').val(filterCertificateType).trigger('change');
  1875. }
  1876. var filterCategories = localStorage.getItem("filterCategoriesMember");
  1877. if (filterCategories)
  1878. {
  1879. $('.filterCategories').val(filterCategories).trigger('change');
  1880. }
  1881. var fromYear = localStorage.getItem("fromYearMember");
  1882. if (fromYear)
  1883. {
  1884. $('input[name="txtFromYear"]').val(fromYear);
  1885. }
  1886. var toYear = localStorage.getItem("toYearMember");
  1887. if (toYear)
  1888. {
  1889. $('input[name="txtToYear"]').val(toYear);
  1890. }
  1891. var fromYearYear = localStorage.getItem("fromYearYearMember");
  1892. if (fromYearYear)
  1893. {
  1894. $('input[name="txtFromYearYear"]').val(fromYearYear);
  1895. }
  1896. var toYearYear = localStorage.getItem("toYearYearMember");
  1897. if (toYearYear)
  1898. {
  1899. $('input[name="txtToYearYear"]').val(toYearYear);
  1900. }
  1901. @endif
  1902. $(document).on("keypress", $('.filterCategories'), function (e) {
  1903. setTimeout(() => {
  1904. $(".select2-results__option").each(function(){
  1905. var txt = $(this).html();
  1906. var count = (txt.match(/-/g) || []).length;
  1907. $(this).addClass('paddingLeftSelect' + count);
  1908. });
  1909. }, 100);
  1910. });
  1911. $('.filterCategories').on('select2:open', function (e) {
  1912. setTimeout(() => {
  1913. $(".select2-results__option").each(function(){
  1914. var txt = $(this).html();
  1915. var count = (txt.match(/-/g) || []).length;
  1916. $(this).addClass('paddingLeftSelect' + count);
  1917. });
  1918. }, 100);
  1919. });
  1920. function reset()
  1921. {
  1922. $('.filterCards').val('').trigger('change');
  1923. $('.filterStatus').val('').trigger('change');
  1924. $('.filterScadenza').val('-1').trigger('change');
  1925. $('.filterCertificateType').val('-1').trigger('change');
  1926. $('.filterCategories').val('-1').trigger('change');
  1927. $('input[name="txtFromYear"]').val('');
  1928. $('input[name="txtToYear"]').val('');
  1929. $('input[name="txtFromYearYear"]').val('');
  1930. $('input[name="txtToYearYear"]').val('');
  1931. loadDataTable();
  1932. }
  1933. function loadDataTable() {
  1934. if ($.fn.DataTable.isDataTable('#tablesaw-350')) {
  1935. $('#tablesaw-350').DataTable().destroy();
  1936. }
  1937. var fromYear = $('input[name="txtFromYear"]').val();
  1938. localStorage.setItem("fromYearMember", fromYear);
  1939. var toYear = $('input[name="txtToYear"]').val();
  1940. localStorage.setItem("toYearMember", toYear);
  1941. var fromYearYear = $('input[name="txtFromYearYear"]').val();
  1942. localStorage.setItem("fromYearYearMember", fromYearYear);
  1943. var toYearYear = $('input[name="txtToYearYear"]').val();
  1944. localStorage.setItem("toYearYearMember", toYearYear);
  1945. var filterCards = $('.filterCards').val();
  1946. localStorage.setItem("filterCardsMember", filterCards);
  1947. var filterStatus = $('.filterStatus').val();
  1948. localStorage.setItem("filterStatusMember", filterStatus);
  1949. var filterScadenza = $('.filterScadenza').val();
  1950. localStorage.setItem("filterScadenzaMember", filterScadenza);
  1951. var filterCertificateType = $('.filterCertificateType').val();
  1952. localStorage.setItem("filterCertificateTypeMember", filterCertificateType);
  1953. var filterCategories = $('.filterCategories').val();
  1954. localStorage.setItem("filterCategoriesMember", filterCategories)
  1955. const pageLength = 10;
  1956. const dataTable = $('#tablesaw-350').DataTable({
  1957. serverSide: true,
  1958. ajax: '/get_members?cards=' + filterCards + "&filterCategories=" + filterCategories + "&filterCertificateType=" + filterCertificateType + "&filterScadenza=" + filterScadenza + "&filterStatus=" + filterStatus + "&fromYear=" + fromYear + "&toYear=" + toYear + "&fromYearYear=" + fromYearYear + "&toYearYear=" + toYearYear,
  1959. columns: [
  1960. {
  1961. data: "last_name",
  1962. render: function (data){
  1963. const d = data.split("|");
  1964. var ret = '<a style="cursor:pointer" onclick="showData(' + d[1] + ')">' + d[0] + '</a>';
  1965. return ret;
  1966. }
  1967. },
  1968. {
  1969. data: "first_name",
  1970. render: function (data){
  1971. const d = data.split("|");
  1972. var ret = '<a style="cursor:pointer" onclick="showData(' + d[1] + ')">' + d[0] + '</a>';
  1973. return ret;
  1974. }
  1975. },
  1976. { data: "phone"},
  1977. { data: "age", "type": "num", className:"dt-type-numeric"},
  1978. { data: "year", className:"dt-type-numeric"},
  1979. {
  1980. data: "status",
  1981. render: function (data){
  1982. const d = data.split("|");
  1983. var ret = '<span class="tablesaw-cell-content"><span class="badge tessera-badge ' + d[0] + '">' + d[1] + '</span></span>';
  1984. return ret;
  1985. }
  1986. },
  1987. {
  1988. data: "certificate",
  1989. render: function (data){
  1990. var ret = '';
  1991. if (data != "") {
  1992. const d = data.split("|");
  1993. ret += '<span class="tablesaw-cell-content d-flex align-items-center">';
  1994. if (d[0] == "0") {
  1995. ret += '<i class="ico--ui check suspended me-2"></i>';
  1996. ret += 'Scaduto : ';
  1997. }
  1998. if (d[0] == "1") {
  1999. ret += '<i class="ico--ui check due me-2"></i>';
  2000. ret += 'In scadenza : ';
  2001. }
  2002. if (d[0] == "2") {
  2003. ret += '<i class="ico--ui check active me-2"></i>';
  2004. ret += 'Scadenza : ';
  2005. }
  2006. ret += d[1];
  2007. ret += '</span>';
  2008. }
  2009. if(data == ""){
  2010. ret += '<span class="tablesaw-cell-content d-flex align-items-center">';
  2011. ret += '<i class="ico--ui check absent me-2"></i>';
  2012. ret += 'Non consegnato';
  2013. ret += '</span>';
  2014. }
  2015. return ret;
  2016. }
  2017. },
  2018. {
  2019. data: "action",
  2020. render: function (data){
  2021. var ret = '<button type="button" class="btn" onclick="editData(' + data + ')" 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>&nbsp;';
  2022. ret += '<button type="button" class="btn" onclick="deleteData(' + data + ')" 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>';
  2023. return ret;
  2024. }
  2025. },
  2026. ],
  2027. fixedHeader: false,
  2028. thead: {
  2029. 'th': {'background-color': 'blue'}
  2030. },
  2031. layout: {
  2032. topStart : null,
  2033. topEnd : null,
  2034. top1A: {
  2035. buttons: [
  2036. {
  2037. extend: 'collection',
  2038. text: 'ESPORTA',
  2039. buttons: [
  2040. {
  2041. extend: 'excelHtml5',"action":newexportaction,
  2042. title: 'Utenti',
  2043. exportOptions: {
  2044. columns: ":not(':last')",
  2045. page: 'all'
  2046. }
  2047. },
  2048. {
  2049. extend: 'pdfHtml5',"action":newexportaction,
  2050. title: 'Utenti',
  2051. exportOptions: {
  2052. columns: ":not(':last')"
  2053. },
  2054. customize: function(doc) {
  2055. doc.styles.tableHeader.alignment = 'left';
  2056. }
  2057. },
  2058. {
  2059. extend: 'print',"action":newexportaction,
  2060. text: 'Stampa',
  2061. title: 'Utenti',
  2062. exportOptions: {
  2063. columns: ":not(':last')"
  2064. }
  2065. }
  2066. ],
  2067. dropup: true
  2068. }
  2069. ]
  2070. },
  2071. top1B : {
  2072. pageLength: {
  2073. menu: [[10, 25, 50, 100, 100000], [10, 25, 50, 100, "Tutti"]]
  2074. }
  2075. },
  2076. top1C :'search',
  2077. },
  2078. pagingType: 'numbers',
  2079. "language": {
  2080. "url": "/assets/js/Italian.json"
  2081. },
  2082. "fnInitComplete": function (oSettings, json) {
  2083. var html = '&nbsp;<a style="cursor:pointer" class="showHideFilter btn--ui"><i class="fa-solid fa-sliders"></i></a>';
  2084. html += '&nbsp;<a style="cursor:pointer" class="addData btn--ui"><i class="fa-solid fa-plus"></i></a>';
  2085. $(".dt-search").append(html);
  2086. }
  2087. });
  2088. $('#tablesaw-350 thead tr th').addClass('col');
  2089. $('#tablesaw-350 thead tr th').css("background-color", "#f6f8fa");
  2090. $('#tablesaw-350').on('draw.dt', function() {
  2091. $('[data-bs-toggle="popover"]').popover()
  2092. });
  2093. }
  2094. $(document).ready(function() {
  2095. $(document).on("click",".addData",function() {
  2096. $(".title--section_addButton").trigger("click")
  2097. });
  2098. } );
  2099. var isEdit = false;
  2100. var isEditCorso = false;
  2101. Livewire.on('setEdit', (x) =>
  2102. {
  2103. isEdit = x;
  2104. console.log(isEdit);
  2105. });
  2106. Livewire.on('setEditCorso', (x) =>
  2107. {
  2108. isEditCorso = x;
  2109. console.log("Edit corso" + isEditCorso);
  2110. });
  2111. Livewire.on('setErrorMsg', (errors) =>
  2112. {
  2113. function msg(value)
  2114. {
  2115. const myArray = value.split("=");
  2116. if (myArray[1] == '0' || myArray[1] == '')
  2117. $("span").find("[aria-controls='select2-" + myArray[0] + "-container']").css('border', 'solid 3px #dc3545');
  2118. }
  2119. console.log(errors);
  2120. });
  2121. Livewire.on('reload', (x) =>
  2122. {
  2123. location.reload();
  2124. });
  2125. Livewire.on('goToTop', () => {
  2126. @this.set('type', 'dati');
  2127. document.body.scrollTop = document.documentElement.scrollTop = 0;
  2128. });
  2129. function storeAction(type)
  2130. {
  2131. @this.change('dati');
  2132. if (isEditCorso)
  2133. {
  2134. if (confirm('Non hai concluso l\' inserimento/modifica del corso, vuoi comunque procedere?'))
  2135. @this.store(type);
  2136. }
  2137. else
  2138. {
  2139. document.body.scrollTop = document.documentElement.scrollTop = 0;
  2140. }
  2141. }
  2142. function updateAction(type)
  2143. {
  2144. @this.change('dati');
  2145. if (isEditCorso)
  2146. {
  2147. if (confirm('Non hai concluso l\' inserimento/modifica del corso, vuoi comunque procedere?'))
  2148. @this.updateAAA(type);
  2149. }
  2150. else
  2151. {
  2152. @this.updateAAA(type);
  2153. document.body.scrollTop = document.documentElement.scrollTop = 0;
  2154. }
  2155. }
  2156. function cancelAction()
  2157. {
  2158. if (isEditCorso)
  2159. {
  2160. if (confirm('Non hai concluso l\' inserimento/modifica del corso, vuoi comunque procedere?'))
  2161. @this.cancel();
  2162. }
  2163. else
  2164. @this.cancel();
  2165. }
  2166. function annulla()
  2167. {
  2168. window.onbeforeunload = null;
  2169. document.location.href = '/members';
  2170. }
  2171. window.onbeforeunload = function(){
  2172. if (isEdit)
  2173. return 'Cambiando pagina le eventuali modifiche andranno perse';
  2174. if (isEditCorso)
  2175. return 'Devi prima salvare i dati del corso';
  2176. };
  2177. window.livewire.on('saved', () => {
  2178. $('#userModal').modal('hide');
  2179. });
  2180. Livewire.on('goToAnchor', () =>
  2181. {
  2182. window.location.href = "#top";
  2183. });
  2184. $(function() {
  2185. if (window.history && window.history.pushState) {
  2186. window.history.pushState('', null, './');
  2187. $(window).on('popstate', function() {
  2188. document.location.href = '/members';
  2189. });
  2190. }
  2191. });
  2192. function setupBackButtonHandlers() {
  2193. const backButtons = document.querySelectorAll('a.btn--ui.lightGrey[href^="/"]');
  2194. backButtons.forEach(button => {
  2195. button.addEventListener('click', function(e) {
  2196. });
  2197. });
  2198. }
  2199. $(document).ready(function() {
  2200. setupBackButtonHandlers();
  2201. });
  2202. document.addEventListener('livewire:load', () => {
  2203. Livewire.on('focus-error-field', (fieldId) => {
  2204. console.log('Validation errors received:', fieldId);
  2205. let element;
  2206. if (typeof fieldId === 'string') {
  2207. element = document.getElementById(fieldId);
  2208. } else if (Array.isArray(fieldId) && fieldId.length > 0) {
  2209. const firstFieldId = fieldId[0];
  2210. element = document.getElementById(firstFieldId);
  2211. fieldId = firstFieldId;
  2212. }
  2213. if (element) {
  2214. element.focus();
  2215. element.scrollIntoView({
  2216. behavior: 'smooth',
  2217. block: 'center'
  2218. });
  2219. element.classList.add('is-invalid');
  2220. const label = document.querySelector(`label[for="${fieldId}"]`);
  2221. if (label) {
  2222. label.classList.add('text-danger');
  2223. }
  2224. const preserveInvalidClass = () => {
  2225. if (!element.classList.contains('is-invalid')) {
  2226. element.classList.add('is-invalid');
  2227. }
  2228. };
  2229. const intervalId = setInterval(preserveInvalidClass, 100);
  2230. element.addEventListener('input', () => {
  2231. clearInterval(intervalId);
  2232. });
  2233. } else {
  2234. console.warn('Element with id ' + fieldId + ' not found');
  2235. }
  2236. });
  2237. });
  2238. function getNextTab(currentTab) {
  2239. const tabs = ['dati', 'tesseramento', 'corsi', 'gruppi'];
  2240. const currentIndex = tabs.indexOf(currentTab);
  2241. return currentIndex < tabs.length - 1 ? tabs[currentIndex + 1] : currentTab;
  2242. }
  2243. function scrollToFormTop() {
  2244. const formSection = document.querySelector('.section--tab, .form--wrapper, #card--resume');
  2245. if (formSection) {
  2246. formSection.scrollIntoView({
  2247. behavior: 'instant',
  2248. block: 'start',
  2249. inline: 'nearest'
  2250. });
  2251. return true;
  2252. }
  2253. return false;
  2254. }
  2255. Livewire.on('saved-and-continue', (currentTab) => {
  2256. const nextTab = getNextTab(currentTab);
  2257. if (nextTab !== currentTab) {
  2258. @this.change(nextTab);
  2259. }
  2260. setTimeout(() => {
  2261. if (!scrollToFormTop()) {
  2262. window.scrollTo({ top: 0, behavior: 'instant' });
  2263. document.body.scrollTop = 0;
  2264. document.documentElement.scrollTop = 0;
  2265. }
  2266. const firstInput = document.querySelector('#first_name');
  2267. if (firstInput) {
  2268. firstInput.focus();
  2269. }
  2270. }, 200);
  2271. });
  2272. Livewire.on('course-availability-updated', () => {
  2273. console.log('Course availability updated');
  2274. // You can add any additional UI updates here if needed
  2275. });
  2276. // Update the existing card/certificate save handlers
  2277. window.addEventListener('card-saved', event => {
  2278. console.log('Card saved, checking course availability');
  2279. // The course availability will be automatically updated by the Livewire component
  2280. });
  2281. window.addEventListener('certificate-saved', event => {
  2282. console.log('Certificate saved, checking course availability');
  2283. // The course availability will be automatically updated by the Livewire component
  2284. });
  2285. </script>
  2286. @endpush