@extends('layouts.client')
@section('title','Tiket Saya')
@section('content')
<div class="d-flex justify-content-between align-items-center mb-3">
  <h5 class="fw-bold mb-0">Tiket Saya</h5>
  <a href="{{ route('client.tickets.create') }}" class="btn btn-primary btn-sm"><i class="fas fa-plus me-1"></i>Buat Tiket</a>
</div>
<div class="card">
  <div class="table-responsive">
    <table class="table table-hover mb-0">
      <thead><tr><th>No. Tiket</th><th>Subjek</th><th>Prioritas</th><th>Status</th><th>Dibuat</th></tr></thead>
      <tbody>
      @forelse($tickets as $t)
      <tr>
        <td><a href="{{ route('client.tickets.show',$t) }}" class="fw-semibold text-decoration-none text-primary">{{ $t->ticket_number }}</a></td>
        <td class="small">{{ $t->subject }}</td>
        <td><span class="badge bg-{{ $t->priority_badge }}">{{ strtoupper($t->priority) }}</span></td>
        <td><span class="badge bg-{{ $t->status_badge }}">{{ str_replace('_',' ',strtoupper($t->status)) }}</span></td>
        <td class="text-muted small">{{ $t->created_at->format('d/m/Y') }}</td>
      </tr>
      @empty<tr><td colspan="5" class="text-center text-muted py-4">Belum ada tiket</td></tr>
      @endforelse
      </tbody>
    </table>
  </div>
  <div class="card-footer">{{ $tickets->links() }}</div>
</div>
@endsection
