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

142 lines
9.7 KiB
PHP

<x-filament-panels::page>
<div class="space-y-4">
<div class="rounded-xl border bg-white p-4">
<div class="flex flex-wrap items-center justify-between gap-3">
<div>
<div class="text-lg font-semibold">Contabilita fornitore</div>
<div class="text-sm text-gray-600">
@if($fornitoreLabel)
Vista contabile sintetica per {{ $fornitoreLabel }}.
@else
Seleziona un fornitore per aprire questa vista.
@endif
</div>
</div>
<div class="flex flex-wrap gap-2">
<div class="rounded-md border border-sky-200 bg-sky-50 px-3 py-1.5 text-xs text-sky-900">
Import FE manuale disponibile dal pulsante in alto. Le fatture gia presenti finiscono come duplicate nell'archivio FE; le ricevute/notifiche SdI vengono saltate e non caricate in contabilita.
</div>
<a href="{{ $this->getFattureRicevuteUrl() }}" class="inline-flex items-center rounded-md bg-emerald-700 px-3 py-1.5 text-xs font-medium text-white hover:bg-emerald-600">Fatture ricevute</a>
<a href="{{ $this->getTicketsUrl() }}" class="inline-flex items-center rounded-md bg-gray-800 px-3 py-1.5 text-xs font-medium text-white hover:bg-gray-700">Ticket</a>
<a href="{{ $this->getCollaboratoriUrl() }}" class="inline-flex items-center rounded-md bg-white px-3 py-1.5 text-xs font-medium text-gray-700 ring-1 ring-inset ring-gray-300 hover:bg-gray-50">Collaboratori</a>
</div>
</div>
</div>
@if($missingAdminContext)
<div class="rounded-xl border border-amber-300 bg-amber-50 p-4 text-sm text-amber-800">
Questa vista per amministratori richiede un fornitore selezionato.
</div>
@else
<div class="grid gap-4 md:grid-cols-4">
<div class="rounded-xl border bg-white p-4">
<div class="text-xs uppercase tracking-wide text-gray-500">Fatture aperte</div>
<div class="mt-1 text-2xl font-semibold">{{ $stats['aperte'] }}</div>
<div class="mt-2 text-sm text-gray-600">Registrate ma non ancora pagate.</div>
</div>
<div class="rounded-xl border bg-white p-4">
<div class="text-xs uppercase tracking-wide text-gray-500">Fatture pagate</div>
<div class="mt-1 text-2xl font-semibold">{{ $stats['pagate'] }}</div>
<div class="mt-2 text-sm text-gray-600">Pagamenti risultanti in contabilità.</div>
</div>
<div class="rounded-xl border bg-white p-4">
<div class="text-xs uppercase tracking-wide text-gray-500">Netto aperto</div>
<div class="mt-1 text-2xl font-semibold">{{ number_format($stats['totale_aperto'], 2, ',', '.') }} €</div>
<div class="mt-2 text-sm text-gray-600">Da incassare sui documenti registrati.</div>
</div>
<div class="rounded-xl border bg-white p-4">
<div class="text-xs uppercase tracking-wide text-gray-500">Totale registrato</div>
<div class="mt-1 text-2xl font-semibold">{{ number_format($stats['totale_registrato'], 2, ',', '.') }} €</div>
<div class="mt-2 text-sm text-gray-600">Storico fatture del fornitore su NetGescon.</div>
</div>
</div>
<div class="grid gap-4 xl:grid-cols-5">
<div class="rounded-xl border bg-white p-0 xl:col-span-3">
<div class="border-b px-4 py-3 text-sm font-semibold">Lavori pronti per chiusura / fatturazione</div>
<div class="overflow-x-auto">
<table class="min-w-full divide-y divide-gray-200 text-sm">
<thead class="bg-gray-50">
<tr>
<th class="px-4 py-3 text-left font-medium text-gray-600">Ticket</th>
<th class="px-4 py-3 text-left font-medium text-gray-600">Amministratore</th>
<th class="px-4 py-3 text-left font-medium text-gray-600">Stato</th>
<th class="px-4 py-3 text-left font-medium text-gray-600">Aggiornato</th>
<th class="px-4 py-3"></th>
</tr>
</thead>
<tbody class="divide-y divide-gray-100 bg-white">
@forelse($queueRows as $row)
<tr>
<td class="px-4 py-3 align-top">
<div class="font-medium">#{{ $row['ticket_id'] }} - {{ $row['titolo'] }}</div>
<div class="text-xs text-gray-500">{{ $row['stabile'] }}</div>
</td>
<td class="px-4 py-3 align-top">{{ $row['amministratore'] }}</td>
<td class="px-4 py-3 align-top">
<span class="inline-flex rounded-full bg-amber-100 px-2 py-1 text-xs font-medium text-amber-800">{{ $row['stato'] }}</span>
</td>
<td class="px-4 py-3 align-top text-gray-600">{{ $row['aggiornato'] }}</td>
<td class="px-4 py-3 text-right align-top">
<a href="{{ $row['url'] }}" class="inline-flex items-center rounded-md bg-primary-600 px-3 py-1.5 text-xs font-medium text-white hover:bg-primary-500">Apri</a>
</td>
</tr>
@empty
<tr>
<td colspan="5" class="px-4 py-10 text-center text-sm text-gray-500">Nessun lavoro in coda per la chiusura.</td>
</tr>
@endforelse
</tbody>
</table>
</div>
</div>
<div class="rounded-xl border bg-white p-0 xl:col-span-2">
<div class="border-b px-4 py-3 text-sm font-semibold">Fatture registrate su NetGescon</div>
@if(! $contabilitaReady)
<div class="p-4 text-sm text-gray-600">
La contabilità fornitore dedicata non è ancora stata attivata su questo ambiente. Questa pagina è pronta a leggerla appena il modulo contabile è disponibile.
</div>
@else
<div class="overflow-x-auto">
<table class="min-w-full divide-y divide-gray-200 text-sm">
<thead class="bg-gray-50">
<tr>
<th class="px-4 py-3 text-left font-medium text-gray-600">Documento</th>
<th class="px-4 py-3 text-left font-medium text-gray-600">Studio</th>
<th class="px-4 py-3 text-left font-medium text-gray-600">Totale</th>
</tr>
</thead>
<tbody class="divide-y divide-gray-100 bg-white">
@forelse($fattureRows as $row)
<tr>
<td class="px-4 py-3 align-top">
<div class="font-medium">{{ $row['numero_documento'] }}</div>
<div class="text-xs text-gray-500">{{ $row['data_documento'] }} · {{ $row['stato'] }}</div>
@if($row['descrizione'] !== '')
<div class="mt-1 text-xs text-gray-500">{{ $row['descrizione'] }}</div>
@endif
</td>
<td class="px-4 py-3 align-top">
<div>{{ $row['amministratore'] }}</div>
<div class="text-xs text-gray-500">{{ $row['stabile'] }}</div>
</td>
<td class="px-4 py-3 align-top">
<div class="font-medium">{{ number_format($row['totale'], 2, ',', '.') }} €</div>
<div class="text-xs text-gray-500">Netto {{ number_format($row['netto'], 2, ',', '.') }} </div>
</td>
</tr>
@empty
<tr>
<td colspan="3" class="px-4 py-10 text-center text-sm text-gray-500">Nessuna fattura registrata per questo fornitore.</td>
</tr>
@endforelse
</tbody>
</table>
</div>
@endif
</div>
</div>
@endif
</div>
</x-filament-panels::page>