netgescon-day0/resources/views/filament/pages/contabilita/riscossione-aggregata.blade.php

76 lines
5.0 KiB
PHP

<x-filament-panels::page>
<div class="mx-auto max-w-7xl space-y-4">
<x-filament::section>
<x-slot name="heading">Foglio riscossione (visione aggregata)</x-slot>
<x-slot name="description">Aggregazione per nominativo con importi emessi/pagati e link alla scheda contabile</x-slot>
@php
$blocks = [
['key' => 'C', 'label' => 'Condomini', 'items' => $condomini ?? []],
['key' => 'I', 'label' => 'Inquilini', 'items' => $inquilini ?? []],
];
@endphp
<div class="grid gap-4">
@foreach($blocks as $blk)
<div class="rounded-2xl border bg-gray-50 p-3">
<div class="mb-2 text-sm font-semibold text-gray-900">{{ $blk['label'] }} ({{ count($blk['items']) }})</div>
@if(empty($blk['items']))
<div class="text-sm text-gray-500">Nessun dato.</div>
@else
<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 pr-3">Nominativo</th>
<th class="text-right py-2 pr-3">Unità</th>
<th class="text-right py-2 pr-3">Avvisi</th>
<th class="text-right py-2 pr-3">Righe</th>
<th class="text-right py-2 pr-3">Addebito</th>
<th class="text-right py-2 pr-3">Pagato</th>
<th class="text-right py-2 pr-3">Residuo</th>
<th class="text-right py-2 pr-0">Scheda</th>
</tr>
</thead>
<tbody class="divide-y">
@foreach($blk['items'] as $r)
@php
$sid = (int) ($r['soggetto_id'] ?? 0);
$schedaUrl = $sid > 0
? \App\Filament\Pages\Contabilita\EstrattoContoSoggetto::getUrl(panel: 'admin-filament', parameters: ['record' => $sid])
: null;
@endphp
<tr>
<td class="py-2 pr-3">
<div class="font-semibold text-gray-900">{{ $r['nominativo'] ?? '—' }}</div>
<div class="text-xs text-gray-500">CF: {{ $r['codice_fiscale'] ?? '—' }}</div>
</td>
<td class="py-2 pr-3 text-right text-gray-900">{{ $r['n_unita'] ?? 0 }}</td>
<td class="py-2 pr-3 text-right text-gray-900">{{ $r['n_avvisi'] ?? 0 }}</td>
<td class="py-2 pr-3 text-right text-gray-900">{{ $r['n_righe'] ?? 0 }}</td>
<td class="py-2 pr-3 text-right text-gray-900">{{ number_format((float) ($r['totale_addebitato'] ?? 0), 2, ',', '.') }} </td>
<td class="py-2 pr-3 text-right text-gray-900">{{ number_format((float) ($r['totale_pagato'] ?? 0), 2, ',', '.') }} </td>
<td class="py-2 pr-3 text-right text-gray-900">{{ number_format((float) ($r['residuo'] ?? 0), 2, ',', '.') }} </td>
<td class="py-2 pr-0 text-right">
@if($schedaUrl)
<a class="fi-btn fi-btn-color-gray fi-btn-size-xs" href="{{ $schedaUrl }}">
<span class="fi-btn-label">Apri</span>
</a>
@else
<span class="text-xs text-gray-400"></span>
@endif
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
@endif
</div>
@endforeach
</div>
</x-filament::section>
</div>
</x-filament-panels::page>