records.blade.php 79 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045
  1. <div class="col card--ui" id="card--dashboard">
  2. <header id="title--section" style="display:none !important" class="d-flex align-items-center justify-content-between">
  3. <div class="title--section_name d-flex align-items-center justify-content-between">
  4. <i class="ico--ui title_section utenti me-2"></i>
  5. <h2 class="primary">Prima nota</h2>
  6. </div>
  7. </header>
  8. <section id="subheader" class="">
  9. <div class="row g-3">
  10. <div class="col-md-3">
  11. Utente
  12. <select name="search_member_id" class="form-select filterMember" wire:model="filterMember">
  13. <option value="">--Seleziona--
  14. @foreach($members as $member)
  15. <option value="{{$member->id}}">{{$member->last_name}} {{$member->first_name}}
  16. @endforeach
  17. </select>
  18. </div>
  19. <div class="col-md-3">
  20. Causale
  21. <select name="search_causal_id[]" class="form-select filterCausals me-2" multiple="multiple" wire:model="filterCausals">
  22. @foreach($causals as $causal)
  23. <option value="{{$causal["id"]}}">{!!$causal["name"]!!}
  24. @endforeach
  25. </select>
  26. </div>
  27. <div class="col-md-3">
  28. Periodo
  29. <div class="col-12 mb-3">
  30. <select wire:model="selectedPeriod" class="form-select" @if($isFiltering) disabled @endif style="height: 43px!important;">
  31. <option value="OGGI">Oggi</option>
  32. <option value="IERI">Ieri</option>
  33. <option value="GIORNO_PERSONALIZZATO">Giorno Personalizzato</option>
  34. <option value="MESE CORRENTE">Mese Corrente</option>
  35. <option value="MESE PRECEDENTE">Mese Precedente</option>
  36. <option value="MESE_PERSONALIZZATO">Mese Personalizzato</option>
  37. <option value="ULTIMO TRIMESTRE">Ultimo Trimestre</option>
  38. <option value="ULTIMO QUADRIMESTRE">Ultimo Quadrimestre</option>
  39. </select>
  40. </div>
  41. @if($selectedPeriod === 'GIORNO_PERSONALIZZATO')
  42. <div class="col-12 mb-2" wire:transition>
  43. <div class="day-picker-container position-relative">
  44. <div class="input-group">
  45. <input type="date"
  46. wire:model="selectedDay"
  47. class="form-control"
  48. style="height: 43px!important;"
  49. @if($isFiltering) disabled @endif>
  50. </div>
  51. @if($showDayPicker)
  52. <div class="day-picker-dropdown position-absolute bg-white border rounded shadow-lg p-3 mt-1"
  53. style="z-index: 1060; width: 100%; max-width: 350px;">
  54. <div class="d-flex justify-content-between align-items-center mb-3">
  55. <h6 class="mb-0 text-primary">
  56. <i class="fa-regular fa-calendar me-2"></i>
  57. Seleziona Giorno
  58. </h6>
  59. <button type="button"
  60. class="btn-close btn-sm"
  61. wire:click="toggleDayPicker"></button>
  62. </div>
  63. <div class="row g-2 mb-3">
  64. <div class="col-6">
  65. <button type="button"
  66. class="btn btn-sm btn-outline-primary w-100"
  67. wire:click="selectToday">
  68. <i class="fas fa-calendar-day me-1"></i>
  69. Oggi
  70. </button>
  71. </div>
  72. <div class="col-6">
  73. <button type="button"
  74. class="btn btn-sm btn-outline-secondary w-100"
  75. wire:click="selectYesterday">
  76. <i class="fas fa-step-backward me-1"></i>
  77. Ieri
  78. </button>
  79. </div>
  80. </div>
  81. <div class="mb-3">
  82. <label class="form-label small">Anno</label>
  83. <select wire:model="selectedYear" class="form-select form-select-sm">
  84. @php
  85. $currentYear = date('Y');
  86. $selectedDayYear = $selectedDay ? substr($selectedDay, 0, 4) : $currentYear;
  87. @endphp
  88. @for($year = $currentYear - 3; $year <= $currentYear + 1; $year++)
  89. <option value="{{ $year }}" {{ $year == $selectedDayYear ? 'selected' : '' }}>
  90. {{ $year }}
  91. </option>
  92. @endfor
  93. </select>
  94. </div>
  95. <div class="mb-3">
  96. <label class="form-label small">Mese</label>
  97. <div class="row g-1">
  98. @php
  99. $months = [
  100. '01' => 'Gen', '02' => 'Feb', '03' => 'Mar', '04' => 'Apr',
  101. '05' => 'Mag', '06' => 'Giu', '07' => 'Lug', '08' => 'Ago',
  102. '09' => 'Set', '10' => 'Ott', '11' => 'Nov', '12' => 'Dic'
  103. ];
  104. $currentMonth = $selectedDay ? substr($selectedDay, 5, 2) : date('m');
  105. $currentYear = $selectedDay ? substr($selectedDay, 0, 4) : date('Y');
  106. @endphp
  107. @foreach($months as $monthNum => $monthName)
  108. <div class="col-3">
  109. <button type="button"
  110. class="btn btn-sm w-100 month-selector {{ $monthNum === $currentMonth ? 'btn-primary' : 'btn-outline-secondary' }}"
  111. data-month="{{ $monthNum }}">
  112. {{ $monthName }}
  113. </button>
  114. </div>
  115. @endforeach
  116. </div>
  117. </div>
  118. <div class="mb-3">
  119. <label class="form-label small">Giorno</label>
  120. <div class="day-grid" id="dayGrid">
  121. </div>
  122. </div>
  123. <div class="row g-2">
  124. <div class="col-6">
  125. <button type="button"
  126. class="btn btn-sm btn-success w-100"
  127. id="confirmDaySelection">
  128. <i class="fas fa-check me-1"></i>
  129. Conferma
  130. </button>
  131. </div>
  132. <div class="col-6">
  133. <button type="button"
  134. class="btn btn-sm btn-outline-secondary w-100"
  135. wire:click="toggleDayPicker">
  136. <i class="fas fa-times me-1"></i>
  137. Annulla
  138. </button>
  139. </div>
  140. </div>
  141. </div>
  142. @endif
  143. </div>
  144. </div>
  145. @if($selectedDay && $selectedPeriod === 'GIORNO_PERSONALIZZATO')
  146. <div class="col-12 mb-2">
  147. <div class="alert alert-info py-2 px-3 mb-0" style="font-size: 0.875rem;">
  148. <i class="fas fa-info-circle me-1"></i>
  149. <strong>Giorno selezionato:</strong><br>
  150. {{ \Carbon\Carbon::createFromFormat('Y-m-d', $selectedDay)->locale('it')->isoFormat('dddd, D MMMM YYYY') }}
  151. </div>
  152. </div>
  153. @endif
  154. @endif
  155. @if($selectedPeriod === 'MESE_PERSONALIZZATO')
  156. <div class="col-12 mb-2" wire:transition>
  157. <div class="month-picker-container position-relative">
  158. <div class="input-group">
  159. <input type="month"
  160. wire:model="selectedMonth"
  161. class="form-control"
  162. style="height: 43px!important;"
  163. @if($isFiltering) disabled @endif>
  164. </div>
  165. @if($showMonthPicker)
  166. <div class="month-picker-dropdown position-absolute bg-white border rounded shadow-lg p-3 mt-1"
  167. style="z-index: 1060; width: 100%; max-width: 300px;">
  168. <div class="d-flex justify-content-between align-items-center mb-3">
  169. <h6 class="mb-0 text-primary">
  170. <i class="fa-regular fa-calendar me-2"></i>
  171. Seleziona Mese
  172. </h6>
  173. <button type="button"
  174. class="btn-close btn-sm"
  175. wire:click="toggleMonthPicker"></button>
  176. </div>
  177. <div class="mb-3">
  178. <label class="form-label small">Anno</label>
  179. <select wire:model="selectedYear" class="form-select form-select-sm">
  180. @php
  181. $currentYear = date('Y');
  182. $selectedYear = $selectedMonth ? substr($selectedMonth, 0, 4) : $currentYear;
  183. @endphp
  184. @for($year = $currentYear - 3; $year <= $currentYear + 1; $year++)
  185. <option value="{{ $year }}" {{ $year == $selectedYear ? 'selected' : '' }}>
  186. {{ $year }}
  187. </option>
  188. @endfor
  189. </select>
  190. </div>
  191. <div class="row g-1 mb-3">
  192. @php
  193. $months = [
  194. '01' => 'Gen', '02' => 'Feb', '03' => 'Mar', '04' => 'Apr',
  195. '05' => 'Mag', '06' => 'Giu', '07' => 'Lug', '08' => 'Ago',
  196. '09' => 'Set', '10' => 'Ott', '11' => 'Nov', '12' => 'Dic'
  197. ];
  198. $currentMonth = $selectedMonth ?: date('Y-m');
  199. @endphp
  200. @foreach($months as $monthNum => $monthName)
  201. <div class="col-3">
  202. <button type="button"
  203. class="btn btn-sm w-100 {{ ($selectedYear . '-' . $monthNum) === $currentMonth ? 'btn-primary' : 'btn-outline-secondary' }}"
  204. wire:click="selectMonth('{{ $selectedYear }}-{{ $monthNum }}')">
  205. {{ $monthName }}
  206. </button>
  207. </div>
  208. @endforeach
  209. </div>
  210. <div class="row g-1">
  211. <div class="col-6">
  212. <button type="button"
  213. class="btn btn-sm btn-outline-primary w-100"
  214. wire:click="selectMonth('{{ date('Y-m') }}')">
  215. <i class="fas fa-calendar-day me-1"></i>
  216. Questo Mese
  217. </button>
  218. </div>
  219. <div class="col-6">
  220. <button type="button"
  221. class="btn btn-sm btn-outline-secondary w-100"
  222. wire:click="selectMonth('{{ date('Y-m', strtotime('-1 month')) }}')">
  223. <i class="fas fa-step-backward me-1"></i>
  224. Mese Scorso
  225. </button>
  226. </div>
  227. </div>
  228. </div>
  229. @endif
  230. </div>
  231. </div>
  232. @if($selectedMonth && $selectedPeriod === 'MESE_PERSONALIZZATO')
  233. <div class="col-12 mb-2">
  234. <div class="alert alert-info py-2 px-3 mb-0" style="font-size: 0.875rem;">
  235. <i class="fas fa-info-circle me-1"></i>
  236. <strong>Periodo selezionato:</strong><br>
  237. {{ \Carbon\Carbon::createFromFormat('Y-m', $selectedMonth)->locale('it')->isoFormat('MMMM YYYY') }}
  238. </div>
  239. </div>
  240. @endif
  241. @endif
  242. </div>
  243. </div>
  244. <div class="row g-3">
  245. <div class="col-md-3">
  246. Metodo di pagamento
  247. <select name="search_payment_method[]" class="form-select filterPaymentMethods me-2" multiple="multiple" wire:model="filterPaymentMethods">
  248. @foreach($payments as $payment)
  249. <option value="{{$payment["id"]}}">{!!$payment["name"]!!}
  250. @endforeach
  251. </select>
  252. </div>
  253. <div class="col-md-3">
  254. Origine
  255. <select name="search_origin[]" class="form-select filterOrigins me-2" multiple="multiple" wire:model="filterOrigins">
  256. @foreach($origins as $origin)
  257. <option value="{{$origin["id"]}}">{!!$origin["name"]!!}
  258. @endforeach
  259. </select>
  260. </div>
  261. <div class="col-md-3">
  262. Destinazione
  263. <select name="search_destination[]" class="form-select filterDestinations me-2" multiple="multiple" wire:model="filterDestinations">
  264. @foreach($destinations as $destination)
  265. <option value="{{$destination["id"]}}">{!!$destination["name"]!!}
  266. @endforeach
  267. </select>
  268. </div>
  269. <div class="col">
  270. <div class="prima--nota_buttons ms-auto" style="float:right; margin-top:25px;">
  271. <button class="btn--ui primary" wire:click="applyFilters" style="margin-right:5px;" @if($isFiltering) disabled @endif>
  272. @if($isFiltering)
  273. <i class="fas fa-spinner fa-spin"></i> CARICAMENTO...
  274. @else
  275. FILTRA
  276. @endif
  277. </button>
  278. <button class="btn--ui lightGrey reset reset" style="margin-left:5px;color:#10172A;" wire:click="resetFilters" @if($isFiltering) disabled @endif>RESET</button>
  279. </div>
  280. </div>
  281. </div>
  282. {{-- Custom loader --}}
  283. <div wire:loading>
  284. <div class="custom_loader">
  285. <i class="fas fa-spinner fa-spin"></i>
  286. </div>
  287. </div>
  288. <style>
  289. .custom_loader {
  290. position: fixed;
  291. top: 0;
  292. left: 0;
  293. right: 0;
  294. bottom: 0;
  295. display: flex;
  296. flex-direction: column;
  297. flex-wrap: nowrap;
  298. align-content: center;
  299. justify-content: center;
  300. align-items: center;
  301. padding: 10px;
  302. background: #ffffff80;
  303. z-index: 1000;
  304. }
  305. .custom_loader i {
  306. font-size: 50px;
  307. color: #0c6197;
  308. }
  309. </style>
  310. {{-- END Custom loader --}}
  311. <div style="float:left; margin-top:10px; margin-bottom:10px;">
  312. <div class="dropdown">
  313. <button class="btn--ui_outline light dropdown-toggle" type="button" id="exportDropdown" data-bs-toggle="dropdown" aria-expanded="false"
  314. style="color:#10172A;" @if($isFiltering) disabled @endif>
  315. ESPORTA
  316. </button>
  317. <ul class="dropdown-menu" aria-labelledby="exportDropdown">
  318. <li><a class="dropdown-item" href="#" wire:click="openExportModal">Excel</a></li>
  319. <li><a class="dropdown-item" href="#" id="print">Stampa</a></li>
  320. </ul>
  321. </div>
  322. </div>
  323. </section>
  324. <section id="resume-table" class="scrollTable records-table" style="position: relative;">
  325. @if($isFiltering)
  326. <div class="loading-overlay">
  327. <div class="loading-content">
  328. <i class="fas fa-spinner fa-spin fa-3x"></i>
  329. <p>Caricamento dati in corso...</p>
  330. </div>
  331. </div>
  332. @endif
  333. <table class="table tablesaw tableHead tablesaw-stack" id="tablesaw-350" width="100%">
  334. <thead>
  335. <tr>
  336. <th scope="col">Data</th>
  337. <th scope="col">Tipologia</th>
  338. <th scope="col">Causale</th>
  339. <th scope="col">Nominativo</th>
  340. <th scope="col">Stato</th>
  341. <th scope="col" class="text-end">Entrata</th>
  342. <th scope="col" class="text-end">Uscita</th>
  343. <th scope="col" style="padding-left: 20px;">Origine</th>
  344. <th scope="col">Destinazione</th>
  345. <th scope="col">Metodo di pagamento</th>
  346. </tr>
  347. <tr>
  348. <th scope="col"></th>
  349. <th scope="col"></th>
  350. <th scope="col"></th>
  351. <th scope="col"></th>
  352. <th scope="col"></th>
  353. <th scope="col"></th>
  354. <th scope="col"></th>
  355. <th scope="col"></th>
  356. <th scope="col"></th>
  357. <th scope="col"></th>
  358. </tr>
  359. </thead>
  360. <tbody id="checkall-target">
  361. @php $count = 0; @endphp
  362. @foreach($records as $record)
  363. @if($record->date != '')
  364. <tr>
  365. <td style="background-color: {{$count % 2 == 0 ? 'white' : '#f2f4f7'}}">{{date("d/m/Y", strtotime($record->date))}}</td>
  366. <td style="background-color: {{$count % 2 == 0 ? 'white' : '#f2f4f7'}}">{{$record->commercial ? 'Commerciale' : 'Non commerciale'}}</td>
  367. <td style="background-color: {{$count % 2 == 0 ? 'white' : '#f2f4f7'}}; width: 22%;white-space: pre-line;">{{$record->causal_name}}</td>
  368. <td style="background-color: {{$count % 2 == 0 ? 'white' : '#f2f4f7'}}; width: 22%">{{$record->type == 'IN' ? ($record->member->first_name . " " . $record->member->last_name) : @$record->supplier->name}}</td>
  369. <td style="background-color: {{$count % 2 == 0 ? 'white' : '#f2f4f7'}}">{{$record->deleted ? 'Annullata' : ''}}</td>
  370. <td style="background-color: {{$count % 2 == 0 ? 'white' : '#f2f4f7'}}; text-align: right; color: green">{{$record->type == 'IN' ? formatPrice($record->amount) : ''}}</td>
  371. <td style="background-color: {{$count % 2 == 0 ? 'white' : '#f2f4f7'}}; text-align: right; color: red">{{$record->type == 'OUT' ? formatPrice($record->amount) : ''}}</td>
  372. <td style="background-color: {{$count % 2 == 0 ? 'white' : '#f2f4f7'}}; padding-left: 20px;">{{$record->type == 'OUT' ? $record->origin : ''}}</td>
  373. <td style="background-color: {{$count % 2 == 0 ? 'white' : '#f2f4f7'}}">{{$record->type == 'IN' ? $record->destination : ''}}</td>
  374. <td style="background-color: {{$count % 2 == 0 ? 'white' : '#f2f4f7'}}">{{$record->payment_method->name}}</td>
  375. </tr>
  376. @php $count++; @endphp
  377. @endif
  378. @endforeach
  379. </tbody>
  380. @if($total_in > 0 || $total_out > 0)
  381. <tfoot>
  382. <tr>
  383. <td colspan="5"><b>Totale</b></td>
  384. <td style="text-align:right; color: green; padding: 0; border-color: var(--bs-table-color-state, var(--bs-table-color-type, var(--bs-table-color)))"><b>{{$total_in > 0 ? formatPrice($total_in) : ''}}</b></td>
  385. <td style="text-align:right; color: red; padding: 0; border-color: var(--bs-table-color-state, var(--bs-table-color-type, var(--bs-table-color)))"><b>{{$total_out > 0 ? formatPrice($total_out) : ''}}</b></td>
  386. <td colspan="3"></td>
  387. </tr>
  388. </tfoot>
  389. @endif
  390. </table>
  391. <button type="button" class="btn btn-floating btn-lg" id="btn-back-to-bottom"><i class="fas fa-arrow-down"></i></button>
  392. <button type="button" class="btn btn-floating btn-lg" id="btn-back-to-top"><i class="fas fa-arrow-up"></i></button>
  393. </section>
  394. <div class="modal fade" id="causalsModal" tabindex="-1" aria-labelledby="causalsModalLabel" aria-hidden="true">
  395. <div class="modal-dialog modal-lg">
  396. <div class="modal-content">
  397. <div class="modal-header" style="background-color: #0C6197!important;">
  398. <h5 class="modal-title" id="causalsModalLabel">
  399. <i class="me-2"></i>
  400. Dettaglio Causali
  401. </h5>
  402. <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="CHIUDI"></button>
  403. </div>
  404. <div class="modal-body">
  405. <div class="row">
  406. <div class="col-12">
  407. <div class="d-flex justify-content-between align-items-center mb-3">
  408. <h6 class="mb-0">
  409. <i class="me-2 text-primary"></i>
  410. Causali incluse:
  411. </h6>
  412. </div>
  413. <div class="border rounded" style="max-height: 400px; overflow-y: auto;">
  414. <ul id="causalsList" class="list-group list-group-flush mb-0">
  415. <!-- Causals will be populated here by JavaScript -->
  416. </ul>
  417. </div>
  418. </div>
  419. </div>
  420. </div>
  421. <div class="modal-footer" style="background-color: #FFF!important;">
  422. <button type="button" class="btn--ui lightGrey me-2" data-bs-dismiss="modal">
  423. <i class="fas fa-times me-1"></i>
  424. CHIUDI
  425. </button>
  426. </div>
  427. </div>
  428. </div>
  429. </div>
  430. <div class="modal fade" id="exportModal" tabindex="-1" aria-labelledby="exportModalLabel" aria-hidden="true">
  431. <div class="modal-dialog">
  432. <div class="modal-content">
  433. <div class="modal-header" style="background-color: #0C6197!important;">
  434. <h5 class="modal-title" id="exportModalLabel">Seleziona Periodo per Export</h5>
  435. <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="CHIUDI"></button>
  436. </div>
  437. <div class="modal-body">
  438. <div class="row g-3">
  439. <div class="col-md-6">
  440. <label for="exportFromDate" class="form-label">Data Inizio</label>
  441. <input type="date" class="form-control" id="exportFromDate" wire:model.defer="exportFromDate">
  442. </div>
  443. <div class="col-md-6">
  444. <label for="exportToDate" class="form-label">Data Fine</label>
  445. <input type="date" class="form-control" id="exportToDate" wire:model.defer="exportToDate">
  446. </div>
  447. </div>
  448. <div class="row mt-4">
  449. <div class="col-12">
  450. <div class="form-check export-method-check">
  451. <input class="form-check-input" type="checkbox" id="sendViaEmail" wire:model.defer="sendViaEmail">
  452. <label class="form-check-label" for="sendViaEmail">
  453. <i class="fas fa-envelope me-2"></i>Invia via Email
  454. <small class="d-block text-muted mt-1">L'export verrà elaborato in background e inviato alla tua email</small>
  455. </label>
  456. </div>
  457. </div>
  458. </div>
  459. <div class="row mt-3" style="display: none;" id="emailAddressRow">
  460. <div class="col-12">
  461. <label for="exportEmailAddress" class="form-label">
  462. <i class="fas fa-envelope me-1"></i>Indirizzo Email
  463. </label>
  464. <input type="email" class="form-control" id="exportEmailAddress"
  465. wire:model.defer="exportEmailAddress"
  466. placeholder="inserisci@email.com">
  467. <div class="invalid-feedback" id="emailValidationFeedback">
  468. Inserisci un indirizzo email valido
  469. </div>
  470. <small class="form-text text-muted">
  471. Il file Excel verrà inviato a questo indirizzo
  472. </small>
  473. </div>
  474. </div>
  475. <div class="row mt-3" style="display: none;" id="emailSubjectRow">
  476. <div class="col-12">
  477. <label for="exportEmailSubject" class="form-label">
  478. <i class="fas fa-tag me-1"></i>Oggetto Email
  479. </label>
  480. <input type="text" class="form-control" id="exportEmailSubject"
  481. wire:model.defer="exportEmailSubject"
  482. placeholder="Prima Nota - Export">
  483. <small class="form-text text-muted">
  484. Personalizza l'oggetto dell'email
  485. </small>
  486. </div>
  487. </div>
  488. <div class="row mt-3">
  489. <div class="col-12">
  490. <div class="alert alert-info d-flex align-items-start">
  491. <i class="fas fa-info-circle me-2 mt-1"></i>
  492. <div>
  493. <strong>Informazioni Export:</strong>
  494. <ul class="mb-0 mt-1">
  495. <li>L'export includerà tutti i record nel periodo selezionato</li>
  496. <li>Verranno applicati i filtri attualmente attivi</li>
  497. <li id="emailProcessingInfo" style="display: none;">L'elaborazione avverrà in background, potrai continuare a usare l'applicazione</li>
  498. </ul>
  499. </div>
  500. </div>
  501. </div>
  502. </div>
  503. </div>
  504. <div class="modal-footer" style="background-color: #FFF!important;">
  505. <button type="button" class="btn--ui lightGrey me-2" data-bs-dismiss="modal">ANNULLA</button>
  506. <button type="button" class="btn--ui primary" onclick="handleExportClick()" id="exportButton">
  507. <span id="loadingState" style="display: none;">
  508. <div class="spinner-border spinner-border-sm me-2" role="status">
  509. <span class="visually-hidden">Loading...</span>
  510. </div>
  511. ELABORAZIONE...
  512. </span>
  513. <span id="normalState">
  514. <i class="fas fa-download me-1"></i>
  515. ESPORTA
  516. </span>
  517. </button>
  518. </div>
  519. </div>
  520. </div>
  521. </div>
  522. <div class="toast-container position-fixed top-0 end-0 p-3" style="z-index: 11000;">
  523. <!-- Toasts will be dynamically added here -->
  524. </div>
  525. </div>
  526. @push('scripts')
  527. <script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
  528. @endpush
  529. @push('scripts')
  530. <link href="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/css/select2.min.css" rel="stylesheet" />
  531. <style>
  532. .loading-overlay {
  533. position: absolute;
  534. top: 0;
  535. left: 0;
  536. right: 0;
  537. bottom: 0;
  538. background-color: rgba(255, 255, 255, 0.9);
  539. display: flex;
  540. justify-content: center;
  541. align-items: center;
  542. z-index: 1000;
  543. border-radius: 4px;
  544. }
  545. .loading-content {
  546. text-align: center;
  547. color: #0C6197;
  548. }
  549. .loading-content i {
  550. margin-bottom: 15px;
  551. color: #0C6197;
  552. }
  553. .loading-content p {
  554. margin: 0;
  555. font-size: 16px;
  556. font-weight: 500;
  557. color: #10172A;
  558. }
  559. .modal {
  560. z-index: 9999 !important;
  561. }
  562. .modal-backdrop {
  563. z-index: 9998 !important;
  564. background-color: rgba(0, 0, 0, 0.6) !important;
  565. }
  566. .modal-content {
  567. border-radius: 8px;
  568. border: none;
  569. box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  570. z-index: 10000 !important;
  571. }
  572. .modal-header {
  573. color: white;
  574. border-bottom: none;
  575. border-radius: 8px 8px 0 0;
  576. }
  577. .modal-header .btn-close {
  578. filter: invert(1);
  579. }
  580. .modal-title {
  581. font-weight: 600;
  582. }
  583. .varie-link:hover {
  584. color: #084c6b !important;
  585. text-decoration: underline !important;
  586. }
  587. #btn-back-to-top {
  588. background-color: #0C6197;
  589. color: white;
  590. position: fixed;
  591. display: none;
  592. }
  593. #btn-back-to-bottom {
  594. background-color: #0C6197;
  595. color: white;
  596. position: fixed;
  597. z-index: 9999;
  598. display: none;
  599. }
  600. button[disabled] {
  601. opacity: 0.7;
  602. cursor: not-allowed;
  603. }
  604. .btn--ui .fa-spinner {
  605. margin-right: 5px;
  606. }
  607. .scrollTable {
  608. margin-left: 0px;
  609. margin-right: 0px;
  610. padding: 15px;
  611. overflow-x: auto;
  612. overflow-y: auto;
  613. white-space: nowrap;
  614. border: 1px solid #ddd;
  615. }
  616. ::-webkit-scrollbar-thumb {
  617. background: #0c6197 !important;
  618. border-radius: 10px;
  619. }
  620. table thead {
  621. position: sticky;
  622. z-index: 100;
  623. top: 0;
  624. }
  625. .select2-container--default .select2-selection--single {
  626. background-color: #E9F0F5;
  627. border: 0.0625rem solid #DFE5EB;
  628. font-size: 0.75rem;
  629. height: 38px !important;
  630. }
  631. .select2-selection__rendered {
  632. padding-top: 3px;
  633. }
  634. .select2 {
  635. width: 100% !important;
  636. }
  637. .select2-selection--multiple {
  638. overflow: hidden !important;
  639. height: auto !important;
  640. }
  641. .select2-container {
  642. box-sizing: border-box;
  643. display: inline-block;
  644. margin: 0;
  645. position: relative;
  646. vertical-align: middle;
  647. z-index: 999 !important;
  648. }
  649. .select2-dropdown {
  650. z-index: 999 !important;
  651. }
  652. .select2-container .select2-selection--single {
  653. box-sizing: border-box;
  654. cursor: pointer;
  655. display: block;
  656. height: 38px;
  657. user-select: none;
  658. -webkit-user-select: none;
  659. }
  660. .select2-container .select2-selection--single .select2-selection__rendered {
  661. display: block;
  662. padding-left: 8px;
  663. padding-right: 20px;
  664. overflow: hidden;
  665. text-overflow: ellipsis;
  666. white-space: nowrap;
  667. }
  668. button#exportDropdown.btn--ui_outline.light {
  669. font-weight: normal !important;
  670. }
  671. .btn--ui_outline.light.dropdown-toggle:active,
  672. .btn--ui_outline.light.dropdown-toggle:focus,
  673. .btn--ui_outline.light.dropdown-toggle.show {
  674. background-color: transparent !important;
  675. color: #10172A !important;
  676. box-shadow: none !important;
  677. }
  678. .btn--ui_outline.light.dropdown-toggle:hover {
  679. background-color: transparent !important;
  680. color: #10172A !important;
  681. }
  682. .form-select {
  683. height: 38px !important;
  684. }
  685. .form-control {
  686. height: 43px !important;
  687. }
  688. #exportModal .modal-body {
  689. padding: 1.5rem;
  690. }
  691. #exportModal .form-label {
  692. font-weight: 600;
  693. color: #10172A;
  694. margin-bottom: 0.5rem;
  695. }
  696. #exportModal .text-muted {
  697. font-size: 0.875rem;
  698. }
  699. .btn--ui[disabled] .fa-spinner {
  700. margin-right: 0.5rem;
  701. }
  702. body.modal-open {
  703. overflow: hidden;
  704. }
  705. .modal-dialog {
  706. z-index: 10001 !important;
  707. margin: 1.75rem auto;
  708. }
  709. .list-group-item {
  710. border-left: none;
  711. border-right: none;
  712. border-top: 1px solid #dee2e6;
  713. padding: 12px 15px;
  714. }
  715. .list-group-item:first-child {
  716. border-top: none;
  717. }
  718. .list-group-item:last-child {
  719. border-bottom: none;
  720. }
  721. @media (max-width: 768px) {
  722. .col-md-2, .col-md-3, .col-md-4 {
  723. margin-bottom: 10px;
  724. }
  725. .prima--nota_buttons {
  726. float: none !important;
  727. margin-top: 10px !important;
  728. text-align: center;
  729. }
  730. }
  731. .export-method-check {
  732. padding: 16px 16px 16px 50px;
  733. background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  734. border-radius: 8px;
  735. border: 2px solid #e9ecef;
  736. transition: all 0.3s ease;
  737. cursor: pointer;
  738. position: relative;
  739. }
  740. .export-method-check:hover {
  741. border-color: #0C6197;
  742. background: linear-gradient(135deg, #e8f4f8 0%, #d1ecf1 100%);
  743. }
  744. .export-method-check .form-check-input {
  745. position: absolute;
  746. left: 16px;
  747. top: 50%;
  748. transform: translateY(-50%);
  749. margin: 0;
  750. width: 20px;
  751. height: 20px;
  752. background-color: #fff;
  753. border: 2px solid #dee2e6;
  754. border-radius: 4px;
  755. cursor: pointer;
  756. }
  757. .export-method-check .form-check-input:checked {
  758. background-color: #0C6197;
  759. border-color: #0C6197;
  760. }
  761. .export-method-check .form-check-input:checked ~ .form-check-label {
  762. color: #0C6197;
  763. font-weight: 600;
  764. }
  765. .export-method-check .form-check-label {
  766. font-weight: 500;
  767. color: #495057;
  768. cursor: pointer;
  769. margin-left: 0;
  770. display: block;
  771. }
  772. .form-check-input:focus {
  773. border-color: #0C6197;
  774. outline: 0;
  775. box-shadow: 0 0 0 0.2rem rgba(12, 97, 151, 0.25);
  776. }
  777. #emailAddressRow.show, #emailSubjectRow.show {
  778. display: block !important;
  779. animation: slideDown 0.3s ease-out;
  780. }
  781. @keyframes slideDown {
  782. from {
  783. opacity: 0;
  784. transform: translateY(-10px);
  785. }
  786. to {
  787. opacity: 1;
  788. transform: translateY(0);
  789. }
  790. }
  791. .invalid-feedback {
  792. display: none;
  793. }
  794. .is-invalid ~ .invalid-feedback {
  795. display: block;
  796. }
  797. .alert-info {
  798. background-color: rgba(12, 97, 151, 0.1);
  799. border-color: rgba(12, 97, 151, 0.2);
  800. color: #0C6197;
  801. }
  802. .spinner-border-sm {
  803. width: 1rem;
  804. height: 1rem;
  805. }
  806. .toast {
  807. min-width: 300px;
  808. }
  809. .toast-body {
  810. font-weight: 500;
  811. }
  812. .btn--ui:disabled {
  813. opacity: 0.7;
  814. cursor: not-allowed;
  815. }
  816. .list-group-item {
  817. border-left: none;
  818. border-right: none;
  819. border-top: 1px solid #dee2e6;
  820. padding: 12px 15px;
  821. }
  822. .list-group-item:first-child {
  823. border-top: none;
  824. }
  825. .list-group-item:last-child {
  826. border-bottom: none;
  827. }
  828. .list-group-item.d-flex {
  829. display: flex !important;
  830. justify-content: space-between !important;
  831. align-items: center !important;
  832. }
  833. .list-group-item .badge {
  834. font-size: 0.875rem;
  835. font-weight: 600;
  836. }
  837. .list-group-item:hover {
  838. background-color: rgba(12, 97, 151, 0.05);
  839. transition: background-color 0.2s ease;
  840. }
  841. #causalsModal .modal-body {
  842. padding: 1rem 0;
  843. }
  844. .loading-overlay {
  845. position: absolute;
  846. top: 0;
  847. left: 0;
  848. right: 0;
  849. bottom: 0;
  850. background-color: rgba(255, 255, 255, 0.9);
  851. display: flex;
  852. justify-content: center;
  853. align-items: center;
  854. z-index: 1000;
  855. border-radius: 4px;
  856. }
  857. /* New styles for Custom Day Picker */
  858. .day-picker-container {
  859. position: relative;
  860. }
  861. .day-picker-dropdown {
  862. max-height: 600px;
  863. overflow-y: auto;
  864. border: 1px solid #dee2e6;
  865. background: white;
  866. border-radius: 8px;
  867. box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
  868. z-index: 1060;
  869. animation: slideDown 0.2s ease-out;
  870. transform-origin: top;
  871. }
  872. .day-grid {
  873. display: grid;
  874. grid-template-columns: repeat(7, 1fr);
  875. gap: 2px;
  876. margin-bottom: 1rem;
  877. }
  878. .day-grid .day-header {
  879. text-align: center;
  880. font-weight: bold;
  881. font-size: 0.75rem;
  882. padding: 0.25rem;
  883. background-color: #f8f9fa;
  884. border-radius: 3px;
  885. color: #6c757d;
  886. }
  887. .day-grid .day-button {
  888. padding: 0.375rem 0.25rem;
  889. font-size: 0.75rem;
  890. border: 1px solid #dee2e6;
  891. background: white;
  892. border-radius: 4px;
  893. cursor: pointer;
  894. transition: all 0.15s ease-in-out;
  895. text-align: center;
  896. min-height: 32px;
  897. display: flex;
  898. align-items: center;
  899. justify-content: center;
  900. }
  901. .day-grid .day-button:hover:not(.disabled) {
  902. background-color: #e9ecef;
  903. border-color: #0C6197;
  904. }
  905. .day-grid .day-button.selected {
  906. background-color: #0C6197;
  907. border-color: #0C6197;
  908. color: white;
  909. }
  910. .day-grid .day-button.today {
  911. border-color: #28a745;
  912. font-weight: bold;
  913. }
  914. .day-grid .day-button.disabled {
  915. color: #6c757d;
  916. background-color: #f8f9fa;
  917. cursor: not-allowed;
  918. opacity: 0.5;
  919. }
  920. .day-grid .day-button.other-month {
  921. color: #adb5bd;
  922. background-color: #f8f9fa;
  923. }
  924. .month-selector.btn-primary {
  925. background-color: #0C6197;
  926. border-color: #0C6197;
  927. }
  928. .month-selector.btn-outline-secondary:hover {
  929. background-color: #6c757d;
  930. border-color: #6c757d;
  931. color: white;
  932. }
  933. input[type="date"] {
  934. background-color: #E9F0F5;
  935. border: 0.0625rem solid #DFE5EB;
  936. font-size: 0.75rem;
  937. }
  938. input[type="date"]:focus {
  939. border-color: #0C6197;
  940. box-shadow: 0 0 0 0.2rem rgba(12, 97, 151, 0.25);
  941. }
  942. input[type="date"]::-webkit-calendar-picker-indicator {
  943. cursor: pointer;
  944. opacity: 0.7;
  945. transition: opacity 0.15s ease-in-out;
  946. }
  947. input[type="date"]::-webkit-calendar-picker-indicator:hover {
  948. opacity: 1;
  949. }
  950. @media (max-width: 768px) {
  951. .day-picker-dropdown {
  952. width: 100% !important;
  953. max-width: none !important;
  954. }
  955. .day-grid .day-button {
  956. font-size: 0.7rem;
  957. padding: 0.25rem;
  958. min-height: 28px;
  959. }
  960. }
  961. .month-picker-container {
  962. position: relative;
  963. }
  964. .month-picker-dropdown {
  965. max-height: 500px;
  966. overflow-y: auto;
  967. border: 1px solid #dee2e6;
  968. background: white;
  969. border-radius: 8px;
  970. box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
  971. z-index: 1060;
  972. }
  973. .month-picker-dropdown .btn {
  974. font-size: 0.75rem;
  975. padding: 0.375rem 0.5rem;
  976. border-radius: 4px;
  977. transition: all 0.15s ease-in-out;
  978. }
  979. .month-picker-dropdown .btn-sm {
  980. font-size: 0.875rem;
  981. padding: 0.25rem 0.5rem;
  982. }
  983. .month-picker-dropdown .btn-close {
  984. padding: 0.25rem;
  985. font-size: 0.75rem;
  986. }
  987. .month-picker-dropdown .btn-primary {
  988. background-color: #0C6197;
  989. border-color: #0C6197;
  990. }
  991. .month-picker-dropdown .btn-outline-primary {
  992. color: #0C6197;
  993. border-color: #0C6197;
  994. }
  995. .month-picker-dropdown .btn-outline-primary:hover {
  996. background-color: #0C6197;
  997. border-color: #0C6197;
  998. }
  999. .month-picker-dropdown .btn-outline-secondary:hover {
  1000. background-color: #6c757d;
  1001. border-color: #6c757d;
  1002. }
  1003. input[type="month"] {
  1004. background-color: #E9F0F5;
  1005. border: 0.0625rem solid #DFE5EB;
  1006. font-size: 0.75rem;
  1007. }
  1008. input[type="month"]:focus {
  1009. border-color: #0C6197;
  1010. box-shadow: 0 0 0 0.2rem rgba(12, 97, 151, 0.25);
  1011. }
  1012. input[type="month"]::-webkit-calendar-picker-indicator {
  1013. cursor: pointer;
  1014. opacity: 0.7;
  1015. transition: opacity 0.15s ease-in-out;
  1016. }
  1017. input[type="month"]::-webkit-calendar-picker-indicator:hover {
  1018. opacity: 1;
  1019. }
  1020. .alert-info {
  1021. background-color: rgba(12, 97, 151, 0.1);
  1022. border-color: rgba(12, 97, 151, 0.2);
  1023. color: #0C6197;
  1024. border-radius: 6px;
  1025. }
  1026. .month-picker-dropdown {
  1027. animation: slideDown 0.2s ease-out;
  1028. transform-origin: top;
  1029. }
  1030. @keyframes slideDown {
  1031. from {
  1032. opacity: 0;
  1033. transform: translateY(-10px) scaleY(0.8);
  1034. }
  1035. to {
  1036. opacity: 1;
  1037. transform: translateY(0) scaleY(1);
  1038. }
  1039. }
  1040. @media (max-width: 768px) {
  1041. .month-picker-dropdown {
  1042. width: 100% !important;
  1043. max-width: none !important;
  1044. }
  1045. .month-picker-dropdown .row.g-1 .col-3 {
  1046. flex: 0 0 25%;
  1047. max-width: 25%;
  1048. }
  1049. }
  1050. [wire\:transition] {
  1051. transition: all 0.3s ease-in-out;
  1052. }
  1053. .select2-container {
  1054. z-index: 999 !important;
  1055. }
  1056. .select2-dropdown {
  1057. z-index: 999 !important;
  1058. }
  1059. .month-picker-dropdown {
  1060. z-index: 1060 !important;
  1061. }
  1062. .month-picker-dropdown .btn-group-sm .btn {
  1063. padding: 0.25rem 0.5rem;
  1064. font-size: 0.75rem;
  1065. }
  1066. .month-picker-container .form-label {
  1067. font-weight: 600;
  1068. color: #10172A;
  1069. margin-bottom: 0.5rem;
  1070. }
  1071. .month-picker-container .input-group .btn {
  1072. border-left: 0;
  1073. background-color: #f8f9fa;
  1074. border-color: #DFE5EB;
  1075. color: #6c757d;
  1076. }
  1077. .month-picker-container .input-group .btn:hover {
  1078. background-color: #e9ecef;
  1079. color: #0C6197;
  1080. }
  1081. </style>
  1082. <script src="https://code.jquery.com/jquery-2.2.4.min.js" integrity="sha256-BbhdlvQf/xTY9gja0Dq3HiwQF8LaCRTXxZKRutelT44=" crossorigin="anonymous"></script>
  1083. <script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js"></script>
  1084. <script src="/assets/js/aCollapTable.js"></script>
  1085. @endpush
  1086. @push('scripts')
  1087. <script>
  1088. let selectedDayValue = '';
  1089. let currentDisplayMonth = '';
  1090. let currentDisplayYear = '';
  1091. function initializeDayPicker() {
  1092. const today = new Date();
  1093. const selectedDay = @this.get('selectedDay');
  1094. if (selectedDay) {
  1095. selectedDayValue = selectedDay;
  1096. const selectedDate = new Date(selectedDay);
  1097. currentDisplayMonth = String(selectedDate.getMonth() + 1).padStart(2, '0');
  1098. currentDisplayYear = String(selectedDate.getFullYear());
  1099. } else {
  1100. currentDisplayMonth = String(today.getMonth() + 1).padStart(2, '0');
  1101. currentDisplayYear = String(today.getFullYear());
  1102. }
  1103. updateDayGrid();
  1104. }
  1105. function updateDayGrid() {
  1106. const dayGrid = document.getElementById('dayGrid');
  1107. if (!dayGrid) return;
  1108. const year = parseInt(currentDisplayYear);
  1109. const month = parseInt(currentDisplayMonth);
  1110. const today = new Date();
  1111. const selectedDate = selectedDayValue ? new Date(selectedDayValue) : null;
  1112. dayGrid.innerHTML = '';
  1113. const dayHeaders = ['Dom', 'Lun', 'Mar', 'Mer', 'Gio', 'Ven', 'Sab'];
  1114. dayHeaders.forEach(header => {
  1115. const headerDiv = document.createElement('div');
  1116. headerDiv.className = 'day-header';
  1117. headerDiv.textContent = header;
  1118. dayGrid.appendChild(headerDiv);
  1119. });
  1120. const firstDay = new Date(year, month - 1, 1);
  1121. const lastDay = new Date(year, month, 0);
  1122. const startDate = new Date(firstDay);
  1123. startDate.setDate(startDate.getDate() - firstDay.getDay());
  1124. for (let i = 0; i < 42; i++) {
  1125. const currentDate = new Date(startDate);
  1126. currentDate.setDate(startDate.getDate() + i);
  1127. const dayButton = document.createElement('button');
  1128. dayButton.type = 'button';
  1129. dayButton.className = 'day-button';
  1130. dayButton.textContent = currentDate.getDate();
  1131. const isCurrentMonth = currentDate.getMonth() === month - 1;
  1132. const isToday = currentDate.toDateString() === today.toDateString();
  1133. const isSelected = selectedDate && currentDate.toDateString() === selectedDate.toDateString();
  1134. if (!isCurrentMonth) {
  1135. dayButton.classList.add('other-month');
  1136. }
  1137. if (isToday) {
  1138. dayButton.classList.add('today');
  1139. }
  1140. if (isSelected) {
  1141. dayButton.classList.add('selected');
  1142. }
  1143. const dateString = currentDate.getFullYear() + '-' +
  1144. String(currentDate.getMonth() + 1).padStart(2, '0') + '-' +
  1145. String(currentDate.getDate()).padStart(2, '0');
  1146. dayButton.addEventListener('click', function() {
  1147. document.querySelectorAll('.day-button.selected').forEach(btn => {
  1148. btn.classList.remove('selected');
  1149. });
  1150. this.classList.add('selected');
  1151. selectedDayValue = dateString;
  1152. });
  1153. dayGrid.appendChild(dayButton);
  1154. }
  1155. }
  1156. document.addEventListener('click', function(event) {
  1157. if (event.target.classList.contains('month-selector')) {
  1158. const month = event.target.getAttribute('data-month');
  1159. currentDisplayMonth = month;
  1160. document.querySelectorAll('.month-selector').forEach(btn => {
  1161. btn.classList.remove('btn-primary');
  1162. btn.classList.add('btn-outline-secondary');
  1163. });
  1164. event.target.classList.remove('btn-outline-secondary');
  1165. event.target.classList.add('btn-primary');
  1166. updateDayGrid();
  1167. }
  1168. });
  1169. document.addEventListener('click', function(event) {
  1170. if (event.target.id === 'confirmDaySelection') {
  1171. if (selectedDayValue) {
  1172. @this.call('selectDay', selectedDayValue);
  1173. }
  1174. }
  1175. });
  1176. document.addEventListener('click', function(event) {
  1177. const dayPicker = document.querySelector('.day-picker-dropdown');
  1178. const dayPickerContainer = document.querySelector('.day-picker-container');
  1179. if (dayPicker && dayPickerContainer && !dayPickerContainer.contains(event.target)) {
  1180. @this.set('showDayPicker', false);
  1181. }
  1182. });
  1183. document.addEventListener('livewire:updated', function() {
  1184. const dayPicker = document.querySelector('.day-picker-dropdown');
  1185. if (dayPicker) {
  1186. initializeDayPicker();
  1187. }
  1188. });
  1189. function closeSelect2Dropdowns() {
  1190. $('.filterCausals').each(function() {
  1191. if ($(this).hasClass('select2-hidden-accessible')) {
  1192. $(this).select2('close');
  1193. }
  1194. });
  1195. $('.filterPaymentMethods').each(function() {
  1196. if ($(this).hasClass('select2-hidden-accessible')) {
  1197. $(this).select2('close');
  1198. }
  1199. });
  1200. $('.filterOrigins').each(function() {
  1201. if ($(this).hasClass('select2-hidden-accessible')) {
  1202. $(this).select2('close');
  1203. }
  1204. });
  1205. $('.filterDestinations').each(function() {
  1206. if ($(this).hasClass('select2-hidden-accessible')) {
  1207. $(this).select2('close');
  1208. }
  1209. });
  1210. $('.filterMember').each(function() {
  1211. if ($(this).hasClass('select2-hidden-accessible')) {
  1212. $(this).select2('close');
  1213. }
  1214. });
  1215. }
  1216. function load() {
  1217. $(document).ready(function(){
  1218. $(document).on("keypress", $('.filterCausals'), function (e) {
  1219. setTimeout(() => {
  1220. $(".select2-results__option").each(function(){
  1221. var txt = $(this).html();
  1222. var count = (txt.match(/-/g) || []).length;
  1223. $(this).addClass('paddingLeftSelect' + count);
  1224. });
  1225. }, 100);
  1226. });
  1227. if (!$('.filterCausals').hasClass('select2-hidden-accessible')) {
  1228. $('.filterCausals').select2({
  1229. "language": {"noResults": function(){return "Nessun risultato";}},
  1230. "dropdownParent": $('body'),
  1231. "width": "100%"
  1232. });
  1233. }
  1234. $('.filterCausals').off('change.customHandler').on('change.customHandler', function (e) {
  1235. var data = $('.filterCausals').select2("val");
  1236. @this.set('filterCausals', data);
  1237. });
  1238. $('.filterCausals').off('select2:open.customHandler').on('select2:open.customHandler', function (e) {
  1239. if ($('#causalsModal').hasClass('show')) {
  1240. $('#causalsModal').modal('hide');
  1241. }
  1242. setTimeout(() => {
  1243. $(".select2-results__option").each(function(){
  1244. var txt = $(this).html();
  1245. var count = (txt.match(/-/g) || []).length;
  1246. $(this).addClass('paddingLeftSelect' + count);
  1247. });
  1248. }, 100);
  1249. });
  1250. $(document).on("keypress", $('.filterPaymentMethods'), function (e) {
  1251. setTimeout(() => {
  1252. $(".select2-results__option").each(function(){
  1253. var txt = $(this).html();
  1254. var count = (txt.match(/-/g) || []).length;
  1255. $(this).addClass('paddingLeftSelect' + count);
  1256. });
  1257. }, 100);
  1258. });
  1259. if (!$('.filterPaymentMethods').hasClass('select2-hidden-accessible')) {
  1260. $('.filterPaymentMethods').select2({
  1261. "language": {"noResults": function(){return "Nessun risultato";}},
  1262. "dropdownParent": $('body'),
  1263. "width": "100%"
  1264. });
  1265. }
  1266. $('.filterPaymentMethods').off('change.customHandler').on('change.customHandler', function (e) {
  1267. var data = $('.filterPaymentMethods').select2("val");
  1268. @this.set('filterPaymentMethods', data);
  1269. });
  1270. $('.filterPaymentMethods').off('select2:open.customHandler').on('select2:open.customHandler', function (e) {
  1271. if ($('#causalsModal').hasClass('show')) {
  1272. $('#causalsModal').modal('hide');
  1273. }
  1274. setTimeout(() => {
  1275. $(".select2-results__option").each(function(){
  1276. var txt = $(this).html();
  1277. var count = (txt.match(/-/g) || []).length;
  1278. $(this).addClass('paddingLeftSelect' + count);
  1279. });
  1280. }, 100);
  1281. });
  1282. $(document).on("keypress", $('.filterOrigins'), function (e) {
  1283. setTimeout(() => {
  1284. $(".select2-results__option").each(function(){
  1285. var txt = $(this).html();
  1286. var count = (txt.match(/-/g) || []).length;
  1287. $(this).addClass('paddingLeftSelect' + count);
  1288. });
  1289. }, 100);
  1290. });
  1291. if (!$('.filterOrigins').hasClass('select2-hidden-accessible')) {
  1292. $('.filterOrigins').select2({
  1293. "language": {"noResults": function(){return "Nessun risultato";}},
  1294. "dropdownParent": $('body'),
  1295. "width": "100%"
  1296. });
  1297. }
  1298. $('.filterOrigins').off('change.customHandler').on('change.customHandler', function (e) {
  1299. var data = $('.filterOrigins').select2("val");
  1300. @this.set('filterOrigins', data);
  1301. });
  1302. $('.filterOrigins').off('select2:open.customHandler').on('select2:open.customHandler', function (e) {
  1303. if ($('#causalsModal').hasClass('show')) {
  1304. $('#causalsModal').modal('hide');
  1305. }
  1306. setTimeout(() => {
  1307. $(".select2-results__option").each(function(){
  1308. var txt = $(this).html();
  1309. var count = (txt.match(/-/g) || []).length;
  1310. $(this).addClass('paddingLeftSelect' + count);
  1311. });
  1312. }, 100);
  1313. });
  1314. $(document).on("keypress", $('.filterDestinations'), function (e) {
  1315. setTimeout(() => {
  1316. $(".select2-results__option").each(function(){
  1317. var txt = $(this).html();
  1318. var count = (txt.match(/-/g) || []).length;
  1319. $(this).addClass('paddingLeftSelect' + count);
  1320. });
  1321. }, 100);
  1322. });
  1323. if (!$('.filterDestinations').hasClass('select2-hidden-accessible')) {
  1324. $('.filterDestinations').select2({
  1325. "language": {"noResults": function(){return "Nessun risultato";}},
  1326. "dropdownParent": $('body'),
  1327. "width": "100%"
  1328. });
  1329. }
  1330. $('.filterDestinations').off('change.customHandler').on('change.customHandler', function (e) {
  1331. var data = $('.filterDestinations').select2("val");
  1332. @this.set('filterDestinations', data);
  1333. });
  1334. $('.filterDestinations').off('select2:open.customHandler').on('select2:open.customHandler', function (e) {
  1335. if ($('#causalsModal').hasClass('show')) {
  1336. $('#causalsModal').modal('hide');
  1337. }
  1338. setTimeout(() => {
  1339. $(".select2-results__option").each(function(){
  1340. var txt = $(this).html();
  1341. var count = (txt.match(/-/g) || []).length;
  1342. $(this).addClass('paddingLeftSelect' + count);
  1343. });
  1344. }, 100);
  1345. });
  1346. if (!$('.filterMember').hasClass('select2-hidden-accessible')) {
  1347. $('.filterMember').select2({
  1348. "language": {"noResults": function(){return "Nessun risultato";}},
  1349. "dropdownParent": $('body'),
  1350. "width": "100%"
  1351. });
  1352. }
  1353. $('.filterMember').off('change.customHandler').on('change.customHandler', function (e) {
  1354. var data = $('.filterMember').select2("val");
  1355. @this.set('filterMember', data);
  1356. });
  1357. $('.filterMember').off('select2:open.customHandler').on('select2:open.customHandler', function (e) {
  1358. if ($('#causalsModal').hasClass('show')) {
  1359. $('#causalsModal').modal('hide');
  1360. }
  1361. });
  1362. });
  1363. }
  1364. function printData() {
  1365. var divToPrint = document.getElementById("tablesaw-350");
  1366. newWin = window.open("");
  1367. var htmlToPrint = '' +
  1368. '<style type="text/css">' +
  1369. 'table th, table td {' +
  1370. 'border:1px solid #000;' +
  1371. 'padding:0.5em;' +
  1372. '}' +
  1373. '</style>';
  1374. htmlToPrint += divToPrint.outerHTML;
  1375. newWin.document.write(htmlToPrint);
  1376. newWin.document.close();
  1377. newWin.print();
  1378. newWin.close();
  1379. }
  1380. function scrollFunction() {
  1381. const element = document.getElementById('resume-table');
  1382. const mybuttonBottom = document.getElementById("btn-back-to-bottom");
  1383. const mybutton = document.getElementById("btn-back-to-top");
  1384. if (element.scrollTop > 20) {
  1385. mybutton.style.display = "block";
  1386. mybuttonBottom.style.display = "block";
  1387. } else {
  1388. mybutton.style.display = "none";
  1389. mybuttonBottom.style.display = "none";
  1390. }
  1391. }
  1392. function backToTop() {
  1393. $('#resume-table').scrollTop(0);
  1394. }
  1395. function backToBottom() {
  1396. $('#resume-table').scrollTop($('#resume-table')[0].scrollHeight);
  1397. }
  1398. $(document).ready(function() {
  1399. load();
  1400. document.querySelector("#print").addEventListener("click", function(){
  1401. printData();
  1402. });
  1403. const element = document.getElementById('resume-table');
  1404. element.onscroll = scrollFunction;
  1405. const mybuttonBottom = document.getElementById("btn-back-to-bottom");
  1406. const mybutton = document.getElementById("btn-back-to-top");
  1407. mybutton.addEventListener("click", backToTop);
  1408. mybuttonBottom.addEventListener("click", backToBottom);
  1409. $(document).on('click', '.varie-link', function(e) {
  1410. e.preventDefault();
  1411. e.stopPropagation();
  1412. closeSelect2Dropdowns();
  1413. const causalsData = $(this).data('causals');
  1414. if (causalsData) {
  1415. const causals = causalsData.split('|');
  1416. $('#causalsList').empty();
  1417. causals.forEach(function(causal) {
  1418. if (causal.trim()) {
  1419. if (causal.includes(':::')) {
  1420. const parts = causal.split(':::');
  1421. const causalName = parts[0].trim();
  1422. const amount = parts[1].trim();
  1423. $('#causalsList').append(
  1424. '<li class="list-group-item d-flex justify-content-between align-items-center">' +
  1425. '<div>' +
  1426. '<i class="fas fa-tags me-2" style="color: #0C6197;"></i>' +
  1427. causalName +
  1428. '</div>' +
  1429. '<span class="badge bg-primary rounded-pill" style="background-color: #0C6197 !important;">' +
  1430. amount +
  1431. '</span>' +
  1432. '</li>'
  1433. );
  1434. } else {
  1435. $('#causalsList').append(
  1436. '<li class="list-group-item">' +
  1437. '<i class="fas fa-tags me-2" style="color: #0C6197;"></i>' +
  1438. causal.trim() +
  1439. '</li>'
  1440. );
  1441. }
  1442. }
  1443. });
  1444. $('#causalsModal').modal('show');
  1445. $('#causalsModal').on('shown.bs.modal', function () {
  1446. $(this).find('.btn-close').focus();
  1447. });
  1448. }
  1449. });
  1450. });
  1451. Livewire.on('load-table', () => {
  1452. load();
  1453. });
  1454. Livewire.on('load-select', () => {
  1455. load();
  1456. });
  1457. Livewire.on('filters-reset', () => {
  1458. $('.filterMember').val('').trigger('change');
  1459. $('.filterCausals').val('').trigger('change');
  1460. $('.filterPaymentMethods').val('').trigger('change');
  1461. $('.filterOrigins').val('').trigger('change');
  1462. $('.filterDestinations').val('').trigger('change');
  1463. load();
  1464. });
  1465. Livewire.on('show-export-modal', () => {
  1466. $('#exportModal').modal('show');
  1467. });
  1468. Livewire.on('hide-export-modal', () => {
  1469. $('#exportModal').modal('hide');
  1470. });
  1471. function showToast(type, message, duration = 5000) {
  1472. const toastContainer = document.querySelector('.toast-container');
  1473. if (!toastContainer) {
  1474. console.error('Toast container not found');
  1475. return;
  1476. }
  1477. const toastId = 'toast-' + Date.now();
  1478. const toastColors = {
  1479. success: 'bg-success',
  1480. error: 'bg-danger',
  1481. warning: 'bg-warning',
  1482. info: 'bg-info'
  1483. };
  1484. const toastIcons = {
  1485. success: 'fa-check-circle',
  1486. error: 'fa-exclamation-circle',
  1487. warning: 'fa-exclamation-triangle',
  1488. info: 'fa-info-circle'
  1489. };
  1490. const toast = document.createElement('div');
  1491. toast.id = toastId;
  1492. toast.className = `toast align-items-center text-white ${toastColors[type]} border-0`;
  1493. toast.setAttribute('role', 'alert');
  1494. toast.innerHTML = `
  1495. <div class="d-flex">
  1496. <div class="toast-body">
  1497. <i class="fas ${toastIcons[type]} me-2"></i>
  1498. ${message}
  1499. </div>
  1500. <button type="button" class="btn-close btn-close-white me-2 m-auto" data-bs-dismiss="toast"></button>
  1501. </div>
  1502. `;
  1503. toastContainer.appendChild(toast);
  1504. if (typeof bootstrap !== 'undefined') {
  1505. const bsToast = new bootstrap.Toast(toast, { delay: duration });
  1506. bsToast.show();
  1507. toast.addEventListener('hidden.bs.toast', function() {
  1508. if (toastContainer.contains(toast)) {
  1509. toastContainer.removeChild(toast);
  1510. }
  1511. });
  1512. return bsToast;
  1513. } else {
  1514. toast.style.display = 'block';
  1515. setTimeout(() => {
  1516. if (toastContainer.contains(toast)) {
  1517. toastContainer.removeChild(toast);
  1518. }
  1519. }, duration);
  1520. }
  1521. }
  1522. document.addEventListener('DOMContentLoaded', function() {
  1523. const sendViaEmailCheckbox = document.getElementById('sendViaEmail');
  1524. const emailAddressRow = document.getElementById('emailAddressRow');
  1525. const emailSubjectRow = document.getElementById('emailSubjectRow');
  1526. const emailProcessingInfo = document.getElementById('emailProcessingInfo');
  1527. const exportIcon = document.getElementById('exportIcon');
  1528. const exportButtonText = document.getElementById('exportButtonText');
  1529. const emailInput = document.getElementById('exportEmailAddress');
  1530. function toggleEmailFields() {
  1531. if (sendViaEmailCheckbox && sendViaEmailCheckbox.checked) {
  1532. if (emailAddressRow) {
  1533. emailAddressRow.style.display = 'block';
  1534. emailAddressRow.classList.add('show');
  1535. }
  1536. if (emailSubjectRow) {
  1537. emailSubjectRow.style.display = 'block';
  1538. emailSubjectRow.classList.add('show');
  1539. }
  1540. if (emailProcessingInfo) {
  1541. emailProcessingInfo.style.display = 'list-item';
  1542. }
  1543. if (exportIcon) exportIcon.className = 'fas fa-paper-plane me-1';
  1544. if (exportButtonText) exportButtonText.textContent = 'INVIA EMAIL';
  1545. } else {
  1546. if (emailAddressRow) {
  1547. emailAddressRow.style.display = 'none';
  1548. emailAddressRow.classList.remove('show');
  1549. }
  1550. if (emailSubjectRow) {
  1551. emailSubjectRow.style.display = 'none';
  1552. emailSubjectRow.classList.remove('show');
  1553. }
  1554. if (emailProcessingInfo) {
  1555. emailProcessingInfo.style.display = 'none';
  1556. }
  1557. if (exportIcon) exportIcon.className = 'fas fa-download me-1';
  1558. if (exportButtonText) exportButtonText.textContent = 'ESPORTA';
  1559. }
  1560. }
  1561. function validateEmail(email) {
  1562. const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
  1563. return emailRegex.test(email);
  1564. }
  1565. if (sendViaEmailCheckbox) {
  1566. sendViaEmailCheckbox.addEventListener('change', toggleEmailFields);
  1567. }
  1568. if (emailInput) {
  1569. emailInput.addEventListener('blur', function() {
  1570. if (sendViaEmailCheckbox && sendViaEmailCheckbox.checked && this.value) {
  1571. if (validateEmail(this.value)) {
  1572. this.classList.remove('is-invalid');
  1573. this.classList.add('is-valid');
  1574. } else {
  1575. this.classList.remove('is-valid');
  1576. this.classList.add('is-invalid');
  1577. }
  1578. }
  1579. });
  1580. emailInput.addEventListener('input', function() {
  1581. this.classList.remove('is-invalid', 'is-valid');
  1582. });
  1583. }
  1584. if (typeof $ !== 'undefined') {
  1585. $('#exportModal').on('shown.bs.modal', function() {
  1586. toggleEmailFields();
  1587. });
  1588. }
  1589. });
  1590. document.addEventListener('livewire:load', function () {
  1591. console.log('Livewire loaded, setting up export event listeners');
  1592. Livewire.on('export-email-queued', function() {
  1593. console.log('Export email queued event received');
  1594. showToast('info',
  1595. '<strong>Export avviato!</strong><br>' +
  1596. 'L\'elaborazione è in corso in background. Riceverai l\'email a breve.',
  1597. 8000
  1598. );
  1599. });
  1600. Livewire.on('export-email-sent', function() {
  1601. console.log('Export email sent event received');
  1602. showToast('success',
  1603. '<strong>Email inviata!</strong><br>' +
  1604. 'L\'export è stato completato e inviato alla tua email.',
  1605. 6000
  1606. );
  1607. });
  1608. Livewire.on('export-email-error', function(message) {
  1609. console.log('Export email error event received:', message);
  1610. showToast('error',
  1611. '<strong>Errore nell\'export:</strong><br>' +
  1612. (message || 'Si è verificato un errore durante l\'elaborazione.'),
  1613. 10000
  1614. );
  1615. });
  1616. Livewire.on('show-export-modal', function() {
  1617. console.log('Show export modal event received');
  1618. if (typeof $ !== 'undefined') {
  1619. $('#exportModal').modal('show');
  1620. }
  1621. });
  1622. Livewire.on('hide-export-modal', function() {
  1623. console.log('Hide export modal event received');
  1624. if (typeof $ !== 'undefined') {
  1625. $('#exportModal').modal('hide');
  1626. }
  1627. });
  1628. });
  1629. if (typeof Livewire !== 'undefined') {
  1630. document.addEventListener('livewire:initialized', function () {
  1631. console.log('Livewire initialized, setting up export event listeners');
  1632. Livewire.on('export-email-queued', function() {
  1633. showToast('info',
  1634. '<strong>Export avviato!</strong><br>' +
  1635. 'L\'elaborazione è in corso in background. Riceverai l\'email a breve.',
  1636. 8000
  1637. );
  1638. });
  1639. Livewire.on('export-email-sent', function() {
  1640. showToast('success',
  1641. '<strong>Email inviata!</strong><br>' +
  1642. 'L\'export è stato completato e inviato alla tua email.',
  1643. 6000
  1644. );
  1645. });
  1646. Livewire.on('export-email-error', function(message) {
  1647. showToast('error',
  1648. '<strong>Errore nell\'export:</strong><br>' +
  1649. (message || 'Si è verificato un errore durante l\'elaborazione.'),
  1650. 10000
  1651. );
  1652. });
  1653. Livewire.on('show-export-modal', function() {
  1654. if (typeof $ !== 'undefined') {
  1655. $('#exportModal').modal('show');
  1656. }
  1657. });
  1658. Livewire.on('hide-export-modal', function() {
  1659. if (typeof $ !== 'undefined') {
  1660. $('#exportModal').modal('hide');
  1661. }
  1662. });
  1663. });
  1664. }
  1665. window.addEventListener('load', function() {
  1666. if (typeof showToast === 'function') {
  1667. console.log('showToast function is available globally');
  1668. } else {
  1669. console.error('showToast function is not available globally');
  1670. }
  1671. });
  1672. function handleExportClick() {
  1673. showExportLoading();
  1674. @this.call('exportData');
  1675. //@this.call('exportWithDateRange');
  1676. }
  1677. function showExportLoading() {
  1678. document.getElementById('normalState').style.display = 'none';
  1679. document.getElementById('loadingState').style.display = 'inline-flex';
  1680. document.getElementById('exportButton').disabled = true;
  1681. }
  1682. function hideExportLoading() {
  1683. document.getElementById('normalState').style.display = 'inline-flex';
  1684. document.getElementById('loadingState').style.display = 'none';
  1685. document.getElementById('exportButton').disabled = false;
  1686. }
  1687. Livewire.on('export-complete', function() {
  1688. hideExportLoading();
  1689. });
  1690. Livewire.on('hide-export-modal', function() {
  1691. hideExportLoading();
  1692. });
  1693. function setupSimpleExportListeners() {
  1694. if (typeof Livewire !== 'undefined') {
  1695. Livewire.on('export-email-queued', function() {
  1696. setTimeout(() => {
  1697. hideExportLoading();
  1698. $('#exportModal').modal('hide');
  1699. showToast('success',
  1700. '<i class="fas fa-paper-plane me-2"></i>' +
  1701. '<strong>Export avviato!</strong><br>' +
  1702. 'Riceverai l\'email a breve.',
  1703. 6000
  1704. );
  1705. }, 1500);
  1706. });
  1707. Livewire.on('export-complete', function() {
  1708. hideExportLoading();
  1709. });
  1710. Livewire.on('hide-export-modal', function() {
  1711. hideExportLoading();
  1712. $('#exportModal').modal('hide');
  1713. });
  1714. }
  1715. }
  1716. document.addEventListener('DOMContentLoaded', function() {
  1717. document.addEventListener('click', function(event) {
  1718. const monthPicker = document.querySelector('.month-picker-dropdown');
  1719. const monthPickerContainer = document.querySelector('.month-picker-container');
  1720. if (monthPicker && monthPickerContainer && !monthPickerContainer.contains(event.target)) {
  1721. if (typeof @this !== 'undefined') {
  1722. @this.set('showMonthPicker', false);
  1723. }
  1724. }
  1725. });
  1726. document.addEventListener('keydown', function(event) {
  1727. if (event.key === 'Escape') {
  1728. if (typeof @this !== 'undefined') {
  1729. @this.set('showMonthPicker', false);
  1730. }
  1731. }
  1732. });
  1733. document.addEventListener('click', function(event) {
  1734. const monthPickerDropdown = event.target.closest('.month-picker-dropdown');
  1735. if (monthPickerDropdown) {
  1736. event.stopPropagation();
  1737. }
  1738. });
  1739. });
  1740. function resetFiltersWithMonthPicker() {
  1741. $('.filterMember').val('').trigger('change');
  1742. $('.filterCausals').val('').trigger('change');
  1743. $('.filterPaymentMethods').val('').trigger('change');
  1744. $('.filterOrigins').val('').trigger('change');
  1745. $('.filterDestinations').val('').trigger('change');
  1746. if (typeof @this !== 'undefined') {
  1747. @this.call('resetFilters');
  1748. }
  1749. load();
  1750. }
  1751. if (typeof Livewire !== 'undefined') {
  1752. Livewire.on('filters-applied', function() {
  1753. console.log('Filters applied with month picker');
  1754. });
  1755. Livewire.on('filters-reset', function() {
  1756. console.log('Filters reset including month picker');
  1757. load();
  1758. });
  1759. }
  1760. function initializeMonthPicker() {
  1761. const monthPickerDropdown = document.querySelector('.month-picker-dropdown');
  1762. if (monthPickerDropdown) {
  1763. monthPickerDropdown.style.opacity = '0';
  1764. monthPickerDropdown.style.transform = 'translateY(-10px)';
  1765. setTimeout(() => {
  1766. monthPickerDropdown.style.transition = 'all 0.2s ease-out';
  1767. monthPickerDropdown.style.opacity = '1';
  1768. monthPickerDropdown.style.transform = 'translateY(0)';
  1769. }, 10);
  1770. }
  1771. }
  1772. document.addEventListener('livewire:updated', function() {
  1773. initializeMonthPicker();
  1774. });
  1775. </script>
  1776. @endpush