@extends('layouts.app')
@section('page_title','HR Tickets')
@section('page_subtitle','Respond to employee HR requests and complaints.')
@section('content')
<div class="card"><h3>Tickets</h3><table class="table"><tr><th>Employee</th><th>Subject</th><th>Message</th><th>Status</th><th>Respond</th></tr>@forelse($tickets as $ticket)<tr><td>{{ $ticket->user?->name }}<br><span class="muted small">{{ ucfirst($ticket->priority) }}</span></td><td><strong>{{ $ticket->subject }}</strong><br><span class="muted small">{{ ucfirst($ticket->category) }}</span></td><td>{{ \Illuminate\Support\Str::limit($ticket->message,140) }}</td><td><span class="badge {{ $ticket->status==='resolved'?'green':'yellow' }}">{{ ucfirst(str_replace('_',' ',$ticket->status)) }}</span></td><td><form method="POST" action="{{ route('admin.tickets.update',$ticket) }}">@csrf @method('PUT')<select name="status"><option @selected($ticket->status==='open')>open</option><option value="in_progress" @selected($ticket->status==='in_progress')>in_progress</option><option @selected($ticket->status==='resolved')>resolved</option><option @selected($ticket->status==='closed')>closed</option></select><select name="priority"><option @selected($ticket->priority==='low')>low</option><option @selected($ticket->priority==='normal')>normal</option><option @selected($ticket->priority==='high')>high</option><option @selected($ticket->priority==='urgent')>urgent</option></select><select name="assigned_to"><option value="">Unassigned</option>@foreach($admins as $admin)<option value="{{ $admin->id }}" @selected($ticket->assigned_to==$admin->id)>{{ $admin->name }}</option>@endforeach</select><textarea name="response" placeholder="Response">{{ $ticket->response }}</textarea><button class="btn secondary">Update</button></form></td></tr>@empty<tr><td colspan="5"><div class="empty">No HR tickets.</div></td></tr>@endforelse</table><div class="pagination">{{ $tickets->links() }}</div></div>
@endsection
