<?php if (isset($component)) { $__componentOriginale0f1cdd055772eb1d4a99981c240763e = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginale0f1cdd055772eb1d4a99981c240763e = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.admin-layout','data' => ['title' => 'Onboarding — OPCON']] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('admin-layout'); ?>
<?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(['title' => 'Onboarding — OPCON']); ?>

    
    <div style="display:flex;align-items:flex-start;justify-content:space-between;gap:1rem;flex-wrap:wrap;margin-bottom:1.5rem;">
        <div>
            <h1 style="font-size:1.375rem;font-weight:700;color:#1e3a5f;margin:0;">Onboarding de Clientes</h1>
            <p style="font-size:0.875rem;color:#64748b;margin:0.25rem 0 0;">Checklists de integração por contrato</p>
        </div>
        <button onclick="document.getElementById('modal-novo').style.display='block'"
                style="display:flex;align-items:center;gap:0.5rem;padding:0.5625rem 1.125rem;border-radius:9px;background:#25b87e;color:#fff;font-family:inherit;font-size:0.875rem;font-weight:600;border:none;cursor:pointer;">
            + Novo item
        </button>
    </div>

    
    <div style="display:grid;grid-template-columns:repeat(3,1fr);gap:1rem;margin-bottom:1.5rem;">
        <?php $__currentLoopData = [
            ['Total de itens', $stats['total'],    '#2563eb', 'rgba(37,99,235,0.1)'],
            ['Concluídos',     $stats['concluido'], '#25b87e', 'rgba(37,184,126,0.1)'],
            ['Pendentes',      $stats['pendente'],  '#f59e0b', 'rgba(245,158,11,0.1)'],
        ]; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as [$lbl, $val, $cor, $bg]): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
        <div style="background:#fff;border-radius:12px;border:1px solid #e2e8f0;padding:1rem 1.25rem;display:flex;align-items:center;gap:0.875rem;">
            <div style="width:40px;height:40px;border-radius:10px;background:<?php echo e($bg); ?>;display:flex;align-items:center;justify-content:center;flex-shrink:0;">
                <span style="font-size:1rem;font-weight:800;color:<?php echo e($cor); ?>;"><?php echo e($val); ?></span>
            </div>
            <p style="font-size:0.875rem;font-weight:600;color:#1e3a5f;margin:0;"><?php echo e($lbl); ?></p>
        </div>
        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
    </div>

    
    <form method="GET" style="display:flex;gap:0.75rem;align-items:center;margin-bottom:1.25rem;flex-wrap:wrap;">
        <select name="contrato_id" onchange="this.form.submit()"
                style="padding:0.4375rem 0.75rem;border-radius:8px;border:1px solid #e2e8f0;font-family:inherit;font-size:0.875rem;color:#1e3a5f;background:#fff;">
            <option value="">Todos os contratos</option>
            <?php $__currentLoopData = $contratos; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $c): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
            <option value="<?php echo e($c->id); ?>" <?php echo e($contratoId == $c->id ? 'selected' : ''); ?>>
                <?php echo e($c->razao_social); ?>

            </option>
            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
        </select>
        <?php if($contratoId): ?>
        <a href="<?php echo e(route('admin.onboarding')); ?>"
           style="font-size:0.875rem;color:#64748b;text-decoration:none;">× Limpar</a>
        <?php endif; ?>
    </form>

    
    <?php $__empty_1 = true; $__currentLoopData = $items; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $contratoId => $grupoItems): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
    <?php $c = $grupoItems->first()->contrato; ?>
    <div style="background:#fff;border-radius:12px;border:1px solid #e2e8f0;margin-bottom:1rem;overflow:hidden;">
        
        <div style="padding:0.875rem 1.25rem;border-bottom:1px solid #f1f5f9;display:flex;align-items:center;justify-content:space-between;background:#f8fafc;">
            <div>
                <p style="font-size:0.9375rem;font-weight:700;color:#1e3a5f;margin:0;"><?php echo e($c->razao_social); ?></p>
                <?php $f = $grupoItems->filter->isConcluido()->count(); $t = $grupoItems->count(); ?>
                <p style="font-size:0.8125rem;color:#64748b;margin:0.125rem 0 0;"><?php echo e($f); ?>/<?php echo e($t); ?> concluídos
                    — <span style="color:<?php echo e($f === $t ? '#25b87e' : '#f59e0b'); ?>;"><?php echo e($t > 0 ? round($f/$t*100) : 0); ?>%</span>
                </p>
            </div>
            
            <div style="width:120px;height:6px;border-radius:3px;background:#e2e8f0;overflow:hidden;">
                <div style="height:100%;background:#25b87e;border-radius:3px;width:<?php echo e($t > 0 ? round($f/$t*100) : 0); ?>%;"></div>
            </div>
        </div>

        
        <div>
            <?php $__currentLoopData = $grupoItems; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
            <div style="display:flex;align-items:center;gap:0.875rem;padding:0.75rem 1.25rem;border-bottom:1px solid #f8fafc;">
                
                <form method="POST" action="<?php echo e(route('admin.onboarding.toggle', $item)); ?>">
                    <?php echo csrf_field(); ?> <?php echo method_field('PATCH'); ?>
                    <button type="submit"
                            style="width:22px;height:22px;border-radius:6px;border:2px solid <?php echo e($item->isConcluido() ? '#25b87e' : '#cbd5e1'); ?>;background:<?php echo e($item->isConcluido() ? '#25b87e' : '#fff'); ?>;cursor:pointer;display:flex;align-items:center;justify-content:center;flex-shrink:0;"
                            title="<?php echo e($item->isConcluido() ? 'Reabrir' : 'Concluir'); ?>">
                        <?php if($item->isConcluido()): ?>
                        <svg style="width:12px;height:12px;color:#fff;" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="3" d="M5 13l4 4L19 7"/>
                        </svg>
                        <?php endif; ?>
                    </button>
                </form>

                
                <div style="flex:1;min-width:0;">
                    <p style="font-size:0.875rem;font-weight:600;color:<?php echo e($item->isConcluido() ? '#94a3b8' : '#1e3a5f'); ?>;margin:0;<?php echo e($item->isConcluido() ? 'text-decoration:line-through;' : ''); ?>"><?php echo e($item->titulo); ?></p>
                    <?php if($item->descricao): ?>
                    <p style="font-size:0.8125rem;color:#94a3b8;margin:0.125rem 0 0;"><?php echo e($item->descricao); ?></p>
                    <?php endif; ?>
                    <?php if($item->isConcluido()): ?>
                    <p style="font-size:0.75rem;color:#25b87e;margin:0.125rem 0 0;">
                        Concluído em <?php echo e($item->concluido_em->format('d/m/Y H:i')); ?>

                        <?php if($item->concluidoPor): ?> por <?php echo e($item->concluidoPor->name); ?><?php endif; ?>
                    </p>
                    <?php endif; ?>
                </div>

                
                <span style="font-size:0.6875rem;font-weight:600;padding:0.1875rem 0.5rem;border-radius:100px;white-space:nowrap;<?php echo e($item->responsavel_cliente ? 'background:#eff6ff;color:#2563eb;' : 'background:#f1f5f9;color:#64748b;'); ?>">
                    <?php echo e($item->responsavel_cliente ? 'Cliente' : 'OPCON'); ?>

                </span>

                
                <form method="POST" action="<?php echo e(route('admin.onboarding.destroy', $item)); ?>">
                    <?php echo csrf_field(); ?> <?php echo method_field('DELETE'); ?>
                    <button type="submit" onclick="return confirm('Remover item?')"
                            style="width:28px;height:28px;border-radius:7px;border:1px solid #fee2e2;background:#fff;color:#ef4444;cursor:pointer;display:flex;align-items:center;justify-content:center;">
                        <svg style="width:12px;height:12px;" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"/>
                        </svg>
                    </button>
                </form>
            </div>
            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
        </div>
    </div>
    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
    <div style="text-align:center;padding:3rem;color:#94a3b8;">
        <p style="font-size:1rem;font-weight:600;">Nenhum item de onboarding</p>
        <p style="font-size:0.875rem;">Crie checklists para orientar a integração dos seus clientes.</p>
    </div>
    <?php endif; ?>

    
    <div id="modal-novo" style="display:none;position:fixed;inset:0;z-index:200;backdrop-filter:blur(3px);background:rgba(0,0,0,0.4);">
        <div style="display:flex;align-items:center;justify-content:center;min-height:100%;width:100%;padding:1rem;"
             onclick="if(event.target===this)document.getElementById('modal-novo').style.display='none'">
        <div style="background:#fff;border-radius:16px;width:100%;max-width:480px;overflow:hidden;box-shadow:0 20px 60px rgba(0,0,0,0.2);"
             onclick="event.stopPropagation()">
            <div style="background:#1e3a5f;padding:1.25rem 1.5rem;display:flex;align-items:center;justify-content:space-between;">
                <h2 style="font-size:1rem;font-weight:700;color:#fff;margin:0;">Novo item de onboarding</h2>
                <button onclick="document.getElementById('modal-novo').style.display='none'"
                        style="background:none;border:none;color:rgba(255,255,255,0.6);cursor:pointer;font-size:1.25rem;line-height:1;">×</button>
            </div>
            <form method="POST" action="<?php echo e(route('admin.onboarding.store')); ?>" style="padding:1.5rem;display:flex;flex-direction:column;gap:1rem;">
                <?php echo csrf_field(); ?>
                <div>
                    <label style="font-size:0.8125rem;font-weight:600;color:#475569;display:block;margin-bottom:0.375rem;">Contrato *</label>
                    <select name="contrato_id" required
                            style="width:100%;padding:0.5625rem 0.75rem;border-radius:8px;border:1px solid #e2e8f0;font-family:inherit;font-size:0.875rem;color:#1e3a5f;">
                        <option value="">Selecione...</option>
                        <?php $__currentLoopData = $contratos; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $c): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                        <option value="<?php echo e($c->id); ?>"><?php echo e($c->razao_social); ?></option>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                    </select>
                </div>
                <div>
                    <label style="font-size:0.8125rem;font-weight:600;color:#475569;display:block;margin-bottom:0.375rem;">Título *</label>
                    <input type="text" name="titulo" required placeholder="Ex: Enviar documentos fiscais"
                           style="width:100%;padding:0.5625rem 0.75rem;border-radius:8px;border:1px solid #e2e8f0;font-family:inherit;font-size:0.875rem;color:#1e3a5f;">
                </div>
                <div>
                    <label style="font-size:0.8125rem;font-weight:600;color:#475569;display:block;margin-bottom:0.375rem;">Descrição</label>
                    <textarea name="descricao" rows="2" placeholder="Instruções adicionais..."
                              style="width:100%;padding:0.5625rem 0.75rem;border-radius:8px;border:1px solid #e2e8f0;font-family:inherit;font-size:0.875rem;color:#1e3a5f;resize:vertical;"></textarea>
                </div>
                <div style="display:flex;gap:1rem;align-items:center;">
                    <div style="flex:1;">
                        <label style="font-size:0.8125rem;font-weight:600;color:#475569;display:block;margin-bottom:0.375rem;">Responsável</label>
                        <select name="responsavel_cliente"
                                style="width:100%;padding:0.5625rem 0.75rem;border-radius:8px;border:1px solid #e2e8f0;font-family:inherit;font-size:0.875rem;color:#1e3a5f;">
                            <option value="1">Cliente</option>
                            <option value="0">OPCON</option>
                        </select>
                    </div>
                    <div style="flex:1;">
                        <label style="font-size:0.8125rem;font-weight:600;color:#475569;display:block;margin-bottom:0.375rem;">Ordem</label>
                        <input type="number" name="ordem" min="0" placeholder="Auto"
                               style="width:100%;padding:0.5625rem 0.75rem;border-radius:8px;border:1px solid #e2e8f0;font-family:inherit;font-size:0.875rem;color:#1e3a5f;">
                    </div>
                </div>
                <div style="display:flex;justify-content:flex-end;gap:0.75rem;padding-top:0.5rem;">
                    <button type="button" onclick="document.getElementById('modal-novo').style.display='none'"
                            style="padding:0.5625rem 1.125rem;border-radius:8px;border:1px solid #e2e8f0;background:#fff;color:#64748b;font-family:inherit;font-size:0.875rem;font-weight:600;cursor:pointer;">
                        Cancelar
                    </button>
                    <button type="submit"
                            style="padding:0.5625rem 1.125rem;border-radius:8px;background:#25b87e;color:#fff;font-family:inherit;font-size:0.875rem;font-weight:600;border:none;cursor:pointer;">
                        Salvar
                    </button>
                </div>
            </form>
        </div>
        </div>
    </div>

 <?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginale0f1cdd055772eb1d4a99981c240763e)): ?>
<?php $attributes = $__attributesOriginale0f1cdd055772eb1d4a99981c240763e; ?>
<?php unset($__attributesOriginale0f1cdd055772eb1d4a99981c240763e); ?>
<?php endif; ?>
<?php if (isset($__componentOriginale0f1cdd055772eb1d4a99981c240763e)): ?>
<?php $component = $__componentOriginale0f1cdd055772eb1d4a99981c240763e; ?>
<?php unset($__componentOriginale0f1cdd055772eb1d4a99981c240763e); ?>
<?php endif; ?>
<?php /**PATH C:\ProjetosWeb\OPCON\resources\views\pages\admin\onboarding.blade.php ENDPATH**/ ?>