member.blade.php 176 KB

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