863 lines
62 KiB
PHP
Executable File
863 lines
62 KiB
PHP
Executable File
<x-filament::page>
|
||
<div class="mx-auto max-w-7xl space-y-4">
|
||
{{-- BARRA PULSANTINI ICONICI COMPATTI UNIFICATA --}}
|
||
<div class="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-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>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>
|
||
<a href="{{ \App\Filament\Pages\Affitti\GestioneAffitti::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>Gestione Affitti</span>
|
||
</a>
|
||
<a href="{{ \App\Filament\Pages\Gescon\AnagraficaUnica::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>Anagrafica Unica</span>
|
||
</a>
|
||
</div>
|
||
|
||
<div class="flex items-center gap-2">
|
||
<button type="button" wire:click="createAffitto"
|
||
class="inline-flex items-center gap-1 rounded-lg bg-emerald-600 px-3 py-1.5 text-xs font-semibold text-white shadow-xs hover:bg-emerald-500 transition">
|
||
<span>➕</span>
|
||
<span>Nuovo Immobile</span>
|
||
</button>
|
||
<button type="button" wire:click="saveAffitto"
|
||
class="inline-flex items-center gap-1 rounded-lg bg-indigo-600 px-3 py-1.5 text-xs font-semibold text-white shadow-xs hover:bg-indigo-500 transition">
|
||
<span>💾</span>
|
||
<span>Salva</span>
|
||
</button>
|
||
@if($selectedAffittoId)
|
||
@if($selectedAffittoObsoleto)
|
||
<button type="button" wire:click="riattivaContratto"
|
||
class="inline-flex items-center gap-1 rounded-lg border border-emerald-300 bg-emerald-50 px-2.5 py-1.5 text-xs font-semibold text-emerald-700 hover:bg-emerald-100">
|
||
<span>🔄</span>
|
||
<span>Riattiva Contratto</span>
|
||
</button>
|
||
@else
|
||
<button type="button" wire:click="markContrattoObsoleto"
|
||
class="inline-flex items-center gap-1 rounded-lg border border-amber-300 bg-amber-50 px-2.5 py-1.5 text-xs font-semibold text-amber-700 hover:bg-amber-100">
|
||
<span>⚠️</span>
|
||
<span>Segna Obsoleto</span>
|
||
</button>
|
||
@endif
|
||
@endif
|
||
</div>
|
||
</div>
|
||
|
||
{{-- KPI SUMMARY CARDS --}}
|
||
@php($kpi = $this->kpiStats)
|
||
<div class="grid grid-cols-2 gap-3 sm:grid-cols-3 lg:grid-cols-5">
|
||
<div class="rounded-xl border border-slate-200 bg-gradient-to-br from-white to-slate-50 p-3 shadow-xs">
|
||
<div class="flex items-center justify-between text-xs font-medium text-slate-500">
|
||
<span>🏢 Locazioni</span>
|
||
<span class="rounded bg-slate-100 px-1.5 py-0.5 text-[10px] font-semibold text-slate-600">Attive: {{ $kpi['totale_attivi'] }}</span>
|
||
</div>
|
||
<div class="mt-1.5 text-xl font-bold text-slate-800">{{ $kpi['totale_locazioni'] }}</div>
|
||
<div class="mt-0.5 text-[11px] text-slate-400">Totale unità gestite</div>
|
||
</div>
|
||
|
||
<div class="rounded-xl border border-emerald-200 bg-gradient-to-br from-white to-emerald-50/40 p-3 shadow-xs">
|
||
<div class="flex items-center justify-between text-xs font-medium text-emerald-700">
|
||
<span>💶 Canoni Dovuti</span>
|
||
<span class="text-xs">📈</span>
|
||
</div>
|
||
<div class="mt-1.5 text-xl font-bold text-emerald-800">€ {{ number_format($kpi['canoni_dovuti'], 2, ',', '.') }}</div>
|
||
<div class="mt-0.5 text-[11px] text-emerald-600">Importo complessivo emesso</div>
|
||
</div>
|
||
|
||
<div class="rounded-xl border border-blue-200 bg-gradient-to-br from-white to-blue-50/40 p-3 shadow-xs">
|
||
<div class="flex items-center justify-between text-xs font-medium text-blue-700">
|
||
<span>💳 Canoni Incassati</span>
|
||
<span class="text-xs">💰</span>
|
||
</div>
|
||
<div class="mt-1.5 text-xl font-bold text-blue-800">€ {{ number_format($kpi['canoni_incassati'], 2, ',', '.') }}</div>
|
||
<div class="mt-0.5 text-[11px] text-blue-600">Totale quote riscosse</div>
|
||
</div>
|
||
|
||
<div class="rounded-xl border {{ $kpi['saldo_pendenze'] > 0.01 ? 'border-amber-300 bg-amber-50/30' : 'border-slate-200 bg-slate-50/50' }} p-3 shadow-xs">
|
||
<div class="flex items-center justify-between text-xs font-medium {{ $kpi['saldo_pendenze'] > 0.01 ? 'text-amber-800' : 'text-slate-600' }}">
|
||
<span>⚖️ Saldo Pendenze</span>
|
||
<span class="text-xs">{{ $kpi['saldo_pendenze'] > 0.01 ? '⚠️' : '✅' }}</span>
|
||
</div>
|
||
<div class="mt-1.5 text-xl font-bold {{ $kpi['saldo_pendenze'] > 0.01 ? 'text-amber-800' : 'text-slate-800' }}">
|
||
€ {{ number_format($kpi['saldo_pendenze'], 2, ',', '.') }}
|
||
</div>
|
||
<div class="mt-0.5 text-[11px] {{ $kpi['saldo_pendenze'] > 0.01 ? 'text-amber-700' : 'text-slate-400' }}">
|
||
{{ $kpi['saldo_pendenze'] > 0.01 ? 'Canoni arretrati residui' : 'Nessun arretrato' }}
|
||
</div>
|
||
</div>
|
||
|
||
<div class="rounded-xl border {{ $kpi['avvisi_scadenze'] > 0 ? 'border-rose-300 bg-rose-50/30' : 'border-slate-200 bg-slate-50/50' }} p-3 shadow-xs">
|
||
<div class="flex items-center justify-between text-xs font-medium {{ $kpi['avvisi_scadenze'] > 0 ? 'text-rose-800' : 'text-slate-600' }}">
|
||
<span>🔔 Scadenze / Avvisi</span>
|
||
<span class="text-xs">{{ $kpi['avvisi_scadenze'] > 0 ? '🔴' : '⚪' }}</span>
|
||
</div>
|
||
<div class="mt-1.5 text-xl font-bold {{ $kpi['avvisi_scadenze'] > 0 ? 'text-rose-800' : 'text-slate-800' }}">
|
||
{{ $kpi['avvisi_scadenze'] }}
|
||
</div>
|
||
<div class="mt-0.5 text-[11px] {{ $kpi['avvisi_scadenze'] > 0 ? 'text-rose-700' : 'text-slate-400' }}">
|
||
{{ $kpi['avvisi_scadenze'] > 0 ? 'Rinnovi o AdE urgenti' : 'Tutti i contratti in regola' }}
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
{{-- SELETTORE STABILE & IMMOBILE CORRENTE --}}
|
||
<div class="flex flex-wrap items-center justify-between gap-3 rounded-xl border border-slate-200 bg-white p-3 shadow-xs">
|
||
<div class="flex flex-wrap items-center gap-3">
|
||
<div class="text-xs font-semibold text-slate-700">🏢 Stabile:</div>
|
||
<select wire:model.live="stabileFilterId" class="fi-input fi-input-wrp fi-select-input text-xs rounded-lg border-slate-300 py-1.5">
|
||
<option value="">— Tutti gli stabili —</option>
|
||
@foreach($stabileOptions as $id => $label)
|
||
<option value="{{ $id }}">{{ $label }}</option>
|
||
@endforeach
|
||
</select>
|
||
|
||
@if(!empty($affittiOptions))
|
||
<div class="text-xs font-semibold text-slate-700">📑 Immobile:</div>
|
||
<select wire:model.live="selectedAffittoId" class="fi-input fi-input-wrp fi-select-input text-xs rounded-lg border-slate-300 py-1.5 max-w-xs">
|
||
@foreach($affittiOptions as $id => $label)
|
||
<option value="{{ $id }}">{{ $label }}</option>
|
||
@endforeach
|
||
</select>
|
||
@endif
|
||
</div>
|
||
|
||
@if($selectedAffittoId)
|
||
<div class="flex items-center gap-2">
|
||
@if(!empty($form['unita_immobiliare_id']))
|
||
<a href="{{ \App\Filament\Pages\UnitaImmobiliarePage::getUrl(panel: 'admin-filament') . '?unita_id=' . $form['unita_immobiliare_id'] }}"
|
||
class="inline-flex items-center gap-1 rounded-lg border border-slate-200 bg-slate-50 px-2.5 py-1 text-xs font-medium text-slate-700 hover:bg-slate-100">
|
||
<span>🏠</span>
|
||
<span>Scheda Unità</span>
|
||
</a>
|
||
@endif
|
||
@php($resolvedPersonaId = $this->resolvePersonaIdForSelected())
|
||
@if($resolvedPersonaId)
|
||
<a href="{{ \App\Filament\Pages\Gescon\AnagraficaUnica::getUrl(panel: 'admin-filament') . '?persona_id=' . $resolvedPersonaId }}"
|
||
class="inline-flex items-center gap-1 rounded-lg border border-slate-200 bg-slate-50 px-2.5 py-1 text-xs font-medium text-slate-700 hover:bg-slate-100">
|
||
<span>🪪</span>
|
||
<span>Anagrafica Conduttore</span>
|
||
</a>
|
||
@endif
|
||
</div>
|
||
@endif
|
||
</div>
|
||
|
||
{{-- PILL TAB BAR --}}
|
||
<div class="flex flex-wrap items-center gap-1.5 border-b border-slate-200 pb-2">
|
||
@php
|
||
$tabs = [
|
||
'elenco' => ['label' => 'Elenco Immobili a Reddito', 'icon' => '🏢'],
|
||
'anagrafica' => ['label' => 'Anagrafica & Catasto Unità', 'icon' => '🏠'],
|
||
'banca' => ['label' => 'Banca & Incassi', 'icon' => '🏦'],
|
||
'scadenze' => ['label' => 'Contratto & Clausole', 'icon' => '📜'],
|
||
'canoni' => ['label' => 'Canoni & Rate', 'icon' => '💶'],
|
||
'documenti' => ['label' => 'Documenti & Allegati', 'icon' => '📁'],
|
||
];
|
||
@endphp
|
||
@foreach($tabs as $key => $tabData)
|
||
<button type="button" wire:click="setTab('{{ $key }}')"
|
||
class="inline-flex items-center gap-1.5 rounded-lg px-3 py-1.5 text-xs font-semibold transition {{ $tab === $key ? 'bg-indigo-600 text-white shadow-xs' : 'bg-slate-100 text-slate-600 hover:bg-slate-200 hover:text-slate-900' }}">
|
||
<span>{{ $tabData['icon'] }}</span>
|
||
<span>{{ $tabData['label'] }}</span>
|
||
</button>
|
||
@endforeach
|
||
</div>
|
||
|
||
{{-- TAB 1: ELENCO IMMOBILI A REDDITO --}}
|
||
@if($tab === 'elenco')
|
||
@php
|
||
$rows = collect($affittiList);
|
||
if (!empty($stabileFilterId)) {
|
||
$rows = $rows->filter(fn($r) => (int)($r['stabile_id'] ?? 0) === (int)$stabileFilterId);
|
||
}
|
||
if (($elencoTipoFiltro ?? 'tutti') === 'ade') {
|
||
$rows = $rows->filter(function ($row) {
|
||
$tipoRiga = strtoupper((string)($row['tipo_riga'] ?? ''));
|
||
$isInternal = str_contains($tipoRiga, 'INT') || str_contains($tipoRiga, 'RIMB') || str_contains($tipoRiga, 'SERV');
|
||
if ($isInternal) {
|
||
return false;
|
||
}
|
||
return !empty($row['inizio_contratto']) || !empty($row['prossima_registrazione']);
|
||
});
|
||
}
|
||
if (($elencoTipoFiltro ?? 'tutti') === 'interni') {
|
||
$rows = $rows->reject(function ($row) {
|
||
$tipoRiga = strtoupper((string)($row['tipo_riga'] ?? ''));
|
||
$isInternal = str_contains($tipoRiga, 'INT') || str_contains($tipoRiga, 'RIMB') || str_contains($tipoRiga, 'SERV');
|
||
if ($isInternal) {
|
||
return false;
|
||
}
|
||
return !empty($row['inizio_contratto']) || !empty($row['prossima_registrazione']);
|
||
});
|
||
}
|
||
if (($elencoStatoContrattoFiltro ?? 'attivi') === 'attivi') {
|
||
$rows = $rows->reject(fn($row) => (bool)($row['obsoleto'] ?? false));
|
||
}
|
||
if (($elencoStatoContrattoFiltro ?? 'attivi') === 'obsoleti') {
|
||
$rows = $rows->filter(fn($row) => (bool)($row['obsoleto'] ?? false));
|
||
}
|
||
@endphp
|
||
|
||
<div class="rounded-xl border border-slate-200 bg-white overflow-hidden shadow-xs">
|
||
<div class="flex flex-wrap items-center justify-between gap-3 border-b border-slate-200 bg-slate-50/70 p-3 text-xs">
|
||
<div class="flex flex-wrap items-center gap-3">
|
||
<div>
|
||
<label class="text-[11px] font-medium text-slate-500">Tipo Locazione:</label>
|
||
<select wire:model.live="elencoTipoFiltro" class="rounded-lg border-slate-300 text-xs py-1 px-2">
|
||
<option value="tutti">Tutti i tipi</option>
|
||
<option value="ade">Registrati AdE / RLI</option>
|
||
<option value="interni">Addebiti interni / Parti comuni</option>
|
||
</select>
|
||
</div>
|
||
<div>
|
||
<label class="text-[11px] font-medium text-slate-500">Stato:</label>
|
||
<select wire:model.live="elencoStatoContrattoFiltro" class="rounded-lg border-slate-300 text-xs py-1 px-2">
|
||
<option value="attivi">Solo Attivi</option>
|
||
<option value="obsoleti">Solo Obsoleti</option>
|
||
<option value="tutti">Tutti gli stati</option>
|
||
</select>
|
||
</div>
|
||
</div>
|
||
<div class="text-xs font-medium text-slate-500">
|
||
Totale contratti: <span class="font-bold text-slate-800">{{ $rows->count() }}</span>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="overflow-x-auto">
|
||
<table class="min-w-full divide-y divide-slate-200 text-xs">
|
||
<thead class="bg-slate-50 text-slate-600 font-semibold">
|
||
<tr>
|
||
<th class="px-3 py-2.5 text-left">Codice</th>
|
||
<th class="px-3 py-2.5 text-left">Descrizione Immobile</th>
|
||
<th class="px-3 py-2.5 text-left">Proprietario / Ente</th>
|
||
<th class="px-3 py-2.5 text-left">Conduttore / Inquilino</th>
|
||
<th class="px-3 py-2.5 text-left">Stabile</th>
|
||
<th class="px-3 py-2.5 text-right">Dovuti</th>
|
||
<th class="px-3 py-2.5 text-right">Incassati</th>
|
||
<th class="px-3 py-2.5 text-right">Saldo</th>
|
||
<th class="px-3 py-2.5 text-left">Avvisi & Scadenze</th>
|
||
<th class="px-3 py-2.5 text-center">Stato</th>
|
||
<th class="px-3 py-2.5 text-right">Azioni</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody class="divide-y divide-slate-100 bg-white">
|
||
@forelse($rows as $row)
|
||
<tr class="hover:bg-slate-50/80 transition {{ ($selectedAffittoId === $row['id']) ? 'bg-indigo-50/40' : '' }}">
|
||
<td class="px-3 py-2 font-mono font-bold text-slate-700">{{ $row['codice_appartamento'] ?? '—' }}</td>
|
||
<td class="px-3 py-2 font-medium text-slate-800">{{ $row['descrizione_immobile'] ?? '—' }}</td>
|
||
<td class="px-3 py-2 text-slate-600">{{ $row['proprietario_nome'] ?? '—' }}</td>
|
||
<td class="px-3 py-2 text-slate-700 font-medium">{{ $row['nome_inquilino'] ?? '—' }}</td>
|
||
<td class="px-3 py-2">
|
||
<div class="font-semibold text-slate-800">{{ $row['stabile'] ?? '—' }}</div>
|
||
<div class="text-[10px] text-slate-500">{{ $row['stabile_nome'] ?? '' }}</div>
|
||
</td>
|
||
<td class="px-3 py-2 text-right font-mono font-semibold text-slate-800">€ {{ number_format((float)($row['dovuti_totale'] ?? 0), 2, ',', '.') }}</td>
|
||
<td class="px-3 py-2 text-right font-mono font-semibold text-emerald-700">€ {{ number_format((float)($row['pagati_totale'] ?? 0), 2, ',', '.') }}</td>
|
||
<td class="px-3 py-2 text-right font-mono font-bold {{ (float)($row['saldo_totale'] ?? 0) > 0.01 ? 'text-amber-700' : 'text-slate-700' }}">
|
||
€ {{ number_format((float)($row['saldo_totale'] ?? 0), 2, ',', '.') }}
|
||
</td>
|
||
<td class="px-3 py-2">
|
||
@if(!empty($row['warnings']))
|
||
@foreach($row['warnings'] as $warning)
|
||
<div class="text-[11px] font-medium text-amber-700 flex items-center gap-1">
|
||
<span>⚠️</span>
|
||
<span>{{ $warning }}</span>
|
||
</div>
|
||
@endforeach
|
||
@else
|
||
<span class="text-[11px] text-slate-400">Regolare</span>
|
||
@endif
|
||
</td>
|
||
<td class="px-3 py-2 text-center">
|
||
@if(!empty($row['obsoleto']))
|
||
<span class="inline-flex items-center rounded-full bg-slate-100 px-2 py-0.5 text-[10px] font-semibold text-slate-600">Obsoleto</span>
|
||
@else
|
||
<span class="inline-flex items-center rounded-full bg-emerald-100 px-2 py-0.5 text-[10px] font-semibold text-emerald-800">Attivo</span>
|
||
@endif
|
||
</td>
|
||
<td class="px-3 py-2 text-right">
|
||
<button type="button" wire:click="selectAffitto({{ $row['id'] }})"
|
||
class="inline-flex items-center gap-1 rounded-lg bg-indigo-50 border border-indigo-200 px-2.5 py-1 text-xs font-semibold text-indigo-700 hover:bg-indigo-100 transition">
|
||
<span>📂</span>
|
||
<span>Apri</span>
|
||
</button>
|
||
</td>
|
||
</tr>
|
||
@empty
|
||
<tr>
|
||
<td colspan="11" class="px-4 py-8 text-center text-slate-400">
|
||
Nessun immobile a reddito o locazione trovata per i criteri selezionati.
|
||
</td>
|
||
</tr>
|
||
@endforelse
|
||
</tbody>
|
||
</table>
|
||
</div>
|
||
</div>
|
||
|
||
{{-- TAB 2: ANAGRAFICA & CATASTO UNITA --}}
|
||
@elseif($tab === 'anagrafica')
|
||
<div class="space-y-4">
|
||
<div class="flex items-center justify-between rounded-xl border border-slate-200 bg-white p-2 shadow-xs">
|
||
<div class="flex items-center gap-1.5">
|
||
@php $subTabs = ['anagrafica' => '🏠 Dati Immobile', 'catasto' => '🏛️ Dati Catastali', 'inquilini' => '👥 Inquilini & Conduttori']; @endphp
|
||
@foreach($subTabs as $key => $label)
|
||
<button type="button" wire:click="setAnagraficaSection('{{ $key }}')"
|
||
class="rounded-lg px-3 py-1 text-xs font-semibold transition {{ $anagraficaSection === $key ? 'bg-indigo-600 text-white shadow-xs' : 'bg-slate-100 text-slate-600 hover:bg-slate-200' }}">
|
||
{{ $label }}
|
||
</button>
|
||
@endforeach
|
||
</div>
|
||
|
||
@if($anagraficaSection === 'catasto')
|
||
<div class="flex items-center gap-2">
|
||
<button type="button" wire:click="mergeCatastoFromUnita(false)"
|
||
class="inline-flex items-center gap-1 rounded-lg border border-indigo-200 bg-indigo-50 px-2.5 py-1 text-xs font-semibold text-indigo-700 hover:bg-indigo-100">
|
||
<span>🔄</span>
|
||
<span>Sincronizza da Unità</span>
|
||
</button>
|
||
<button type="button" wire:click="mergeCatastoFromUnita(true)"
|
||
class="inline-flex items-center gap-1 rounded-lg border border-amber-300 bg-amber-50 px-2.5 py-1 text-xs font-semibold text-amber-700 hover:bg-amber-100">
|
||
<span>⚠️</span>
|
||
<span>Sovrascrivi da Unità</span>
|
||
</button>
|
||
</div>
|
||
@endif
|
||
</div>
|
||
|
||
@if($anagraficaSection === 'anagrafica')
|
||
<div class="grid grid-cols-1 lg:grid-cols-2 gap-4">
|
||
<div class="rounded-xl border border-slate-200 bg-white p-4 shadow-xs space-y-3">
|
||
<h3 class="text-xs font-bold uppercase tracking-wider text-slate-500">Unità & Identificativi</h3>
|
||
<div class="grid grid-cols-1 md:grid-cols-2 gap-3">
|
||
<div class="md:col-span-2">
|
||
<label class="text-xs font-medium text-slate-600">Unità Immobiliare di Stabile Collegata</label>
|
||
<div class="flex gap-2 mt-1">
|
||
<select wire:model.live="form.unita_immobiliare_id" class="w-full rounded-lg border-slate-300 text-xs py-1.5">
|
||
<option value="">— Seleziona unità immobiliare —</option>
|
||
@foreach($unitaOptions as $id => $label)
|
||
<option value="{{ $id }}">{{ $label }}</option>
|
||
@endforeach
|
||
</select>
|
||
@if(!empty($form['unita_immobiliare_id']))
|
||
<a href="{{ \App\Filament\Pages\UnitaImmobiliarePage::getUrl(panel: 'admin-filament') . '?unita_id=' . $form['unita_immobiliare_id'] }}"
|
||
target="_blank"
|
||
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-700 hover:bg-slate-100 shrink-0">
|
||
<span>🏠</span>
|
||
<span>Apri</span>
|
||
</a>
|
||
@endif
|
||
</div>
|
||
</div>
|
||
<div>
|
||
<label class="text-xs font-medium text-slate-600">Codice Appartamento / Bene</label>
|
||
<input wire:model="form.codice_appartamento" class="w-full rounded-lg border-slate-300 text-xs py-1.5 mt-1" />
|
||
</div>
|
||
<div>
|
||
<label class="text-xs font-medium text-slate-600">Tipo Riga / Addebito</label>
|
||
<input wire:model="form.tipo_riga" class="w-full rounded-lg border-slate-300 text-xs py-1.5 mt-1" />
|
||
</div>
|
||
<div class="md:col-span-2">
|
||
<label class="text-xs font-medium text-slate-600">Descrizione Immobile</label>
|
||
<input wire:model="form.descrizione_immobile" class="w-full rounded-lg border-slate-300 text-xs py-1.5 mt-1" />
|
||
</div>
|
||
<div>
|
||
<label class="text-xs font-medium text-slate-600">Proprietario / Locatore</label>
|
||
<input wire:model="form.proprietario_nome" class="w-full rounded-lg border-slate-300 text-xs py-1.5 mt-1" />
|
||
</div>
|
||
<div>
|
||
<label class="text-xs font-medium text-slate-600">Intestatario Fiscale</label>
|
||
<input wire:model="form.proprietario_intesta" class="w-full rounded-lg border-slate-300 text-xs py-1.5 mt-1" />
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="rounded-xl border border-slate-200 bg-white p-4 shadow-xs space-y-3">
|
||
<h3 class="text-xs font-bold uppercase tracking-wider text-slate-500">Indirizzo & Stabile</h3>
|
||
<div class="grid grid-cols-1 md:grid-cols-2 gap-3">
|
||
<div class="md:col-span-2">
|
||
<label class="text-xs font-medium text-slate-600">Indirizzo Completo</label>
|
||
<input wire:model="form.indirizzo_immobile" class="w-full rounded-lg border-slate-300 text-xs py-1.5 mt-1" />
|
||
</div>
|
||
<div>
|
||
<label class="text-xs font-medium text-slate-600">CAP</label>
|
||
<input wire:model="form.cap" class="w-full rounded-lg border-slate-300 text-xs py-1.5 mt-1" />
|
||
</div>
|
||
<div>
|
||
<label class="text-xs font-medium text-slate-600">Città</label>
|
||
<input wire:model="form.citta" class="w-full rounded-lg border-slate-300 text-xs py-1.5 mt-1" />
|
||
</div>
|
||
<div>
|
||
<label class="text-xs font-medium text-slate-600">Provincia</label>
|
||
<input wire:model="form.provincia" class="w-full rounded-lg border-slate-300 text-xs py-1.5 mt-1" />
|
||
</div>
|
||
<div>
|
||
<label class="text-xs font-medium text-slate-600">Stabile Associato</label>
|
||
<div class="rounded-lg border border-slate-200 bg-slate-50 px-3 py-1.5 text-xs text-slate-700 mt-1 font-semibold">
|
||
{{ $selectedStabileCode ?? '—' }} {{ $selectedStabileName ? '· ' . $selectedStabileName : '' }}
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
@elseif($anagraficaSection === 'catasto')
|
||
<div class="rounded-xl border border-slate-200 bg-white p-4 shadow-xs space-y-4">
|
||
<div class="flex items-center justify-between border-b border-slate-200 pb-2">
|
||
<h3 class="text-xs font-bold uppercase tracking-wider text-slate-700">Dati Catasto Consolidati</h3>
|
||
<span class="text-xs text-slate-500">Collegamento diretto ai dati dell'unità catastale</span>
|
||
</div>
|
||
|
||
<div class="grid grid-cols-1 md:grid-cols-3 lg:grid-cols-4 gap-3 text-xs">
|
||
<div>
|
||
<label class="font-medium text-slate-600">Codice Comune Catastale</label>
|
||
<input wire:model="form.comune_catastale_codice" class="w-full rounded-lg border-slate-300 text-xs py-1.5 mt-1" placeholder="es. H501" />
|
||
</div>
|
||
<div>
|
||
<label class="font-medium text-slate-600">Comune Catastale</label>
|
||
<input wire:model="form.comune_catastale_nome" class="w-full rounded-lg border-slate-300 text-xs py-1.5 mt-1" />
|
||
</div>
|
||
<div>
|
||
<label class="font-medium text-slate-600">Sezione Urbana</label>
|
||
<input wire:model="form.sezione_urbana" class="w-full rounded-lg border-slate-300 text-xs py-1.5 mt-1" />
|
||
</div>
|
||
<div>
|
||
<label class="font-medium text-slate-600">Foglio</label>
|
||
<input wire:model="form.foglio" class="w-full rounded-lg border-slate-300 text-xs py-1.5 mt-1" />
|
||
</div>
|
||
<div>
|
||
<label class="font-medium text-slate-600">Particella</label>
|
||
<input wire:model="form.particella" class="w-full rounded-lg border-slate-300 text-xs py-1.5 mt-1" />
|
||
</div>
|
||
<div>
|
||
<label class="font-medium text-slate-600">Subalterno</label>
|
||
<input wire:model="form.subalterno" class="w-full rounded-lg border-slate-300 text-xs py-1.5 mt-1" />
|
||
</div>
|
||
<div>
|
||
<label class="font-medium text-slate-600">Categoria Catastale</label>
|
||
<input wire:model="form.categoria_catastale" class="w-full rounded-lg border-slate-300 text-xs py-1.5 mt-1" placeholder="es. A/2, C/1" />
|
||
</div>
|
||
<div>
|
||
<label class="font-medium text-slate-600">Classe Catastale</label>
|
||
<input wire:model="form.classe_catastale" class="w-full rounded-lg border-slate-300 text-xs py-1.5 mt-1" />
|
||
</div>
|
||
<div>
|
||
<label class="font-medium text-slate-600">Consistenza (Vani/Mq)</label>
|
||
<input wire:model="form.consistenza_catastale" class="w-full rounded-lg border-slate-300 text-xs py-1.5 mt-1" />
|
||
</div>
|
||
<div>
|
||
<label class="font-medium text-slate-600">Rendita Catastale (€)</label>
|
||
<input wire:model="form.rendita_catastale" class="w-full rounded-lg border-slate-300 text-xs py-1.5 mt-1" />
|
||
</div>
|
||
<div>
|
||
<label class="font-medium text-slate-600">Superficie Mq</label>
|
||
<input wire:model="form.superficie_catastale_mq" class="w-full rounded-lg border-slate-300 text-xs py-1.5 mt-1" />
|
||
</div>
|
||
<div>
|
||
<label class="font-medium text-slate-600">Piano / Interno</label>
|
||
<div class="grid grid-cols-2 gap-1 mt-1">
|
||
<input wire:model="form.piano_catastale" placeholder="P." class="rounded-lg border-slate-300 text-xs py-1.5" />
|
||
<input wire:model="form.interno_catastale" placeholder="Int." class="rounded-lg border-slate-300 text-xs py-1.5" />
|
||
</div>
|
||
</div>
|
||
<div class="md:col-span-2">
|
||
<label class="font-medium text-slate-600">Destinazione d'uso</label>
|
||
<input wire:model="form.destinazione_uso" class="w-full rounded-lg border-slate-300 text-xs py-1.5 mt-1" />
|
||
</div>
|
||
<div class="md:col-span-2">
|
||
<label class="font-medium text-slate-600">Canone Fitto Base Annuo (€)</label>
|
||
<input wire:model="form.importo_fitto" class="w-full rounded-lg border-slate-300 text-xs py-1.5 mt-1" />
|
||
</div>
|
||
<div class="md:col-span-4">
|
||
<label class="font-medium text-slate-600">Note Catastali / Vincoli</label>
|
||
<textarea wire:model="form.note" class="w-full rounded-lg border-slate-300 text-xs py-1.5 mt-1" rows="2"></textarea>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
@else
|
||
{{-- SEZIONE INQUILINI & CONDUTTORI --}}
|
||
<div class="rounded-xl border border-slate-200 bg-white p-4 shadow-xs space-y-4">
|
||
<div class="flex items-center justify-between border-b border-slate-200 pb-2">
|
||
<div>
|
||
<h3 class="text-xs font-bold uppercase tracking-wider text-slate-700">Conduttore Principale & Anagrafica Unica</h3>
|
||
<p class="text-[11px] text-slate-500">Sincronizzazione diretta con il database centrale delle persone</p>
|
||
</div>
|
||
<button type="button" wire:click="addInquilino"
|
||
class="inline-flex items-center gap-1 rounded-lg bg-indigo-50 border border-indigo-200 px-2.5 py-1 text-xs font-semibold text-indigo-700 hover:bg-indigo-100">
|
||
<span>➕</span>
|
||
<span>Aggiungi Conduttore / Co-Inquilino</span>
|
||
</button>
|
||
</div>
|
||
|
||
{{-- SELETTORE RAPIDO ANAGRAFICA UNICA --}}
|
||
<div class="rounded-lg border border-indigo-200 bg-indigo-50/40 p-3">
|
||
<label class="text-xs font-semibold text-indigo-900">Seleziona Conduttore da Anagrafica Unica (Persone):</label>
|
||
<div class="flex gap-2 mt-1">
|
||
<select wire:model.live="selectedPersonaId" class="w-full rounded-lg border-indigo-300 text-xs py-1.5">
|
||
<option value="">— Cerca in Anagrafica Unica —</option>
|
||
@foreach($personaOptions as $id => $label)
|
||
<option value="{{ $id }}">{{ $label }}</option>
|
||
@endforeach
|
||
</select>
|
||
@php($currentPId = $this->resolvePersonaIdForSelected())
|
||
@if($currentPId)
|
||
<a href="{{ \App\Filament\Pages\Gescon\AnagraficaUnica::getUrl(panel: 'admin-filament') . '?persona_id=' . $currentPId }}"
|
||
target="_blank"
|
||
class="inline-flex items-center gap-1 rounded-lg border border-indigo-300 bg-white px-3 py-1.5 text-xs font-semibold text-indigo-700 hover:bg-indigo-50 shrink-0">
|
||
<span>🪪</span>
|
||
<span>Apri Scheda Persona</span>
|
||
</a>
|
||
@endif
|
||
</div>
|
||
</div>
|
||
|
||
<div class="space-y-3">
|
||
@forelse($inquilini as $i => $inq)
|
||
<div class="rounded-xl border border-slate-200 bg-slate-50/60 p-3 grid grid-cols-1 md:grid-cols-6 gap-2 text-xs">
|
||
<div class="md:col-span-2">
|
||
<label class="font-medium text-slate-600">Rubrica / Persona</label>
|
||
<select wire:model="inquilini.{{ $i }}.rubrica_inquilino_id" class="w-full rounded-lg border-slate-300 text-xs py-1.5 mt-1">
|
||
<option value="">— Seleziona —</option>
|
||
@foreach($rubricaOptions as $id => $label)
|
||
<option value="{{ $id }}">{{ $label }}</option>
|
||
@endforeach
|
||
</select>
|
||
</div>
|
||
<div class="md:col-span-2">
|
||
<label class="font-medium text-slate-600">Nome Visualizzato</label>
|
||
<input wire:model="inquilini.{{ $i }}.nome_visualizzato" class="w-full rounded-lg border-slate-300 text-xs py-1.5 mt-1" />
|
||
</div>
|
||
<div>
|
||
<label class="font-medium text-slate-600">Telefono / Cellulare</label>
|
||
<input wire:model="inquilini.{{ $i }}.telefono" class="w-full rounded-lg border-slate-300 text-xs py-1.5 mt-1" />
|
||
</div>
|
||
<div>
|
||
<label class="font-medium text-slate-600">Email / PEC</label>
|
||
<input wire:model="inquilini.{{ $i }}.email" class="w-full rounded-lg border-slate-300 text-xs py-1.5 mt-1" />
|
||
</div>
|
||
<div class="md:col-span-5">
|
||
<label class="font-medium text-slate-600">Note & Documenti Personali Allegati</label>
|
||
<input wire:model="inquilini.{{ $i }}.documenti_note" class="w-full rounded-lg border-slate-300 text-xs py-1.5 mt-1" />
|
||
</div>
|
||
<div class="flex items-end justify-end">
|
||
<button type="button" wire:click="removeInquilino({{ $i }})" class="text-rose-600 text-xs font-semibold hover:underline">
|
||
🗑️ Rimuovi
|
||
</button>
|
||
</div>
|
||
</div>
|
||
@empty
|
||
<div class="text-xs text-slate-400 py-3 text-center">Nessun conduttore associato. Utilizza il pulsante in alto per aggiungere il primo conduttore.</div>
|
||
@endforelse
|
||
</div>
|
||
</div>
|
||
@endif
|
||
</div>
|
||
|
||
{{-- TAB 3: BANCA & INCASSI --}}
|
||
@elseif($tab === 'banca')
|
||
<div class="grid grid-cols-1 lg:grid-cols-2 gap-4">
|
||
<div class="rounded-xl border border-slate-200 bg-white p-4 shadow-xs space-y-3">
|
||
<h3 class="text-xs font-bold uppercase tracking-wider text-slate-500">Coordinate Bancarie del Contratto</h3>
|
||
<div class="grid grid-cols-1 md:grid-cols-2 gap-3 text-xs">
|
||
<div class="md:col-span-2">
|
||
<label class="font-medium text-slate-600">Conto Corrente Stabile Collegato</label>
|
||
<div class="flex gap-2 mt-1">
|
||
<select wire:model="form.conto_bancario_id" class="w-full rounded-lg border-slate-300 text-xs py-1.5">
|
||
<option value="">— Seleziona conto —</option>
|
||
@foreach($contoOptions as $id => $label)
|
||
<option value="{{ $id }}">{{ $label }}</option>
|
||
@endforeach
|
||
</select>
|
||
@if(!empty($form['conto_bancario_id']))
|
||
<a class="inline-flex items-center gap-1 rounded-lg border border-slate-200 bg-slate-50 px-2.5 py-1.5 text-xs font-semibold text-slate-700 hover:bg-slate-100 shrink-0"
|
||
target="_blank" href="{{ url('/admin-filament/contabilita/casse-banche/movimenti?conto_id=' . $form['conto_bancario_id']) }}">
|
||
<span>🏦</span>
|
||
<span>Movimenti</span>
|
||
</a>
|
||
@endif
|
||
</div>
|
||
</div>
|
||
<div class="md:col-span-2">
|
||
<label class="font-medium text-slate-600">Intestazione Conto</label>
|
||
<input wire:model="form.inte_cc" class="w-full rounded-lg border-slate-300 text-xs py-1.5 mt-1" />
|
||
</div>
|
||
<div class="md:col-span-2">
|
||
<label class="font-medium text-slate-600">IBAN</label>
|
||
<input wire:model="form.iban" class="w-full rounded-lg border-slate-300 text-xs py-1.5 mt-1 font-mono" />
|
||
</div>
|
||
<div>
|
||
<label class="font-medium text-slate-600">Num. CCP</label>
|
||
<input wire:model="form.num_ccp" class="w-full rounded-lg border-slate-300 text-xs py-1.5 mt-1" />
|
||
</div>
|
||
<div>
|
||
<label class="font-medium text-slate-600">Autorizzazione 674</label>
|
||
<input wire:model="form.autorizz_674" class="w-full rounded-lg border-slate-300 text-xs py-1.5 mt-1" />
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="rounded-xl border border-slate-200 bg-white p-4 shadow-xs space-y-3">
|
||
<h3 class="text-xs font-bold uppercase tracking-wider text-slate-500">Parametri Contabili di Riferimento</h3>
|
||
<div class="grid grid-cols-1 md:grid-cols-2 gap-3 text-xs">
|
||
<div>
|
||
<label class="font-medium text-slate-600">Selezione Contabile</label>
|
||
<input wire:model="form.selez" class="w-full rounded-lg border-slate-300 text-xs py-1.5 mt-1" />
|
||
</div>
|
||
<div>
|
||
<label class="font-medium text-slate-600">Definizione Amministrativa</label>
|
||
<input wire:model="form.def_ammin" class="w-full rounded-lg border-slate-300 text-xs py-1.5 mt-1" />
|
||
</div>
|
||
<div class="md:col-span-2">
|
||
<label class="font-medium text-slate-600">Descrizione Prima Voce</label>
|
||
<input wire:model="form.descr_1_voce" class="w-full rounded-lg border-slate-300 text-xs py-1.5 mt-1" />
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
{{-- TAB 4: CONTRATTO & CLAUSOLE --}}
|
||
@elseif($tab === 'scadenze')
|
||
<div class="grid grid-cols-1 lg:grid-cols-2 gap-4">
|
||
<div class="rounded-xl border border-slate-200 bg-white p-4 shadow-xs space-y-3">
|
||
<h3 class="text-xs font-bold uppercase tracking-wider text-slate-500">Durata Contratto & Adempimenti Fiscali</h3>
|
||
<div class="grid grid-cols-1 md:grid-cols-2 gap-3 text-xs">
|
||
<div>
|
||
<label class="font-medium text-slate-600">Inizio Contratto</label>
|
||
<input type="date" wire:model="form.inizio_contratto" class="w-full rounded-lg border-slate-300 text-xs py-1.5 mt-1" />
|
||
</div>
|
||
<div>
|
||
<label class="font-medium text-slate-600">Data Fine Contratto</label>
|
||
<input type="date" wire:model="form.data_fine_contratto" class="w-full rounded-lg border-slate-300 text-xs py-1.5 mt-1" />
|
||
</div>
|
||
<div>
|
||
<label class="font-medium text-slate-600">Ultimo Rinnovo</label>
|
||
<input type="date" wire:model="form.ultimo_rinnovo" class="w-full rounded-lg border-slate-300 text-xs py-1.5 mt-1" />
|
||
</div>
|
||
<div>
|
||
<label class="font-medium text-slate-600">Prossima Scadenza</label>
|
||
<input type="date" wire:model="form.prossima_scadenza" class="w-full rounded-lg border-slate-300 text-xs py-1.5 mt-1" />
|
||
</div>
|
||
<div>
|
||
<label class="font-medium text-slate-600">Prossima Registrazione AdE</label>
|
||
<input type="date" wire:model="form.prossima_registrazione" class="w-full rounded-lg border-slate-300 text-xs py-1.5 mt-1" />
|
||
</div>
|
||
<div>
|
||
<label class="font-medium text-slate-600">Data Registrazione AdE</label>
|
||
<input type="date" wire:model="form.data_registrazione_ade" class="w-full rounded-lg border-slate-300 text-xs py-1.5 mt-1" />
|
||
</div>
|
||
<div class="md:col-span-2">
|
||
<label class="font-medium text-slate-600">Numero Registrazione AdE / RLI</label>
|
||
<input wire:model="form.numero_registrazione_ade" class="w-full rounded-lg border-slate-300 text-xs py-1.5 mt-1" />
|
||
</div>
|
||
<div>
|
||
<label class="font-medium text-slate-600">Giorno Emissione Rata</label>
|
||
<input type="number" min="1" max="28" wire:model="form.giorno_emissione_canone" class="w-full rounded-lg border-slate-300 text-xs py-1.5 mt-1" />
|
||
</div>
|
||
<div>
|
||
<label class="font-medium text-slate-600">Canone Mensile Base (€)</label>
|
||
<input wire:model="form.importo_fitto" class="w-full rounded-lg border-slate-300 text-xs py-1.5 mt-1 font-semibold" />
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="rounded-xl border border-slate-200 bg-white p-4 shadow-xs space-y-3">
|
||
<div class="flex items-center justify-between border-b border-slate-200 pb-2">
|
||
<h3 class="text-xs font-bold uppercase tracking-wider text-slate-500">Bozza Contratto & Clausole</h3>
|
||
<button type="button" wire:click="addClausolaContratto"
|
||
class="inline-flex items-center gap-1 rounded-lg bg-indigo-50 border border-indigo-200 px-2.5 py-1 text-xs font-semibold text-indigo-700 hover:bg-indigo-100">
|
||
<span>➕</span>
|
||
<span>Aggiungi Clausola</span>
|
||
</button>
|
||
</div>
|
||
|
||
<div class="rounded-lg border border-slate-200 bg-slate-50 p-3 space-y-2">
|
||
<div class="flex items-center gap-2">
|
||
<select wire:model="selectedContractTemplate" class="w-full rounded-lg border-slate-300 text-xs py-1.5">
|
||
@foreach($contractTemplates as $key => $label)
|
||
<option value="{{ $key }}">{{ $label }}</option>
|
||
@endforeach
|
||
</select>
|
||
<button type="button" wire:click="generateContractDraft"
|
||
class="inline-flex items-center gap-1 rounded-lg bg-emerald-600 px-3 py-1.5 text-xs font-semibold text-white hover:bg-emerald-500 shrink-0">
|
||
<span>⚡</span>
|
||
<span>Genera Bozza</span>
|
||
</button>
|
||
</div>
|
||
@if($contractDraftPreview)
|
||
<textarea readonly class="w-full rounded-lg border-slate-300 bg-white text-xs font-mono p-2" rows="8">{{ $contractDraftPreview }}</textarea>
|
||
@endif
|
||
</div>
|
||
|
||
<div class="space-y-2">
|
||
@forelse($clausoleContratto as $i => $c)
|
||
<div class="rounded-lg border border-slate-200 bg-slate-50 p-2.5 grid grid-cols-1 md:grid-cols-6 gap-2 text-xs">
|
||
<div class="md:col-span-3">
|
||
<label class="font-medium text-slate-600">Titolo Clausola</label>
|
||
<input wire:model="clausoleContratto.{{ $i }}.titolo" class="w-full rounded-lg border-slate-300 text-xs py-1 mt-1" />
|
||
</div>
|
||
<div>
|
||
<label class="font-medium text-slate-600">Periodicità</label>
|
||
<select wire:model="clausoleContratto.{{ $i }}.periodicita" class="w-full rounded-lg border-slate-300 text-xs py-1 mt-1">
|
||
<option value="">—</option>
|
||
<option value="mensile">Mensile</option>
|
||
<option value="annuale">Annuale</option>
|
||
<option value="una_tantum">Una tantum</option>
|
||
</select>
|
||
</div>
|
||
<div>
|
||
<label class="font-medium text-slate-600">Importo (€)</label>
|
||
<input wire:model="clausoleContratto.{{ $i }}.importo" class="w-full rounded-lg border-slate-300 text-xs py-1 mt-1" />
|
||
</div>
|
||
<div class="flex items-end justify-end">
|
||
<button type="button" class="text-rose-600 text-xs font-semibold" wire:click="removeClausolaContratto({{ $i }})">🗑️ Rimuovi</button>
|
||
</div>
|
||
</div>
|
||
@empty
|
||
<div class="text-xs text-slate-400 py-2 text-center">Nessuna clausola personalizzata impostata.</div>
|
||
@endforelse
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
{{-- TAB 5: CANONI & RATE --}}
|
||
@elseif($tab === 'canoni')
|
||
<div class="rounded-xl border border-slate-200 bg-white p-4 shadow-xs space-y-4">
|
||
<div class="flex flex-wrap items-center justify-between gap-3 border-b border-slate-200 pb-3">
|
||
<div>
|
||
<h3 class="text-xs font-bold uppercase tracking-wider text-slate-700">Canoni e Scadenziario Rate</h3>
|
||
<div class="text-xs text-slate-500 mt-0.5">
|
||
Dovuti: <span class="font-bold text-slate-800">€ {{ number_format($totali['dovuti'] ?? 0, 2, ',', '.') }}</span> ·
|
||
Incassati: <span class="font-bold text-emerald-700">€ {{ number_format($totali['pagati'] ?? 0, 2, ',', '.') }}</span> ·
|
||
Saldo Residuo: <span class="font-bold {{ ($totali['saldo'] ?? 0) > 0.01 ? 'text-amber-700' : 'text-slate-800' }}">€ {{ number_format($totali['saldo'] ?? 0, 2, ',', '.') }}</span>
|
||
</div>
|
||
</div>
|
||
<div class="flex items-center gap-2">
|
||
<button type="button" wire:click="emitCanoniAutomatici"
|
||
class="inline-flex items-center gap-1 rounded-lg bg-indigo-600 px-3 py-1.5 text-xs font-semibold text-white shadow-xs hover:bg-indigo-500 transition">
|
||
<span>⚡</span>
|
||
<span>Emetti Rate Automatiche</span>
|
||
</button>
|
||
<button type="button" wire:click="cleanCanoniDuplicates"
|
||
class="inline-flex items-center gap-1 rounded-lg border border-amber-300 bg-amber-50 px-2.5 py-1.5 text-xs font-semibold text-amber-700 hover:bg-amber-100">
|
||
<span>🧹</span>
|
||
<span>Pulisci Duplicati</span>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="overflow-x-auto rounded-lg border border-slate-200">
|
||
<table class="min-w-full divide-y divide-slate-200 text-xs">
|
||
<thead class="bg-slate-50 text-slate-600 font-semibold">
|
||
<tr>
|
||
<th class="px-3 py-2 text-left">Periodo / Mese</th>
|
||
<th class="px-3 py-2 text-left">Emissione / Scadenza</th>
|
||
<th class="px-3 py-2 text-center">Stato</th>
|
||
<th class="px-3 py-2 text-right">Dovuto</th>
|
||
<th class="px-3 py-2 text-right">Incassato</th>
|
||
<th class="px-3 py-2 text-right">Saldo Progressivo</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody class="divide-y divide-slate-100 bg-white">
|
||
@forelse($canoniRighe as $r)
|
||
@php($d = (float)($r['totale_dovuto'] ?? 0))
|
||
@php($p = (float)($r['totale_pagato'] ?? 0))
|
||
<tr class="hover:bg-slate-50/70 transition">
|
||
<td class="px-3 py-2 font-medium text-slate-800">{{ $r['mese_descrizione'] ?? ($r['mese'] ?? '') }} {{ $r['anno'] ?? '' }}</td>
|
||
<td class="px-3 py-2 text-slate-600">
|
||
<div>{{ $r['data_emissione'] ?? '—' }}</div>
|
||
<div class="text-[10px] text-slate-400">Scad: {{ $r['data_scadenza'] ?? '—' }}</div>
|
||
</td>
|
||
<td class="px-3 py-2 text-center">
|
||
@if(($r['stato'] ?? '') === 'scaduto')
|
||
<span class="inline-flex rounded-full bg-rose-100 px-2 py-0.5 text-[10px] font-semibold text-rose-800">Scaduto</span>
|
||
@elseif(($r['stato'] ?? '') === 'da_pagare')
|
||
<span class="inline-flex rounded-full bg-amber-100 px-2 py-0.5 text-[10px] font-semibold text-amber-800">Da pagare</span>
|
||
@elseif(($r['stato'] ?? '') === 'non_emesso')
|
||
<span class="inline-flex rounded-full bg-slate-100 px-2 py-0.5 text-[10px] font-semibold text-slate-600">Non emesso</span>
|
||
@else
|
||
<span class="inline-flex rounded-full bg-emerald-100 px-2 py-0.5 text-[10px] font-semibold text-emerald-800">In regola</span>
|
||
@endif
|
||
</td>
|
||
<td class="px-3 py-2 text-right font-mono font-semibold text-slate-800">€ {{ number_format($d, 2, ',', '.') }}</td>
|
||
<td class="px-3 py-2 text-right font-mono font-semibold text-emerald-700">
|
||
<div>€ {{ number_format($p, 2, ',', '.') }}</div>
|
||
@if(!empty($r['data_pagamento']))
|
||
<div class="text-[10px] text-slate-400">{{ $r['data_pagamento'] }}</div>
|
||
@endif
|
||
</td>
|
||
<td class="px-3 py-2 text-right font-mono font-bold text-slate-700">€ {{ number_format((float)($r['saldo_progressivo'] ?? 0), 2, ',', '.') }}</td>
|
||
</tr>
|
||
@empty
|
||
<tr>
|
||
<td colspan="6" class="px-3 py-6 text-center text-slate-400">Nessun canone generato per questo immobile.</td>
|
||
</tr>
|
||
@endforelse
|
||
</tbody>
|
||
</table>
|
||
</div>
|
||
</div>
|
||
|
||
{{-- TAB 6: DOCUMENTI & ALLEGATI --}}
|
||
@elseif($tab === 'documenti')
|
||
<div class="grid grid-cols-1 lg:grid-cols-2 gap-4">
|
||
<div class="rounded-xl border border-slate-200 bg-white p-4 shadow-xs space-y-3">
|
||
<h3 class="text-xs font-bold uppercase tracking-wider text-slate-500">Carica Documento di Locazione</h3>
|
||
<div class="space-y-2 text-xs">
|
||
<input type="file" wire:model="documentFile" class="w-full rounded-lg border-slate-300 text-xs py-1.5" />
|
||
<select wire:model="documentInquilinoRow" class="w-full rounded-lg border-slate-300 text-xs py-1.5">
|
||
<option value="">— Documento generico contratto —</option>
|
||
@foreach($inquilini as $idx => $inq)
|
||
<option value="{{ $idx }}">Inquilino: {{ $inq['nome_visualizzato'] ?? ('#' . ($idx + 1)) }}</option>
|
||
@endforeach
|
||
</select>
|
||
<input wire:model="documentDescrizione" placeholder="Descrizione del documento (es. Contratto firmato, RLI)" class="w-full rounded-lg border-slate-300 text-xs py-1.5" />
|
||
<input type="date" wire:model="documentDataScadenza" class="w-full rounded-lg border-slate-300 text-xs py-1.5" />
|
||
<button type="button" wire:click="uploadDocumento"
|
||
class="inline-flex items-center gap-1 rounded-lg bg-emerald-600 px-3 py-1.5 text-xs font-semibold text-white hover:bg-emerald-500">
|
||
<span>📤</span>
|
||
<span>Carica Documento</span>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="rounded-xl border border-slate-200 bg-white p-4 shadow-xs space-y-3">
|
||
<h3 class="text-xs font-bold uppercase tracking-wider text-slate-500">Archivio Documentale Stabile</h3>
|
||
<p class="text-xs text-slate-600">I documenti caricati (contratti registrati, ricevute telematiche, comunicazioni di recesso) vengono archiviati nel fascicolo dello stabile.</p>
|
||
<a class="inline-flex items-center gap-1.5 rounded-lg border border-slate-200 bg-slate-50 px-3 py-1.5 text-xs font-semibold text-slate-700 hover:bg-slate-100"
|
||
href="{{ \App\Filament\Pages\Condomini\StabilePage::getUrl(['tab' => 'documenti-collegati'], panel: 'admin-filament') }}">
|
||
<span>📁</span>
|
||
<span>Apri Documenti Collegati Stabile</span>
|
||
</a>
|
||
</div>
|
||
</div>
|
||
@endif
|
||
</div>
|
||
</x-filament::page>
|