357 lines
25 KiB
PHP
357 lines
25 KiB
PHP
<x-filament-panels::page>
|
|
<div class="mx-auto max-w-7xl space-y-6 px-4 lg:px-8 py-4">
|
|
@if (! $unita)
|
|
<div class="rounded-xl border border-dashed border-gray-200 bg-white p-6 text-center text-gray-600">
|
|
Nessuna unità immobiliare trovata.
|
|
</div>
|
|
@php return; @endphp
|
|
@endif
|
|
|
|
<div class="flex flex-wrap items-start justify-between gap-4">
|
|
<div class="space-y-1">
|
|
<div class="text-xs uppercase tracking-wide text-gray-500">Condomini / Unità</div>
|
|
<div class="text-2xl font-semibold text-gray-900">Unità immobiliare</div>
|
|
<div class="text-sm text-gray-700">{{ $unita->denominazione ?? $unita->codice_unita ?? $unita->codice_completo ?? 'Unità' }}</div>
|
|
</div>
|
|
<div class="rounded-xl border bg-white px-4 py-3 text-sm text-gray-700 shadow-sm min-w-[200px] text-center">
|
|
<div class="font-semibold text-gray-900">ID: {{ $unita->id ?? '—' }}</div>
|
|
<div class="text-xs text-gray-500">Codice unità: {{ $unita->codice_unita ?? $unita->codice_completo ?? '—' }}</div>
|
|
</div>
|
|
</div>
|
|
|
|
<x-filament::section>
|
|
<div class="grid gap-3 sm:grid-cols-2 lg:grid-cols-4">
|
|
<div class="rounded-lg border bg-white p-4 shadow-sm">
|
|
<div class="text-xs text-gray-500">Stabile</div>
|
|
<div class="text-sm font-semibold text-gray-900">{{ $unita->stabile?->codice_operatore ?? $unita->stabile?->codice_stabile ?? '—' }}</div>
|
|
<div class="text-xs text-gray-500">{{ $unita->stabile?->denominazione ?? '' }}</div>
|
|
</div>
|
|
<div class="rounded-lg border bg-white p-4 shadow-sm">
|
|
<div class="text-xs text-gray-500">Posizione</div>
|
|
<div class="text-sm font-semibold text-gray-900">Scala {{ $unita->scala ?? '—' }} · Piano {{ $unita->piano ?? '—' }} · Interno {{ $unita->interno ?? '—' }}</div>
|
|
<div class="text-xs text-gray-500">{{ trim(($unita->indirizzo ?? '').' '.($unita->civico ?? '').' '.($unita->comune ?? '')) }}</div>
|
|
</div>
|
|
<div class="rounded-lg border bg-white p-4 shadow-sm">
|
|
<div class="text-xs text-gray-500">Tipologia</div>
|
|
<div class="text-sm font-semibold text-gray-900">{{ $unita->tipo_unita ?? 'ND' }}</div>
|
|
</div>
|
|
<div class="rounded-lg border bg-white p-4 shadow-sm">
|
|
<div class="text-xs text-gray-500">Utilizzo</div>
|
|
<div class="text-sm font-semibold text-gray-900">{{ $unita->utilizzo_attuale ?? 'ND' }}</div>
|
|
</div>
|
|
</div>
|
|
</x-filament::section>
|
|
|
|
<x-filament::section>
|
|
<div class="grid gap-3 lg:grid-cols-3">
|
|
<div class="lg:col-span-2 rounded-xl border bg-white p-4 shadow-sm">
|
|
<div class="text-xs text-gray-500">Occupante principale</div>
|
|
<div class="text-sm font-semibold text-gray-900">{{ $relazioniPerTipo['proprietari'][0]['nome'] ?? $relazioniPerTipo['inquilini'][0]['nome'] ?? '—' }}</div>
|
|
<div class="text-xs text-gray-500">CF: {{ $relazioniPerTipo['proprietari'][0]['codice_fiscale'] ?? $relazioniPerTipo['inquilini'][0]['codice_fiscale'] ?? '—' }}</div>
|
|
</div>
|
|
<div class="rounded-xl border bg-white p-4 shadow-sm">
|
|
<div class="text-xs text-gray-500">Riferimenti</div>
|
|
<div class="grid gap-2 text-xs text-gray-600">
|
|
<div class="flex items-center justify-between"><span class="text-gray-500">Codice unità</span><span class="font-semibold text-gray-900">{{ $unita->codice_unita ?? $unita->codice_completo ?? '—' }}</span></div>
|
|
<div class="flex items-center justify-between"><span class="text-gray-500">Palazzina</span><span class="font-semibold text-gray-900">{{ $unita->palazzina ?? '—' }}</span></div>
|
|
<div class="flex items-center justify-between"><span class="text-gray-500">Scala</span><span class="font-semibold text-gray-900">{{ $unita->scala ?? '—' }}</span></div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</x-filament::section>
|
|
|
|
<div class="flex flex-wrap gap-2">
|
|
@php
|
|
$tabs = [
|
|
'riepilogo' => ['label' => 'Riepilogo'],
|
|
'millesimi' => ['label' => 'Tabelle millesimali'],
|
|
'persone' => ['label' => 'Persone collegate'],
|
|
'economico' => ['label' => 'Economico'],
|
|
'dati' => ['label' => 'Dati catastali'],
|
|
];
|
|
@endphp
|
|
@foreach ($tabs as $key => $cfg)
|
|
<button
|
|
type="button"
|
|
wire:click="setTab('{{ $key }}')"
|
|
class="inline-flex items-center gap-2 rounded-full border px-4 py-2 text-sm font-semibold transition {{ $tab === $key ? 'border-primary-300 bg-primary-50 text-primary-700 shadow-sm' : 'border-gray-200 bg-white text-gray-700 hover:bg-gray-50' }}">
|
|
<span>{{ $cfg['label'] }}</span>
|
|
</button>
|
|
@endforeach
|
|
</div>
|
|
|
|
@if ($tab === 'riepilogo')
|
|
<div class="space-y-4">
|
|
<x-filament::section>
|
|
<x-slot name="heading">Indicatori principali</x-slot>
|
|
<div class="grid gap-3 sm:grid-cols-2 lg:grid-cols-4">
|
|
@foreach ([
|
|
['Superficie', ($unita->superficie_commerciale ?? 0) . ' m²'],
|
|
['Millesimi', $unita->millesimi_proprieta ?? $unita->millesimi_generali ?? 0],
|
|
['Percentuale', ($unita->millesimi_proprieta ?? $unita->millesimi_generali) ? number_format((($unita->millesimi_proprieta ?? $unita->millesimi_generali)/1000)*100, 2) . '%' : '0%'],
|
|
['Valore stimato', ($unita->valore_commerciale_stimato ?? 0) . ' €'],
|
|
] as [$label, $value])
|
|
<div class="rounded-lg border bg-white p-4">
|
|
<div class="text-xs text-gray-500">{{ $label }}</div>
|
|
<div class="text-lg font-semibold text-gray-900">{{ $value }}</div>
|
|
</div>
|
|
@endforeach
|
|
</div>
|
|
</x-filament::section>
|
|
|
|
<x-filament::section>
|
|
<x-slot name="heading">Identificazione</x-slot>
|
|
<div class="grid gap-3 sm:grid-cols-2 lg:grid-cols-4">
|
|
@foreach ([
|
|
['Tipologia', $unita->tipo_unita ?? 'ND'],
|
|
['Stato occupazione', $unita->stato_occupazione ?? 'ND'],
|
|
['Utilizzo', $unita->utilizzo_attuale ?? 'ND'],
|
|
['Codice stabile', $unita->stabile?->codice_operatore ?? $unita->stabile?->codice_stabile ?? 'ND'],
|
|
] as [$label, $value])
|
|
<div class="rounded-lg border bg-white p-3">
|
|
<div class="text-xs text-gray-500">{{ $label }}</div>
|
|
<div class="text-sm font-semibold text-gray-900">{{ $value }}</div>
|
|
</div>
|
|
@endforeach
|
|
</div>
|
|
</x-filament::section>
|
|
|
|
<x-filament::section>
|
|
<x-slot name="heading">Persone collegate</x-slot>
|
|
<div class="grid gap-3 md:grid-cols-2 lg:grid-cols-3">
|
|
@foreach ([
|
|
'proprietari' => ['label' => 'Proprietari', 'color' => 'text-primary-700'],
|
|
'inquilini' => ['label' => 'Inquilini', 'color' => 'text-emerald-700'],
|
|
'altri' => ['label' => 'Altri soggetti', 'color' => 'text-gray-700'],
|
|
] as $key => $cfg)
|
|
@php $relazioni = $relazioniPerTipo[$key] ?? []; @endphp
|
|
<div class="rounded-xl border bg-white p-3 shadow-sm">
|
|
<div class="mb-2 text-sm font-semibold {{ $cfg['color'] }}">{{ $cfg['label'] }} ({{ count($relazioni) }})</div>
|
|
@if (empty($relazioni))
|
|
<div class="text-sm text-gray-500">Nessun soggetto.</div>
|
|
@else
|
|
<div class="space-y-2">
|
|
@foreach ($relazioni as $relazione)
|
|
<div class="rounded-lg border bg-gray-50 p-3">
|
|
<div class="text-sm font-semibold text-gray-900">{{ $relazione['nome'] }}</div>
|
|
<div class="text-xs text-gray-500">CF: {{ $relazione['codice_fiscale'] ?? '—' }}</div>
|
|
<div class="text-xs text-gray-500">Quota: {{ $relazione['quota_label'] ?? '—' }}%</div>
|
|
</div>
|
|
@endforeach
|
|
</div>
|
|
@endif
|
|
</div>
|
|
@endforeach
|
|
</div>
|
|
</x-filament::section>
|
|
</div>
|
|
@endif
|
|
|
|
@if ($tab === 'millesimi')
|
|
<x-filament::section>
|
|
<x-slot name="heading">Tabelle millesimali</x-slot>
|
|
@if (empty($millesimiPerTabella))
|
|
<div class="text-sm text-gray-500">Nessuna tabella millesimale associata.</div>
|
|
@else
|
|
<div class="overflow-x-auto">
|
|
<table class="min-w-full text-sm">
|
|
<thead>
|
|
<tr class="border-b text-left text-gray-500">
|
|
<th class="py-2">Tabella</th>
|
|
<th class="py-2 text-right">Millesimi</th>
|
|
<th class="py-2 text-right">Percentuale</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody class="divide-y">
|
|
@foreach ($millesimiPerTabella as $r)
|
|
<tr>
|
|
<td class="py-2">
|
|
<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">{{ $r['codice'] }}</span>
|
|
<span class="ml-2 text-gray-900">{{ $r['nome'] }}</span>
|
|
</td>
|
|
<td class="py-2 text-right text-gray-900">{{ number_format($r['millesimi'], 3, ',', '.') }}</td>
|
|
<td class="py-2 text-right text-gray-900">{{ number_format($r['percentuale'], 2, ',', '.') }}%</td>
|
|
</tr>
|
|
@endforeach
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
@endif
|
|
</x-filament::section>
|
|
@endif
|
|
|
|
@if ($tab === 'persone')
|
|
<x-filament::section>
|
|
<x-slot name="heading">Persone collegate</x-slot>
|
|
<div class="space-y-4">
|
|
@foreach ([
|
|
'proprietari' => ['label' => 'Proprietari / comproprietari', 'class' => 'text-primary-700'],
|
|
'inquilini' => ['label' => 'Inquilini / conduttori', 'class' => 'text-emerald-700'],
|
|
'altri' => ['label' => 'Altri soggetti collegati', 'class' => 'text-gray-700'],
|
|
] as $key => $cfg)
|
|
@php $relazioni = $relazioniPerTipo[$key] ?? []; @endphp
|
|
<div class="rounded-xl border bg-white p-4">
|
|
<div class="mb-2 text-sm font-semibold {{ $cfg['class'] }}">{{ $cfg['label'] }} ({{ count($relazioni) }})</div>
|
|
@if (empty($relazioni))
|
|
<div class="text-sm text-gray-500">Nessun soggetto collegato.</div>
|
|
@else
|
|
<div class="grid gap-3 sm:grid-cols-2 lg:grid-cols-3">
|
|
@foreach ($relazioni as $relazione)
|
|
<div class="rounded-lg border bg-gray-50 p-3">
|
|
<div class="text-xs text-gray-500">{{ $relazione['tipo'] ?? 'Relazione' }}</div>
|
|
<div class="text-sm font-semibold text-gray-900">{{ $relazione['nome'] }}</div>
|
|
<div class="text-xs text-gray-500">CF: {{ $relazione['codice_fiscale'] ?? '—' }}</div>
|
|
<div class="text-xs text-gray-500">Quota: {{ $relazione['quota_label'] ?? '—' }}%</div>
|
|
</div>
|
|
@endforeach
|
|
</div>
|
|
@endif
|
|
</div>
|
|
@endforeach
|
|
</div>
|
|
</x-filament::section>
|
|
@endif
|
|
|
|
@if ($tab === 'economico')
|
|
<div class="space-y-4">
|
|
@if (! empty($preventiviPerTabella))
|
|
<x-filament::section>
|
|
<x-slot name="heading">Preventivo per tabella</x-slot>
|
|
@if (! empty($totaliPerGestione))
|
|
<div class="mb-3 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 class="space-y-4">
|
|
@foreach ($preventiviPerTabella as $tabella)
|
|
<div class="rounded-xl border bg-white p-4 shadow-sm">
|
|
<div class="flex items-center justify-between mb-3">
|
|
<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">% 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-gray-50 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-gray-50 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-gray-50 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>
|
|
<x-slot name="heading">Voci di spesa per tabella</x-slot>
|
|
@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)
|
|
<div class="rounded-xl border bg-white overflow-hidden">
|
|
<div class="flex items-center gap-2 bg-gray-50 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">% 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($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 === 'dati')
|
|
<x-filament::section>
|
|
<x-slot name="heading">Dati catastali</x-slot>
|
|
<div class="grid gap-3 sm:grid-cols-2 lg:grid-cols-4">
|
|
@foreach ([
|
|
['Foglio', $unita->foglio ?? '—'],
|
|
['Particella', $unita->particella ?? '—'],
|
|
['Subalterno', $unita->subalterno ?? '—'],
|
|
['Categoria', $unita->categoria_catastale ?? '—'],
|
|
] as [$label, $value])
|
|
<div class="rounded-lg border bg-white p-3">
|
|
<div class="text-xs text-gray-500">{{ $label }}</div>
|
|
<div class="text-sm font-semibold text-gray-900">{{ $value }}</div>
|
|
</div>
|
|
@endforeach
|
|
</div>
|
|
</x-filament::section>
|
|
@endif
|
|
</div>
|
|
</x-filament-panels::page>
|