netgescon-day0/resources/views/filament/pages/contabilita/situazione-iniziale.blade.php

847 lines
64 KiB
PHP
Executable File
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<x-filament-panels::page>
@php
$query = request()->query();
$tab = $this->tab ?? 'bilancio';
$tab = in_array($tab, ['bilancio', 'crediti', 'debiti', 'conguagli', 'dettaglio'], true) ? $tab : 'bilancio';
$fmt = fn($v) => number_format((float) ($v ?? 0), 2, ',', '.');
$stabile = optional(\App\Support\StabileContext::getActiveStabile(auth()->user()));
$activeLegacyYear = (string) ($legacyYear ?? $this->legacyYear ?? '');
@endphp
<div class="space-y-6">
{{-- 1. HERO HEADER: STABILE & CONTROLLI GESTIONE --}}
<div class="rounded-xl border border-slate-200 bg-white p-5 shadow-xs">
<div class="flex flex-col gap-4 lg:flex-row lg:items-center lg:justify-between">
<div class="flex items-center gap-3.5">
<div class="flex h-12 w-12 items-center justify-center rounded-xl bg-indigo-50 border border-indigo-200 text-2xl">
🏛️
</div>
<div>
<div class="flex items-center gap-2">
<h2 class="text-base font-bold text-slate-900">{{ $stabile->denominazione ?? '—' }}</h2>
<span class="rounded-full bg-indigo-100 text-indigo-800 border border-indigo-200 px-2.5 py-0.5 text-xs font-bold font-mono">
COD: {{ $stabile->codice_stabile ?? '—' }}
</span>
</div>
<div class="text-xs text-slate-500 mt-0.5 flex items-center gap-2">
<span>Esercizio attivo: <strong class="text-slate-800">{{ $this->legacyYearLabels[$activeLegacyYear] ?? ($activeLegacyYear ?: 'Tutti') }}</strong></span>
@if(!empty($stabile->codice_fiscale))
<span>· CF Stabile: <code class="font-mono text-slate-700">{{ $stabile->codice_fiscale }}</code></span>
@endif
</div>
</div>
</div>
{{-- Form Filtro Parametri --}}
<form method="get" class="flex flex-wrap items-end gap-3 bg-slate-50 border border-slate-200 p-2.5 rounded-xl">
<input type="hidden" name="tab" value="{{ $tab }}" />
@if (request()->query('dett'))
<input type="hidden" name="dett" value="{{ request()->query('dett') }}" />
@endif
<div class="w-48">
<label class="text-[11px] font-semibold text-slate-600 mb-1 block uppercase tracking-wider">Esercizio Archivio</label>
<select name="legacy_year" class="w-full rounded-lg border border-slate-300 bg-white px-2.5 py-1.5 text-xs text-slate-800 focus:border-indigo-500 focus:ring-1 focus:ring-indigo-500">
<option value="">Tutti gli esercizi</option>
@foreach($legacyYears as $y)
<option value="{{ $y }}" @selected($activeLegacyYear === (string) $y)>{{ $this->legacyYearLabels[$y] ?? $y }}</option>
@endforeach
</select>
</div>
<div class="w-40">
<label class="text-[11px] font-semibold text-slate-600 mb-1 block uppercase tracking-wider">Data Bilancio Iniziale</label>
<input type="date" name="data" value="{{ $dataBilancio ?? '' }}" class="w-full rounded-lg border border-slate-300 bg-white px-2.5 py-1.5 text-xs text-slate-800 focus:border-indigo-500 focus:ring-1 focus:ring-indigo-500" />
</div>
<div class="w-40">
<label class="text-[11px] font-semibold text-slate-600 mb-1 block uppercase tracking-wider">Saldo Manuale ()</label>
<input type="text" name="saldo_manuale" value="{{ $saldoBancaManuale ?? '' }}" placeholder="es. 1.234,56" class="w-full rounded-lg border border-slate-300 bg-white px-2.5 py-1.5 text-xs text-slate-800 font-mono focus:border-indigo-500 focus:ring-1 focus:ring-indigo-500" />
</div>
<div>
<button type="submit" class="inline-flex items-center gap-1.5 rounded-lg bg-indigo-600 px-3 py-1.5 text-xs font-semibold text-white shadow-xs hover:bg-indigo-700 transition">
<span>🔄 Aggiorna</span>
</button>
</div>
</form>
</div>
</div>
{{-- 2. TAB DI NAVIGAZIONE ELEGANTE --}}
<div class="flex items-center gap-2 border-b border-slate-200 pb-2 overflow-x-auto">
<button type="button"
wire:click="$set('tab', 'bilancio'); $set('dett', null)"
class="inline-flex items-center gap-2 rounded-xl px-4 py-2 text-xs font-bold transition {{ $tab === 'bilancio' ? 'bg-indigo-600 text-white shadow-sm' : 'bg-white text-slate-700 border border-slate-200 hover:bg-slate-50' }}">
<span>📊</span>
<span>Bilancio di Partenza</span>
</button>
<button type="button"
wire:click="$set('tab', 'conguagli'); $set('dett', null)"
class="inline-flex items-center gap-2 rounded-xl px-4 py-2 text-xs font-bold transition {{ $tab === 'conguagli' ? 'bg-indigo-600 text-white shadow-sm' : 'bg-white text-slate-700 border border-slate-200 hover:bg-slate-50' }}">
<span>🚀</span>
<span>Conguagli Apertura (dett_tab)</span>
<span class="rounded-full px-1.5 py-0.2 text-[10px] {{ $tab === 'conguagli' ? 'bg-indigo-700 text-white' : 'bg-slate-100 text-slate-600' }}">
{{ count($dettTabRows ?? []) }}
</span>
</button>
<button type="button"
wire:click="$set('tab', 'crediti'); $set('dett', null)"
class="inline-flex items-center gap-2 rounded-xl px-4 py-2 text-xs font-bold transition {{ $tab === 'crediti' ? 'bg-indigo-600 text-white shadow-sm' : 'bg-white text-slate-700 border border-slate-200 hover:bg-slate-50' }}">
<span>📥</span>
<span>Crediti Pregressi</span>
</button>
<button type="button"
wire:click="$set('tab', 'debiti'); $set('dett', null)"
class="inline-flex items-center gap-2 rounded-xl px-4 py-2 text-xs font-bold transition {{ $tab === 'debiti' ? 'bg-indigo-600 text-white shadow-sm' : 'bg-white text-slate-700 border border-slate-200 hover:bg-slate-50' }}">
<span>📤</span>
<span>Debiti verso Fornitori</span>
</button>
<button type="button"
wire:click="$set('tab', 'dettaglio')"
class="inline-flex items-center gap-2 rounded-xl px-4 py-2 text-xs font-bold transition {{ $tab === 'dettaglio' ? 'bg-indigo-600 text-white shadow-sm' : 'bg-white text-slate-700 border border-slate-200 hover:bg-slate-50' }}">
<span>🔍</span>
<span>Dettaglio Analitico</span>
</button>
</div>
{{-- 3. TAB CONTENT --}}
{{-- TAB: DETTAGLIO ANALITICO --}}
@if ($tab === 'dettaglio')
<div class="rounded-xl border border-slate-200 bg-white p-5 shadow-xs">
<div class="flex items-center justify-between border-b border-slate-200 pb-3 mb-4">
<h3 class="text-sm font-bold text-slate-900">{{ $detailMeta['titolo'] ?? 'Dettaglio Analitico' }}</h3>
</div>
@if (($detailMeta['tipo'] ?? null) === 'cre_deb_preced')
<div class="overflow-x-auto">
<table class="w-full text-left text-xs text-slate-700 divide-y divide-slate-100">
<thead class="bg-slate-50 text-[11px] font-bold uppercase tracking-wider text-slate-500">
<tr>
<th class="px-3.5 py-2.5">C/D</th>
<th class="px-3.5 py-2.5">Cod. Voce</th>
<th class="px-3.5 py-2.5">Voce</th>
<th class="px-3.5 py-2.5">Descrizione</th>
<th class="px-3.5 py-2.5">Straord.</th>
<th class="px-3.5 py-2.5 text-right">Importo </th>
</tr>
</thead>
<tbody class="divide-y divide-slate-100">
@forelse(($detailRows ?? []) as $r)
<tr class="hover:bg-slate-50/80 transition">
<td class="px-3.5 py-2 font-bold">{{ $r['c_d'] }}</td>
<td class="px-3.5 py-2 font-mono text-slate-600">{{ $r['cod_voc'] }}</td>
<td class="px-3.5 py-2 font-medium text-slate-900">{{ $r['des_voce'] }}</td>
<td class="px-3.5 py-2 text-slate-700">{{ $r['descrizione'] }}</td>
<td class="px-3.5 py-2">{{ $r['n_stra'] ?? '—' }}</td>
<td class="px-3.5 py-2 text-right font-mono font-bold">{{ $fmt($r['importo_euro'] ?? 0) }}</td>
</tr>
@empty
<tr>
<td colspan="6" class="p-6 text-center text-xs text-slate-500">Nessun dato disponibile nel dettaglio selezionato.</td>
</tr>
@endforelse
</tbody>
</table>
</div>
@elseif (($detailMeta['tipo'] ?? null) === 'dett_tab')
<div class="overflow-x-auto">
<table class="w-full text-left text-xs text-slate-700 divide-y divide-slate-100">
<thead class="bg-slate-50 text-[11px] font-bold uppercase tracking-wider text-slate-500">
<tr>
<th class="px-3.5 py-2.5">Tabella</th>
<th class="px-3.5 py-2.5">Condomino</th>
<th class="px-3.5 py-2.5">Inquilino</th>
<th class="px-3.5 py-2.5 text-right">MM</th>
<th class="px-3.5 py-2.5">Straord.</th>
<th class="px-3.5 py-2.5 text-right">Cons. </th>
</tr>
</thead>
<tbody class="divide-y divide-slate-100">
@forelse(($detailRows ?? []) as $r)
<tr class="hover:bg-slate-50/80 transition">
<td class="px-3.5 py-2 font-mono font-bold text-indigo-700">{{ $r['cod_tab'] }}</td>
<td class="px-3.5 py-2">
<div class="font-medium text-slate-900">#{{ $r['id_cond'] }}</div>
<div class="text-[11px] text-slate-500">{{ $r['cond_label'] ?? '' }}</div>
</td>
<td class="px-3.5 py-2 font-mono">{{ $r['cond_inquil'] ?: '—' }}</td>
<td class="px-3.5 py-2 text-right font-mono">{{ $r['mm'] !== null ? number_format((float) $r['mm'], 3, ',', '.') : '—' }}</td>
<td class="px-3.5 py-2">{{ $r['n_stra'] ?? '—' }}</td>
<td class="px-3.5 py-2 text-right font-mono font-bold {{ ($r['cons_euro'] ?? 0) >= 0 ? 'text-emerald-700' : 'text-rose-600' }}">
{{ $fmt($r['cons_euro'] ?? 0) }}
</td>
</tr>
@empty
<tr>
<td colspan="6" class="p-6 text-center text-xs text-slate-500">Nessun dato disponibile nel dettaglio selezionato.</td>
</tr>
@endforelse
</tbody>
</table>
</div>
@else
<div class="p-8 text-center text-xs text-slate-500">
Seleziona una voce dal tab <strong>Bilancio di Partenza</strong> per visualizzarne il dettaglio analitico riga per riga.
</div>
@endif
</div>
{{-- TAB: CONGUAGLI APERTURA (dett_tab) --}}
@elseif ($tab === 'conguagli')
<div class="space-y-4">
{{-- Box Informativo Logica Contabile --}}
<div class="rounded-xl border border-blue-200 bg-blue-50/60 p-4">
<div class="flex items-start gap-3">
<span class="text-xl"></span>
<div class="text-xs text-blue-900 leading-relaxed">
<strong>Principio Contabile di Competenza e Passaggio Gestioni:</strong>
Al termine dell'esercizio consuntivo, il <em>Conguaglio Finale</em> (<strong>CF</strong>, data 31/12/99) registrato nella tabella <code>rate</code>
rappresenta il saldo di quadratura dell'unità (differenza tra rate versate e quote spese attribuite per millesimi).
Questo saldo confluisce esattamente come <strong>Conguaglio di Apertura</strong> nella tabella <code>dett_tab</code> nel campo <code>cons_euro</code> (con codici <code>CONG.O</code> per l'Ordinaria, <code>CONG.R</code> per il Riscaldamento e <code>CONG.S</code> per le Straordinarie).
</div>
</div>
</div>
<div class="rounded-xl border border-slate-200 bg-white p-5 shadow-xs">
<div class="flex flex-col sm:flex-row sm:items-center sm:justify-between border-b border-slate-200 pb-3 mb-4 gap-3">
<div>
<h3 class="text-sm font-bold text-slate-900">Conguagli di Apertura (dett_tab)</h3>
<p class="text-[11px] text-slate-500">Saldi iniziali registrati per le singole unità per il nuovo esercizio.</p>
</div>
<span class="rounded-full bg-indigo-50 border border-indigo-200 px-3 py-0.5 text-xs font-bold text-indigo-700">
{{ count($dettTabRows ?? []) }} posizioni
</span>
</div>
{{-- Form Aggiunta Riga --}}
<form wire:submit.prevent="addDettTabRow" class="mb-4 rounded-xl border border-slate-200 bg-slate-50 p-4">
<div class="text-xs font-bold text-slate-700 uppercase tracking-wider mb-3"> Aggiungi Nuova Posizione Conguaglio Iniziale</div>
<div class="grid grid-cols-1 gap-3 sm:grid-cols-6">
<div>
<label class="text-[11px] font-semibold text-slate-600 block mb-1">Codice Tabella</label>
<select wire:model="formDettTabAdd.cod_tab" class="w-full rounded-lg border border-slate-300 bg-white px-2.5 py-1.5 text-xs font-mono">
<option value="CONG.O">CONG.O (Ordinaria)</option>
<option value="CONG.R">CONG.R (Riscaldamento)</option>
<option value="CONG.S">CONG.S (Straordinaria)</option>
</select>
</div>
<div>
<label class="text-[11px] font-semibold text-slate-600 block mb-1">ID Condomino</label>
<input type="text" wire:model="formDettTabAdd.id_cond" placeholder="es. 1" class="w-full rounded-lg border border-slate-300 bg-white px-2.5 py-1.5 text-xs font-mono" />
</div>
<div>
<label class="text-[11px] font-semibold text-slate-600 block mb-1">Ruolo</label>
<select wire:model="formDettTabAdd.cond_inquil" class="w-full rounded-lg border border-slate-300 bg-white px-2.5 py-1.5 text-xs">
<option value="C">C (Condomino / Prop.)</option>
<option value="I">I (Inquilino / Cond.)</option>
</select>
</div>
<div>
<label class="text-[11px] font-semibold text-slate-600 block mb-1">Importo (€)</label>
<input type="text" wire:model="formDettTabAdd.cons_euro" placeholder="es. 120,50 o -45,00" class="w-full rounded-lg border border-slate-300 bg-white px-2.5 py-1.5 text-xs font-mono" />
</div>
<div>
<label class="text-[11px] font-semibold text-slate-600 block mb-1">Millesimi (MM)</label>
<input type="text" wire:model="formDettTabAdd.mm" placeholder="0.000" class="w-full rounded-lg border border-slate-300 bg-white px-2.5 py-1.5 text-xs font-mono" />
</div>
<div class="flex items-end">
<button type="submit" class="w-full rounded-lg bg-indigo-600 py-1.5 text-xs font-semibold text-white shadow-xs hover:bg-indigo-700 transition">
Inserisci
</button>
</div>
</div>
</form>
{{-- Tabella Dati --}}
<div class="overflow-x-auto rounded-lg border border-slate-200">
<table class="w-full text-left text-xs text-slate-700 divide-y divide-slate-200">
<thead class="bg-slate-50 text-[11px] font-bold uppercase tracking-wider text-slate-500">
<tr>
<th class="px-3.5 py-2.5">Tabella</th>
<th class="px-3.5 py-2.5">ID Cond.</th>
<th class="px-3.5 py-2.5">Ruolo</th>
<th class="px-3.5 py-2.5">Nominativo Collegato</th>
<th class="px-3.5 py-2.5 text-right">Importo Iniziale (€)</th>
<th class="px-3.5 py-2.5 text-right">MM</th>
<th class="px-3.5 py-2.5 text-center">Unico</th>
<th class="px-3.5 py-2.5 text-right">Azioni</th>
</tr>
</thead>
<tbody class="divide-y divide-slate-100 bg-white">
@forelse(($dettTabRows ?? []) as $r)
@php $id = (int) ($r['id'] ?? 0); @endphp
@php $isEditing = (int) ($this->editingDettTabId ?? 0) === $id; @endphp
<tr class="hover:bg-indigo-50/30 transition {{ $isEditing ? 'bg-amber-50/50' : '' }}">
<td class="px-3.5 py-2 whitespace-nowrap">
@if($isEditing)
<input type="text" wire:model.defer="dettTabEdit.{{ $id }}.cod_tab" class="w-24 rounded border border-slate-300 px-2 py-1 text-xs font-mono" />
@else
<span class="inline-flex items-center rounded px-2 py-0.5 font-bold font-mono text-[11px] {{ str_starts_with($r['cod_tab'], 'CONG.O') ? 'bg-blue-100 text-blue-800' : (str_starts_with($r['cod_tab'], 'CONG.R') ? 'bg-amber-100 text-amber-800' : 'bg-purple-100 text-purple-800') }}">
{{ $r['cod_tab'] }}
</span>
@endif
</td>
<td class="px-3.5 py-2 font-mono font-bold text-slate-800">
@if($isEditing)
<input type="text" wire:model.defer="dettTabEdit.{{ $id }}.id_cond" class="w-16 rounded border border-slate-300 px-2 py-1 text-xs font-mono" />
@else
#{{ $r['id_cond'] }}
@endif
</td>
<td class="px-3.5 py-2 whitespace-nowrap">
@if($isEditing)
<select wire:model.defer="dettTabEdit.{{ $id }}.cond_inquil" class="rounded border border-slate-300 px-2 py-1 text-xs">
<option value="C">C (Condomino)</option>
<option value="I">I (Inquilino)</option>
</select>
@else
<span class="rounded px-1.5 py-0.5 text-[10px] font-bold {{ $r['cond_inquil'] === 'I' ? 'bg-indigo-100 text-indigo-800' : 'bg-amber-100 text-amber-800' }}">
{{ $r['cond_inquil'] === 'I' ? '👤 Inquilino (I)' : '🏢 Condomino (C)' }}
</span>
@endif
</td>
<td class="px-3.5 py-2 font-medium text-slate-900">
{{ $r['cond_label'] ?: '' }}
</td>
<td class="px-3.5 py-2 text-right font-mono font-bold whitespace-nowrap {{ ($r['cons_euro'] ?? 0) >= 0 ? 'text-emerald-700' : 'text-rose-600' }}">
@if($isEditing)
<input type="text" wire:model.defer="dettTabEdit.{{ $id }}.cons_euro" class="w-24 rounded border border-slate-300 px-2 py-1 text-xs font-mono text-right" />
@else
€ {{ $fmt($r['cons_euro'] ?? 0) }}
@endif
</td>
<td class="px-3.5 py-2 text-right font-mono text-slate-600">
@if($isEditing)
<input type="text" wire:model.defer="dettTabEdit.{{ $id }}.mm" class="w-20 rounded border border-slate-300 px-2 py-1 text-xs font-mono text-right" />
@else
{{ $r['mm'] !== null ? number_format((float) $r['mm'], 3, ',', '.') : '' }}
@endif
</td>
<td class="px-3.5 py-2 text-center">
@if($isEditing)
<input type="checkbox" wire:model.defer="dettTabEdit.{{ $id }}.unico" />
@else
<span class="text-slate-400">{{ !empty($r['unico']) ? '' : '' }}</span>
@endif
</td>
<td class="px-3.5 py-2 text-right whitespace-nowrap">
@if($isEditing)
<button type="button" wire:click="saveDettTabRow({{ $id }})" class="rounded bg-emerald-600 px-2.5 py-1 text-[11px] font-semibold text-white shadow-xs hover:bg-emerald-700">Salva</button>
<button type="button" wire:click="cancelEditDettTabRow" class="rounded bg-slate-200 px-2 py-1 text-[11px] font-semibold text-slate-700 hover:bg-slate-300">Annulla</button>
<button type="button" wire:click="deleteDettTabRow({{ $id }})" class="rounded bg-rose-600 px-2 py-1 text-[11px] font-semibold text-white hover:bg-rose-700">Elimina</button>
@else
<button type="button" wire:click="editDettTabRow({{ $id }})" class="rounded border border-slate-300 bg-white px-2.5 py-1 text-[11px] font-semibold text-slate-700 hover:bg-slate-50">Modifica</button>
@endif
</td>
</tr>
@empty
<tr>
<td colspan="8" class="p-6 text-center text-xs text-slate-500">Nessuna riga di conguaglio di apertura disponibile per l'esercizio selezionato.</td>
</tr>
@endforelse
</tbody>
</table>
</div>
</div>
</div>
{{-- TAB: CREDITI PREGRESSI --}}
@elseif ($tab === 'crediti')
<div class="space-y-4">
<div class="rounded-xl border border-slate-200 bg-white p-5 shadow-xs">
<div class="border-b border-slate-200 pb-3 mb-4">
<h3 class="text-sm font-bold text-slate-900">Crediti Pregressi (Cre_Deb_preced)</h3>
<p class="text-[11px] text-slate-500">Partite creditorie aperte del condominio registrate nel legacy.</p>
</div>
{{-- Form Aggiunta Credito --}}
<form wire:submit.prevent="addCreDebRow('C')" class="mb-4 rounded-xl border border-slate-200 bg-slate-50 p-4">
<div class="text-xs font-bold text-slate-700 uppercase tracking-wider mb-3"> Registra Nuovo Credito Pregresso</div>
<div class="grid grid-cols-1 gap-3 sm:grid-cols-6">
<div>
<label class="text-[11px] font-semibold text-slate-600 block mb-1">Codice Voce</label>
@if(!empty($vocSpeOptions ?? []))
<select wire:model="formCreDebAdd.cod_voc" class="w-full rounded-lg border border-slate-300 bg-white px-2.5 py-1.5 text-xs">
<option value=""></option>
@foreach(($vocSpeOptions ?? []) as $k => $v)
<option value="{{ $k }}">{{ $v }}</option>
@endforeach
</select>
@else
<input type="text" wire:model="formCreDebAdd.cod_voc" class="w-full rounded-lg border border-slate-300 bg-white px-2.5 py-1.5 text-xs" />
@endif
</div>
<div class="sm:col-span-2">
<label class="text-[11px] font-semibold text-slate-600 block mb-1">Descrizione Voce</label>
<input type="text" wire:model="formCreDebAdd.des_voce" class="w-full rounded-lg border border-slate-300 bg-white px-2.5 py-1.5 text-xs" />
</div>
<div class="sm:col-span-2">
<label class="text-[11px] font-semibold text-slate-600 block mb-1">Dettaglio / Note</label>
<input type="text" wire:model="formCreDebAdd.descrizione" class="w-full rounded-lg border border-slate-300 bg-white px-2.5 py-1.5 text-xs" />
</div>
<div>
<label class="text-[11px] font-semibold text-slate-600 block mb-1">Importo ()</label>
<input type="text" wire:model="formCreDebAdd.importo_euro" placeholder="es. 100,00" class="w-full rounded-lg border border-slate-300 bg-white px-2.5 py-1.5 text-xs font-mono" />
</div>
<div class="sm:col-span-6 flex justify-end">
<button type="submit" class="rounded-lg bg-indigo-600 px-4 py-1.5 text-xs font-semibold text-white shadow-xs hover:bg-indigo-700 transition">
Aggiungi Credito
</button>
</div>
</div>
</form>
{{-- Tabella Crediti --}}
<div class="overflow-x-auto rounded-lg border border-slate-200">
<table class="w-full text-left text-xs text-slate-700 divide-y divide-slate-200">
<thead class="bg-slate-50 text-[11px] font-bold uppercase tracking-wider text-slate-500">
<tr>
<th class="px-3.5 py-2.5">Cod_voc</th>
<th class="px-3.5 py-2.5">Des_voce</th>
<th class="px-3.5 py-2.5">Descrizione</th>
<th class="px-3.5 py-2.5">n_stra</th>
<th class="px-3.5 py-2.5 text-right">Importo </th>
<th class="px-3.5 py-2.5 text-center">Incluso</th>
<th class="px-3.5 py-2.5 text-right">Azioni</th>
</tr>
</thead>
<tbody class="divide-y divide-slate-100 bg-white">
@forelse(($creDebRows ?? []) as $r)
@php $id = (int) ($r['id'] ?? 0); @endphp
@php $isEditing = (int) ($this->editingCreDebId ?? 0) === $id; @endphp
<tr class="hover:bg-slate-50/80 transition cursor-pointer" wire:click="selectCreDebRow({{ $id }})">
<td class="px-3.5 py-2 font-mono font-bold text-slate-800">
@if($isEditing)
<input type="text" wire:model.defer="creDebEdit.{{ $id }}.cod_voc" class="w-20 rounded border border-slate-300 px-2 py-1 text-xs font-mono" wire:click.stop />
@else
{{ $r['cod_voc'] }}
@endif
</td>
<td class="px-3.5 py-2 font-medium text-slate-900">
@if($isEditing)
<input type="text" wire:model.defer="creDebEdit.{{ $id }}.des_voce" class="w-full rounded border border-slate-300 px-2 py-1 text-xs" wire:click.stop />
@else
{{ ($r['voc_spe_descriz'] ?? '') !== '' ? $r['voc_spe_descriz'] : ($r['des_voce'] ?? '') }}
@endif
</td>
<td class="px-3.5 py-2 text-slate-600">
@if($isEditing)
<input type="text" wire:model.defer="creDebEdit.{{ $id }}.descrizione" class="w-full rounded border border-slate-300 px-2 py-1 text-xs" wire:click.stop />
@else
{{ $r['descrizione'] }}
@endif
</td>
<td class="px-3.5 py-2">
@if($isEditing)
<input type="number" wire:model.defer="creDebEdit.{{ $id }}.n_stra" class="w-16 rounded border border-slate-300 px-2 py-1 text-xs" wire:click.stop />
@else
{{ $r['n_stra'] ?? '—' }}
@endif
</td>
<td class="px-3.5 py-2 text-right font-mono font-bold text-emerald-700">
@if($isEditing)
<input type="text" wire:model.defer="creDebEdit.{{ $id }}.importo_euro" class="w-24 rounded border border-slate-300 px-2 py-1 text-xs font-mono text-right" wire:click.stop />
@else
{{ $fmt($r['importo_euro'] ?? 0) }}
@endif
</td>
<td class="px-3.5 py-2 text-center">
@if($isEditing)
<input type="checkbox" wire:model.defer="creDebEdit.{{ $id }}.incluso" wire:click.stop />
@else
<span class="text-slate-500">{{ !empty($r['incluso']) ? '✓' : '—' }}</span>
@endif
</td>
<td class="px-3.5 py-2 text-right whitespace-nowrap">
@if($isEditing)
<button type="button" wire:click.stop="saveCreDebRow({{ $id }})" class="rounded bg-emerald-600 px-2.5 py-1 text-[11px] font-semibold text-white shadow-xs hover:bg-emerald-700">Salva</button>
<button type="button" wire:click.stop="cancelEditCreDebRow" class="rounded bg-slate-200 px-2 py-1 text-[11px] font-semibold text-slate-700 hover:bg-slate-300">Annulla</button>
<button type="button" wire:click.stop="deleteCreDebRow({{ $id }})" class="rounded bg-rose-600 px-2 py-1 text-[11px] font-semibold text-white hover:bg-rose-700">Elimina</button>
@else
<button type="button" wire:click.stop="editCreDebRow({{ $id }})" class="rounded border border-slate-300 bg-white px-2.5 py-1 text-[11px] font-semibold text-slate-700 hover:bg-slate-50">Modifica</button>
@endif
</td>
</tr>
@empty
<tr>
<td colspan="7" class="p-6 text-center text-xs text-slate-500">Nessun credito pregresso disponibile.</td>
</tr>
@endforelse
</tbody>
</table>
</div>
</div>
</div>
{{-- TAB: DEBITI VERSO FORNITORI --}}
@elseif ($tab === 'debiti')
<div class="space-y-4">
<div class="rounded-xl border border-slate-200 bg-white p-5 shadow-xs">
<div class="border-b border-slate-200 pb-3 mb-4">
<h3 class="text-sm font-bold text-slate-900">Debiti verso Fornitori (Cre_Deb_preced & Operazioni)</h3>
<p class="text-[11px] text-slate-500">Partite debitorie aperte da saldare per competenza pregresso.</p>
</div>
{{-- Form Aggiunta Debito --}}
<form wire:submit.prevent="addCreDebRow('D')" class="mb-4 rounded-xl border border-slate-200 bg-slate-50 p-4">
<div class="text-xs font-bold text-slate-700 uppercase tracking-wider mb-3"> Registra Nuovo Debito verso Fornitore</div>
<div class="grid grid-cols-1 gap-3 sm:grid-cols-6">
<div>
<label class="text-[11px] font-semibold text-slate-600 block mb-1">Codice Voce</label>
@if(!empty($vocSpeOptions ?? []))
<select wire:model="formCreDebAdd.cod_voc" class="w-full rounded-lg border border-slate-300 bg-white px-2.5 py-1.5 text-xs">
<option value=""></option>
@foreach(($vocSpeOptions ?? []) as $k => $v)
<option value="{{ $k }}">{{ $v }}</option>
@endforeach
</select>
@else
<input type="text" wire:model="formCreDebAdd.cod_voc" class="w-full rounded-lg border border-slate-300 bg-white px-2.5 py-1.5 text-xs" />
@endif
</div>
<div class="sm:col-span-2">
<label class="text-[11px] font-semibold text-slate-600 block mb-1">Descrizione Voce</label>
<input type="text" wire:model="formCreDebAdd.des_voce" class="w-full rounded-lg border border-slate-300 bg-white px-2.5 py-1.5 text-xs" />
</div>
<div class="sm:col-span-2">
<label class="text-[11px] font-semibold text-slate-600 block mb-1">Dettaglio / Fornitore</label>
<input type="text" wire:model="formCreDebAdd.descrizione" class="w-full rounded-lg border border-slate-300 bg-white px-2.5 py-1.5 text-xs" />
</div>
<div>
<label class="text-[11px] font-semibold text-slate-600 block mb-1">Importo ()</label>
<input type="text" wire:model="formCreDebAdd.importo_euro" placeholder="es. 100,00" class="w-full rounded-lg border border-slate-300 bg-white px-2.5 py-1.5 text-xs font-mono" />
</div>
<div class="sm:col-span-6 flex justify-end">
<button type="submit" class="rounded-lg bg-indigo-600 px-4 py-1.5 text-xs font-semibold text-white shadow-xs hover:bg-indigo-700 transition">
Aggiungi Debito
</button>
</div>
</div>
</form>
{{-- Tabella Debiti --}}
<div class="overflow-x-auto rounded-lg border border-slate-200">
<table class="w-full text-left text-xs text-slate-700 divide-y divide-slate-200">
<thead class="bg-slate-50 text-[11px] font-bold uppercase tracking-wider text-slate-500">
<tr>
<th class="px-3.5 py-2.5">Cod_voc</th>
<th class="px-3.5 py-2.5">Des_voce</th>
<th class="px-3.5 py-2.5">Descrizione</th>
<th class="px-3.5 py-2.5">n_stra</th>
<th class="px-3.5 py-2.5 text-right">Importo </th>
<th class="px-3.5 py-2.5 text-center">Incluso</th>
<th class="px-3.5 py-2.5 text-right">Azioni</th>
</tr>
</thead>
<tbody class="divide-y divide-slate-100 bg-white">
@forelse(($creDebRows ?? []) as $r)
@php $id = (int) ($r['id'] ?? 0); @endphp
@php $isEditing = (int) ($this->editingCreDebId ?? 0) === $id; @endphp
<tr class="hover:bg-slate-50/80 transition cursor-pointer" wire:click="selectCreDebRow({{ $id }})">
<td class="px-3.5 py-2 font-mono font-bold text-slate-800">
@if($isEditing)
<input type="text" wire:model.defer="creDebEdit.{{ $id }}.cod_voc" class="w-20 rounded border border-slate-300 px-2 py-1 text-xs font-mono" wire:click.stop />
@else
{{ $r['cod_voc'] }}
@endif
</td>
<td class="px-3.5 py-2 font-medium text-slate-900">
@if($isEditing)
<input type="text" wire:model.defer="creDebEdit.{{ $id }}.des_voce" class="w-full rounded border border-slate-300 px-2 py-1 text-xs" wire:click.stop />
@else
{{ ($r['voc_spe_descriz'] ?? '') !== '' ? $r['voc_spe_descriz'] : ($r['des_voce'] ?? '') }}
@endif
</td>
<td class="px-3.5 py-2 text-slate-600">
@if($isEditing)
<input type="text" wire:model.defer="creDebEdit.{{ $id }}.descrizione" class="w-full rounded border border-slate-300 px-2 py-1 text-xs" wire:click.stop />
@else
{{ $r['descrizione'] }}
@endif
</td>
<td class="px-3.5 py-2">
@if($isEditing)
<input type="number" wire:model.defer="creDebEdit.{{ $id }}.n_stra" class="w-16 rounded border border-slate-300 px-2 py-1 text-xs" wire:click.stop />
@else
{{ $r['n_stra'] ?? '—' }}
@endif
</td>
<td class="px-3.5 py-2 text-right font-mono font-bold text-rose-600">
@if($isEditing)
<input type="text" wire:model.defer="creDebEdit.{{ $id }}.importo_euro" class="w-24 rounded border border-slate-300 px-2 py-1 text-xs font-mono text-right" wire:click.stop />
@else
{{ $fmt($r['importo_euro'] ?? 0) }}
@endif
</td>
<td class="px-3.5 py-2 text-center">
@if($isEditing)
<input type="checkbox" wire:model.defer="creDebEdit.{{ $id }}.incluso" wire:click.stop />
@else
<span class="text-slate-500">{{ !empty($r['incluso']) ? '✓' : '—' }}</span>
@endif
</td>
<td class="px-3.5 py-2 text-right whitespace-nowrap">
@if($isEditing)
<button type="button" wire:click.stop="saveCreDebRow({{ $id }})" class="rounded bg-emerald-600 px-2.5 py-1 text-[11px] font-semibold text-white shadow-xs hover:bg-emerald-700">Salva</button>
<button type="button" wire:click.stop="cancelEditCreDebRow" class="rounded bg-slate-200 px-2 py-1 text-[11px] font-semibold text-slate-700 hover:bg-slate-300">Annulla</button>
<button type="button" wire:click.stop="deleteCreDebRow({{ $id }})" class="rounded bg-rose-600 px-2 py-1 text-[11px] font-semibold text-white hover:bg-rose-700">Elimina</button>
@else
<button type="button" wire:click.stop="editCreDebRow({{ $id }})" class="rounded border border-slate-300 bg-white px-2.5 py-1 text-[11px] font-semibold text-slate-700 hover:bg-slate-50">Modifica</button>
@endif
</td>
</tr>
@empty
<tr>
<td colspan="7" class="p-6 text-center text-xs text-slate-500">Nessun debito verso fornitori disponibile.</td>
</tr>
@endforelse
</tbody>
</table>
</div>
</div>
</div>
{{-- TAB: BILANCIO DI PARTENZA --}}
@else
@php
$baseParams = array_merge($query, ['tab' => 'dettaglio']);
$link = fn(string $dett) => \App\Filament\Pages\Contabilita\SituazioneIniziale::getUrl(panel: 'admin-filament', parameters: array_merge($baseParams, ['dett' => $dett]));
$saldoBancaTot = $bilancio['banca']['saldo_letto'] ?? null;
$saldoBancaTot = is_numeric($saldoBancaTot) ? (float) $saldoBancaTot : null;
$saldoBancaAtt = $saldoBancaTot !== null && $saldoBancaTot >= 0 ? $saldoBancaTot : null;
$saldoBancaPas = $saldoBancaTot !== null && $saldoBancaTot < 0 ? abs($saldoBancaTot) : null;
$delta = $bilancio['banca']['delta_letto'] ?? null;
$delta = is_numeric($delta) ? (float) $delta : null;
$mancanza = $delta !== null ? abs($delta) : null;
@endphp
<div class="space-y-5">
{{-- 1. SALDO BANCA E RISORSE FINANZIARIE --}}
<div class="rounded-xl border border-slate-200 bg-white p-5 shadow-xs">
<div class="flex items-center justify-between border-b border-slate-200 pb-3 mb-4">
<div class="flex items-center gap-2">
<span class="text-base">🏦</span>
<h3 class="text-sm font-bold text-slate-900 uppercase tracking-wide">Saldo Risorse Finanziarie / Banche alla Data</h3>
</div>
</div>
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
<div class="rounded-xl border border-emerald-200 bg-emerald-50/40 p-4">
<span class="text-xs font-bold text-emerald-900 uppercase tracking-wider">ATTIVITÀ (Saldo Attivo)</span>
<div class="mt-1 text-2xl font-bold font-mono text-emerald-800">{{ $saldoBancaAtt !== null ? '€ ' . $fmt($saldoBancaAtt) : '—' }}</div>
</div>
<div class="rounded-xl border border-rose-200 bg-rose-50/40 p-4">
<span class="text-xs font-bold text-rose-900 uppercase tracking-wider">PASSIVITÀ (Scoperto di Conto)</span>
<div class="mt-1 text-2xl font-bold font-mono text-rose-800">{{ $saldoBancaPas !== null ? '€ ' . $fmt($saldoBancaPas) : '—' }}</div>
</div>
<div class="md:col-span-2 mt-2">
<div class="text-xs font-semibold text-slate-600 mb-2 uppercase tracking-wider">Dettaglio Conti Correnti Bancari e Casse:</div>
<div class="overflow-x-auto rounded-lg border border-slate-200">
<table class="w-full text-left text-xs text-slate-700 divide-y divide-slate-200">
<thead class="bg-slate-50 text-[11px] font-bold uppercase tracking-wider text-slate-500">
<tr>
<th class="px-3.5 py-2">Conto / Cassa</th>
<th class="px-3.5 py-2 text-right">Saldo di Partenza</th>
</tr>
</thead>
<tbody class="divide-y divide-slate-100 bg-white">
@forelse(($risorseFinanziarie ?? []) as $r)
<tr class="hover:bg-slate-50 transition">
<td class="px-3.5 py-2 font-medium text-slate-800">🏛️ {{ $r['label'] }}</td>
<td class="px-3.5 py-2 text-right font-mono font-bold text-slate-900"> {{ $fmt($r['saldo'] ?? 0) }}</td>
</tr>
@empty
<tr>
<td colspan="2" class="p-4 text-center text-xs text-slate-500">Nessun conto bancario o cassa registrato per lo stabile.</td>
</tr>
@endforelse
</tbody>
</table>
</div>
<div class="mt-4 flex flex-wrap items-center justify-between gap-3 bg-slate-50 p-3 rounded-xl border border-slate-200 text-xs">
<div>FINANZIARIO (Attività - Passività): <strong class="font-mono text-slate-900"> {{ $fmt($bilancio['finanziario'] ?? 0) }}</strong></div>
<div>Delta Banca vs Finanziario: <strong class="font-mono text-slate-900"> {{ $delta !== null ? $fmt($delta) : '—' }}</strong></div>
@if ($delta !== null)
@if (abs($delta) <= 0.01)
<span class="rounded-full bg-emerald-100 text-emerald-800 font-bold px-3 py-1 text-xs border border-emerald-300">
Quadratura Finanziaria OK (0,00)
</span>
@else
<span class="rounded-full bg-amber-100 text-amber-800 font-bold px-3 py-1 text-xs border border-amber-300">
⚠️ Scostamento: {{ $fmt($mancanza) }}
</span>
@endif
@endif
</div>
</div>
</div>
</div>
{{-- 2. GESTIONE ORDINARIA --}}
<div class="rounded-xl border border-slate-200 bg-white p-5 shadow-xs">
<div class="flex items-center justify-between border-b border-slate-200 pb-3 mb-4">
<div class="flex items-center gap-2">
<span class="text-base">🏢</span>
<h3 class="text-sm font-bold text-slate-900 uppercase tracking-wide">Gestione Ordinaria (Chiusa)</h3>
</div>
<span class="rounded-full bg-blue-50 text-blue-700 border border-blue-200 px-2.5 py-0.5 text-xs font-bold font-mono">CONG.O</span>
</div>
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
<div class="rounded-lg border border-slate-200 bg-slate-50/50 p-3.5 space-y-2 text-xs">
<span class="font-bold text-slate-700 uppercase tracking-wide block">ATTIVITÀ (Crediti verso Condomini / Terzi)</span>
<div class="flex items-center justify-between bg-white p-2.5 rounded-lg border border-slate-200">
<span class="text-slate-600">Conguagli da Incassare (+)</span>
<a class="font-mono font-bold text-indigo-600 hover:underline" href="{{ $link('cong_pos_ordinaria') }}"> {{ $fmt($bilancio['ordinaria']['cong_pos'] ?? 0) }}</a>
</div>
<div class="flex items-center justify-between bg-white p-2.5 rounded-lg border border-slate-200">
<span class="text-slate-600">Crediti Pregressi</span>
<a class="font-mono font-bold text-indigo-600 hover:underline" href="{{ $link('crediti_ordinaria') }}"> {{ $fmt($bilancio['ordinaria']['crediti'] ?? 0) }}</a>
</div>
</div>
<div class="rounded-lg border border-slate-200 bg-slate-50/50 p-3.5 space-y-2 text-xs">
<span class="font-bold text-slate-700 uppercase tracking-wide block">PASSIVITÀ (Debiti verso Condomini / Fornitori)</span>
<div class="flex items-center justify-between bg-white p-2.5 rounded-lg border border-slate-200">
<span class="text-slate-600">Conguagli da Rimborsare (-)</span>
<a class="font-mono font-bold text-rose-600 hover:underline" href="{{ $link('cong_neg_ordinaria') }}"> {{ $fmt($bilancio['ordinaria']['cong_neg'] ?? 0) }}</a>
</div>
<div class="flex items-center justify-between bg-white p-2.5 rounded-lg border border-slate-200">
<span class="text-slate-600">Debiti verso Fornitori</span>
<a class="font-mono font-bold text-rose-600 hover:underline" href="{{ $link('debiti_ordinaria') }}"> {{ $fmt($bilancio['ordinaria']['debiti'] ?? 0) }}</a>
</div>
<div class="flex items-center justify-between bg-white p-2.5 rounded-lg border border-slate-200">
<span class="text-slate-600">Fondi Accantonati</span>
<span class="font-mono font-bold text-slate-900"> {{ $fmt($bilancio['ordinaria']['fondi'] ?? 0) }}</span>
</div>
</div>
</div>
</div>
{{-- 3. GESTIONE RISCALDAMENTO --}}
<div class="rounded-xl border border-slate-200 bg-white p-5 shadow-xs">
<div class="flex items-center justify-between border-b border-slate-200 pb-3 mb-4">
<div class="flex items-center gap-2">
<span class="text-base">♨️</span>
<h3 class="text-sm font-bold text-slate-900 uppercase tracking-wide">Gestione Riscaldamento (Chiusa)</h3>
</div>
<span class="rounded-full bg-amber-50 text-amber-700 border border-amber-200 px-2.5 py-0.5 text-xs font-bold font-mono">CONG.R</span>
</div>
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
<div class="rounded-lg border border-slate-200 bg-slate-50/50 p-3.5 space-y-2 text-xs">
<span class="font-bold text-slate-700 uppercase tracking-wide block">ATTIVITÀ</span>
<div class="flex items-center justify-between bg-white p-2.5 rounded-lg border border-slate-200">
<span class="text-slate-600">Conguagli da Incassare (+)</span>
<a class="font-mono font-bold text-indigo-600 hover:underline" href="{{ $link('cong_pos_riscaldamento') }}"> {{ $fmt($bilancio['riscaldamento']['cong_pos'] ?? 0) }}</a>
</div>
<div class="flex items-center justify-between bg-white p-2.5 rounded-lg border border-slate-200">
<span class="text-slate-600">Crediti</span>
<a class="font-mono font-bold text-indigo-600 hover:underline" href="{{ $link('crediti_riscaldamento') }}"> {{ $fmt($bilancio['riscaldamento']['crediti'] ?? 0) }}</a>
</div>
</div>
<div class="rounded-lg border border-slate-200 bg-slate-50/50 p-3.5 space-y-2 text-xs">
<span class="font-bold text-slate-700 uppercase tracking-wide block">PASSIVITÀ</span>
<div class="flex items-center justify-between bg-white p-2.5 rounded-lg border border-slate-200">
<span class="text-slate-600">Conguagli da Rimborsare (-)</span>
<a class="font-mono font-bold text-rose-600 hover:underline" href="{{ $link('cong_neg_riscaldamento') }}"> {{ $fmt($bilancio['riscaldamento']['cong_neg'] ?? 0) }}</a>
</div>
<div class="flex items-center justify-between bg-white p-2.5 rounded-lg border border-slate-200">
<span class="text-slate-600">Debiti</span>
<a class="font-mono font-bold text-rose-600 hover:underline" href="{{ $link('debiti_riscaldamento') }}"> {{ $fmt($bilancio['riscaldamento']['debiti'] ?? 0) }}</a>
</div>
</div>
</div>
</div>
{{-- 4. GESTIONI LAVORI STRAORDINARI PLURIENNALI APERTI --}}
<div class="rounded-xl border border-slate-200 bg-white p-5 shadow-xs">
<div class="flex items-center justify-between border-b border-slate-200 pb-3 mb-4">
<div class="flex items-center gap-2">
<span class="text-base">🏗️</span>
<h3 class="text-sm font-bold text-slate-900 uppercase tracking-wide">Gestioni Lavori Straordinari Pluriennali (Aperti)</h3>
</div>
<span class="rounded-full bg-purple-50 text-purple-700 border border-purple-200 px-2.5 py-0.5 text-xs font-bold font-mono">CONG.S / L*.ST</span>
</div>
<div class="space-y-3">
@forelse(($bilancio['straordinarie'] ?? []) as $straKey => $row)
<div class="rounded-xl border border-purple-200 bg-purple-50/20 p-4">
<div class="font-bold text-purple-950 text-xs uppercase tracking-wide mb-3">
{{ $row['label'] ?? $row['titolo'] ?? ('Straordinaria #' . ($row['n_stra'] ?? $straKey)) }}
</div>
<div class="grid grid-cols-1 md:grid-cols-2 gap-3 text-xs">
<div class="bg-white p-3 rounded-lg border border-purple-100 space-y-1.5">
<span class="font-semibold text-slate-700 block">ATTIVITÀ:</span>
<div class="flex items-center justify-between">
<span class="text-slate-500">Conguagli (+)</span>
<a class="font-mono font-bold text-indigo-600 hover:underline" href="{{ $link('cong_pos_stra_' . ($row['key'] ?? $straKey)) }}"> {{ $fmt($row['cong_pos'] ?? 0) }}</a>
</div>
<div class="flex items-center justify-between">
<span class="text-slate-500">Crediti</span>
<a class="font-mono font-bold text-indigo-600 hover:underline" href="{{ $link('crediti_stra_' . ($row['key'] ?? $straKey)) }}"> {{ $fmt($row['crediti'] ?? 0) }}</a>
</div>
</div>
<div class="bg-white p-3 rounded-lg border border-purple-100 space-y-1.5">
<span class="font-semibold text-slate-700 block">PASSIVITÀ:</span>
<div class="flex items-center justify-between">
<span class="text-slate-500">Conguagli (-)</span>
<a class="font-mono font-bold text-rose-600 hover:underline" href="{{ $link('cong_neg_stra_' . ($row['key'] ?? $straKey)) }}"> {{ $fmt($row['cong_neg'] ?? 0) }}</a>
</div>
<div class="flex items-center justify-between">
<span class="text-slate-500">Debiti</span>
<a class="font-mono font-bold text-rose-600 hover:underline" href="{{ $link('debiti_stra_' . ($row['key'] ?? $straKey)) }}"> {{ $fmt($row['debiti'] ?? 0) }}</a>
</div>
</div>
</div>
</div>
@empty
<div class="p-6 text-center text-xs text-slate-500">Nessuna gestione straordinaria aperta rilevata.</div>
@endforelse
</div>
</div>
{{-- 5. TOTALI GENERALI STABILE --}}
<div class="rounded-xl border border-slate-300 bg-slate-900 text-white p-5 shadow-sm">
<div class="flex items-center justify-between border-b border-slate-700 pb-3 mb-4">
<div class="flex items-center gap-2">
<span class="text-base">⚖️</span>
<h3 class="text-sm font-bold uppercase tracking-wider">Totali Generali di Bilancio Iniziale (Stabile)</h3>
</div>
</div>
<div class="grid grid-cols-1 md:grid-cols-3 gap-4 text-center">
<div class="bg-slate-800/80 p-4 rounded-xl border border-slate-700">
<span class="text-xs text-emerald-400 font-bold uppercase tracking-wider block">TOTALE ATTIVITÀ</span>
<div class="mt-1 text-2xl font-bold font-mono text-white"> {{ $fmt($bilancio['tot_attivita'] ?? 0) }}</div>
</div>
<div class="bg-slate-800/80 p-4 rounded-xl border border-slate-700">
<span class="text-xs text-rose-400 font-bold uppercase tracking-wider block">TOTALE PASSIVITÀ</span>
<div class="mt-1 text-2xl font-bold font-mono text-white"> {{ $fmt($bilancio['tot_passivita'] ?? 0) }}</div>
</div>
<div class="bg-slate-800/80 p-4 rounded-xl border border-slate-700">
<span class="text-xs text-indigo-400 font-bold uppercase tracking-wider block">FINANZIARIO (ATT - PASS)</span>
<div class="mt-1 text-2xl font-bold font-mono text-white"> {{ $fmt($bilancio['finanziario'] ?? 0) }}</div>
</div>
</div>
</div>
</div>
@endif
</div>
</x-filament-panels::page>