<div>
    
    <div class="w-full flex items-center justify-between">
        <a href="<?php echo e(route('license_tokens.index')); ?>"
            class="flex rounded-lg bg-white border border-gray-200 px-4 py-2 text-gray-700 hover:bg-gray-100 font-bold">
            <img src="<?php echo e(asset('vendor/blade-untitledui-icons/arrow-narrow-left.svg')); ?>" alt="Volver" class="w-6 h-6">
            <span class="ml-2">Volver</span>
        </a>
        <a href="<?php echo e(route('license_tokens.edit', $licenseToken)); ?>"
            class="flex rounded-lg bg-3ip border border-gray-200 px-4 py-2 text-white hover:bg-3ip-light font-bold ml-auto">
            <img src="<?php echo e(asset('vendor/blade-untitledui-icons/pencil.svg')); ?>" alt="Editar" class="w-6 h-6 svg-fill-white">
            <span class="ml-2">Editar token</span>
        </a>
    </div>

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

        </div>
    <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
    <?php if(session()->has('error')): ?>
        <div class="my-4 rounded bg-red-100 px-4 py-2 text-red-700">
            <?php echo e(session('error')); ?>

        </div>
    <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>

    
    <div
        class="w-full flex flex-wrap items-center justify-between mt-8 rounded-lg bg-white border border-gray-200 px-8 py-4">
        <div class="w-full flex items-center justify-between">

            <div class="flex items-center justify-start" x-data="{
                token: '<?php echo e($licenseToken->token); ?>',
                isVisible: false,
                copied: false,
                get displayedToken() {
                    if (this.isVisible) {
                        return this.token;
                    }
                    return this.token.replace(/[^-_]/g, '*');
                },
                toggleVisibility() {
                    this.isVisible = !this.isVisible;
                },
                async copyToClipboard() {
                    try {
                        await navigator.clipboard.writeText(this.token);
                        this.copied = true;
                        setTimeout(() => {
                            this.copied = false;
                        }, 2000);
                    } catch (err) {
                        console.error('Error al copiar:', err);
                    }
                }
            }">
                <div class="flex border rounded-lg p-2 border-gray-200 font-mono">
                    <span x-text="displayedToken"></span>
                </div>
                <button @click="toggleVisibility()" class="flex group ml-4">
                    <img x-show="!isVisible" src="<?php echo e(asset('vendor/blade-untitledui-icons/eye.svg')); ?>" alt="Ver"
                        class="w-5 h-5 svg-fill-gray group-hover:svg-fill-orange">
                    <img x-show="isVisible" src="<?php echo e(asset('vendor/blade-untitledui-icons/eye-off.svg')); ?>"
                        alt="Ocultar" class="w-5 h-5 svg-fill-gray group-hover:svg-fill-orange">
                </button>
                <button @click="copyToClipboard()" class="flex group ml-4">
                    <img x-show="!copied" src="<?php echo e(asset('vendor/blade-untitledui-icons/copy.svg')); ?>" alt="Copiar"
                        class="w-5 h-5 svg-fill-gray group-hover:svg-fill-orange">
                    <img x-show="copied" src="<?php echo e(asset('vendor/blade-untitledui-icons/check-circle.svg')); ?>"
                        alt="Copiado" class="w-5 h-5 svg-fill-green">
                </button>
            </div>
            <div class="flex items-center justify-end gap-4">
                <div class="flex items-center justify-end w-full">
                    <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($licenseToken->active): ?>
                        <span
                            class="flex items-center gap-1 text-green-600 font-semibold bg-green-100 border border-green-200 rounded px-2 py-1 w-full">
                            <img src="<?php echo e(asset('vendor/blade-untitledui-icons/check-circle.svg')); ?>" alt="Activo"
                                class="w-4 h-4 svg-fill-green">
                            <span>Licencia activa</span>
                        </span>
                    <?php else: ?>
                        <span
                            class="flex items-center gap-1 text-gray-400 font-semibold bg-gray-100 border border-gray-200 rounded px-2 py-1">
                            <img src="<?php echo e(asset('vendor/blade-untitledui-icons/hourglass.svg')); ?>" alt="Desactivada"
                                class="w-4 h-4 svg-fill-gray">
                            <span>Licencia inactiva</span>
                        </span>
                    <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                </div>
                <div class="flex items-center justify-end">
                    <label class="relative inline-flex items-center cursor-pointer">
                        <input type="checkbox" wire:click="toggleActive" wire:loading.attr="disabled"
                            <?php if($licenseToken->active): ?> checked <?php endif; ?> class="sr-only peer">
                        <div
                            class="w-11 h-6 bg-gray-200 peer-focus:outline-none peer-focus:ring-4 peer-focus:ring-orange-300 rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-green-500">
                        </div>
                    </label>
                </div>
            </div>
        </div>

        <div class="w-full flex items-center gap-4 mt-4">
            <div class="flex items-center flex-wrap">
                <div class="text-gray-500 w-full">Cliente:</div>
                <div class="w-full font-bold"><?php echo e($licenseToken->client->name); ?></div>
            </div>
            <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($licenseToken->name): ?>
            <div class="flex items-center flex-wrap">
                <div class="text-gray-500 w-full">Nombre:</div>
                <div class="w-full font-bold"><?php echo e($licenseToken->name); ?></div>
            </div>
            <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
            <div class="flex items-center flex-wrap">
                <div class="text-gray-500 w-full">Fecha de la licencia:</div>
                <div class="w-full font-bold"><?php echo e($licenseToken->start_at?->format('d/m/Y') ?? '—'); ?> -
                    <?php echo e($licenseToken->end_at?->format('d/m/Y') ?? '—'); ?></div>
            </div>
            <div class="flex items-center flex-wrap">
                <div class="text-gray-500 w-full">Creado:</div>
                <div class="w-full font-bold"><?php echo e($licenseToken->created_at?->format('d/m/Y') ?? '—'); ?></div>
            </div>
            <div class="flex items-center flex-wrap">
                <div class="text-gray-500 w-full">Autor:</div>
                <div class="w-full font-bold"><?php echo e($licenseToken->creator->name ?? '—'); ?></div>
            </div>
        </div>
    </div>

    <div class="w-full flex items-start gap-4 mt-4">
        
        <div class="w-full flex flex-wrap items-center justify-between rounded-lg bg-white border border-gray-200 px-8 py-4"
            x-data="{
                mode: 'view',
                selectedProducts: <?php if ((object) ('selectedProducts') instanceof \Livewire\WireDirective) : ?>window.Livewire.find('<?php echo e($__livewire->getId()); ?>').entangle('<?php echo e('selectedProducts'->value()); ?>')<?php echo e('selectedProducts'->hasModifier('live') ? '.live' : ''); ?><?php else : ?>window.Livewire.find('<?php echo e($__livewire->getId()); ?>').entangle('<?php echo e('selectedProducts'); ?>')<?php endif; ?>,
                toggleMode() {
                    if (this.mode === 'view') {
                        // Al entrar en modo edición, sincronizar con los productos actuales
                        this.selectedProducts = window.Livewire.find('<?php echo e($_instance->getId()); ?>').selectedProducts;
                        this.mode = 'edit';
                    } else {
                        // Al salir sin guardar, restaurar los valores originales desde Livewire
                        this.selectedProducts = window.Livewire.find('<?php echo e($_instance->getId()); ?>').selectedProducts;
                        this.mode = 'view';
                    }
                },
                toggleProduct(productId) {
                    const index = this.selectedProducts.indexOf(productId);
                    if (index > -1) {
                        this.selectedProducts.splice(index, 1);
                    } else {
                        this.selectedProducts.push(productId);
                    }
                },
                isProductSelected(productId) {
                    return this.selectedProducts.includes(productId);
                },
                async saveChanges() {
                    await window.Livewire.find('<?php echo e($_instance->getId()); ?>').saveProducts(this.selectedProducts);
                    // Después de guardar, Livewire actualizará el componente y Alpine se reinicializará
                    // El modo volverá a 'view' automáticamente al reinicializarse
                    this.mode = 'view';
                }
            }">
            <div class="w-full flex items-center justify-between">
                <div class="w-full font-bold text-lg">Productos activos:</div>
                <div class="w-full flex items-center justify-end">
                    <button @click="toggleMode()" x-show="mode === 'view'"
                        class="flex items-center font-bold text-blue-600 hover:text-blue-800 text-lg">
                        Gestionar
                    </button>
                    <button @click="saveChanges()" x-show="mode === 'edit'"
                        class="flex items-center font-bold bg-3ip text-white rounded-lg px-4 py-2">
                        Guardar cambios
                    </button>
                </div>
            </div>
            <div class="w-full flex flex-wrap items-center justify-between mt-4" x-show="mode === 'edit'" x-cloak>
                <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php $__currentLoopData = $allProducts; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $product): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                    <div class="w-full flex items-center justify-between py-2">
                        <div class="flex items-center justify-start">
                            <div class="flex items-center justify-start mr-2 border border-gray-200 rounded-lg p-1">
                                <img src="<?php echo e($product->image_url ?? asset('images/placeholder.png')); ?>" alt="<?php echo e($product->name); ?>"
                                    class="w-10 h-10 rounded-full">
                            </div>
                            <div class="font-bold"><?php echo e($product->name); ?></div>
                        </div>
                        <div class="flex items-center justify-end">
                            <label class="relative inline-flex items-center cursor-pointer">
                                <input type="checkbox" :checked="isProductSelected(<?php echo e($product->id); ?>)"
                                    @change="toggleProduct(<?php echo e($product->id); ?>)" class="sr-only peer">
                                <div
                                    class="w-11 h-6 bg-gray-200 peer-focus:outline-none peer-focus:ring-4 peer-focus:ring-orange-300 rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-green-500">
                                </div>
                            </label>
                        </div>
                    </div>
                    <hr class="w-full border-gray-200 my-2">
                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
            </div>
            <div class="w-full flex items-center flex-wrap justify-between mt-4" x-show="mode === 'view'" x-cloak>
                <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php $__currentLoopData = $licenseToken->products; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $product): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                    <div class="w-full flex items-center justify-start py-2">
                        <div class="flex items-center justify-start mr-2 border border-gray-200 rounded-lg p-1">
                            <img src="<?php echo e($product->image_url ?? asset('images/placeholder.png')); ?>" alt="<?php echo e($product->name); ?>"
                                class="w-10 h-10 rounded-full">
                        </div>
                        <div class="w-full font-bold"><?php echo e($product->name); ?></div>
                    </div>
                    <hr class="w-full border-gray-200 my-2">
                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
            </div>
        </div>
        
        <div class="w-full flex flex-wrap items-center justify-between rounded-lg bg-white border border-gray-200 px-8 py-4"
            wire:key="environments-<?php echo e($licenseToken->environments->pluck('id')->sort()->implode('-')); ?>"
            x-data="{
                mode: 'view',
                viewMode: 'existing', // 'existing' o 'new'
                selectedEnvironments: <?php if ((object) ('selectedEnvironments') instanceof \Livewire\WireDirective) : ?>window.Livewire.find('<?php echo e($__livewire->getId()); ?>').entangle('<?php echo e('selectedEnvironments'->value()); ?>')<?php echo e('selectedEnvironments'->hasModifier('live') ? '.live' : ''); ?><?php else : ?>window.Livewire.find('<?php echo e($__livewire->getId()); ?>').entangle('<?php echo e('selectedEnvironments'); ?>')<?php endif; ?>,
                searchQuery: '',
                toggleMode() {
                    if (this.mode === 'view') {
                        // Al entrar en modo edición, sincronizar con los entornos actuales
                        this.selectedEnvironments = window.Livewire.find('<?php echo e($_instance->getId()); ?>').selectedEnvironments;
                        this.mode = 'edit';
                        this.viewMode = 'existing';
                    } else {
                        // Al salir sin guardar, restaurar los valores originales desde Livewire
                        this.selectedEnvironments = window.Livewire.find('<?php echo e($_instance->getId()); ?>').selectedEnvironments;
                        this.mode = 'view';
                    }
                },
                toggleViewMode(newMode) {
                    this.viewMode = newMode;
                },
                toggleEnvironment(environmentId) {
                    const index = this.selectedEnvironments.indexOf(environmentId);
                    if (index > -1) {
                        this.selectedEnvironments.splice(index, 1);
                    } else {
                        this.selectedEnvironments.push(environmentId);
                    }
                },
                isEnvironmentSelected(environmentId) {
                    return this.selectedEnvironments.includes(environmentId);
                },
                async saveChanges() {
                    await window.Livewire.find('<?php echo e($_instance->getId()); ?>').saveEnvironments(this.selectedEnvironments);
                    // Después de guardar, Livewire actualizará el componente
                    // El wire:key forzará la reinicialización de Alpine con los nuevos datos
                    this.mode = 'view';
                    // Esperar un momento para que Livewire actualice el DOM
                    await new Promise(resolve => setTimeout(resolve, 100));
                },
                filterEnvironments(environment) {
                    if (!this.searchQuery) return true;
                    const query = this.searchQuery.toLowerCase();
                    return environment.name.toLowerCase().includes(query) ||
                           environment.domain.toLowerCase().includes(query);
                }
            }">
            <div class="w-full flex items-center justify-between">
                <div class="w-full font-bold text-lg">Entornos vinculados:</div>
                <div class="w-full flex items-center justify-end">
                    <button @click="toggleMode()" x-show="mode === 'view'"
                        class="flex items-center font-bold text-blue-600 hover:text-blue-800 text-lg">
                        Gestionar
                    </button>
                    <button @click="saveChanges()" x-show="mode === 'edit'"
                        class="flex items-center font-bold bg-3ip text-white rounded-lg px-4 py-2">
                        Guardar cambios
                    </button>
                </div>
            </div>

            
            <div x-show="mode === 'edit'" x-cloak class="w-full mt-4">
                
                <div class="w-full flex items-center gap-2 mb-4">
                    <button @click="toggleViewMode('existing')"
                        class="w-full justify-center"
                        :class="viewMode === 'existing'
                            ? 'bg-black text-white font-bold px-4 py-2 rounded-lg flex items-center'
                            : 'bg-white text-gray-700 font-bold border border-gray-200 px-4 py-2 rounded-lg flex items-center hover:bg-gray-50'">
                        <img src="<?php echo e(asset('vendor/blade-untitledui-icons/server-04.svg')); ?>" alt="Entorno existente"
                            class="w-4 h-4 mr-2" :class="viewMode === 'existing' ? 'svg-fill-white' : ''">
                        <span>Entorno existente</span>
                    </button>
                    <button @click="toggleViewMode('new')"
                        class="w-full justify-center"
                        :class="viewMode === 'new'
                            ? 'bg-black text-white font-bold px-4 py-2 rounded-lg flex items-center'
                            : 'bg-white text-gray-700 font-bold border border-gray-200 px-4 py-2 rounded-lg flex items-center hover:bg-gray-50'">
                        <span class="mr-2">
                            <img src="<?php echo e(asset('vendor/blade-untitledui-icons/plus.svg')); ?>" alt="Nuevo entorno"
                                class="w-4 h-4" :class="viewMode === 'new' ? 'svg-fill-white' : ''">
                        </span>
                        <span>Nuevo entorno</span>
                    </button>
                </div>

                
                <div x-show="viewMode === 'existing'" x-cloak class="w-full">
                    <div class="w-full mb-4">
                        <h3 class="font-bold text-lg mb-2">Listado de entornos</h3>
                        <div class="relative">
                            <input type="text"
                                x-model="searchQuery"
                                placeholder="Buscar entorno por nombre o dominio"
                                class="w-full rounded-lg border border-gray-200 px-4 py-2 pl-10 focus:outline-none focus:ring-2 focus:ring-orange-300">
                            <img src="<?php echo e(asset('vendor/blade-untitledui-icons/search-lg.svg')); ?>" alt="Buscar"
                                class="absolute left-3 top-1/2 transform -translate-y-1/2 w-5 h-5 text-gray-400">
                        </div>
                    </div>

                    <div class="w-full max-h-96 overflow-y-auto">
                        <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php $__currentLoopData = $allEnvironments; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $environment): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                            <div x-show="filterEnvironments(<?php echo \Illuminate\Support\Js::from(['name' => $environment->name, 'domain' => $environment->domain])->toHtml() ?>)"
                                class="w-full flex items-center justify-between py-3 px-2 rounded-lg transition-colors <?php if($environment->is_associated_to_other): ?> bg-gray-100 <?php else: ?> hover:bg-gray-50 <?php endif; ?>">
                                <div class="flex items-center justify-start flex-1">
                                    <input type="checkbox"
                                        :checked="isEnvironmentSelected(<?php echo e($environment->id); ?>)"
                                        @change="toggleEnvironment(<?php echo e($environment->id); ?>)"
                                        <?php if($environment->is_associated_to_other): ?> disabled <?php endif; ?>
                                        class="w-4 h-4 text-orange-600 border-gray-300 rounded focus:ring-orange-500 mr-3 <?php if($environment->is_associated_to_other): ?> opacity-50 cursor-not-allowed <?php endif; ?> <?php if(!$environment->is_associated_to_other): ?> cursor-pointer <?php endif; ?>">
                                    <div class="flex items-center justify-start mr-3">
                                        <img src="<?php echo e($environment->type->image_url ?? asset('images/placeholder.png')); ?>"
                                            alt="<?php echo e($environment->type->name ?? 'Environment'); ?>" class="w-10 h-10 rounded-full">
                                    </div>
                                    <div class="flex flex-col">
                                        <div class="font-bold"><?php echo e($environment->name); ?></div>
                                        <div class="text-sm text-gray-500"><?php echo e($environment->domain); ?></div>
                                    </div>
                                </div>
                                <div class="flex items-center justify-end">
                                    <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($environment->license_token_id && $environment->license_token_id !== $licenseToken->id): ?>
                                        <span class="text-xs text-gray-500 bg-gray-200 px-2 py-1 rounded">Asociado</span>
                                    <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                                </div>
                            </div>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                    </div>
                </div>

                
                <div x-show="viewMode === 'new'" x-cloak class="w-full">
                    <div class="w-full mb-4">
                        <h3 class="font-bold text-lg mb-4">Crear nuevo entorno</h3>
                    </div>

                    <form wire:submit.prevent="createNewEnvironment"
                        @environment-created.window="viewMode = 'existing'"
                        class="w-full space-y-4">
                        
                        <div>
                            <label for="newEnvironmentName" class="block text-sm font-medium text-gray-700 mb-1">Nombre</label>
                            <input type="text"
                                id="newEnvironmentName"
                                wire:model="newEnvironmentName"
                                class="w-full rounded-lg border border-gray-200 px-4 py-2 focus:outline-none focus:ring-2 focus:ring-orange-300 <?php $__errorArgs = ['newSiteName'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> border-red-500 <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>"
                                placeholder="Ej: Moodle Promocional">
                            <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php $__errorArgs = ['newEnvironmentName'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                                <p class="mt-1 text-sm text-red-600"><?php echo e($message); ?></p>
                            <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                        </div>

                        
                        <div>
                            <label for="newEnvironmentDomain" class="block text-sm font-medium text-gray-700 mb-1">Dominio / URL</label>
                            <input type="text"
                                id="newEnvironmentDomain"
                                wire:model="newEnvironmentDomain"
                                class="w-full rounded-lg border border-gray-200 px-4 py-2 focus:outline-none focus:ring-2 focus:ring-orange-300 <?php $__errorArgs = ['newSiteDomain'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> border-red-500 <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>"
                                placeholder="Ej: https://ejemplo.com">
                            <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php $__errorArgs = ['newEnvironmentDomain'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                                <p class="mt-1 text-sm text-red-600"><?php echo e($message); ?></p>
                            <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                        </div>

                        
                        <div>
                            <label for="newEnvironmentDescription" class="block text-sm font-medium text-gray-700 mb-1">Descripción</label>
                            <textarea id="newEnvironmentDescription"
                                wire:model="newEnvironmentDescription"
                                rows="3"
                                class="w-full rounded-lg border border-gray-200 px-4 py-2 focus:outline-none focus:ring-2 focus:ring-orange-300 <?php $__errorArgs = ['newSiteDescription'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> border-red-500 <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>"
                                placeholder="Descripción del entorno"></textarea>
                            <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php $__errorArgs = ['newEnvironmentDescription'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                                <p class="mt-1 text-sm text-red-600"><?php echo e($message); ?></p>
                            <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                        </div>

                        
                        <div>
                            <label for="newEnvironmentTypeId" class="block text-sm font-medium text-gray-700 mb-1">Tipo de entorno</label>
                            <select id="newEnvironmentTypeId"
                                wire:model="newEnvironmentTypeId"
                                class="w-full rounded-lg border border-gray-200 px-4 py-2 focus:outline-none focus:ring-2 focus:ring-orange-300 <?php $__errorArgs = ['newSiteTypeId'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> border-red-500 <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>">
                                <option value="">Seleccionar tipo</option>
                                <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php $__currentLoopData = $environmentTypes; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $type): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                    <option value="<?php echo e($type->id); ?>"><?php echo e($type->name); ?></option>
                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                            </select>
                            <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php $__errorArgs = ['newEnvironmentTypeId'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                                <p class="mt-1 text-sm text-red-600"><?php echo e($message); ?></p>
                            <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                        </div>

                        
                        <div>
                            <label for="newEnvironmentVersion" class="block text-sm font-medium text-gray-700 mb-1">Versión</label>
                            <select id="newEnvironmentVersion"
                                wire:model="newEnvironmentVersion"
                                class="w-full rounded-lg border border-gray-200 px-4 py-2 focus:outline-none focus:ring-2 focus:ring-orange-300 <?php $__errorArgs = ['newSiteVersion'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> border-red-500 <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>">
                                <option value="">Seleccionar versión</option>
                                <option value="Moodle 4.1">Moodle 4.1</option>
                                <option value="Moodle 4.2">Moodle 4.2</option>
                                <option value="Moodle 4.3">Moodle 4.3</option>
                                <option value="Moodle 5.0">Moodle 5.0</option>
                                <option value="Moodle 5.1">Moodle 5.1</option>
                                <option value="Workplace 4.1">Workplace 4.1</option>
                                <option value="Workplace 4.2">Workplace 4.2</option>
                                <option value="Wordpress 6.9">Wordpress 6.9</option>
                            </select>
                            <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php $__errorArgs = ['newEnvironmentVersion'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                                <p class="mt-1 text-sm text-red-600"><?php echo e($message); ?></p>
                            <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                        </div>

                        
                        <div>
                            <label for="newEnvironmentEnv" class="block text-sm font-medium text-gray-700 mb-1">Desarrollo</label>
                            <select id="newEnvironmentEnv"
                                wire:model="newEnvironmentEnv"
                                class="w-full rounded-lg border border-gray-200 px-4 py-2 focus:outline-none focus:ring-2 focus:ring-orange-300 <?php $__errorArgs = ['newEnvironmentEnv'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> border-red-500 <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>">
                                <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php $__currentLoopData = $environmentEnvironments; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key => $label): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                    <option value="<?php echo e($key); ?>"><?php echo e($label); ?></option>
                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                            </select>
                            <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php $__errorArgs = ['newEnvironmentEnv'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                                <p class="mt-1 text-sm text-red-600"><?php echo e($message); ?></p>
                            <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                        </div>

                        
                        <div>
                            <label for="newEnvironmentHosting" class="block text-sm font-medium text-gray-700 mb-1">Alojamiento</label>
                            <select id="newEnvironmentHosting"
                                wire:model="newEnvironmentHosting"
                                class="w-full rounded-lg border border-gray-200 px-4 py-2 focus:outline-none focus:ring-2 focus:ring-orange-300 <?php $__errorArgs = ['newEnvironmentHosting'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> border-red-500 <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>">
                                <option value="">Seleccionar alojamiento</option>
                                <option value="1">Servidor interno</option>
                                <option value="2">Servidor externo</option>
                                <option value="3">Cloud</option>
                            </select>
                            <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php $__errorArgs = ['newEnvironmentHosting'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                                <p class="mt-1 text-sm text-red-600"><?php echo e($message); ?></p>
                            <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                        </div>

                        
                        <div class="flex items-center justify-end gap-3 pt-4">
                            <button type="button"
                                @click="viewMode = 'existing'"
                                class="px-4 py-2 rounded-lg border border-gray-200 text-gray-700 hover:bg-gray-50 font-bold">
                                Cancelar
                            </button>
                            <button type="submit"
                                wire:loading.attr="disabled"
                                class="px-4 py-2 rounded-lg bg-3ip text-white hover:bg-orange-600 font-bold disabled:opacity-50">
                                <span wire:loading.remove>Crear entorno</span>
                                <span wire:loading>Creando...</span>
                            </button>
                        </div>
                    </form>
                </div>
            </div>

            
            <div class="w-full flex items-center flex-wrap justify-between mt-4" x-show="mode === 'view'" x-cloak>
                <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php $__currentLoopData = $licenseToken->environments; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $environment): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                    <div class="w-full flex items-center flex-col justify-start py-2">
                        <div class="flex items-center justify-start w-full">
                            <div class="flex items-center justify-start mr-2 border border-gray-200 rounded-lg p-1">
                                <img src="<?php echo e($environment->type->image_url ?? asset('images/placeholder.png')); ?>"
                                    alt="<?php echo e($environment->type->name ?? 'Environment'); ?>" class="w-10 h-10 rounded-full">
                            </div>
                            <div class="flex flex-col">
                                <div class="font-bold"><?php echo e($environment->name); ?></div>
                            </div>
                        </div>
                        <div class="text-sm text-gray-500 flex items-center justify-start w-full mt-2">
                            <a href="<?php echo e($environment->domain); ?>" target="_blank" class="text-blue-600 hover:text-blue-800 flex items-center justify-start">
                                <img src="<?php echo e(asset('vendor/blade-untitledui-icons/globe.svg')); ?>" alt="Abrir entorno"
                                    class="w-4 h-4">
                                <span class="ml-2"><?php echo e($environment->domain); ?></span>
                            </a>
                        </div>
                    </div>
                    <hr class="w-full border-gray-200 my-2">
                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
            </div>
        </div>
    </div>

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