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

200 lines
15 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">Ticket operativi fornitore</div>
<div class="text-sm text-gray-600">
@if($this->fornitoreLabel)
Vista operativa attiva per {{ $this->fornitoreLabel }}.
@else
Seleziona un fornitore dalla gestione ticket per aprire questa vista.
@endif
</div>
</div>
<div class="flex flex-wrap gap-2">
<a href="{{ \App\Filament\Pages\Fornitore\LavorazioniOperative::getUrl(['fornitore' => $this->fornitoreId], panel: 'admin-filament') }}" 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">Lavorazioni</a>
<a href="{{ $this->getCollaboratoriUrl() }}" 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">Collaboratori</a>
<a href="{{ $this->getImpostazioniUrl() }}" 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">Impostazioni</a>
<a href="{{ $this->getContabilitaUrl() }}" 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">Contabilita</a>
</div>
</div>
</div>
@if($this->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. Aprila dalla gestione ticket oppure usa un link con il parametro fornitore.
</div>
@else
<div class="grid gap-4 md:grid-cols-3">
<button type="button" wire:click="setStatus('aperti')" class="rounded-xl border p-4 text-left {{ $status === 'aperti' ? 'border-primary-500 bg-primary-50' : 'bg-white' }}">
<div class="text-xs uppercase tracking-wide text-gray-500">Aperti</div>
<div class="mt-1 text-2xl font-semibold">{{ $totals['aperti'] }}</div>
<div class="mt-2 text-sm text-gray-600">Assegnati, in corso o in verifica.</div>
</button>
<button type="button" wire:click="setStatus('fatturabili')" class="rounded-xl border p-4 text-left {{ $status === 'fatturabili' ? 'border-primary-500 bg-primary-50' : 'bg-white' }}">
<div class="text-xs uppercase tracking-wide text-gray-500">Fatturabili</div>
<div class="mt-1 text-2xl font-semibold">{{ $totals['fatturabili'] }}</div>
<div class="mt-2 text-sm text-gray-600">Interventi pronti o gia fatturati.</div>
</button>
<button type="button" wire:click="setStatus('chiusi')" class="rounded-xl border p-4 text-left {{ $status === 'chiusi' ? 'border-primary-500 bg-primary-50' : 'bg-white' }}">
<div class="text-xs uppercase tracking-wide text-gray-500">Chiusi</div>
<div class="mt-1 text-2xl font-semibold">{{ $totals['chiusi'] }}</div>
<div class="mt-2 text-sm text-gray-600">Storico completato del fornitore.</div>
</button>
</div>
<div class="rounded-xl border bg-white p-0">
<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">Num</th>
<th class="px-4 py-3 text-left font-medium text-gray-600">Ingresso</th>
<th class="px-4 py-3 text-left font-medium text-gray-600">Cliente</th>
<th class="px-4 py-3 text-left font-medium text-gray-600">Tel</th>
<th class="px-4 py-3 text-left font-medium text-gray-600">Difetto</th>
<th class="px-4 py-3 text-left font-medium text-gray-600">Modello</th>
<th class="px-4 py-3 text-left font-medium text-gray-600">Seriale</th>
<th class="px-4 py-3 text-left font-medium text-gray-600">Cod. prod</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($rows as $row)
<tr class="{{ $row['row_class'] }}">
<td class="px-4 py-3 align-top font-medium">
{{ $row['numero'] }}
<div class="mt-1 text-[11px] text-slate-500">{{ $row['origine'] }}</div>
</td>
<td class="px-4 py-3 align-top text-gray-700">{{ $row['ingresso'] }}</td>
<td class="px-4 py-3 align-top">
<div class="font-medium">{{ $row['cliente'] }}</div>
<div class="text-[11px] text-slate-500">{{ $row['stabile'] }}</div>
</td>
<td class="px-4 py-3 align-top">{{ $row['telefono'] !== '' ? $row['telefono'] : '-' }}</td>
<td class="px-4 py-3 align-top">{{ $row['difetto'] }}</td>
<td class="px-4 py-3 align-top">
<div>{{ $row['modello'] }}</div>
@if(($row['titolo'] ?? '') !== '')
<div class="text-[11px] text-slate-500">{{ $row['titolo'] }}</div>
@endif
</td>
<td class="px-4 py-3 align-top">{{ $row['seriale'] }}</td>
<td class="px-4 py-3 align-top">{{ $row['cod_prodotto'] }}</td>
<td class="px-4 py-3 align-top">
<span class="inline-flex rounded-full border px-2 py-1 text-xs font-medium {{ $row['badge_class'] }}">{{ $row['stato'] }}</span>
</td>
<td class="px-4 py-3 align-top text-gray-600">{{ $row['updated_at'] }}</td>
<td class="px-4 py-3 text-right align-top">
<div class="flex justify-end gap-2">
@if($row['row_type'] === 'ticket')
<button type="button" wire:click="openInterventoModal({{ (int) $row['id'] }})" class="inline-flex items-center rounded-md bg-gray-100 px-3 py-1.5 text-xs font-medium text-gray-700 hover:bg-gray-200">Apri modal</button>
@endif
@if($row['url'])
<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 scheda</a>
@else
<a href="{{ $this->getImpostazioniUrl() }}" class="inline-flex items-center rounded-md bg-white px-3 py-1.5 text-xs font-medium text-slate-600 ring-1 ring-inset ring-slate-300 hover:bg-slate-50">Gestisci import</a>
@endif
</div>
</td>
</tr>
@empty
<tr>
<td colspan="11" class="px-4 py-10 text-center text-sm text-gray-500">Nessun intervento trovato per questo filtro.</td>
</tr>
@endforelse
</tbody>
</table>
</div>
</div>
@endif
</div>
@if($detailModal)
<div class="fixed inset-0 z-50 flex items-center justify-center bg-black/60 p-4">
<div class="max-h-[92vh] w-full max-w-5xl overflow-hidden rounded-xl bg-white shadow-2xl">
<div class="flex items-start justify-between gap-4 border-b px-4 py-3">
<div>
<div class="text-sm font-semibold">Ticket #{{ $detailModal['ticket_id'] }} · {{ $detailModal['titolo'] }}</div>
<div class="text-xs text-gray-500">{{ $detailModal['stabile'] }} · stato {{ $detailModal['stato'] }}</div>
</div>
<div class="flex items-center gap-2">
<a href="{{ $detailModal['url'] }}" class="rounded-md bg-slate-100 px-2 py-1 text-xs hover:bg-slate-200">Apri scheda completa</a>
<button type="button" wire:click="closeInterventoModal" class="rounded-md bg-gray-100 px-2 py-1 text-xs hover:bg-gray-200">Chiudi</button>
</div>
</div>
<div class="max-h-[calc(92vh-64px)] overflow-auto p-4">
<div class="grid gap-4 xl:grid-cols-3">
<div class="space-y-4 xl:col-span-2">
<div class="rounded-xl border bg-white p-4">
<div class="grid gap-3 text-sm md:grid-cols-2">
<div>
<div class="text-xs uppercase tracking-wide text-gray-500">Contatto</div>
<div class="mt-1">{{ $detailModal['contatto'] !== '' ? $detailModal['contatto'] : '-' }}</div>
</div>
<div>
<div class="text-xs uppercase tracking-wide text-gray-500">Telefono</div>
<div class="mt-1">{{ $detailModal['telefono'] !== '' ? $detailModal['telefono'] : '-' }}</div>
</div>
<div class="md:col-span-2">
<div class="text-xs uppercase tracking-wide text-gray-500">Problema</div>
<div class="mt-1">{{ $detailModal['problema'] }}</div>
</div>
</div>
<div class="mt-4 whitespace-pre-wrap rounded-lg bg-gray-50 p-3 text-sm text-gray-700">{{ $detailModal['descrizione'] !== '' ? $detailModal['descrizione'] : 'Nessuna descrizione disponibile.' }}</div>
</div>
<div class="rounded-xl border bg-white p-4">
<div class="text-sm font-semibold">Ultime comunicazioni</div>
<div class="mt-3 space-y-2">
@forelse($detailModal['messages'] as $message)
<div class="rounded-lg border p-3 text-sm">
<div class="font-medium">{{ $message['author'] }}</div>
<div class="mt-1 whitespace-pre-wrap text-gray-700">{{ $message['body'] }}</div>
<div class="mt-1 text-xs text-gray-500">{{ $message['created_at'] }}</div>
</div>
@empty
<div class="text-sm text-gray-500">Nessuna comunicazione disponibile.</div>
@endforelse
</div>
</div>
</div>
<div class="space-y-4">
<div class="rounded-xl border bg-white p-4">
<div class="text-sm font-semibold">Allegati ticket</div>
<div class="mt-3 grid gap-3 sm:grid-cols-2 xl:grid-cols-1">
@forelse($detailModal['attachments'] as $attachment)
<a href="{{ $attachment['url'] }}" target="_blank" class="rounded-xl border bg-white p-3 text-xs shadow-sm hover:border-primary-300 hover:bg-primary-50/30">
<div class="aspect-[4/3] rounded-lg border bg-gray-50 p-2">
@if($attachment['is_image'])
<img src="{{ $attachment['url'] }}" alt="{{ $attachment['name'] }}" class="h-full w-full rounded object-cover" />
@else
<div class="flex h-full items-center justify-center text-center text-gray-500">
<div>
<div class="text-sm font-semibold">{{ $attachment['is_pdf'] ? 'PDF' : 'FILE' }}</div>
<div class="mt-1 text-[11px]">Apri allegato</div>
</div>
</div>
@endif
</div>
<div class="mt-2 font-medium">{{ $attachment['name'] }}</div>
<div class="mt-1 text-gray-600">{{ $attachment['description'] !== '' ? $attachment['description'] : 'Nessuna descrizione' }}</div>
<div class="mt-2 text-[11px] text-gray-500">{{ $attachment['created_at'] }}</div>
</a>
@empty
<div class="text-sm text-gray-500">Nessun allegato disponibile.</div>
@endforelse
</div>
</div>
</div>
</div>
</div>
</div>
</div>
@endif
</x-filament-panels::page>