@extends('crm-admin::main-layout')
@section('breadcrumb')
  <li class="breadcrumb-item">
    <a href="{{route('home')}}">Home</a>
  </li>
  <li class="breadcrumb-item">
    <a href="{{route('landings.admin.landings.index')}}">Landings</a>
  </li>
  <li class="breadcrumb-item active">
    {{$landing->name}}
  </li>
@endsection
@section('content')
<div class='row'>
  <div class='col-md-12'>
    <div class='box'>
      <div class='box-header dark'>
        <h2>Actualizar información</h2>
      </div>
      <div class='box-body'>
        {!! Form::model($landing,['route'=> ['landings.admin.landings.update',$landing],"method"=>"PUT", 'enctype'=>'multipart/form-data']) !!}
        @include('landings::landings.fields')
      </div>
      <div class='dker p-a text-right'>
        <div class='col-md-12'>
          <a class='btn danger' href="{{route('landings.admin.landings.index')}}" style='margin-right:10px'>Cancelar</a>
          <button class='btn dark' type='submit'>
            Registrar
          </button>
          {!! Form::close() !!}
        </div>
      </div>
    </div>
  </div>
</div>

<div class='modal fade' data-backdrop='true' id='ver'>
  <div class='modal-dialog modal-lg'>
    <div class='modal-content box-shadow-z3'>
      <div class='modal-body text-center p-lg'>
        @if ($landing->image_path == null)
        <h4> No hay imagen asignada</h4>
        @else
          <img class='image-modal-preview' src="{{asset('storage/'.$landing->image_path)}}">
        @endif
      </div>
      <div class='modal-footer'>
        <button class='btn dark p-x-md' data-dismiss='modal' type='button'>Cerrar</button>
        @if($landing->image_path != null)
          {!! Form::open(['route'=> ['landings.admin.landings.delete_image',$landing->id],'method'=>'DELETE'])!!}
            <button class='btn btn-danger button-mb' onclick="return confirm('¿Estás seguro de eliminar este elemento?');" type='submit'>
              <i class='fas fa-trash-alt icon-special-size'>
                Eliminar
              </i>
            </button>
          {!! Form::close()!!}
        @endif
      </div>
    </div>
    <!-- /.modal-content -->
  </div>
</div>
@endsection
@section('script_extras')
  <script src='{{asset("/assets/ckeditor-f/ckeditor.js")}}'></script>
  <script>
    var options = {
      filebrowserImageBrowseUrl: '/laravel-filemanager?type=Images',
      filebrowserImageUploadUrl: '/laravel-filemanager/upload?type=Images&_token=',
      filebrowserBrowseUrl: '/laravel-filemanager?type=Files',
      filebrowserUploadUrl: '/laravel-filemanager/upload?type=Files&_token='
    };
  </script>
  <script>CKEDITOR.replace('contenidos', options);</script>
@endsection