| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666 |
- <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: 38px;">
- <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="export()">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;">Tipo</th>
- <th scope="col" style="border-left:3px solid white;">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">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">
- <h6>Causali incluse:</h6>
- <ul id="causalsList" class="list-group list-group-flush">
- </ul>
- </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">CHIUDI</button>
- </div>
- </div>
- </div>
- </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;
- }
- 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;
- }
- }
- </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()) {
- $('#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();
- });
- }
- });
- $('#causalsModal').on('show.bs.modal', function () {
- closeSelect2Dropdowns();
- $('body').addClass('modal-open');
- });
- $('#causalsModal').on('hidden.bs.modal', function () {
- $('body').removeClass('modal-open');
- });
- });
- Livewire.on('load-table', () => {
- load();
- });
- Livewire.on('load-select', () => {
- load();
- });
- Livewire.on('filters-reset', () => {
- $('.filterMember').val('').trigger('change');
- $('.filterCausals').val('').trigger('change');
- load();
- });
- </script>
- @endpush
|