netgescon-day0/resources/views/fornitore/tickets/index.blade.php

117 lines
6.1 KiB
PHP

@extends('admin.layouts.netgescon')
@section('title', 'I miei ticket operativi')
@section('content')
<div class="container-fluid py-4">
<div class="d-flex justify-content-between align-items-center mb-3">
<div>
<h1 class="h4 mb-0">Ticket operativi - {{ $fornitore->ragione_sociale ?? $fornitore->nome ?? 'Fornitore' }}</h1>
<small class="text-muted">Gestione interventi, chiusure operative e raggruppamento fattura</small>
</div>
<div>
<a href="{{ route('fornitore.dipendenti.index') }}" class="btn btn-sm btn-outline-primary">Gestisci dipendenti</a>
</div>
</div>
<div class="mb-3 d-flex gap-2">
<a class="btn btn-sm {{ $stato === 'aperti' ? 'btn-primary' : 'btn-outline-primary' }}" href="{{ route('fornitore.tickets.index', ['stato' => 'aperti']) }}">Aperti</a>
<a class="btn btn-sm {{ $stato === 'fatturabili' ? 'btn-primary' : 'btn-outline-primary' }}" href="{{ route('fornitore.tickets.index', ['stato' => 'fatturabili']) }}">Fatturabili</a>
<a class="btn btn-sm {{ $stato === 'chiusi' ? 'btn-primary' : 'btn-outline-primary' }}" href="{{ route('fornitore.tickets.index', ['stato' => 'chiusi']) }}">Chiusi</a>
</div>
<div class="card mb-4">
<div class="card-header">Interventi da fatturare</div>
<div class="card-body">
@if($fatturabili->isEmpty())
<p class="text-muted mb-0">Nessun intervento ancora pronto per fattura.</p>
@else
<div class="table-responsive">
<table class="table table-sm align-middle mb-0">
<thead>
<tr>
<th>Ticket</th>
<th>Stabile</th>
<th>Stato</th>
<th>Rif. chiusura</th>
<th>Fattura</th>
</tr>
</thead>
<tbody>
@foreach($fatturabili as $item)
<tr>
<td><a href="{{ route('fornitore.tickets.show', $item) }}">#{{ $item->ticket_id }} - {{ $item->ticket->titolo ?? '-' }}</a></td>
<td>{{ $item->ticket->stabile->denominazione ?? '-' }}</td>
<td><span class="badge bg-secondary">{{ $item->stato }}</span></td>
<td>{{ $item->riferimento_chiusura ?: '-' }}</td>
<td>{{ $item->fattura_numero ?: 'Da emettere' }}</td>
</tr>
@endforeach
</tbody>
</table>
</div>
@endif
</div>
</div>
<div class="card">
<div class="card-header">Pratiche / Interventi / Manutenzioni</div>
<div class="card-body p-0">
<div class="table-responsive">
<table class="table table-hover mb-0">
<thead>
<tr>
<th>Ingresso</th>
<th>Contatto</th>
<th>Telefono</th>
<th>Problema</th>
<th>Apparato</th>
<th>Stato</th>
<th>Aggiornato</th>
<th></th>
</tr>
</thead>
<tbody>
@forelse($interventi as $idx => $intervento)
@php($row = $rows[$idx] ?? ['ingresso' => '-', 'contatto' => '-', 'telefono' => '', 'problema' => '-', 'apparato' => '-'])
<tr>
<td>{{ $row['ingresso'] }}</td>
<td>
<div class="fw-semibold">{{ $row['contatto'] }}</div>
<small class="text-muted">Ticket #{{ $intervento->ticket_id }} - {{ $intervento->ticket->stabile->denominazione ?? '-' }}</small>
</td>
<td>
@if(!empty($row['telefono']))
<a href="tel:{{ preg_replace('/\s+/', '', (string) $row['telefono']) }}" class="btn btn-sm btn-outline-success">
{{ $row['telefono'] }}
</a>
@else
<span class="text-muted">-</span>
@endif
</td>
<td>{{ \Illuminate\Support\Str::limit((string) $row['problema'], 90) }}</td>
<td>{{ $row['apparato'] }}</td>
<td><span class="badge bg-info text-dark">{{ $intervento->stato }}</span></td>
<td>{{ optional($intervento->updated_at)->format('d/m/Y H:i') }}</td>
<td>
<a href="{{ route('fornitore.tickets.show', $intervento) }}" class="btn btn-sm btn-outline-primary">Scheda</a>
<form method="POST" action="{{ route('fornitore.tickets.sollecito', $intervento) }}" class="d-inline">
@csrf
<button type="submit" class="btn btn-sm btn-outline-warning">Sollecito</button>
</form>
</td>
</tr>
@empty
<tr>
<td colspan="9" class="text-center text-muted py-4">Nessun intervento disponibile.</td>
</tr>
@endforelse
</tbody>
</table>
</div>
</div>
<div class="card-footer">{{ $interventi->links() }}</div>
</div>
</div>
@endsection