1917 lines
158 KiB
PHP
Executable File
1917 lines
158 KiB
PHP
Executable File
<x-filament-panels::page>
|
|
<div class="w-full max-w-full space-y-4 px-2 lg:px-6">
|
|
{{-- BARRA NAVIGAZIONE UNIFICATA E COMPATTA --}}
|
|
<div class="mb-2 flex flex-wrap items-center justify-between gap-2 rounded-xl border border-slate-200 bg-white/80 p-2 shadow-xs backdrop-blur-xs">
|
|
<div class="flex flex-wrap items-center gap-1.5">
|
|
<a href="{{ \App\Filament\Pages\Gescon\StabiliArchivio::getUrl(panel: 'admin-filament') }}"
|
|
class="inline-flex items-center gap-1.5 rounded-lg border border-slate-200 bg-slate-50 px-2.5 py-1.5 text-xs font-semibold text-slate-700 transition hover:bg-slate-100 hover:text-slate-900">
|
|
<span>🏢</span>
|
|
<span>Elenco Stabili</span>
|
|
</a>
|
|
<a href="{{ \App\Filament\Pages\Condomini\NominativiStabile::getUrl(panel: 'admin-filament') }}"
|
|
class="inline-flex items-center gap-1.5 rounded-lg border border-slate-200 bg-slate-50 px-2.5 py-1.5 text-xs font-semibold text-slate-700 transition hover:bg-slate-100 hover:text-slate-900">
|
|
<span>👥</span>
|
|
<span>Elenco Nominativi</span>
|
|
</a>
|
|
<a href="{{ \App\Filament\Pages\UnitaImmobiliarePage::getUrl(panel: 'admin-filament') }}"
|
|
class="inline-flex items-center gap-1.5 rounded-lg border border-indigo-200 bg-indigo-50 px-2.5 py-1.5 text-xs font-semibold text-indigo-700 shadow-xs ring-2 ring-indigo-500/20">
|
|
<span>🏠</span>
|
|
<span>Unità Immobiliare</span>
|
|
</a>
|
|
<a href="{{ \App\Filament\Pages\Condomini\TabelleMillesimaliArchivio::getUrl(panel: 'admin-filament') }}"
|
|
class="inline-flex items-center gap-1.5 rounded-lg border border-slate-200 bg-slate-50 px-2.5 py-1.5 text-xs font-semibold text-slate-700 transition hover:bg-slate-100 hover:text-slate-900">
|
|
<span>📐</span>
|
|
<span>Millesimi</span>
|
|
</a>
|
|
<a href="{{ \App\Filament\Pages\Condomini\CatastoHub::getUrl(panel: 'admin-filament') }}"
|
|
class="inline-flex items-center gap-1.5 rounded-lg border border-slate-200 bg-slate-50 px-2.5 py-1.5 text-xs font-semibold text-slate-700 transition hover:bg-slate-100 hover:text-slate-900">
|
|
<span>🏛️</span>
|
|
<span>Catasto</span>
|
|
</a>
|
|
</div>
|
|
</div>
|
|
|
|
@php
|
|
$unitaOptions = $this->getUnitaOptions();
|
|
$prevUrl = $this->getPrevUnitaUrl();
|
|
$nextUrl = $this->getNextUnitaUrl();
|
|
$visibilityOptions = [
|
|
'attive' => 'Attive',
|
|
'tutte' => 'Tutte',
|
|
'archiviate' => 'Archiviate',
|
|
];
|
|
@endphp
|
|
|
|
{{-- CONTROLLI COMPATTI SELEZIONE UNITÀ & PULSANTI RUOLO CONDOMINO / INQUILINO --}}
|
|
<div class="mb-3 flex flex-wrap items-center justify-between gap-3 rounded-xl border border-slate-200 bg-white p-2.5 shadow-xs">
|
|
<div class="flex flex-wrap items-center gap-2.5">
|
|
<a href="{{ $this->getBackUrl() }}" class="inline-flex items-center gap-1 rounded-lg border border-slate-200 bg-slate-50 px-2.5 py-1 text-xs font-semibold text-slate-600 transition hover:bg-slate-100 hover:text-slate-900">
|
|
<span>←</span>
|
|
<span>Torna indietro</span>
|
|
</a>
|
|
<span class="text-slate-300">|</span>
|
|
|
|
<div class="flex items-center gap-1.5">
|
|
@if($prevUrl)
|
|
<a class="inline-flex items-center justify-center rounded-lg border border-slate-200 bg-slate-50 px-2.5 py-1 text-xs font-semibold text-slate-700 transition hover:bg-slate-100" href="{{ $prevUrl }}">← Prec.</a>
|
|
@else
|
|
<span class="inline-flex items-center justify-center rounded-lg border border-slate-200 bg-slate-50 px-2.5 py-1 text-xs font-semibold text-slate-400 opacity-50">← Prec.</span>
|
|
@endif
|
|
|
|
<div class="min-w-64 max-w-xl">
|
|
{{ $this->getSchema('unitaPicker') }}
|
|
</div>
|
|
|
|
@if($nextUrl)
|
|
<a class="inline-flex items-center justify-center rounded-lg border border-slate-200 bg-slate-50 px-2.5 py-1 text-xs font-semibold text-slate-700 transition hover:bg-slate-100" href="{{ $nextUrl }}">Succ. →</a>
|
|
@else
|
|
<span class="inline-flex items-center justify-center rounded-lg border border-slate-200 bg-slate-50 px-2.5 py-1 text-xs font-semibold text-slate-400 opacity-50">Succ. →</span>
|
|
@endif
|
|
</div>
|
|
|
|
{{-- SELETTORE ESPLICITO RUOLO CONDOMINO / INQUILINO --}}
|
|
<div class="flex items-center gap-1 rounded-lg border border-slate-200 bg-slate-100 p-1">
|
|
<button type="button" wire:click="setCondInquilActive('C')"
|
|
class="inline-flex items-center gap-1.5 rounded-md px-3 py-1 text-xs font-bold transition {{ ($condInquilActive ?? 'C') === 'C' ? 'bg-amber-600 text-white shadow-xs' : 'text-slate-600 hover:text-slate-900' }}">
|
|
<span>🏢</span>
|
|
<span>Condomino (Proprietari)</span>
|
|
</button>
|
|
<button type="button" wire:click="setCondInquilActive('I')"
|
|
class="inline-flex items-center gap-1.5 rounded-md px-3 py-1 text-xs font-bold transition {{ ($condInquilActive ?? 'C') === 'I' ? 'bg-indigo-600 text-white shadow-xs' : 'text-slate-600 hover:text-slate-900' }}">
|
|
<span>👤</span>
|
|
<span>Inquilino</span>
|
|
</button>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="flex flex-wrap items-center gap-2">
|
|
<span class="text-xs font-medium text-slate-500">Vista:</span>
|
|
<button
|
|
type="button"
|
|
wire:click="toggleMostraStorico"
|
|
class="rounded-lg border px-2.5 py-1 text-xs font-semibold transition {{ $mostraStorico ? 'border-amber-300 bg-amber-50 text-amber-700 shadow-xs' : 'border-slate-200 bg-slate-50 text-slate-700 hover:bg-slate-100' }}">
|
|
{{ $mostraStorico ? 'Mostra storico (Attivo)' : 'Solo gestione selezionata' }}
|
|
</button>
|
|
<span class="text-xs font-medium text-slate-500 ml-1">Visibilità:</span>
|
|
@foreach($visibilityOptions as $key => $label)
|
|
<button
|
|
type="button"
|
|
wire:click="setUnitaVisibilita('{{ $key }}')"
|
|
class="rounded-lg border px-2.5 py-1 text-xs font-semibold transition {{ $this->unitaVisibilita === $key ? 'border-indigo-300 bg-indigo-50 text-indigo-700 shadow-xs' : 'border-slate-200 bg-slate-50 text-slate-700 hover:bg-slate-100' }}">
|
|
{{ $label }}
|
|
</button>
|
|
@endforeach
|
|
</div>
|
|
</div>
|
|
|
|
@if(!$unita)
|
|
<div class="rounded-xl border border-dashed border-gray-200 bg-white p-6 text-center text-gray-500">Nessuna unità immobiliare trovata.</div>
|
|
@else
|
|
|
|
{{-- Tabs + contenuto --}}
|
|
<x-filament::section class="p-0! overflow-hidden">
|
|
<div class="flex flex-wrap items-center gap-2 px-4 py-2 bg-white border-b">
|
|
@php
|
|
$tabs = [
|
|
'riepilogo' => ['icon' => 'heroicon-o-rectangle-group', 'label' => 'Riepilogo'],
|
|
'nominativi' => ['icon' => 'heroicon-o-user-group', 'label' => '👥 Nominativi & Subentri'],
|
|
'estratto_conto' => ['icon' => 'heroicon-o-calculator', 'label' => '🧾 Estratto Conto & Pagamenti'],
|
|
'millesimi' => ['icon' => 'heroicon-o-chart-pie', 'label' => '📊 Tabelle Millesimali & Spese'],
|
|
'preferenze' => ['icon' => 'heroicon-o-envelope', 'label' => '📨 Comunicazioni & Protocollo'],
|
|
'acqua' => ['icon' => 'heroicon-o-beaker', 'label' => '💧 Acqua'],
|
|
];
|
|
@endphp
|
|
@foreach($tabs as $key => $cfg)
|
|
<button
|
|
type="button"
|
|
wire:click="setTab('{{ $key }}')"
|
|
class="inline-flex items-center gap-2 rounded-lg border px-3 py-2 text-sm font-semibold transition
|
|
{{ $tab === $key ? 'border-primary-300 bg-primary-50 text-primary-700 shadow-sm' : 'border-transparent bg-gray-50 text-gray-700 hover:border-gray-200' }}">
|
|
<x-filament::icon :icon="$cfg['icon']" class="h-4 w-4" />
|
|
<span>{{ $cfg['label'] }}</span>
|
|
</button>
|
|
@endforeach
|
|
</div>
|
|
|
|
<div class="p-4 space-y-4">
|
|
@if($tab === 'riepilogo')
|
|
{{-- Header compatto dell'Unità Immobiliare --}}
|
|
<x-filament::section class="p-4! mb-4">
|
|
@php
|
|
$isArchivedUnita = method_exists($unita, 'trashed') && $unita->trashed();
|
|
$labelUnita = (string) ($unita->denominazione ?? '');
|
|
if ($labelUnita !== '' && preg_match('/^\s*area\s+condominiale\s*$/i', $labelUnita)) {
|
|
$labelUnita = '';
|
|
}
|
|
$condominoDaCondomin = trim((string) ($this->getLegacyCondominoRiferimentoNome() ?? ''));
|
|
$proprietariAttivi = collect($relazioniPerTipo['proprietari'] ?? []);
|
|
$condominoRiferimento = $proprietariAttivi
|
|
->first(fn (array $relazione): bool => strtolower(trim((string) ($relazione['tipo_raw'] ?? ''))) !== 'comproprietario')
|
|
?? ($relazioniPerTipo['proprietari'][0] ?? null);
|
|
$condominoNome = $condominoDaCondomin !== ''
|
|
? $condominoDaCondomin
|
|
: (string) ($condominoRiferimento['nome'] ?? '');
|
|
$condominoCf = trim((string) ($this->getLegacyCondominoRiferimentoCodiceFiscale() ?? ''));
|
|
if ($condominoCf === '') {
|
|
$condominoCf = (string) ($condominoRiferimento['codice_fiscale'] ?? '');
|
|
}
|
|
$inquilinoNome = (string) ($relazioniPerTipo['inquilini'][0]['nome'] ?? '');
|
|
$comproprietariCount = $proprietariAttivi
|
|
->filter(fn (array $relazione): bool => strtolower(trim((string) ($relazione['tipo_raw'] ?? ''))) === 'comproprietario')
|
|
->count();
|
|
$hasInquilino = !empty($relazioniPerTipo['inquilini'][0]['nome'] ?? null);
|
|
@endphp
|
|
|
|
<div class="flex items-start justify-between gap-4 flex-wrap">
|
|
<div class="space-y-1">
|
|
<div class="flex flex-wrap items-center gap-3 text-lg font-semibold text-gray-900">
|
|
<x-filament::icon icon="heroicon-o-home-modern" class="h-5 w-5 text-primary-600" />
|
|
<span class="text-primary-700 font-bold">Unità immobiliare {{ $unita->codice_unita ?? $unita->codice_completo }}</span>
|
|
@if($isArchivedUnita)
|
|
<span class="rounded-full border border-amber-300 bg-amber-50 px-2 py-0.5 text-xs font-semibold text-amber-700">Archiviata</span>
|
|
@endif
|
|
</div>
|
|
|
|
<div class="flex items-center gap-2 text-sm text-gray-800 mt-2">
|
|
<span class="inline-flex items-center rounded bg-emerald-100 px-2 py-0.5 text-xs font-bold text-emerald-800">C</span>
|
|
<span class="font-semibold">Condomino:</span>
|
|
<span class="font-bold text-indigo-900">{{ $condominoNome !== '' ? trim(str_replace([' - ', ' 0 ', ' 0', '-'], [' ', ' ', ' ', ' '], $condominoNome)) : '—' }}</span>
|
|
</div>
|
|
|
|
@if($comproprietariCount > 0)
|
|
<div class="text-xs text-gray-500 pl-6">Comproprietari collegati: {{ $comproprietariCount }}</div>
|
|
@endif
|
|
|
|
<div class="flex items-center gap-2 text-sm text-gray-800 mt-1">
|
|
<span class="inline-flex items-center rounded bg-sky-100 px-2 py-0.5 text-xs font-bold text-sky-800">I</span>
|
|
<span class="font-semibold">Inquilino:</span>
|
|
<span class="font-bold text-slate-800">{{ $inquilinoNome !== '' ? trim(str_replace([' - ', ' 0 ', ' 0', '-'], [' ', ' ', ' ', ' '], $inquilinoNome)) : '—' }}</span>
|
|
</div>
|
|
|
|
<div class="text-xs text-gray-600 mt-1">📍 {{ trim(($unita->indirizzo ?? '').' Scala '.($unita->scala ?? '').' Int. '.($unita->interno ?? '').' '.($unita->comune ?? '')) }}</div>
|
|
|
|
<div class="mt-3 pt-2 border-t border-gray-100">
|
|
<a href="/admin-filament/condomini/catasto-hub?unita_id={{ $unita->id }}" class="inline-flex items-center gap-2 rounded-lg bg-indigo-700 hover:bg-indigo-800 text-white font-semibold px-3.5 py-1.5 text-xs shadow-xs transition">
|
|
<span>🏛️</span>
|
|
<span>[ Apri in HUB Catasto ]</span>
|
|
</a>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="grid gap-3 sm:grid-cols-2 min-w-80">
|
|
<div class="rounded-xl border border-slate-200 bg-slate-50 p-3.5">
|
|
<div class="text-xs font-semibold text-slate-500">🏢 Condomino di riferimento</div>
|
|
<div class="text-sm font-bold text-slate-900 mt-1">{{ $condominoNome !== '' ? $condominoNome : '—' }}</div>
|
|
<div class="text-xs font-mono text-slate-600 mt-0.5">CF: {{ $condominoCf !== '' ? $condominoCf : '—' }}</div>
|
|
</div>
|
|
<div class="rounded-xl border border-slate-200 bg-slate-50 p-3.5 {{ $hasInquilino ? '' : 'opacity-60' }}">
|
|
<div class="text-xs font-semibold text-slate-500">👤 Inquilino</div>
|
|
<div class="text-sm font-bold text-slate-900 mt-1">{{ $inquilinoNome !== '' ? $inquilinoNome : '—' }}</div>
|
|
<div class="text-xs font-mono text-slate-600 mt-0.5">CF: {{ $relazioniPerTipo['inquilini'][0]['codice_fiscale'] ?? '—' }}</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</x-filament::section>
|
|
|
|
{{-- 1. SCHEDE ANAGRAFICHE SOGGETTI ATTIVI & IDENTIFICAZIONE COMPATTA --}}
|
|
<div class="grid gap-4 md:grid-cols-2 lg:grid-cols-3">
|
|
{{-- Card Condomino / Proprietario Attivo --}}
|
|
<div class="rounded-xl border border-indigo-100 bg-white p-4 shadow-xs">
|
|
<div class="flex items-center justify-between border-b border-indigo-50 pb-2 mb-3">
|
|
<div class="flex items-center gap-2">
|
|
<span class="inline-flex h-7 w-7 items-center justify-center rounded-lg bg-indigo-100 text-sm font-bold text-indigo-800">🏢</span>
|
|
<span class="text-xs font-bold uppercase tracking-wider text-indigo-900">Condomino (Proprietario)</span>
|
|
</div>
|
|
<span class="rounded-full bg-emerald-50 border border-emerald-200 px-2 py-0.5 text-[10px] font-bold text-emerald-700">🟢 In Carica</span>
|
|
</div>
|
|
|
|
<div class="space-y-1.5">
|
|
<div class="text-base font-bold text-gray-900 leading-snug">
|
|
{{ $condominoNome !== '' ? $condominoNome : '—' }}
|
|
</div>
|
|
<div class="text-xs font-mono text-gray-600">
|
|
CF: <strong>{{ $condominoCf !== '' ? $condominoCf : '—' }}</strong>
|
|
</div>
|
|
<div class="flex items-center gap-2 text-xs text-gray-600 pt-1">
|
|
<span class="rounded bg-indigo-50 text-indigo-700 font-semibold px-2 py-0.5">
|
|
Quota: {{ $relazioniPerTipo['proprietari'][0]['quota_label'] ?? '100,00' }}%
|
|
</span>
|
|
@if($comproprietariCount > 0)
|
|
<span class="rounded bg-amber-50 text-amber-800 font-semibold px-2 py-0.5">
|
|
+{{ $comproprietariCount }} comproprietari
|
|
</span>
|
|
@endif
|
|
</div>
|
|
<div class="text-xs text-gray-500 pt-1">
|
|
Validità: <strong class="text-gray-700">{{ $relazioniPerTipo['proprietari'][0]['data_inizio'] ?? 'Gestione attiva' }}</strong>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
{{-- Card Inquilino / Conduttore Attivo --}}
|
|
<div class="rounded-xl border border-sky-100 bg-white p-4 shadow-xs">
|
|
<div class="flex items-center justify-between border-b border-sky-50 pb-2 mb-3">
|
|
<div class="flex items-center gap-2">
|
|
<span class="inline-flex h-7 w-7 items-center justify-center rounded-lg bg-sky-100 text-sm font-bold text-sky-800">👤</span>
|
|
<span class="text-xs font-bold uppercase tracking-wider text-sky-900">Inquilino (Conduttore)</span>
|
|
</div>
|
|
@if($hasInquilino)
|
|
<span class="rounded-full bg-sky-50 border border-sky-200 px-2 py-0.5 text-[10px] font-bold text-sky-700">Locazione attiva</span>
|
|
@else
|
|
<span class="rounded-full bg-gray-100 text-gray-500 px-2 py-0.5 text-[10px] font-medium">Nessun inquilino</span>
|
|
@endif
|
|
</div>
|
|
|
|
<div class="space-y-1.5">
|
|
<div class="text-base font-bold text-gray-900 leading-snug">
|
|
{{ $inquilinoNome !== '' ? $inquilinoNome : 'Nessun inquilino registrato' }}
|
|
</div>
|
|
<div class="text-xs font-mono text-gray-600">
|
|
CF: <strong>{{ $relazioniPerTipo['inquilini'][0]['codice_fiscale'] ?? '—' }}</strong>
|
|
</div>
|
|
@if($hasInquilino)
|
|
<div class="flex items-center gap-2 text-xs text-gray-600 pt-1">
|
|
<span class="rounded bg-sky-50 text-sky-700 font-semibold px-2 py-0.5">
|
|
Spese: {{ $relazioniPerTipo['inquilini'][0]['quota_label'] ?? '100,00' }}%
|
|
</span>
|
|
</div>
|
|
<div class="text-xs text-gray-500 pt-1">
|
|
Subentro: <strong class="text-gray-700">{{ $relazioniPerTipo['inquilini'][0]['data_inizio'] ?? '—' }}</strong>
|
|
</div>
|
|
@else
|
|
<div class="text-xs text-gray-400 italic pt-2">
|
|
L'unità risulta occupata direttamente dal proprietario.
|
|
</div>
|
|
@endif
|
|
</div>
|
|
</div>
|
|
|
|
{{-- Card Dati Catastali & Identificazione Immobile --}}
|
|
<div class="rounded-xl border border-slate-200 bg-slate-50/70 p-4 shadow-xs">
|
|
<div class="flex items-center justify-between border-b border-slate-200 pb-2 mb-3">
|
|
<div class="flex items-center gap-2">
|
|
<span class="inline-flex h-7 w-7 items-center justify-center rounded-lg bg-slate-200 text-sm font-bold text-slate-800">🏛️</span>
|
|
<span class="text-xs font-bold uppercase tracking-wider text-slate-700">Dati Catasto & Immobile</span>
|
|
</div>
|
|
<span class="font-mono text-xs font-bold text-indigo-700">Sub. {{ $unita->subalterno ?: '—' }}</span>
|
|
</div>
|
|
|
|
<div class="space-y-1.5 text-xs">
|
|
<div class="flex items-center justify-between text-gray-600">
|
|
<span>Tipologia:</span>
|
|
<strong class="text-gray-900 capitalize">{{ $unita->tipo_unita ?? 'Abitazione' }}</strong>
|
|
</div>
|
|
<div class="flex items-center justify-between text-gray-600">
|
|
<span>Categoria & Rendita:</span>
|
|
<strong class="text-gray-900">{{ $unita->categoria_catastale ?: '—' }} · € {{ number_format((float)($unita->rendita_catastale ?? 0), 2, ',', '.') }}</strong>
|
|
</div>
|
|
<div class="flex items-center justify-between text-gray-600">
|
|
<span>Foglio / Particella:</span>
|
|
<strong class="text-gray-900">Fg. {{ $unita->foglio ?: ($unita->stabile?->foglio ?: '—') }} / Part. {{ $unita->particella ?: ($unita->stabile?->particella_catasto ?: '—') }}</strong>
|
|
</div>
|
|
<div class="flex items-center justify-between text-gray-600">
|
|
<span>Posizione fabbricato:</span>
|
|
<strong class="text-gray-900">Scala {{ $unita->scala ?: '—' }} · Int. {{ $unita->interno ?: '—' }} · Piano {{ $unita->piano ?: '—' }}</strong>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
{{-- 2. SEZIONE RECAPITI MULTICANALE DINAMICI (MATRICE ATOMICA DIVISA COND/INQ + AGGREGATA) --}}
|
|
@php
|
|
$multiRecapiti = $this->getRecapitiMulticanaleTableProperty();
|
|
$recapitiCondomino = array_values(array_filter($multiRecapiti, fn($r) => ($r['tipo_soggetto'] ?? 'condomino') === 'condomino'));
|
|
$recapitiInquilino = array_values(array_filter($multiRecapiti, fn($r) => ($r['tipo_soggetto'] ?? '') === 'inquilino'));
|
|
$currentRecapitiMode = $this->recapitiViewMode ?? 'diviso';
|
|
@endphp
|
|
|
|
<div class="rounded-xl border border-gray-200 bg-white shadow-xs overflow-hidden mt-4">
|
|
<div class="flex flex-col sm:flex-row sm:items-center sm:justify-between bg-gray-50/80 px-4 py-3 border-b border-gray-200 gap-3">
|
|
<div class="flex items-center gap-2">
|
|
<span class="text-base">📱</span>
|
|
<div>
|
|
<div class="text-sm font-bold text-gray-900">Recapiti Multicanale Dinamici dell'Unità</div>
|
|
<div class="text-[11px] text-gray-500">Email, PEC, cellulari, telefoni e recapiti postali divisi per Condomino e Inquilino</div>
|
|
</div>
|
|
</div>
|
|
|
|
{{-- Selettore Vista Atomica / Aggregata --}}
|
|
<div class="flex items-center gap-1.5 bg-white border border-gray-200 p-1 rounded-lg">
|
|
<button type="button"
|
|
wire:click="setRecapitiViewMode('diviso')"
|
|
class="px-2.5 py-1 text-xs font-semibold rounded-md transition {{ $currentRecapitiMode === 'diviso' ? 'bg-indigo-600 text-white shadow-xs' : 'text-gray-600 hover:text-gray-900 hover:bg-gray-100' }}">
|
|
📊 Diviso per Soggetto
|
|
</button>
|
|
<button type="button"
|
|
wire:click="setRecapitiViewMode('condomino')"
|
|
class="px-2.5 py-1 text-xs font-semibold rounded-md transition {{ $currentRecapitiMode === 'condomino' ? 'bg-amber-500 text-white shadow-xs' : 'text-gray-600 hover:text-gray-900 hover:bg-gray-100' }}">
|
|
🏢 Condomino ({{ count($recapitiCondomino) }})
|
|
</button>
|
|
<button type="button"
|
|
wire:click="setRecapitiViewMode('inquilino')"
|
|
class="px-2.5 py-1 text-xs font-semibold rounded-md transition {{ $currentRecapitiMode === 'inquilino' ? 'bg-indigo-500 text-white shadow-xs' : 'text-gray-600 hover:text-gray-900 hover:bg-gray-100' }}">
|
|
👤 Inquilino ({{ count($recapitiInquilino) }})
|
|
</button>
|
|
<button type="button"
|
|
wire:click="setRecapitiViewMode('tutti')"
|
|
class="px-2.5 py-1 text-xs font-semibold rounded-md transition {{ $currentRecapitiMode === 'tutti' ? 'bg-slate-700 text-white shadow-xs' : 'text-gray-600 hover:text-gray-900 hover:bg-gray-100' }}">
|
|
🌐 Tutti ({{ count($multiRecapiti) }})
|
|
</button>
|
|
</div>
|
|
</div>
|
|
|
|
@if(empty($multiRecapiti))
|
|
<div class="p-6 text-center text-xs text-gray-500">
|
|
Nessun recapito multicanale o contatto registrato per i soggetti di questa unità.
|
|
</div>
|
|
@else
|
|
{{-- VISTA 1: DIVISO PER SOGGETTO (DUE SOTTO-TABELLE ATOMICHE) --}}
|
|
@if($currentRecapitiMode === 'diviso')
|
|
<div class="p-4 space-y-4">
|
|
{{-- SOTTO-TABELLA CONDOMINO --}}
|
|
<div class="rounded-lg border border-amber-200 bg-amber-50/20 overflow-hidden">
|
|
<div class="flex items-center justify-between px-3.5 py-2 bg-amber-50 border-b border-amber-200">
|
|
<div class="flex items-center gap-2">
|
|
<span class="text-sm">🏢</span>
|
|
<span class="text-xs font-bold text-amber-950 uppercase tracking-wide">Recapiti Condomino / Aventi Diritto</span>
|
|
</div>
|
|
<span class="rounded bg-amber-200/80 text-amber-900 font-bold px-2 py-0.5 text-[10px]">
|
|
{{ count($recapitiCondomino) }} canali
|
|
</span>
|
|
</div>
|
|
@if(empty($recapitiCondomino))
|
|
<div class="p-3 text-center text-xs text-gray-500">Nessun contatto registrato per il Condomino.</div>
|
|
@else
|
|
<div class="overflow-x-auto">
|
|
<table class="w-full text-left text-xs text-gray-700 divide-y divide-amber-100/60">
|
|
<thead class="bg-amber-50/50 text-[10px] font-bold uppercase tracking-wider text-amber-900/70">
|
|
<tr>
|
|
<th class="px-3.5 py-2">Canale</th>
|
|
<th class="px-3.5 py-2">Etichetta</th>
|
|
<th class="px-3.5 py-2">Soggetto</th>
|
|
<th class="px-3.5 py-2">Valore Contatto</th>
|
|
<th class="px-3.5 py-2 text-center">Stato</th>
|
|
<th class="px-3.5 py-2 text-right">Azione</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody class="divide-y divide-amber-100/60 bg-white">
|
|
@foreach($recapitiCondomino as $rec)
|
|
<tr class="hover:bg-amber-50/40 transition">
|
|
<td class="px-3.5 py-2 whitespace-nowrap">
|
|
<span class="inline-flex items-center gap-1.5 rounded-md border px-2 py-0.5 font-semibold text-[11px] {{ $rec['color'] }}">
|
|
<span>{{ $rec['icon'] }}</span>
|
|
<span>{{ $rec['canale'] }}</span>
|
|
</span>
|
|
</td>
|
|
<td class="px-3.5 py-2 font-medium text-gray-800 whitespace-nowrap">{{ $rec['etichetta'] }}</td>
|
|
<td class="px-3.5 py-2 whitespace-nowrap">
|
|
<span class="font-bold text-gray-900">{{ $rec['soggetto'] }}</span>
|
|
<span class="text-gray-400 font-normal">({{ $rec['ruolo'] }})</span>
|
|
</td>
|
|
<td class="px-3.5 py-2 font-mono text-gray-900 font-medium">{{ $rec['valore'] }}</td>
|
|
<td class="px-3.5 py-2 text-center whitespace-nowrap">
|
|
@if($rec['is_principal'])
|
|
<span class="rounded bg-emerald-100 text-emerald-800 px-1.5 py-0.5 text-[10px] font-bold">★ Principale</span>
|
|
@else
|
|
<span class="text-gray-400 text-[11px]">—</span>
|
|
@endif
|
|
</td>
|
|
<td class="px-3.5 py-2 text-right whitespace-nowrap">
|
|
@if(!empty($rec['action_url']))
|
|
<a href="{{ $rec['action_url'] }}" class="inline-flex items-center gap-1 rounded bg-amber-50 hover:bg-amber-100 border border-amber-200 text-amber-900 font-semibold px-2 py-0.5 text-[11px] transition">
|
|
<span>Apri</span>
|
|
</a>
|
|
@endif
|
|
</td>
|
|
</tr>
|
|
@endforeach
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
@endif
|
|
</div>
|
|
|
|
{{-- SOTTO-TABELLA INQUILINO --}}
|
|
<div class="rounded-lg border border-indigo-200 bg-indigo-50/20 overflow-hidden">
|
|
<div class="flex items-center justify-between px-3.5 py-2 bg-indigo-50 border-b border-indigo-200">
|
|
<div class="flex items-center gap-2">
|
|
<span class="text-sm">👤</span>
|
|
<span class="text-xs font-bold text-indigo-950 uppercase tracking-wide">Recapiti Inquilino / Conduttore</span>
|
|
</div>
|
|
<span class="rounded bg-indigo-200/80 text-indigo-900 font-bold px-2 py-0.5 text-[10px]">
|
|
{{ count($recapitiInquilino) }} canali
|
|
</span>
|
|
</div>
|
|
@if(empty($recapitiInquilino))
|
|
<div class="p-3 text-center text-xs text-gray-500">Nessun contatto o recapito registrato per l'Inquilino.</div>
|
|
@else
|
|
<div class="overflow-x-auto">
|
|
<table class="w-full text-left text-xs text-gray-700 divide-y divide-indigo-100/60">
|
|
<thead class="bg-indigo-50/50 text-[10px] font-bold uppercase tracking-wider text-indigo-900/70">
|
|
<tr>
|
|
<th class="px-3.5 py-2">Canale</th>
|
|
<th class="px-3.5 py-2">Etichetta</th>
|
|
<th class="px-3.5 py-2">Soggetto</th>
|
|
<th class="px-3.5 py-2">Valore Contatto</th>
|
|
<th class="px-3.5 py-2 text-center">Stato</th>
|
|
<th class="px-3.5 py-2 text-right">Azione</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody class="divide-y divide-indigo-100/60 bg-white">
|
|
@foreach($recapitiInquilino as $rec)
|
|
<tr class="hover:bg-indigo-50/40 transition">
|
|
<td class="px-3.5 py-2 whitespace-nowrap">
|
|
<span class="inline-flex items-center gap-1.5 rounded-md border px-2 py-0.5 font-semibold text-[11px] {{ $rec['color'] }}">
|
|
<span>{{ $rec['icon'] }}</span>
|
|
<span>{{ $rec['canale'] }}</span>
|
|
</span>
|
|
</td>
|
|
<td class="px-3.5 py-2 font-medium text-gray-800 whitespace-nowrap">{{ $rec['etichetta'] }}</td>
|
|
<td class="px-3.5 py-2 whitespace-nowrap">
|
|
<span class="font-bold text-gray-900">{{ $rec['soggetto'] }}</span>
|
|
<span class="text-gray-400 font-normal">({{ $rec['ruolo'] }})</span>
|
|
</td>
|
|
<td class="px-3.5 py-2 font-mono text-gray-900 font-medium">{{ $rec['valore'] }}</td>
|
|
<td class="px-3.5 py-2 text-center whitespace-nowrap">
|
|
@if($rec['is_principal'])
|
|
<span class="rounded bg-emerald-100 text-emerald-800 px-1.5 py-0.5 text-[10px] font-bold">★ Principale</span>
|
|
@else
|
|
<span class="text-gray-400 text-[11px]">—</span>
|
|
@endif
|
|
</td>
|
|
<td class="px-3.5 py-2 text-right whitespace-nowrap">
|
|
@if(!empty($rec['action_url']))
|
|
<a href="{{ $rec['action_url'] }}" class="inline-flex items-center gap-1 rounded bg-indigo-50 hover:bg-indigo-100 border border-indigo-200 text-indigo-700 font-semibold px-2 py-0.5 text-[11px] transition">
|
|
<span>Apri</span>
|
|
</a>
|
|
@endif
|
|
</td>
|
|
</tr>
|
|
@endforeach
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
@endif
|
|
</div>
|
|
</div>
|
|
{{-- VISTA 2: FILTRATA PER CONDOMINO, INQUILINO O TUTTI --}}
|
|
@else
|
|
@php
|
|
$displayedRows = match($currentRecapitiMode) {
|
|
'condomino' => $recapitiCondomino,
|
|
'inquilino' => $recapitiInquilino,
|
|
default => $multiRecapiti,
|
|
};
|
|
@endphp
|
|
<div class="overflow-x-auto">
|
|
<table class="w-full text-left text-xs text-gray-700 divide-y divide-gray-100">
|
|
<thead class="bg-gray-50 text-[11px] font-bold uppercase tracking-wider text-gray-500">
|
|
<tr>
|
|
<th class="px-4 py-2.5">Canale</th>
|
|
<th class="px-4 py-2.5">Etichetta / Uso</th>
|
|
<th class="px-4 py-2.5">Soggetto Collegato</th>
|
|
<th class="px-4 py-2.5">Valore Contatto</th>
|
|
<th class="px-4 py-2.5 text-center">Stato</th>
|
|
<th class="px-4 py-2.5 text-right">Azioni Rapide</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody class="divide-y divide-gray-100 bg-white">
|
|
@foreach($displayedRows as $rec)
|
|
<tr class="hover:bg-indigo-50/30 transition">
|
|
<td class="px-4 py-2.5 whitespace-nowrap">
|
|
<span class="inline-flex items-center gap-1.5 rounded-md border px-2 py-0.5 font-semibold text-[11px] {{ $rec['color'] }}">
|
|
<span>{{ $rec['icon'] }}</span>
|
|
<span>{{ $rec['canale'] }}</span>
|
|
</span>
|
|
</td>
|
|
<td class="px-4 py-2.5 font-medium text-gray-800 whitespace-nowrap">
|
|
{{ $rec['etichetta'] }}
|
|
</td>
|
|
<td class="px-4 py-2.5 whitespace-nowrap">
|
|
<span class="font-bold text-gray-900">{{ $rec['soggetto'] }}</span>
|
|
<span class="text-gray-400 font-normal">({{ $rec['ruolo'] }})</span>
|
|
</td>
|
|
<td class="px-4 py-2.5 font-mono text-gray-900 font-medium">
|
|
{{ $rec['valore'] }}
|
|
</td>
|
|
<td class="px-4 py-2.5 text-center whitespace-nowrap">
|
|
@if($rec['is_principal'])
|
|
<span class="rounded bg-emerald-100 text-emerald-800 px-1.5 py-0.5 text-[10px] font-bold">★ Principale</span>
|
|
@else
|
|
<span class="text-gray-400 text-[11px]">—</span>
|
|
@endif
|
|
</td>
|
|
<td class="px-4 py-2.5 text-right whitespace-nowrap">
|
|
@if(!empty($rec['action_url']))
|
|
<a href="{{ $rec['action_url'] }}" class="inline-flex items-center gap-1 rounded bg-indigo-50 hover:bg-indigo-100 border border-indigo-200 text-indigo-700 font-semibold px-2 py-1 text-[11px] transition">
|
|
<span>Apri</span>
|
|
</a>
|
|
@endif
|
|
</td>
|
|
</tr>
|
|
@endforeach
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
@endif
|
|
@endif
|
|
</div>
|
|
@endif
|
|
|
|
@if($tab === 'nominativi')
|
|
<div class="space-y-4">
|
|
<div class="rounded-xl border border-indigo-100 bg-indigo-50/50 p-4">
|
|
<div class="flex items-center gap-2">
|
|
<span class="text-xl">👥</span>
|
|
<div>
|
|
<h3 class="text-base font-semibold text-gray-900">Timeline Subentri e Cronistoria Avvicendamenti</h3>
|
|
<p class="text-xs text-gray-600">Cronistoria titolari ed avvicendamenti storici per questa unità immobiliare tra le diverse gestioni annuali. Seleziona un nominativo per accedere all'estratto conto contabile analitico.</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
@php
|
|
$timelineItems = $this->getTimelineSubentriCompletaProperty();
|
|
@endphp
|
|
|
|
@if(empty($timelineItems))
|
|
<div class="rounded-xl border border-dashed border-gray-200 bg-white p-8 text-center text-gray-500">
|
|
Nessuna cronistoria subentri registrata per questa unità immobiliare.
|
|
</div>
|
|
@else
|
|
<div class="relative border-l-2 border-indigo-200 ml-4 space-y-4 py-2">
|
|
@foreach($timelineItems as $item)
|
|
<div class="relative pl-6">
|
|
<span class="absolute -left-[9px] top-3 h-4 w-4 rounded-full border-2 border-indigo-600 bg-white"></span>
|
|
<div class="rounded-xl border border-gray-200 bg-white p-4 shadow-xs hover:border-indigo-300 hover:shadow-md transition flex flex-wrap items-center justify-between gap-4">
|
|
<div class="space-y-1">
|
|
<div class="flex items-center gap-2">
|
|
<span class="font-bold text-gray-900 text-base">{{ $item['nominativo'] }}</span>
|
|
<span class="inline-flex items-center rounded-md px-2 py-0.5 text-xs font-semibold {{ $item['ruolo'] === 'Inquilino' ? 'bg-amber-100 text-amber-800' : 'bg-indigo-100 text-indigo-800' }}">
|
|
{{ $item['ruolo'] }}
|
|
</span>
|
|
</div>
|
|
<div class="text-xs text-gray-500 flex flex-wrap items-center gap-3">
|
|
@if($item['codice_fiscale'])
|
|
<span>CF: <code class="font-mono">{{ $item['codice_fiscale'] }}</code></span>
|
|
@endif
|
|
<span>ID Condomino: <strong>#{{ $item['id_cond'] }}</strong></span>
|
|
<span>Gestioni: <strong class="text-indigo-700">{{ implode(' | ', $item['year_labels'] ?? $item['years']) }}</strong></span>
|
|
</div>
|
|
@if(!empty($item['dettaglio_subentro']))
|
|
@php
|
|
$subentroText = $item['dettaglio_subentro'];
|
|
try {
|
|
$parsedDate = \Carbon\Carbon::parse($subentroText)->format('d/m/Y');
|
|
$subentroText = 'Subentrato il: ' . $parsedDate;
|
|
} catch (\Throwable $e) {}
|
|
@endphp
|
|
<div class="text-xs text-amber-800 bg-amber-50 rounded-md border border-amber-200 px-2.5 py-1 inline-block mt-1 font-medium">
|
|
📅 {{ $subentroText }}
|
|
</div>
|
|
@endif
|
|
</div>
|
|
|
|
<div>
|
|
<button type="button"
|
|
wire:click="selectNominativoKey('{{ $item['key'] }}')"
|
|
class="inline-flex items-center gap-1.5 rounded-lg bg-indigo-600 px-3.5 py-2 text-xs font-semibold text-white shadow-xs hover:bg-indigo-700 transition">
|
|
<span>🧾</span>
|
|
<span>Vai all'Estratto Conto del Soggetto</span>
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
@endforeach
|
|
</div>
|
|
@endif
|
|
</div>
|
|
@endif
|
|
|
|
@if($tab === 'estratto_conto')
|
|
@php
|
|
$ecData = $this->getEstrattoContoNominativoDettaglioProperty();
|
|
$timelineItems = $this->getTimelineSubentriCompletaProperty();
|
|
$soggetto = $ecData['soggetto'] ?? null;
|
|
|
|
$rateCondominiHeader = $rateEmessePerCategoria['condomini'] ?? [];
|
|
$rateInquiliniHeader = $rateEmessePerCategoria['inquilini'] ?? [];
|
|
$sumHeader = function (array $items, string $field): float {
|
|
$s = 0.0;
|
|
foreach ($items as $it) {
|
|
$s += (float) ($it[$field] ?? 0);
|
|
}
|
|
return $s;
|
|
};
|
|
$totCAddebH = $sumHeader($rateCondominiHeader, 'totale_addebitato');
|
|
$totCPagH = $sumHeader($rateCondominiHeader, 'totale_pagato');
|
|
$totCResH = $sumHeader($rateCondominiHeader, 'residuo');
|
|
$totIAddebH = $sumHeader($rateInquiliniHeader, 'totale_addebitato');
|
|
$totIPagH = $sumHeader($rateInquiliniHeader, 'totale_pagato');
|
|
$totIResH = $sumHeader($rateInquiliniHeader, 'residuo');
|
|
$hasInquilino = !empty($relazioniPerTipo['inquilini'][0]['nome'] ?? null);
|
|
if (empty($rateCondominiHeader) && empty($rateInquiliniHeader) && !$hasInquilino) {
|
|
$totCAddebH = (float) collect($estrattoCompattoRateRows ?? [])->sum(fn (array $row): float => (float) ($row['dovuto'] ?? 0));
|
|
$totCPagH = (float) collect($estrattoCompattoIncassi ?? [])->sum(fn (array $row): float => (float) ($row['importo'] ?? 0));
|
|
$totCResH = round($totCAddebH - $totCPagH, 2);
|
|
}
|
|
@endphp
|
|
|
|
<div class="space-y-4">
|
|
{{-- Box Estratto Rapido Sintetico diviso per Condomino ed Inquilino --}}
|
|
<div class="rounded-xl border border-slate-200 bg-slate-50 p-4">
|
|
<div class="text-xs font-bold text-slate-600 uppercase tracking-wider mb-2">⚡ Estratto Conto Rapido Sintetico</div>
|
|
<div class="grid gap-3 sm:grid-cols-2">
|
|
<button type="button"
|
|
wire:click="setCondInquilActive('C')"
|
|
class="rounded-xl border p-3.5 text-left transition {{ ($condInquilActive ?? 'C') === 'C' ? 'border-amber-400 bg-amber-50/80 shadow-xs ring-2 ring-amber-500/20' : 'border-slate-200 bg-white hover:bg-slate-100' }}">
|
|
<div class="flex items-center justify-between">
|
|
<span class="text-xs font-bold text-amber-900">🏢 Condomino (Proprietari)</span>
|
|
<span class="rounded bg-amber-200 px-1.5 py-0.5 text-[10px] font-bold text-amber-900">C</span>
|
|
</div>
|
|
<div class="text-xs text-slate-700 mt-1 font-mono">
|
|
Addebito: <strong>€ {{ number_format($totCAddebH, 2, ',', '.') }}</strong> ·
|
|
Incasso: <strong class="text-emerald-700">€ {{ number_format($totCPagH, 2, ',', '.') }}</strong> ·
|
|
Residuo: <strong class="{{ $totCResH > 0 ? 'text-rose-600' : 'text-slate-600' }}">€ {{ number_format($totCResH, 2, ',', '.') }}</strong>
|
|
</div>
|
|
</button>
|
|
|
|
<button type="button"
|
|
wire:click="setCondInquilActive('I')"
|
|
class="rounded-xl border p-3.5 text-left transition {{ ($condInquilActive ?? 'C') === 'I' ? 'border-indigo-400 bg-indigo-50/80 shadow-xs ring-2 ring-indigo-500/20' : 'border-slate-200 bg-white hover:bg-slate-100' }} {{ $hasInquilino ? '' : 'opacity-60' }}"
|
|
@if(!$hasInquilino) disabled @endif>
|
|
<div class="flex items-center justify-between">
|
|
<span class="text-xs font-bold text-indigo-900">👤 Inquilino</span>
|
|
<span class="rounded bg-indigo-200 px-1.5 py-0.5 text-[10px] font-bold text-indigo-900">I</span>
|
|
</div>
|
|
<div class="text-xs text-slate-700 mt-1 font-mono">
|
|
Addebito: <strong>€ {{ number_format($totIAddebH, 2, ',', '.') }}</strong> ·
|
|
Incasso: <strong class="text-emerald-700">€ {{ number_format($totIPagH, 2, ',', '.') }}</strong> ·
|
|
Residuo: <strong class="{{ $totIResH > 0 ? 'text-rose-600' : 'text-slate-600' }}">€ {{ number_format($totIResH, 2, ',', '.') }}</strong>
|
|
</div>
|
|
</button>
|
|
</div>
|
|
</div>
|
|
|
|
{{-- Header selezione soggetto --}}
|
|
<div class="flex flex-wrap items-center justify-between gap-4 rounded-xl border border-slate-200 bg-slate-50 p-4">
|
|
<div>
|
|
<span class="text-xs font-medium text-slate-500">Seleziona Nominativo / Subentrante:</span>
|
|
<div class="flex flex-wrap items-center gap-2 mt-1">
|
|
@foreach($timelineItems as $tItem)
|
|
<button type="button"
|
|
wire:click="selectNominativoKey('{{ $tItem['key'] }}')"
|
|
class="inline-flex items-center gap-1.5 rounded-lg px-3 py-1.5 text-xs font-semibold transition border {{ ($soggetto['key'] ?? '') === $tItem['key'] ? 'bg-indigo-700 text-white border-indigo-700 shadow-md ring-2 ring-indigo-500/20' : 'bg-white text-slate-700 border-slate-200 hover:bg-slate-100' }}">
|
|
<span>{{ $tItem['nominativo'] }}</span>
|
|
<span class="opacity-75">({{ implode(', ', array_slice($tItem['year_labels'] ?? $tItem['years'], -1)) }})</span>
|
|
</button>
|
|
@endforeach
|
|
</div>
|
|
</div>
|
|
|
|
@if($soggetto)
|
|
<div class="text-right">
|
|
<span class="text-xs text-slate-500">ID Condomino: <strong>#{{ $soggetto['id_cond'] }}</strong></span>
|
|
<div class="text-sm font-bold text-indigo-900">{{ $soggetto['nominativo'] }}</div>
|
|
</div>
|
|
@endif
|
|
</div>
|
|
|
|
@if($soggetto)
|
|
{{-- KPI Summary --}}
|
|
<div class="grid grid-cols-1 gap-4 sm:grid-cols-4">
|
|
<div class="rounded-xl border border-slate-200 bg-white p-4 text-center">
|
|
<span class="text-xs font-medium text-slate-500">Totale Preventivo (€)</span>
|
|
<div class="text-lg font-bold text-slate-900">€ {{ number_format($ecData['totale_preventivo'], 2, ',', '.') }}</div>
|
|
</div>
|
|
<div class="rounded-xl border border-slate-200 bg-white p-4 text-center">
|
|
<span class="text-xs font-medium text-slate-500">Totale Consuntivo (€)</span>
|
|
<div class="text-lg font-bold text-slate-900">€ {{ number_format($ecData['totale_consuntivo'], 2, ',', '.') }}</div>
|
|
</div>
|
|
<div class="rounded-xl border border-emerald-200 bg-emerald-50/50 p-4 text-center">
|
|
<span class="text-xs font-medium text-emerald-700">Totale Incassato (€)</span>
|
|
<div class="text-lg font-bold text-emerald-800">€ {{ number_format($ecData['totale_incassato'], 2, ',', '.') }}</div>
|
|
</div>
|
|
<div class="rounded-xl border {{ $ecData['saldo_finale'] >= 0 ? 'border-emerald-300 bg-emerald-100/50 text-emerald-900' : 'border-rose-300 bg-rose-50 text-rose-900' }} p-4 text-center">
|
|
<span class="text-xs font-medium">Saldo Finale (€)</span>
|
|
<div class="text-lg font-bold">€ {{ number_format($ecData['saldo_finale'], 2, ',', '.') }}</div>
|
|
</div>
|
|
</div>
|
|
|
|
{{-- Tabella Rate Emesse (Dovuto vs Pagato + Data Pagamento e Movimento) --}}
|
|
<div class="rounded-xl border border-slate-200 bg-white overflow-hidden shadow-xs">
|
|
<div class="border-b border-slate-200 bg-slate-50 px-4 py-3 font-semibold text-slate-800 text-sm flex items-center justify-between">
|
|
<span>📑 Rate Emesse ed Avvisi di Pagamento</span>
|
|
<span class="text-xs text-slate-500 font-normal">Estratti da rate_emesse / emes_det per {{ $soggetto['nominativo'] }}</span>
|
|
</div>
|
|
@if(empty($ecData['rate_emesse']))
|
|
<div class="p-6 text-center text-slate-500 text-xs">Nessuna rata emessa per questo nominativo / ruolo.</div>
|
|
@else
|
|
<div class="overflow-x-auto">
|
|
<table class="w-full text-left text-xs">
|
|
<thead class="bg-slate-100 text-slate-700 font-semibold border-b border-slate-200">
|
|
<tr>
|
|
<th class="px-4 py-2.5">Data Emissione</th>
|
|
<th class="px-4 py-2.5">Data Scadenza</th>
|
|
<th class="px-4 py-2.5">Gestione</th>
|
|
<th class="px-4 py-2.5">Descrizione Rata</th>
|
|
<th class="px-4 py-2.5 text-right">Dovuto (€)</th>
|
|
<th class="px-4 py-2.5 text-right">Pagato (€)</th>
|
|
<th class="px-4 py-2.5">Data Pagamento</th>
|
|
<th class="px-4 py-2.5">Movimento / Cassa-Banca</th>
|
|
<th class="px-4 py-2.5 text-right">Residuo (€)</th>
|
|
<th class="px-4 py-2.5 text-center">Stato</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody class="divide-y divide-slate-100">
|
|
@foreach($ecData['rate_emesse'] as $rE)
|
|
<tr class="hover:bg-slate-50 transition">
|
|
<td class="px-4 py-2 font-mono text-slate-600">{{ $rE['data_emissione'] }}</td>
|
|
<td class="px-4 py-2 font-mono text-slate-800 font-semibold">{{ $rE['data_scadenza'] }}</td>
|
|
<td class="px-4 py-2">
|
|
<span class="inline-flex items-center rounded px-2 py-0.5 text-xs font-semibold bg-indigo-50 text-indigo-700">
|
|
{{ $rE['gestione'] }}
|
|
</span>
|
|
</td>
|
|
<td class="px-4 py-2 font-medium text-slate-900">
|
|
<div class="flex items-center gap-1.5">
|
|
@if(str_contains(strtoupper($rE['descrizione'] ?? ''), 'CONGUAGLIO FINALE') || str_contains(strtoupper($rE['descrizione'] ?? ''), ' CF') || ($rE['descrizione'] ?? '') === 'CF')
|
|
<span class="inline-flex items-center rounded bg-purple-100 text-purple-800 px-1.5 py-0.5 text-[10px] font-bold">🏁 Conguaglio Finale (CF)</span>
|
|
@elseif(str_contains(strtoupper($rE['descrizione'] ?? ''), 'CONGUAGLIO INIZIALE'))
|
|
<span class="inline-flex items-center rounded bg-blue-100 text-blue-800 px-1.5 py-0.5 text-[10px] font-bold">🚀 Conguaglio Iniziale</span>
|
|
@endif
|
|
<span>{{ $rE['descrizione'] }}</span>
|
|
</div>
|
|
</td>
|
|
<td class="px-4 py-2 text-right font-mono font-medium text-slate-900">€ {{ number_format($rE['dovuto'], 2, ',', '.') }}</td>
|
|
<td class="px-4 py-2 text-right font-mono font-medium text-emerald-700">€ {{ number_format($rE['pagato'], 2, ',', '.') }}</td>
|
|
<td class="px-4 py-2 font-mono text-slate-700 font-medium">{{ $rE['data_pagamento'] ?? '—' }}</td>
|
|
<td class="px-4 py-2 text-slate-600 font-mono text-xs">
|
|
@if(($rE['movimento_bancario'] ?? '—') !== '—')
|
|
<span class="inline-flex items-center gap-1 rounded bg-slate-100 border border-slate-200 px-2 py-0.5 text-xs text-slate-800 font-mono">
|
|
<span>🏛️ {{ $rE['movimento_bancario'] }}</span>
|
|
</span>
|
|
@else
|
|
<span class="text-slate-400">—</span>
|
|
@endif
|
|
</td>
|
|
<td class="px-4 py-2 text-right font-mono font-bold {{ $rE['residuo'] > 0 ? 'text-rose-600' : 'text-slate-500' }}">
|
|
€ {{ number_format($rE['residuo'], 2, ',', '.') }}
|
|
</td>
|
|
<td class="px-4 py-2 text-center">
|
|
@if($rE['residuo'] <= 0 && $rE['dovuto'] > 0)
|
|
<span class="inline-flex items-center rounded-full bg-emerald-100 px-2 py-0.5 text-xs font-semibold text-emerald-800">
|
|
Saldata
|
|
</span>
|
|
@elseif($rE['pagato'] > 0)
|
|
<span class="inline-flex items-center rounded-full bg-amber-100 px-2 py-0.5 text-xs font-semibold text-amber-800">
|
|
Parziale
|
|
</span>
|
|
@else
|
|
<span class="inline-flex items-center rounded-full bg-rose-100 px-2 py-0.5 text-xs font-semibold text-rose-800">
|
|
Da Pagare
|
|
</span>
|
|
@endif
|
|
</td>
|
|
</tr>
|
|
@endforeach
|
|
</tbody>
|
|
<tfoot class="bg-slate-50 font-bold border-t border-slate-200">
|
|
<tr>
|
|
<td colspan="4" class="px-4 py-2.5 text-right text-slate-700">Totali Rate Emesse:</td>
|
|
<td class="px-4 py-2.5 text-right font-mono text-slate-900">€ {{ number_format($ecData['totale_dovuto_rate'], 2, ',', '.') }}</td>
|
|
<td class="px-4 py-2.5 text-right font-mono text-emerald-700">€ {{ number_format($ecData['totale_pagato_rate'], 2, ',', '.') }}</td>
|
|
<td colspan="2"></td>
|
|
<td class="px-4 py-2.5 text-right font-mono text-rose-700">€ {{ number_format($ecData['totale_residuo_rate'], 2, ',', '.') }}</td>
|
|
<td></td>
|
|
</tr>
|
|
</tfoot>
|
|
</table>
|
|
</div>
|
|
@endif
|
|
</div>
|
|
|
|
{{-- Tabella Incassi Registrati --}}
|
|
<div class="rounded-xl border border-slate-200 bg-white overflow-hidden shadow-xs">
|
|
<div class="border-b border-slate-200 bg-slate-50 px-4 py-3 font-semibold text-slate-800 text-sm flex items-center justify-between">
|
|
<span>💵 Incassi Effettuati e Ricevute</span>
|
|
<span class="text-xs text-slate-500 font-normal">Estratti da incassi / in_da_ec</span>
|
|
</div>
|
|
@if(empty($ecData['incassi']))
|
|
<div class="p-6 text-center text-slate-500 text-xs">Nessun incasso registrato per questo nominativo.</div>
|
|
@else
|
|
<div class="overflow-x-auto">
|
|
<table class="w-full text-left text-xs">
|
|
<thead class="bg-slate-100 text-slate-700 font-semibold border-b border-slate-200">
|
|
<tr>
|
|
<th class="px-4 py-2.5">Data Pagamento</th>
|
|
<th class="px-4 py-2.5">Cassa / Banca</th>
|
|
<th class="px-4 py-2.5">Anno Rif.</th>
|
|
<th class="px-4 py-2.5">Descrizione / Note</th>
|
|
<th class="px-4 py-2.5 text-right">Importo Incassato (€)</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody class="divide-y divide-slate-100">
|
|
@foreach($ecData['incassi'] as $inc)
|
|
<tr class="hover:bg-slate-50 transition">
|
|
<td class="px-4 py-2 font-mono text-slate-800">{{ $inc['data_pagamento'] }}</td>
|
|
<td class="px-4 py-2 font-semibold text-indigo-700">{{ $inc['cod_cassa'] }}</td>
|
|
<td class="px-4 py-2 font-mono text-slate-600">{{ $inc['anno_rif'] }}</td>
|
|
<td class="px-4 py-2 text-slate-600">{{ $inc['descrizione'] }}</td>
|
|
<td class="px-4 py-2 text-right font-mono font-bold text-emerald-700">€ {{ number_format($inc['importo_euro'], 2, ',', '.') }}</td>
|
|
</tr>
|
|
@endforeach
|
|
</tbody>
|
|
<tfoot class="bg-slate-50 font-bold border-t border-slate-200">
|
|
<tr>
|
|
<td colspan="4" class="px-4 py-2.5 text-right text-slate-700">Totale Incassato:</td>
|
|
<td class="px-4 py-2.5 text-right font-mono text-emerald-700">€ {{ number_format($ecData['totale_incassato'], 2, ',', '.') }}</td>
|
|
</tr>
|
|
</tfoot>
|
|
</table>
|
|
</div>
|
|
@endif
|
|
</div>
|
|
@endif
|
|
</div>
|
|
@endif
|
|
|
|
@if($tab === 'millesimi')
|
|
@php
|
|
$ecData = $this->getEstrattoContoNominativoDettaglioProperty();
|
|
$soggetto = $ecData['soggetto'] ?? [];
|
|
@endphp
|
|
<div class="space-y-6">
|
|
{{-- Sezione 1: Tabelle Millesimali Assegnate all'Unità --}}
|
|
<x-filament::section>
|
|
<div class="flex items-center justify-between border-b border-gray-100 pb-3 mb-4">
|
|
<div class="flex items-center gap-2">
|
|
<x-filament::icon icon="heroicon-o-chart-pie" class="h-5 w-5 text-indigo-600" />
|
|
<span class="font-bold text-slate-900 text-sm">Tabelle Millesimali Assegnate</span>
|
|
</div>
|
|
<span class="text-xs text-slate-500">Millesimi generali e speciali configurati</span>
|
|
</div>
|
|
|
|
<div class="mb-4 flex flex-wrap gap-2">
|
|
@php
|
|
$gruppi = [
|
|
'ordinarie' => 'ORDINARIE',
|
|
'riscaldamento' => 'RISCALDAMENTO',
|
|
'straordinarie' => 'STRAORDINARIE',
|
|
];
|
|
@endphp
|
|
@foreach($gruppi as $key => $label)
|
|
<button
|
|
type="button"
|
|
wire:click="setMillesimiGruppo('{{ $key }}')"
|
|
class="inline-flex items-center rounded-lg border px-4 py-2 text-xs font-semibold transition
|
|
{{ ($millesimiGruppo ?? 'ordinarie') === $key ? 'border-primary-300 bg-primary-50 text-primary-700 shadow-sm' : 'border-gray-200 bg-white text-gray-700 hover:bg-gray-50' }}"
|
|
>
|
|
{{ $label }}
|
|
</button>
|
|
@endforeach
|
|
</div>
|
|
|
|
@if(empty($millesimiPerTabella))
|
|
<div class="text-xs text-gray-500">Nessuna tabella millesimale associata.</div>
|
|
@else
|
|
@php
|
|
$selectedGruppo = $millesimiGruppo ?? 'ordinarie';
|
|
$filteredMillesimi = array_values(array_filter($millesimiPerTabella, fn ($r) => ($r['gruppo'] ?? 'ordinarie') === $selectedGruppo));
|
|
@endphp
|
|
<div class="overflow-x-auto rounded-lg border border-slate-200">
|
|
<table class="min-w-full text-xs">
|
|
<thead class="bg-slate-50 text-slate-600 border-b border-slate-200 font-semibold">
|
|
<tr class="text-left">
|
|
<th class="py-2.5 px-4">Codice Tabella</th>
|
|
<th class="py-2.5 px-4">Denominazione</th>
|
|
<th class="py-2.5 px-4 text-right">Valore Millesimi (mm)</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody class="divide-y divide-slate-100 bg-white">
|
|
@forelse($filteredMillesimi as $r)
|
|
@php
|
|
$tipo = $r['tipo'] ?? 'altro';
|
|
$tipoLabel = ucwords(str_replace('_', ' ', (string) $tipo));
|
|
$prevTipo = $loop->first ? null : ($filteredMillesimi[$loop->index - 1]['tipo'] ?? 'altro');
|
|
@endphp
|
|
|
|
@if($loop->first || $tipo !== $prevTipo)
|
|
<tr class="bg-indigo-50/40">
|
|
<td class="py-2 px-4 font-bold text-indigo-900" colspan="3">{{ $tipoLabel }}</td>
|
|
</tr>
|
|
@endif
|
|
|
|
<tr class="hover:bg-slate-50">
|
|
<td class="py-2.5 px-4 font-mono font-bold text-indigo-700">{{ $r['codice'] }}</td>
|
|
<td class="py-2.5 px-4 text-slate-800">{{ $r['nome'] }}</td>
|
|
<td class="py-2.5 px-4 text-right font-mono font-semibold text-slate-900">{{ number_format($r['millesimi'], 4, ',', '.') }}</td>
|
|
</tr>
|
|
@empty
|
|
<tr>
|
|
<td class="py-4 text-center text-gray-500" colspan="3">Nessun millesimo presente per il gruppo selezionato</td>
|
|
</tr>
|
|
@endforelse
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
@endif
|
|
</x-filament::section>
|
|
|
|
{{-- Sezione 2: Spese e Millesimi Addebitati per Gestione --}}
|
|
<div class="rounded-xl border border-slate-200 bg-white overflow-hidden shadow-xs">
|
|
<div class="border-b border-slate-200 bg-slate-50 px-4 py-3 font-semibold text-slate-800 text-sm flex items-center justify-between">
|
|
<div class="flex items-center gap-2">
|
|
<span>📊 Spese e Millesimi Addebitati a <strong>{{ $soggetto['nominativo'] ?? 'Condomino' }}</strong></span>
|
|
<span class="rounded bg-indigo-100 px-2 py-0.5 text-xs text-indigo-800 font-normal">
|
|
{{ reset($ecData['addebiti'])['anno_gestione'] ?? 'Anno In Corso' }}
|
|
</span>
|
|
</div>
|
|
<span class="text-xs text-slate-500 font-normal">Suddivise per Gruppo (Ordinaria, Riscaldamento, Straordinaria)</span>
|
|
</div>
|
|
@if(empty($ecData['addebiti']))
|
|
<div class="p-6 text-center text-slate-500 text-xs">Nessun addebito preventivato o consuntivato per questo nominativo.</div>
|
|
@else
|
|
<div class="overflow-x-auto">
|
|
<table class="w-full text-left text-xs">
|
|
<thead class="bg-slate-100 text-slate-700 font-semibold border-b border-slate-200">
|
|
<tr>
|
|
<th class="px-4 py-2.5">Codice Tabella</th>
|
|
<th class="px-4 py-2.5">Descrizione Tabella</th>
|
|
<th class="px-4 py-2.5">Tipo Gestione</th>
|
|
<th class="px-4 py-2.5 text-right">Millesimi (mm)</th>
|
|
<th class="px-4 py-2.5 text-right">Preventivo (€)</th>
|
|
<th class="px-4 py-2.5 text-right">Consuntivo (€)</th>
|
|
<th class="px-4 py-2.5 text-right">Conguaglio (€)</th>
|
|
<th class="px-4 py-2.5 text-center">Voci Spesa</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody class="divide-y divide-slate-100">
|
|
@foreach($ecData['addebiti'] as $addIndex => $add)
|
|
<tr class="hover:bg-indigo-50/50 transition cursor-pointer" onclick="document.getElementById('voc-spe-row-{{ $addIndex }}') ? document.getElementById('voc-spe-row-{{ $addIndex }}').classList.toggle('hidden') : null">
|
|
<td class="px-4 py-2.5 font-mono font-bold text-indigo-700">{{ $add['cod_tabella'] }}</td>
|
|
<td class="px-4 py-2.5 font-semibold text-slate-900">{{ $add['descrizione_tab'] }}</td>
|
|
<td class="px-4 py-2.5">
|
|
<span class="inline-flex items-center rounded-md px-2 py-0.5 text-xs font-semibold {{ $add['tipo_label'] === 'Riscaldamento' ? 'bg-amber-100 text-amber-800' : ($add['tipo_label'] === 'Straordinaria' ? 'bg-rose-100 text-rose-800' : 'bg-slate-100 text-slate-800') }}">
|
|
{{ $add['tipo_label'] }}
|
|
</span>
|
|
</td>
|
|
<td class="px-4 py-2.5 text-right font-mono text-slate-600">{{ number_format($add['millesimi'], 2, ',', '.') }}</td>
|
|
<td class="px-4 py-2.5 text-right font-mono font-medium text-slate-800">€ {{ number_format($add['preventivo_euro'], 2, ',', '.') }}</td>
|
|
<td class="px-4 py-2.5 text-right font-mono font-medium text-slate-800">€ {{ number_format($add['consuntivo_euro'], 2, ',', '.') }}</td>
|
|
<td class="px-4 py-2.5 text-right font-mono font-bold {{ $add['conguaglio_euro'] > 0 ? 'text-amber-600' : ($add['conguaglio_euro'] < 0 ? 'text-emerald-600' : 'text-slate-500') }}">
|
|
€ {{ number_format($add['conguaglio_euro'], 2, ',', '.') }}
|
|
</td>
|
|
<td class="px-4 py-2.5 text-center">
|
|
@if(!empty($add['voci_spesa']))
|
|
<span class="inline-flex items-center gap-1 rounded bg-indigo-50 border border-indigo-200 px-2 py-0.5 text-xs font-semibold text-indigo-700">
|
|
<span>{{ count($add['voci_spesa']) }} voci</span>
|
|
<span>🔍</span>
|
|
</span>
|
|
@else
|
|
<span class="text-slate-400 text-xs">—</span>
|
|
@endif
|
|
</td>
|
|
</tr>
|
|
@if(!empty($add['voci_spesa']))
|
|
<tr id="voc-spe-row-{{ $addIndex }}" class="hidden bg-slate-50/80 border-b border-indigo-100">
|
|
<td colspan="8" class="p-3">
|
|
<div class="rounded-lg border border-indigo-100 bg-white p-3 shadow-xs">
|
|
<div class="text-xs font-bold text-indigo-900 mb-2 flex items-center gap-2">
|
|
<span>📋 Voci di Spesa collegate alla Tabella <strong>{{ $add['cod_tabella'] }}</strong></span>
|
|
<span class="text-slate-500 font-normal">({{ count($add['voci_spesa']) }} voci da voc_spe)</span>
|
|
</div>
|
|
<table class="w-full text-left text-xs border border-slate-200 rounded">
|
|
<thead class="bg-indigo-50 text-indigo-900 font-semibold">
|
|
<tr>
|
|
<th class="px-3 py-1.5">Cod. Voce</th>
|
|
<th class="px-3 py-1.5">Descrizione Voce</th>
|
|
<th class="px-3 py-1.5 text-center">% Prop.</th>
|
|
<th class="px-3 py-1.5 text-center">% Inq.</th>
|
|
<th class="px-3 py-1.5 text-right">Preventivo Voce (€)</th>
|
|
<th class="px-3 py-1.5 text-right">Consuntivo Voce (€)</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody class="divide-y divide-slate-100">
|
|
@foreach($add['voci_spesa'] as $voc)
|
|
<tr class="hover:bg-slate-50">
|
|
<td class="px-3 py-1.5 font-mono font-bold text-slate-700">{{ $voc['cod_voce'] }}</td>
|
|
<td class="px-3 py-1.5 text-slate-900 font-medium">{{ $voc['descrizione'] }}</td>
|
|
<td class="px-3 py-1.5 text-center font-mono text-slate-600">{{ number_format($voc['perc_proprietario'], 0) }}%</td>
|
|
<td class="px-3 py-1.5 text-center font-mono text-slate-600">{{ number_format($voc['perc_inquilino'], 0) }}%</td>
|
|
<td class="px-3 py-1.5 text-right font-mono text-slate-800">€ {{ number_format($voc['preventivo_euro'], 2, ',', '.') }}</td>
|
|
<td class="px-3 py-1.5 text-right font-mono text-slate-800">€ {{ number_format($voc['consuntivo_euro'], 2, ',', '.') }}</td>
|
|
</tr>
|
|
@endforeach
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
@endif
|
|
@endforeach
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
@endif
|
|
</div>
|
|
</div>
|
|
@endif
|
|
|
|
@if($tab === 'preferenze')
|
|
@php
|
|
$protocolloList = $this->getProtocolloComunicazioniProperty();
|
|
@endphp
|
|
<div class="space-y-6">
|
|
{{-- 1. Protocollo Corrispondenza ed Estratti Conto Inviati --}}
|
|
<div class="rounded-xl border border-slate-200 bg-white overflow-hidden shadow-xs">
|
|
<div class="border-b border-slate-200 bg-slate-50 px-4 py-3 flex items-center justify-between">
|
|
<div class="flex items-center gap-2">
|
|
<span class="text-base">📨</span>
|
|
<div>
|
|
<span class="font-bold text-slate-900 text-sm">Protocollo Comunicazioni & Corrispondenza Inviata</span>
|
|
<div class="text-xs text-slate-500">Estratti conto, lettere, circolari e comunicazioni storiche collegate all'unità</div>
|
|
</div>
|
|
</div>
|
|
<span class="rounded-full bg-indigo-50 border border-indigo-200 px-3 py-1 text-xs font-bold text-indigo-800">
|
|
{{ count($protocolloList) }} documenti a protocollo
|
|
</span>
|
|
</div>
|
|
|
|
@if(empty($protocolloList))
|
|
<div class="p-8 text-center text-slate-500 text-xs">
|
|
Nessuna comunicazione o estratto conto inviato registrato a protocollo per questa unità.
|
|
</div>
|
|
@else
|
|
<div class="overflow-x-auto">
|
|
<table class="w-full text-left text-xs">
|
|
<thead class="bg-slate-100 text-slate-700 font-semibold border-b border-slate-200">
|
|
<tr>
|
|
<th class="px-4 py-2.5">Data Invio</th>
|
|
<th class="px-4 py-2.5">Protocollo / Rif.</th>
|
|
<th class="px-4 py-2.5">Canale</th>
|
|
<th class="px-4 py-2.5">Destinatario</th>
|
|
<th class="px-4 py-2.5">Oggetto / Contenuto</th>
|
|
<th class="px-4 py-2.5 text-right">Importo E/C</th>
|
|
<th class="px-4 py-2.5 text-center">Allegato</th>
|
|
<th class="px-4 py-2.5">Note</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody class="divide-y divide-slate-100">
|
|
@foreach($protocolloList as $prot)
|
|
<tr class="hover:bg-indigo-50/40 transition">
|
|
<td class="px-4 py-2.5 font-medium text-slate-900 whitespace-nowrap">{{ $prot['data_invio'] }}</td>
|
|
<td class="px-4 py-2.5 font-mono font-bold text-indigo-700 whitespace-nowrap">{{ $prot['protocollo'] }}</td>
|
|
<td class="px-4 py-2.5 whitespace-nowrap">
|
|
<span class="inline-flex items-center gap-1 rounded-md px-2 py-0.5 text-xs font-semibold
|
|
{{ str_contains(strtolower($prot['canale']), 'pec') ? 'bg-emerald-100 text-emerald-800' : (str_contains(strtolower($prot['canale']), 'mail') ? 'bg-blue-100 text-blue-800' : 'bg-slate-100 text-slate-800') }}">
|
|
<span>{{ str_contains(strtolower($prot['canale']), 'pec') ? '🛡️' : (str_contains(strtolower($prot['canale']), 'mail') ? '✉️' : '📮') }}</span>
|
|
<span>{{ $prot['canale'] }}</span>
|
|
</span>
|
|
</td>
|
|
<td class="px-4 py-2.5 font-medium text-slate-900">
|
|
<div>{{ $prot['destinatario'] }}</div>
|
|
<div class="text-[10px] text-slate-500 font-normal">{{ $prot['ruolo'] }}</div>
|
|
</td>
|
|
<td class="px-4 py-2.5 text-slate-700 max-w-xs truncate" title="{{ $prot['oggetto'] }}">
|
|
{{ $prot['oggetto'] }}
|
|
</td>
|
|
<td class="px-4 py-2.5 text-right font-mono font-bold {{ ($prot['importo'] ?? 0) > 0 ? 'text-slate-900' : 'text-slate-400' }}">
|
|
{{ $prot['importo'] !== null ? '€ ' . number_format($prot['importo'], 2, ',', '.') : '—' }}
|
|
</td>
|
|
<td class="px-4 py-2.5 text-center">
|
|
@php
|
|
$allegatiList = !empty($prot['allegati']) ? $prot['allegati'] : (!empty($prot['nome_file']) ? [['filename' => $prot['nome_file'], 'path' => $prot['file_path'], 'exists' => $prot['file_exists'], 'is_pdf' => str_ends_with(strtolower($prot['nome_file']), '.pdf'), 'is_image' => preg_match('/\.(jpg|jpeg|png|webp|gif)$/i', $prot['nome_file'])]] : []);
|
|
@endphp
|
|
@if(!empty($allegatiList))
|
|
<div class="flex flex-wrap items-center justify-center gap-1.5 max-w-xs mx-auto">
|
|
@foreach($allegatiList as $att)
|
|
@php
|
|
$attName = $att['filename'] ?? 'file';
|
|
$attPath = $att['path'] ?? '';
|
|
$attExists = $att['exists'] ?? false;
|
|
$isPdf = $att['is_pdf'] ?? str_ends_with(strtolower($attName), '.pdf');
|
|
$isImg = $att['is_image'] ?? preg_match('/\.(jpg|jpeg|png|webp|gif)$/i', $attName);
|
|
@endphp
|
|
<button
|
|
type="button"
|
|
wire:click="previewProtocolDoc('{{ $prot['id'] }}', '{{ addslashes($attName) }}', '{{ addslashes($attPath) }}')"
|
|
class="inline-flex items-center gap-1 rounded-md px-2 py-0.5 text-[11px] font-mono transition shadow-2xs {{ $attExists ? 'bg-slate-100 hover:bg-indigo-100 hover:text-indigo-800 text-slate-700 border border-slate-200 cursor-pointer' : 'bg-slate-50 text-slate-400 border border-dashed border-slate-200 cursor-pointer' }}"
|
|
title="{{ $attExists ? 'Visualizza anteprima (' . $attName . ')' : 'File non presente localmente (' . $attName . ')' }}"
|
|
>
|
|
<span>{{ $isPdf ? '📄' : ($isImg ? '🖼️' : '📎') }}</span>
|
|
<span class="truncate max-w-[120px] {{ $attExists ? 'underline font-medium' : 'line-through' }}">{{ $attName }}</span>
|
|
</button>
|
|
@endforeach
|
|
</div>
|
|
@else
|
|
<span class="text-slate-400">—</span>
|
|
@endif
|
|
</td>
|
|
<td class="px-4 py-2.5 text-slate-500 text-[11px] max-w-xs truncate" title="{{ $prot['note'] }}">
|
|
{{ $prot['note'] ?: '—' }}
|
|
</td>
|
|
</tr>
|
|
@endforeach
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
@endif
|
|
</div>
|
|
|
|
{{-- 2. Preferenze di Invio Ufficiali per i Soggetti --}}
|
|
<x-filament::section>
|
|
<x-slot name="heading">Canali Ufficiali di Notifica</x-slot>
|
|
<x-slot name="description">Preferenze di spedizione canoniche per proprietari e comproprietari</x-slot>
|
|
|
|
<div class="space-y-4">
|
|
@if(empty($canaliComunicazione))
|
|
<div class="text-xs text-gray-500">Nessun proprietario o comproprietario registrato per questa unità.</div>
|
|
@else
|
|
<div class="overflow-x-auto rounded-lg border border-gray-200">
|
|
<table class="w-full text-left text-xs text-gray-500">
|
|
<thead class="bg-gray-50 text-xs uppercase text-gray-700 font-semibold border-b">
|
|
<tr>
|
|
<th class="px-4 py-2.5">Soggetto / Nominativo</th>
|
|
<th class="px-4 py-2.5">Convocazione Assemblea</th>
|
|
<th class="px-4 py-2.5">Invio Verbali</th>
|
|
<th class="px-4 py-2.5">Solleciti e Rate</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody class="divide-y divide-gray-200 bg-white">
|
|
@foreach($canaliComunicazione as $soggettoId => $p)
|
|
<tr class="hover:bg-gray-50/50">
|
|
<td class="px-4 py-3">
|
|
<div class="font-bold text-gray-900">{{ $p['nominativo'] }}</div>
|
|
<div class="text-xs text-gray-500 font-mono mt-0.5">{{ $p['codice_fiscale'] ?? '—' }}</div>
|
|
</td>
|
|
<td class="px-4 py-3">
|
|
<select
|
|
wire:change="salvaCanaleComunicazione({{ $soggettoId }}, 'convocazione', $event.target.value)"
|
|
class="w-full text-xs rounded-md border-gray-300 shadow-sm focus:border-primary-500 focus:ring-primary-500 font-semibold text-gray-700">
|
|
@foreach(['PEC', 'Raccomandata AR', 'Posta Ordinaria', 'Mano'] as $opt)
|
|
<option value="{{ $opt }}" {{ $p['convocazione'] === $opt ? 'selected' : '' }}>{{ $opt }}</option>
|
|
@endforeach
|
|
</select>
|
|
</td>
|
|
<td class="px-4 py-3">
|
|
<select
|
|
wire:change="salvaCanaleComunicazione({{ $soggettoId }}, 'verbali', $event.target.value)"
|
|
class="w-full text-xs rounded-md border-gray-300 shadow-sm focus:border-primary-500 focus:ring-primary-500 font-semibold text-gray-700">
|
|
@foreach(['PEC', 'Raccomandata AR', 'Posta Ordinaria', 'Mano'] as $opt)
|
|
<option value="{{ $opt }}" {{ $p['verbali'] === $opt ? 'selected' : '' }}>{{ $opt }}</option>
|
|
@endforeach
|
|
</select>
|
|
</td>
|
|
<td class="px-4 py-3">
|
|
<select
|
|
wire:change="salvaCanaleComunicazione({{ $soggettoId }}, 'solleciti', $event.target.value)"
|
|
class="w-full text-xs rounded-md border-gray-300 shadow-sm focus:border-primary-500 focus:ring-primary-500 font-semibold text-gray-700">
|
|
@foreach(['Email Standard', 'PEC', 'Posta Ordinaria'] as $opt)
|
|
<option value="{{ $opt }}" {{ $p['solleciti'] === $opt ? 'selected' : '' }}>{{ $opt }}</option>
|
|
@endforeach
|
|
</select>
|
|
</td>
|
|
</tr>
|
|
@endforeach
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
@endif
|
|
</div>
|
|
</x-filament::section>
|
|
</div>
|
|
@endif
|
|
|
|
@if($tab === 'acqua')
|
|
<div class="space-y-4">
|
|
<x-filament::section>
|
|
<x-slot name="heading">Storico letture acqua unità</x-slot>
|
|
<x-slot name="description">Andamento letture, consumi e richieste legate a questa utenza immobiliare.</x-slot>
|
|
|
|
<div class="grid gap-3 md:grid-cols-4">
|
|
<div class="rounded-lg border bg-gray-50 p-3">
|
|
<div class="text-xs text-gray-500">Letture registrate</div>
|
|
<div class="mt-2 text-xl font-semibold text-gray-900">{{ number_format((int) ($acquaStats['totale_letture'] ?? 0), 0, ',', '.') }}</div>
|
|
</div>
|
|
<div class="rounded-lg border bg-gray-50 p-3">
|
|
<div class="text-xs text-gray-500">Consumi storici</div>
|
|
<div class="mt-2 text-xl font-semibold text-gray-900">{{ number_format((float) ($acquaStats['totale_consumi_mc'] ?? 0), 3, ',', '.') }} mc</div>
|
|
</div>
|
|
<div class="rounded-lg border bg-gray-50 p-3">
|
|
<div class="text-xs text-gray-500">Ultima lettura</div>
|
|
<div class="mt-2 text-xl font-semibold text-gray-900">{{ isset($acquaStats['ultima_lettura']) && $acquaStats['ultima_lettura'] !== null ? number_format((float) $acquaStats['ultima_lettura'], 3, ',', '.') : '—' }}</div>
|
|
<div class="mt-1 text-[11px] text-gray-500">{{ $acquaStats['ultima_data'] ?? 'nessuna data' }}</div>
|
|
</div>
|
|
<div class="rounded-lg border bg-gray-50 p-3">
|
|
<div class="text-xs text-gray-500">Richieste aperte</div>
|
|
<div class="mt-2 text-xl font-semibold text-gray-900">{{ number_format((int) ($acquaStats['richieste_aperte'] ?? 0), 0, ',', '.') }}</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="mt-4 grid gap-4 lg:grid-cols-[1.2fr_0.8fr]">
|
|
<div class="rounded-xl border bg-cyan-50 p-4">
|
|
<div class="text-sm font-semibold text-cyan-900">Utenza acqua collegata</div>
|
|
<div class="mt-2 grid gap-2 text-xs text-cyan-900 md:grid-cols-2">
|
|
<div>Servizio: <span class="font-semibold">{{ $acquaStats['servizio_label'] ?? 'non configurato' }}</span></div>
|
|
<div>Matricola: <span class="font-semibold">{{ $acquaStats['matricola'] ?? '—' }}</span></div>
|
|
<div>Seriale unità: <span class="font-semibold">{{ $unita->acqua_contatore_seriale ?? '—' }}</span></div>
|
|
<div>Gateway ID: <span class="font-semibold">{{ $unita->acqua_gateway_device_id ?? '—' }}</span></div>
|
|
<div>Codice utenza: <span class="font-semibold">{{ $acquaStats['utenza'] ?? '—' }}</span></div>
|
|
<div>Contratto: <span class="font-semibold">{{ $acquaStats['contratto'] ?? '—' }}</span></div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="rounded-xl border bg-white p-4">
|
|
<div class="text-sm font-semibold text-gray-900">Azioni rapide</div>
|
|
<div class="mt-3 flex flex-wrap gap-2">
|
|
@if(!empty($acquaQuickLinks['ticket_light']))
|
|
<a href="{{ $acquaQuickLinks['ticket_light'] }}" class="inline-flex items-center rounded-md border border-cyan-300 bg-cyan-50 px-3 py-1.5 text-xs font-medium text-cyan-800 hover:bg-cyan-100">Nuova lettura unità</a>
|
|
@endif
|
|
@if(!empty($acquaQuickLinks['archivio']))
|
|
<a href="{{ $acquaQuickLinks['archivio'] }}" class="inline-flex items-center rounded-md border border-gray-300 bg-gray-50 px-3 py-1.5 text-xs font-medium text-gray-700 hover:bg-gray-100">Archivio letture</a>
|
|
@endif
|
|
@if(!empty($acquaQuickLinks['hub_stabile']))
|
|
<a href="{{ $acquaQuickLinks['hub_stabile'] }}" class="inline-flex items-center rounded-md border border-gray-300 bg-gray-50 px-3 py-1.5 text-xs font-medium text-gray-700 hover:bg-gray-100">Campagna stabile</a>
|
|
@endif
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</x-filament::section>
|
|
|
|
<x-filament::section>
|
|
<x-slot name="heading">Dettaglio letture e consumi nel tempo</x-slot>
|
|
<x-slot name="description">Storico operativo della singola unità con canale di arrivo, riferimento e protocollo.</x-slot>
|
|
|
|
<div class="overflow-x-auto">
|
|
<table class="min-w-full text-sm">
|
|
<thead>
|
|
<tr class="border-b text-gray-500">
|
|
<th class="px-2 py-2 text-left">Data</th>
|
|
<th class="px-2 py-2 text-left">Periodo</th>
|
|
<th class="px-2 py-2 text-right">Lett. iniziale</th>
|
|
<th class="px-2 py-2 text-right">Lett. finale</th>
|
|
<th class="px-2 py-2 text-right">Consumo</th>
|
|
<th class="px-2 py-2 text-left">Canale / stato</th>
|
|
<th class="px-2 py-2 text-left">Riferimento</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@forelse($acquaLettureStorico as $row)
|
|
<tr class="border-b border-gray-100">
|
|
<td class="px-2 py-2">{{ $row['data'] ?: '—' }}</td>
|
|
<td class="px-2 py-2">{{ $row['periodo'] ?: '—' }}</td>
|
|
<td class="px-2 py-2 text-right">{{ isset($row['lettura_inizio']) && $row['lettura_inizio'] !== null ? number_format((float) $row['lettura_inizio'], 3, ',', '.') : '—' }}</td>
|
|
<td class="px-2 py-2 text-right">{{ isset($row['lettura_fine']) && $row['lettura_fine'] !== null ? number_format((float) $row['lettura_fine'], 3, ',', '.') : '—' }}</td>
|
|
<td class="px-2 py-2 text-right">{{ isset($row['consumo_valore']) && $row['consumo_valore'] !== null ? number_format((float) $row['consumo_valore'], 3, ',', '.') . ' ' . ($row['consumo_unita'] ?? 'mc') : '—' }}</td>
|
|
<td class="px-2 py-2">
|
|
<div>{{ $row['canale'] ?: '—' }}</div>
|
|
<div class="text-[11px] text-gray-500">{{ $row['workflow'] ?: '—' }} @if(!empty($row['protocollo'])) · {{ $row['protocollo'] }} @endif</div>
|
|
</td>
|
|
<td class="px-2 py-2">
|
|
<div>{{ $row['riferimento'] ?: '—' }}</div>
|
|
@if(!empty($row['fattura_label']))
|
|
<div class="text-[11px] text-cyan-700">{{ $row['fattura_label'] }}</div>
|
|
@endif
|
|
</td>
|
|
</tr>
|
|
@empty
|
|
<tr>
|
|
<td colspan="7" class="px-2 py-6 text-center text-gray-500">Nessuna lettura acqua registrata per questa unità.</td>
|
|
</tr>
|
|
@endforelse
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
@php
|
|
$tabelleAcqua = collect($preventiviPerTabella)->filter(fn($t) => str_starts_with(strtoupper($t['codice'] ?? ''), 'AC'))->values();
|
|
$ripartiAcqua = collect($ripartizioniPerTabella)->filter(fn($t) => str_starts_with(strtoupper($t['tabella_codice'] ?? ''), 'AC'))->values();
|
|
@endphp
|
|
|
|
@if($tabelleAcqua->isNotEmpty())
|
|
<div class="mt-6">
|
|
<h3 class="text-sm font-bold text-gray-900 mb-3">Millesimi e Quote Acqua di Preventivo</h3>
|
|
<div class="space-y-4">
|
|
@foreach($tabelleAcqua as $tabella)
|
|
<div class="rounded-2xl border border-cyan-100 bg-cyan-50/20 p-4">
|
|
<div class="flex items-center justify-between mb-2">
|
|
<span class="inline-flex items-center rounded-full bg-cyan-50 px-2.5 py-0.5 text-xs font-semibold text-cyan-700">{{ $tabella['codice'] }} · {{ $tabella['nome'] }}</span>
|
|
<div class="text-right">
|
|
<div class="text-xs text-gray-500">Totale tabella</div>
|
|
<div class="text-lg font-semibold text-gray-900">{{ number_format($tabella['total_preventivo'], 2, ',', '.') }} €</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="overflow-x-auto bg-white rounded-xl border border-cyan-100 p-2">
|
|
<table class="min-w-full text-sm">
|
|
<thead>
|
|
<tr class="text-gray-500">
|
|
<th class="text-left py-1">Voce</th>
|
|
<th class="text-right py-1">Preventivo</th>
|
|
<th class="text-right py-1">Quota unità</th>
|
|
<th class="text-right py-1">Prop.</th>
|
|
<th class="text-right py-1">Inquilino</th>
|
|
<th class="text-right py-1">% Prop.</th>
|
|
<th class="text-right py-1">% Inq.</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody class="divide-y">
|
|
@foreach($tabella['voci'] as $voce)
|
|
<tr>
|
|
<td class="py-1 text-gray-800">{{ $voce['codice'] }} · {{ $voce['descrizione'] }}</td>
|
|
<td class="py-1 text-right text-gray-900">{{ number_format($voce['importo_preventivato'] ?? 0, 2, ',', '.') }} €</td>
|
|
<td class="py-1 text-right text-gray-900">{{ number_format($voce['quota_unita'] ?? 0, 2, ',', '.') }} €</td>
|
|
<td class="py-1 text-right text-gray-900">{{ number_format($voce['importo_proprietario'] ?? 0, 2, ',', '.') }} €</td>
|
|
<td class="py-1 text-right text-gray-900">{{ number_format($voce['importo_inquilino'] ?? 0, 2, ',', '.') }} €</td>
|
|
<td class="py-1 text-right text-gray-700">{{ number_format(100.00 - ($voce['percentuale_inquilino'] ?? 0), 2, ',', '.') }} %</td>
|
|
<td class="py-1 text-right text-gray-700">{{ number_format($voce['percentuale_inquilino'] ?? 0, 2, ',', '.') }} %</td>
|
|
</tr>
|
|
@endforeach
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
@endforeach
|
|
</div>
|
|
</div>
|
|
@endif
|
|
|
|
@if($ripartiAcqua->isNotEmpty())
|
|
<div class="mt-6">
|
|
<h3 class="text-sm font-bold text-gray-900 mb-3">Millesimi e Quote Acqua di Consuntivo</h3>
|
|
<div class="space-y-4">
|
|
@foreach($ripartiAcqua as $tabella)
|
|
<div class="rounded-2xl border border-cyan-100 bg-cyan-50/20 overflow-hidden">
|
|
<div class="flex items-center gap-2 bg-white px-3 py-2 border-b border-cyan-100">
|
|
<span class="inline-flex items-center rounded-full bg-cyan-50 px-2 py-0.5 text-xs font-semibold text-cyan-700">{{ $tabella['tabella_codice'] }}</span>
|
|
<span class="text-sm font-semibold text-gray-900">{{ $tabella['tabella_nome'] }}</span>
|
|
</div>
|
|
<div class="overflow-x-auto bg-white">
|
|
<table class="min-w-full text-sm">
|
|
<thead>
|
|
<tr class="text-gray-500 border-b">
|
|
<th class="text-left py-2 px-2">Voce</th>
|
|
<th class="text-center py-2 px-2">Gestione</th>
|
|
<th class="text-center py-2 px-2">Calcolo</th>
|
|
<th class="text-right py-2 px-2">% applicata</th>
|
|
<th class="text-right py-2 px-2">Quota finale</th>
|
|
<th class="text-right py-2 px-2">% prop</th>
|
|
<th class="text-right py-2 px-2">% inquilino</th>
|
|
<th class="text-right py-2 px-2">Prop.</th>
|
|
<th class="text-right py-2 px-2">Inq.</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody class="divide-y">
|
|
@foreach($tabella['righe'] as $r)
|
|
<tr>
|
|
<td class="py-2 px-2 text-gray-900 font-semibold">{{ $r['voce_codice'] ?? '—' }} {{ $r['voce_descrizione'] ?? '' }}</td>
|
|
<td class="py-2 px-2 text-center text-gray-700">{{ $r['tipo_gestione'] ?? '—' }}</td>
|
|
<td class="py-2 px-2 text-center text-gray-700">{{ $r['calcolo'] ?? '—' }}</td>
|
|
<td class="py-2 px-2 text-right text-gray-900">{{ number_format($r['percentuale_applicata'] ?? 0, 2, ',', '.') }}%</td>
|
|
<td class="py-2 px-2 text-right text-gray-900">{{ number_format($r['quota_finale'] ?? 0, 4, ',', '.') }}</td>
|
|
<td class="py-2 px-2 text-right text-gray-900">{{ number_format(100.00 - ($r['percentuale_inquilino'] ?? 0), 2, ',', '.') }}%</td>
|
|
<td class="py-2 px-2 text-right text-gray-900">{{ number_format($r['percentuale_inquilino'] ?? 0, 2, ',', '.') }}%</td>
|
|
<td class="py-2 px-2 text-right text-gray-900">{{ number_format($r['importo_proprietario'] ?? 0, 4, ',', '.') }}</td>
|
|
<td class="py-2 px-2 text-right text-gray-900">{{ number_format($r['importo_inquilino'] ?? 0, 4, ',', '.') }}</td>
|
|
</tr>
|
|
@endforeach
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
@endforeach
|
|
</div>
|
|
</div>
|
|
@endif
|
|
</x-filament::section>
|
|
</div>
|
|
@endif
|
|
|
|
|
|
@if($tab === 'economico')
|
|
<div class="grid gap-4">
|
|
{{-- Contenuti economici: preventivi/riparti (rate emesse spostate nel tab Estratto conto) --}}
|
|
|
|
@if(!empty($preventiviPerTabella))
|
|
<x-filament::section>
|
|
<div class="flex flex-wrap items-center justify-between gap-3 mb-3">
|
|
<div>
|
|
<div class="text-sm font-semibold text-gray-900">Preventivo per tabella</div>
|
|
<div class="text-xs text-gray-500">Quote unità e riparto proprietario/inquilino (dett_tab cond_inquil).</div>
|
|
</div>
|
|
@if(!empty($totaliPerGestione))
|
|
<div class="flex flex-wrap gap-2 text-sm text-gray-700">
|
|
<span class="rounded border px-3 py-1 bg-gray-50">O: {{ number_format($totaliPerGestione['O'] ?? 0, 2, ',', '.') }} €</span>
|
|
<span class="rounded border px-3 py-1 bg-gray-50">R: {{ number_format($totaliPerGestione['R'] ?? 0, 2, ',', '.') }} €</span>
|
|
<span class="rounded border px-3 py-1 bg-gray-50">S: {{ number_format($totaliPerGestione['S'] ?? 0, 2, ',', '.') }} €</span>
|
|
</div>
|
|
@endif
|
|
</div>
|
|
|
|
<div class="space-y-4">
|
|
@foreach($preventiviPerTabella as $tabella)
|
|
@if(str_starts_with(strtoupper($tabella['codice'] ?? ''), 'AC')) @continue @endif
|
|
<div class="rounded-2xl border bg-gray-50 p-4">
|
|
|
|
<div class="flex items-center justify-between mb-2">
|
|
<div>
|
|
<div class="text-xs text-gray-600">{{ $tabella['tabella_codice'] }} · tipo {{ $tabella['tipo'] }}</div>
|
|
<div class="text-sm font-semibold text-gray-900">{{ $tabella['tabella_nome'] }}</div>
|
|
</div>
|
|
<div class="text-right">
|
|
<div class="text-xs text-gray-500">Totale tabella</div>
|
|
<div class="text-lg font-semibold text-gray-900">{{ number_format($tabella['total_preventivo'], 2, ',', '.') }} €</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="overflow-x-auto">
|
|
<table class="min-w-full text-sm">
|
|
<thead>
|
|
<tr class="text-gray-500">
|
|
<th class="text-left py-1">Voce</th>
|
|
<th class="text-right py-1">Preventivo</th>
|
|
<th class="text-right py-1">Quota unità</th>
|
|
<th class="text-right py-1">Prop.</th>
|
|
<th class="text-right py-1">Inquilino</th>
|
|
<th class="text-right py-1">% Prop.</th>
|
|
<th class="text-right py-1">% Inq.</th>
|
|
</tr>
|
|
</thead>
|
|
|
|
<tbody class="divide-y">
|
|
@foreach($tabella['voci'] as $voce)
|
|
<tr>
|
|
<td class="py-1 text-gray-800">{{ $voce['codice'] }} · {{ $voce['descrizione'] }}</td>
|
|
<td class="py-1 text-right text-gray-900">{{ number_format($voce['importo_preventivato'] ?? 0, 2, ',', '.') }} €</td>
|
|
<td class="py-1 text-right text-gray-900">{{ number_format($voce['quota_unita'] ?? 0, 2, ',', '.') }} €</td>
|
|
<td class="py-1 text-right text-gray-900">{{ number_format($voce['importo_proprietario'] ?? 0, 2, ',', '.') }} €</td>
|
|
<td class="py-1 text-right text-gray-900">{{ number_format($voce['importo_inquilino'] ?? 0, 2, ',', '.') }} €</td>
|
|
<td class="py-1 text-right text-gray-700">{{ number_format($voce['percentuale_inquilino'] ?? 0, 2, ',', '.') }} %</td>
|
|
</tr>
|
|
@endforeach
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
<div class="mt-3 grid grid-cols-1 md:grid-cols-3 gap-3 text-sm">
|
|
<div class="rounded border bg-white p-3">
|
|
<div class="text-gray-500">Millesimi unità / tabella</div>
|
|
<div class="font-semibold text-gray-900">{{ number_format($tabella['unit_millesimi'], 3, ',', '.') }} / {{ number_format($tabella['tabella_millesimi'], 3, ',', '.') }}</div>
|
|
</div>
|
|
<div class="rounded border bg-white p-3">
|
|
<div class="text-gray-500">Quota unità</div>
|
|
<div class="font-semibold text-gray-900">{{ number_format($tabella['quota_unit'], 2, ',', '.') }} €</div>
|
|
</div>
|
|
<div class="rounded border bg-white p-3">
|
|
<div class="text-gray-500">Riparto proprietario / inquilino</div>
|
|
<div class="font-semibold text-gray-900">{{ number_format($tabella['importo_proprietario'], 2, ',', '.') }} € / {{ number_format($tabella['importo_inquilino'], 2, ',', '.') }} €</div>
|
|
<div class="text-xs text-gray-500">% inquilino: {{ number_format($tabella['percentuale_inquilino'] ?? 0, 2, ',', '.') }}</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
@endforeach
|
|
</div>
|
|
</x-filament::section>
|
|
@endif
|
|
|
|
<x-filament::section>
|
|
<div class="flex items-center gap-2 text-sm font-semibold text-gray-900 mb-3">
|
|
<x-filament::icon icon="heroicon-o-banknotes" class="h-5 w-5 text-emerald-600" />
|
|
<span>Voci di spesa per tabella (prop. / inq.)</span>
|
|
</div>
|
|
@if(empty($ripartizioniPerTabella))
|
|
<div class="text-sm text-gray-500">Nessuna ripartizione registrata per questa unità.</div>
|
|
@else
|
|
<div class="space-y-3">
|
|
@foreach($ripartizioniPerTabella as $tabella)
|
|
@if(str_starts_with(strtoupper($tabella['tabella_codice'] ?? ''), 'AC')) @continue @endif
|
|
<div class="rounded-2xl border bg-gray-50 overflow-hidden">
|
|
|
|
<div class="flex items-center gap-2 bg-white px-3 py-2 border-b">
|
|
<span class="inline-flex items-center rounded-full border border-primary-200 bg-primary-50 px-2 py-0.5 text-xs font-semibold text-primary-700">{{ $tabella['tabella_codice'] }}</span>
|
|
<span class="text-sm font-semibold text-gray-900">{{ $tabella['tabella_nome'] }}</span>
|
|
</div>
|
|
<div class="overflow-x-auto">
|
|
<table class="min-w-full text-sm">
|
|
<thead>
|
|
<tr class="text-gray-500 border-b">
|
|
<th class="text-left py-2 px-2">Voce</th>
|
|
<th class="text-center py-2 px-2">Gestione</th>
|
|
<th class="text-center py-2 px-2">Calcolo</th>
|
|
<th class="text-right py-2 px-2">% applicata</th>
|
|
<th class="text-right py-2 px-2">Quota finale</th>
|
|
<th class="text-right py-2 px-2">% prop</th>
|
|
<th class="text-right py-2 px-2">% inquilino</th>
|
|
<th class="text-right py-2 px-2">Prop.</th>
|
|
<th class="text-right py-2 px-2">Inq.</th>
|
|
</tr>
|
|
</thead>
|
|
|
|
<tbody class="divide-y">
|
|
@foreach($tabella['righe'] as $r)
|
|
<tr>
|
|
<td class="py-2 px-2 text-gray-900 font-semibold">{{ $r['voce_codice'] ?? '—' }} {{ $r['voce_descrizione'] ?? '' }}</td>
|
|
<td class="py-2 px-2 text-center text-gray-700">{{ $r['tipo_gestione'] ?? '—' }}</td>
|
|
<td class="py-2 px-2 text-center text-gray-700">{{ $r['calcolo'] ?? '—' }}</td>
|
|
<td class="py-2 px-2 text-right text-gray-900">{{ number_format($r['percentuale_applicata'] ?? 0, 2, ',', '.') }}%</td>
|
|
<td class="py-2 px-2 text-right text-gray-900">{{ number_format($r['quota_finale'] ?? 0, 4, ',', '.') }}</td>
|
|
<td class="py-2 px-2 text-right text-gray-900">{{ number_format(100.00 - ($r['percentuale_inquilino'] ?? 0), 2, ',', '.') }}%</td>
|
|
<td class="py-2 px-2 text-right text-gray-900">{{ number_format($r['percentuale_inquilino'] ?? 0, 2, ',', '.') }}%</td>
|
|
<td class="py-2 px-2 text-right text-gray-900">{{ number_format($r['importo_proprietario'] ?? 0, 4, ',', '.') }}</td>
|
|
<td class="py-2 px-2 text-right text-gray-900">{{ number_format($r['importo_inquilino'] ?? 0, 4, ',', '.') }}</td>
|
|
</tr>
|
|
|
|
@endforeach
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
@endforeach
|
|
</div>
|
|
@endif
|
|
</x-filament::section>
|
|
</div>
|
|
@endif
|
|
|
|
@if($tab === 'estratto_conto')
|
|
@php
|
|
$rateCondomini = $rateEmessePerCategoria['condomini'] ?? [];
|
|
$rateInquilini = $rateEmessePerCategoria['inquilini'] ?? [];
|
|
|
|
$sumBlk = function (array $items, string $field): float {
|
|
$s = 0.0;
|
|
foreach ($items as $it) {
|
|
$s += (float) ($it[$field] ?? 0);
|
|
}
|
|
return $s;
|
|
};
|
|
|
|
$totCAddeb = $sumBlk($rateCondomini, 'totale_addebitato');
|
|
$totCPag = $sumBlk($rateCondomini, 'totale_pagato');
|
|
$totCRes = $sumBlk($rateCondomini, 'residuo');
|
|
|
|
$totIAddeb = $sumBlk($rateInquilini, 'totale_addebitato');
|
|
$totIPag = $sumBlk($rateInquilini, 'totale_pagato');
|
|
$totIRes = $sumBlk($rateInquilini, 'residuo');
|
|
|
|
if (empty($rateCondomini) && empty($rateInquilini)) {
|
|
$totCAddeb = (float) collect($estrattoRateRowsProprietario ?? [])->sum('dovuto');
|
|
$totCPag = (float) collect($estrattoIncassiProprietario ?? [])->sum('importo');
|
|
$totCRes = $totCAddeb - $totCPag;
|
|
|
|
$totIAddeb = (float) collect($estrattoRateRowsInquilino ?? [])->sum('dovuto');
|
|
$totIPag = (float) collect($estrattoIncassiInquilino ?? [])->sum('importo');
|
|
$totIRes = $totIAddeb - $totIPag;
|
|
}
|
|
@endphp
|
|
|
|
<div class="space-y-6">
|
|
<!-- SEZIONE PROPRIETARIO (C) -->
|
|
<x-filament::section>
|
|
<div class="flex items-center justify-between border-b pb-2 mb-4">
|
|
<div class="flex items-center gap-2 text-sm font-semibold text-gray-900">
|
|
<x-filament::icon icon="heroicon-o-user" class="h-5 w-5 text-primary-600" />
|
|
<span>Estratto Conto PROPRIETARIO (Condòmino - C)</span>
|
|
</div>
|
|
<div class="text-right text-xs">
|
|
<span class="font-medium text-gray-500">Addebito:</span> <span class="font-bold text-gray-900">{{ number_format($totCAddeb, 2, ',', '.') }} €</span> ·
|
|
<span class="font-medium text-gray-500">Pagato:</span> <span class="font-bold text-emerald-600">{{ number_format($totCPag, 2, ',', '.') }} €</span> ·
|
|
<span class="font-medium text-gray-500">Residuo:</span> <span class="font-bold text-amber-600">{{ number_format($totCRes, 2, ',', '.') }} €</span>
|
|
</div>
|
|
</div>
|
|
|
|
@php
|
|
$movimentiC = [];
|
|
$seenC = [];
|
|
foreach ($estrattoRateRowsProprietario ?? [] as $r) {
|
|
$k = ($r['gestione']??'').'|'.($r['data_emissione']??'').'|'.($r['descrizione']??'').'|'.number_format((float)($r['dovuto']??0), 2, '.', '');
|
|
if(isset($seenC[$k])) continue;
|
|
$seenC[$k] = true;
|
|
$movimentiC[] = [
|
|
'tipo' => 'rata',
|
|
'data' => $r['data_emissione'] ?? null,
|
|
'descrizione' => $r['descrizione'] ?? '',
|
|
'ref' => !empty($r['avviso']) ? ('Avv. ' . $r['avviso']) : '',
|
|
'dovuto' => (float)$r['dovuto'],
|
|
'incasso' => (float)$r['pagato'],
|
|
'residuo' => (float)$r['residuo'],
|
|
'gestione' => $r['gestione'] ?? 'Ordinaria',
|
|
];
|
|
}
|
|
foreach ($estrattoIncassiProprietario ?? [] as $i) {
|
|
$k = ($i['data']??'').'|'.($i['descrizione']??'').'|'.number_format((float)($i['importo']??0), 2, '.', '');
|
|
if(isset($seenC[$k])) continue;
|
|
$seenC[$k] = true;
|
|
$movimentiC[] = [
|
|
'tipo' => 'incasso',
|
|
'data' => $i['data'] ?? null,
|
|
'descrizione' => $i['descrizione'] ?? '',
|
|
'ref' => !empty($i['n_ricevuta']) ? ('Ric. ' . $i['n_ricevuta']) : '',
|
|
'dovuto' => null,
|
|
'incasso' => (float)$i['importo'],
|
|
'residuo' => null,
|
|
'gestione' => $i['gestione'] ?? 'Ordinaria',
|
|
];
|
|
}
|
|
foreach ($estrattoConguagliIniziali ?? [] as $c) {
|
|
$importo = (float)($c['importo'] ?? 0);
|
|
if(abs($importo) < 0.0001) continue;
|
|
$movimentiC[] = [
|
|
'tipo' => 'conguaglio',
|
|
'data' => $c['data'] ?? null,
|
|
'descrizione' => $c['descrizione'] ?? '',
|
|
'ref' => trim(($c['gestione_label'] ?? '') . ' ' . ($c['tipo'] ?? '')),
|
|
'dovuto' => $importo,
|
|
'incasso' => null,
|
|
'residuo' => $importo,
|
|
'gestione' => $c['gestione_label'] ?? 'Ordinaria',
|
|
];
|
|
}
|
|
usort($movimentiC, function($a, $b){
|
|
$da = $a['data'] ? \Carbon\Carbon::createFromFormat('d/m/Y', $a['data'])->timestamp : 0;
|
|
$db = $b['data'] ? \Carbon\Carbon::createFromFormat('d/m/Y', $b['data'])->timestamp : 0;
|
|
return $da <=> $db;
|
|
});
|
|
@endphp
|
|
|
|
@if(empty($movimentiC))
|
|
<div class="text-xs text-gray-500 py-2">Nessuna rata o incasso registrato per il proprietario.</div>
|
|
@else
|
|
<div class="overflow-x-auto rounded-xl border">
|
|
<table class="min-w-full text-xs">
|
|
<thead class="bg-gray-50 border-b">
|
|
<tr>
|
|
<th class="text-left py-2 px-3 text-gray-600">Data</th>
|
|
<th class="text-left py-2 px-3 text-gray-600">Tipo</th>
|
|
<th class="text-left py-2 px-3 text-gray-600">Descrizione</th>
|
|
<th class="text-left py-2 px-3 text-gray-600">Rif.</th>
|
|
<th class="text-right py-2 px-3 text-gray-600">Dovuto</th>
|
|
<th class="text-right py-2 px-3 text-gray-600">Pagato</th>
|
|
<th class="text-right py-2 px-3 text-gray-600">Residuo</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody class="divide-y">
|
|
@foreach($movimentiC as $m)
|
|
<tr>
|
|
<td class="py-2 px-3">{{ $m['data'] ?? '—' }}</td>
|
|
<td class="py-2 px-3 font-semibold">{{ $m['tipo'] === 'rata' ? 'Rata' : ($m['tipo'] === 'conguaglio' ? 'Conguaglio' : 'Incasso') }}</td>
|
|
<td class="py-2 px-3 text-gray-900">{{ $m['descrizione'] }}</td>
|
|
<td class="py-2 px-3 text-gray-500">{{ $m['ref'] ?: '—' }}</td>
|
|
<td class="py-2 px-3 text-right tabular-nums">{{ $m['dovuto'] !== null ? number_format($m['dovuto'], 2, ',', '.') . ' €' : '—' }}</td>
|
|
<td class="py-2 px-3 text-right tabular-nums">{{ $m['incasso'] !== null ? number_format($m['incasso'], 2, ',', '.') . ' €' : '—' }}</td>
|
|
<td class="py-2 px-3 text-right tabular-nums font-semibold">{{ $m['residuo'] !== null ? number_format($m['residuo'], 2, ',', '.') . ' €' : '—' }}</td>
|
|
</tr>
|
|
@endforeach
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
@endif
|
|
|
|
@if(!empty($rateCondomini))
|
|
<div class="mt-4 border-t pt-3">
|
|
<div class="text-xs font-semibold text-gray-700 mb-2">Schede anagrafiche collegate:</div>
|
|
<div class="grid gap-2 sm:grid-cols-2 lg:grid-cols-3">
|
|
@foreach($rateCondomini as $rc)
|
|
@php
|
|
$sid = (int) ($rc['soggetto_id'] ?? 0);
|
|
$url = $sid > 0 ? \App\Filament\Pages\Contabilita\EstrattoContoSoggetto::getUrl(panel: 'admin-filament', parameters: ['record' => $sid]) . '?' . http_build_query(['vista' => 'unita', 'unita_id' => (int) ($this->unita?->id ?? 0)]) : null;
|
|
@endphp
|
|
<div class="p-2 border rounded-lg bg-gray-50/50 flex justify-between items-center text-xs">
|
|
<div>
|
|
<div class="font-bold text-gray-900">{{ $rc['nome'] }}</div>
|
|
<div class="text-[10px] text-gray-500">Addebito: {{ number_format($rc['totale_addebitato'], 2, ',', '.') }} €</div>
|
|
</div>
|
|
@if($url)
|
|
<a href="{{ $url }}" class="px-2 py-1 bg-white hover:bg-gray-100 border rounded text-[10px] font-semibold">Apri scheda</a>
|
|
@endif
|
|
</div>
|
|
@endforeach
|
|
</div>
|
|
</div>
|
|
@endif
|
|
</x-filament::section>
|
|
|
|
<!-- SEZIONE INQUILINO (I) -->
|
|
<x-filament::section>
|
|
<div class="flex items-center justify-between border-b pb-2 mb-4">
|
|
<div class="flex items-center gap-2 text-sm font-semibold text-gray-900">
|
|
<x-filament::icon icon="heroicon-o-users" class="h-5 w-5 text-emerald-600" />
|
|
<span>Estratto Conto CONDUTTORE (Inquilino - I)</span>
|
|
</div>
|
|
<div class="text-right text-xs">
|
|
<span class="font-medium text-gray-500">Addebito:</span> <span class="font-bold text-gray-900">{{ number_format($totIAddeb, 2, ',', '.') }} €</span> ·
|
|
<span class="font-medium text-gray-500">Pagato:</span> <span class="font-bold text-emerald-600">{{ number_format($totIPag, 2, ',', '.') }} €</span> ·
|
|
<span class="font-medium text-gray-500">Residuo:</span> <span class="font-bold text-amber-600">{{ number_format($totIRes, 2, ',', '.') }} €</span>
|
|
</div>
|
|
</div>
|
|
|
|
@php
|
|
$movimentiI = [];
|
|
$seenI = [];
|
|
foreach ($estrattoRateRowsInquilino ?? [] as $r) {
|
|
$k = ($r['gestione']??'').'|'.($r['data_emissione']??'').'|'.($r['descrizione']??'').'|'.number_format((float)($r['dovuto']??0), 2, '.', '');
|
|
if(isset($seenI[$k])) continue;
|
|
$seenI[$k] = true;
|
|
$movimentiI[] = [
|
|
'tipo' => 'rata',
|
|
'data' => $r['data_emissione'] ?? null,
|
|
'descrizione' => $r['descrizione'] ?? '',
|
|
'ref' => !empty($r['avviso']) ? ('Avv. ' . $r['avviso']) : '',
|
|
'dovuto' => (float)$r['dovuto'],
|
|
'incasso' => (float)$r['pagato'],
|
|
'residuo' => (float)$r['residuo'],
|
|
'gestione' => $r['gestione'] ?? 'Ordinaria',
|
|
];
|
|
}
|
|
foreach ($estrattoIncassiInquilino ?? [] as $i) {
|
|
$k = ($i['data']??'').'|'.($i['descrizione']??'').'|'.number_format((float)($i['importo']??0), 2, '.', '');
|
|
if(isset($seenI[$k])) continue;
|
|
$seenI[$k] = true;
|
|
$movimentiI[] = [
|
|
'tipo' => 'incasso',
|
|
'data' => $i['data'] ?? null,
|
|
'descrizione' => $i['descrizione'] ?? '',
|
|
'ref' => !empty($i['n_ricevuta']) ? ('Ric. ' . $i['n_ricevuta']) : '',
|
|
'dovuto' => null,
|
|
'incasso' => (float)$i['importo'],
|
|
'residuo' => null,
|
|
'gestione' => $i['gestione'] ?? 'Ordinaria',
|
|
];
|
|
}
|
|
usort($movimentiI, function($a, $b){
|
|
$da = $a['data'] ? \Carbon\Carbon::createFromFormat('d/m/Y', $a['data'])->timestamp : 0;
|
|
$db = $b['data'] ? \Carbon\Carbon::createFromFormat('d/m/Y', $b['data'])->timestamp : 0;
|
|
return $da <=> $db;
|
|
});
|
|
@endphp
|
|
|
|
@if(empty($movimentiI))
|
|
<div class="text-xs text-gray-500 py-2">Nessuna rata o incasso registrato per l'inquilino.</div>
|
|
@else
|
|
<div class="overflow-x-auto rounded-xl border">
|
|
<table class="min-w-full text-xs">
|
|
<thead class="bg-gray-50 border-b">
|
|
<tr>
|
|
<th class="text-left py-2 px-3 text-gray-600">Data</th>
|
|
<th class="text-left py-2 px-3 text-gray-600">Tipo</th>
|
|
<th class="text-left py-2 px-3 text-gray-600">Descrizione</th>
|
|
<th class="text-left py-2 px-3 text-gray-600">Rif.</th>
|
|
<th class="text-right py-2 px-3 text-gray-600">Dovuto</th>
|
|
<th class="text-right py-2 px-3 text-gray-600">Pagato</th>
|
|
<th class="text-right py-2 px-3 text-gray-600">Residuo</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody class="divide-y">
|
|
@foreach($movimentiI as $m)
|
|
<tr>
|
|
<td class="py-2 px-3">{{ $m['data'] ?? '—' }}</td>
|
|
<td class="py-2 px-3 font-semibold">{{ $m['tipo'] === 'rata' ? 'Rata' : 'Incasso' }}</td>
|
|
<td class="py-2 px-3 text-gray-900">{{ $m['descrizione'] }}</td>
|
|
<td class="py-2 px-3 text-gray-500">{{ $m['ref'] ?: '—' }}</td>
|
|
<td class="py-2 px-3 text-right tabular-nums">{{ $m['dovuto'] !== null ? number_format($m['dovuto'], 2, ',', '.') . ' €' : '—' }}</td>
|
|
<td class="py-2 px-3 text-right tabular-nums">{{ $m['incasso'] !== null ? number_format($m['incasso'], 2, ',', '.') . ' €' : '—' }}</td>
|
|
<td class="py-2 px-3 text-right tabular-nums font-semibold">{{ $m['residuo'] !== null ? number_format($m['residuo'], 2, ',', '.') . ' €' : '—' }}</td>
|
|
</tr>
|
|
@endforeach
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
@endif
|
|
|
|
@if(!empty($rateInquilini))
|
|
<div class="mt-4 border-t pt-3">
|
|
<div class="text-xs font-semibold text-gray-700 mb-2">Schede anagrafiche collegate:</div>
|
|
<div class="grid gap-2 sm:grid-cols-2 lg:grid-cols-3">
|
|
@foreach($rateInquilini as $ri)
|
|
@php
|
|
$sid = (int) ($ri['soggetto_id'] ?? 0);
|
|
$url = $sid > 0 ? \App\Filament\Pages\Contabilita\EstrattoContoSoggetto::getUrl(panel: 'admin-filament', parameters: ['record' => $sid]) . '?' . http_build_query(['vista' => 'unita', 'unita_id' => (int) ($this->unita?->id ?? 0)]) : null;
|
|
@endphp
|
|
<div class="p-2 border rounded-lg bg-gray-50/50 flex justify-between items-center text-xs">
|
|
<div>
|
|
<div class="font-bold text-gray-900">{{ $ri['nome'] }}</div>
|
|
<div class="text-[10px] text-gray-500">Addebito: {{ number_format($ri['totale_addebitato'], 2, ',', '.') }} €</div>
|
|
</div>
|
|
@if($url)
|
|
<a href="{{ $url }}" class="px-2 py-1 bg-white hover:bg-gray-100 border rounded text-[10px] font-semibold">Apri scheda</a>
|
|
@endif
|
|
</div>
|
|
@endforeach
|
|
</div>
|
|
</div>
|
|
@endif
|
|
</x-filament::section>
|
|
</div>
|
|
@endif
|
|
</div>
|
|
</x-filament::section>
|
|
@endif
|
|
|
|
{{-- Modal Anteprima Documento Protocollo / Comunicazione --}}
|
|
@if($showDocModal && $activeDoc)
|
|
<div class="fixed inset-0 z-50 overflow-y-auto bg-gray-900/60 backdrop-blur-xs flex items-center justify-center p-4">
|
|
<div class="bg-white dark:bg-gray-800 rounded-2xl shadow-2xl border border-gray-200 dark:border-gray-700 w-full max-w-3xl overflow-hidden">
|
|
<div class="flex items-center justify-between px-4 py-3 bg-gray-100 dark:bg-gray-900 border-b border-gray-200 dark:border-gray-700">
|
|
<div class="font-bold text-sm text-gray-800 dark:text-gray-200 truncate flex items-center gap-2">
|
|
<x-heroicon-m-document-text class="w-4 h-4 text-indigo-600" />
|
|
<span>{{ $activeDoc['title'] }}</span>
|
|
</div>
|
|
<button wire:click="closeDocModal" type="button" class="text-gray-400 hover:text-gray-700 dark:hover:text-gray-200">
|
|
<x-heroicon-m-x-mark class="w-5 h-5" />
|
|
</button>
|
|
</div>
|
|
|
|
<div class="p-4 max-h-[70vh] overflow-y-auto flex items-center justify-center bg-gray-50 dark:bg-gray-950">
|
|
@php
|
|
$dPath = $activeDoc['path'] ?? null;
|
|
$dExists = $activeDoc['exists'] ?? false;
|
|
$dType = $activeDoc['content_type'] ?? 'application/pdf';
|
|
$isPdf = str_contains($dType, 'pdf') || ($dPath && str_ends_with(strtolower($dPath), '.pdf'));
|
|
$isImg = str_starts_with($dType, 'image/') || ($dPath && preg_match('/\.(jpg|jpeg|png|webp|gif)$/i', $dPath));
|
|
@endphp
|
|
|
|
@if(! $dExists && empty($activeDoc['content']))
|
|
<div class="text-center text-sm text-amber-600 p-8 space-y-2">
|
|
<div class="text-2xl">📁</div>
|
|
<div class="font-semibold">Documento non presente nel disco locale</div>
|
|
<div class="text-xs text-gray-500 font-mono">{{ $dPath }}</div>
|
|
</div>
|
|
@elseif($isImg && $dPath && file_exists($dPath))
|
|
@php
|
|
$b64 = base64_encode(file_get_contents($dPath));
|
|
@endphp
|
|
<img src="data:image/jpeg;base64,{{ $b64 }}" alt="Documento" class="max-h-[60vh] max-w-full rounded-lg object-contain shadow" />
|
|
@elseif($isPdf && $dPath && file_exists($dPath))
|
|
@php
|
|
$b64 = base64_encode(file_get_contents($dPath));
|
|
@endphp
|
|
<iframe src="data:application/pdf;base64,{{ $b64 }}" class="w-full h-[60vh] rounded-lg border border-gray-300 dark:border-gray-700"></iframe>
|
|
@elseif(!empty($activeDoc['content']))
|
|
<div class="p-4 bg-white dark:bg-gray-900 rounded-lg text-xs font-mono text-gray-800 dark:text-gray-200 whitespace-pre-wrap max-h-[50vh] overflow-y-auto w-full">
|
|
{{ $activeDoc['content'] }}
|
|
</div>
|
|
@else
|
|
<div class="text-center space-y-3 p-8">
|
|
<x-heroicon-o-document class="w-16 h-16 mx-auto text-gray-400" />
|
|
<div class="text-sm font-semibold text-gray-800 dark:text-gray-200">{{ $activeDoc['title'] }}</div>
|
|
<div class="text-xs text-gray-400">Percorso: {{ $dPath }}</div>
|
|
</div>
|
|
@endif
|
|
</div>
|
|
|
|
<div class="flex items-center justify-end gap-2 p-3 bg-gray-50 dark:bg-gray-900 border-t border-gray-200 dark:border-gray-700">
|
|
<button
|
|
wire:click="closeDocModal"
|
|
type="button"
|
|
class="px-4 py-1.5 text-xs font-semibold text-gray-600 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700 rounded-lg transition"
|
|
>
|
|
Chiudi
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
@endif
|
|
</div>
|
|
</x-filament-panels::page>
|