@php
    use App\Modules\HR\Overtime\Models\OvertimeRequest;
    $breadcrumbs = [
        ['label' => __('common.home'), 'url' => route('dashboard.index')],
        ['label' => __('me.overtime_title')],
    ];
@endphp

<x-ui.layout.page
    :title="__('me.overtime_title')"
    :subtitle="__('me.overtime_subtitle')"
    page-icon="fe fe-watch"
    :breadcrumbs="$breadcrumbs"
>
    <x-slot:actions>
        @can('create', OvertimeRequest::class)
            <x-ui.buttons.primary :href="route('me.overtime.create')" icon="fe fe-plus">
                {{ __('me.overtime.new') }}
            </x-ui.buttons.primary>
        @endcan
    </x-slot:actions>

    <x-ui.table.table :columns="[
        ['label' => '#'],
        ['label' => __('overtime.fields.attendance_date')],
        ['label' => __('overtime.fields.overtime_minutes')],
        ['label' => __('overtime.fields.status')],
    ]">
        @forelse ($paginator as $req)
            <x-ui.table.row>
                <td><code>{{ $req->id }}</code></td>
                <td>{{ $req->attendance_date?->format('Y-m-d') }}</td>
                <td>{{ $req->overtime_minutes }}</td>
                <td><span class="badge bg-secondary">{{ __('overtime.status.'.$req->status) }}</span></td>
            </x-ui.table.row>
        @empty
            <x-ui.table.row>
                <td colspan="4" class="text-center text-muted py-4">{{ __('overtime.empty') }}</td>
            </x-ui.table.row>
        @endforelse
    </x-ui.table.table>

    @if ($paginator->hasPages())
        <div class="mt-3 d-flex justify-content-center">{{ $paginator->links() }}</div>
    @endif
</x-ui.layout.page>
