<?php $__env->startSection('title'); ?> Edit  Category
<?php $__env->stopSection(); ?>
<?php $__env->startSection('content'); ?>
    <style>
        .active {
            background-color: #007BFF !important;
            color: white !important;
        }
    </style>
    <!-- Content Wrapper. Contains page content -->
    <div class="content-wrapper">
        <!-- Main content -->
        <section class="content">
            <div class="container-fluid">
                <div class="row">
                    <div class="col-12">

                        <div class="card card-box-shadow mt-5">

                            <div class="card-header">
                                <h3 class="card-title">Edit Category</h3>
                                <a href="<?php echo e(route('admin.categories.index')); ?>">
                                    <button id="submit_btn" class="btn btn-primary custom_btn_sm_back custom_btn btn-sm float-right">
                                        <i class="fas fa-arrow-circle-left"></i>
                                        Back
                                    </button>
                                </a>
                            </div>
                            <!-- /.card-header -->

                            <div class="card-body">
                                <form action="<?php echo e(route('admin.categories.update', $find_category->id)); ?>" method="POST" enctype="multipart/form-data">
                                    <?php echo csrf_field(); ?>

                                    <div class="col-md-12">
                                        <div class="form-group">
                                            <label for="Name">Title:</label>
                                            <input type="text" class="form-control form__field" name="name" placeholder="Enter Title" value="<?php echo e($find_category->name ?: ''); ?>">
                                        </div>
                                        <small class="text-danger"><?php $__errorArgs = ['category_name'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> <?php echo e($message); ?> <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?></small>
                                    </div>

                                    <div class="col-md-12 mt-5">
                                        <div class="form-group">
                                            <label for="categoryImageInput">Choose Category Image:</label>
                                            <input type="file" class="form-control form__field visually-hidden" name="category_image" id="categoryImageInput" accept="image/*">
                                            <label for="categoryImageInput" class="file-input-label form__field form-control">
                                                <i class="fas fa-camera"></i> Choose file
                                            </label>
                                        </div>

                                        <img id="categoryImagePreview" src="<?php echo e($find_category->getFirstMediaUrl('category_image') ?: asset('upload/No-Image.png')); ?>" alt="Profile Preview" style="width: 200px; height: 150px; margin-top: 10px;">
                                    </div>

                                    <div class="col-md-12 mt-5">
                                        <label for="">Short Description</label>
                                        <textarea name="description" rows="4" placeholder="Description" class="form-control" id="summernote1"><?php echo e($find_category->description ?: ''); ?></textarea>
                                        <small class="text-danger"><?php $__errorArgs = ['description'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> <?php echo e($message); ?> <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?></small>
                                    </div>

                                    <div class="text-center mt-5">
                                        <button id="submit_btn" class="btn btn-primary custom_btn">
                                            <i class="fa-solid fa-cloud-arrow-up"></i> Submit
                                        </button>
                                    </div>

                                </form>
                            </div>
                            <!-- /.card-body -->
                        </div>

                    </div>
                    <!-- /.col -->
                </div>
                <!-- /.row -->
            </div>
            <!-- /.container-fluid -->
        </section>
        <!-- /.content -->
    </div>

    <!-- /.content-wrapper -->
<?php $__env->stopSection(); ?>

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

    <script>
        $('#summernote1').summernote({
            placeholder: 'Hello Admin',
            tabsize: 2,
            height: 100
        });

    </script>
    <script>

        function showImagePreview(input, previewId) {
            const preview = document.getElementById(previewId);

            if (input.files && input.files[0]) {
                const reader = new FileReader();

                reader.onload = function (e) {
                    preview.src = e.target.result;
                    preview.style.display = 'block';
                };

                reader.readAsDataURL(input.files[0]);
            }
        }

        const topBannerImageInput = document.getElementById('topBannerImageInput');
        topBannerImageInput.addEventListener('change', function () {
            showImagePreview(this, 'topBannerImagePreview');

        });
    </script>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.admin-layout', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/vagrant/projects/upsence/resources/views/admin/category/update.blade.php ENDPATH**/ ?>