member.blade.php 167 KB

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