records.blade.php 76 KB

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