HEX
Server: LiteSpeed
System: Linux srv1.dhviews.com 5.14.0-570.23.1.el9_6.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Jun 24 11:27:16 EDT 2025 x86_64
User: bdedition (1723)
PHP: 7.4.33
Disabled: NONE
Upload Files
File: /home/bdedition/public_html/core/storage/framework/views/5d2e89d17b657cf42fae8847edc90570.php
<?php $__env->startSection('panel'); ?>
    <div class="row justify-content-center">
        <div class="col-xxl-8 col-xl-12">
            <div class="card">
                <div class="card-body">
                    <form action="<?php echo e(route('user.news.store', @$news->id)); ?>" method="POST" enctype="multipart/form-data"
                        class="disableSubmission">
                        <?php echo csrf_field(); ?>
                        <div class="row justify-content-center">
                            <div class="col-xl-6">
                                <div class="form-group">
                                    <?php if (isset($component)) { $__componentOriginaldbcc027cdd3569f61821c56d10b77c01 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginaldbcc027cdd3569f61821c56d10b77c01 = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.image-uploader','data' => ['name' => 'image','imagePath' => getImage(getFilePath('news') . '/' . @$news->image, getFileSize('news')),'size' => getFileSize('news'),'class' => 'w-100','id' => 'thumbImage','required' => false]] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('image-uploader'); ?>
<?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(['name' => 'image','imagePath' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute(getImage(getFilePath('news') . '/' . @$news->image, getFileSize('news'))),'size' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute(getFileSize('news')),'class' => 'w-100','id' => 'thumbImage','required' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute(false)]); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginaldbcc027cdd3569f61821c56d10b77c01)): ?>
<?php $attributes = $__attributesOriginaldbcc027cdd3569f61821c56d10b77c01; ?>
<?php unset($__attributesOriginaldbcc027cdd3569f61821c56d10b77c01); ?>
<?php endif; ?>
<?php if (isset($__componentOriginaldbcc027cdd3569f61821c56d10b77c01)): ?>
<?php $component = $__componentOriginaldbcc027cdd3569f61821c56d10b77c01; ?>
<?php unset($__componentOriginaldbcc027cdd3569f61821c56d10b77c01); ?>
<?php endif; ?>
                                </div>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-lg-12">
                                <div class="form-group position-relative">
                                    <label><?php echo app('translator')->get('Category'); ?></label>
                                    <select name="category_id" class="select2" data-minimum-results-for-search="-1"
                                        required>
                                        <option value=""><?php echo app('translator')->get('Select One'); ?></option>
                                        <?php $__currentLoopData = $categories; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $category): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                            <option value="<?php echo e($category->id); ?>" <?php if(old('category_id', @$news->category_id) == $category->id): echo 'selected'; endif; ?>>
                                                <?php echo e($category->name); ?></option>
                                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                    </select>
                                </div>
                            </div>
                            <div class="col-lg-12">
                                <div class="form-group">
                                    <label><?php echo app('translator')->get('News Title'); ?></label>
                                    <input type="text" class="form-control" name="title"
                                        value="<?php echo e(old('title', @$news->title)); ?>" required>
                                </div>
                            </div>
                            <div class="col-lg-12">
                                <div class="form-group">
                                    <div class="d-flex justify-content-between align-items-center">
                                        <label><?php echo app('translator')->get('Slug'); ?></label>
                                        <a href="javascript:void(0)" class="buildSlug"><i class="las la-link"></i>
                                            <?php echo app('translator')->get('Make Slug'); ?></a>
                                    </div>
                                    <input type="text" class="form-control" name="slug"
                                        value="<?php echo e(old('slug', @$news->slug)); ?>" required>
                                </div>
                            </div>
                            <div class="col-sm-12">
                                <div class="form-group">
                                    <label><?php echo app('translator')->get('Tags'); ?></label>
                                    <select name="tags[]" multiple class="select2-auto-tokenize form-control">
                                        <option value="" disabled><?php echo app('translator')->get('Enter Keyword'); ?></option>
                                        <?php if(@$news->tags): ?>
                                            <?php $__currentLoopData = $news->tags; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $tag): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                <option value="<?php echo e($tag); ?>" selected><?php echo e(__($tag)); ?></option>
                                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                        <?php endif; ?>
                                    </select>
                                </div>
                            </div>
                            <div class="col-md-4">
                                <div class="form-group">
                                    <label><?php echo app('translator')->get('Trending'); ?></label>
                                    <div class="form-group">
                                        <input type="checkbox" data-width="100%" data-size="large" data-onstyle="-success"
                                            data-offstyle="-danger" data-bs-toggle="toggle" data-height="35"
                                            data-on="<?php echo app('translator')->get('Yes'); ?>" data-off="<?php echo app('translator')->get('No'); ?>" name="trending"
                                            <?php if(@$news->trending): ?> checked <?php endif; ?>>
                                    </div>
                                </div>
                            </div>
                            <div class="col-md-4">
                                <div class="form-group">
                                    <label><?php echo app('translator')->get('Must Read'); ?></label>
                                    <div class="form-group">
                                        <input type="checkbox" data-width="100%" data-size="large" data-onstyle="-success"
                                            data-offstyle="-danger" data-bs-toggle="toggle" data-height="35"
                                            data-on="<?php echo app('translator')->get('Yes'); ?>" data-off="<?php echo app('translator')->get('No'); ?>" name="must_read"
                                            <?php if(@$news->must_read): ?> checked <?php endif; ?>>
                                    </div>
                                </div>
                            </div>
                            <div class="col-md-4">
                                <div class="form-group">
                                    <label><?php echo app('translator')->get('Add Video'); ?></label>
                                    <div class="form-group">
                                        <input type="checkbox" data-width="100%" data-size="large" data-onstyle="-success"
                                            data-offstyle="-danger" data-bs-toggle="toggle" data-height="35"
                                            data-on="<?php echo app('translator')->get('Yes'); ?>" data-off="<?php echo app('translator')->get('No'); ?>" name="have_video"
                                            <?php if(@$news->have_video): ?> checked <?php endif; ?>>
                                    </div>
                                </div>
                            </div>
                            <div class="hideInput"></div>
                            <div class="col-lg-12">
                                <div class="form-group">
                                    <label><?php echo app('translator')->get('Short Description'); ?></label>
                                    <textarea name="short_description" rows="5" class="form-control" required><?php echo e(old('short_description', @$news->short_description)); ?></textarea>
                                </div>
                            </div>
                            <div class="col-sm-12">
                                <div class="form-group">
                                    <label><?php echo app('translator')->get('Description'); ?></label>
                                    <textarea rows="10" class="form-control nicEdit" name="description"><?php echo e(old('description', @$news->description)); ?></textarea>
                                </div>
                            </div>
                        </div>
                        <div class="form-group">
                            <button type="submit" class="btn btn--primary w-100 h-45"><?php echo app('translator')->get('Submit'); ?></button>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
