netgescon-day0/resources/views/filament/pages/gescon/table.blade.php

172 lines
11 KiB
PHP

<x-filament-panels::page>
<div class="space-y-4">
<div class="rounded-xl border bg-white p-4">
<div class="mb-3 flex flex-wrap gap-2">
<button
type="button"
wire:click="apriElenco"
class="inline-flex items-center rounded-md px-3 py-1.5 text-xs font-medium {{ $activeTab === 'elenco' ? 'bg-slate-800 text-white' : 'bg-slate-100 text-slate-700 hover:bg-slate-200' }}"
>
Tab 1: Elenco Fornitori
</button>
<button
type="button"
wire:click="$set('activeTab', 'scheda')"
class="inline-flex items-center rounded-md px-3 py-1.5 text-xs font-medium {{ $activeTab === 'scheda' ? 'bg-slate-800 text-white' : 'bg-slate-100 text-slate-700 hover:bg-slate-200' }}"
>
Tab 2: Scheda Fornitore (inline)
</button>
</div>
<div class="grid grid-cols-1 gap-3 md:grid-cols-3">
<div>
<div class="text-sm font-semibold">Archivio Fornitori</div>
<div class="mt-1 text-xs text-gray-500">Vista operativa in stile ticket-gestione. Cerca rapidamente e apri HUB/scheda inline.</div>
</div>
<div class="rounded-lg border bg-gray-50 px-3 py-2 text-xs md:col-span-2">
Totale fornitori importati: <span class="font-semibold">{{ (int) ($fornitoriCount ?? 0) }}</span>
</div>
</div>
@if($activeTab === 'elenco')
<div class="mt-3">
<label class="block text-xs font-medium text-gray-700">Ricerca fornitore</label>
<input
type="text"
wire:model.live.debounce.400ms="search"
placeholder="Ragione sociale, nome, P.IVA, CF, email, telefono, TAG"
class="mt-1 w-full rounded-lg border-gray-300 text-sm"
>
</div>
@endif
</div>
@if($activeTab === 'elenco')
<div class="rounded-xl border bg-white p-4">
<div class="overflow-x-auto">
<table class="min-w-full border-collapse border text-xs">
<thead>
<tr class="bg-slate-100 text-slate-700">
<th class="border px-2 py-2 text-left">Fornitore</th>
<th class="border px-2 py-2 text-left">Contatti</th>
<th class="border px-2 py-2 text-left">Documento</th>
<th class="border px-2 py-2 text-left">TAG / Team</th>
<th class="border px-2 py-2 text-left">Rubrica</th>
<th class="border px-2 py-2 text-left">Azioni</th>
</tr>
</thead>
<tbody>
@forelse($this->fornitoriRows as $f)
<tr class="hover:bg-slate-50">
<td class="border px-2 py-2">
<div class="font-medium">{{ $this->getFornitoreLabel($f) }}</div>
<div class="text-[11px] text-gray-500">#{{ (int) $f->id }}</div>
</td>
<td class="border px-2 py-2">
<div>{{ $f->email ?: '-' }}</div>
<div class="text-gray-500">{{ $f->telefono ?: ($f->cellulare ?: '-') }}</div>
</td>
<td class="border px-2 py-2">
<div>P.IVA: {{ $f->partita_iva ?: '-' }}</div>
<div class="text-gray-500">CF: {{ $f->codice_fiscale ?: '-' }}</div>
</td>
<td class="border px-2 py-2">
<div>{{ $f->tags ?: '-' }}</div>
<div class="text-gray-500">Dipendenti: {{ (int) ($f->dipendenti_count ?? 0) }}</div>
</td>
<td class="border px-2 py-2">
@if((int) ($f->rubrica_id ?? 0) > 0)
<span class="inline-flex items-center rounded-md bg-emerald-100 px-2 py-1 text-[11px] font-medium text-emerald-800">Collegata</span>
@else
<span class="inline-flex items-center rounded-md bg-amber-100 px-2 py-1 text-[11px] font-medium text-amber-800">Da collegare</span>
@endif
</td>
<td class="border px-2 py-2">
<div class="flex flex-wrap gap-1">
<button type="button" wire:click="apriScheda({{ (int) $f->id }})" class="inline-flex items-center rounded-md bg-slate-700 px-2 py-1 text-[11px] font-medium text-white hover:bg-slate-600">Apri scheda inline</button>
<a href="{{ $this->getFornitoreHubUrl((int) $f->id) }}" class="inline-flex items-center rounded-md bg-indigo-700 px-2 py-1 text-[11px] font-medium text-white hover:bg-indigo-600">Apri HUB</a>
</div>
</td>
</tr>
@empty
<tr>
<td colspan="6" class="border px-2 py-4 text-center text-gray-500">Nessun fornitore trovato con i filtri correnti.</td>
</tr>
@endforelse
</tbody>
</table>
</div>
<div class="mt-2 text-[11px] text-gray-500">Mostrati max 400 record per mantenere la pagina rapida.</div>
</div>
@else
@php($fornitore = $this->selectedFornitore)
<div class="rounded-xl border bg-white p-4">
@if($fornitore)
<div class="mb-3 flex flex-wrap items-center justify-between gap-2">
<div>
<div class="text-sm font-semibold">Scheda fornitore inline: {{ $this->getFornitoreLabel($fornitore) }}</div>
<div class="text-xs text-gray-500">ID #{{ (int) $fornitore->id }} · Dipendenti collegati: {{ (int) ($fornitore->dipendenti_count ?? 0) }}</div>
</div>
<a href="{{ $this->getFornitoreAnagraficaUrl((int) $fornitore->id) }}" class="inline-flex items-center rounded-md bg-slate-100 px-3 py-1.5 text-xs font-medium text-slate-700 hover:bg-slate-200">Apri vecchia scheda (immutata)</a>
</div>
<div class="grid grid-cols-1 gap-4 lg:grid-cols-2">
<div class="rounded-lg border p-3">
<div class="mb-2 text-xs font-semibold text-gray-700">Automazioni</div>
<div class="space-y-3 text-xs">
<div>
<div class="font-medium text-gray-700">Fornitore acqua</div>
<label class="mr-3 inline-flex items-center gap-1">
<input type="radio" wire:model.defer="automazioni.fornitore_acqua" value="1"> Attivo
</label>
<label class="inline-flex items-center gap-1">
<input type="radio" wire:model.defer="automazioni.fornitore_acqua" value="0"> Disattivo
</label>
</div>
<div>
<div class="font-medium text-gray-700">Ticket fornitore</div>
<label class="mr-3 inline-flex items-center gap-1">
<input type="radio" wire:model.defer="automazioni.abilita_ticket" value="1"> Attivo
</label>
<label class="inline-flex items-center gap-1">
<input type="radio" wire:model.defer="automazioni.abilita_ticket" value="0"> Disattivo
</label>
</div>
<div>
<div class="font-medium text-gray-700">Allegati e camera webapp</div>
<label class="mr-3 inline-flex items-center gap-1">
<input type="radio" wire:model.defer="automazioni.abilita_allegati_camera" value="1"> Attivo
</label>
<label class="inline-flex items-center gap-1">
<input type="radio" wire:model.defer="automazioni.abilita_allegati_camera" value="0"> Disattivo
</label>
</div>
</div>
<button type="button" wire:click="saveSchedaAutomazioni" class="mt-3 inline-flex items-center rounded-md bg-emerald-700 px-3 py-1.5 text-xs font-medium text-white hover:bg-emerald-600">Salva automazioni</button>
</div>
<div class="rounded-lg border p-3">
<div class="mb-2 text-xs font-semibold text-gray-700">Coordinate bancarie</div>
<div class="space-y-3 text-xs">
<div>
<label class="mb-1 block font-medium text-gray-700">IBAN</label>
<input type="text" wire:model.defer="contoIban" class="w-full rounded-md border-gray-300 text-xs" placeholder="IT00A0000000000000000000000">
</div>
<div>
<label class="mb-1 block font-medium text-gray-700">Intestazione conto esatta</label>
<input type="text" wire:model.defer="contoIntestazioneEsatta" class="w-full rounded-md border-gray-300 text-xs" placeholder="Nome intestatario esatto da legacy">
</div>
</div>
<button type="button" wire:click="saveSchedaBancaria" class="mt-3 inline-flex items-center rounded-md bg-blue-700 px-3 py-1.5 text-xs font-medium text-white hover:bg-blue-600">Salva conto</button>
</div>
</div>
@else
<div class="rounded-lg border border-amber-200 bg-amber-50 p-4 text-xs text-amber-800">
Seleziona prima un fornitore dalla Tab 1 e usa il pulsante "Apri scheda inline".
</div>
@endif
</div>
@endif
</div>
</x-filament-panels::page>