117 lines
6.7 KiB
PHP
117 lines
6.7 KiB
PHP
<x-filament-panels::page>
|
|
<div class="mx-auto max-w-7xl space-y-4">
|
|
@php
|
|
$archivio = request()->query('archivio', 'all');
|
|
$archivio = in_array($archivio, ['all', 'netgescon', 'gescon'], true) ? $archivio : 'all';
|
|
$baseUrl = \App\Filament\Pages\Contabilita\PrimaNotaArchivio::getUrl(panel: 'admin-filament');
|
|
@endphp
|
|
|
|
<x-filament.components.page-breadcrumbs
|
|
:breadcrumbs="[
|
|
['label' => 'Contabilità', 'url' => null],
|
|
['label' => 'Prima nota', 'url' => null],
|
|
]"
|
|
/>
|
|
|
|
<div class="flex flex-wrap gap-2">
|
|
<a href="{{ $baseUrl . '?archivio=all' }}"
|
|
class="rounded-lg px-4 py-2 text-sm font-medium {{ $archivio === 'all' ? 'bg-primary-600 text-white' : 'bg-gray-100 text-gray-700 dark:bg-gray-800 dark:text-gray-300' }}">
|
|
Tutte le registrazioni
|
|
</a>
|
|
<a href="{{ $baseUrl . '?archivio=netgescon' }}"
|
|
class="rounded-lg px-4 py-2 text-sm font-medium {{ $archivio === 'netgescon' ? 'bg-primary-600 text-white' : 'bg-gray-100 text-gray-700 dark:bg-gray-800 dark:text-gray-300' }}">
|
|
Archivio NetGescon
|
|
</a>
|
|
<a href="{{ $baseUrl . '?archivio=gescon' }}"
|
|
class="rounded-lg px-4 py-2 text-sm font-medium {{ $archivio === 'gescon' ? 'bg-primary-600 text-white' : 'bg-gray-100 text-gray-700 dark:bg-gray-800 dark:text-gray-300' }}">
|
|
Archivio GESCON
|
|
</a>
|
|
</div>
|
|
|
|
@if(! $this->getActiveStabile())
|
|
<x-filament::section>
|
|
<div class="text-sm text-gray-600">Seleziona uno stabile per lavorare in prima nota.</div>
|
|
</x-filament::section>
|
|
@endif
|
|
|
|
<div x-data="{ tab: 'lista' }" class="space-y-4">
|
|
<div class="flex flex-wrap gap-2">
|
|
<button type="button"
|
|
class="rounded-lg px-4 py-2 text-sm font-medium"
|
|
:class="tab === 'lista' ? 'bg-primary-600 text-white' : 'bg-gray-100 text-gray-700 dark:bg-gray-800 dark:text-gray-300'"
|
|
@click="tab = 'lista'">
|
|
Registrazioni
|
|
</button>
|
|
<button type="button"
|
|
class="rounded-lg px-4 py-2 text-sm font-medium"
|
|
:class="tab === 'bilancio' ? 'bg-primary-600 text-white' : 'bg-gray-100 text-gray-700 dark:bg-gray-800 dark:text-gray-300'"
|
|
@click="tab = 'bilancio'">
|
|
Bilancio
|
|
</button>
|
|
</div>
|
|
|
|
<div x-show="tab === 'lista'">
|
|
{{ $this->table }}
|
|
</div>
|
|
|
|
<div x-show="tab === 'bilancio'">
|
|
@php($bilancio = $this->getBilancioData())
|
|
@php($totDare = (float) ($bilancio['totale_dare'] ?? 0))
|
|
@php($totAvere = (float) ($bilancio['totale_avere'] ?? 0))
|
|
@php($diff = abs($totDare - $totAvere))
|
|
|
|
<x-filament::section>
|
|
<div class="grid gap-4 md:grid-cols-3">
|
|
<div class="rounded-md border border-gray-200 px-3 py-2 text-sm dark:border-gray-800">
|
|
<div class="text-gray-500">Totale Dare</div>
|
|
<div class="font-semibold">€ {{ number_format($totDare, 2, ',', '.') }}</div>
|
|
</div>
|
|
<div class="rounded-md border border-gray-200 px-3 py-2 text-sm dark:border-gray-800">
|
|
<div class="text-gray-500">Totale Avere</div>
|
|
<div class="font-semibold">€ {{ number_format($totAvere, 2, ',', '.') }}</div>
|
|
</div>
|
|
<div class="rounded-md border px-3 py-2 text-sm {{ $diff <= 0.005 ? 'border-emerald-200 bg-emerald-50 text-emerald-700 dark:border-emerald-800 dark:bg-emerald-950 dark:text-emerald-300' : 'border-rose-200 bg-rose-50 text-rose-700 dark:border-rose-800 dark:bg-rose-950 dark:text-rose-300' }}">
|
|
<div>Quadratura</div>
|
|
<div class="font-semibold">{{ $diff <= 0.005 ? 'OK' : 'Non bilanciato' }}</div>
|
|
</div>
|
|
</div>
|
|
</x-filament::section>
|
|
|
|
@foreach(($bilancio['sezioni'] ?? []) as $sezione)
|
|
<x-filament::section>
|
|
<x-slot name="heading">{{ $sezione['titolo'] ?? 'Sezione' }}</x-slot>
|
|
|
|
<div class="overflow-hidden rounded-lg border border-gray-200 dark:border-gray-800">
|
|
<table class="min-w-full divide-y divide-gray-200 text-sm dark:divide-gray-800">
|
|
<thead class="bg-gray-50 text-left text-xs font-semibold text-gray-600 dark:bg-gray-900 dark:text-gray-300">
|
|
<tr>
|
|
<th class="px-3 py-2">Conto</th>
|
|
<th class="px-3 py-2 text-right">Dare</th>
|
|
<th class="px-3 py-2 text-right">Avere</th>
|
|
<th class="px-3 py-2 text-right">Saldo</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody class="divide-y divide-gray-100 dark:divide-gray-800">
|
|
@php($righe = $sezione['righe'] ?? [])
|
|
@forelse($righe as $r)
|
|
<tr>
|
|
<td class="px-3 py-2">{{ $r['label'] ?? '—' }}</td>
|
|
<td class="px-3 py-2 text-right">{{ $r['dare'] > 0 ? ('€ ' . number_format($r['dare'], 2, ',', '.')) : '—' }}</td>
|
|
<td class="px-3 py-2 text-right">{{ $r['avere'] > 0 ? ('€ ' . number_format($r['avere'], 2, ',', '.')) : '—' }}</td>
|
|
<td class="px-3 py-2 text-right">€ {{ number_format($r['saldo'] ?? 0, 2, ',', '.') }}</td>
|
|
</tr>
|
|
@empty
|
|
<tr>
|
|
<td colspan="4" class="px-3 py-4 text-center text-gray-500">Nessuna voce movimentata.</td>
|
|
</tr>
|
|
@endforelse
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</x-filament::section>
|
|
@endforeach
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</x-filament-panels::page>
|