<?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 Menus</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/menus/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><strong>Listagem de Menus</strong></h4>
                </div>

                <?php if( in_array(PERMISSAO_INCLUIR,$permissoes_modulo) ): ?>
                  <div class="col-md-6" >
                    <a href="<?php echo e(URL::to('admin/menus/adicionar')); ?>">
                      <button type="button" class="btn pull-right" style=" width: 85px" > <span class="glyphicon glyphicon-plus" aria-hidden="true"></span> Novo</button>
                    </a>
                  </div>
                <?php endif; ?>

                </div>
            </div>

            <div class="panel-body">

              <form action="<?php echo e(URL::to('admin/menus/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>Módulo</th>
                      <th class="th-c">Funções</th>
                      <th class="th-cm"><input type="checkbox" id="checkAll" class="minimal" ></th>
                    </tr>
                    <?php foreach($menus as $menu): ?>
                      <tr>
                        <td>
                            <?php if( in_array(PERMISSAO_ALTERAR,$permissoes_modulo) ): ?>
                              <a href="<?php echo e(URL::to('admin/menus/editar')); ?>/<?php echo e($menu->id); ?>"><?php echo e($menu->nome); ?></a>
                            <?php else: ?>
                              <?php echo e($menu->nome); ?>

                            <?php endif; ?>
                        </td>
                        <td><?php echo e($menu->modulo->nome); ?></td>
                        <td class="th-c">

                          <?php if( in_array(PERMISSAO_ALTERAR,$permissoes_modulo) ): ?>

                            <a href="<?php echo e(URL::to('admin/menus/editar')); ?>/<?php echo e($menu->id); ?>" 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/menus/deletar',$menu->id)); ?>" 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[]" class="minimal" value="<?php echo e($menu->id); ?>">
                          <?php endif; ?>
                        </td>
                      </tr>
                    <?php endforeach; ?>
                  </tbody>
                </table>
                </div>
                <?php if(count($menus) == 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/menus/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($menus->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 $menus->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(); ?>