
<div class="w-full" style="font-size:14px; display:flex; flex-direction:column; gap:14px;">

    
    <?php if (isset($component)) { $__componentOriginal2544aeb3df80db4e8cf42f27632fe7f3 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal2544aeb3df80db4e8cf42f27632fe7f3 = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.cabecera','data' => ['rotulo' => 'Negocio','titulo' => 'Clientes','descripcion' => 'Quién nos compra, con sus datos de facturación, sus contactos y lo que tiene contratado. Entra en uno para ver sus licencias, sus entornos y sus contactos, o para darlo de baja.']] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('cabecera'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\Illuminate\View\AnonymousComponent::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes(['rotulo' => 'Negocio','titulo' => 'Clientes','descripcion' => 'Quién nos compra, con sus datos de facturación, sus contactos y lo que tiene contratado. Entra en uno para ver sus licencias, sus entornos y sus contactos, o para darlo de baja.']); ?>

         <?php $__env->slot('icono', null, []); ?> 
            <?php if (isset($component)) { $__componentOriginalb86967db162ccc0bceeb1ac50f169b8f = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginalb86967db162ccc0bceeb1ac50f169b8f = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.nav-icon','data' => ['name' => 'building-07','tint' => 'orange']] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('nav-icon'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\Illuminate\View\AnonymousComponent::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes(['name' => 'building-07','tint' => 'orange']); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginalb86967db162ccc0bceeb1ac50f169b8f)): ?>
<?php $attributes = $__attributesOriginalb86967db162ccc0bceeb1ac50f169b8f; ?>
<?php unset($__attributesOriginalb86967db162ccc0bceeb1ac50f169b8f); ?>
<?php endif; ?>
<?php if (isset($__componentOriginalb86967db162ccc0bceeb1ac50f169b8f)): ?>
<?php $component = $__componentOriginalb86967db162ccc0bceeb1ac50f169b8f; ?>
<?php unset($__componentOriginalb86967db162ccc0bceeb1ac50f169b8f); ?>
<?php endif; ?>
         <?php $__env->endSlot(); ?>

         <?php $__env->slot('acciones', null, []); ?> 
    <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('admin.clients.create')): ?>
                <a href="<?php echo e(route('clients.create')); ?>" wire:navigate
                   class="flex flex-none items-center gap-2 rounded-lg px-4 py-2.5 text-[13.5px] font-semibold text-white"
                   style="background:var(--orange-500);"
                   onmouseover="this.style.background='var(--orange-600)'"
                   onmouseout="this.style.background='var(--orange-500)'">
                    <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M5 12h14"/><path d="M12 5v14"/></svg>
                    Nuevo cliente
                </a>
            <?php endif; ?>
         <?php $__env->endSlot(); ?>
     <?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal2544aeb3df80db4e8cf42f27632fe7f3)): ?>
