member.blade.php 184 KB

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