<div class="w-full overflow-y-auto">

    <div class="w-full flex justify-between items-start">

        <livewire:components.section-header title="Configuración" description="" />
    </div>

    <div class="flex w-full">
        <livewire:configurations.components.menu selected="environments-types" />
    </div>

    {{-- Search + Create--}}
    <div class="flex items-center justify-between w-full mt-6">
        <div class="w-1/3">
            <input type="text" wire:model.live.debounce.300ms="search" placeholder="Buscar"
                class="w-full rounded-lg border-2 border-gray-200 px-4 py-2">
        </div>
        <a href="{{ route('configurations.environments-types.create') }}" class="rounded bg-3ip px-4 py-2 text-white hover:bg-3ip-light flex items-center">
            <img src="{{ asset('vendor/blade-untitledui-icons/plus.svg') }}" alt="Logo"
                class="w-6 h-6 mr-2 svg-fill-white">
            Crear entorno
        </a>
    </div>

    {{-- Table --}}
    <div class="overflow-hidden bg-white w-full mt-4">
        <table class="w-full rounded-xl border-separate border">
            <thead class="text-xs text-gray-600">
                <tr class="">
                    <th class="border-b px-4 py-3"></th>
                    <th class="text-left border-b px-4 py-3">Nombre</th>
                    <th class="text-left border-b px-4 py-3">Shortname</th>
                    <th class="text-left border-b px-4 py-3">Descripción</th>
                    <th class="border-b px-4 py-3"></th>
                </tr>
            </thead>
            <tbody class="divide-y">
                @foreach ($types as $type)
                    <tr>
                        <td class="px-4 py-3 {{ !$loop->last ? 'border-b' : '' }}">
                            <img src="{{ $type->image_url ?? asset('images/placeholder.png') }}" alt="{{ $type->name }}" class="w-6 h-6">
                        </td>
                        <td class="px-4 py-3 {{ !$loop->last ? 'border-b' : '' }}">{{ $type->name }}</td>
                        <td class="px-4 py-3 {{ !$loop->last ? 'border-b' : '' }}">{{ $type->shortname }}</td>
                        <td class="px-4 py-3 {{ !$loop->last ? 'border-b' : '' }}">{{ $type->description }}</td>
                        <td class="flex items-center justify-end px-4 py-3 {{ !$loop->last ? 'border-b' : '' }}">
                            <a href="{{ route('configurations.environments-types.edit', $type->id) }}" class="group">
                                <img src="{{ asset('vendor/blade-untitledui-icons/settings.svg') }}" alt="Editar" class="w-6 h-6 group-hover:svg-fill-orange">
                            </a>
                            {{-- <a href="{{ route('configurations.environments.destroy', $type->id) }}" class="text-red-500 hover:text-red-700">Eliminar</a> --}}
                        </td>
                    </tr>
                @endforeach
                <tr>
                    <td colspan="5" class="px-4 py-3 text-center text-gray-500">
                        {{ $types->links('livewire.components.table-pagination') }}
                    </td>
                </tr>
            </tbody>
        </table>
    </div>
</div>
