docbow/docbow_project/docbow/templates/docbow/full-profile.html

113 lines
3.1 KiB
HTML

{% extends "docbow/base_user.html" %}
{% load crispy_forms_tags %}
{% load i18n %}
{% block title %}
{% trans "Profile" %}
{% endblock %}
{% block extra_scripts %}
{{ profile_form.media.css }}
{{ delegate_form.media.css }}
{% endblock %}
{% block main-column %}
<h3 id="profile">{% trans "profile_menu" %}</h3>
<h4>Notifications</h4>
{% crispy profile_form profile_form.helper %}
{% if delegate_form %}
<h3 id="delegate">{% trans "Delegations" %}</h3>
<h4>Délégations attribuées</h4>
{% if delegations %}
<form method="post" action=".">
{% csrf_token %}
<table id="delegations">
<thead>
<tr>
<th id="firstname">Prénom</th>
<th id="lastname">Nom</th>
<th id="email">Courriel</th>
<th id="username">Identifiant</th>
<th></th>
</tr>
</thead>
<tbody>
{% for delegation in delegations %}
<tr class="{% cycle 'odd' 'even' %}">
<td>{{ delegation.to.first_name }}</td>
<td>{{ delegation.to.last_name }}</td>
<td>{{ delegation.to.email }}</td>
<td>{{ delegation.to.username }}</td>
<td><input type="image" name="delegate-delete-{{ delegation.to.username }}" src="{{ STATIC_URL }}/docbow/css/images/poubelle.png" alt="{% trans "Delete" %}"/></td>
</tr>
<tr class="last-connection {% cycle 'odd' 'even' %}">
{% if delegation.journals %}
<td colspan="5">Dernière(s) connexion(s): {% for connection_time in delegation.journals %}
{{ connection_time }}
{% if not forloop.last %}, {% endif %}
{% endfor %}</td>
{% else %}
{% if delegation.to.date_joined != delegation.to.last_login %}
<td colspan="5">Dernière connexion: {{ delegation.to.last_login }}</td>
{% else %}
<td colspan="5">Aucune connexion.</td>
{% endif %}
{% endif %}
</tr>
{% endfor %}
</tbody>
</table>
</form>
{% else %}
<p>Aucune délégation attribuée</p>
{% endif %}
<h4>{% trans "Create a new delegation" %}</h4>
<div id="new-delegation-form">
{% crispy delegate_form delegate_form.helper %}
</div>
<h4>{% trans "Received delegations" %}</h4>
{% if received_delegations %}
<ul id="received-delegations">
{% for delegation in received_delegations %}
<li>{% firstof delegation.by.get_full_name delegation.by.username %}</li>
{% endfor %}
</ul>
{% else %}
<p>Aucune délégation reçue</p>
{% endif %}
{% endif %}
<h3 id="password-change">{% trans "Changing password" %}</h3>
<form method="post" action=".">
{% csrf_token %}
{{ password_change_form|crispy }}
<input type="submit" name="{{password_change_form.prefix}}-validate" value="{% trans 'Change Password' %}" />
</form>
{% endblock main-column %}
{% block endscripts %}
{{ profile_form.media.js }}
{{ delegate_form.media.js }}
<script src="{{ STATIC_URL }}jquery-plugin/js/jquery.scrollTo-min.js" type="text/javascript"></script>
<script>
$(function () {
$('#id_profile-mobile_phone').after($('input[name="profile-clear_mobile_phone"]').detach());
if ($('div.error').length) {
$.scrollTo('div.error');
} else {
$.scrollTo('#errorMsg');
}
});
</script>
{% endblock endscripts %}