member.blade.php 172 KB

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