<?php $__env->startSection('content'); ?>
  <?php if(Session::has('message')): ?>
    <div class="row">
      <div class="col-md-12">
        <div class="alert alert-<?= Session::get('class') ?>">
          <?=Session::get('message')?>
          <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>
        </div>
      </div>
    </div>
  <?php endif; ?>
  <div class="panel panel-defalt">
    <div class="panel-heading">
      <div class="col-md-12">
        <h3 class="box-title">Cadastro de Clientes</h3>
      </div>
    </div>

    <div class="row">
      <div class="col-md-12">
        <div class="panel-body">

          <div class="box box-primary" >
            <div class="panel-heading">
              <h4><strong>Busca</strong></h4>
            </div>
            <div class="panel-body">
              <div class="row">
                <form class="form" action="<?php echo e(URL::to('admin/clientes/busca')); ?>" method="post">
                  <div class=" col-md-6 form-group">
                    <input type="hidden" name="_token" value="<?php echo e(csrf_token()); ?>" />
                    <input type="hidden" name="offset" value="<?php echo e($offset); ?>" />
                    <label for="nome">Nome</label>
                    <input type="text" class="form-control" id="nome" name="nome" value="<?php echo e($nome); ?>">
                  </div>
                  <div class=" col-md-6 form-group sub-div">
                    <button type="submit" class="btn  pull-right"><i class="glyphicon glyphicon-search"></i> Buscar</button>
                  </div>
                </form>
              </div>
            </div>
          </div>
          <div class="box box-primary">
            <div class="panel-heading">
              <div class="row">
                <div class="col-md-6">
                  <h4 class="box-title"><strong>Listagem</strong></h4>
                </div>
                <div class="col-md-6" >
                  <?php if( in_array(PERMISSAO_INCLUIR,$permissoes_modulo) ): ?>
                  <a href="<?php echo e(URL::to('admin/clientes/adicionar')); ?>">
                    <button type="button" class="btn pull-right" style="width: 85px"> <span class="glyphicon glyphicon-plus" aria-hidden="true"></span> Novo </button>
                  </a>
                  <?php endif; ?>
                </div>
              </div>
            </div>

          <div class="panel-body">

            <form action="<?php echo e(URL::to('admin/clientes/excluir')); ?>" method="post" >
              <input type="hidden" name="_token" value="<?php echo e(csrf_token()); ?>" />
              <div class="table-responsive">
              <table class="table table-striped">
                <tbody>
                  <tr>
                    <th>Nome</th>
                    <th class="th-c">Funções</th>
                    <th class="th-cm"><!-- <input type="checkbox" id="checkAll" class="minimal"> --></th>
                  </tr>
                  <?php foreach($clientes as $cliente): ?>
                    <tr>
                      <td>
                          <?php if( in_array(PERMISSAO_ALTERAR,$permissoes_modulo) ): ?>
                            <a href="<?php echo e(URL::to('admin/clientes/editar')); ?>/<?php echo e($cliente->cod_cliente); ?>" ><?php echo e($cliente->nome); ?></a>
                          <?php else: ?>
                            <?php echo e($cliente->nome); ?>

                          <?php endif; ?>
                      </td>
                      <td class="th-c">

                        <?php if( in_array(PERMISSAO_ALTERAR,$permissoes_modulo) ): ?>
                          <a href="<?php echo e(URL::to('admin/clientes/editar')); ?>/<?php echo e($cliente->cod_cliente); ?>" title="Editar" class="sp_a">
                            <span class="glyphicon glyphicon-pencil" aria-hidden="true"></span>
                          </a>
                        <?php endif; ?>
                        <?php if( in_array(PERMISSAO_EXCLUIR,$permissoes_modulo) ): ?>
                        <!-- |
                          <a href="<?php echo e(url('/admin/clientes/deletar',$cliente->cod_cliente)); ?>" onclick=" return confirm('Deseja excluir esse registro?');" title="Excluir" class="sp_a">
                            <span class="glyphicon glyphicon-trash" aria-hidden="true"></span>
                          </a> -->
                        <?php endif; ?>
                      </td>
                      <td class="th-cm">
                        <?php if( in_array(PERMISSAO_EXCLUIR,$permissoes_modulo) ): ?>
                          <!-- <input type="checkbox" id="ids" name="ids[]" value="<?php echo e($cliente->cod_cliente); ?>" class="minimal"> -->
                        <?php endif; ?>
                      </td>
                    </tr>
                  <?php endforeach; ?>
                </tbody>
              </table>
              </div>
              <?php if(count($clientes) == 0): ?>
                <div class="alert alert-info" role="alert">
                    <h4> Nenhum registro encontrado. </h4>
                    <?php if(!empty($nome)): ?> <h5> Sua busca por "<b><?php echo e($nome); ?></b>" não retornou resultados. </h5> <?php endif; ?>
                </div>
              <?php endif; ?>
              <div class="row rem-marg">
                <!-- <div class="col-md-2 rem-marg-col">
                    <button class="btn pull-right" type="button" onclick="this.form.submit();">
                        <span class="glyphicon glyphicon-trash" aria-hidden="true"></span>
                        <span class="btn-spam-rem"> Remover</span>
                    </button>
                </div> -->
              </div>
            </form>
            <div class="row">

              <div class="col-md-4">

                <div class="pg-left">
                  <form action="<?php echo e(URL::to('admin/clientes/index')); ?>">
                    <select name="offset" id="offset" onchange="this.form.submit()" class="form-control" >
                      <option <?php if( $offset == 5 ): ?> selected <?php endif; ?> value="5">5</option>
                      <option <?php if( $offset == 10 ): ?> selected <?php endif; ?> value="10">10</option>
                      <option <?php if( $offset == 15 ): ?> selected <?php endif; ?> value="15">15</option>
                      <option <?php if( $offset == 20 ): ?> selected <?php endif; ?> value="20">20</option>
                      <option <?php if( $offset == 25 ): ?> selected <?php endif; ?> value="25">25</option>
                      <option <?php if( $offset == 30 ): ?> selected <?php endif; ?> value="30">30</option>
                    </select>
                  </form>
                </div>

                <div class="pg-total" >
                  Total: <b><?php echo e($clientes->total()); ?></b> - Mostrando <b><?php echo e($offset); ?></b> por página
                </div>

              </div>

              <div class="col-md-8 pull-right pg-render" >
                <?php echo $clientes->appends( array('offset' => $offset, 'nome' => $nome ) )->render(); ?>

              </div>

            </div>

        </div>
        </div>
      </div>
    </div>
  </div>
</div>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('layout.siafc', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>