<?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 Formulários</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/formularios/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 Formulários</strong></h4>
              </div>

              <?php if( in_array(PERMISSAO_INCLUIR,$permissoes_modulo) ): ?>
                <div class="col-md-6" >
                  <a href="<?php echo e(URL::to('admin/formularios/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/formularios/excluir')); ?>" method="post" >
              <input type="hidden" name="_token" value="<?php echo e(csrf_token()); ?>" />
              <table class="table table-striped">
                <tbody>
                  <tr>
                    <th>Nome</th>
                    <th>Pasta</th>
                    <th>Módulo</th>
                    <th>Menu</th>
                    <th class="th-c">Funções</th>
                    <th class="th-cm"><input type="checkbox" id="checkAll" class="minimal" ></th>
                  </tr>
                  <?php foreach($formularios as $formulario): ?>
                    <tr>
                      <td>
                          <?php if( in_array(PERMISSAO_ALTERAR,$permissoes_modulo) ): ?>
                            <a href="<?php echo e(URL::to('admin/formularios/editar')); ?>/<?php echo e($formulario->id); ?>" ><?php echo e($formulario->nome); ?></a>
                          <?php else: ?>
                            <?php echo e($formulario->nome); ?>

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


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

                          <a href="<?php echo e(URL::to('admin/formularios/editar')); ?>/<?php echo e($formulario->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/formularios/deletar',$formulario->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($formulario->id); ?>">
                        <?php endif; ?>
                      </td>
                    </tr>

                  <?php endforeach; ?>
                </tbody>
              </table>

              <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/formularios/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($formularios->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 $formularios->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(); ?>