<!DOCTYPE html>
<html lang="{{ app()->getLocale() }}">
<head>
    <meta charset="utf-8">
    <title>{{ __('exports.leave_summary.title', ['name' => $employee->full_name]) }}</title>
    <style>
        body { font-family: DejaVu Sans, sans-serif; font-size: 12px; color: #1e293b; }
        h1, h2 { color: #1d4ed8; }
        table { width: 100%; border-collapse: collapse; margin: 12px 0 24px; }
        th, td { border: 1px solid #e2e8f0; padding: 6px 8px; text-align: left; }
        th { background: #f1f5f9; }
    </style>
</head>
<body>
    <h1>@lang('exports.leave_summary.heading')</h1>
    <p>{{ $employee->full_name }} (#{{ $employee->employee_number }})</p>
    <p>@lang('exports.leave_summary.annual_taken'): {{ $summary->vacationTaken }} · @lang('exports.leave_summary.remaining'): {{ $summary->vacationRemaining }} · @lang('exports.leave_summary.sick_leaves'): {{ $summary->sickLeaveCount }}</p>

    <h2>@lang('exports.leave_summary.vacations')</h2>
    <table>
        <thead><tr><th>@lang('exports.leave_summary.start')</th><th>@lang('exports.leave_summary.end')</th><th>@lang('exports.leave_summary.days')</th><th>@lang('exports.leave_summary.type')</th><th>@lang('exports.leave_summary.status')</th></tr></thead>
        <tbody>
            @forelse ($employee->vacations as $vacation)
                <tr>
                    <td>{{ $vacation->start_date->format('Y-m-d') }}</td>
                    <td>{{ $vacation->end_date->format('Y-m-d') }}</td>
                    <td>{{ $vacation->days }}</td>
                    <td>{{ $vacation->type->label() }}</td>
                    <td>{{ $vacation->status->label() }}</td>
                </tr>
            @empty
                <tr><td colspan="5">@lang('exports.leave_summary.no_vacation_records')</td></tr>
            @endforelse
        </tbody>
    </table>

    <h2>@lang('exports.leave_summary.sick_leaves_heading')</h2>
    <table>
        <thead><tr><th>@lang('exports.leave_summary.start')</th><th>@lang('exports.leave_summary.end')</th><th>@lang('exports.leave_summary.days')</th><th>@lang('exports.leave_summary.institution')</th></tr></thead>
        <tbody>
            @forelse ($employee->sickLeaves as $leave)
                <tr>
                    <td>{{ $leave->start_date->format('Y-m-d') }}</td>
                    <td>{{ $leave->end_date->format('Y-m-d') }}</td>
                    <td>{{ $leave->days }}</td>
                    <td>{{ $leave->medical_institution }}</td>
                </tr>
            @empty
                <tr><td colspan="4">@lang('exports.leave_summary.no_sick_leave_records')</td></tr>
            @endforelse
        </tbody>
    </table>
</body>
</html>
