member.blade.php 183 KB

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