member.blade.php 175 KB

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