@php
    $breadcrumbs = [
        ['label' => __('common.home'), 'url' => route('dashboard.index')],
        ['label' => __('common.hr')],
        ['label' => __('employment_statuses.title')],
    ];
@endphp

<x-ui.layout.page
    :title="__('employment_statuses.title')"
    :subtitle="__('employment_statuses.subtitle')"
    page-icon="fe fe-tag"
    :breadcrumbs="$breadcrumbs"
>
    <x-ui.operational.index-shell>
        <x-slot:toolbar>
            <x-ui.operational.action-bar>
                <x-slot:primary>
                    <x-ui.operational.create-button
                        :href="route('hr.employment-statuses.create')"
                        :label="__('employment_statuses.actions.add')"
                        permission="employment_statuses.create"
                    />
                </x-slot:primary>
            </x-ui.operational.action-bar>
        </x-slot:toolbar>

        <x-ui.table.table :columns="[
            ['label' => __('employment_statuses.fields.name')],
            ['label' => __('employment_statuses.fields.color')],
            ['label' => __('employment_statuses.fields.sort_order')],
            ['label' => __('employment_statuses.fields.status')],
            ['label' => __('common.actions'), 'align' => 'end', 'width' => '120px'],
        ]">
            @forelse ($statuses as $status)
                <x-ui.table.row>
                    <td><strong>{{ $status->name }}</strong></td>
                    <td>
                        <x-ui.operational.status-badge
                            :label="__('employment_statuses.colors.'.$status->color)"
                            :variant="$status->color"
                        />
                    </td>
                    <td>{{ $status->sort_order }}</td>
                    <td>
                        <x-ui.operational.status-badge
                            :label="$status->is_active ? __('employment_statuses.status.active') : __('employment_statuses.status.inactive')"
                            :variant="$status->is_active ? 'success' : 'neutral'"
                        />
                    </td>
                    <td class="text-end">
                        <x-ui.table.actions-trigger
                            :type="__('employment_statuses.singular')"
                            :id="$status->id"
                            :view-href="auth()->user()?->can('update', $status) ? route('hr.employment-statuses.edit', $status) : null"
                        />
                    </td>
                </x-ui.table.row>
            @empty
                <x-ui.table.row>
                    <td colspan="5" class="p-0">
                        <x-ui.operational.empty-state :title="__('employment_statuses.empty')" />
                    </td>
                </x-ui.table.row>
            @endforelse
        </x-ui.table.table>
    </x-ui.operational.index-shell>
</x-ui.layout.page>
