

<?php $__env->startSection('header-title', 'Forum Konusu Düzenle'); ?>

<?php $__env->startSection('content'); ?>
<div class="page-header mb-4">
    <h1 class="page-title">Forum Konusu Düzenle</h1>
    <p class="text-muted"><?php echo e($forumTopic->title); ?></p>
</div>

<div class="row">
    <div class="col-lg-8">
        <div class="card">
            <div class="card-body">
                <form action="<?php echo e(route('admin.forum-topics.update', $forumTopic)); ?>" method="POST">
                    <?php echo csrf_field(); ?>
                    <?php echo method_field('PUT'); ?>

                    <div class="mb-3">
                        <label class="form-label">Konu Başlığı <span class="text-danger">*</span></label>
                        <input type="text" name="title" value="<?php echo e(old('title', $forumTopic->title)); ?>" class="form-control <?php $__errorArgs = ['title'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> is-invalid <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>" required autofocus>
                        <?php $__errorArgs = ['title'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                            <div class="invalid-feedback"><?php echo e($message); ?></div>
                        <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                    </div>

                    <div class="mb-3">
                        <label class="form-label">Kategori <span class="text-danger">*</span></label>
                        <select name="category_id" class="form-select <?php $__errorArgs = ['category_id'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> is-invalid <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>" required>
                            <?php $__currentLoopData = $categories; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $id => $name): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <option value="<?php echo e($id); ?>" <?php echo e(old('category_id', $forumTopic->category_id) == $id ? 'selected' : ''); ?>><?php echo e($name); ?></option>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                        </select>
                        <?php $__errorArgs = ['category_id'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                            <div class="invalid-feedback"><?php echo e($message); ?></div>
                        <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                    </div>

                    <div class="row">
                        <div class="col-md-6">
                            <div class="form-check form-switch mb-3">
                                <input type="checkbox" name="is_sticky" class="form-check-input" id="is_sticky" <?php echo e(old('is_sticky', $forumTopic->is_sticky) ? 'checked' : ''); ?>>
                                <label class="form-check-label" for="is_sticky">
                                    <strong>Sabit Konu</strong>
                                    <div class="form-text">Sabit konular her zaman üstte görünür</div>
                                </label>
                            </div>
                        </div>
                        <div class="col-md-6">
                            <div class="form-check form-switch mb-3">
                                <input type="checkbox" name="is_locked" class="form-check-input" id="is_locked" <?php echo e(old('is_locked', $forumTopic->is_locked) ? 'checked' : ''); ?>>
                                <label class="form-check-label" for="is_locked">
                                    <strong>Kilitli Konu</strong>
                                    <div class="form-text">Kilitli konulara yanıt yazılamaz</div>
                                </label>
                            </div>
                        </div>
                    </div>

                    <div class="d-flex gap-2 mt-3">
                        <button type="submit" class="btn btn-primary">
                            <i class="ti ti-check me-2"></i>Güncelle
                        </button>
                        <a href="<?php echo e(route('admin.forum-topics.index')); ?>" class="btn btn-secondary">İptal</a>
                        <form action="<?php echo e(route('admin.forum-topics.destroy', $forumTopic)); ?>" method="POST" class="ms-auto" onsubmit="return confirm('Bu konuyu silmek istediğinizden emin misiniz?');">
                            <?php echo csrf_field(); ?>
                            <?php echo method_field('DELETE'); ?>
                            <button type="submit" class="btn btn-danger">
                                <i class="ti ti-trash me-2"></i>Sil
                            </button>
                        </form>
                    </div>
                </form>
            </div>
        </div>

        <div class="card mt-3">
            <div class="card-header">
                <h3 class="card-title">Konu İçeriği</h3>
            </div>
            <div class="card-body">
                <div class="p-3 bg-light rounded" style="white-space: pre-wrap;"><?php echo e($forumTopic->content); ?></div>
            </div>
        </div>

        <div class="card mt-3">
            <div class="card-header">
                <h3 class="card-title">Yanıtlar (<?php echo e($forumTopic->posts->count()); ?>)</h3>
            </div>
            <div class="list-group list-group-flush">
                <?php $__empty_1 = true; $__currentLoopData = $forumTopic->posts; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $post): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                <div class="list-group-item">
                    <div class="d-flex justify-content-between align-items-start">
                        <div>
                            <div class="d-flex align-items-center gap-2 mb-2">
                                <strong><?php echo e($post->user->name); ?></strong>
                                <span class="text-muted" style="font-size:12px;"><?php echo e($post->created_at->format('d.m.Y H:i')); ?></span>
                            </div>
                            <div style="white-space: pre-wrap;"><?php echo e($post->content); ?></div>
                        </div>
                        <div class="text-end">
                            <div class="text-success">👍 <?php echo e($post->likes); ?></div>
                            <div class="text-danger">👎 <?php echo e($post->dislikes); ?></div>
                        </div>
                    </div>
                </div>
                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                <div class="list-group-item text-center text-muted">Henüz yanıt yok.</div>
                <?php endif; ?>
            </div>
        </div>
    </div>

    <div class="col-lg-4">
        <div class="card">
            <div class="card-header">
                <h3 class="card-title">Konu Bilgileri</h3>
            </div>
            <div class="card-body">
                <table class="table table-sm table-vcenter">
                    <tr>
                        <td class="text-muted w-50">Slug:</td>
                        <td><code><?php echo e($forumTopic->slug); ?></code></td>
                    </tr>
                    <tr>
                        <td class="text-muted">Yazar:</td>
                        <td><strong><?php echo e($forumTopic->user->name); ?></strong></td>
                    </tr>
                    <tr>
                        <td class="text-muted">Kategori:</td>
                        <td><?php echo e($forumTopic->category->name); ?></td>
                    </tr>
                    <tr>
                        <td class="text-muted">Yanıt Sayısı:</td>
                        <td><strong><?php echo e($forumTopic->reply_count); ?></strong></td>
                    </tr>
                    <tr>
                        <td class="text-muted">Görüntülenme:</td>
                        <td><strong><?php echo e($forumTopic->views); ?></strong></td>
                    </tr>
                    <tr>
                        <td class="text-muted">Son Yanıt:</td>
                        <td><?php echo e($forumTopic->last_reply_at?->diffForHumans() ?? '-'); ?></td>
                    </tr>
                    <tr>
                        <td class="text-muted">Durum:</td>
                        <td>
                            <?php if($forumTopic->is_sticky): ?>
                                <span class="badge bg-warning">Sabit</span>
                            <?php endif; ?>
                            <?php if($forumTopic->is_locked): ?>
                                <span class="badge bg-danger">Kilitli</span>
                            <?php endif; ?>
                            <?php if(!$forumTopic->is_sticky && !$forumTopic->is_locked): ?>
                                <span class="badge bg-success">Normal</span>
                            <?php endif; ?>
                        </td>
                    </tr>
                    <tr>
                        <td class="text-muted">Oluşturulma:</td>
                        <td><?php echo e($forumTopic->created_at->format('d.m.Y H:i')); ?></td>
                    </tr>
                </table>
            </div>
        </div>

        <div class="card mt-3">
            <div class="card-header">
                <h3 class="card-title">Hızlı İşlemler</h3>
            </div>
            <div class="card-body">
                <form action="<?php echo e(route('admin.forum-topics.toggle_sticky', $forumTopic)); ?>" method="POST" class="mb-2">
                    <?php echo csrf_field(); ?>
                    <button type="submit" class="btn btn-<?php echo e($forumTopic->is_sticky ? 'warning' : 'outline-warning'); ?> w-100">
                        <i class="ti ti-pin me-2"></i><?php echo e($forumTopic->is_sticky ? 'Sabeti Kaldır' : 'Sabit Yap'); ?>

                    </button>
                </form>
                <form action="<?php echo e(route('admin.forum-topics.toggle_locked', $forumTopic)); ?>" method="POST">
                    <?php echo csrf_field(); ?>
                    <button type="submit" class="btn btn-<?php echo e($forumTopic->is_locked ? 'danger' : 'outline-danger'); ?> w-100">
                        <i class="ti ti-lock me-2"></i><?php echo e($forumTopic->is_locked ? 'Kilidi Aç' : 'Kilit Yap'); ?>

                    </button>
                </form>
            </div>
        </div>
    </div>
</div>
<?php $__env->stopSection(); ?>

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