member.blade.php 176 KB

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