<?php $__env->startSection('style'); ?>
    <link rel="stylesheet" href="<?php echo e(asset('assets/backend/css/bootstrap-tagsinput.css')); ?>">
    <link rel="stylesheet" href="<?php echo e(asset('assets/backend/css/summernote-bs4.css')); ?>">
    <link rel="stylesheet" href="<?php echo e(asset('assets/backend/css/dropzone.css')); ?>">
    <link rel="stylesheet" href="<?php echo e(asset('assets/backend/css/media-uploader.css')); ?>">
<?php $__env->stopSection(); ?>
<?php $__env->startSection('site-title'); ?>
    <?php echo e(__('Edit BLog')); ?>

<?php $__env->stopSection(); ?>
<?php $__env->startSection('content'); ?>
    <div class="col-lg-12 col-ml-12 padding-bottom-30">
        <div class="row">
            <div class="col-lg-12">
                <div class="margin-top-40"></div>
                <?php echo $__env->make('backend/partials/message', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
                <?php if($errors->any()): ?>
                    <div class="alert alert-danger">
                        <ul>
                            <?php $__currentLoopData = $errors->all(); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $error): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <li><?php echo e($error); ?></li>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                        </ul>
                    </div>
                <?php endif; ?>
            </div>
            <div class="col-lg-12 mt-5">
            <div class="card">
                <div class="card-body">
                   <div class="header-wrap">
                       <h4 class="header-title"><?php echo e(__('Edit Blog Post')); ?>

                          <a href="<?php echo e(route('admin.blog')); ?>" class="btn btn-info btn-xs pull-right"><i class="fas fa-angle-double-left"></i><?php echo e(__('All Blogs')); ?></a>
                       </h4>

                       <form action="<?php echo e(route('admin.blog.update',$blog_post->id)); ?>" method="post" enctype="multipart/form-data">
                           <?php echo csrf_field(); ?>
                           <div class="row">
                               <div class="col-lg-8">
                                   <div class="form-group">
                                       <label for="language"><strong><?php echo e(__('Language')); ?></strong></label>
                                       <select name="lang" id="language" class="form-control"style="height:42px;">
                                           <?php $__currentLoopData = $all_languages; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $lang): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                               <option <?php if($lang->slug == $blog_post->lang): ?> selected <?php endif; ?> value="<?php echo e($lang->slug); ?>"><?php echo e($lang->name); ?></option>
                                           <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                       </select>
                                   </div>
                                   <div class="form-group">
                                       <label for="title"><?php echo e(__('Title')); ?></label>
                                       <input type="text" class="form-control"  id="title" name="title" value="<?php echo e($blog_post->title); ?>">
                                   </div>
                                   <div class="form-group">
                                       <label><?php echo e(__('Content')); ?></label>
                                       <input type="hidden" name="blog_content" value="<?php echo e($blog_post->content); ?>">
                                       <div class="summernote" data-content='<?php echo e($blog_post->content); ?>'></div>
                                   </div>
                                   <div class="form-group">
                                       <label for="meta_title"><?php echo e(__('Meta Title')); ?></label>
                                       <input type="text" name="meta_title" value="<?php echo e($blog_post->meta_title); ?>" class="form-control">
                                   </div>
                                   <div class="form-group">
                                       <label for="meta_tags"><?php echo e(__('Meta Tags')); ?></label>
                                       <input type="text" name="meta_tags" value="<?php echo e($blog_post->meta_tags); ?>" class="form-control" data-role="tagsinput" id="meta_tags">
                                   </div>
                                   <div class="form-group">
                                       <label for="meta_description"><?php echo e(__('Meta Description')); ?></label>
                                       <textarea name="meta_description"  class="form-control" rows="5" id="meta_description"><?php echo e($blog_post->meta_description); ?></textarea>
                                   </div>
                               </div>
                               <div class="col-lg-4">
                                   <div class="form-group">
                                       <label for="title"><?php echo e(__('Slug')); ?></label>
                                       <input type="text" class="form-control"  id="slug"  name="slug" value="<?php echo e($blog_post->slug); ?>">
                                   </div>
                                   <div class="form-group">
                                       <label for="title"><?php echo e(__('Excerpt')); ?></label>
                                       <textarea name="excerpt" id="excerpt" class="form-control max-height-150" cols="30" rows="10"><?php echo e($blog_post->excerpt); ?></textarea>
                                   </div>

                                   <div class="form-group">
                                       <label for="category"><?php echo e(__('Category')); ?></label>
                                       <select name="category" class="form-control" id="category" style="height:45px;">
                                           <option value=""><?php echo e(__("Select Category")); ?></option>
                                           <?php $__currentLoopData = $all_category; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $category): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                               <option <?php if($blog_post->blog_categories_id == $category->id): ?> selected <?php endif; ?> value="<?php echo e($category->id); ?>"><?php echo e($category->name); ?></option>
                                           <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                       </select>
                                   </div>
                                   <div class="form-group">
                                       <label for="title"><?php echo e(__('Tags')); ?></label>
                                       <input type="text" class="form-control" value="<?php echo e($blog_post->tags); ?>" name="tags" data-role="tagsinput">
                                   </div>
                                   <div class="form-group">
                                       <label for="author"><?php echo e(__('Author Name')); ?></label>
                                       <input type="text" class="form-control" name="author" id="author" value="<?php echo e($blog_post->author); ?>">
                                   </div>
                                   <div class="form-group">
                                       <label for="status"><?php echo e(__('Status')); ?></label>
                                       <select name="status" id="status" class="form-control">
                                           <option <?php if($blog_post->status == 'publish'): ?> selected <?php endif; ?> value="publish"><?php echo e(__('Publish')); ?></option>
                                           <option <?php if($blog_post->status == 'draft'): ?> selected <?php endif; ?> value="draft"><?php echo e(__('Draft')); ?></option>
                                       </select>
                                   </div>
                                   <div class="form-group">
                                       <label for="image"><?php echo e(__('Image')); ?></label>
                                       <div class="media-upload-btn-wrapper">
                                           <div class="img-wrap">
                                               <?php
                                                   $blog_img = get_attachment_image_by_id($blog_post->image,null,true);
                                                   $blog_image_btn_label = 'Upload Image';
                                               ?>
                                               <?php if(!empty($blog_img)): ?>
                                                   <div class="attachment-preview">
                                                       <div class="thumbnail">
                                                           <div class="centered">
                                                               <img class="avatar user-thumb" src="<?php echo e($blog_img['img_url']); ?>" alt="">
                                                           </div>
                                                       </div>
                                                   </div>
                                                   <?php  $blog_image_btn_label = 'Change Image'; ?>
                                               <?php endif; ?>
                                           </div>
                                           <input type="hidden" id="edit_image" name="image" value="<?php echo e($blog_post->image); ?>">
                                           <button type="button" class="btn btn-info media_upload_form_btn" data-btntitle="Select Blog Image" data-modaltitle="Upload Blog Image" data-toggle="modal" data-target="#media_upload_modal">
                                               <?php echo e(__($blog_image_btn_label)); ?>

                                           </button>
                                       </div>
                                       <small><?php echo e(__('Recommended image size 1920x1280')); ?></small>
                                   </div>
                                   <button type="submit" class="btn btn-primary mt-4 pr-4 pl-4"><?php echo e(__('Update Post')); ?></button>
                               </div>
                           </div>
                       </form>
                   </div>

                </div>
            </div>
        </div>
        </div>
    </div>
     <?php echo $__env->make('backend.partials.media-upload.media-upload-markup', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
<?php $__env->stopSection(); ?>
<?php $__env->startSection('script'); ?>
    <script src="<?php echo e(asset('assets/backend/js/summernote-bs4.js')); ?>"></script>
    <script src="<?php echo e(asset('assets/backend/js/bootstrap-tagsinput.js')); ?>"></script>
    <script>
    $(document).ready(function () {
           $('.summernote').summernote({
               height: 400,   //set editable area's height
               codemirror: { // codemirror options
                   theme: 'monokai'
               },
               callbacks: {
                   onChange: function(contents, $editable) {
                       $(this).prev('input').val(contents);
                   }
               }
           });
           if($('.summernote').length > 0){
               $('.summernote').each(function(index,value){
                   $(this).summernote('code', $(this).data('content'));
               });
           }

           $(document).on('change','#language',function(e){
               e.preventDefault();
               var selectedLang = $(this).val();
               $.ajax({
                   url: "<?php echo e(route('admin.blog.lang.cat')); ?>",
                   type: "POST",
                   data: {
                       _token : "<?php echo e(csrf_token()); ?>",
                       lang : selectedLang
                   },
                   success:function (data) {
                       $('#category').html('<option value="">Select Category</option>');
                       $.each(data,function(index,value){
                           $('#category').append('<option value="'+value.id+'">'+value.name+'</option>')
                       });
                   }
               });
           });

       });
    </script>
    <script src="<?php echo e(asset('assets/backend/js/dropzone.js')); ?>"></script>
    <?php echo $__env->make('backend.partials.media-upload.media-js', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('backend.admin-master', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/xgenxchi/public_html/laravel/zixer/@core/resources/views/backend/pages/blog/edit.blade.php ENDPATH**/ ?>