<?php $__env->startPush('plugin-styles'); ?>
<?php $__env->stopPush(); ?>

<?php $__env->startSection('content'); ?>
<div class="row">
    <div class="col s12">
        <?php echo $__env->make('componentes._breadcrumbs', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
    </div>

    <div class="col-lg-12 grid-margin stretch-card">
        <div class="card">

            <div class="card-body">

                <?php if(session('status')): ?>
                    <div class="row clearfix">
                        <div class="col-sm-12">
                            <div class="alert alert-success">
                                <?php echo e(session('status')); ?>

                            </div>
                        </div>
                    </div>
                <?php endif; ?>

                <h4 class="card-title">Editar Post</h4>
                <p class="card-description"> </p>

                <?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><br />
                <?php endif; ?>

                <div class="auto-form-wrapper">
                    <form action="<?php echo e(route('blog-post.update', $obj->id)); ?>" method="post" enctype="multipart/form-data">
                        <?php echo e(csrf_field()); ?>

                        <?php echo e(method_field('PUT')); ?>


                        <input type="hidden" name="old_image" value="<?php echo e(isset($obj->image) ? $obj->image : ''); ?>" >
                        <input type="hidden" name="old_mkt" value="<?php echo e(isset($obj->mkt_image) ? $obj->mkt_image : ''); ?>" >
                        <input type="hidden" name="old_mkt_mobile" value="<?php echo e(isset($obj->mkt_mobile) ? $obj->mkt_mobile : ''); ?>" >
                        <input type="hidden" name="old_background" value="<?php echo e(isset($obj->background) ? $obj->background : ''); ?>" >
                        <input type="hidden" name="old_arquivo" value="<?php echo e(isset($obj->arquivo) ? $obj->arquivo : ''); ?>" >
                        <input type="hidden" name="status" value="<?php echo e($obj->status); ?>" >

                        <div class="row clearfix">
                            <div class="col-sm-6">
                                <div class="form-group">
                                    <div class="input-field">
                                        <select name="tipo" id="tipo" class="form-control c-tipo__blog" required>
                                            <option value="">Selecione um tipo</option>
                                            <option value="blog"  <?php echo e($obj->tipo == 'blog' ?  'selected' : ''); ?>>Blog</option>
                                            <option value="case"  <?php echo e($obj->tipo == 'case' ?  'selected' : ''); ?>>Case</option>
                                        </select>
                                    </div>
                                </div>
                            </div>
                            <div class="col-sm-6">
                                <div class="form-group">
                                    <div class="input-field">
                                        <select name="language_id" id="language_id" class="form-control" required>
                                            <option value="">Selecione um Idioma</option>
                                            <option value="pt_br" <?php echo e($obj->language_id == 'pt_br' ?  'selected' : ''); ?>>Português</option>
                                            <option value="es_es" <?php echo e($obj->language_id == 'es_es' ?  'selected' : ''); ?>>Espanhol</option>
                                            <option value="en_us" <?php echo e($obj->language_id == 'en_us' ?  'selected' : ''); ?>>Inglês</option>
                                        </select>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="row clearfix">
                            <div class="col-sm-12">
                                <div class="form-group">
                                    <div class="input-group">
                                        <input type="text" name="title" id="title" class="validate form-control"
                                            value="<?php echo e(isset($obj->title) ?  str_replace("#$#", "𝝨", $obj->title) :  str_replace("#$#", "𝝨", old('title'))); ?>"
                                            Placeholder="Título do Post" required>
                                    </div>
                                </div>
                            </div>
                        </div>      
                        <div class="row clearfix">
                            <div class="col-sm-12">
                                <div class="form-group">
                                    <div class="input-group">
                                        <input type="text" name="subtitle" id="subtitle" class="validate form-control"
                                            value="<?php echo e(isset($obj->subtitle) ?  $obj->subtitle : old('subtitle')); ?>"
                                            Placeholder="Subtítulo do Post" required>
                                    </div>
                                </div>
                            </div>
                        </div>

                        <div class="row clearfix">
                            <div class="col-sm-12">
                                <div class="form-group">
                                    <div class="input-group">
                                        <input type="text" name="shorturl" id="shorturl" class="validate form-control"
                                            value="<?php echo e(isset($obj->shorturl) ?  str_replace("#$#", "𝝨", $obj->shorturl) :  str_replace("#$#", "𝝨", old('shorturl'))); ?>"
                                            Placeholder="Url do Post">
                                    </div>
                                </div>
                            </div>
                        </div>     
                        
                        <div class="row clearfix">
                            <div class="col-sm-6">
                                <div class="form-group">
                                    <div class="input-group">
                                        <input type="file" name="image" id="image" class="form-control">
                                    </div>
                                    <p>Tamanho máximo da imagem: 1920 x 1066px</p>
                                </div>
                            </div>
                        </div>

                        <?php if(isset($obj->image)): ?> 
                        <div class="row clearfix">
                            <div class="col-sm-6">
                                <div class="form-group">
                                    <div class="input-group">
                                    <img src="<?php echo e(isset($obj->image) ?   url('storage/blog/'.$obj->image) : ''); ?>" width="200px" />
                                    </div>
                                </div>
                            </div>
                        </div>
                        <?php endif; ?>

                        
                        <div class="row clearfix">
                            <div class="col-sm-12">
                                <div class="form-group">
                                    
                                    <div class="input-group">
                                        <input type="text" name="alt_image" id="alt_image" class="validate form-control"
                                        value="<?php echo e(isset($obj->alt_image) ?  $obj->alt_image : old('alt_image')); ?>"
                                        Placeholder="Alt Imagem"  />
                                    </div>
                                </div>
                            </div>
                        </div>

                        
                        <div class="background <?php echo e(( $obj->tipo == 'case') ? 'on' : ''); ?>">
                            <div class="row clearfix">
                                <div class="col-sm-6">
                                    <p>Imagem Background</p>
                                    <div class="form-group">
                                        <div class="input-group">
                                            <input type="file" name="background" id="background" class="form-control">
                                        </div>
                                        <p>Tamanho da imagem: 1920 x 1066px</p>
                                    </div>
                                </div>
                            </div>

                            <?php if(isset($obj->background)): ?> 
                            <div class="row clearfix">
                                <div class="col-sm-6">
                                    <div class="form-group">
                                        <div class="input-group">
                                        <img src="<?php echo e(isset($obj->background) ?   url('storage/blog/'.$obj->background) : ''); ?>" width="200px" />
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <?php endif; ?>
                        </div>
                        
                        <div class="row clearfix">
                            <div class="col-sm-12">
                                <div class="form-group">
                                    <p>Descrição</p>
                                    <div class="input-group">
                                        <textarea name="content" id="content" class="description"><?php echo e(isset($obj->content) ?   str_replace("#$#", "𝝨", $obj->content) :  str_replace("#$#", "𝝨", old('content'))); ?></textarea>
                                    </div>
                                </div>
                            </div>
                        </div>
                    
                        <?php
                            $datePubArray = explode(" ", $obj->date_published);
                            $datePub = date('Y-m-d', strtotime($datePubArray[0]));
                        ?>

                        <div class="row clearfix">
                            <div class="col-sm-6">
                                <div class="form-group">
                                    <div class="input-group">
                                        <input type="date" name="date_published" id="date_published" class="validate form-control datepicker"
                                            value="<?php echo e(($obj->date_published) ?  $datePub : old('date_published')); ?>"
                                            Placeholder="Data de Publicação" >
                                    </div>
                                </div>
                            </div>
                            <div class="col-sm-6">
                                <div class="form-group">
                                    <div class="input-group">
                                        <input type="text" name="hour_published" id="hour_published" class="validate form-control" maxlength="5"
                                            value="<?php echo e(($obj->date_published) ?  substr(end($datePubArray),0,5) : old('hour_published')); ?>"
                                            Placeholder="Hora de Publicação" >
                                    </div>
                                </div>
                            </div>
                        </div>     
                        
                        <div class="row clearfix">
                            <div class="col-sm-6">
                                <div class="form-group">
                                    <div class="input-group">
                                        <select name="categorie_id" id="categorie_id" class="validate form-control" required>
                                            <option value="">Selecione uma categoria</option>
                                            <?php if(@$categorias): ?>
                                                <?php $__currentLoopData = $categorias; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $categoria): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                    <option value="<?php echo e($categoria->id); ?>" <?php echo e($categoria->id == @$obj->blogCategory->id  ? 'selected' : ''); ?>>
                                                        <?php echo e($categoria->name); ?>

                                                    </option>
                                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                            <?php endif; ?>
                                        </select>
                                    </div>
                                </div>
                            </div>
                            <div class="col-sm-6">
                                <div class="form-group">
                                    <div class="input-field">
                                        <div class="input-group">
                                            <select name="author_id" id="author_id" class="validate form-control"  >
                                                <option value="">Selecione um Autor</option>
                                                <?php if(@$autores): ?>
                                                    <?php $__currentLoopData = $autores; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $autor): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                        <option value="<?php echo e($autor->id); ?>" <?php echo e($autor->id == @$obj->author_id  ? 'selected' : ''); ?>>
                                                            <?php echo e($autor->name); ?>

                                                        </option>
                                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                                <?php endif; ?>
                                            </select>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>

                        <div class="row clearfix">
                            <div class="col-sm-6">
                                <div class="form-group">
                                    <div class="input-group">
                                        <select name="blog_cta_id" id="blog_cta_id" class="validate form-control" >
                                            <option value="">Selecione um CTA</option>
                                            <?php if(@$ctas): ?>
                                                <?php $__currentLoopData = $ctas; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $cta): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                    <option value="<?php echo e($cta->id); ?>"  <?php echo e($cta->id == @$obj->blogCta->id  ? 'selected' : ''); ?>>
                                                        <?php echo e($cta->title); ?>

                                                    </option>
                                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                            <?php endif; ?>
                                        </select>
                                    </div>
                                </div>
                            </div>
                        </div>

                        <div class="row clearfix">
                            <div class="col-sm-6">
                                <div class="form-group">
                                    <p>Tags</p>
                                    <div class="input-group">
                                        <input type="text" name="tags" id="tags" class="validate form-control"
                                        value="<?php echo e(($obj->tags) ?  $obj->tags : old('tags')); ?>"
                                        Placeholder="Tags" >
                                        
                                    </div><p>Separe as tags por virgula</p>
                                </div>
                            </div>
                        </div>

                        <h5 class="title_section">Form RD Station</h5>
                        <div class="row clearfix">
                            <div class="col-sm-12">
                                <div class="form-group">
                                    <p>Form Rd Station</p>
                                    <div class="input-group">
                                        <textarea name="form_rd" id="form_rd" class="form-control" ><?php echo e(isset($obj->form_rd) ?  $obj->form_rd : old('form_rd')); ?></textarea>
                                    </div>
                                </div>
                            </div>
                        </div>

                        <h5 class="title_section">Arquivo para Download</h5>
                        <div class="row clearfix">
                            <div class="col-sm-6">
                                <p>Arquivo para donwload</p>
                                <div class="form-group">
                                    <div class="input-group">
                                        <input type="file" name="arquivo" id="arquivo" class="form-control">
                                    </div>
                                </div>
                            </div>
                        </div>

                        <?php if(@$obj->arquivo != ''): ?> 
                        <div class="row clearfix">
                            <div class="col-sm-6">
                                <div class="form-group">
                                    <div class="input-group content-img-arquivo">
                                        <a href="<?php echo e(isset($obj->arquivo) ?   url('storage/blog/'.$obj->arquivo) : ''); ?>" target="_blank" style="margin-right: 10px; padding-top:10px">Download</a>
                                        <a title="Remover Arquivo" class="btn btn-icons btn-inverse-danger bt-excluir-img" data-token="<?php echo e(csrf_token()); ?>" data-id="<?php echo e($obj->id); ?>" data-pagina="blog_posts" data-campo="arquivo"><i class="mdi mdi-delete"></i></a>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <?php endif; ?>

                        <div class="row clearfix">
                            <div class="col-sm-12">
                                <div class="form-group">
                                    <div class="input-group">
                                        <input type="text" name="btnfile" id="btnfile" class="validate form-control"
                                            value="<?php echo e(isset($obj->btnfile) ?  $obj->btnfile : old('btnfile')); ?>"
                                            Placeholder="Botão para Download de Arquivo" >
                                    </div>
                                </div>
                            </div>
                        </div>  


                        <h5 class="title_section">Marketing</h5>
                        <div class="row clearfix">
                            <div class="col-sm-6">
                                <div class="form-group">
                                    <p>Banner Desktop</p>
                                    <div class="input-group">
                                        <input type="file" name="mkt_image" id="mkt_image" class="form-control">
                                    </div>
                                    <p>Tamanho máximo da imagem Desktop: 220 x 500px</p>
                                </div>
                            </div>
                        </div>

                        <?php if(($obj->mkt_image != '')): ?> 
                        <div class="row clearfix">
                            <div class="col-sm-6">
                                <div class="form-group content-img-mkt_image">
                                    <div class="input-group">
                                    <img src="<?php echo e(($obj->mkt_image != '') ?   url('storage/blog/'.$obj->mkt_image) : ''); ?>" width="200px" />
                                    <a title="Remover Imagem" class="btn btn-icons btn-inverse-danger bt-excluir-img" data-token="<?php echo e(csrf_token()); ?>" data-id="<?php echo e($obj->id); ?>" data-pagina="blog_posts" data-campo="mkt_image"><i class="mdi mdi-delete"></i></a>    
                                    </div>
                                </div>
                            </div>
                        </div>
                        <?php endif; ?>

                        <div class="row clearfix">
                            <div class="col-sm-6">
                                <div class="form-group ">
                                    <p>Banner Mobile</p>
                                    <div class="input-group">
                                        <input type="file" name="mkt_mobile" id="mkt_mobile" class="form-control">
                                            
                                    </div>
                                    <p>Tamanho máximo da imagem Mobile: 550 x 220px</p>
                                </div>
                            </div>
                        </div>

                        <?php if($obj->mkt_mobile != ''): ?> 
                        <div class="row clearfix">
                            <div class="col-sm-6">
                                <div class="form-group content-img-mkt_mobile">
                                    <div class="input-group">
                                    <img src="<?php echo e(($obj->mkt_mobile != '') ?   url('storage/blog/'.$obj->mkt_mobile) : ''); ?>" width="200px" />
                                    <a title="Remover Imagem" class="btn btn-icons btn-inverse-danger bt-excluir-img" data-token="<?php echo e(csrf_token()); ?>" data-id="<?php echo e($obj->id); ?>" data-pagina="blog_posts" data-campo="mkt_mobile"><i class="mdi mdi-delete"></i></a>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <?php endif; ?>

                        <div class="row clearfix">
                            <div class="col-sm-6">
                                <div class="form-group">
                                    <div class="input-group">
                                        <input type="text" name="mkt_link" id="mkt_link" class="validate form-control"
                                        value="<?php echo e(isset($obj->mkt_link) ?  $obj->mkt_link : old('mkt_link')); ?>"
                                        Placeholder="Link Banner Marketing"  />
                                    </div>
                                </div>
                            </div>
                            <div class="col-sm-6">
                                <div class="form-group">
                                    <div class="input-group">
                                        <select name="mkt_target" id="mkt_target" class="form-control" >
                                            <option value="">Selecione um Target</option>
                                            <option value="0" <?php echo e(($obj->mkt_target == 0) ?  "selected" : ''); ?>>Abrir na mesma Aba</option>
                                            <option value="1" <?php echo e(($obj->mkt_target == 1) ?  "selected" : ''); ?>>Abrir em nova Aba</option>
                                        </select>
                                        
                                    </div>
                                </div>
                            </div>
                        </div>
                        
                        
                        <h5 class="title_section">Meta Tags</h5>
                        <div class="row clearfix">
                            <div class="col-sm-12">
                                <div class="form-group">
                                    <div class="input-group">
                                        <input type="text" name="meta_title" id="meta_title" class="validate form-control"
                                            value="<?php echo e(isset($obj->meta_title) ?  $obj->meta_title : old('meta_title')); ?>"
                                            Placeholder="Meta Title" >
                                    </div>
                                </div>
                            </div>
                        </div>

                        <div class="row clearfix">
                            <div class="col-sm-12">
                                <div class="form-group">
                                    <div class="input-group">
                                        <input type="text" name="meta_description" id="meta_description" class="validate form-control"
                                            value="<?php echo e(isset($obj->meta_description) ?  $obj->meta_description : old('meta_description')); ?>"
                                            Placeholder="Meta Description" >
                                    </div>
                                </div>
                            </div>
                        </div>
                    
                       
                        <div class="row clearfix">
                            <div class="col-sm-2">
                                <button class="btn btn-primary submit-btn btn-block">Atualizar</button>
                            </div>
                        </div>

                    </form>
                </div>

            </div>
            

            <div class="card-body">
                <h4 class="card-title">Adicionar Posts Relacionados</h4>
                <div class="row clearfix">
                    <div class="col-sm-4">
                        <div class="form-group">
                            <div class="input-group">
                                <select name="bscCategory" id="bscCategory" class="validate form-control" >
                                    <option value="">Procurar uma categoria</option>
                                    <?php if(@$categorias): ?>
                                        <?php $__currentLoopData = $categorias; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $categoria): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                            <option value="<?php echo e($categoria->id); ?>">
                                                <?php echo e($categoria->name); ?>

                                            </option>
                                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                    <?php endif; ?>
                                </select>
                            </div>
                        </div>
                    </div>
                    <div class="col-sm-4">
                        <div class="form-group">
                            <div class="input-group">
                                <input type="text" name="bscTitle" id="bscTitle" class="validate form-control"
                                    value=""
                                    Placeholder="Procurar um Post" >
                            </div>
                        </div>
                    </div>
                    <div class="col-sm-4">
                        <div class="form-group">
                            <div class="input-group">
                                <button id="filter-btn" >Procurar</button>
                            </div>
                        </div>
                    </div>
                </div>

                <form action="<?php echo e(route('blog-post.relacionados.store', $obj->id)); ?>" method="post" enctype="multipart/form-data">
                    <?php echo e(csrf_field()); ?>

                    <div class="row clearfix">
                        <div class="col-sm-8">
                            <div class="form-group">
                                <div class="input-group">
                                    <select name="post_id[]" id="post_id" class="form-multiselect" multiple>
                                        <?php if(@$posts): ?>
                                            <?php $__currentLoopData = $posts; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $post): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                <option value="<?php echo e($post->id); ?>"><?php echo e($post->title); ?></option>
                                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                        <?php endif; ?>
                                    </select>
                                </div>
                            </div>
                        </div>
                        <div class="col-sm-2">
                            <button class="btn btn-primary submit-btn btn-block">Adicionar</button>
                        </div>
                    </div>
                    
                </form>
               
                <div class="clientes">
                    <?php if($relacionados): ?> 
                        <?php $__currentLoopData = $relacionados; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $rel): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                            <div class="cliente_item">
                                <div class="box-sizing"><p><?php echo e(@$rel['post']->title); ?></p></div>
                                <form action="<?php echo e(route('blog-post.relacionados.destroy', $rel['rel_id'])); ?>" method="post" class="excluir_item box-sizing">
                                    <?php echo e(method_field('DELETE')); ?>

                                    <?php echo e(csrf_field()); ?>

                                    <button title="Deletar" class="btn btn-icons" href="#"><i class="mdi mdi-delete"></i></button>
                                </form> 
                            </div>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                    <?php endif; ?>
                </div>      
            </div>

            
        </div>

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

<?php $__env->startPush('plugin-scripts'); ?>
<?php $__env->stopPush(); ?>

<?php $__env->startPush('custom-scripts'); ?>
<?php $__env->stopPush(); ?>
<?php echo $__env->make('layout.master', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /var/www/site.apoiocotacoes.com.br/apoio/resources/views/admin/blog-post/editar.blade.php ENDPATH**/ ?>