member.blade.php 169 KB

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