@php
  $search = isset($_GET['search']) ? $_GET['search'] : $_GET['search']= '';
@endphp
<div class="card prodcard">
  <div class="card-body">
    <form action="{{route('admin.pesqMarca')}}" method="get">
      {{ csrf_field() }}
      <div class="input-group mb-sm-3">
        <input type="text" class="form-control" name="search" placeholder="Ex: Marca" value="{{$search}}">
        <div class="input-group-append">
          <button class="btn btn-outline-secondary" type="submit">Pesquisar</button>
        </div>
        <div class="input-group-append">
          <button class="btn btn-outline-secondary" type="button"
                  onclick="location.href = '{{ route('admin.cadastrarMarca') }}'">Cadastrar
          </button>
        </div>
      </div>
    </form>
    <table class="table table-sm table-hover ">{{-- table-bordered --}}
      <thead>
      <tr class="row small">
        <th class="col-xs-2 col-sm-2 col-md-2 col-lg-2">Código</th>
        <th class="col-xs-7 col-sm-7 col-md-7 col-lg-5">Descrição</th>
        <th class="text-center col-xs-3 col-sm-3 col-md-3 col-lg-5">Ação</th>
      </tr>
      </thead>
      <tbody>
      @foreach ($marcaspro as $marca)

        <tr class="row">
          <td class="col-xs-2 col-sm-2 col-md-2 col-lg-2">{{$marca->codigo}}</td>
          <td class="col-xs-5 col-sm-5 col-md-5 col-lg-5">{{$marca->descricao}}</td>
          <td class="text-center col-xs-3 col-sm-3 col-md-3 col-lg-5">
            {{--		    	<button class="btn btn-sm btn-outline-success col-lg-4 col-md-6 col-sm-12" type="button" data-toggle="modal" data-target="#modalEditar{{$prod->codigo}}">Editar</button>--}}
            <button class="btn btn-sm btn-outline-success col-lg-4 col-md-6 col-sm-12" type="submit"
                    onclick="location.href = '{{ route('admin.manMarca',$marca->codigo) }}'">Editar
            </button>
            <button class="btn btn-sm btn-outline-danger col-lg-4 col-md-6 col-sm-12" type="button" data-toggle="modal"
                    data-target="#modalDel{{$marca->codigo}}">Deletar
            </button>
          </td>
        </tr>
        {{-- modaldel --}}
        <div class="modal fade" id="modalDel{{$marca->codigo}}" tabindex="-1" role="dialog"
             aria-labelledby="modalDel.{{$marca->codigo}}" aria-hidden="true">
          <div class="modal-dialog modal-dialog" role="document">
            <div class="modal-content">
              <div class="modal-header text-right">
                <h5 class="text-center">Deseja realmente excluir esta Marca?</h5>
              </div>
              <div class=" modal-footer align-content-center">
                <button type="button" class="btn btn-secondary" data-dismiss="modal">Fechar</button>
                <button type="button" class="btn btn-danger "
                        onclick="location.href = '{{ route('admin.deleteMarca',$marca->codigo  ) }}'">Excluir
                </button>
              </div>
            </div>
          </div>
        </div>
      @endforeach
      </tbody>
    </table>
    <div class="row justify-content-sm-center pagprod">
      {{ $marcaspro->links() }}
    </div>
  </div>
</div>

