<?php
	//session_start();
	//Incluindo a conexão com banco de dados   
    include("config/conexao.php"); 
	include("cabecalho.php"); 
	$empresa_id = $_SESSION['codCliente'];
	$result_rec  = " SELECT u.*, CONCAT(u.firstname,' ',u.realname) as Nome ";
	$result_rec .= " FROM glpi_users u"; 
	$result_rec .= " WHERE u.empresa_id = '{$empresa_id}'   ORDER BY u.id"; //
	$resultado_rec = mysqli_query($conn, $result_rec);
	$number = mysqli_num_rows($resultado_rec);
?>
<!--<!DOCTYPE html>
<html lang="pt-br">

<head>
  <meta charset="utf-8">
  <title>Central de Atendimento</title>
  <meta name="author" content="">
  <meta name="description" content="">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <link href="css/plugins/pace/pace.css" rel="stylesheet">
  <script src="js/pace/pace.js"></script>
  <link href="css/plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet">
  <link href='css/fonts/google/fonte.css' rel="stylesheet" type="text/css">
  <link href="css/fonts/font-awesome/css/font-awesome.min.css" rel="stylesheet">
  <link href="css/plugins/datatables/datatables.css" rel="stylesheet">
  <link href="css/style.css" rel="stylesheet">
</head>

<body>
  <div id="wrapper">
    <!-- INICIO MENU DE NAVEGAÇÃO -->
<!--			<nav class="navbar-top" role="navigation">
				<div class="navbar-header">
					<button type="button" class="navbar-toggle pull-right" data-toggle="collapse" data-target=".sidebar-collapse">
						<i class="fa fa-bars"></i> Menu
					</button>
					<div class="navbar-brand">					
						<a href="index">
							<img src="img/adapter_bco.svg"   style="width: 70%;">
						</a>
					</div>
				</div>
				<div class="nav-top">
					<!--<ul class="nav navbar-left">
						<li class="tooltip-sidebar-toggle">
							<a href="#" id="sidebar-toggle" data-toggle="tooltip" data-placement="right" title="Ocultar Barra Lateral">	
								<i class="fa fa-bars"></i>
							</a>	
						</li>
					</ul> -->
<!--					<ul class="nav navbar-right">
						<li class="dropdown">
							<a href="#" class="dropdown-toggle" data-toggle="dropdown">		
								<i class="fa fa-user"></i>&nbsp&nbsp<?php echo $_SESSION['usuarioNome']; ?>&nbsp&nbsp<i class="fa fa-caret-down"></i>
							</a>		
							<ul class="dropdown-menu dropdown-user">
								<li>
									<a href="">
										<i class="fa fa-user"></i> Dados Pessoais
									</a>
								</li>
								<li>
									<a href="#" data-toggle="modal" data-target="#AlterarSenha">
										<i class="fa fa-gear"></i> Configurações
									</a>
								</li>
								<li class="divider"></li>
								<li>
									<a class="logout_open" href="logoff.php">
										<i class="fa fa-sign-out"></i> Sair
									</a>
								</li>
							</ul>
						</li>
					</ul>
				</div>
			</nav>
    <!-- FIM MENU DE NAVEGAÇÃO -->
    <div id="page-wrapper">
      <div class="page-content">
        <div class="row">
          <div class="col-lg-12">
            <div class="page-title">
              <ol class="breadcrumb">
                <li>
                  <i class="fa fa-home"></i> <a href="home.php">Home</a>
                </li>
                <li class="active"><i class="fa fa-user-circle-o"></i> Usuários</li>
              </ol>
            </div>
          </div>
        </div>
        <div class="portlet portlet-default">
          <div class="portlet-heading">
            <div class="portlet-title">
              <h4>Usuários Cadastrados</h4>
            </div>
            <div class="portlet-widgets">
<!--              <button type="button" id="NovoUsuario" name="NovoUsuario" class="btn btn-default btn-xs" data-toggle="modal" data-target="#NovoUsuario" >
                <i class="fa fa-user-circle-o"></i> Novo Usuário
              </button>
