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

179 lines
12 KiB
PHP
Executable File

<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">
@if((bool) ($feModuleStatus['enabled'] ?? false))
Import FE manuale disponibile dal pulsante in alto. In questa vista le fatture passive e ricevute restano separate dalle future attive/emesse del modulo commerciale.
@else
Modulo FE attualmente disattivato per questo fornitore. La separazione tra passive/ricevute e future attive/emesse resta comunque predisposta.
@endif
</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>
@php($feModuleEnabled = (bool) ($feModuleStatus['enabled'] ?? false))
@php($feSources = is_array($feModuleStatus['source_labels'] ?? null) ? $feModuleStatus['source_labels'] : [])
<div class="rounded-xl border {{ $feModuleEnabled ? 'border-emerald-200 bg-emerald-50' : 'border-amber-300 bg-amber-50' }} p-4 text-sm">
<div class="font-semibold {{ $feModuleEnabled ? 'text-emerald-900' : 'text-amber-900' }}">Modulo FE fornitore</div>
@if($feModuleEnabled)
<div class="mt-1 text-emerald-800">
Modulo attivo. Archivio FE separato sul fornitore e sorgenti abilitate: {{ $feSources !== [] ? implode(', ', $feSources) : 'Upload manuale' }}.
</div>
@else
<div class="mt-1 text-amber-800">
Modulo FE disattivato per questo fornitore. Riattivalo dalla scheda fornitore nelle Impostazioni FE.
</div>
@endif
</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">Passive aperte</div>
<div class="mt-1 text-2xl font-semibold">{{ $stats['aperte'] }}</div>
<div class="mt-2 text-sm text-gray-600">Ricevute e 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">Passive 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 passive aperte</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 liquidare sui documenti passivi registrati.</div>
</div>
<div class="rounded-xl border bg-white p-4">
<div class="text-xs uppercase tracking-wide text-gray-500">Totale passive registrate</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 ricevute del fornitore su NetGescon.</div>
</div>
</div>
<div class="grid gap-4 lg:grid-cols-3">
<div class="rounded-xl border border-emerald-200 bg-emerald-50 p-4 lg:col-span-2">
<div class="text-sm font-semibold text-emerald-900">Area documenti attivi / commerciali</div>
<div class="mt-1 text-sm text-emerald-800">Questa sezione resterà separata dalle passive. Qui andranno preventivi, ordini, fatture attive ed emesse, senza finire nello stesso elenco delle ricevute.</div>
<div class="mt-3 flex flex-wrap gap-2 text-xs text-emerald-900">
<span class="rounded-full bg-white px-3 py-1 font-medium">Preventivi</span>
<span class="rounded-full bg-white px-3 py-1 font-medium">Ordini</span>
<span class="rounded-full bg-white px-3 py-1 font-medium">Fatture attive</span>
</div>
</div>
<div class="rounded-xl border bg-white p-4">
<div class="text-xs uppercase tracking-wide text-slate-500">Stato modulo</div>
<div class="mt-2 text-sm font-semibold text-slate-900">Separazione predisposta</div>
<div class="mt-2 text-sm text-slate-600">Le passive/ricevute restano sotto. Le attive/emesse avranno un elenco dedicato appena aggancio la fonte dati commerciale.</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 passive / ricevute 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>