<?php $__env->stopSection(); ?>

<?php $__env->startPush('breadcrumb-plugins'); ?>
    <?php if (isset($component)) { $__componentOriginal3b9bf6c313f6db4d5c9389e5666c89a5 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal3b9bf6c313f6db4d5c9389e5666c89a5 = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.back','data' => ['route' => ''.e(route('user.news.index')).'']] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('back'); ?>
<?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(['route' => ''.e(route('user.news.index')).'']); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal3b9bf6c313f6db4d5c9389e5666c89a5)): ?>
<?php $attributes = $__attributesOriginal3b9bf6c313f6db4d5c9389e5666c89a5; ?>
<?php unset($__attributesOriginal3b9bf6c313f6db4d5c9389e5666c89a5); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal3b9bf6c313f6db4d5c9389e5666c89a5)): ?>
<?php $component = $__componentOriginal3b9bf6c313f6db4d5c9389e5666c89a5; ?>
<?php unset($__componentOriginal3b9bf6c313f6db4d5c9389e5666c89a5); ?>
<?php endif; ?>
<?php $__env->stopPush(); ?>

<?php $__env->startPush('script'); ?>
    <script>
        $(function() {
            'use strict'
            let videoLink = `<?php echo e(@$news->video_link ?? ''); ?>`;
            let videoStatus = '<?php echo e(@$news->have_video); ?>';

            var video_input = `<div class="col-md-12">
                                <div class="form-group">
                                    <label for=""><?php echo app('translator')->get('Youtube Link'); ?></label>
                                    <input type="text" name="video_link" value="${videoLink}" class="form-control" placeholder="https://www.youtube.com/embed/g--C2srD_5I">
                                </div>
                            </div>`;

            $('input[name=have_video]').on('change', function() {
                if ($(this).is(':checked')) {
                    $('.hideInput').html(video_input);
                } else {
                    $('.hideInput').html('');
                }
            })

            if (videoStatus == 1) {
                $('.hideInput').html(video_input);
            }

            $('.buildSlug').on('click', function() {
                let closestForm = $(this).closest('form');
                let title = closestForm.find('[name=title]').val();
            
                // Generate a proper Unicode slug
                let slug = generateSlug(title);
            
                closestForm.find('[name=slug]').val(slug);
                closestForm.find('[name=slug]').trigger('input');
            });
            
            $('[name=slug]').on('input', function() {
                let closestForm = $(this).closest('form');
                closestForm.find('[type=submit]').addClass('disabled');
                let slug = $(this).val();
            
                // Generate and sanitize the slug
                slug = generateSlug(slug);
            
                $(this).val(slug);
            
                let id = `<?php echo e(@$news->id); ?>`;
            
                if (slug) {
                    $('.slug-verification').removeClass('d-none');
                    $('.slug-verification').html(`
                        <small class="text--info"><i class="las la-spinner la-spin"></i> <?php echo app('translator')->get('Checking'); ?></small>
                    `);
            
                    // Perform slug verification
                    $.get("<?php echo e(route('admin.news.slug.check')); ?>", { slug: slug, id: id }, function(response) {
                        if (!response.exists) {
                            $('.slug-verification').html(`
                                <small class="text--success"><i class="las la-check"></i> <?php echo app('translator')->get('Available'); ?></small>
                            `);
                            closestForm.find('[type=submit]').removeClass('disabled');
                        } else {
                            $('.slug-verification').html(`
                                <small class="text--danger"><i class="las la-times"></i> <?php echo app('translator')->get('Slug already exists'); ?></small>
                            `);
                        }
                    });
                } else {
                    $('.slug-verification').addClass('d-none');
                }
            });
            
            // Function to generate a proper Unicode-friendly slug
            function generateSlug(input) {
                return input
                    .toString()
                    .toLowerCase() // Convert to lowercase
                    .trim() // Remove leading/trailing spaces
                    .replace(/[\s]+/g, '-') // Replace spaces with dashes
            }
        })
    </script>
<?php $__env->stopPush(); ?>

<?php $__env->startPush('style'); ?>
    <style>
        .image-uploader {
            border: 2px dashed #c8c8c8;
        }
    </style>
<?php $__env->stopPush(); ?>
<?php echo $__env->make('staff.layouts.app', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/bdedition/public_html/core/resources/views/staff/news/form.blade.php ENDPATH**/ ?>