@extends('crm-admin::main-layout')
@section('breadcrumb')
  <li class="breadcrumb-item">
    <a href="{{route('home')}}">Home</a>
  </li>
  <li class="breadcrumb-item active">
    Landings
  </li>
@endsection

@section("content")
<div class='row'>
  <div class='col-md-12'>
    <div class='box'>
      <div class='box-header dark'>
        <h2>
          Landings
          <span>
            <a class='btn btn-xs btn-info button-ml' href="{{route('landings.admin.landings.create')}}">
              <i class='fas fa-plus'></i>
              Agregar Landing
            </a>
          </span>
        </h2>
      </div>
      <div class='box-body'>
        <div class='col-md-12'>
          <table class='table'>
            <tr>
              <th width="10%" class="text-center">#</th>
              <th width="25%" class="text-center">Nombre</th>
              <th width="25%" class="text-center">Banner</th>
              <th width="20%" class="text-center">Formato</th>
              <th width="20%"></th>
            </tr>
            <tbody>
              @if ($landings->isEmpty())
                <tr>
                  <td colspan="5" class="text-center">
                    No hay landings registradas
                  </td>  
                </tr>
              @else
                @foreach($landings as $landing)
                  <tr>
                    <td>{{$landing->id}}</td>
                    <td>
                      <strong>Nombre:</strong> {{$landing->name}}<br/>
                      <strong>Slug:</strong> {{$landing->slug}}
                    </td>
                    <td class="text-center">
                      @if($landing->image_path != null)
                        <img src="{{asset('storage/'. $landing->image_path)}}" width="100%">
                      @else
                        No banner  
                      @endif
                    </td>
                    <td>{{$landing->formato}}</td>
                    <td class="text-center">
                       {!! Form::open(['route'=> ['landings.admin.landings.destroy',$landing->id],'method'=>'DELETE'])!!}
                          <button class='btn btn-danger btn-xs button-mb' onclick="return confirm('¿Estás seguro de eliminar este elemento?');" type='submit'>
                            <i class='fas fa-trash-alt icon-special-size'></i>
                            Eliminar
                          </button>
                        {!! Form::close()!!}
                        <a class='btn btn-xs accent' href="{{route('landings.admin.landings.edit', $landing->id)}}">
                          <i class='fas fa-edit icon-special-size'></i>
                          Editar
                        </a>
                    </td>
                  </tr>  
                @endforeach
              @endif
            </tbody>
          </table>
        </div>
      </div>
      <div class='dker p-a text-right'>
      </div>
    </div>
  </div>
</div>
@endsection