member.blade.php 176 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452
  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}}" 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-warning" role="alert">
  1050. <strong>Attenzione:</strong> Per aggiungere corsi è necessario avere un tesseramento attivo o un certificato medico valido.
  1051. </div>
  1052. @elseif($active["status"] != 1)
  1053. <div class="alert alert-info" role="alert">
  1054. <strong>Info:</strong> Il tesseramento non è attivo, ma è presente un certificato medico valido.
  1055. </div>
  1056. @elseif(!$hasCertificate)
  1057. <div class="alert alert-info" role="alert">
  1058. <strong>Info:</strong> Non è presente un certificato medico valido, ma il tesseramento è attivo.
  1059. </div>
  1060. @endif
  1061. <table class="table tablesaw tableHead tablesaw-stack tabella--corsi" id="tablesaw-350-2" style="min-width:800px">
  1062. <tbody id="checkall-target">
  1063. @foreach($member_courses as $member_course)
  1064. <tr>
  1065. <td style="width:20%%;border:0px;" colspan="1">
  1066. <b>{{$member_course->course->name}}</b><br>
  1067. </td>
  1068. <td style="width:20%;border:0px;">
  1069. {{$member_course->course->frequency->name ?? ""}}<br>
  1070. </td>
  1071. <td style="width:20%;border:0px;">
  1072. {{$member_course->course->level->name ?? ""}}<br>
  1073. </td>
  1074. <td style="text-align:right;width:5%;border:0px;">
  1075. @php
  1076. $status = $member_course->getStatus();
  1077. @endphp
  1078. <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>
  1079. </td>
  1080. <td style="text-align:right;width:15%;border:0px;">
  1081. <div class="row">
  1082. <div class="col-4">
  1083. <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>
  1084. </div>
  1085. <div class="col-4">
  1086. <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>
  1087. </div>
  1088. </div>
  1089. </td>
  1090. <td style="text-align:left;width:15%;border:0px;padding-top:15px;">
  1091. @if($member_course->notes != '')
  1092. <button type="button" class="btn" wire:click="showHideCourse({{ $member_course->id }})">
  1093. @if(in_array($member_course->id, $showCourse))
  1094. <i class="fa-solid fa-chevron-circle-up"></i>
  1095. @else
  1096. <i class="fa-solid fa-chevron-circle-down"></i>
  1097. @endif
  1098. </button>&nbsp;
  1099. @endif
  1100. </td>
  1101. </tr>
  1102. <tr>
  1103. <td style="width:30%" colspan="2">
  1104. {{date("d/m/Y", strtotime($member_course->date_from))}} - {{date("d/m/Y", strtotime($member_course->date_to))}}
  1105. </td>
  1106. <td style="width:30%"colspan="5">
  1107. @php
  1108. $ok = false;
  1109. @endphp
  1110. @foreach(json_decode($member_course->when) as $xx => $x)
  1111. @if($xx > 0)
  1112. <br>
  1113. @endif
  1114. @foreach($x->day as $zz => $d)
  1115. {{$zz > 0 ? '-' : ''}}{{$d}}
  1116. @endforeach
  1117. @if($x->from != '' && $x->to != '')
  1118. h {{$x->from}} - {{$x->to}}
  1119. @endif
  1120. @php
  1121. $ok = $x->from != '';
  1122. @endphp
  1123. @endforeach
  1124. @if(!$ok && $member_course->course->when != '')
  1125. @foreach(json_decode($member_course->course->when) as $xx => $x)
  1126. @php
  1127. $ok = true;
  1128. @endphp
  1129. @if($xx > 0)
  1130. <br>
  1131. @endif
  1132. @foreach($x->day as $zz => $d)
  1133. {{$zz > 0 ? '-' : ''}}{{$d}}
  1134. @endforeach
  1135. @if($x->from != '')
  1136. h {{$x->from}} - {{$x->to}}
  1137. @endif
  1138. @endforeach
  1139. @endif
  1140. </td>
  1141. </tr>
  1142. @if(in_array($member_course->id, $showCourse))
  1143. @if(false)
  1144. <tr>
  1145. <td colspan="5">
  1146. <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>
  1147. <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;
  1148. <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;
  1149. <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;
  1150. <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;
  1151. <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;
  1152. <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;
  1153. <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;
  1154. <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;
  1155. <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;
  1156. <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;
  1157. <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;
  1158. <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;
  1159. </td>
  1160. <td>
  1161. <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;
  1162. <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>
  1163. </td>
  1164. </tr>
  1165. @endif
  1166. <tr>
  1167. <td colspan="7">
  1168. @if($member_course->notes != '')
  1169. <b>Note</b><br>
  1170. {{$member_course->notes}}
  1171. @endif
  1172. @if($selectedCourseMember == $member_course->id)
  1173. @if(sizeof($payMonths) > 0 || $createSubscription)
  1174. <button class="btn--ui primary" style="color:white" wire:click="newPayment({{$member_course}})">Nuova entrata</button>&nbsp;
  1175. <button class="btn--ui primary" style="color:white" wire:click="block({{$member_course}})">Sospendi</button>
  1176. @endif
  1177. @if(sizeof($suspendedMonths) > 0)
  1178. <button class="btn--ui primary" style="color:white" wire:click="reactivate({{$member_course}})">Riattiva</button>&nbsp;
  1179. @endif<br>
  1180. @endif
  1181. </td>
  1182. </tr>
  1183. @endif
  1184. @endforeach
  1185. </tbody>
  1186. </table>
  1187. @if($dataId > 0)
  1188. @if ($active["status"] == 1 || $hasCertificate)
  1189. <button class="btn--ui primary" wire:click.prevent="addCourse()" style="max-width:200px">Aggiungi</button>
  1190. @else
  1191. {{-- <button class="btn--ui lightGrey" disabled style="max-width:200px">Aggiungi corso (non disponibile)</button>
  1192. <small class="text-muted d-block mt-1">Completa prima il tesseramento o carica un certificato medico valido</small> --}}
  1193. @endif
  1194. @endif
  1195. @else
  1196. <div class="form--wrapper">
  1197. <form class="form--utente">
  1198. <div class="row ">
  1199. <div class="col-12 mt-2">
  1200. <label for="course_name" class="form-label">Tipo corso</label><br>
  1201. <input type="radio" name="chkType" value="standard" wire:model="course_course_type">&nbsp;Standard
  1202. &nbsp;&nbsp;&nbsp;
  1203. <input type="radio" name="chkType" value="custom" wire:model="course_course_type">&nbsp;Personalizzato
  1204. </div>
  1205. <div class="row mt-3">
  1206. <div class="col-md-4">
  1207. <label for="course_name" class="form-label">Corso</label>
  1208. <select id="course_name" class="form-select" aria-label="Livello" wire:model="course_name" >
  1209. <option value="">
  1210. @foreach($course_names as $cn)
  1211. <option value="{{$cn}}">{{$cn}}
  1212. @endforeach
  1213. </select>
  1214. </div>
  1215. @if(false)
  1216. <label for="course_name" class="form-label">Corso</label>
  1217. <select id="course_course_id" class="form-select @error('course_course_id') is-invalid @enderror" aria-label="Corso" wire:model="course_course_id" >
  1218. <option value="">
  1219. @foreach($courses as $c)
  1220. <option value="{{$c->id}}">{{$c->name}}
  1221. @endforeach
  1222. </select>
  1223. @endif
  1224. @error('course_course_id')
  1225. <div class="invalid-feedback">Devi selezionare un corso</div>
  1226. @enderror
  1227. @if($course_exist)
  1228. <small style="color:red">Attenzione : il corso selezionato è già associato all'utente</small>
  1229. @endif
  1230. @if($course_name != '')
  1231. <div class="col-md-4">
  1232. <label for="course_level_id" class="form-label">Livello</label>
  1233. <select id="course_level_id" class="form-select" aria-label="Livello" wire:model="course_level_id" >
  1234. <option value="">
  1235. @foreach($course_levels as $l)
  1236. <option value="{{$l->id}}">{{$l->name}}
  1237. @endforeach
  1238. </select>
  1239. </div>
  1240. @endif
  1241. @if($course_level_id != '')
  1242. <div class="col-md-4">
  1243. <label for="course_frequency_id" class="form-label">Frequenza</label>
  1244. <select id="course_frequency_id" class="form-select" aria-label="Tipologia" wire:model="course_frequency_id" >
  1245. <option value="">
  1246. @foreach($course_frequencies as $f)
  1247. <option value="{{$f->id}}">{{$f->name}}
  1248. @endforeach
  1249. </select>
  1250. </div>
  1251. @endif
  1252. </div>
  1253. </div>
  1254. @if($course_course_id > 0)
  1255. <div class="row mt-4">
  1256. <div class="col-md-6">
  1257. <label for="course_course_subscription_id" class="form-label">Abbonamento</label>
  1258. <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">
  1259. <option value="">
  1260. @foreach($course_subscriptions as $t)
  1261. <option value="{{$t["id"]}}">{{$t["name"]}}
  1262. @endforeach
  1263. </select>
  1264. </div>
  1265. <div class="col-md-6">
  1266. <label for="course_price" class="form-label">Costo mensile</label>
  1267. <input class="form-control" type="text" id="course_price" placeholder="Costo mensile" wire:model="course_price" onkeyup="onlyNumberAmount(this)">
  1268. </div>
  1269. </div>
  1270. @if(false)
  1271. <div class="row mt-4 course--duration">
  1272. <div class="col-md-12">
  1273. <label for="duration" class="form-label">Durata del corso</label>
  1274. <div class="d-flex course--duration_mounth">
  1275. @foreach($course_months_list as $cm)
  1276. <a class="{{$this->checkMonth($cm) ? 'selected' : 'notSelected'}}" wire:click="setMonth({{$cm}})">{{getMonthName($cm, true)}}</a>
  1277. @endforeach
  1278. </div>
  1279. </div>
  1280. </div>
  1281. @endif
  1282. <div class="row mt-4">
  1283. <div class="col-md-6">
  1284. <label for="course_date_from" class="form-label">Data inizio</label>
  1285. <input class="form-control" type="date" id="course_date_from" wire:model="course_date_from">
  1286. </div>
  1287. <div class="col-md-6">
  1288. <label for="course_date_to" class="form-label">Data fine</label>
  1289. <input class="form-control" type="date" id="course_date_to" wire:model="course_date_to">
  1290. </div>
  1291. </div>
  1292. <div class="row mt-4">
  1293. <div class="col-md-6">
  1294. <label for="course_subscription_price" class="form-label">Costo iscrizione</label>
  1295. <input class="form-control" type="text" id="course_subscription_price" placeholder="Costo iscrizione" wire:model="course_subscription_price" onkeyup="onlyNumberAmount(this)">
  1296. </div>
  1297. </div>
  1298. @if($course_course_type == 'custom')
  1299. @foreach($course_when as $idW => $when)
  1300. <div class="row">
  1301. <div class="col-12">
  1302. <div class="day durata--corso d-flex">
  1303. <label for="" class="form-label">Giorno</label>
  1304. <div class="durata--corso_days mb-3">
  1305. <a class="{{in_array('lun', $course_when[$idW]["day"]) ? 'selected' : 'notSelected'}}" wire:click="setDay({{$idW}}, 'lun')">Lun</a>
  1306. <a class="{{in_array('mar', $course_when[$idW]["day"]) ? 'selected' : 'notSelected'}}" wire:click="setDay({{$idW}}, 'mar')">Mar</a>
  1307. <a class="{{in_array('mer', $course_when[$idW]["day"]) ? 'selected' : 'notSelected'}}" wire:click="setDay({{$idW}}, 'mer')">Mer</a>
  1308. <a class="{{in_array('gio', $course_when[$idW]["day"]) ? 'selected' : 'notSelected'}}" wire:click="setDay({{$idW}}, 'gio')">Gio</a>
  1309. <a class="{{in_array('ven', $course_when[$idW]["day"]) ? 'selected' : 'notSelected'}}" wire:click="setDay({{$idW}}, 'ven')">Ven</a>
  1310. <a class="{{in_array('sab', $course_when[$idW]["day"]) ? 'selected' : 'notSelected'}}" wire:click="setDay({{$idW}}, 'sab')">Sab</a>
  1311. <a class="{{in_array('dom', $course_when[$idW]["day"]) ? 'selected' : 'notSelected'}}" wire:click="setDay({{$idW}}, 'dom')">Dom</a>
  1312. </div>
  1313. <div class="durata--corso_select">
  1314. <div class="from--h me-3">
  1315. <label for="" class="form-label">Dalle</label>
  1316. <select class="form-select" wire:model="course_when.{{$idW}}.from">
  1317. <option value="">--Seleziona--
  1318. @for($c=6;$c<=23;$c++)
  1319. <option value="{{str_pad($c, 2, "0", STR_PAD_LEFT)}}:00">{{str_pad($c, 2, "0", STR_PAD_LEFT)}}:00
  1320. <option value="{{str_pad($c, 2, "0", STR_PAD_LEFT)}}:30">{{str_pad($c, 2, "0", STR_PAD_LEFT)}}:30
  1321. @endfor
  1322. </select>
  1323. </div>
  1324. <div class="to--h">
  1325. <label for="" class="form-label">Alle</label>
  1326. <select class="form-select" wire:model="course_when.{{$idW}}.to">
  1327. <option value="">--Seleziona--
  1328. @for($c=6;$c<=23;$c++)
  1329. <option value="{{str_pad($c, 2, "0", STR_PAD_LEFT)}}:00">{{str_pad($c, 2, "0", STR_PAD_LEFT)}}:00
  1330. <option value="{{str_pad($c, 2, "0", STR_PAD_LEFT)}}:30">{{str_pad($c, 2, "0", STR_PAD_LEFT)}}:30
  1331. @endfor
  1332. </select>
  1333. </div>
  1334. </div>
  1335. <button class="btn--ui primary remove--day position-absolute" wire:click.prevent="delRow({{$idW}})"><i class="fa-solid fa-minus"></i></button>
  1336. <button class="btn--ui primary add--day position-absolute" wire:click.prevent="addRow()"><i class="fa-solid fa-plus"></i></button>
  1337. </div>
  1338. </div>
  1339. </div>
  1340. @endforeach
  1341. @endif
  1342. <div class="row mt-2">
  1343. <div class="col-md-12">
  1344. <label for="course_date_from" class="form-label">Note</label>
  1345. <input class="form-control" type="text" id="course_note" placeholder="Note" wire:model="course_note">
  1346. </div>
  1347. </div>
  1348. @endif
  1349. </form>
  1350. </div>
  1351. @if($course_course_id > 0)
  1352. <br>
  1353. <div class="row mt-2">
  1354. <div class="col-md-12">
  1355. <button class="btn--ui lightGrey" wire:click.prevent="cancelCourse()">Annulla</button>
  1356. @if($addCourse)
  1357. @if(!$course_exist)
  1358. <button class="btn--ui primary" wire:click.prevent="storeCourse()">Salva corso</button>
  1359. @endif
  1360. @endif
  1361. @if($updateCourse)
  1362. <button class="btn--ui primary" wire:click.prevent="updateCourse()">Salva corso</button>
  1363. @endif
  1364. </div>
  1365. </div>
  1366. @endif
  1367. @endif
  1368. @endif
  1369. @endif
  1370. </div>
  1371. </div>
  1372. <div class="col-md-5 col-xl-4 p-3">
  1373. <div id="card--resume" class="primary card--ui ms-3 user--resume">
  1374. <header>
  1375. <div class="username d-flex align-items-start">
  1376. {{-- <i class="ico--ui utenti light me-2"></i> --}}
  1377. <div class="user--resume_name d-flex flex-column">
  1378. <span class="user-name">{{ strtoupper($first_name) }} {{ strtoupper($last_name) }}</span>
  1379. @if($dataId > 0)
  1380. <div class="user_name me-4">
  1381. <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>
  1382. </div>
  1383. @endif
  1384. {{-- <span class="user-email">{{ $birth_date ? date("d/m/Y", strtotime($birth_date)) : '' }}{!!$age != '' ? ' (' . $age . ')' : ''!!}</span> --}}
  1385. </div>
  1386. </div>
  1387. </header>
  1388. <div class="card--resume_body">
  1389. <ul class="user-address mb-4 p-0">
  1390. <li><i class="fa-solid fa-phone"></i><span>Tel. {{ $phone }}</span></li>
  1391. <li><i class="fa-solid fa-calendar"></i><span>Nato il {{ $birth_date ? date("d/m/Y", strtotime($birth_date)) : '' }}{!!$age != '' ? ' (' . $age . ')' : ''!!}</span></li>
  1392. <li><i class="fa-solid fa-envelope"></i><span>{{ $email }}</span></li>
  1393. </ul>
  1394. <ul class="user-residence p-0">
  1395. <li>
  1396. <i class="fa-solid fa-building"></i>
  1397. {{-- <i class="ico--ui resume--ico residence me-2"></i> --}}
  1398. <span>
  1399. @if($city_id > 0)
  1400. {{$this->getCity($city_id)}}
  1401. @if($province_id > 0)
  1402. ( {{$this->getProvince($province_id)}} ) -
  1403. @endif
  1404. @endif
  1405. {{ $zip_code }}<br>
  1406. {{ $address }}
  1407. </span>
  1408. </li>
  1409. </ul>
  1410. <div class="resume--tab_info tesseramento">
  1411. <h2 class="mb-3"><i class="fa-solid fa-file-lines"></i><span>Certificato</span></h2>
  1412. @if(sizeof($member_certificates) > 0)
  1413. @php
  1414. $cert = $member_certificates[0]
  1415. @endphp
  1416. @if($cert->expire_date . " 23:59:59" > date("Y-m-d"))
  1417. <div class="resume--wrapper d-flex align-items-start justify-content-between mb-2">
  1418. <div class="resume--info resume-certificato d-flex align-items-start">
  1419. {{-- <i class="fa-regular fa-file-lines me-2"></i> --}}
  1420. <div class="title--tessera_added">
  1421. <h4>{{$cert->type == 'A' ? 'Agonistico' : 'Non agonistico'}}</h4>
  1422. <span class="title-detail">Scadenza: <span class="title-detail_date">{{$cert->expire_date ? date("d/m/Y", strtotime($cert->expire_date)) : ''}}</span></span></small>
  1423. </div>
  1424. </div>
  1425. @if($cert->expire_date . " 23:59:59" < date("Y-m-d"))
  1426. <span class="badge tessera-badge suspended">scaduto</span>
  1427. @endif
  1428. @if($cert->expire_date . " 23:59:59" >= date("Y-m-d") && $cert->expire_date < date("Y-m-d", strtotime("+1 month")))
  1429. <span class="badge tessera-badge due">in scadenza</span>
  1430. @endif
  1431. @if($cert->expire_date . " 23:59:59" >= date("Y-m-d", strtotime("+1 month")))
  1432. <span class="badge tessera-badge active">valido</span>
  1433. @endif
  1434. </div>
  1435. @endif
  1436. @endif
  1437. </div>
  1438. <div class="resume--tab_info tesseramento">
  1439. <h2 class="mb-3"><i class="fa-solid fa-address-card"></i><span>Tesseramento</span></h2>
  1440. @foreach($member_cards as $member_card)
  1441. @if($member_card->expire_date . " 23:59:59" > date("Y-m-d"))
  1442. <div class="resume--wrapper d-flex align-items-start justify-content-between mb-2">
  1443. <div class="resume--info resume-tessera d-flex align-items-start">
  1444. {{-- <i class="ico--ui tessera me-2"></i> --}}
  1445. <div class="title--tessera_added">
  1446. <h4>{{$member_card->card->name}}</h4>
  1447. <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>
  1448. @if($member_card->discipline_1)
  1449. </br>
  1450. <span class="title-detail">Disciplina : <b>{{$member_card->discipline_1->name}}</b></span>
  1451. @endif
  1452. @if($member_card->discipline_2)
  1453. </br>
  1454. <span class="title-detail">Disciplina : <b>{{$member_card->discipline_2->name}}</b></span>
  1455. @endif
  1456. @if($member_card->discipline_3)
  1457. </br>
  1458. <span class="title-detail">Disciplina : <b>{{$member_card->discipline_3->name}}</b></span>
  1459. @endif
  1460. </div>
  1461. </div>
  1462. <span class="badge tessera-badge active">attiva</span>
  1463. </div>
  1464. @endif
  1465. @endforeach
  1466. </div>
  1467. <div class="resume--tab_info gruppi corsi">
  1468. <h2 class="mb-3"><i class="fa-solid fa-chalkboard"></i><span>Corsi</span></h2>
  1469. @foreach($member_courses as $member_course)
  1470. @php
  1471. $course_year = date('Y', strtotime($member_course->date_from));
  1472. $current_year = date('Y');
  1473. $course_month = date('m', strtotime($member_course->date_from));
  1474. $current_month = date('m');
  1475. @endphp
  1476. @if (
  1477. ($course_year == (date('Y') + 1) && $course_month <=8) ||
  1478. ($course_year == date('Y') && $course_month >= 9)
  1479. )
  1480. <div class="resume--info resume-corso d-flex align-items-center">
  1481. <div class="row">
  1482. <div class="row">
  1483. <strong>{{$member_course->course->getTree()}}</strong>
  1484. </div>
  1485. <div class="row">
  1486. <span class="title-detail">
  1487. {{$member_course->course->level->name ?? ""}}<br>
  1488. {{$member_course->course->frequency->name ?? ""}}
  1489. </span>
  1490. </div>
  1491. <div class="row">
  1492. <span class="title-detail">
  1493. @php
  1494. $ok = false;
  1495. @endphp
  1496. @foreach(json_decode($member_course->when) as $xx => $x)
  1497. @if($xx > 0)
  1498. <br>
  1499. @endif
  1500. @foreach($x->day as $zz => $d)
  1501. {{$zz > 0 ? '-' : ''}}{{$d}}
  1502. @endforeach
  1503. @if($x->from != '' && $x->to != '')
  1504. h {{$x->from}} - {{$x->to}}
  1505. @endif
  1506. @php
  1507. $ok = $x->from != '';
  1508. @endphp
  1509. @endforeach
  1510. @if(!$ok && $member_course->course->when != '')
  1511. @foreach(json_decode($member_course->course->when) as $xx => $x)
  1512. @php
  1513. $ok = true;
  1514. @endphp
  1515. @if($xx > 0)
  1516. <br>
  1517. @endif
  1518. @foreach($x->day as $zz => $d)
  1519. {{$zz > 0 ? '-' : ''}}{{$d}}
  1520. @endforeach
  1521. @if($x->from != '')
  1522. h {{$x->from}} - {{$x->to}}
  1523. @endif
  1524. @endforeach
  1525. @endif
  1526. </span>
  1527. </div>
  1528. </div>
  1529. </div>
  1530. @endif
  1531. @endforeach
  1532. </div>
  1533. <div class="resume--tab_info gruppi">
  1534. <h2 class="mb-3"><i class="fa-solid fa-users"></i><span>Gruppi di appartenenza</span></h2>
  1535. <ul>
  1536. @foreach($member_categories as $member_category)
  1537. <li class="resume--info"><span>{{$member_category->category->getTree()}}</span></li>
  1538. @endforeach
  1539. </ul>
  1540. </div>
  1541. <div class="resume--tab_info credito">
  1542. <h2 class="mb-3"><i class="fa-solid fa-wallet"></i><span>Borsellino MAD</span></h2>
  1543. <span class="value">{{formatPrice($money)}}</span>
  1544. </div>
  1545. </div>
  1546. </div>
  1547. </div>
  1548. </div>
  1549. </div>
  1550. <section class="save--section d-flex justify-content-start">
  1551. <div class="container">
  1552. <div class="row">
  1553. <div class="col-md-7 col-xl-8 d-flex gx-0">
  1554. @if($add)
  1555. <button class="btn--ui primary d-flex order-1 me-2" wire:click="store(false)">salva e continua</button>
  1556. <button class="btn--ui primary d-flex order-3 ms-auto" onclick="store(true)">salva e chiudi</button>
  1557. @endif
  1558. @if($update)
  1559. <button class="btn--ui primary d-flex order-1 me-2" wire:click="updateAAA(false)">salva e continua</button>
  1560. <button class="btn--ui primary d-flex order-3 ms-auto" onclick="updateAAA(true)">salva e chiudi</button>
  1561. @endif
  1562. <button class="btn--ui lightGrey" onclick="annulla()" style="margin-right:10px">annulla</button><br><br>
  1563. </div>
  1564. <div class="col-md-5 col-xl-4"></div>
  1565. </div>
  1566. </div>
  1567. </section>
  1568. @endif
  1569. </div>
  1570. @endif
  1571. <div wire:ignore.self class="modal fade" id="userModal" tabindex="-1" aria-labelledby="userModalLabel" aria-hidden="true">
  1572. <div class="modal-dialog">
  1573. <div class="modal-content">
  1574. <div class="modal-header">
  1575. <h5 class="modal-title" id="userModalLabel">Modifica borsellino</h5>
  1576. <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
  1577. </div>
  1578. <div class="modal-body">
  1579. <div class="row">
  1580. <div class="col-md-6">
  1581. <label for="newMemberFirstName" class="form-label">Importo</label>
  1582. <input class="form-control " type="text" id="importoBorsellino" >
  1583. </div>
  1584. </div>
  1585. </div>
  1586. <div class="modal-footer">
  1587. <button type="button" class="btn--ui lightGrey" data-bs-dismiss="modal">Annulla</button>
  1588. <button type="button" class="btn--ui btn-primary" onclick="updateBorsellino('-')">Decrementa</button>
  1589. <button type="button" class="btn--ui btn-primary" onclick="updateBorsellino('+')">Aumenta</button>
  1590. </div>
  1591. </div>
  1592. </div>
  1593. </div>
  1594. </div>
  1595. @push('scripts')
  1596. <link href="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/css/select2.min.css" rel="stylesheet" />
  1597. <style>
  1598. table.tableHead thead
  1599. {
  1600. position: sticky;
  1601. z-index: 100;
  1602. top: 0;
  1603. }
  1604. .select2-container--default .select2-selection--single
  1605. {
  1606. background-color: #E9F0F5;
  1607. border: 0.0625rem solid #DFE5EB;
  1608. font-size: 0.75rem;
  1609. }
  1610. .select2-selection
  1611. {
  1612. height: 38px !important;
  1613. }
  1614. .select2-selection__rendered
  1615. {
  1616. padding-top:3px;
  1617. }
  1618. .select2
  1619. {
  1620. width:100% !important;
  1621. }
  1622. a.notSelected
  1623. {
  1624. display: flex;
  1625. margin-right:10px;
  1626. float:left;
  1627. height: 2.5rem !important;
  1628. width:50px;
  1629. align-items: center;
  1630. justify-content: center;
  1631. color: var(--color-blu);
  1632. background-color: #d3dce1 !important;
  1633. padding: 0 1.25rem;
  1634. font-size: 0.875rem;
  1635. font-family: greycliff-cf, sans-serif;
  1636. border-radius: 1.875rem !important;
  1637. -webkit-border-radius: 1.875rem !important;
  1638. -moz-border-radius: 1.875rem !important;
  1639. -webkit-transition: all 0.3s ease-in-out;
  1640. -moz-transition: all 0.3s ease-in-out;
  1641. -o-transition: all 0.3s ease-in-out;
  1642. transition: all 0.3s ease-in-out;
  1643. border: none;
  1644. }
  1645. a.selected
  1646. {
  1647. display: flex;
  1648. margin-right:10px;
  1649. float:left;
  1650. height: 2.5rem !important;
  1651. width:50px;
  1652. align-items: center;
  1653. justify-content: center;
  1654. color: #fff;
  1655. background-color: var(--color-blu) !important;
  1656. padding: 0 1.25rem;
  1657. font-size: 0.875rem;
  1658. font-family: greycliff-cf, sans-serif;
  1659. border-radius: 1.875rem !important;
  1660. -webkit-border-radius: 1.875rem !important;
  1661. -moz-border-radius: 1.875rem !important;
  1662. -webkit-transition: all 0.3s ease-in-out;
  1663. -moz-transition: all 0.3s ease-in-out;
  1664. -o-transition: all 0.3s ease-in-out;
  1665. transition: all 0.3s ease-in-out;
  1666. border: none;
  1667. }
  1668. div.day
  1669. {
  1670. margin-top:20px;
  1671. color: var(--color-blu);
  1672. background-color: #ffffff !important;
  1673. padding: 20px;
  1674. border-radius: 1.875rem !important;
  1675. -webkit-border-radius: 1.875rem !important;
  1676. -moz-border-radius: 1.875rem !important;
  1677. -webkit-transition: all 0.3s ease-in-out;
  1678. -moz-transition: all 0.3s ease-in-out;
  1679. -o-transition: all 0.3s ease-in-out;
  1680. transition: all 0.3s ease-in-out;
  1681. border: 2px solid #d3dce1;
  1682. }
  1683. .btn--ui.lightGrey, .btn--ui.extraLightGrey
  1684. {
  1685. -webkit-border-radius: 0.5rem !important;
  1686. background-color:#ffffff !important;
  1687. border: 1px solid grey;
  1688. color: black;
  1689. font-weight:normal;
  1690. }
  1691. .persistent-invalid
  1692. {
  1693. border-color: #dc3545 !important;
  1694. padding-right: calc(1.5em + 0.75rem) !important;
  1695. 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;
  1696. background-repeat: no-repeat !important;
  1697. background-position: right calc(0.375em + 0.1875rem) center !important;
  1698. background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem) !important;
  1699. }
  1700. </style>
  1701. <script src="https://code.jquery.com/jquery-2.2.4.min.js" integrity="sha256-BbhdlvQf/xTY9gja0Dq3HiwQF8LaCRTXxZKRutelT44=" crossorigin="anonymous"></script>
  1702. <script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js"></script>
  1703. @endpush
  1704. @push('scripts')
  1705. <script>
  1706. function matchStart(params, data) {
  1707. params.term = params.term || '';
  1708. if (data.text.toUpperCase().indexOf(params.term.toUpperCase()) == 0) {
  1709. return data;
  1710. }
  1711. return false;
  1712. }
  1713. var nation_id = {{$nation_id > 0 ? $nation_id : 0}};
  1714. var province_id = 0;
  1715. var nation_birth_id = 0;
  1716. var province_birth_id = 0;
  1717. Livewire.on('load-select', () => {
  1718. loadCombo();
  1719. });
  1720. function updateBorsellino(verse)
  1721. {
  1722. var importoBorsellino = $("#importoBorsellino").val();
  1723. @this.updateBorsellino(importoBorsellino, verse);
  1724. }
  1725. Livewire.on('load-provinces', (nation_id, element) => {
  1726. $('.' + element).select2({
  1727. ajax: {
  1728. url: '/provinces/' + nation_id,
  1729. dataType: 'json'
  1730. }
  1731. });
  1732. });
  1733. Livewire.on('load-cities', (province_id, element) => {
  1734. $('.' + element).select2({
  1735. ajax: {
  1736. url: '/cities/' + province_id,
  1737. dataType: 'json'
  1738. }
  1739. });
  1740. });
  1741. Livewire.on('hide-search', () => {
  1742. //pcsh2();
  1743. });
  1744. Livewire.on('setIds', (nation_id_x, birth_nation_id_x) => {
  1745. nation_id = nation_id_x;
  1746. nation_birth_id = birth_nation_id_x;
  1747. });
  1748. function loadCombo()
  1749. {
  1750. $('.nationClass').select2({
  1751. ajax: {
  1752. url: '/nations',
  1753. dataType: 'json'
  1754. }
  1755. });
  1756. $('.nationClass').on('change', function (e) {
  1757. nation_id = $('.nationClass').select2("val");
  1758. province_id = 0;
  1759. @this.set('nation_id', nation_id);
  1760. @this.set('province_id', 0);
  1761. @this.set('city_id', 0);
  1762. @this.checkIsItaly();
  1763. });
  1764. $('.provinceClass').select2({
  1765. ajax: {
  1766. url: '/provinces/' + nation_id,
  1767. dataType: 'json'
  1768. }
  1769. });
  1770. $('.provinceClass').on('change', function (e) {
  1771. province_id = $('.provinceClass').select2("val");
  1772. @this.set('province_id', province_id);
  1773. @this.set('city_id', 0);
  1774. });
  1775. $('.cityClass').select2({
  1776. ajax: {
  1777. url: '/cities/' + province_id,
  1778. dataType: 'json'
  1779. }
  1780. });
  1781. $('.cityClass').on('change', function (e) {
  1782. var data = $('.cityClass').select2("val");
  1783. @this.set('city_id', data);
  1784. });
  1785. $('.nationBirthClass').select2({
  1786. ajax: {
  1787. url: '/nations',
  1788. dataType: 'json'
  1789. }
  1790. });
  1791. $('.nationBirthClass').on('change', function (e) {
  1792. nation_birth_id = $('.nationBirthClass').select2("val");
  1793. province_birth_id = 0;
  1794. @this.set('birth_nation_id', nation_birth_id);
  1795. @this.set('birth_province_id', 0);
  1796. @this.set('birth_city_id', 0);
  1797. @this.checkIsBirthItaly();
  1798. });
  1799. $('.provinceBirthClass').select2({
  1800. ajax: {
  1801. url: '/provinces/' + nation_birth_id,
  1802. dataType: 'json'
  1803. }
  1804. });
  1805. $('.provinceBirthClass').on('change', function (e) {
  1806. province_birth_id = $('.provinceBirthClass').select2("val");
  1807. @this.set('birth_province_id', province_birth_id);
  1808. @this.set('birth_city_id', 0);
  1809. });
  1810. $('.cityBirthClass').select2({
  1811. ajax: {
  1812. url: '/cities/' + province_birth_id,
  1813. dataType: 'json'
  1814. }
  1815. });
  1816. $('.cityBirthClass').on('change', function (e) {
  1817. var data = $('.cityBirthClass').select2("val");
  1818. @this.set('birth_city_id', data);
  1819. });
  1820. $('.card_card_id').select2({
  1821. matcher: function(params, data) {
  1822. return matchStart(params, data);
  1823. }
  1824. });
  1825. $('.card_card_id').on('change', function (e) {
  1826. var data = $('.card_card_id').select2("val");
  1827. @this.set('card_card_id', data);
  1828. });
  1829. $('.certificate_type').select2({
  1830. matcher: function(params, data) {
  1831. return matchStart(params, data);
  1832. }
  1833. });
  1834. $('.certificate_type').on('change', function (e) {
  1835. var data = $('.certificate_type').select2("val");
  1836. @this.set('certificate_type', data);
  1837. });
  1838. $('.categoriesClass').select2({
  1839. matcher: function(params, data) {
  1840. return matchStart(params, data);
  1841. }
  1842. });
  1843. $('.categoriesClass').on('change', function (e) {
  1844. var data = $('.categoriesClass').select2("val");
  1845. @this.set('category_category_id', data);
  1846. });
  1847. $('.coursesClass').select2({
  1848. matcher: function(params, data) {
  1849. return matchStart(params, data);
  1850. }
  1851. });
  1852. $('.coursesClass').on('change', function (e) {
  1853. var data = $('.coursesClass').select2("val");
  1854. @this.set('course_course_id', data);
  1855. });
  1856. }
  1857. @if($refreshAfter == 1)
  1858. setTimeout(() => {
  1859. loadCombo();
  1860. }, 100)
  1861. @endif
  1862. function onlyNumberAmount(input) {
  1863. let v = input.value.replace(/\D+/g, '');
  1864. if (v.length > 14) v = v.slice(0, 14);
  1865. input.value = "€ " + v.replace(/(\d)(\d\d)$/, "$1,$2").replace(/(^\d{1,3}|\d{3})(?=(?:\d{3})+(?:,|$))/g, '$1.');
  1866. }
  1867. </script>
  1868. @endpush
  1869. @push('scripts')
  1870. <link href="/css/datatables.css" rel="stylesheet" />
  1871. <script src="/assets/js/datatables.js"></script>
  1872. <script src="https://cdn.datatables.net/buttons/3.0.2/js/buttons.dataTables.js"></script>
  1873. <script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.10.1/jszip.min.js"></script>
  1874. <script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.2.7/pdfmake.min.js"></script>
  1875. <script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.2.7/vfs_fonts.js"></script>
  1876. @endpush
  1877. @push('scripts')
  1878. <script>
  1879. window.addEventListener("scroll-to-top", (e) => {
  1880. let container = document.getElementById("card--dashboard");
  1881. if (container) {
  1882. container.scrollTo(0,0);
  1883. }
  1884. });
  1885. function showData(id)
  1886. {
  1887. @this.showDetailF(id);
  1888. }
  1889. function editData(id) {
  1890. if ($('#tablesaw-350').length && $.fn.DataTable.isDataTable('#tablesaw-350')) {
  1891. const dataTable = $('#tablesaw-350').DataTable();
  1892. const pageLength = dataTable.page.len();
  1893. const currentPage = dataTable.page.info().page;
  1894. const order = dataTable.order();
  1895. if (order && order.length > 0) {
  1896. localStorage.setItem('dtOrderColumn', order[0][0]);
  1897. localStorage.setItem('dtOrderDir', order[0][1]);
  1898. }
  1899. }
  1900. window.scrollTo({
  1901. top: 0,
  1902. behavior: 'smooth'
  1903. });
  1904. @this.edit(id);
  1905. }
  1906. function deleteData(id)
  1907. {
  1908. if (confirm('Sei sicuro?'))
  1909. @this.delete(id);
  1910. }
  1911. function archiveData(id)
  1912. {
  1913. if (confirm('Sei sicuro? Tutti i dati relativi a questo utente verranno archiviati e non saranno più visibili.'))
  1914. @this.archive(id);
  1915. }
  1916. var isFilter = false;
  1917. $(document).ready(function() {
  1918. $(document).on("click",".showHideFilter",function() {
  1919. if (isFilter)
  1920. {
  1921. isFilter = false;
  1922. $(".showFilter").hide();
  1923. }
  1924. else
  1925. {
  1926. isFilter = true;
  1927. $(".showFilter").show();
  1928. }
  1929. });
  1930. } );
  1931. $(document).ready(function() {
  1932. loadDataTable();
  1933. } );
  1934. Livewire.on('load-data-table', () => {
  1935. setTimeout(function() {loadDataTable()}, 100);
  1936. });
  1937. Livewire.on('destroy-data-table', () => {
  1938. $('#tablesaw-350').DataTable().destroy();
  1939. });
  1940. function destroyDataTable()
  1941. {
  1942. $('#tablesaw-350').DataTable().destroy();
  1943. }
  1944. $('.filterCards').select2({"language": {"noResults": function(){return "Nessun risultato";}}});
  1945. $('.filterStatus').select2({"language": {"noResults": function(){return "Nessun risultato";}}});
  1946. $('.filterScadenza').select2({"language": {"noResults": function(){return "Nessun risultato";}}});
  1947. $('.filterCertificateType').select2({"language": {"noResults": function(){return "Nessun risultato";}}});
  1948. $('.filterCategories').select2({"language": {"noResults": function(){return "Nessun risultato";}}});
  1949. @if(isset($_GET["showFilters"]))
  1950. var filterStatus = localStorage.getItem("filterStatusMember");
  1951. if (filterStatus)
  1952. {
  1953. $('.filterStatus').val(filterStatus).trigger('change');
  1954. }
  1955. var filterCards = localStorage.getItem("filterCardsMember");
  1956. if (filterCards)
  1957. {
  1958. $('.filterCards').val(filterCards).trigger('change');
  1959. }
  1960. var filterScadenza = localStorage.getItem("filterScadenzaMember");
  1961. if (filterScadenza)
  1962. {
  1963. $('.filterScadenza').val(filterScadenza).trigger('change');
  1964. }
  1965. var filterCertificateType = localStorage.getItem("filterCertificateTypeMember");
  1966. if (filterCertificateType)
  1967. {
  1968. $('.filterCertificateType').val(filterCertificateType).trigger('change');
  1969. }
  1970. var filterCategories = localStorage.getItem("filterCategoriesMember");
  1971. if (filterCategories)
  1972. {
  1973. $('.filterCategories').val(filterCategories).trigger('change');
  1974. }
  1975. var fromYear = localStorage.getItem("fromYearMember");
  1976. if (fromYear)
  1977. {
  1978. $('input[name="txtFromYear"]').val(fromYear);
  1979. }
  1980. var toYear = localStorage.getItem("toYearMember");
  1981. if (toYear)
  1982. {
  1983. $('input[name="txtToYear"]').val(toYear);
  1984. }
  1985. var fromYearYear = localStorage.getItem("fromYearYearMember");
  1986. if (fromYearYear)
  1987. {
  1988. $('input[name="txtFromYearYear"]').val(fromYearYear);
  1989. }
  1990. var toYearYear = localStorage.getItem("toYearYearMember");
  1991. if (toYearYear)
  1992. {
  1993. $('input[name="txtToYearYear"]').val(toYearYear);
  1994. }
  1995. @endif
  1996. $(document).on("keypress", $('.filterCategories'), function (e) {
  1997. setTimeout(() => {
  1998. $(".select2-results__option").each(function(){
  1999. var txt = $(this).html();
  2000. var count = (txt.match(/-/g) || []).length;
  2001. $(this).addClass('paddingLeftSelect' + count);
  2002. });
  2003. }, 100);
  2004. });
  2005. $('.filterCategories').on('select2:open', function (e) {
  2006. setTimeout(() => {
  2007. $(".select2-results__option").each(function(){
  2008. var txt = $(this).html();
  2009. var count = (txt.match(/-/g) || []).length;
  2010. $(this).addClass('paddingLeftSelect' + count);
  2011. });
  2012. }, 100);
  2013. });
  2014. function reset()
  2015. {
  2016. $('.filterCards').val('').trigger('change');
  2017. $('.filterStatus').val('').trigger('change');
  2018. $('.filterScadenza').val('-1').trigger('change');
  2019. $('.filterCertificateType').val('-1').trigger('change');
  2020. $('.filterCategories').val('-1').trigger('change');
  2021. $('input[name="txtFromYear"]').val('');
  2022. $('input[name="txtToYear"]').val('');
  2023. $('input[name="txtFromYearYear"]').val('');
  2024. $('input[name="txtToYearYear"]').val('');
  2025. loadDataTable();
  2026. }
  2027. function loadDataTable() {
  2028. let date = new Date();
  2029. let date_export = `${date.getFullYear()}${date.getMonth()}${date.getDate()}_`;
  2030. 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();
  2031. localStorage.setItem("filterCardsMember", $('.filterCards').val());
  2032. localStorage.setItem("filterCategoriesMember", $('.filterCategories').val());
  2033. localStorage.setItem("filterCertificateTypeMember", $('.filterCertificateType').val());
  2034. localStorage.setItem("filterScadenzaMember", $('.filterScadenza').val());
  2035. localStorage.setItem("filterStatusMember", $('.filterStatus').val());
  2036. localStorage.setItem("fromYearMember", $('input[name="txtFromYear"]').val());
  2037. localStorage.setItem("toYearMember", $('input[name="txtToYear"]').val());
  2038. localStorage.setItem("fromYearYearMember", $('input[name="txtFromYearYear"]').val());
  2039. localStorage.setItem("toYearYearMember", $('input[name="txtToYearYear"]').val());
  2040. if ($.fn.dataTable.isDataTable('#tablesaw-350')) {
  2041. $('#tablesaw-350').DataTable().destroy();
  2042. }
  2043. const pageLength = 10;
  2044. const dataTable = $('#tablesaw-350').DataTable({
  2045. serverSide: true,
  2046. processing: true,
  2047. ajax: url,
  2048. columns: [
  2049. {
  2050. data: "last_name",
  2051. render: function (data){
  2052. const d = data.split("|");
  2053. var ret = '<a style="cursor:pointer" onclick="showData(' + d[1] + ')">' + d[0] + '</a>';
  2054. return ret;
  2055. }
  2056. },
  2057. {
  2058. data: "first_name",
  2059. render: function (data){
  2060. const d = data.split("|");
  2061. var ret = '<a style="cursor:pointer" onclick="showData(' + d[1] + ')">' + d[0] + '</a>';
  2062. return ret;
  2063. }
  2064. },
  2065. { data: "phone"},
  2066. { data: "age", "type": "num", className:"dt-type-numeric"},
  2067. { data: "year", className:"dt-type-numeric"},
  2068. {
  2069. data: "status",
  2070. render: function (data){
  2071. const d = data.split("|");
  2072. var ret = '<span class="tablesaw-cell-content"><span class="badge tessera-badge ' + d[0] + '">' + d[1] + '</span></span>';
  2073. return ret;
  2074. }
  2075. },
  2076. {
  2077. data: "certificate",
  2078. render: function (data){
  2079. var ret = '';
  2080. if (data != "") {
  2081. const d = data.split("|");
  2082. ret += '<span class="tablesaw-cell-content d-flex align-items-center">';
  2083. if (d[0] == "0") {
  2084. ret += '<i class="ico--ui check suspended me-2"></i>';
  2085. ret += 'Scaduto : ';
  2086. }
  2087. if (d[0] == "1") {
  2088. ret += '<i class="ico--ui check due me-2"></i>';
  2089. ret += 'In scadenza : ';
  2090. }
  2091. if (d[0] == "2") {
  2092. ret += '<i class="ico--ui check active me-2"></i>';
  2093. ret += 'Scadenza : ';
  2094. }
  2095. ret += d[1];
  2096. ret += '</span>';
  2097. }
  2098. if(data == ""){
  2099. ret += '<span class="tablesaw-cell-content d-flex align-items-center">';
  2100. ret += '<i class="ico--ui check absent me-2"></i>';
  2101. ret += 'Non consegnato';
  2102. ret += '</span>';
  2103. }
  2104. return ret;
  2105. }
  2106. },
  2107. {
  2108. data: "action",
  2109. render: function (data){
  2110. 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;';
  2111. 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>';
  2112. return ret;
  2113. }
  2114. },
  2115. ],
  2116. fixedHeader: false,
  2117. thead: {
  2118. 'th': {'background-color': 'blue'}
  2119. },
  2120. layout: {
  2121. topStart : null,
  2122. topEnd : null,
  2123. top1A: {
  2124. // buttons: [
  2125. // {
  2126. // extend: 'collection',
  2127. // text: 'ESPORTA',
  2128. buttons: [
  2129. {
  2130. extend: 'excelHtml5',
  2131. text: '<i class="fa-solid fa-file-excel"></i>',
  2132. action: newexportaction,
  2133. title: date_export + 'Utenti',
  2134. exportOptions: {
  2135. columns: ":not(':last')",
  2136. page: 'all'
  2137. }
  2138. },
  2139. {
  2140. extend: 'pdfHtml5',
  2141. text: '<i class="fa-solid fa-file-pdf"></i>',
  2142. action: newexportaction,
  2143. title: date_export + 'Utenti',
  2144. exportOptions: {
  2145. columns: ":not(':last')"
  2146. },
  2147. customize: function(doc) {
  2148. doc.styles.tableHeader.alignment = 'left';
  2149. }
  2150. },
  2151. {
  2152. extend: 'print',
  2153. action: newexportaction,
  2154. text: '<i class="fa-solid fa-print"></i>',
  2155. title: date_export + 'Utenti',
  2156. exportOptions: {
  2157. columns: ":not(':last')"
  2158. }
  2159. }
  2160. ],
  2161. // dropup: true
  2162. // }
  2163. // ]
  2164. },
  2165. top1B : {
  2166. pageLength: {
  2167. menu: [[10, 25, 50, 100, 100000], [10, 25, 50, 100, "Tutti"]]
  2168. }
  2169. },
  2170. top1C :'search',
  2171. },
  2172. pagingType: 'numbers',
  2173. "language": {
  2174. "url": "/assets/js/Italian.json"
  2175. },
  2176. "fnInitComplete": function (oSettings, json) {
  2177. var html = '&nbsp;<a style="cursor:pointer" class="showHideFilter btn--ui"><i class="fa-solid fa-sliders"></i></a>';
  2178. html += '&nbsp;<a style="cursor:pointer" class="addData btn--ui"><i class="fa-solid fa-plus"></i></a>';
  2179. $(".dt-search").append(html);
  2180. }
  2181. });
  2182. $('#tablesaw-350 thead tr th').addClass('col');
  2183. $('#tablesaw-350 thead tr th').css("background-color", "#f6f8fa");
  2184. $('#tablesaw-350').on('draw.dt', function() {
  2185. $('[data-bs-toggle="popover"]').popover()
  2186. });
  2187. }
  2188. $(document).ready(function() {
  2189. $(document).on("click",".addData",function() {
  2190. $(".title--section_addButton").trigger("click")
  2191. });
  2192. } );
  2193. var isEdit = false;
  2194. var isEditCorso = false;
  2195. Livewire.on('setEdit', (x) =>
  2196. {
  2197. isEdit = x;
  2198. console.log(isEdit);
  2199. });
  2200. Livewire.on('setEditCorso', (x) =>
  2201. {
  2202. isEditCorso = x;
  2203. console.log("Edit corso" + isEditCorso);
  2204. });
  2205. Livewire.on('setErrorMsg', (errors) =>
  2206. {
  2207. function msg(value)
  2208. {
  2209. const myArray = value.split("=");
  2210. if (myArray[1] == '0' || myArray[1] == '')
  2211. $("span").find("[aria-controls='select2-" + myArray[0] + "-container']").css('border', 'solid 3px #dc3545');
  2212. }
  2213. console.log(errors);
  2214. });
  2215. Livewire.on('reload', (x) =>
  2216. {
  2217. location.reload();
  2218. });
  2219. Livewire.on('goToTop', () => {
  2220. @this.set('type', 'dati');
  2221. document.body.scrollTop = document.documentElement.scrollTop = 0;
  2222. });
  2223. function storeAction(type)
  2224. {
  2225. @this.change('dati');
  2226. if (isEditCorso)
  2227. {
  2228. if (confirm('Non hai concluso l\' inserimento/modifica del corso, vuoi comunque procedere?'))
  2229. @this.store(type);
  2230. }
  2231. else
  2232. {
  2233. document.body.scrollTop = document.documentElement.scrollTop = 0;
  2234. }
  2235. }
  2236. function updateAction(type)
  2237. {
  2238. @this.change('dati');
  2239. if (isEditCorso)
  2240. {
  2241. if (confirm('Non hai concluso l\' inserimento/modifica del corso, vuoi comunque procedere?'))
  2242. @this.updateAAA(type);
  2243. }
  2244. else
  2245. {
  2246. @this.updateAAA(type);
  2247. document.body.scrollTop = document.documentElement.scrollTop = 0;
  2248. }
  2249. }
  2250. function cancelAction()
  2251. {
  2252. if (isEditCorso)
  2253. {
  2254. if (confirm('Non hai concluso l\' inserimento/modifica del corso, vuoi comunque procedere?'))
  2255. @this.cancel();
  2256. }
  2257. else
  2258. @this.cancel();
  2259. }
  2260. function annulla()
  2261. {
  2262. window.onbeforeunload = null;
  2263. document.location.href = '/members';
  2264. }
  2265. function store(reload) {
  2266. window.onbeforeunload = null;
  2267. @this.store(reload)
  2268. }
  2269. function updateAAA(reload) {
  2270. window.onbeforeunload = null;
  2271. @this.updateAAA(reload)
  2272. }
  2273. window.onbeforeunload = function(){
  2274. if (isEdit)
  2275. return 'Cambiando pagina le eventuali modifiche andranno perse';
  2276. if (isEditCorso)
  2277. return 'Devi prima salvare i dati del corso';
  2278. };
  2279. window.livewire.on('saved', () => {
  2280. $('#userModal').modal('hide');
  2281. });
  2282. Livewire.on('goToAnchor', () =>
  2283. {
  2284. window.location.href = "#top";
  2285. });
  2286. $(function() {
  2287. if (window.history && window.history.pushState) {
  2288. window.history.pushState('', null, './');
  2289. $(window).on('popstate', function() {
  2290. document.location.href = '/members';
  2291. });
  2292. }
  2293. });
  2294. function setupBackButtonHandlers() {
  2295. const backButtons = document.querySelectorAll('a.btn--ui.lightGrey[href^="/"]');
  2296. backButtons.forEach(button => {
  2297. button.addEventListener('click', function(e) {
  2298. });
  2299. });
  2300. }
  2301. $(document).ready(function() {
  2302. setupBackButtonHandlers();
  2303. });
  2304. document.addEventListener('livewire:load', () => {
  2305. Livewire.on('focus-error-field', (fieldId) => {
  2306. console.log('Validation errors received:', fieldId);
  2307. let element;
  2308. if (typeof fieldId === 'string') {
  2309. element = document.getElementById(fieldId);
  2310. } else if (Array.isArray(fieldId) && fieldId.length > 0) {
  2311. const firstFieldId = fieldId[0];
  2312. element = document.getElementById(firstFieldId);
  2313. fieldId = firstFieldId; // Use the first fieldId for highlighting
  2314. }
  2315. if (element) {
  2316. element.focus();
  2317. element.scrollIntoView({
  2318. behavior: 'smooth',
  2319. block: 'center'
  2320. });
  2321. element.classList.add('is-invalid');
  2322. const label = document.querySelector(`label[for="${fieldId}"]`);
  2323. if (label) {
  2324. label.classList.add('text-danger');
  2325. }
  2326. const preserveInvalidClass = () => {
  2327. if (!element.classList.contains('is-invalid')) {
  2328. element.classList.add('is-invalid');
  2329. }
  2330. };
  2331. const intervalId = setInterval(preserveInvalidClass, 100);
  2332. // Stop preserving after user interaction
  2333. element.addEventListener('input', () => {
  2334. clearInterval(intervalId);
  2335. });
  2336. } else {
  2337. console.warn('Element with id ' + fieldId + ' not found');
  2338. }
  2339. });
  2340. });
  2341. </script>
  2342. @endpush