records.blade.php 79 KB

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