-->			  <a href="#" class="btn btn-default btn-xs" data-toggle="modal" data-target="#NovoUsuario" data-placement="top" title="Novo"> 
				<i class="fa fa-user-circle-o"></i> Novo Usuário 
			  </a>

            </div>
            <div class="clearfix"></div>
          </div>
          <div class="portlet-body">
            <div class="table-responsive"><br>
              <table id="DataTable" class="table table-striped table-bordered table-hover table-green">
                <thead>
                  <tr>
                    <th style="width: 6%; text-align: center;">ID</th>
                    <th style="width: 20%; text-align: center;">Usuário</th>
                    <th style="width: 15%; text-align: center;">Nome</th>
                    <th style="width: 10%; text-align: center;">Data Cadastro</th>
                    <th style="width: 10%; text-align: center;">Editar</th>
                  </tr>
                </thead>
                <tbody>
                  <?php while($row_rec = mysqli_fetch_assoc($resultado_rec)){ ?>
                  <tr id="<?php echo $row_rec['id']; ?>" class="gradeU">
                    <td style="text-align: center;">
                      <?php echo $row_rec['id']; ?>
                    </td>
                    <td style="text-align: center;">
                      <?php echo $row_rec['name']; ?>
                    </td>
                    <td style="text-align: center;">
                      <?php echo $row_rec['Nome']; ?>
                    </td>
                    <td style="text-align: center;">
                      <?php echo $row_rec['date_creation']; ?>
                    </td>
                    <td class="center" style="text-align: center;">
                      <a href="editausuario.php?id=<?php echo $row_rec['id']; ?>" class="btn btn-default btn-xs"  title="Editar">
                        <i class="fa fa-pencil-square-o"></i>
                      </a>					  
                    </td>
                  </tr>
                  <?php } ?>
                </tbody>
              </table>
            </div>
          </div>
        </div>
        <div class="row">
        </div>
      </div>
    </div>
  </div>

  <!-- -------------------------------------------------------------------------------------------------------------------------->
 
    <div class="modal modal-flex fade" id="NovoUsuario" tabindex="-1" role="dialog" aria-labelledby="flexModalLabel" aria-hidden="true">
      <div class="modal-dialog">
		 <form  action="config/script_usuarios.php?acao=cadastrar" method="POST" enctype="multipart/form-data">
			<div class="modal-content">
			  <div class="modal-header">
				<button type="button" id="CloseModal" name="CloseModal" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
				<h4 class="modal-title" id="flexModalLabel" style="color:white;">
				  <i class="fa fa-user-circle-o"></i> Novo Usuário
				</h4>
			  </div>
			  <div class="modal-body">
				<div id="basicFormExample" class="panel-collapse collapse in">
				  <div class="portlet-body">
					<p>
					  <b>
						<i class="fa fa-exclamation-triangle" aria-hidden="true"></i> ATENÇÃO!
					  </b> Para cadastrar um novo usuário no sistema preencha formulário abaixo.
					</p>
					<!------------------------>
					<div class= "row">
						<div class="col-lg-6">
							<div class="form-group">
							  <label><b>Nome Usuário:</b></label>
							  <input type="hidden" name="id_usuario" id="id_usuario" />
							  <input type="hidden" name="empresa_id" id="empresa_id" value="<?php echo $_SESSION['codCliente']; ?>" />
							  <input type="text" class="form-control" placeholder="Nome do usuário" name="usuario" id="usuario" required="required" />
							</div>
						</div>
						<div class="col-lg-6">
							<div class="form-group">
							  <label><b>Sobre Nome:</b></label>
							  <input type="text" class="form-control" placeholder="Sobre do usuário" name="sobre_nome" id="sobre_nome" required="required" />
							</div>
						</div>
					</div>
					<div class= "row">
						<div class="col-lg-6">
							<div class="form-group">
							  <label><b>Login:</b></label>
							  <input type="text" class="form-control" placeholder="Login do usuário" name="login" id="login" required="required" />
							</div>
						</div>
						<div class="col-lg-6">
							<div class="form-group">
							  <label><b>Senha:</b></label>
							  <input type="password" class="form-control" placeholder="Senha do usuário" name="senha" id="senha" required="required" />
							</div>
						</div>
					</div>
					<div class= "row">
						<div class="col-lg-6">
							<div class="form-group">
							  <label><b>Confirmação de Senha:</b></label>
							  <input type="password" class="form-control" placeholder="Confirmação de Senha" name="csenha" id="csenha" required="required" />
							</div>
						</div>
						<div class="col-lg-6">
							<div class="form-group">
							  <label><b>E-MAIL:</b></label>
							  <input type="email" class="form-control" placeholder="Login do usuário" name="email" id="email" required="required" />
							</div>
						</div>
					</div>
				  </div>
				</div>
			  </div>
			  <div class="modal-footer">
				<button type="button" id="CancelarCadastro" name="CancelarCadastro" class="btn btn-default" data-dismiss="modal">Cancelar</button>
				<button type="submit" id="SalvarUsuario" name="SalvarUsuario" onclick="return ValidarCadastro();" class="btn btn-green">
				  <i class="fa fa-save"></i> Salvar
				</button>
			  </div>
			</div>
		</form>	
      </div>
    </div>
  
  <!-- -------------------------------------------------------------------------------------------------------------------------->

  <!-- -------------------------------------------------------------------------------------------------------------------------->

  <script src="js/jquery/jquery-1.8.1.js"></script>
  <script src="js/jquery/jquery.maskedinput.js"></script>
  <script src="js/jquery/jquery.cadastro.usuario.js"></script>
  <script src="js/bootstrap/bootstrap.min.js"></script>
  <script src="js/slimscroll/jquery.slimscroll.min.js"></script>
  <script src="js/popupoverlay/jquery.popupoverlay.js"></script>
  <script src="js/popupoverlay/defaults.js"></script>
  <script src="js/popupoverlay/logout.js"></script>
  <script src="js/hisrc/hisrc.js"></script>
  <script src="js/datatables/jquery.dataTables.js"></script>
  <script src="js/datatables/datatables-bs3.js"></script>
  <script src="js/jquery/jquery.Layout.js"></script>

</body>

</html>
