{% extends "ldt/user/user_base.html" %}
{# form of password change #}

{% load i18n %}
{% block css_import %}
	{{ block.super }}
    <style type="text/css">
    
  	.leftcolumn {
   		width: 30%;
   		text-align: right;
   	}
   	
   	#profile_forms input[type="text"], #profile_forms input[type="password"], select {
   		width: 250px;
   	}
   	   	
	</style>
{% endblock %}

{% block content %}
{{ block.super }}

<div id="profile_forms">
{% if msg %}
<div class="success" style="left:50%; text-align: center;">{{ msg }}</div>
{% endif %}
<form method="post" action="{% url ldt.user.views.profile %}">
{% csrf_token %}
	<table>
		<tr>
            <td class="leftcolumn">
                <label for="id_username">{% trans "Username" %}</label>
            </td>
            <td>
                <input id="id_username" type="text" maxlength="30" name="username" value="{{ user.username }}"/>
                {% for error in profile_form.errors.username %}
                <span class="error">{{ error}}</span>                
                {% endfor %}
            </td>
        </tr>
		<tr>
            <td class="leftcolumn"> 
                <label for="id_first_name">{% trans "First name" %}</label>
            </td>
            <td>
                <input id="id_first_name" type="text" maxlength="30" name="first_name" value="{{ user.first_name }}"/>
            </td>
        </tr>
        <tr>
            <td class="leftcolumn">
                <label for="id_last_name">{% trans "Name" %}</label>
            </td> 
            <td>
                <input id="id_last_name" type="text" maxlength="30" name="last_name" value="{{ user.last_name }}"/>
            </td>
        </tr>
        <tr>
            <td class="leftcolumn">
                <label for="id_email">{% trans "Email" %}</label>
            </td>
            <td>
                <input id="id_email" type="text" maxlength="75" name="email" class="required email" value="{{ user.email }}"/>
            	{% for error in profile_form.email.errors %}
            	<span class="error">
            		{{ error }}            		
            	</span>
            	{% endfor %}
            </td>
        </tr>
        <tr>
	        <td class="leftcolumn">
	        	<label>{% trans "Language" %}</label>
	        </td>
			<td>
				<select name="language" >
				{% for lang in LANGUAGES %}
					<option value="{{ lang.0 }}"{% ifequal lang.0 user_language %} selected="selected" {% endifequal %}>{% trans lang.1 %}</option>
				{% endfor %}    
				</select>
			</td>
		</tr>
		<tr>
        	<td></td>
        	<td><input type="submit" name="submit_profile" value="{% trans "Profile change" %}" /></td>
        </tr>       
    </table>    
</form>

<form method="post" action="{% url ldt.user.views.password %}">
{% csrf_token %}
<table>
		<tr>
			<td class="leftcolumn">
				<label for="id_old_password">{% trans "Password" %}</label>
			</td>
			<td>
				<input type="password" name="old_password" id="id_old_password" />
           		{% for error in password_form.old_password.errors %}
            	<span class="error">
            		{{ error }}            		
            	</span>
            	{% endfor %}
			</td>
		</tr>
		<tr>
			<td class="leftcolumn">
				<label for="id_new_password1">{% trans "New password" %}</label>
			</td>
			<td>
				<input type="password" name="new_password1" id="id_new_password1" />
				{% for error in password_form.new_password1.errors %}
            	<span class="error">
            		{{ error }}            		
            	</span>
            	{% endfor %}
			</td>			
		</tr>
		<tr>
			<td class="leftcolumn">
				<label for="id_new_password2">{% trans "New password confirmation" %}</label>
			</td>
			<td>
				<input type="password" name="new_password2" id="id_new_password2" />
				{% for error in password_form.new_password2.errors %}
            	<span class="error">
            		{{ error }}            		
            	</span>
            	{% endfor %}
            </td>			
		</tr>
        <tr>
        	<td></td>
        	<td><input type="submit" name="submit_password" value="{% trans "Password change" %}" /></td>
        </tr>         
    </table>
</form>

</div>

{% endblock%}


