netgescon-day0/resources/views/admin/gescon-import/anagrafiche.blade.php

84 lines
4.2 KiB
PHP

@extends('admin.layouts.netgescon')
@section('title', 'GESCON Import · Anagrafiche importate')
@section('breadcrumb')
<a href="{{ route('admin.gescon-import.index') }}">GESCON Import</a>
<span>Anagrafiche importate</span>
@endsection
@section('content')
<div class="content-wrapper px-6">
@include('components.layout.alerts')
<div class="flex items-start justify-between gap-4 mb-4">
<div>
<h1 class="text-xl font-semibold text-slate-800">Anagrafiche importate</h1>
<p class="text-sm text-slate-600">Fonte: {{ $source === 'rubrica_universale' ? 'Rubrica Universale' : 'Persone legacy' }}. Totale mostrato: {{ $persone->total() }}.</p>
</div>
<a href="{{ route('admin.gescon-import.index') }}" class="netgescon-btn netgescon-btn-outline-secondary">
<i class="mdi mdi-arrow-left"></i> Torna al pannello Import
</a>
</div>
<form method="get" class="netgescon-card p-4 mb-4 flex flex-wrap items-end gap-3">
<div class="flex flex-col">
<label class="text-xs font-semibold text-slate-600 mb-1">Cerca</label>
<input type="text" name="search" value="{{ $search }}" class="netgescon-input" placeholder="Nome, cognome, CF, email, telefono...">
</div>
<div class="flex flex-col">
<label class="text-xs font-semibold text-slate-600 mb-1">Per pagina</label>
<input type="number" name="per_page" value="{{ $perPage }}" min="10" max="200" class="netgescon-input w-24">
</div>
<button type="submit" class="netgescon-btn netgescon-btn-primary">Filtra</button>
</form>
<div class="netgescon-card p-0 overflow-x-auto">
<table class="min-w-full text-sm">
<thead class="bg-slate-50 border-b">
<tr class="text-left text-slate-600">
<th class="px-3 py-2">Nome / Ragione sociale</th>
<th class="px-3 py-2">Tipo</th>
<th class="px-3 py-2">Contatti</th>
<th class="px-3 py-2">Categoria</th>
<th class="px-3 py-2">Ultimo aggiornamento</th>
</tr>
</thead>
<tbody class="divide-y">
@forelse($persone as $p)
@php
$nomeCompleto = $p->ragione_sociale ?? trim(($p->cognome ?? '').' '.($p->nome ?? ''));
$tipo = $p->tipo_contatto ?? ($p->tipologia ?? '');
$email = $p->email ?? $p->pec ?? $p->email_principale ?? null;
$telefono = $p->telefono_ufficio ?? $p->telefono_cellulare ?? $p->telefono_principale ?? null;
$categoria = $p->categoria ?? ($p->tipo ?? '');
$updated = $p->updated_at ?? $p->created_at ?? null;
@endphp
<tr>
<td class="px-3 py-2">
<div class="font-semibold text-slate-900">{{ $nomeCompleto ?: 'Soggetto senza nome' }}</div>
@if(!empty($p->codice_interno))
<div class="text-xs text-slate-500">Codice interno: {{ $p->codice_interno }}</div>
@elseif(!empty($p->id))
<div class="text-xs text-slate-500">ID: {{ $p->id }}</div>
@endif
</td>
<td class="px-3 py-2 text-slate-700">{{ $tipo ?: '—' }}</td>
<td class="px-3 py-2 text-slate-700">
<div>{{ $email ?: '—' }}</div>
<div class="text-xs text-slate-500">{{ $telefono ?: '' }}</div>
</td>
<td class="px-3 py-2 text-slate-700">{{ $categoria ?: '—' }}</td>
<td class="px-3 py-2 text-slate-700">{{ $updated ? $updated->format('d/m/Y H:i') : '—' }}</td>
</tr>
@empty
<tr><td colspan="5" class="px-3 py-3 text-center text-slate-500">Nessuna anagrafica trovata.</td></tr>
@endforelse
</tbody>
</table>
</div>
<div class="mt-3">{{ $persone->links() }}</div>
</div>
@endsection