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

    <div style="max-width: 1100px;">

        
        <div style="display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:1rem; margin-bottom:1.5rem;">
            <div>
                <h1 style="font-size:1.375rem; font-weight:700; color:#1e3a5f; margin:0;">Blog / CMS</h1>
                <p style="font-size:0.875rem; color:#64748b; margin:0.25rem 0 0;">Gerencie artigos publicados e rascunhos</p>
            </div>
            <a href="<?php echo e(route('admin.blog.create')); ?>"
               style="display:inline-flex; align-items:center; gap:0.5rem; padding:0.5rem 1.25rem; background:#25b87e; color:#fff; border-radius:8px; font-size:0.875rem; font-weight:600; text-decoration:none; transition:background 0.15s;"
               onmouseover="this.style.background='#1fa96e'" onmouseout="this.style.background='#25b87e'">
                <svg style="width:16px;height:16px;" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                    <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4v16m8-8H4"/>
                </svg>
                Novo post
            </a>
        </div>

        
        <?php if(session('success')): ?>
            <div style="background:#f0fdf4; border:1px solid #bbf7d0; border-radius:8px; padding:0.75rem 1rem; margin-bottom:1rem; font-size:0.875rem; color:#166534;">
                <?php echo e(session('success')); ?>

            </div>
        <?php endif; ?>

        
        <div style="background:#fff; border-radius:12px; border:1px solid #e2e8f0; overflow:hidden;">
            <table class="adm-table">
                <thead>
                    <tr>
                        <th>Post</th>
                        <th>Categoria</th>
                        <th>Autor</th>
                        <th>Status</th>
                        <th>Publicado em</th>
                        <th style="text-align:right;">Ações</th>
                    </tr>
                </thead>
                <tbody>
                    <?php $__empty_1 = true; $__currentLoopData = $posts; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $post): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                        <tr>
                            <td style="padding:0.875rem 1rem;">
                                <div style="display:flex; align-items:center; gap:0.75rem;">
                                    <span style="font-size:1.5rem; line-height:1; flex-shrink:0;"><?php echo e($post->cover_emoji ?: '📝'); ?></span>
                                    <div>
                                        <p style="font-weight:600; font-size:0.875rem; color:#1e3a5f; margin:0; line-height:1.3;"><?php echo e(Str::limit($post->title, 60)); ?></p>
                                        <p style="font-size:0.75rem; color:#94a3b8; margin:0.2rem 0 0;"><?php echo e($post->read_time); ?> min de leitura</p>
                                    </div>
                                </div>
                            </td>
                            <td style="padding:0.875rem 1rem;">
                                <span style="font-size:0.75rem; font-weight:600; padding:0.2rem 0.6rem; border-radius:100px; background:#eff6ff; color:#2563eb;"><?php echo e($post->category); ?></span>
                            </td>
                            <td style="padding:0.875rem 1rem; font-size:0.875rem; color:#475569;">
                                <?php echo e($post->author?->name ?? '—'); ?>

                            </td>
                            <td style="padding:0.875rem 1rem;">
                                <?php if($post->isPublished()): ?>
                                    <span style="font-size:0.75rem; font-weight:600; padding:0.2rem 0.6rem; border-radius:100px; background:#f0fdf4; color:#166534; border:1px solid #bbf7d0;">Publicado</span>
                                <?php else: ?>
                                    <span style="font-size:0.75rem; font-weight:600; padding:0.2rem 0.6rem; border-radius:100px; background:#fefce8; color:#92400e; border:1px solid #fde68a;">Rascunho</span>
                                <?php endif; ?>
                            </td>
                            <td style="padding:0.875rem 1rem; font-size:0.8125rem; color:#64748b;">
                                <?php echo e($post->published_at?->format('d/m/Y') ?? '—'); ?>

                            </td>
                            <td style="padding:0.875rem 1rem; text-align:right;">
                                <div style="display:inline-flex; align-items:center; gap:0.375rem;">
                                    
                                    <form method="POST" action="<?php echo e(route('admin.blog.toggle', $post)); ?>">
                                        <?php echo csrf_field(); ?> <?php echo method_field('PATCH'); ?>
                                        <button type="submit"
                                                title="<?php echo e($post->isPublished() ? 'Despublicar' : 'Publicar'); ?>"
                                                style="display:inline-flex; align-items:center; padding:0.375rem; border-radius:6px; border:1px solid <?php echo e($post->isPublished() ? '#fde68a' : '#bbf7d0'); ?>; background:<?php echo e($post->isPublished() ? '#fefce8' : '#f0fdf4'); ?>; color:<?php echo e($post->isPublished() ? '#b45309' : '#166534'); ?>; cursor:pointer; transition:all 0.15s;">
                                            <?php if($post->isPublished()): ?>
                                                <svg style="width:14px;height:14px;" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                                                    <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13.875 18.825A10.05 10.05 0 0112 19c-4.478 0-8.268-2.943-9.543-7a9.97 9.97 0 011.563-3.029m5.858.908a3 3 0 114.243 4.243M9.878 9.878l4.242 4.242M9.88 9.88l-3.29-3.29m7.532 7.532l3.29 3.29M3 3l3.59 3.59m0 0A9.953 9.953 0 0112 5c4.478 0 8.268 2.943 9.543 7a10.025 10.025 0 01-4.132 5.411m0 0L21 21"/>
                                                </svg>
                                            <?php else: ?>
                                                <svg style="width:14px;height:14px;" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                                                    <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z"/>
                                                    <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"/>
                                                </svg>
                                            <?php endif; ?>
                                        </button>
                                    </form>

                                    
                                    <?php if($post->isPublished()): ?>
                                        <a href="<?php echo e(route('blog.show', $post)); ?>" target="_blank"
                                           title="Ver no site"
                                           style="display:inline-flex; align-items:center; padding:0.375rem; border-radius:6px; border:1px solid #e2e8f0; background:#f8fafc; color:#64748b; text-decoration:none; transition:all 0.15s;"
                                           onmouseover="this.style.background='#f1f5f9'" onmouseout="this.style.background='#f8fafc'">
                                            <svg style="width:14px;height:14px;" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                                                <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"/>
                                            </svg>
                                        </a>
                                    <?php endif; ?>

                                    
                                    <a href="<?php echo e(route('admin.blog.edit', $post)); ?>"
                                       title="Editar"
                                       style="display:inline-flex; align-items:center; padding:0.375rem; border-radius:6px; border:1px solid #bfdbfe; background:#eff6ff; color:#2563eb; text-decoration:none; transition:all 0.15s;"
                                       onmouseover="this.style.background='#dbeafe'" onmouseout="this.style.background='#eff6ff'">
                                        <svg style="width:14px;height:14px;" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                                            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"/>
                                        </svg>
                                    </a>

                                    
                                    <form method="POST" action="<?php echo e(route('admin.blog.destroy', $post)); ?>"
                                          onsubmit="return confirm('Excluir este post definitivamente?')">
                                        <?php echo csrf_field(); ?> <?php echo method_field('DELETE'); ?>
                                        <button type="submit" title="Excluir"
                                                style="display:inline-flex; align-items:center; padding:0.375rem; border-radius:6px; border:1px solid #fecaca; background:#fef2f2; color:#dc2626; cursor:pointer; transition:all 0.15s;"
                                                onmouseover="this.style.background='#fee2e2'" onmouseout="this.style.background='#fef2f2'">
                                            <svg style="width:14px;height:14px;" 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>
                            </td>
                        </tr>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                        <tr>
                            <td colspan="6" style="padding:3rem; text-align:center; color:#94a3b8; font-size:0.875rem;">
                                Nenhum post criado ainda.
                                <a href="<?php echo e(route('admin.blog.create')); ?>" style="color:#25b87e; font-weight:600; text-decoration:none; margin-left:0.25rem;">Criar o primeiro →</a>
                            </td>
                        </tr>
                    <?php endif; ?>
                </tbody>
            </table>
        </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\blog\index.blade.php ENDPATH**/ ?>