<div>
     <?php $__env->slot('header', null, []); ?> 
        <h2 class="text-xl font-semibold leading-tight text-gray-800">
            Gestionar sitios del token: <?php echo e($licenseToken->token); ?>

        </h2>
     <?php $__env->endSlot(); ?>

    <div class="py-6">
        <div class="mx-auto max-w-6xl sm:px-6 lg:px-8">

            <!--[if BLOCK]><![endif]--><?php if(session()->has('success')): ?>
                <div class="mb-4 rounded bg-green-100 px-4 py-2 text-green-700">
                    <?php echo e(session('success')); ?>

                </div>
            <?php endif; ?><!--[if ENDBLOCK]><![endif]-->

            
            <div class="mb-6 rounded bg-blue-50 p-4">
                <p class="text-sm text-gray-700">
                    <strong>Token:</strong> <span class="font-mono"><?php echo e($licenseToken->token); ?></span>
                </p>
                <p class="text-sm text-gray-700">
                    <strong>Cliente:</strong> <?php echo e($licenseToken->client->name ?? '—'); ?>

                </p>
            </div>

            
            <div class="mb-4">
                <input
                    type="text"
                    wire:model.live.debounce.300ms="search"
                    placeholder="Buscar sitio por nombre o dominio..."
                    class="w-full rounded border border-gray-300 px-3 py-2 focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500"
                >
            </div>

            <form wire:submit="save" class="space-y-4">
                
                <div class="rounded bg-white shadow">
                    <div class="p-4 border-b">
                        <h3 class="text-lg font-semibold text-gray-800">
                            Seleccionar sitios para vincular
                        </h3>
                        <p class="text-sm text-gray-600 mt-1">
                            Selecciona los sitios que deseas vincular a este token de licencia.
                        </p>
                    </div>

                    <div class="max-h-96 overflow-y-auto">
                        <!--[if BLOCK]><![endif]--><?php $__empty_1 = true; $__currentLoopData = $sites; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $site): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                            <label class="flex items-center p-4 border-b hover:bg-gray-50 cursor-pointer <?php echo e($site->licenseToken && $site->licenseToken->id !== $licenseToken->id ? 'bg-orange-50' : ''); ?>">
                                <input
                                    type="checkbox"
                                    wire:model="selectedSites"
                                    value="<?php echo e($site->id); ?>"
                                    class="rounded border-gray-300 text-blue-600 focus:ring-blue-500"
                                    <?php echo e($site->licenseToken && $site->licenseToken->id !== $licenseToken->id ? 'disabled' : ''); ?>

                                >
                                <div class="ml-3 flex-1">
                                    <div class="flex items-center justify-between">
                                        <div>
                                            <p class="font-medium text-gray-900"><?php echo e($site->name); ?></p>
                                            <p class="text-sm text-gray-500"><?php echo e($site->domain); ?></p>
                                            <!--[if BLOCK]><![endif]--><?php if($site->client): ?>
                                                <p class="text-xs text-gray-400 mt-1">Cliente: <?php echo e($site->client->name); ?></p>
                                            <?php endif; ?><!--[if ENDBLOCK]><![endif]-->
                                        </div>
                                        <div class="text-right text-sm">
                                            <!--[if BLOCK]><![endif]--><?php if($site->licenseToken): ?>
                                                <!--[if BLOCK]><![endif]--><?php if($site->licenseToken->id === $licenseToken->id): ?>
                                                    <span class="inline-flex items-center px-2 py-1 rounded-full text-xs font-medium bg-green-100 text-green-800">
                                                        Vinculado
                                                    </span>
                                                <?php else: ?>
                                                    <span class="inline-flex items-center px-2 py-1 rounded-full text-xs font-medium bg-orange-100 text-orange-800">
                                                        Otro token
                                                    </span>
                                                <?php endif; ?><!--[if ENDBLOCK]><![endif]-->
                                            <?php else: ?>
                                                <span class="inline-flex items-center px-2 py-1 rounded-full text-xs font-medium bg-gray-100 text-gray-800">
                                                    Sin token
                                                </span>
                                            <?php endif; ?><!--[if ENDBLOCK]><![endif]-->
                                        </div>
                                    </div>
                                </div>
                            </label>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                            <div class="p-8 text-center text-gray-500">
                                <p>No se encontraron sitios.</p>
                            </div>
                        <?php endif; ?><!--[if ENDBLOCK]><![endif]-->
                    </div>
                </div>

                
                <div class="flex justify-between">
                    <a href="<?php echo e(route('license_tokens.show', $licenseToken)); ?>"
                       class="rounded border border-gray-300 px-4 py-2 text-gray-700 hover:bg-gray-50">
                        Cancelar
                    </a>

                    <button type="submit"
                            wire:loading.attr="disabled"
                            class="rounded bg-blue-600 px-4 py-2 text-white hover:bg-blue-700 disabled:opacity-50">
                        <span wire:loading.remove>Guardar vinculaciones</span>
                        <span wire:loading>Guardando...</span>
                    </button>
                </div>
            </form>

        </div>
    </div>
</div><?php /**PATH /var/www/html/resources/views/livewire/license-tokens/manage-sites.blade.php ENDPATH**/ ?>