<?php echo csrf_field(); ?>
<div class='row'>
  <div class="col-md-12 col-sm-12  ">
    <div class="x_panel">
      <!--<div class="x_title">
        <h2>subtitulo</h2>
        <ul class="nav navbar-right panel_toolbox">
          <li><a class="collapse-link"><i class="fa fa-chevron-up"></i></a>
          </li>
          <li class="dropdown">
            <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"><i class="fa fa-wrench"></i></a>
            <div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
                <a class="dropdown-item" href="#">Settings 1</a>
                <a class="dropdown-item" href="#">Settings 2</a>
              </div>
          </li>
          <li><a class="close-link"><i class="fa fa-close"></i></a>
          </li>
        </ul>
        <div class="clearfix"></div>
      </div>-->
      <div class="x_content">
        @if($catalogos->count()>0)
          <div class="table mt-3" id='div_listado'>
            <div class="row encabezado">
              <div class="col-md-2 col-sm-2 d-none d-sm-block">ID</div>
              <div class="col-md-2 col-sm-2 d-none d-sm-block">Año</div>
              <div class="col-md-2 col-sm-2 d-none d-sm-block">Fecha Inicio</div>
              <div class="col-md-2 col-sm-2 d-none d-sm-block">Fecha Termino</div>
              <div class="col-md-2 col-sm-2 d-none d-sm-block">Estado</div>
              <div class="col-md-2 col-sm-2 d-none d-sm-block">Acciones</div>
            </div>
            <div class="row contenido-500">
              <div class="col-md-12">
                @foreach ($catalogos as $c)
                  <div class="row cuerpo">
                    <div class="col-6 d-block d-sm-none bg-dark-blue text-white text-center">ID</div>
                    <div class="col-md-2 col-sm-2 col-6 d-block d-sm-none bg-dark-blue text-white text-center">{{ $c->id }}</div>
                    <div class="col-md-2 col-sm-2 col-6 d-none d-sm-block text-center">{{ $c->id }}</div>
                    
                    <div class="col-6 d-block d-sm-none text-center">Año</div>
                    <div class="col-md-2 col-sm-2 col-6 text-center">{{ $c->anio }}</div>

                    <div class="col-6 d-block d-sm-none text-center">Fecha Inicio</div>
                    <div class="col-md-2 col-sm-2 col-6 text-center">{{ $c->inicio->format('d/m/Y') }}</div>

                    <div class="col-6 d-block d-sm-none text-center">Fecha Termino</div>
                    <div class="col-md-2 col-sm-2 col-6 text-center">{{ $c->termino->format('d/m/Y') }}</div>

                    <div class="col-6 d-block d-sm-none text-center">Estado</div>
                    <div class="col-md-2 col-sm-2 col-6 text-center">
                      @switch($c->estado)
                          @case(1) En proceso de captura @break
                          @case(2) En Firma Subdirección @break
                          @case(3) Autorizado @break
                          @default Perdido
                      @endswitch
                    </div>
                  
                    <div class="col-6 d-block d-sm-none text-center">Acciones</div>
                    <div class="col-md-2 col-sm-2 col-6 text-center" >
                      <div class="btn-group btn-group-xs" role="group" aria-label="...">
                        <!--respetar los colores y botones para consultar, modificar y eliminar -->
                        @can('catalogo_consultar')
                          <button class="btn btn-outline-warning" type="button" data-toggle="popover" data-trigger="hover" data-placement="left" data-content="Consultar" onclick="javascript:catalogo_consultar('{{ $c->id }}')"><i class="fa fa-folder-open-o"></i></button>
                        @endcan
                        @if ($c->estado==3)
                          @can('catalogo_exportar')
                            <a class="btn btn-outline-secondary" data-toggle="popover" data-trigger="hover" data-placement="left" data-content="Exportar Catálogo de Proveedores Aprobados" href="/proveedorCatalogo/exportar/{{ $c->id }}"><i class="fa fa-cloud-download"></i></a>
                          @endcan
                        @endif
                      </div>
                    </div>
                    
                  </div>
                @endforeach
              </div>
            </div>
          </div>

          <div id="show_datos"></div>
        @else
          <div class="row">
            <div class="col-lg-12 col-md-12 text-center">
              <h2>Aun no se han registrado catálogos!!.</h2>
            </div>
          </div>
        @endif
      </div>
    </div>
  </div>
</div>


