netgescon-day0/resources/views/filament/pages/condomini/validazione-fatture.blade.php

121 lines
8.6 KiB
PHP

<x-filament-panels::page>
<div class="mx-auto max-w-7xl space-y-4">
@if(!$this->stabileAttivo)
<div class="rounded-lg border border-red-200 bg-red-50 p-4 text-sm text-red-900">
Seleziona uno stabile attivo per accedere alla validazione delle fatture.
</div>
@else
<div class="grid grid-cols-1 lg:grid-cols-12 gap-4">
<!-- Colonna Sinistra: Testo OCR Estratto (Spalla Visiva) -->
<div class="lg:col-span-4 bg-gray-50 dark:bg-gray-900 border border-gray-200 dark:border-gray-800 rounded-xl p-4 shadow-sm flex flex-col h-[700px]">
<div class="flex items-center justify-between border-b pb-2 mb-3">
<h3 class="text-sm font-semibold text-gray-900 dark:text-gray-100 flex items-center gap-1.5">
🔍 Testo Estratto (OCR PDF)
</h3>
</div>
<div class="flex-1 overflow-y-auto bg-white dark:bg-gray-950 p-3 rounded-lg border border-gray-100 dark:border-gray-900 font-mono text-[10px] whitespace-pre-wrap text-gray-800 dark:text-gray-300 leading-relaxed max-h-[600px]">
{{ $selectedRecordText ?: 'Seleziona una fattura dalla tabella a destra per visualizzarne il testo estratto...' }}
</div>
</div>
<!-- Colonna Destra: Griglia e CRUD In-Line di Staging (Zero Modal) -->
<div class="lg:col-span-8 bg-white dark:bg-gray-950 border border-gray-200 dark:border-gray-900 rounded-xl p-4 shadow-sm h-[700px] flex flex-col">
<div class="flex items-center justify-between border-b pb-2 mb-3">
<h3 class="text-sm font-semibold text-gray-900 dark:text-gray-100">
Dispo-Campi Estratti in Attesa di Validazione
</h3>
<span class="inline-flex items-center rounded-md bg-blue-50 dark:bg-blue-900/30 px-1.5 py-0.5 text-xs font-semibold text-blue-700 dark:text-blue-300">
{{ count($records) }} Pendenti
</span>
</div>
<div class="flex-1 overflow-x-auto overflow-y-auto">
<table class="min-w-full divide-y divide-gray-200 dark:divide-gray-850 text-xs">
<thead class="bg-gray-50 dark:bg-gray-900 text-left font-semibold text-gray-500 uppercase tracking-wider">
<tr>
<th class="px-2 py-3">Fornitore</th>
<th class="px-2 py-3">P.IVA</th>
<th class="px-2 py-3">Matricola</th>
<th class="px-2 py-3">Importo</th>
<th class="px-2 py-3">CBILL (18 cifre)</th>
<th class="px-2 py-3 text-center">Azioni</th>
</tr>
</thead>
<tbody class="divide-y divide-gray-150 dark:divide-gray-900">
@forelse($records as $row)
<tr class="hover:bg-gray-50 dark:hover:bg-gray-900 {{ $selectedRecordId === $row['id'] ? 'bg-blue-50/40 dark:bg-blue-950/20' : '' }}" wire:click="selectRecord({{ $row['id'] }})">
<!-- Fornitore Nome -->
<td class="px-2 py-2">
<input type="text"
value="{{ $row['fornitore_nome'] }}"
wire:change="updateRecord({{ $row['id'] }}, 'fornitore_nome', $event.target.value)"
class="w-full bg-transparent border-0 border-b border-dashed border-gray-300 focus:border-primary-500 focus:ring-0 p-0 text-xs text-gray-900 dark:text-gray-100 font-semibold"
/>
</td>
<!-- P.IVA -->
<td class="px-2 py-2">
<input type="text"
value="{{ $row['partita_iva'] }}"
wire:change="updateRecord({{ $row['id'] }}, 'partita_iva', $event.target.value)"
class="w-full bg-transparent border-0 border-b border-dashed border-gray-300 focus:border-primary-500 focus:ring-0 p-0 text-xs font-mono text-gray-700 dark:text-gray-300"
/>
</td>
<!-- Matricola Contatore -->
<td class="px-2 py-2">
<input type="text"
value="{{ $row['matricola_contatore'] }}"
wire:change="updateRecord({{ $row['id'] }}, 'matricola_contatore', $event.target.value)"
class="w-full bg-transparent border-0 border-b border-dashed border-gray-300 focus:border-primary-500 focus:ring-0 p-0 text-xs text-gray-700 dark:text-gray-300"
/>
</td>
<!-- Importo -->
<td class="px-2 py-2">
<input type="text"
value="{{ $row['importo_monetario'] }}"
wire:change="updateRecord({{ $row['id'] }}, 'importo_monetario', $event.target.value)"
class="w-full bg-transparent border-0 border-b border-dashed border-gray-300 focus:border-primary-500 focus:ring-0 p-0 text-xs font-mono text-right text-gray-900 dark:text-gray-100 font-semibold"
/>
</td>
<!-- CBILL 18 Cifre -->
<td class="px-2 py-2">
<input type="text"
value="{{ $row['cbill'] }}"
wire:change="updateRecord({{ $row['id'] }}, 'cbill', $event.target.value)"
class="w-full bg-transparent border-0 border-b border-dashed border-gray-300 focus:border-primary-500 focus:ring-0 p-0 text-xs font-mono text-gray-700 dark:text-gray-300"
maxlength="18"
/>
</td>
<!-- Azioni in-line -->
<td class="px-2 py-2 text-center whitespace-nowrap space-x-1">
<button type="button" wire:click.stop="validaERegistra({{ $row['id'] }})" class="inline-flex items-center rounded bg-emerald-50 px-1.5 py-1 text-[10px] font-semibold text-emerald-700 hover:bg-emerald-100 dark:bg-emerald-900/30 dark:text-emerald-300">
Valida
</button>
<button type="button" wire:click.stop="scartaRecord({{ $row['id'] }})" class="inline-flex items-center rounded bg-red-50 px-1.5 py-1 text-[10px] font-semibold text-red-700 hover:bg-red-100 dark:bg-red-900/30 dark:text-red-300">
Scarta
</button>
</td>
</tr>
@empty
<tr>
<td colspan="6" class="px-2 py-4 text-center text-gray-500">
Nessun record in staging da validare per questo stabile.
</td>
</tr>
@endforelse
</tbody>
</table>
</div>
</div>
</div>
@endif
</div>
</x-filament-panels::page>