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

<main id="main" class="main">
    <?php if( Session::get('permissions.user_type') == 'A' || Session::get('permissions.user_type') == 'SA'): ?>
        <div class="page-breadcrumb">
            <div class="row">
                <div class="col-12 d-flex no-block align-items-center justify-content-between px-4 mb-2">
                    <h4 class="page-title">Create Blog</h4>
                    <div class="ml-auto text-right">
                        <a href="<?php echo e(url('admin/blog/list/')); ?>/<?php echo e($site_id); ?>" class="btn btn-outline-info">Back</a>
                    </div>
                </div>
            </div>
        </div>

        <div class="container-fluid">
            <div class="row">
                <div class="col-12">
                    <div class="card">

                        <?php $__currentLoopData = ['danger', 'warning', 'success', 'info']; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $msg): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                            <?php if(Session::has('alert-' . $msg)): ?>
                                <h4 class="font-weight-light alert alert-<?php echo e($msg); ?>"><?php echo e(Session::get('alert-' . $msg)); ?></h4>
                            <?php endif; ?>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                        <form action="<?php echo e(url('admin/blog/add/')); ?>/<?php echo e($site_id); ?>" method="POST" class="form-horizontal" id="formadd" enctype="multipart/form-data">
                            <?php echo csrf_field(); ?>
                            <div class="card-body">
                                <h4 class="card-title">Create Blog</h4>
                                <input type="hidden" name="site_id" value="<?php echo $site_id; ?>">
                                <div class="form-group m-t-20">
                                    <label>Blog Slug<span>*</span></label>
                                    <div class="input-group">
                                        <input type="text" class="form-control" id="blog_slug" name="blog_slug" placeholder="Enter Blog Slug" required>
                                        
                                    </div>
                                </div>
                                <div class="form-group m-t-20">
                                    <label>Blog Image<span></span></label>
                                    <input type="file" class="form-control" id="blog_image" name="blog_image" value="" placeholder="Enter Blog Image">
                                    
                                    <?php if($errors->has('blog_image')): ?>
                                        <span class="text-danger"><?php echo e($errors->first('blog_image')); ?></span>
                                    <?php endif; ?>
                                </div>

                                <div class="form-group m-t-20">
                                    <label>Blog Date</label>
                                    <input type="datetime-local" class="form-control" id="blog_date" name="blog_date" placeholder="Enter Blog Date" required>
                                </div>
                                
                                <div class="form-group m-t-20">
                                    <label>Blog Heading</label>
                                    <textarea class="form-control" rows="5" id="blog_heading" name="blog_heading" placeholder="Enter Blog Heading" required></textarea>
                                </div>
                                
                                <div class="form-group m-t-20">
                                    <label>Blog Content</label>
                                    <textarea class="form-control" rows="5" id="blog_content" name="blog_content" placeholder="Enter Blog Content" required></textarea>
                                </div>
                                <div class="form-group m-t-20">
                                    <label>Meta Title</label>
                                    <input type="text" class="form-control" id="blogmeta_title" name="blogmeta_title" placeholder="Enter Meta Title" required>
                                </div>
                                <div class="form-group m-t-20">
                                    <label>Meta Description</label>
                                    <textarea class="form-control" rows="5" id="blogmeta_description" name="blogmeta_description" placeholder="Enter Meta Description" required></textarea>
                                </div>
                            </div>
                            <div class="border-top">
                                <div class="card-body">
                                    <input class="btn btn-primary" type="submit" value="CREATE">
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    <?php endif; ?> 

</main>

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-validate/1.19.5/jquery.validate.min.js"></script>
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" rel="stylesheet">
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.bundle.min.js"></script>
<script src="https://cdn.ckeditor.com/4.14.0/standard/ckeditor.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.13.18/css/bootstrap-select.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.13.18/js/bootstrap-select.min.js"></script>   

<script type="text/javascript">
    $.validator.setDefaults({
            submitHandler: function(form) {
                form.submit();
            }
    });

    $(document).ready(function () {
        setTimeout(function () {
            $('.cke_notifications_area').attr("style", "display: none !important");
        }, 1000); // 60000ms = 1 minute
    });

    $(function() {
        // validate the comment form when it is submitted
        $("#formadd").validate({
            ignore: [],
            errorPlacement: function(label, element) {
                label.addClass('mt-2 text-danger');
                label.insertAfter(element);
            },
            highlight: function(element, errorClass) {
                $(element).parents('.form-group').addClass('has-danger')
                $(element).addClass('form-control-danger')
            }

          });
    });

    CKEDITOR.replace("blog_content");

    $('#title').on('blur', function(){
        var title = $.trim($(this).val());
        if(title != ''){
            //if($.trim($('#slug').val()) == ''){
                $('#slug').val(title.replace(/ /g,"-").toLowerCase());
                $('#slug-error').hide();
            //}
        }

    });

</script>    

<?php $__env->stopSection(); ?>


<?php echo $__env->make('layouts.admin.app', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/rightflorist/public_html/ofadmin.rightflorist.org/resources/views/admin/blog/add.blade.php ENDPATH**/ ?>