<!-- OPCIONES ADMIN -->
<div class="panel panel-default">
  <div class="panel-heading"><strong>CREAR USUARIO</strong></div>
  <div class="panel-body"> 
   		<form action="add_user.php" method="POST">
  			<div id="tb_col" style="width: 310px">
  				<p class="bloque_input">Nombres y Apellido: <input type="text" name="name" size="15" class="right"></p>
				<p class="bloque_input">Email: <input type="email" name="email" size="15" class="right"></p>
				<p class="bloque_input">Tipo de usuario: <select name="type_user" size="1" class="right">
					<option value='Esteticista'>Esteticista</option> 
					<option value='Médico'>Médico</option> 
					<option value='Paciente'>Paciente virtual</option> 
					<option value='Admin'>Administrador</option> 
				</select></p>
  			</div>
  			<div id="tb_col" style="width: 8%"></div>
  			<div id="tb_col" style="width: 310px">
  				<p class="bloque_input">Nombre de usuario: <input type="text" name="username" size="15" class="right" required></p>	
				<p class="bloque_input">Contraseña: <input type="password" name="password" size="15" id="pass1" class="right" class="right" required></p>
				<p class="bloque_input">Repita la contraseña:  <input type="password" name="password2" size="15" id="pass2" onblur="same_pass()"  class="right" required></p>
			<input type="submit" name="Crear" value="Crear Usuario" class="right">
			</div>
		</form>
			<!-- 
		<strong>Eliminar usuario</strong><br />
		<strong>Editar usuario</strong> -->
  </div>
</div>

<div class="panel panel-default">
  <div class="panel-heading"><strong>USUARIOS</strong></div>
  <div class="panel-body"> 
   		<?php
		$result = mysqli_query($con,"SELECT * FROM user ORDER BY name");  
			echo "<table class='table table-hover' style='padding:0px'> \n"; 
			echo "
			<thead>
			<tr>
			<th>Nombre y apellidos</th>
			<th>Usuario</th>
			<th>Email </th>
			<th>Permisos </th>
			<th>Fecha de creación </th>
			<th> </th>
			</tr>
			</thead>
			<tbody>	\n"; 
			while ($row = mysqli_fetch_row($result))
			{ 
			echo 	"<tr> 
					<td><strong>$row[2]</strong></td>
					<td>$row[1]</td>
					<td>$row[4]</td>
					<td>$row[6]</td>
					<td>$row[7]</td>
					<td><a class='btn btn-danger btn-xs' href='#' onclick='confirm_del($row[0])' title='Eliminar' alt='Eliminar'><span class='glyphicon glyphicon-trash' ></span></a> ";
					    if($row[6] == "Paciente"){
					    	if($row[5] == 1){
					    		echo "<a class='btn btn-danger btn-xs' href='#' onclick='confirm_lock($row[0])'>Bloquear</a>";
					      		} else {
					      		echo "<a class='btn btn-success btn-xs' href='#' onclick='confirm_unlock($row[0])' >Desbloquear</a>";
					      		}
					    }
			echo 			"</td>
					      </tr>";
			};
			echo " \n"; 
			echo " </tbody></table> \n"; 
			// <a class='btn btn-info btn-xs' href='#$id=$row[0]'><span class='glyphicon glyphicon-edit'> Editar</span></a>
		?> 
  </div>
</div>
	<!-- END OPCIONES ADMIN -->
