| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217 |
- <div class="col card--ui" id="card--dashboard">
- <header id="title--section" style="display:none !important" class="d-flex align-items-center justify-content-between">
- <div class="title--section_name d-flex align-items-center justify-content-between">
- <i class="ico--ui title_section utenti me-2"></i>
- <h2 class="primary">Prima nota</h2>
- </div>
- </header>
- <section id="subheader" class="">
- <div class="row g-3">
- <div class="col-md-3">
- Utente
- <select name="search_member_id" class="form-select filterMember" wire:model="filterMember">
- <option value="">--Seleziona--
- @foreach($members as $member)
- <option value="{{$member->id}}">{{$member->last_name}} {{$member->first_name}}
- @endforeach
- </select>
- </div>
- <div class="col-md-4">
- Causale
- <select name="search_causal_id[]" class="form-select filterCausals me-2" multiple="multiple" wire:model="filterCausals">
- @foreach($causals as $causal)
- <option value="{{$causal["id"]}}">{!!$causal["name"]!!}
- @endforeach
- </select>
- </div>
- <div class="col-md-3">
- Periodo
- <select wire:model="selectedPeriod" class="form-select" @if($isFiltering) disabled @endif style="height: 43px!important;">
- <option value="OGGI">Oggi</option>
- <option value="IERI">Ieri</option>
- <option value="MESE CORRENTE">Mese Corrente</option>
- <option value="MESE PRECEDENTE">Mese Precedente</option>
- <option value="ULTIMO TRIMESTRE">Ultimo Trimestre</option>
- <option value="ULTIMO QUADRIMESTRE">Ultimo Quadrimestre</option>
- </select>
- </div>
- <div class="col-md-2">
- <div class="prima--nota_buttons ms-auto" style="float:right; margin-top:25px;">
- <button class="btn--ui primary" wire:click="applyFilters" style="margin-right:5px;" @if($isFiltering) disabled @endif>
- @if($isFiltering)
- <i class="fas fa-spinner fa-spin"></i> CARICAMENTO...
- @else
- FILTRA
- @endif
- </button>
- <button class="btn--ui lightGrey reset reset" style="margin-left:5px;color:#10172A;" wire:click="resetFilters" @if($isFiltering) disabled @endif>RESET</button>
- </div>
- </div>
- </div>
- <div style="float:left; margin-top:10px; margin-bottom:10px;">
- <div class="dropdown">
- <button class="btn--ui_outline light dropdown-toggle" type="button" id="exportDropdown" data-bs-toggle="dropdown" aria-expanded="false"
- style="color:#10172A;" @if($isFiltering) disabled @endif>
- ESPORTA
- </button>
- <ul class="dropdown-menu" aria-labelledby="exportDropdown">
- <li><a class="dropdown-item" href="#" wire:click="openExportModal">Excel</a></li>
- <li><a class="dropdown-item" href="#" id="print">Stampa</a></li>
- </ul>
- </div>
- </div>
- </section>
- <section id="resume-table" class="scrollTable records-table" style="position: relative;">
- @if($isFiltering)
- <div class="loading-overlay">
- <div class="loading-content">
- <i class="fas fa-spinner fa-spin fa-3x"></i>
- <p>Caricamento dati in corso...</p>
- </div>
- </div>
- @endif
- <table class="table tablesaw tableHead tablesaw-stack" id="tablesaw-350" width="100%">
- <thead>
- <tr>
- <th scope="col">Data</th>
- <th scope="col" style="border-left:3px solid white;">Causale</th>
- <th scope="col" style="border-left:3px solid white;">Dettaglio Causale</th>
- <th scope="col" style="border-left:3px solid white;">Stato</th>
- <th scope="col" style="border-left:3px solid white;">Nominativo</th>
- @foreach($payments as $p)
- <th colspan="2" scope="col" style="text-align:center; border-left:3px solid white;">{{$p->name}}</th>
- @endforeach
- </tr>
- <tr>
- <th scope="col"></th>
- <th scope="col" style="border-left:3px solid white;"></th>
- <th scope="col" style="border-left:3px solid white;"></th>
- <th scope="col" style="border-left:3px solid white;"></th>
- <th scope="col" style="border-left:3px solid white;"></th>
- @foreach($payments as $p)
- @if($p->type == 'ALL')
- <th scope="col" style="text-align:center; border-left:3px solid white;">Entrate</th>
- <th scope="col" style="text-align:center">Uscite</th>
- @elseif($p->type == 'IN')
- <th scope="col" style="text-align:center; border-left:3px solid white;">Entrate</th>
- <th scope="col" style="text-align:center;"></th>
- @elseif($p->type == 'OUT')
- <th style="border-left:3px solid white;"></th>
- <th scope="col" style="text-align:center;">Uscite</th>
- @endif
- @endforeach
- </tr>
- </thead>
- <tbody id="checkall-target">
- @php $count = 0; @endphp
- @foreach($records as $causal => $record)
- <tr>
- @php
- $parts = explode("§", $causal);
- $d = $parts[0] ?? '';
- $c = $parts[1] ?? '';
- $n = $parts[2] ?? '';
- $det = $parts[3] ?? '';
- $del = $parts[4] ?? '';
- $detailParts = explode('|', $det);
- $isMultiple = count($detailParts) > 1;
- $displayDetail = $isMultiple ? 'Varie' : $det;
- @endphp
- <td style="background-color:{{$count % 2 == 0 ? 'white' : '#f2f4f7'}}">{{date("d/m/Y", strtotime($d))}}</td>
- <td style="border-left:3px solid white !important;background-color:{{$count % 2 == 0 ? 'white' : '#f2f4f7'}}">{{$c}}</td>
- <td style="border-left:3px solid white !important;background-color:{{$count % 2 == 0 ? 'white' : '#f2f4f7'}}">
- @if($isMultiple)
- <span class="varie-link" data-causals="{{implode('|', array_slice($detailParts, 1))}}" style="color: #0C6197; cursor: pointer; text-decoration: underline;">
- {{$displayDetail}}
- </span>
- @else
- {{$displayDetail}}
- @endif
- </td>
- <td style="border-left:3px solid white !important;background-color:{{$count % 2 == 0 ? 'white' : '#f2f4f7'}}">
- @if($del == 'DELETED')
- <span style='color:red'>Annullata</span>
- @endif
- </td>
- <td style="border-left:3px solid white !important;background-color:{{$count % 2 == 0 ? 'white' : '#f2f4f7'}}">{{$n}}</td>
- @foreach($payments as $p)
- @if(isset($record[$p->name]))
- <td style="text-align:right; border-left:3px solid white !important;background-color:{{$count % 2 == 0 ? 'white' : '#f2f4f7'}}">
- @if(isset($record[$p->name]["IN"]))
- <span class="tablesaw-cell-content " style="color:green">{{formatPrice($record[$p->name]["IN"])}}</span>
- @endif
- </td>
- <td style="text-align:right;background-color:{{$count % 2 == 0 ? 'white' : '#f2f4f7'}}">
- @if(isset($record[$p->name]["OUT"]))
- <span class="tablesaw-cell-content " style="color:red">{{formatPrice($record[$p->name]["OUT"])}}</span>
- @endif
- </td>
- @else
- <td style="border-left:3px solid white !important;background-color:{{$count % 2 == 0 ? 'white' : '#f2f4f7'}}"></td>
- <td style="background-color:{{$count % 2 == 0 ? 'white' : '#f2f4f7'}}"></td>
- @endif
- @endforeach
- </tr>
- @php $count++; @endphp
- @endforeach
- </tbody>
- <tfoot>
- <tr>
- <td></td>
- <td></td>
- <td></td>
- <td></td>
- <td><b>Totale</b></td>
- @foreach($payments as $p)
- @if(isset($totals[$p->name]))
- @if($p->type == 'ALL')
- <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>
- <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>
- @elseif($p->type == 'IN')
- <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>
- <td style="text-align:right"><span class="tablesaw-cell-content primary" style="color:red; font-size:18px;"><b> </b></span></td>
- @elseif($p->type == 'OUT')
- <td style="text-align:right"><span class="tablesaw-cell-content primary" style="color:green; font-size:18px;"><b> </b></span></td>
- <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>
- @endif
- @else
- @if($p->type == 'ALL')
- <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>
- <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>
- @elseif($p->type == 'IN')
- <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>
- <td style="text-align:center"><span class="tablesaw-cell-content primary" style="color:red; font-size:18px;"><b> </b></span></td>
- @elseif($p->type == 'OUT')
- <td style="text-align:right"><span class="tablesaw-cell-content primary" style="color:green; font-size:18px;"><b> </b></span></td>
- <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>
- @endif
- @endif
- @endforeach
- </tr>
- <tr style="display:none">
- <td></td>
- <td><b>Differenza</b></td>
- @foreach($payments as $p)
- @if(isset($totals[$p->name]))
- @php
- $diff = $totals[$p->name]["IN"] - $totals[$p->name]["OUT"];
- @endphp
- @if($diff < 0)
- <td></td>
- @endif
- <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>
- @if($diff > 0)
- <td></td>
- @endif
- @else
- <td colspan="2" style="text-align:right"><b>{{formatPrice(0)}}</b></td>
- @endif
- @endforeach
- </tr>
- </tfoot>
- </table>
- <button type="button" class="btn btn-floating btn-lg" id="btn-back-to-bottom"><i class="fas fa-arrow-down"></i></button>
- <button type="button" class="btn btn-floating btn-lg" id="btn-back-to-top"><i class="fas fa-arrow-up"></i></button>
- </section>
- <div class="modal fade" id="causalsModal" tabindex="-1" aria-labelledby="causalsModalLabel" aria-hidden="true">
- <div class="modal-dialog modal-lg">
- <div class="modal-content">
- <div class="modal-header" style="background-color: #0C6197!important;">
- <h5 class="modal-title" id="causalsModalLabel">
- <i class="me-2"></i>
- Dettaglio Causali
- </h5>
- <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="CHIUDI"></button>
- </div>
- <div class="modal-body">
- <div class="row">
- <div class="col-12">
- <div class="d-flex justify-content-between align-items-center mb-3">
- <h6 class="mb-0">
- <i class="me-2 text-primary"></i>
- Causali incluse:
- </h6>
- </div>
- <div class="border rounded" style="max-height: 400px; overflow-y: auto;">
- <ul id="causalsList" class="list-group list-group-flush mb-0">
- <!-- Causals will be populated here by JavaScript -->
- </ul>
- </div>
- </div>
- </div>
- </div>
- <div class="modal-footer" style="background-color: #FFF!important;">
- <button type="button" class="btn--ui lightGrey me-2" data-bs-dismiss="modal">
- <i class="fas fa-times me-1"></i>
- CHIUDI
- </button>
- </div>
- </div>
- </div>
- </div>
- <div class="modal fade" id="exportModal" tabindex="-1" aria-labelledby="exportModalLabel" aria-hidden="true">
- <div class="modal-dialog">
- <div class="modal-content">
- <div class="modal-header" style="background-color: #0C6197!important;">
- <h5 class="modal-title" id="exportModalLabel">Seleziona Periodo per Export</h5>
- <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="CHIUDI"></button>
- </div>
- <div class="modal-body">
- <div class="row g-3">
- <div class="col-md-6">
- <label for="exportFromDate" class="form-label">Data Inizio</label>
- <input type="date" class="form-control" id="exportFromDate" wire:model.defer="exportFromDate">
- </div>
- <div class="col-md-6">
- <label for="exportToDate" class="form-label">Data Fine</label>
- <input type="date" class="form-control" id="exportToDate" wire:model.defer="exportToDate">
- </div>
- </div>
- <div class="row mt-4">
- <div class="col-12">
- <div class="form-check export-method-check">
- <input class="form-check-input" type="checkbox" id="sendViaEmail" wire:model.defer="sendViaEmail">
- <label class="form-check-label" for="sendViaEmail">
- <i class="fas fa-envelope me-2"></i>Invia via Email
- <small class="d-block text-muted mt-1">L'export verrà elaborato in background e inviato alla tua email</small>
- </label>
- </div>
- </div>
- </div>
- <div class="row mt-3" style="display: none;" id="emailAddressRow">
- <div class="col-12">
- <label for="exportEmailAddress" class="form-label">
- <i class="fas fa-envelope me-1"></i>Indirizzo Email
- </label>
- <input type="email" class="form-control" id="exportEmailAddress"
- wire:model.defer="exportEmailAddress"
- placeholder="inserisci@email.com">
- <div class="invalid-feedback" id="emailValidationFeedback">
- Inserisci un indirizzo email valido
- </div>
- <small class="form-text text-muted">
- Il file Excel verrà inviato a questo indirizzo
- </small>
- </div>
- </div>
- <div class="row mt-3" style="display: none;" id="emailSubjectRow">
- <div class="col-12">
- <label for="exportEmailSubject" class="form-label">
- <i class="fas fa-tag me-1"></i>Oggetto Email
- </label>
- <input type="text" class="form-control" id="exportEmailSubject"
- wire:model.defer="exportEmailSubject"
- placeholder="Prima Nota - Export">
- <small class="form-text text-muted">
- Personalizza l'oggetto dell'email
- </small>
- </div>
- </div>
- <div class="row mt-3">
- <div class="col-12">
- <div class="alert alert-info d-flex align-items-start">
- <i class="fas fa-info-circle me-2 mt-1"></i>
- <div>
- <strong>Informazioni Export:</strong>
- <ul class="mb-0 mt-1">
- <li>L'export includerà tutti i record nel periodo selezionato</li>
- <li>Verranno applicati i filtri attualmente attivi</li>
- <li id="emailProcessingInfo" style="display: none;">L'elaborazione avverrà in background, potrai continuare a usare l'applicazione</li>
- </ul>
- </div>
- </div>
- </div>
- </div>
- </div>
- <div class="modal-footer" style="background-color: #FFF!important;">
- <button type="button" class="btn--ui lightGrey me-2" data-bs-dismiss="modal">ANNULLA</button>
- <button type="button" class="btn--ui primary" onclick="handleExportClick()" id="exportButton">
- <span id="loadingState" style="display: none;">
- <div class="spinner-border spinner-border-sm me-2" role="status">
- <span class="visually-hidden">Loading...</span>
- </div>
- ELABORAZIONE...
- </span>
- <span id="normalState">
- <i class="fas fa-download me-1"></i>
- ESPORTA
- </span>
- </button>
- </div>
- </div>
- </div>
- </div>
- <div class="toast-container position-fixed top-0 end-0 p-3" style="z-index: 11000;">
- <!-- Toasts will be dynamically added here -->
- </div>
- </div>
- @push('scripts')
- <script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
- @endpush
- @push('scripts')
- <link href="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/css/select2.min.css" rel="stylesheet" />
- <style>
- .loading-overlay {
- position: absolute;
- top: 0;
- left: 0;
- right: 0;
- bottom: 0;
- background-color: rgba(255, 255, 255, 0.9);
- display: flex;
- justify-content: center;
- align-items: center;
- z-index: 1000;
- border-radius: 4px;
- }
- .loading-content {
- text-align: center;
- color: #0C6197;
- }
- .loading-content i {
- margin-bottom: 15px;
- color: #0C6197;
- }
- .loading-content p {
- margin: 0;
- font-size: 16px;
- font-weight: 500;
- color: #10172A;
- }
- .modal {
- z-index: 9999 !important;
- }
- .modal-backdrop {
- z-index: 9998 !important;
- background-color: rgba(0, 0, 0, 0.6) !important;
- }
- .modal-content {
- border-radius: 8px;
- border: none;
- box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
- z-index: 10000 !important;
- }
- .modal-header {
- color: white;
- border-bottom: none;
- border-radius: 8px 8px 0 0;
- }
- .modal-header .btn-close {
- filter: invert(1);
- }
- .modal-title {
- font-weight: 600;
- }
- .varie-link:hover {
- color: #084c6b !important;
- text-decoration: underline !important;
- }
- #btn-back-to-top {
- background-color: #0C6197;
- color: white;
- position: fixed;
- display: none;
- }
- #btn-back-to-bottom {
- background-color: #0C6197;
- color: white;
- position: fixed;
- z-index: 9999;
- display: none;
- }
- button[disabled] {
- opacity: 0.7;
- cursor: not-allowed;
- }
- .btn--ui .fa-spinner {
- margin-right: 5px;
- }
- .scrollTable {
- margin-left: 0px;
- margin-right: 0px;
- padding: 15px;
- overflow-x: auto;
- overflow-y: auto;
- white-space: nowrap;
- border: 1px solid #ddd;
- }
- ::-webkit-scrollbar-thumb {
- background: #e4e4e4;
- border-radius: 10px;
- }
- table thead {
- position: sticky;
- z-index: 100;
- top: 0;
- }
- .select2-container--default .select2-selection--single {
- background-color: #E9F0F5;
- border: 0.0625rem solid #DFE5EB;
- font-size: 0.75rem;
- height: 38px !important;
- }
- .select2-selection__rendered {
- padding-top: 3px;
- }
- .select2 {
- width: 100% !important;
- }
- .select2-selection--multiple {
- overflow: hidden !important;
- height: auto !important;
- }
- .select2-container {
- box-sizing: border-box;
- display: inline-block;
- margin: 0;
- position: relative;
- vertical-align: middle;
- z-index: 999 !important;
- }
- .select2-dropdown {
- z-index: 999 !important;
- }
- .select2-container .select2-selection--single {
- box-sizing: border-box;
- cursor: pointer;
- display: block;
- height: 38px;
- user-select: none;
- -webkit-user-select: none;
- }
- .select2-container .select2-selection--single .select2-selection__rendered {
- display: block;
- padding-left: 8px;
- padding-right: 20px;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- }
- button#exportDropdown.btn--ui_outline.light {
- font-weight: normal !important;
- }
- .btn--ui_outline.light.dropdown-toggle:active,
- .btn--ui_outline.light.dropdown-toggle:focus,
- .btn--ui_outline.light.dropdown-toggle.show {
- background-color: transparent !important;
- color: #10172A !important;
- box-shadow: none !important;
- }
- .btn--ui_outline.light.dropdown-toggle:hover {
- background-color: transparent !important;
- color: #10172A !important;
- }
- .form-select {
- height: 38px !important;
- }
- .form-control {
- height: 43px !important;
- }
- #exportModal .modal-body {
- padding: 1.5rem;
- }
- #exportModal .form-label {
- font-weight: 600;
- color: #10172A;
- margin-bottom: 0.5rem;
- }
- #exportModal .text-muted {
- font-size: 0.875rem;
- }
- .btn--ui[disabled] .fa-spinner {
- margin-right: 0.5rem;
- }
- body.modal-open {
- overflow: hidden;
- }
- .modal-dialog {
- z-index: 10001 !important;
- margin: 1.75rem auto;
- }
- .list-group-item {
- border-left: none;
- border-right: none;
- border-top: 1px solid #dee2e6;
- padding: 12px 15px;
- }
- .list-group-item:first-child {
- border-top: none;
- }
- .list-group-item:last-child {
- border-bottom: none;
- }
- @media (max-width: 768px) {
- .col-md-2, .col-md-3, .col-md-4 {
- margin-bottom: 10px;
- }
- .prima--nota_buttons {
- float: none !important;
- margin-top: 10px !important;
- text-align: center;
- }
- }
- .export-method-check {
- padding: 16px 16px 16px 50px;
- background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
- border-radius: 8px;
- border: 2px solid #e9ecef;
- transition: all 0.3s ease;
- cursor: pointer;
- position: relative;
- }
- .export-method-check:hover {
- border-color: #0C6197;
- background: linear-gradient(135deg, #e8f4f8 0%, #d1ecf1 100%);
- }
- .export-method-check .form-check-input {
- position: absolute;
- left: 16px;
- top: 50%;
- transform: translateY(-50%);
- margin: 0;
- width: 20px;
- height: 20px;
- background-color: #fff;
- border: 2px solid #dee2e6;
- border-radius: 4px;
- cursor: pointer;
- }
- .export-method-check .form-check-input:checked {
- background-color: #0C6197;
- border-color: #0C6197;
- }
- .export-method-check .form-check-input:checked ~ .form-check-label {
- color: #0C6197;
- font-weight: 600;
- }
- .export-method-check .form-check-label {
- font-weight: 500;
- color: #495057;
- cursor: pointer;
- margin-left: 0;
- display: block;
- }
- .form-check-input:focus {
- border-color: #0C6197;
- outline: 0;
- box-shadow: 0 0 0 0.2rem rgba(12, 97, 151, 0.25);
- }
- #emailAddressRow.show, #emailSubjectRow.show {
- display: block !important;
- animation: slideDown 0.3s ease-out;
- }
- @keyframes slideDown {
- from {
- opacity: 0;
- transform: translateY(-10px);
- }
- to {
- opacity: 1;
- transform: translateY(0);
- }
- }
- .invalid-feedback {
- display: none;
- }
- .is-invalid ~ .invalid-feedback {
- display: block;
- }
- .alert-info {
- background-color: rgba(12, 97, 151, 0.1);
- border-color: rgba(12, 97, 151, 0.2);
- color: #0C6197;
- }
- .spinner-border-sm {
- width: 1rem;
- height: 1rem;
- }
- .toast {
- min-width: 300px;
- }
- .toast-body {
- font-weight: 500;
- }
- .btn--ui:disabled {
- opacity: 0.7;
- cursor: not-allowed;
- }
- .list-group-item {
- border-left: none;
- border-right: none;
- border-top: 1px solid #dee2e6;
- padding: 12px 15px;
- }
- .list-group-item:first-child {
- border-top: none;
- }
- .list-group-item:last-child {
- border-bottom: none;
- }
- /* Enhanced styles for the causal modal with amounts */
- .list-group-item.d-flex {
- display: flex !important;
- justify-content: space-between !important;
- align-items: center !important;
- }
- .list-group-item .badge {
- font-size: 0.875rem;
- font-weight: 600;
- }
- .list-group-item:hover {
- background-color: rgba(12, 97, 151, 0.05);
- transition: background-color 0.2s ease;
- }
- #causalsModal .modal-body {
- padding: 1rem 0;
- }
- </style>
- <script src="https://code.jquery.com/jquery-2.2.4.min.js" integrity="sha256-BbhdlvQf/xTY9gja0Dq3HiwQF8LaCRTXxZKRutelT44=" crossorigin="anonymous"></script>
- <script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js"></script>
- <script src="/assets/js/aCollapTable.js"></script>
- @endpush
- @push('scripts')
- <script>
- function closeSelect2Dropdowns() {
- $('.filterCausals').each(function() {
- if ($(this).hasClass('select2-hidden-accessible')) {
- $(this).select2('close');
- }
- });
- $('.filterMember').each(function() {
- if ($(this).hasClass('select2-hidden-accessible')) {
- $(this).select2('close');
- }
- });
- }
- function load() {
- $(document).ready(function(){
- $(document).on("keypress", $('.filterCausals'), function (e) {
- setTimeout(() => {
- $(".select2-results__option").each(function(){
- var txt = $(this).html();
- var count = (txt.match(/-/g) || []).length;
- $(this).addClass('paddingLeftSelect' + count);
- });
- }, 100);
- });
- if (!$('.filterCausals').hasClass('select2-hidden-accessible')) {
- $('.filterCausals').select2({
- "language": {"noResults": function(){return "Nessun risultato";}},
- "dropdownParent": $('body'),
- "width": "100%"
- });
- }
- $('.filterCausals').off('change.customHandler').on('change.customHandler', function (e) {
- var data = $('.filterCausals').select2("val");
- @this.set('filterCausals', data);
- });
- $('.filterCausals').off('select2:open.customHandler').on('select2:open.customHandler', function (e) {
- if ($('#causalsModal').hasClass('show')) {
- $('#causalsModal').modal('hide');
- }
- setTimeout(() => {
- $(".select2-results__option").each(function(){
- var txt = $(this).html();
- var count = (txt.match(/-/g) || []).length;
- $(this).addClass('paddingLeftSelect' + count);
- });
- }, 100);
- });
- if (!$('.filterMember').hasClass('select2-hidden-accessible')) {
- $('.filterMember').select2({
- "language": {"noResults": function(){return "Nessun risultato";}},
- "dropdownParent": $('body'),
- "width": "100%"
- });
- }
- $('.filterMember').off('change.customHandler').on('change.customHandler', function (e) {
- var data = $('.filterMember').select2("val");
- @this.set('filterMember', data);
- });
- $('.filterMember').off('select2:open.customHandler').on('select2:open.customHandler', function (e) {
- if ($('#causalsModal').hasClass('show')) {
- $('#causalsModal').modal('hide');
- }
- });
- });
- }
- function printData() {
- var divToPrint = document.getElementById("tablesaw-350");
- newWin = window.open("");
- var htmlToPrint = '' +
- '<style type="text/css">' +
- 'table th, table td {' +
- 'border:1px solid #000;' +
- 'padding:0.5em;' +
- '}' +
- '</style>';
- htmlToPrint += divToPrint.outerHTML;
- newWin.document.write(htmlToPrint);
- newWin.document.close();
- newWin.print();
- newWin.close();
- }
- function scrollFunction() {
- const element = document.getElementById('resume-table');
- const mybuttonBottom = document.getElementById("btn-back-to-bottom");
- const mybutton = document.getElementById("btn-back-to-top");
- if (element.scrollTop > 20) {
- mybutton.style.display = "block";
- mybuttonBottom.style.display = "block";
- } else {
- mybutton.style.display = "none";
- mybuttonBottom.style.display = "none";
- }
- }
- function backToTop() {
- $('#resume-table').scrollTop(0);
- }
- function backToBottom() {
- $('#resume-table').scrollTop($('#resume-table')[0].scrollHeight);
- }
- $(document).ready(function() {
- load();
- document.querySelector("#print").addEventListener("click", function(){
- printData();
- });
- const element = document.getElementById('resume-table');
- element.onscroll = scrollFunction;
- const mybuttonBottom = document.getElementById("btn-back-to-bottom");
- const mybutton = document.getElementById("btn-back-to-top");
- mybutton.addEventListener("click", backToTop);
- mybuttonBottom.addEventListener("click", backToBottom);
- $(document).on('click', '.varie-link', function(e) {
- e.preventDefault();
- e.stopPropagation();
- closeSelect2Dropdowns();
- const causalsData = $(this).data('causals');
- if (causalsData) {
- const causals = causalsData.split('|');
- $('#causalsList').empty();
- causals.forEach(function(causal) {
- if (causal.trim()) {
- if (causal.includes(':::')) {
- const parts = causal.split(':::');
- const causalName = parts[0].trim();
- const amount = parts[1].trim();
- $('#causalsList').append(
- '<li class="list-group-item d-flex justify-content-between align-items-center">' +
- '<div>' +
- '<i class="fas fa-tags me-2" style="color: #0C6197;"></i>' +
- causalName +
- '</div>' +
- '<span class="badge bg-primary rounded-pill" style="background-color: #0C6197 !important;">' +
- amount +
- '</span>' +
- '</li>'
- );
- } else {
- $('#causalsList').append(
- '<li class="list-group-item">' +
- '<i class="fas fa-tags me-2" style="color: #0C6197;"></i>' +
- causal.trim() +
- '</li>'
- );
- }
- }
- });
- $('#causalsModal').modal('show');
- $('#causalsModal').on('shown.bs.modal', function () {
- $(this).find('.btn-close').focus();
- });
- }
- });
- });
- Livewire.on('load-table', () => {
- load();
- });
- Livewire.on('load-select', () => {
- load();
- });
- Livewire.on('filters-reset', () => {
- $('.filterMember').val('').trigger('change');
- $('.filterCausals').val('').trigger('change');
- load();
- });
- Livewire.on('show-export-modal', () => {
- $('#exportModal').modal('show');
- });
- Livewire.on('hide-export-modal', () => {
- $('#exportModal').modal('hide');
- });
- function showToast(type, message, duration = 5000) {
- const toastContainer = document.querySelector('.toast-container');
- if (!toastContainer) {
- console.error('Toast container not found');
- return;
- }
- const toastId = 'toast-' + Date.now();
- const toastColors = {
- success: 'bg-success',
- error: 'bg-danger',
- warning: 'bg-warning',
- info: 'bg-info'
- };
- const toastIcons = {
- success: 'fa-check-circle',
- error: 'fa-exclamation-circle',
- warning: 'fa-exclamation-triangle',
- info: 'fa-info-circle'
- };
- const toast = document.createElement('div');
- toast.id = toastId;
- toast.className = `toast align-items-center text-white ${toastColors[type]} border-0`;
- toast.setAttribute('role', 'alert');
- toast.innerHTML = `
- <div class="d-flex">
- <div class="toast-body">
- <i class="fas ${toastIcons[type]} me-2"></i>
- ${message}
- </div>
- <button type="button" class="btn-close btn-close-white me-2 m-auto" data-bs-dismiss="toast"></button>
- </div>
- `;
- toastContainer.appendChild(toast);
- if (typeof bootstrap !== 'undefined') {
- const bsToast = new bootstrap.Toast(toast, { delay: duration });
- bsToast.show();
- toast.addEventListener('hidden.bs.toast', function() {
- if (toastContainer.contains(toast)) {
- toastContainer.removeChild(toast);
- }
- });
- return bsToast;
- } else {
- toast.style.display = 'block';
- setTimeout(() => {
- if (toastContainer.contains(toast)) {
- toastContainer.removeChild(toast);
- }
- }, duration);
- }
- }
- document.addEventListener('DOMContentLoaded', function() {
- const sendViaEmailCheckbox = document.getElementById('sendViaEmail');
- const emailAddressRow = document.getElementById('emailAddressRow');
- const emailSubjectRow = document.getElementById('emailSubjectRow');
- const emailProcessingInfo = document.getElementById('emailProcessingInfo');
- const exportIcon = document.getElementById('exportIcon');
- const exportButtonText = document.getElementById('exportButtonText');
- const emailInput = document.getElementById('exportEmailAddress');
- function toggleEmailFields() {
- if (sendViaEmailCheckbox && sendViaEmailCheckbox.checked) {
- if (emailAddressRow) {
- emailAddressRow.style.display = 'block';
- emailAddressRow.classList.add('show');
- }
- if (emailSubjectRow) {
- emailSubjectRow.style.display = 'block';
- emailSubjectRow.classList.add('show');
- }
- if (emailProcessingInfo) {
- emailProcessingInfo.style.display = 'list-item';
- }
- if (exportIcon) exportIcon.className = 'fas fa-paper-plane me-1';
- if (exportButtonText) exportButtonText.textContent = 'INVIA EMAIL';
- } else {
- if (emailAddressRow) {
- emailAddressRow.style.display = 'none';
- emailAddressRow.classList.remove('show');
- }
- if (emailSubjectRow) {
- emailSubjectRow.style.display = 'none';
- emailSubjectRow.classList.remove('show');
- }
- if (emailProcessingInfo) {
- emailProcessingInfo.style.display = 'none';
- }
- if (exportIcon) exportIcon.className = 'fas fa-download me-1';
- if (exportButtonText) exportButtonText.textContent = 'ESPORTA';
- }
- }
- function validateEmail(email) {
- const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
- return emailRegex.test(email);
- }
- if (sendViaEmailCheckbox) {
- sendViaEmailCheckbox.addEventListener('change', toggleEmailFields);
- }
- if (emailInput) {
- emailInput.addEventListener('blur', function() {
- if (sendViaEmailCheckbox && sendViaEmailCheckbox.checked && this.value) {
- if (validateEmail(this.value)) {
- this.classList.remove('is-invalid');
- this.classList.add('is-valid');
- } else {
- this.classList.remove('is-valid');
- this.classList.add('is-invalid');
- }
- }
- });
- emailInput.addEventListener('input', function() {
- this.classList.remove('is-invalid', 'is-valid');
- });
- }
- if (typeof $ !== 'undefined') {
- $('#exportModal').on('shown.bs.modal', function() {
- toggleEmailFields();
- });
- }
- });
- document.addEventListener('livewire:load', function () {
- console.log('Livewire loaded, setting up export event listeners');
- Livewire.on('export-email-queued', function() {
- console.log('Export email queued event received');
- showToast('info',
- '<strong>Export avviato!</strong><br>' +
- 'L\'elaborazione è in corso in background. Riceverai l\'email a breve.',
- 8000
- );
- });
- Livewire.on('export-email-sent', function() {
- console.log('Export email sent event received');
- showToast('success',
- '<strong>Email inviata!</strong><br>' +
- 'L\'export è stato completato e inviato alla tua email.',
- 6000
- );
- });
- Livewire.on('export-email-error', function(message) {
- console.log('Export email error event received:', message);
- showToast('error',
- '<strong>Errore nell\'export:</strong><br>' +
- (message || 'Si è verificato un errore durante l\'elaborazione.'),
- 10000
- );
- });
- Livewire.on('show-export-modal', function() {
- console.log('Show export modal event received');
- if (typeof $ !== 'undefined') {
- $('#exportModal').modal('show');
- }
- });
- Livewire.on('hide-export-modal', function() {
- console.log('Hide export modal event received');
- if (typeof $ !== 'undefined') {
- $('#exportModal').modal('hide');
- }
- });
- });
- if (typeof Livewire !== 'undefined') {
- document.addEventListener('livewire:initialized', function () {
- console.log('Livewire initialized, setting up export event listeners');
- Livewire.on('export-email-queued', function() {
- showToast('info',
- '<strong>Export avviato!</strong><br>' +
- 'L\'elaborazione è in corso in background. Riceverai l\'email a breve.',
- 8000
- );
- });
- Livewire.on('export-email-sent', function() {
- showToast('success',
- '<strong>Email inviata!</strong><br>' +
- 'L\'export è stato completato e inviato alla tua email.',
- 6000
- );
- });
- Livewire.on('export-email-error', function(message) {
- showToast('error',
- '<strong>Errore nell\'export:</strong><br>' +
- (message || 'Si è verificato un errore durante l\'elaborazione.'),
- 10000
- );
- });
- Livewire.on('show-export-modal', function() {
- if (typeof $ !== 'undefined') {
- $('#exportModal').modal('show');
- }
- });
- Livewire.on('hide-export-modal', function() {
- if (typeof $ !== 'undefined') {
- $('#exportModal').modal('hide');
- }
- });
- });
- }
- window.addEventListener('load', function() {
- if (typeof showToast === 'function') {
- console.log('showToast function is available globally');
- } else {
- console.error('showToast function is not available globally');
- }
- });
- function handleExportClick() {
- showExportLoading();
- @this.call('exportWithDateRange');
- }
- function showExportLoading() {
- document.getElementById('normalState').style.display = 'none';
- document.getElementById('loadingState').style.display = 'inline-flex';
- document.getElementById('exportButton').disabled = true;
- }
- function hideExportLoading() {
- document.getElementById('normalState').style.display = 'inline-flex';
- document.getElementById('loadingState').style.display = 'none';
- document.getElementById('exportButton').disabled = false;
- }
- // Listen for when export is complete
- Livewire.on('export-complete', function() {
- hideExportLoading();
- });
- Livewire.on('hide-export-modal', function() {
- hideExportLoading();
- });
- </script>
- @endpush
|