@extends('layouts.app')

@section('title', 'Policy acknowledgments')
@section('heading', 'Policy acknowledgments')

@section('content')
@include('hr.top-submenu')
    <x-card>
        <div class="mb-4">
            <a href="{{ route('company-policies.index') }}" class="text-sm text-primary hover:underline">&larr; Policies</a>
        </div>
        <h2 class="mb-4 text-lg font-semibold text-slate-900">{{ $companyPolicy->name }}</h2>

        <x-table>
            <x-slot name="head">
                <tr>
                    <th class="px-4 py-3 text-left text-xs font-medium uppercase text-slate-500">Employee</th>
                    <th class="px-4 py-3 text-left text-xs font-medium uppercase text-slate-500">Acknowledged</th>
                    <th class="px-4 py-3 text-left text-xs font-medium uppercase text-slate-500">IP</th>
                </tr>
            </x-slot>
            @forelse($acknowledgments as $ack)
                <tr>
                    <td class="px-4 py-3 text-sm text-slate-900">{{ $ack->user?->name }}</td>
                    <td class="px-4 py-3 text-sm text-slate-600">{{ $ack->acknowledged_at?->format('d M Y H:i') }}</td>
                    <td class="px-4 py-3 text-sm text-slate-600">{{ $ack->ip_address ?? '—' }}</td>
                </tr>
            @empty
                <tr><td colspan="3" class="px-4 py-8 text-center text-sm text-slate-500">No acknowledgments yet.</td></tr>
            @endforelse
        </x-table>
        @if($acknowledgments->hasPages())<div class="mt-4">{{ $acknowledgments->links() }}</div>@endif
    </x-card>
@endsection
