359 lines
25 KiB
PHP
Executable File
359 lines
25 KiB
PHP
Executable File
@extends('admin.layouts.app')
|
|
|
|
@section('title', '
|
|
{{ __(\'Dettagli Ticket\') }}
|
|
')
|
|
|
|
@section('content')
|
|
|
|
|
|
|
|
<div class="py-5">
|
|
<div class="container-fluid mx-auto sm:px-4 lg:px-8">
|
|
<div class="bg-white dark:bg-dark overflow-hidden shadow-sm rounded">
|
|
<div class="p-6 text-gray-900 dark:text-gray-100">
|
|
|
|
<div class="d-flex justify-content-between align-items-center mb-6">
|
|
<h3 class="text-2xl fw-bold text-dark ">{{ $ticket->titolo }}</h3>
|
|
<div class="gap-2">
|
|
<a href="{{ route('admin.tickets.edit', $ticket) }}"
|
|
class="bg-primary text-white fw-bold py-2 px-3 rounded">
|
|
Modifica
|
|
</a>
|
|
@if($ticket->stato !== 'Chiuso')
|
|
<form method="POST" action="{{ route('admin.tickets.close', $ticket) }}" style="display:inline-block;">
|
|
@csrf
|
|
<button type="submit" class="btn btn-success">Chiudi Ticket</button>
|
|
</form>
|
|
@endif
|
|
<a href="{{ route('admin.tickets.index') }}"
|
|
class="bg-light0 hover:bg-gray-700 text-white fw-bold py-2 px-3 rounded">
|
|
Torna alla Lista
|
|
</a>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Informazioni Principali -->
|
|
<div class="grid row md:row gap-6 mb-8">
|
|
<div class="bg-light dark:bg-gray-700 p-4 rounded-lg">
|
|
<h4 class="text-lg font-medium text-gray-900 dark:text-gray-100 mb-3">Informazioni Generali</h4>
|
|
<dl class="space-y-2">
|
|
<div>
|
|
<dt class="text-sm font-medium text-muted dark:text-gray-400">ID Ticket:</dt>
|
|
<dd class="text-sm text-gray-900 dark:text-gray-100">{{ $ticket->id }}</dd>
|
|
</div>
|
|
<div>
|
|
<dt class="text-sm font-medium text-muted dark:text-gray-400">Titolo:</dt>
|
|
<dd class="text-sm text-gray-900 dark:text-gray-100">{{ $ticket->titolo }}</dd>
|
|
</div>
|
|
<div>
|
|
<dt class="text-sm font-medium text-muted dark:text-gray-400">Stabile:</dt>
|
|
<dd class="text-sm text-gray-900 dark:text-gray-100">{{ $ticket->stabile->denominazione ?? '-' }}</dd>
|
|
</div>
|
|
<div>
|
|
<dt class="text-sm font-medium text-muted dark:text-gray-400">Categoria:</dt>
|
|
<dd class="text-sm text-gray-900 dark:text-gray-100">{{ $ticket->categoriaTicket->nome ?? '-' }}</dd>
|
|
</div>
|
|
</dl>
|
|
</div>
|
|
|
|
<div class="bg-light dark:bg-gray-700 p-4 rounded-lg">
|
|
<h4 class="text-lg font-medium text-gray-900 dark:text-gray-100 mb-3">Stato e Priorità</h4>
|
|
<dl class="space-y-2">
|
|
<div>
|
|
<dt class="text-sm font-medium text-muted dark:text-gray-400">Stato:</dt>
|
|
<dd class="text-sm">
|
|
<span class="inline-d-flex align-items-center px-2.5 py-0.5 rounded-full text-xs font-medium
|
|
@switch($ticket->stato)
|
|
@case('Aperto')
|
|
bg-red-100 text-red-800 dark:bg-red-800 dark:text-red-100
|
|
@break
|
|
@case('Preso in Carico')
|
|
bg-yellow-100 text-yellow-800 dark:bg-yellow-800 dark:text-yellow-100
|
|
@break
|
|
@case('In Lavorazione')
|
|
bg-blue-100 text-blue-800 dark:bg-blue-800 dark:text-blue-100
|
|
@break
|
|
@case('Risolto')
|
|
bg-green-100 text-green-800 dark:bg-green-800 dark:text-green-100
|
|
@break
|
|
@case('Chiuso')
|
|
bg-gray-100 text-dark dark:bg-dark dark:text-gray-100
|
|
@break
|
|
@default
|
|
bg-gray-100 text-dark dark:bg-dark dark:text-gray-100
|
|
@endswitch">
|
|
{{ $ticket->stato }}
|
|
</span>
|
|
</dd>
|
|
</div>
|
|
<div>
|
|
<dt class="text-sm font-medium text-muted dark:text-gray-400">Priorità:</dt>
|
|
<dd class="text-sm">
|
|
<span class="inline-d-flex align-items-center px-2.5 py-0.5 rounded-full text-xs font-medium
|
|
@switch($ticket->priorita)
|
|
@case('Urgente')
|
|
bg-red-100 text-red-800 dark:bg-red-800 dark:text-red-100
|
|
@break
|
|
@case('Alta')
|
|
bg-orange-100 text-orange-800 dark:bg-orange-800 dark:text-orange-100
|
|
@break
|
|
@case('Media')
|
|
bg-yellow-100 text-yellow-800 dark:bg-yellow-800 dark:text-yellow-100
|
|
@break
|
|
@case('Bassa')
|
|
bg-green-100 text-green-800 dark:bg-green-800 dark:text-green-100
|
|
@break
|
|
@default
|
|
bg-gray-100 text-dark dark:bg-dark dark:text-gray-100
|
|
@endswitch">
|
|
{{ $ticket->priorita }}
|
|
</span>
|
|
</dd>
|
|
</div>
|
|
<div>
|
|
<dt class="text-sm font-medium text-muted dark:text-gray-400">Aperto da:</dt>
|
|
<dd class="text-sm text-gray-900 dark:text-gray-100">{{ $ticket->apertoUser->name ?? '-' }}</dd>
|
|
</div>
|
|
<div>
|
|
<dt class="text-sm font-medium text-muted dark:text-gray-400">Assegnato a:</dt>
|
|
<dd class="text-sm text-gray-900 dark:text-gray-100">{{ $ticket->assegnatoUser->name ?? $ticket->assegnatoFornitore->ragione_sociale ?? '-' }}</dd>
|
|
</div>
|
|
</dl>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Descrizione -->
|
|
@if($ticket->descrizione)
|
|
<div class="bg-light dark:bg-gray-700 p-4 rounded-lg mb-6">
|
|
<h4 class="text-lg font-medium text-gray-900 dark:text-gray-100 mb-3">Descrizione</h4>
|
|
<p class="text-sm text-gray-900 dark:text-gray-100 whitespace-pre-wrap">{{ $ticket->descrizione }}</p>
|
|
</div>
|
|
@endif
|
|
|
|
<!-- Date e Scadenze -->
|
|
<div class="bg-light dark:bg-gray-700 p-4 rounded-lg mb-6">
|
|
<h4 class="text-lg font-medium text-gray-900 dark:text-gray-100 mb-3">Date e Scadenze</h4>
|
|
<dl class="grid row md:row gap-4">
|
|
<div>
|
|
<dt class="text-sm font-medium text-muted dark:text-gray-400">Data Apertura:</dt>
|
|
<dd class="text-sm text-gray-900 dark:text-gray-100">{{ $ticket->data_apertura->format('d/m/Y H:i') }}</dd>
|
|
</div>
|
|
@if($ticket->data_scadenza_prevista)
|
|
<div>
|
|
<dt class="text-sm font-medium text-muted dark:text-gray-400">Scadenza Prevista:</dt>
|
|
<dd class="text-sm text-gray-900 dark:text-gray-100">{{ $ticket->data_scadenza_prevista->format('d/m/Y') }}</dd>
|
|
</div>
|
|
@endif
|
|
@if($ticket->data_risoluzione_effettiva)
|
|
<div>
|
|
<dt class="text-sm font-medium text-muted dark:text-gray-400">Data Risoluzione:</dt>
|
|
<dd class="text-sm text-gray-900 dark:text-gray-100">{{ $ticket->data_risoluzione_effettiva->format('d/m/Y') }}</dd>
|
|
</div>
|
|
@endif
|
|
@if($ticket->data_chiusura_effettiva)
|
|
<div>
|
|
<dt class="text-sm font-medium text-muted dark:text-gray-400">Data Chiusura:</dt>
|
|
<dd class="text-sm text-gray-900 dark:text-gray-100">{{ $ticket->data_chiusura_effettiva->format('d/m/Y') }}</dd>
|
|
</div>
|
|
@endif
|
|
</dl>
|
|
</div>
|
|
|
|
<!-- Interventi Operativi Fornitore -->
|
|
<div class="bg-light dark:bg-gray-700 p-4 rounded-lg mb-6">
|
|
<h4 class="text-lg font-medium text-gray-900 dark:text-gray-100 mb-3">Flusso Operativo Fornitore</h4>
|
|
|
|
@if(!$ticket->assegnatoFornitore)
|
|
<p class="text-muted mb-0">Assegna il ticket a un fornitore per aprire l'intervento operativo.</p>
|
|
@else
|
|
<form method="POST" action="{{ route('admin.tickets.interventi.store', $ticket) }}" class="mb-4">
|
|
@csrf
|
|
<div class="mb-3">
|
|
<label class="form-label" for="note_amministratore">Note amministratore al manutentore</label>
|
|
<textarea id="note_amministratore" name="note_amministratore" class="form-control" rows="3" placeholder="Indicazioni operative, vincoli, urgenze..."></textarea>
|
|
</div>
|
|
<div class="mb-3">
|
|
<label class="form-label">Articoli/attivita pronti</label>
|
|
<div class="row g-2">
|
|
@foreach(($articoliPronti ?? []) as $articolo)
|
|
<div class="col-md-6">
|
|
<div class="form-check">
|
|
<input class="form-check-input" type="checkbox" name="articoli_utilizzati[]" value="{{ $articolo }}" id="articolo_{{ $loop->index }}">
|
|
<label class="form-check-label" for="articolo_{{ $loop->index }}">{{ $articolo }}</label>
|
|
</div>
|
|
</div>
|
|
@endforeach
|
|
</div>
|
|
</div>
|
|
<button type="submit" class="btn btn-primary">Crea Intervento Operativo</button>
|
|
<a href="{{ route('fornitore.tickets.index') }}" class="btn btn-outline-secondary">Apri area manutentore</a>
|
|
</form>
|
|
|
|
@if($ticket->interventi->count() > 0)
|
|
@foreach($ticket->interventi as $intervento)
|
|
<div class="border rounded p-3 mb-3 bg-white">
|
|
<div class="d-flex justify-content-between align-items-center mb-2">
|
|
<div>
|
|
<strong>Intervento #{{ $intervento->id }}</strong>
|
|
<span class="badge bg-info text-dark ms-2">{{ $intervento->stato }}</span>
|
|
</div>
|
|
<small class="text-muted">Creato {{ optional($intervento->created_at)->format('d/m/Y H:i') }}</small>
|
|
</div>
|
|
|
|
<p class="mb-2"><strong>Rapporto fornitore:</strong> {{ $intervento->rapporto_fornitore ?: 'Non ancora inviato' }}</p>
|
|
<p class="mb-2"><strong>QR token:</strong> {{ $intervento->qr_token ?: '-' }} | <strong>Scansionato:</strong> {{ optional($intervento->qr_scansionato_at)->format('d/m/Y H:i') ?: '-' }}</p>
|
|
<p class="mb-3"><strong>Foto:</strong>
|
|
@if($intervento->foto_path)
|
|
<a href="{{ Storage::disk('public')->url($intervento->foto_path) }}" target="_blank">Visualizza</a>
|
|
@else
|
|
Non caricata
|
|
@endif
|
|
</p>
|
|
|
|
<form method="POST" action="{{ route('admin.tickets.interventi.verify', [$ticket, $intervento]) }}" class="mb-3">
|
|
@csrf
|
|
<div class="row g-2 align-items-end">
|
|
<div class="col-md-2">
|
|
<div class="form-check">
|
|
<input class="form-check-input" type="checkbox" name="check_foto_ok" value="1" id="check_foto_{{ $intervento->id }}" {{ $intervento->check_foto_ok ? 'checked' : '' }}>
|
|
<label class="form-check-label" for="check_foto_{{ $intervento->id }}">Foto ok</label>
|
|
</div>
|
|
</div>
|
|
<div class="col-md-2">
|
|
<div class="form-check">
|
|
<input class="form-check-input" type="checkbox" name="check_qr_ok" value="1" id="check_qr_{{ $intervento->id }}" {{ $intervento->check_qr_ok ? 'checked' : '' }}>
|
|
<label class="form-check-label" for="check_qr_{{ $intervento->id }}">QR ok</label>
|
|
</div>
|
|
</div>
|
|
<div class="col-md-2">
|
|
<div class="form-check">
|
|
<input class="form-check-input" type="checkbox" name="check_admin_ok" value="1" id="check_admin_{{ $intervento->id }}" {{ $intervento->check_admin_ok ? 'checked' : '' }}>
|
|
<label class="form-check-label" for="check_admin_{{ $intervento->id }}">Admin ok</label>
|
|
</div>
|
|
</div>
|
|
<div class="col-md-3">
|
|
<input type="text" name="riferimento_chiusura" class="form-control form-control-sm" placeholder="Rif. interno" value="{{ $intervento->riferimento_chiusura }}">
|
|
</div>
|
|
<div class="col-md-3">
|
|
<button type="submit" class="btn btn-sm btn-outline-primary">Salva checklist</button>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
|
|
<form method="POST" action="{{ route('admin.tickets.interventi.invoice', [$ticket, $intervento]) }}" class="row g-2 mb-3">
|
|
@csrf
|
|
<div class="col-md-2"><input type="text" class="form-control form-control-sm" name="fattura_numero" placeholder="Numero" value="{{ $intervento->fattura_numero }}"></div>
|
|
<div class="col-md-2"><input type="date" class="form-control form-control-sm" name="fattura_data" value="{{ optional($intervento->fattura_data)->format('Y-m-d') }}"></div>
|
|
<div class="col-md-2"><input type="number" step="0.01" class="form-control form-control-sm" name="fattura_imponibile" placeholder="Imponibile" value="{{ $intervento->fattura_imponibile }}"></div>
|
|
<div class="col-md-2"><input type="number" step="0.01" class="form-control form-control-sm" name="fattura_totale" placeholder="Totale" value="{{ $intervento->fattura_totale }}"></div>
|
|
<div class="col-md-2"><input type="text" class="form-control form-control-sm" name="fe_riferimento" placeholder="Rif FE" value="{{ $intervento->fe_riferimento }}"></div>
|
|
<div class="col-md-2"><button type="submit" class="btn btn-sm btn-outline-secondary w-100">Registra fattura</button></div>
|
|
</form>
|
|
|
|
<form method="POST" action="{{ route('admin.tickets.interventi.close', [$ticket, $intervento]) }}">
|
|
@csrf
|
|
<button type="submit" class="btn btn-sm btn-success">Chiudi intervento definitivamente</button>
|
|
</form>
|
|
</div>
|
|
@endforeach
|
|
@else
|
|
<p class="text-muted mb-0">Nessun intervento operativo creato.</p>
|
|
@endif
|
|
@endif
|
|
</div>
|
|
|
|
<!-- Informazioni Sistema -->
|
|
<div class="bg-light dark:bg-gray-700 p-4 rounded-lg">
|
|
<h4 class="text-lg font-medium text-gray-900 dark:text-gray-100 mb-3">Informazioni Sistema</h4>
|
|
<dl class="grid row md:row gap-4">
|
|
<div>
|
|
<dt class="text-sm font-medium text-muted dark:text-gray-400">Creato il:</dt>
|
|
<dd class="text-sm text-gray-900 dark:text-gray-100">{{ $ticket->created_at->format('d/m/Y H:i') }}</dd>
|
|
</div>
|
|
<div>
|
|
<dt class="text-sm font-medium text-muted dark:text-gray-400">Ultimo aggiornamento:</dt>
|
|
<dd class="text-sm text-gray-900 dark:text-gray-100">{{ $ticket->updated_at->format('d/m/Y H:i') }}</dd>
|
|
</div>
|
|
</dl>
|
|
</div>
|
|
|
|
<!-- Comunicazioni Email / EML -->
|
|
<div class="bg-light dark:bg-gray-700 p-4 rounded-lg mt-6">
|
|
<h4 class="text-lg font-medium text-gray-900 dark:text-gray-100 mb-3">Registro Comunicazioni Email</h4>
|
|
|
|
<form method="POST" action="{{ route('admin.tickets.email-message.store', $ticket) }}" enctype="multipart/form-data" class="mb-4">
|
|
@csrf
|
|
<div class="grid row md:row gap-3">
|
|
<div>
|
|
<label for="eml_file" class="form-label">File EML</label>
|
|
<input id="eml_file" type="file" name="eml_file" class="form-control" accept=".eml,.msg,.txt" required>
|
|
</div>
|
|
<div>
|
|
<label for="oggetto" class="form-label">Oggetto (opzionale)</label>
|
|
<input id="oggetto" type="text" name="oggetto" class="form-control" placeholder="Oggetto email">
|
|
</div>
|
|
<div>
|
|
<label for="email_mittente" class="form-label">Email mittente (opzionale)</label>
|
|
<input id="email_mittente" type="email" name="email_mittente" class="form-control" placeholder="mittente@example.com">
|
|
</div>
|
|
<div>
|
|
<label for="email_destinatario" class="form-label">Email destinatario (opzionale)</label>
|
|
<input id="email_destinatario" type="email" name="email_destinatario" class="form-control" placeholder="destinatario@example.com">
|
|
</div>
|
|
<div>
|
|
<label for="inviato_il" class="form-label">Data invio (opzionale)</label>
|
|
<input id="inviato_il" type="datetime-local" name="inviato_il" class="form-control">
|
|
</div>
|
|
<div class="md:col-span-2">
|
|
<label for="messaggio" class="form-label">Nota operativa</label>
|
|
<textarea id="messaggio" name="messaggio" class="form-control" rows="2" placeholder="Nota interna per la gestione ticket"></textarea>
|
|
</div>
|
|
</div>
|
|
<div class="mt-3">
|
|
<button type="submit" class="btn btn-primary">Archivia Email nel Ticket</button>
|
|
</div>
|
|
</form>
|
|
|
|
@if(isset($comunicazioni) && $comunicazioni->count() > 0)
|
|
<div class="table-responsive">
|
|
<table class="table table-sm align-middle">
|
|
<thead>
|
|
<tr>
|
|
<th>Data</th>
|
|
<th>Oggetto</th>
|
|
<th>Mittente</th>
|
|
<th>Operatore</th>
|
|
<th>EML</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@foreach($comunicazioni as $msg)
|
|
<tr>
|
|
<td>{{ optional($msg->inviato_il ?? $msg->created_at)->format('d/m/Y H:i') }}</td>
|
|
<td>{{ $msg->oggetto ?? '-' }}</td>
|
|
<td>{{ $msg->email_mittente ?? '-' }}</td>
|
|
<td>{{ $msg->user->name ?? '-' }}</td>
|
|
<td>
|
|
@if($msg->eml_documento_id)
|
|
<a href="{{ route('admin.documenti.download', $msg->eml_documento_id) }}" class="btn btn-outline-secondary btn-sm">Scarica</a>
|
|
@else
|
|
-
|
|
@endif
|
|
</td>
|
|
</tr>
|
|
@endforeach
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
@else
|
|
<p class="text-muted mb-0">Nessuna comunicazione email registrata su questo ticket.</p>
|
|
@endif
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
@endsection
|