<x-daylight::tables.table>
    <x-slot:columns>
        <x-daylight::tables.sortable-column field="name">
            {{ __('daylight::general.name') }}
        </x-daylight::tables.sortable-column>

        <x-daylight::tables.sortable-column field="status">
            {{ __('daylight::general.status') }}
        </x-daylight::tables.sortable-column>

        <x-daylight::tables.sortable-column field="created_at">
            {{ __('daylight::general.created_at') }}
        </x-daylight::tables.sortable-column>
    </x-slot:columns>

    @foreach ($this->rows as $row)
        <x-daylight::tables.row wire:key="{{ $row->id }}" :$row>
            <x-daylight::tables.column class="flex items-center">
                <a href="{{ route('daylight.store.products.show', $row) }}" class="flex items-center">
                    @if($row->getFirstMedia('gallery'))
                        <img src="{{ $row->getFirstMedia('gallery')->getUrl('thumbnail') }}" alt="{{ $row->name }}" class="h-12 w-12 object-cover rounded-md">
                    @endif

                    <h3 class="ml-4">{{ $row->name }}</h3>
                </a>
            </x-daylight::tables.column>

            <x-daylight::tables.column>
                <span class="rounded px-2 py-1 border text-xs {{ $row->status->adminColor() }}">
                    {{ $row->status->label() }}
                </span>
            </x-daylight::tables.column>

            <x-daylight::tables.column>
                {{ $row->created_at->format('d-m-Y H:i') }}
            </x-daylight::tables.column>

            <x-slot:actions>
                <a href="{{ route('daylight.store.products.show', $row) }}"
                   class="py-0.5 pl-2 pr-1 inline-flex font-medium items-center gap-1 text-sm">
                    <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" class="w-5 h-5">
                        <path stroke-linecap="round" stroke-linejoin="round" d="M2.036 12.322a1.012 1.012 0 0 1 0-.639C3.423 7.51 7.36 4.5 12 4.5c4.638 0 8.573 3.007 9.963 7.178.07.207.07.431 0 .639C20.577 16.49 16.64 19.5 12 19.5c-4.638 0-8.573-3.007-9.963-7.178Z" />
                        <path stroke-linecap="round" stroke-linejoin="round" d="M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z" />
                    </svg>
                </a>

                <x-daylight::tables.row-actions
                    :edit-url="route('daylight.store.products.edit', $row)"
                    :can-duplicate="true"
                    :can-delete="true"
                    :row-id="$row->id"
                />
            </x-slot:actions>
        </x-daylight::tables.row>
    @endforeach
</x-daylight::tables.table>
