208 lines
13 KiB
PHP
Executable File
208 lines
13 KiB
PHP
Executable File
<x-filament-panels::page>
|
|
<div class="mx-auto max-w-7xl space-y-4">
|
|
<x-filament::section class="p-4!">
|
|
@include('filament.components.page-breadcrumbs', [
|
|
'breadcrumbs' => [
|
|
['label' => 'Condomini', 'url' => route('admin.dashboards.condomini')],
|
|
['label' => 'Tabelle millesimali', 'url' => \App\Filament\Pages\Condomini\TabelleMillesimaliArchivio::getUrl(panel: 'admin-filament')],
|
|
['label' => 'Prospetto'],
|
|
],
|
|
'backUrl' => $this->getBackUrl(),
|
|
'backLabel' => 'Torna indietro',
|
|
])
|
|
|
|
<div class="mt-3 flex items-start justify-between gap-4 flex-wrap">
|
|
<div class="space-y-1">
|
|
<div class="flex items-center gap-2 text-lg font-semibold text-gray-900">
|
|
<x-filament::icon icon="heroicon-o-chart-pie" class="h-5 w-5 text-primary-600" />
|
|
<span>Tabelle millesimali · Prospetto</span>
|
|
</div>
|
|
<div class="text-sm text-gray-700">Seleziona una tabella a sinistra per vedere i dettagli (unità, millesimi, percentuali).</div>
|
|
</div>
|
|
|
|
@if(!empty($tabelle) && count($tabelle) > 1)
|
|
<div class="min-w-70">
|
|
<div class="text-xs text-gray-500 mb-1">Tabella</div>
|
|
<select
|
|
class="fi-input block w-full"
|
|
onchange="window.location = '{{ static::getUrl() }}' + '?tabella_id=' + this.value"
|
|
>
|
|
@foreach($tabelle as $t)
|
|
<option value="{{ $t['id'] }}" @selected((int) $tabellaId === (int) $t['id'])>
|
|
{{ $t['codice'] }} — {{ $t['nome'] }}
|
|
</option>
|
|
@endforeach
|
|
</select>
|
|
</div>
|
|
@endif
|
|
</div>
|
|
</x-filament::section>
|
|
|
|
<div class="grid gap-4 lg:grid-cols-3">
|
|
<x-filament::section class="lg:col-span-1">
|
|
<x-slot name="heading">Elenco tabelle</x-slot>
|
|
<x-slot name="description">Stabile attivo</x-slot>
|
|
|
|
@if(empty($tabelle))
|
|
<div class="rounded-xl border border-dashed border-gray-200 bg-white p-6 text-center text-gray-500">Nessuna tabella millesimale.</div>
|
|
@else
|
|
<div class="space-y-2">
|
|
@foreach($tabelle as $t)
|
|
@php $selected = (int) $tabellaId === (int) $t['id']; @endphp
|
|
<a
|
|
href="{{ static::getUrl() }}?tabella_id={{ (int) $t['id'] }}"
|
|
class="block rounded-xl border p-3 transition
|
|
{{ $selected ? 'border-primary-300 bg-primary-50' : 'border-gray-200 bg-white hover:bg-gray-50' }}"
|
|
>
|
|
<div class="flex items-start justify-between gap-3">
|
|
<div>
|
|
<div class="text-sm font-semibold {{ $selected ? 'text-primary-700' : 'text-gray-900' }}">
|
|
{{ $t['codice'] }}
|
|
</div>
|
|
<div class="text-xs text-gray-600">{{ $t['nome'] }}</div>
|
|
@if(!empty($t['tipo']) || !empty($t['calcolo']))
|
|
<div class="mt-1 text-xs text-gray-500">
|
|
{{ $t['tipo'] ? ('Tipo: ' . $t['tipo']) : '' }}
|
|
{{ $t['tipo'] && $t['calcolo'] ? ' · ' : '' }}
|
|
{{ $t['calcolo'] ? ('Calcolo: ' . $t['calcolo']) : '' }}
|
|
</div>
|
|
@endif
|
|
</div>
|
|
<div class="text-right">
|
|
<div class="text-xs text-gray-500">{{ !empty($t['is_consumo']) ? 'A consumo' : 'Bilanciata' }}</div>
|
|
@if(!empty($t['is_consumo']))
|
|
<div class="text-sm font-semibold text-emerald-700">SI</div>
|
|
@else
|
|
<div class="text-sm font-semibold {{ $t['is_bilanciata'] ? 'text-emerald-700' : 'text-amber-700' }}">
|
|
{{ $t['is_bilanciata'] ? 'SI' : 'NO' }}
|
|
</div>
|
|
@endif
|
|
</div>
|
|
</div>
|
|
</a>
|
|
@endforeach
|
|
</div>
|
|
@endif
|
|
</x-filament::section>
|
|
|
|
<x-filament::section class="lg:col-span-2">
|
|
<x-slot name="heading">Dettaglio</x-slot>
|
|
<x-slot name="description">Unità e millesimi</x-slot>
|
|
|
|
@if(!$tabellaInfo)
|
|
<div class="text-sm text-gray-500">Seleziona una tabella per vedere il dettaglio.</div>
|
|
@else
|
|
<div class="space-y-3">
|
|
<div class="flex items-center justify-end gap-2">
|
|
@if(empty($righe))
|
|
<button
|
|
type="button"
|
|
wire:click="inizializzaRighe"
|
|
class="fi-btn fi-btn-color-gray fi-btn-size-sm"
|
|
>
|
|
Inizializza righe
|
|
</button>
|
|
@endif
|
|
<button
|
|
type="button"
|
|
wire:click="saveRighe"
|
|
class="fi-btn fi-btn-color-primary fi-btn-size-sm"
|
|
>
|
|
Salva
|
|
</button>
|
|
</div>
|
|
|
|
<div class="rounded-xl border bg-gray-50 p-3">
|
|
<div class="flex items-start justify-between gap-3 flex-wrap">
|
|
<div>
|
|
<div class="text-sm font-semibold text-gray-900">{{ $tabellaInfo['codice'] }} — {{ $tabellaInfo['nome'] }}</div>
|
|
<div class="text-xs text-gray-600">
|
|
@if(!empty($tabellaInfo['tipo'])) Tipo: {{ $tabellaInfo['tipo'] }} @endif
|
|
@if(!empty($tabellaInfo['tipo']) && !empty($tabellaInfo['calcolo'])) · @endif
|
|
@if(!empty($tabellaInfo['calcolo'])) Calcolo: {{ $tabellaInfo['calcolo'] }} @endif
|
|
</div>
|
|
@if(!empty($tabellaInfo['preventivo']) || !empty($tabellaInfo['consuntivo']))
|
|
<div class="text-xs text-gray-500">
|
|
@if(!empty($tabellaInfo['preventivo'])) Prev: {{ number_format((float) $tabellaInfo['preventivo'], 2, ',', '.') }} @endif
|
|
@if(!empty($tabellaInfo['preventivo']) && !empty($tabellaInfo['consuntivo'])) · @endif
|
|
@if(!empty($tabellaInfo['consuntivo'])) Cons: {{ number_format((float) $tabellaInfo['consuntivo'], 2, ',', '.') }} @endif
|
|
</div>
|
|
@endif
|
|
</div>
|
|
<div class="text-right">
|
|
<div class="text-xs text-gray-500">Totale (calcolato)</div>
|
|
<div class="text-sm font-semibold text-gray-900">{{ number_format((float) ($tabellaInfo['totale'] ?? 0), 3, ',', '.') }}</div>
|
|
@if(!empty($tabellaInfo['is_consumo']))
|
|
<div class="text-xs text-emerald-700">A consumo</div>
|
|
@else
|
|
<div class="text-xs {{ ($tabellaInfo['is_bilanciata'] ?? false) ? 'text-emerald-700' : 'text-amber-700' }}">
|
|
{{ ($tabellaInfo['is_bilanciata'] ?? false) ? 'Bilanciata (≈1000)' : 'Non bilanciata' }}
|
|
</div>
|
|
@endif
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
@if(empty($righe))
|
|
<div class="rounded-xl border border-dashed border-gray-200 bg-white p-6 text-center text-gray-500">Nessun dettaglio millesimi.</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">Unità</th>
|
|
<th class="py-2">Posizione</th>
|
|
<th class="py-2 text-center">Partecipa</th>
|
|
<th class="py-2 text-right">Millesimi</th>
|
|
<th class="py-2 text-right">%</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody class="divide-y">
|
|
@foreach($righe as $r)
|
|
@php
|
|
$unitaUrl = \App\Filament\Pages\UnitaImmobiliarePage::getUrl(panel: 'admin-filament')
|
|
. '?unita_id=' . (int) $r['unita_id']
|
|
. '&back=' . urlencode(request()->fullUrl());
|
|
@endphp
|
|
<tr>
|
|
<td class="py-2">
|
|
<a href="{{ $unitaUrl }}" class="text-gray-900 font-semibold hover:text-primary-700">
|
|
{{ $r['codice_unita'] ?? ('Unità #' . $r['unita_id']) }}
|
|
</a>
|
|
@if(!empty($r['denominazione']))
|
|
<div class="text-xs text-gray-500">{{ $r['denominazione'] }}</div>
|
|
@endif
|
|
</td>
|
|
<td class="py-2 text-gray-700">
|
|
Pal. {{ $r['palazzina'] ?? '—' }} · Scala {{ $r['scala'] ?? '—' }} · Piano {{ $r['piano'] ?? '—' }} · Int. {{ $r['interno'] ?? '—' }}
|
|
</td>
|
|
<td class="py-2 text-center">
|
|
<input
|
|
type="checkbox"
|
|
class="fi-checkbox-input"
|
|
wire:model.defer="righe.{{ $loop->index }}.partecipa"
|
|
/>
|
|
</td>
|
|
<td class="py-2 text-right">
|
|
<input
|
|
type="number"
|
|
step="0.001"
|
|
inputmode="decimal"
|
|
class="fi-input block w-28 text-right"
|
|
wire:model.defer="righe.{{ $loop->index }}.millesimi"
|
|
/>
|
|
</td>
|
|
<td class="py-2 text-right text-gray-900">{{ number_format((float) $r['percentuale'], 2, ',', '.') }}%</td>
|
|
</tr>
|
|
@endforeach
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
@endif
|
|
</div>
|
|
@endif
|
|
</x-filament::section>
|
|
</div>
|
|
</div>
|
|
</x-filament-panels::page>
|