<x-app-layout>
    <x-slot name="header">{{ __('app.employees') }}</x-slot>

    <div class="mb-3 d-flex gap-2">
        <a href="{{ route('employees.create') }}" class="btn btn-primary">{{ __('Add Employee') }}</a>
        <a href="{{ route('employee-payments.create') }}" class="btn btn-outline-success"><i class="bi bi-cash-coin me-1"></i>{{ __('app.add_payment') }}</a>
    </div>

    <div class="card shadow-sm">
        <div class="card-body p-0">
            <div class="table-responsive">
                <table class="table table-striped mb-0">
                    <thead class="table-light">
                        <tr>
                            <th>{{ __('Name') }}</th>
                            <th>{{ __('Designation') }}</th>
                            <th>{{ __('Salary Type') }}</th>
                            <th>{{ __('Salary') }}</th>
                            <th>{{ __('Status') }}</th>
                            <th>{{ __('Actions') }}</th>
                        </tr>
                    </thead>
                    <tbody>
                        @forelse($employees as $employee)
                            <tr>
                                <td>{{ $employee->name }}</td>
                                <td>{{ $employee->designation }}</td>
                                <td>{{ ucfirst($employee->salary_type) }}</td>
                                <td>{{ number_format($employee->salary_amount, 2) }}</td>
                                <td>{{ ucfirst($employee->status) }}</td>
                                <td>
                                    <a href="{{ route('employees.edit', $employee) }}" class="btn btn-sm btn-outline-secondary me-1">{{ __('Edit') }}</a>
                                    <form action="{{ route('employees.destroy', $employee) }}" method="POST" class="d-inline-block">
                                        @csrf
                                        @method('DELETE')
                                        <button type="submit" class="btn btn-sm btn-danger" onclick="return confirm('Delete?')">{{ __('Delete') }}</button>
                                    </form>
                                </td>
                            </tr>
                        @empty
                            <tr>
                                <td colspan="6" class="text-center">{{ __('No employees found.') }}</td>
                            </tr>
                        @endforelse
                    </tbody>
                </table>
            </div>
        </div>
    </div>

    <div class="mt-3">{{ $employees->links() }}</div>
</x-app-layout>
