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

<x-ui.layout.page
    :title="__('inventory.attributes.title')"
    :subtitle="__('inventory.attributes.subtitle')"
    page-icon="fe fe-sliders"
    :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('inventory.attributes.create')"
                        :label="__('inventory.attributes.actions.add')"
                        permission="inventory.catalog.manage"
                    />
                </x-slot:primary>
            </x-ui.operational.action-bar>
        </x-slot:toolbar>

        <x-ui.table.table :columns="[
            ['label' => __('inventory.attributes.columns.code')],
            ['label' => __('inventory.attributes.columns.name')],
            ['label' => __('inventory.attributes.columns.type')],
            ['label' => __('common.active')],
            ['label' => __('inventory.attributes.columns.options')],
        ]">
            @forelse ($attributes as $attribute)
                <x-ui.table.row>
                    <td>{{ $attribute->code }}</td>
                    <td>{{ $attribute->name }}</td>
                    <td>{{ $attribute->type ? __('inventory.attributes.types.'.$attribute->type->value) : '—' }}</td>
                    <td>
                        <x-ui.operational.status-badge
                            :label="$attribute->is_active ? __('common.active') : __('common.inactive')"
                            :variant="$attribute->is_active ? 'success' : 'neutral'"
                        />
                    </td>
                    <td>{{ $attribute->options_count }}</td>
                </x-ui.table.row>
            @empty
                <x-ui.table.row>
                    <td colspan="5" class="p-0">
                        <x-ui.operational.empty-state :title="__('operational_ui.index.empty_default')" />
                    </td>
                </x-ui.table.row>
            @endforelse
        </x-ui.table.table>

        <x-slot:pagination>
            {{ $attributes->links() }}
        </x-slot:pagination>
    </x-ui.operational.index-shell>
</x-ui.layout.page>
