{% extends "layout.html" %}
{% block title %}Perfil
{% endblock %}

{% set nav_active = 'configuracion' %}
{% block content %}
{% if message_success %}
<div class="alert alert-success alert-dismissible" role="alert">
	<button type="button" class="close" data-dismiss="alert" aria-label="Close">
		<span aria-hidden="true">&times;</span>
	</button>
	{{message_success}}
</div>
{% endif %}
{% if message_error %}
<div class="alert alert-danger alert-dismissible" role="alert">
	{{message_error}}
	<button type="button" class="close" data-dismiss="alert" aria-label="Close">
		<span aria-hidden="true">&times;</span>
	</button>
</div>
{% endif %}

<div class="box">
	<div class="box-header with-border">
		<h3 class="box-title">Perfil</h3>
		<div class="box-tools pull-right">
			<button class="btn btn-box-tool" data-widget="collapse">
				<i class="fa fa-minus"></i>
			</button>

			<button class="btn btn-box-tool" data-widget="remove">
				<i class="fa fa-times"></i>
			</button>
		</div>
	</div>
	<div class="box-body">
		<div class="row">
			<div class="col-md-12"> 
				<form action="accion_perfil.php" method="post">
					<div class="row">
						<div class="form-group col-md-4">
							<label for="">Nombre</label>
							<input class="form-control" name="nombre" type="text" value="{{usuario.nombre}}">
						</div>
						{% for privilegio in privilegios %}
						{% if privilegio.nombre == 'usuarios' %}
						<div class="form-group col-md-4">
							<label for="">Cargo</label>
							<input class="form-control" name="cargo" type="text" value="{{usuario.cargo}}">
						</div>
						{% endif %}
						{% endfor %}
						<div class="form-group col-md-4">
							<label for="">Nombre de usuario</label>
							<input class="form-control" name="nick" type="text" value="{{usuario.nick}}">
						</div>
					</div>
					<input type="hidden" name="id" value="{{usuario.id}}">
					<input type="hidden" name="editar_perfil" value="true">
					<button class="btn btn-verdedark" type="submit">Actualizar</button>
				</form>
			</div>
		</div>
	</div>
</div>
<!-- fin box -->

<div class="box">
	<div class="box-header with-border">
		<h3 class="box-title">Seguridad</h3>
		<div class="box-tools pull-right">
			<button class="btn btn-box-tool" data-widget="collapse">
				<i class="fa fa-minus"></i>
			</button>

			<button class="btn btn-box-tool" data-widget="remove">
				<i class="fa fa-times"></i>
			</button>
		</div>
	</div>
	<div class="box-body">
		<div class="row">
			<div class="col-md-12">
				<form action="accion_perfil.php" method="post">
					<div class="row">
						<div class="form-group col-md-6 col-12">
							<label for="">Nueva contrase&ntilde;a</label>
							<input class="form-control" name="new_password" type="password">
							<input name="id" value="{{usuario.id}}" type="hidden">
						</div>
						<div class="form-group col-md-6 col-12">
							<label for="">Repita su contrase&ntilde;a</label>
							<input class="form-control" name="new_password_repeat" type="password">
						</div>
					</div>
					<button class="btn btn-verdedark">Cambiar contrase&ntilde;a</button>
				</form>
			</div>
		</div>

	</div>
</div>
{% endblock %}