<?php $attributes = $__attributesOriginal2544aeb3df80db4e8cf42f27632fe7f3; ?>
<?php unset($__attributesOriginal2544aeb3df80db4e8cf42f27632fe7f3); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal2544aeb3df80db4e8cf42f27632fe7f3)): ?>
<?php $component = $__componentOriginal2544aeb3df80db4e8cf42f27632fe7f3; ?>
<?php unset($__componentOriginal2544aeb3df80db4e8cf42f27632fe7f3); ?>
<?php endif; ?>

    <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if(session('success')): ?>
        <div class="rounded-lg px-4 py-2.5 text-[13px]"
             style="background:var(--success-50); color:var(--success-500);">
            <?php echo e(session('success')); ?>

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

    <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if(session('warning')): ?>
        <div class="rounded-lg px-4 py-2.5 text-[13px]"
             style="background:var(--warning-50); color:var(--warning-500);">
            <?php echo e(session('warning')); ?>

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

    
    <div class="flex flex-wrap items-center gap-3 rounded-xl border p-3 px-4"
         style="background:var(--surface-card); border-color:var(--border-subtle);">

        <div class="flex min-w-[240px] flex-1 items-center gap-2 rounded-lg border px-3 py-1.5"
             style="border-color:var(--border-default); background:var(--surface-page);">
            <svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="var(--text-subtle)" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" class="flex-none"><circle cx="11" cy="11" r="8"/><path d="m21 21-4.3-4.3"/></svg>
            
            <input type="text" wire:model.live.debounce.300ms="search"
                   placeholder="Nombre, shortname, CIF, razón social o CRM"
                   class="min-w-0 flex-1 border-none bg-transparent p-0 text-[13px] focus:ring-0"
                   style="color:var(--text-body);">
            <div wire:loading wire:target="search" class="flex-none">
                <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="var(--text-subtle)" stroke-width="2" class="animate-spin"><path d="M21 12a9 9 0 1 1-6.22-8.56"/></svg>
            </div>
        </div>

        
        <div class="flex flex-none gap-0.5 rounded-lg border p-[3px]"
             style="background:var(--surface-page); border-color:var(--border-default);">
            <?php
                $pestanas = [
                    'alta' => 'De alta · ' . $resumen['alta'],
                    'baja' => 'De baja · ' . $resumen['baja'],
                    'todos' => 'Todos',
                ];
            ?>
            <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php $__currentLoopData = $pestanas; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $clave => $etiqueta): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                <button type="button" wire:click="$set('estado', '<?php echo e($clave); ?>')"
                        class="rounded-md px-3 py-[5px] text-[12.5px] font-semibold transition-colors"
                        style="<?php echo \Illuminate\Support\Arr::toCssStyles([
                            'background:var(--neutral-800); color:#fff' => $estado === $clave,
                            'background:transparent; color:var(--text-muted)' => $estado !== $clave,
                        ]) ?>">
                    <?php echo e($etiqueta); ?>

                </button>
            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
        </div>

        <span class="flex-none text-[12.5px]" style="color:var(--text-muted);">
            <strong class="font-bold" style="color:var(--text-strong);"><?php echo e($clients->total()); ?></strong>
            <?php echo e($clients->total() === 1 ? 'cliente' : 'clientes'); ?>

        </span>
    </div>

    
    <div class="overflow-hidden rounded-xl border"
         style="background:var(--surface-card); border-color:var(--border-subtle);">

        <div class="cli-grid hidden border-b px-5 py-2 text-[11px] font-semibold uppercase tracking-[0.06em] lg:grid"
             style="color:var(--text-muted); border-color:var(--divider);">
            <span>Cliente</span>
            <span>Licencias</span>
            <span>Entornos</span>
            <span>Desde</span>
            <span></span>
        </div>

        <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php $__empty_1 = true; $__currentLoopData = $clients; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $client): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
            <?php
                $estadoLic = $client->estadoDeLasLicencias();
                // Un cliente sin licencias y sin entornos: el alta a medio hacer. Se
                // pinta más apagado, y el de baja más todavía.
                $sinActividad = $client->tokens_count === 0 && $client->environments_count === 0;

                $colores = [
                    'activa' => ['var(--success-500)', 'var(--success-50)'],
                    'pronto' => ['var(--warning-500)', 'var(--warning-50)'],
                    'vencida' => ['var(--danger-500)', 'var(--danger-50)'],
                    'desactivada' => ['var(--neutral-600)', 'var(--surface-sunken)'],
                ];
            ?>

            <a href="<?php echo e(route('clients.show', $client)); ?>" wire:navigate
               class="cli-grid items-center border-b px-5 py-2.5 transition-colors hover:bg-[var(--surface-alt)]"
               style="border-color:var(--divider); opacity:<?php echo e(! $client->actived ? '0.65' : ($sinActividad ? '0.8' : '1')); ?>;">

                
                <div class="min-w-0">
                    <div class="flex min-w-0 items-center gap-2">
                        <span class="truncate text-[12.5px]"
                              style="color:var(--text-strong); font-weight:<?php echo e($sinActividad ? '500' : '600'); ?>;">
                            <?php echo e($client->name); ?>

                        </span>
                        <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if (! ($client->actived)): ?>
                            <span class="flex-none rounded px-[7px] py-px text-[10.5px] font-semibold"
                                  style="color:var(--danger-500); background:var(--danger-50);">
                                DE BAJA
                            </span>
                        <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                    </div>

                    <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if(! $client->actived): ?>
                        
                        <div class="mt-px truncate text-[11.5px]" style="color:var(--danger-500);">
                            <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($client->deactivated_at): ?>
                                desde <?php echo e($client->deactivated_at->format('d/m/Y')); ?>

                            <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                            <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($client->deactivation_reason): ?>
                                · «<?php echo e($client->deactivation_reason); ?>»
                            <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                            <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($client->deactivatedBy): ?>
                                · <?php echo e($client->deactivatedBy->name); ?>

                            <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                        </div>
                    <?php else: ?>
                        <div class="mt-px truncate text-[11.5px]" style="color:var(--text-muted);">
                            <?php echo e($client->shortname); ?>

                            <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($client->cif): ?>
                                · <?php echo e($client->cif); ?>

                            <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                            <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if (! ($client->cif)): ?>
                                
                                <span class="font-semibold" style="color:var(--warning-500);">· sin CIF</span>
                            <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                        </div>
                    <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                </div>

                
                <div class="min-w-0">
                    <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($estadoLic === 'nunca'): ?>
                        
                        <span class="rounded-full border border-dashed px-2.5 py-0.5 text-[11.5px]"
                              style="color:var(--text-subtle); border-color:var(--border-default);">
                            Sin licencias
                        </span>
                    <?php else: ?>
                        <span class="rounded-full px-2.5 py-0.5 text-[11.5px] font-semibold"
                              style="color:<?php echo e($colores[$estadoLic][0]); ?>; background:<?php echo e($colores[$estadoLic][1]); ?>;">
                            <?php echo e($client->etiquetaDeLasLicencias()); ?>

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

                
                <div class="min-w-0 text-[12.5px]">
                    <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($client->environments_count > 0): ?>
                        <span class="font-semibold" style="color:var(--text-strong);">
                            <?php echo e($client->environments_count); ?>

                        </span>
                        <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($client->sin_senal_count > 0): ?>
                            <span class="text-[11.5px] font-semibold" style="color:var(--danger-500);">
                                · <?php echo e($client->sin_senal_count); ?> sin señal
                            </span>
                        <?php elseif($client->sin_sincronizar_count > 0): ?>
                            
                            <span class="text-[11.5px] font-semibold" style="color:var(--warning-500);">
                                · <?php echo e($client->sin_sincronizar_count); ?> sin sincronizar
                            </span>
                        <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                    <?php else: ?>
                        <span style="color:var(--text-subtle);">—</span>
                    <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                </div>

                <span class="text-[12px]" style="color:var(--text-muted);">
                    <?php echo e($client->fecha_inicio_relacion?->format('m/Y') ?? '—'); ?>

                </span>

                <svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="var(--text-subtle)" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="hidden lg:block"><path d="m9 18 6-6-6-6"/></svg>
            </a>
        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
            <div class="px-6 py-8 text-center text-[13px]" style="color:var(--text-muted);">
                <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($search !== ''): ?>
                    Ningún cliente coincide con «<?php echo e($search); ?>».
                <?php elseif($estado === 'baja'): ?>
                    Ningún cliente de baja.
                <?php else: ?>
                    Ningún cliente todavía.
                <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
            </div>
        <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>

        
        <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($clients->hasPages()): ?>
            <div class="px-5 py-2.5"><?php echo e($clients->onEachSide(1)->links()); ?></div>
        <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
    </div>
</div><?php /**PATH /var/www/html/resources/views/livewire/clients/index.blade.php ENDPATH**/ ?>