<?php $__env->startSection('title', 'News Management'); ?>

<?php $__env->startSection('content'); ?>
<div class="dashboard-header" style="margin-bottom: 24px; display: flex; justify-content: space-between; align-items: center;">
    <div>
        <h1 style="font-family:'Oswald',sans-serif; font-size:2rem; color:var(--primary); margin:0;">News Management</h1>
    </div>
    <div style="display:flex; gap:10px;">
        <a href="<?php echo e(route('admin.news.categories')); ?>" class="btn btn-outline">
            <i class="fas fa-tags"></i> Categories
        </a>
        <a href="<?php echo e(route('admin.news.create')); ?>" class="btn btn-primary">
            <i class="fas fa-plus"></i> Create Article
        </a>
    </div>
</div>

<div class="admin-card">
    <div class="admin-card-body" style="padding:0;">
        <?php if($news->count()): ?>
        <div class="table-responsive">
            <table class="admin-table">
                <thead>
                    <tr>
                        <th>#</th>
                        <th>Title</th>
                        <th>Category</th>
                        <th>Author</th>
                        <th>Status</th>
                        <th>Featured</th>
                        <th style="text-align:right;">Actions</th>
                    </tr>
                </thead>
                <tbody>
                    <?php $__currentLoopData = $news; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                    <tr>
                        <td><?php echo e($item->id); ?></td>
                        <td>
                            <div style="font-weight:600; color:var(--primary);"><?php echo e(Str::limit($item->title, 50)); ?></div>
                        </td>
                        <td>
                            <?php if($item->category): ?>
                            <span class="badge badge-info"><?php echo e($item->category->name); ?></span>
                            <?php else: ?>
                            <span style="color:var(--text-muted);">-</span>
                            <?php endif; ?>
                        </td>
                        <td><?php echo e($item->author->name ?? '-'); ?></td>
                        <td>
                            <?php if($item->status === 'published'): ?>
                                <span class="badge badge-success">Published</span>
                            <?php else: ?>
                                <span class="badge badge-warning">Draft</span>
                            <?php endif; ?>
                        </td>
                        <td>
                            <?php if($item->is_featured): ?>
                                <span class="badge badge-success"><i class="fas fa-star"></i> Yes</span>
                            <?php else: ?>
                                <span style="color:var(--text-muted); font-size:0.8rem;">No</span>
                            <?php endif; ?>
                        </td>
                        <td style="text-align:right;">
                            <a href="<?php echo e(route('news.show', $item->slug)); ?>" class="btn btn-outline btn-sm" target="_blank" title="View on site">
                                <i class="fas fa-external-link-alt"></i>
                            </a>
                            <a href="<?php echo e(route('admin.news.edit', $item->id)); ?>" class="btn btn-primary btn-sm">
                                <i class="fas fa-edit"></i>
                            </a>
                            <form action="<?php echo e(route('admin.news.destroy', $item->id)); ?>" method="POST" style="display:inline-block;" onsubmit="return confirm('Delete this article?');">
                                <?php echo csrf_field(); ?>
                                <?php echo method_field('DELETE'); ?>
                                <button type="submit" class="btn btn-danger btn-sm">
                                    <i class="fas fa-trash"></i>
                                </button>
                            </form>
                        </td>
                    </tr>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                </tbody>
            </table>
        </div>
        <div style="padding: 20px;">
            <?php echo e($news->links()); ?>

        </div>
        <?php else: ?>
        <div style="padding: 60px; text-align: center; color: var(--text-muted);">
            <i class="fas fa-newspaper" style="font-size: 3rem; opacity: 0.5; margin-bottom: 16px; display:block;"></i>
            <p style="margin-bottom:16px;">No news articles found.</p>
            <a href="<?php echo e(route('admin.news.create')); ?>" class="btn btn-primary">
                <i class="fas fa-plus"></i> Create First Article
            </a>
        </div>
        <?php endif; ?>
    </div>
</div>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.admin', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH C:\xampp\htdocs\Tekendow\resources\views/admin/news/index.blade.php ENDPATH**/ ?>