member.blade.php 174 KB

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