@include('admin.header', [
   'elementActive' => 'posts'
])
<div class="content-wrapper">
    <section class="content-header">
       <h1>
          Postagens	      <small></small>
       </h1>
    </section>
    <!-- Main content -->
    <section class="content">
       <div class="row">
          <div class="col-xs-12">


            <section class="content">
                <div class="row">        	
                    <div class="col-xs-12">
                  
        
                    <div class="nav-tabs-custom">
        
   
        
                          <div class="tab-content">
        
                              
                              <form action="{{ route('admin.posts.update', $post->id) }}" class="form-horizontal" method="post" enctype="multipart/form-data">  						
                                @csrf
                                @method('put')
                                  <fieldset>
                                      
                                    <div class="form-group">
                                          <label class="col-md-12">Titulo</label>
                                          <div class="col-md-6">
                                              <input name="title" type="text" class="form-control" value="{{ $post->title }}">
                                          </div>
                                    </div>
        

                                    <div class="form-group">
                                        <label class="col-md-12">Thumbnail</label>
                                        <div class="col-md-12">
                   
                                           <fieldset> 
                                               <img src="{{ asset($post->thumbnail) }}" width="300px">
                                               <hr/>
                                              <div class="fileupload fileupload-new" data-provides="fileupload">
                                                  <div class="input-append">
                                                    <div class="uneditable-input">
                                                      <i class="fa fa-file fileupload-exists"></i>
                                                      <span class="fileupload-preview"></span>
                                                    </div>
                                                    <span class="btn btn-default btn-file">
                                                    <span class="fileupload-exists">Alterar</span>
                                                    <span class="fileupload-new">Procurar arquivo</span>
                                                      <input type="file" name="thumbnail">
                                                    </span>
                                                    <a href="#" class="btn btn-default fileupload-exists" data-dismiss="fileupload">Remover</a>
                                                  </div>
                                              </div>
                                            </fieldset>
                                            <br>
                                            <span style="color: #ff0000;"><strong>Tamanho ideal: Largura 600 x Altura 443</strong></span>
                      
                      
                                        </div>
                                     </div>


                                    <div class="form-group">
                                        <label class="col-md-12">Autor</label>
                                        <div class="col-md-6">
                                            <input name="author" type="text" class="form-control" value="{{ $post->author }}">
                                        </div>
                                  </div>
        
                                    <div class="form-group">
                                    <label class="col-md-12">Grupo/Categoria</label>
                                    <div class="col-md-6">
                                        <select name="id_post_category" class="form-control" >
                                            @foreach ($categories as $category)
                                                <option {{ $post->id_post_category == $category->id ? 'selected' : '' }} value="{{ $category->id }}">{{ $category->name }}</option>
                                            @endforeach
                                        </select>
                                    </div>
                                    </div>
                    
                                    <div class="form-group">
                                        <label class="col-md-12">Prévia</label>
                                        <div class="col-md-6">
                                            <textarea class="form-control" name="summary" rows="5">{{ $post->summary }}</textarea>
                                    </div>
                                    </div>
                    
                                    <div class="form-group">
                                        <label class="col-md-12">Conteúdo</label>
                                        <div class="col-md-12">
                                            <textarea  name="content" rows="10">{{ $post->content }}</textarea>
                                        </div>
                                    </div>
                    
                                </fieldset>
                    
                                <div>
                                    <button type="submit" class="btn btn-primary">Salvar</button>
                                    <a href="{{ route('admin.posts.index') }}"><button type="button" class="btn btn-default">Voltar</button></a>
                                    </div>
                                  
                            </form>         
        
        
                    </div>
            
                </div>
                    </div>
                    <!-- /.row -->
                </div>
            </section>
            
          </div>
       </div>
       <!-- /.row -->
    </section>
    <!-- /.content -->
 </div>
@include('admin.footer')


<script>
    CKEDITOR.replace( 'content', {
        filebrowserUploadUrl: "{{route('admin.posts.upload', ['_token' => csrf_token() ])}}",
        filebrowserUploadMethod: 'form',
        image_previewText: ' ',
        removeButtons: 'Save',
        extraPlugins: 'emojione'
    });
    
    CKEDITOR.config.allowedContent = true;
    CKEDITOR.config.fillEmptyBlocks = false;
    
    CKEDITOR.instances.content.on('blur', function() {
        verifyNewsletterBodyTerms(CKEDITOR.instances.content.getData());
    });
</script>
