@extends('layouts.app')

@section('title', 'Leave Types')
@section('heading', 'Leave Types')

@section('content')
@include('settings.partials.back-to-home')
    <x-card>
        <div class="mb-4 flex justify-between items-center">
            <p class="text-slate-600">Manage leave types and annual quotas.</p>
            <a href="{{ route('leave-types.create') }}" class="inline-flex items-center rounded-lg bg-slate-800 px-4 py-2 text-sm font-medium text-white hover:bg-slate-700"><i class="bi bi-plus-lg me-1"></i>Add Leave Type</a>
        </div>
        <x-table>
            <x-slot name="head">
                <tr>
                    <th class="px-4 py-3 text-left text-xs font-medium uppercase text-slate-500">Name</th>
                    <th class=" whitespace-nowrap px-4 py-3 text-left text-xs font-medium uppercase text-slate-500">Total / Year</th>
                    <th class="px-4 py-3 text-left text-xs font-medium uppercase text-slate-500">Paid</th>
                    <th class="px-4 py-3 text-left text-xs font-medium uppercase text-slate-500">Count Type</th>
                    <th class="px-4 py-3 text-right text-xs font-medium uppercase text-slate-500">Actions</th>
                </tr>
            </x-slot>
            @forelse($leaveTypes as $lt)
                <tr>
                    <td class="whitespace-nowrap px-4 py-3 text-sm text-slate-900">{{ $lt->name }}</td>
                    <td class="whitespace-nowrap px-4 py-3 text-sm text-slate-600">{{ $lt->total_leaves }}</td>
                    <td class="whitespace-nowrap px-4 py-3 text-sm">{{ $lt->is_paid ? 'Yes' : 'No' }}</td>
                    <td class="whitespace-nowrap px-4 py-3 text-sm text-slate-600">{{ $lt->count_type ?? '—' }}</td>
                    <td class="whitespace-nowrap px-4 py-3 text-right text-sm">—</td>
                </tr>
            @empty
                <tr><td colspan="5" class="px-4 py-8 text-center text-sm text-slate-500">No leave types yet.</td></tr>
            @endforelse
        </x-table>
        @if($leaveTypes->hasPages())<div class="mt-4">{{ $leaveTypes->links() }}</div>@endif
    </x-card>
@endsection
