<?php
    $settings = \App\GeneralSettings::first();
?>



<?php $__env->startSection('title', 'Edit Topic - ' . $topic->topic_title); ?>

<?php $__env->startPush('styles'); ?>
<link href="https://cdn.jsdelivr.net/npm/summernote@0.8.20/dist/summernote-lite.min.css" rel="stylesheet">
<style>
  

    .content-card {
        background: rgba(255,255,255,0.95);
        backdrop-filter: blur(10px);
        border-radius: 20px;
        box-shadow: 0 20px 50px rgba(0,0,0,0.4);
        overflow: hidden;
    }

    .content-card .card-body {
        background: white;
        color: #212529;
    }

    .form-control, .form-select, .note-editor {
        border-radius: 16px !important;
    }

    .btn-save {
        background: var(--primary);
        color: white;
        border: none;
        border-radius: 50px;
        padding: 14px 40px;
        font-weight: 700 1.1rem 'Poppins', sans-serif;
        box-shadow: 0 10px 30px rgba(108,92,231,0.4);
        transition: all 0.3s;
    }

    .btn-save:hover {
        transform: translateY(-4px);
        box-shadow: 0 15px 40px rgba(108,92,231,0.6);
    }
</style>
<?php $__env->stopPush(); ?>

<?php $__env->startPush('scripts'); ?>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/summernote@0.8.20/dist/summernote-lite.min.js"></script>
<script>
    $(document).ready(function() {
        $('#summernote').summernote({
            placeholder: 'Edit your content here...',
            height: 380,
            focus: true,
            toolbar: [
                ['style', ['bold', 'italic', 'underline', 'clear']],
                ['font', ['strikethrough']],
                ['para', ['ul', 'ol', 'paragraph']],
                ['insert', ['link', 'picture', 'video']],
                ['view', ['fullscreen', 'codeview']]
            ]
        });
    });
</script>
<?php $__env->stopPush(); ?>

<?php $__env->startSection('content'); ?>


<div class="hero-section text-white text-center position-relative">
    <div class="container position-relative">
        <h1 class="display-3 fw-bold text-uppercase mb-3">FORUMS</h1>
        <h5 class="fw-light fs-3 opacity-90"><?php echo e($settings->website_name); ?> Community</h5>
    </div>
</div>

<div class="container my-5">

    <div class="row justify-content-center">
        <div class="col-xl-9 col-lg-10">

            
            <div class="content-card shadow-lg">
                <div class="card-header py-4 text-white text-center fw-bold" style="background: var(--primary);">
                    <h3 class="mb-0">Edit Topic</h3>
                    <p class="mb-0 mt-2 opacity-90">Editing as <strong><?php echo e(Auth::user()->name); ?></strong></p>
                </div>

                <div class="card-body p-5 p-xl-6">
                    <form action="<?php echo e(route('topic.update', $topic->topic_id)); ?>" method="POST">
                        <?php echo csrf_field(); ?>
                        <?php echo method_field('PUT'); ?>

                        
                        <div class="mb-4">
                            <label class="form-label fw-bold fs-5">Category <span class="text-danger">*</span></label>
                            <select name="category" class="form-select form-select-lg <?php $__errorArgs = ['category'];
$__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>
                                <option value="">Choose a category</option>
                                <?php $__currentLoopData = $categories; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $category): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                    <option value="<?php echo e($category->forum_category_id); ?>"
                                        <?php echo e(old('category', $topic->topic_category_id) == $category->forum_category_id ? 'selected' : ''); ?>>
                                        <?php echo e($category->forum_category_name); ?>

                                    </option>
                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                            </select>
                            <?php $__errorArgs = ['category'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                                <div class="text-danger small mt-2"><?php echo e($message); ?></div>
                            <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                        </div>

                        
                        <div class="mb-4">
                            <label class="form-label fw-bold fs-5">Title <span class="text-danger">*</span></label>
                            <input type="text" name="topic"
                                   class="form-control form-control-lg <?php $__errorArgs = ['topic'];
$__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); ?>"
                                   value="<?php echo e(old('topic', $topic->topic_title)); ?>"
                                   placeholder="Enter topic title..." required>
                            <?php $__errorArgs = ['topic'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                                <div class="text-danger small mt-2"><?php echo e($message); ?></div>
                            <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                        </div>

                        
                        <div class="mb-5">
                            <label class="form-label fw-bold fs-5">Content <span class="text-danger">*</span></label>
                            <textarea name="content" id="summernote" class="<?php $__errorArgs = ['content'];
$__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); ?>">
                                <?php echo e(old('content', $topic->topic_content)); ?>

                            </textarea>
                            <?php $__errorArgs = ['content'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                                <div class="text-danger small mt-2"><?php echo e($message); ?></div>
                            <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                        </div>

                        
                        <div class="text-center">
                            <button type="submit" class="btn btn-save">
                                Save Changes
                            </button>
                            <a href="<?php echo e(route('topic.show', $topic->topic_id)); ?>" class="btn btn-outline-secondary btn-lg px-5 ms-3">
                                Cancel
                            </a>
                        </div>
                    </form>
                </div>
            </div>

        </div>
    </div>
</div>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('layouts.app', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH C:\xampp8.2\htdocs\MCCMS\resources\views/forum/editpost.blade.php ENDPATH**/ ?>