<x-ui.layout.page :title="__('assets.title')" :subtitle="__('assets.subtitle')" page-icon="fe fe-monitor">
    <x-slot:actions>@can('create', \App\Modules\HR\Assets\Models\Asset::class)
        <x-ui.buttons.primary :href="route('hr.assets.create')">{{ __('assets.actions.add') }}</x-ui.buttons.primary>
    @endcan</x-slot:actions>
    <x-ui.table.table :columns="[
        ['label' => __('assets.fields.asset_code')], ['label' => __('assets.fields.name')],
        ['label' => __('assets.fields.category')], ['label' => __('assets.fields.status')],
        ['label' => __('assets.fields.employee')], ['label' => __('common.actions'), 'align' => 'end'],
    ]">
        @forelse ($assets as $asset)
            <x-ui.table.row>
                <td><code>{{ $asset->asset_code }}</code></td><td>{{ $asset->name }}</td>
                <td>{{ $asset->category }}</td><td>{{ __('assets.statuses.'.$asset->status) }}</td>
                <td>{{ $asset->currentEmployee?->full_name ?? '—' }}</td>
                <td class="text-end"><x-ui.buttons.secondary size="sm" :href="route('hr.assets.show', $asset)">
                    {{ __('common.view') }}</x-ui.buttons.secondary></td>
            </x-ui.table.row>
        @empty
            <x-ui.table.row><td colspan="6">{{ __('assets.empty') }}</td></x-ui.table.row>
        @endforelse
    </x-ui.table.table>
    {{ $assets->links() }}
</x-ui.layout.page>
