member.blade.php 176 KB

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