@extends('layouts.app')

@section('title', 'Corporate Employees Directory')

@section('content')
<div class="space-y-6">
    <div class="flex flex-col sm:flex-row sm:items-center justify-between gap-4">
        <div>
            <h1 class="text-xl font-bold text-slate-900 dark:text-white">Corporate Client Employees Directory</h1>
            <p class="text-xs text-slate-500">Corporate client employee profiles for visa applications, Emirates IDs, and work permit renewals.</p>
        </div>
        <div class="flex items-center space-x-2 rtl:space-x-reverse">
            <a href="{{ route('app.corporate.expiries') }}" class="px-4 py-2 bg-amber-500 text-white font-bold text-xs rounded-xl shadow-sm">Corporate Expiry Matrix</a>
            <a href="{{ route('app.corporate.employees.create') }}" class="px-4 py-2 bg-sky-600 hover:bg-sky-700 text-white font-bold text-xs rounded-xl shadow-sm">+ Add Corporate Employee</a>
        </div>
    </div>

    <!-- Corporate Employees Table (Requirements 48-52) -->
    <div class="bg-white dark:bg-slate-800 rounded-3xl border border-slate-200 dark:border-slate-700/60 shadow-sm overflow-hidden text-xs">
        <div class="overflow-x-auto">
            <table class="w-full text-left rtl:text-right">
                <thead class="bg-slate-50 dark:bg-slate-900/60 border-b border-slate-200 dark:border-slate-700 text-slate-500 uppercase tracking-wider font-bold">
                    <tr>
                        <th class="px-6 py-4">Employee Code</th>
                        <th class="px-6 py-4">Employee Name</th>
                        <th class="px-6 py-4">Company Client</th>
                        <th class="px-6 py-4">Passport #</th>
                        <th class="px-6 py-4">Emirates ID</th>
                        <th class="px-6 py-4">Status</th>
                        <th class="px-6 py-4 text-right rtl:text-left">Actions</th>
                    </tr>
                </thead>
                <tbody class="divide-y divide-slate-200 dark:divide-slate-700/60 font-medium">
                    @foreach($employees as $emp)
                        <tr class="hover:bg-slate-50 dark:hover:bg-slate-700/30">
                            <td class="px-6 py-4 font-mono font-bold text-sky-600 dark:text-sky-400">{{ $emp->corporate_employee_code }}</td>
                            <td class="px-6 py-4">
                                <div class="font-bold text-slate-900 dark:text-white">{{ $emp->full_name }}</div>
                                <div class="text-[11px] text-slate-400">{{ $emp->designation ?? 'Staff' }} &middot; {{ $emp->nationality }}</div>
                            </td>
                            <td class="px-6 py-4 text-slate-700 dark:text-slate-300 font-semibold">{{ $emp->company ? $emp->company->name_en : 'N/A' }}</td>
                            <td class="px-6 py-4 font-mono font-bold text-slate-800 dark:text-slate-200">{{ $emp->passport_number ?? 'N/A' }}</td>
                            <td class="px-6 py-4 font-mono text-slate-500">{{ $emp->emirates_id ?? 'N/A' }}</td>
                            <td class="px-6 py-4">
                                <span class="px-2.5 py-0.5 rounded-full {{ $emp->status === 'active' ? 'bg-emerald-100 text-emerald-700' : 'bg-slate-100 text-slate-600' }} font-bold text-[10px]">{{ ucfirst(str_replace('_', ' ', $emp->status)) }}</span>
                            </td>
                            <td class="px-6 py-4 text-right rtl:text-left">
                                <a href="{{ route('app.corporate.employees.show', $emp) }}" class="text-sky-600 font-bold hover:underline">View Profile</a>
                            </td>
                        </tr>
                    @endforeach
                </tbody>
            </table>
        </div>
        <div class="p-4 border-t border-slate-200 dark:border-slate-700">
            {{ $employees->links() }}
        </div>
    </div>
</div>
@endsection
