8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-12-23 15:33:45 +00:00
re2o/users/templates/users/profil.html
2018-12-30 12:35:41 +01:00

524 lines
23 KiB
HTML

{% extends "users/sidebar.html" %}
{% comment %}
Re2o est un logiciel d'administration développé initiallement au rezometz. Il
se veut agnostique au réseau considéré, de manière à être installable en
quelques clics.
Copyright © 2017 Gabriel Détraz
Copyright © 2017 Goulven Kermarec
Copyright © 2017 Augustin Lemesle
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
{% endcomment %}
{% load bootstrap3 %}
{% load acl %}
{% load logs_extra %}
{% load design %}
{% load i18n %}
{% block title %}{% trans "Profile" %}{% endblock %}
{% block content %}
<div align="center" class="title-dashboard">
{% if user == users %}
<h2>{% blocktrans with name=users.name surname=users.surname %}Welcome {{ name }} {{ surname }}{% endblocktrans %}</h2>
{% else %}
<h2>{% blocktrans with name=users.name surname=users.surname %}Profile of {{ name }} {{ surname }}{% endblocktrans %}</h2>
{% endif %}
</div>
<div class="dashboard_container">
<div class="row">
<div class="col-sm-6 {% if solde_activated %}col-md-4{% else %}col_md-6{% endif %}">
{% if users.is_ban%}
<div class="panel panel-danger">
<div class="panel-heading dashboard">{% trans "Your account has been banned" %}</div>
<div class="panel-body dashboard">
<i class="text-danger">{% blocktrans with end_ban=users.end_ban|date:"SHORT_DATE_FORMAT" %}End of the ban: {{ end_ban }}{% endblocktrans %}</i>
</div>
</div>
{% elif not users.has_access %}
<div class="panel panel-danger">
<div class="panel-heading dashboard">{% trans "No connection" %}</div>
<div class="panel-body dashboard">
{% can_create Facture %}
<a class="btn btn-danger btn-sm" role="button" href="{% url 'cotisations:new-facture' users.id %}">
<i class="fa fa-sign-in"></i> {% trans "Pay for a connection" %}
</a>
{% acl_else %}
{% trans "Ask for someone with the appropriate rights to pay for a connection." %}
{% acl_end %}
</div>
</div>
{% else %}
<div class="panel panel-success">
<div class="panel-heading dashboard">{% blocktrans with end_connection=users.end_access|date:"SHORT_DATE_FORMAT" %}Connection (until {{ end_connection }} ){% endblocktrans %}</div>
<div class="panel-body dashboard">
{% can_create Facture %}
<a class="btn btn-success btn-sm" role="button" href="{% url 'cotisations:new-facture' users.id %}">
<i class="fa fa-sign-in"></i> {% trans "Extend the connection period" %}
</a>
{% acl_end %}
</div>
</div>
{% endif %}
</div>
{% if solde_activated %}
<div class="col-sm-6 col-md-4">
<div class="panel panel-info">
<div class="panel-heading dashboard" data-parent="#accordion" data-toggle="collapse" data-target="#collapse4">
{{ users.solde }} <i class="fa fa-eur"></i>
</div>
<div class="panel-body dashboard">
<a class="btn btn-primary btn-sm" role="button" href="{% url 'cotisations:credit-solde' users.id %}">
<i class="fa fa-eur"></i> {% trans "Refill the balance" %}
</a>
</div>
</div>
</div>
{% endif %}
<div class="col-sm-6 {% if solde_activated %}col-md-4{% else %}col-md-6{% endif %}">
{% if nb_machines %}
<div class="panel panel-info">
<div class="panel-heading dashboard" data-parent="#accordion" data-toggle="collapse" data-target="#collapse3">
<i class="fa fa-desktop"></i>{% trans " Machines" %} <span class="badge"> {{ nb_machines }}</span>
</div>
<div class="panel-body dashboard">
<a class="btn btn-primary btn-sm" role="button" href="{% url 'machines:new-machine' users.id %}">
<i class="fa fa-desktop"></i>{% trans " Add a machine" %}
</a>
</div>
</div>
{% else %}
<div class="panel panel-warning">
<div class="panel-heading dashboard">{% trans "No machine" %}</div>
<div class="panel-body dashboard">
<a class="btn btn-warning btn-sm" role="button" href="{% url 'machines:new-machine' users.id %}">
<i class="fa fa-desktop"></i>{% trans " Add a machine" %}
</a>
</div>
</div>
{% endif %}
</div>
</div>
</div>
<div class="panel-group" id="accordion">
<div class="panel panel-default">
<div class="panel-heading clearfix profil" data-parent="#accordion" data-toggle="collapse"
data-target="#collapse1">
<h3 class="panel-title pull-left">
<i class="fa fa-user"></i>{% trans " Detailed information" %}
</h3>
</div>
<div class="panel-collapse collapse in" id="collapse1">
<div class="panel-body">
<a class="btn btn-primary btn-sm" role="button" href="{% url 'users:edit-info' users.id %}">
<i class="fa fa-edit"></i>
{% trans "Edit" %}
</a>
<a class="btn btn-primary btn-sm" role="button" href="{% url 'users:password' users.id %}">
<i class="fa fa-lock"></i>
{% trans "Change the password" %}
</a>
{% can_change User state %}
<a class="btn btn-primary btn-sm" role="button" href="{% url 'users:state' users.id %}">
<i class="fa fa-id-badge"></i>
{% trans "Change the state" %}
</a>
{% acl_end %}
{% can_change User groups %}
<a class="btn btn-primary btn-sm" role="button" href="{% url 'users:groups' users.id %}">
<i class="fa fa-check"></i>
{% trans "Edit the groups" %}
</a>
{% acl_end %}
{% history_button users text=True %}
</ul>
</div>
<div class="panel-body">
<dl class="dl-horizontal row profile-info">
<div class="col-md-6">
{% if users.is_class_club %}
<dt>{% trans "Mailing" %}</dt>
{% if users.club.mailing %}
<dd>{{ users.pseudo }}(-admin)</dd>
{% else %}
<dd>{% trans "Mailing disabled" %}</dd>
{% endif %}
{% else %}
<dt>{% trans "Firt name" %}</dt>
<dd>{{ users.name }}</dd>
{% endif %}
</div>
<div class="col-md-6">
<dt>{% trans "Surname" %}</dt>
<dd>{{ users.surname }}</dd>
</div>
<div class="col-md-6">
<dt>{% trans "Username" %}</dt>
<dd>{{ users.pseudo }}</dd>
</div>
<div class="col-md-6">
<dt>{% trans "Email address" %}</dt>
<dd><a href="mailto:{{ users.email }}">{{ users.email }}</a></dd>
</div>
<div class="col-md-6">
<dt>{% trans "Room" %}</dt>
<dd>
{{ users.room }} {% can_view_all Port %}{% if users.room.port_set.all %} /
{{ users.room.port_set.all|join:", " }} {% endif %}{% acl_end %}
</dd>
</div>
<div class="col-md-6">
<dt>{% trans "Telephone number" %}</dt>
<dd>{{ users.telephone }}</dd>
</div>
<div class="col-md-6">
<dt>{% trans "School" %}</dt>
<dd>{{ users.school }}</dd>
</div>
<div class="col-md-6">
<dt>{% trans "Comment" %}</dt>
<dd>{{ users.comment }}</dd>
</div>
<div class="col-md-6">
<dt>{% trans "Registration date" %}</dt>
<dd>{{ users.registered }}</dd>
</div>
<div class="col-md-6">
<dt>{% trans "Last login" %}</dt>
<dd>{{ users.last_login }}</dd>
</div>
<div class="col-md-6">
<dt>{% trans "End of membership" %}</dt>
{% if users.end_adhesion != None %}
<dd><i class="text-success">{{ users.end_adhesion }}</i></dd>
{% else %}
<dd><i class="text-danger">{% trans "Not a member" %}</i></dd>
{% endif %}
</div>
<div class="col-md-6">
<dt>{% trans "Whitelist" %}</dt>
{% if users.end_whitelist != None %}
<dd><i class="text-success">{{ users.end_whitelist }}</i></dd>
{% else %}
<dd><i class="text-warning">{% trans "None" %}</i></dd>
{% endif %}
</div>
<div class="col-md-6">
<dt>{% trans "Ban" %}</dt>
{% if users.end_ban != None %}
<dd><i class="text-danger">{{ users.end_ban }}</i></dd>
{% else %}
<dd><i class="text-success">{% trans "Not banned" %}</i></dd>
{% endif %}
</div>
<div class="col-md-6">
<dt>{% trans "State" %}</dt>
{% if users.state == 0 %}
<dd><i class="text-success">{% trans "Active" %}</i></dd>
{% elif users.state == 1 %}
<dd><i class="text-warning">{% trans "Disabled" %}</i></dd>
{% elif users.state == 2 %}
<dd><i class="text-danger">{% trans "Archived" %}</i></dd>
{% elif users.state == 3 %}
<dd><i class="text-danger">{% trans "Not yet Member" %}</i></dd>
{% endif %}
</div>
<div class="col-md-6">
<dt>{% trans "Internet access" %}</dt>
{% if users.has_access == True %}
<dd><i class="text-success">
{% blocktrans with end_access=users.end_access %}Active
(until {{ end_access }}){% endblocktrans %}</i></dd>
{% else %}
<dd><i class="text-danger">{% trans "Disabled" %}</i></dd>
{% endif %}
</div>
<div class="col-md-6">
<dt>{% trans "Groups of rights" %}</dt>
{% if users.groups.all %}
<dd>{{ users.groups.all|join:", " }}</dd>
{% else %}
<dd>{% trans "None" %}</dd>
{% endif %}
</div>
<div class="col-md-6">
<dt>{% trans "Balance" %}</dt>
<dd>
{{ users.solde }} €
{% if user_solde %}
<a class="btn btn-primary btn-sm" style='float:right' role="button"
href="{% url 'cotisations:credit-solde' users.pk %}">
<i class="fa fa-eur"></i>
{% trans "Refill" %}
</a>
{% endif %}
</dd>
</div>
{% if users.adherent.gpg_fingerprint %}
<div class="col-md-6 col-xs-12">
<dt>{% trans "GPG fingerprint" %}</dt>
<dd>{{ users.adherent.gpg_fingerprint }}</dd>
</div>
{% endif %}
{% if users.shell %}
<div class="col-md-6 col-xs-12">
<dt>{% trans "Shell" %}</dt>
<dd>{{ users.shell }}</dd>
</div>
{% endif %}
</dl>
</div>
</div>
</div>
{% if users.is_class_club %}
<div class="panel panel-default">
<div class="panel-heading clearfix" data-parent="#accordion" data-toggle="collapse" data-target="#collapse2">
<h3 class="panel-title pull-left">
<i class="fa fa-users"></i>{% trans " Manage the club" %}
</h3>
</div>
<div class="panel-collapse collapse" id="collapse2">
<div class="panel-body">
<a class="btn btn-primary btn-sm" role="button" href="{% url 'users:edit-club-admin-members' users.club.id %}">
<i class="fa fa-lock"></i>
{% trans "Manage the admins and members" %}
</a>
</div>
<div class="panel-body">
<h4>{% trans "Club admins" %}</h4>
<div class="table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th>{% trans "Surname" %}</th>
<th>{% trans "First name" %}</th>
<th>{% trans "Username" %}</th>
</tr>
</thead>
{% for admin in users.club.administrators.all %}
<tr>
<td>{{ admin.surname }}</td>
<td>{{ admin.name }}</td>
<td>{{ admin.pseudo }}</td>
</tr>
{% endfor %}
</table>
</div>
<h4>{% trans "Members" %}</h4>
<div class="table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th>{% trans "Surname" %}</th>
<th>{% trans "First name" %}</th>
<th>{% trans "Username" %}</th>
</tr>
</thead>
{% for admin in users.club.members.all %}
<tr>
<td>{{ admin.surname }}</td>
<td>{{ admin.name }}</td>
<td>{{ admin.pseudo }}</td>
</tr>
{% endfor %}
</table>
</div>
</div>
</div>
</div>
{% endif %}
<div class="panel panel-default">
<div class="panel-heading clearfix profil" data-parent="#accordion" data-toggle="collapse" data-target="#collapse3">
<h3 class="panel-title pull-left">
<i class="fa fa-desktop"></i>
{% trans "Machines" %}
<span class="badge">{{nb_machines}}</span>
</h3>
</div>
<div id="collapse3" class="panel-collapse collapse">
<div class="panel-body">
<a class="btn btn-primary btn-sm" role="button" href="{% url 'machines:new-machine' users.id %}">
<i class="fa fa-desktop"></i>
{% trans "Add a machine" %}
</a>
</div>
<div class="panel-body">
{% if machines_list %}
{% include "machines/aff_machines.html" with machines_list=machines_list %}
{% else %}
<p>{% trans "No machine" %}</p>
{% endif %}
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading clearfix profil" data-parent="#accordion" data-toggle="collapse" data-target="#collapse4">
<h3 class="panel-title pull-left">
<i class="fa fa-eur"></i>
{% trans "Subscriptions" %}
</h3>
</div>
<div id="collapse4" class="panel-collapse collapse">
<div class="panel-body">
{% can_create Facture %}
<a class="btn btn-primary btn-sm" role="button" href="{% url 'cotisations:new-facture' users.id %}">
<i class="fa fa-eur"></i>
{% trans "Add as subscription" %}
</a>
{% if user_solde %}
<a class="btn btn-primary btn-sm" role="button" href="{% url 'cotisations:credit-solde' users.id %}">
<i class="fa fa-eur"></i>
{% trans "Edit the balance" %}
</a>
{% endif%}
{% acl_end %}
</div>
<div class="panel-body">
{% if facture_list %}
{% include "cotisations/aff_cotisations.html" with facture_list=facture_list %}
{% else %}
<p>{% trans "No invoice" %}</p>
{% endif %}
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading clearfix profil" data-parent="#accordion" data-toggle="collapse" data-target="#collapse5">
<h3 class="panel-title pull-left">
<i class="fa fa-ban"></i>
{% trans "Bans" %}
</h3>
</div>
<div id="collapse5" class="panel-collapse collapse">
<div class="panel-body">
{% can_create Ban %}
<a class="btn btn-primary btn-sm" role="button" href="{% url 'users:add-ban' users.id %}">
<i class="fa fa-ban"></i>
{% trans "Add a ban" %}
</a>
{% acl_end %}
</div>
<div class="panel-body">
{% if ban_list %}
{% include "users/aff_bans.html" with ban_list=ban_list %}
{% else %}
<p>{% trans "No ban" %}</p>
{% endif %}
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading clearfix profil" data-parent="#accordion" data-toggle="collapse" data-target="#collapse6">
<h3 class="panel-title pull-left">
<i class="fa fa-check-circle"></i>
{% trans "Whitelists" %}
</h3>
</div>
<div id="collapse6" class="panel-collapse collapse">
<div class="panel-body">
{% can_create Whitelist %}
<a class="btn btn-primary btn-sm" role="button" href="{% url 'users:add-whitelist' users.id %}">
<i class="fa fa-check-circle"></i>
{% trans "Grant a whitelist" %}
</a>
{% acl_end %}
</div>
<div class="panel-body">
{% if white_list %}
{% include "users/aff_whitelists.html" with white_list=white_list %}
{% else %}
<p>{% trans "No whitelist" %}</p>
{% endif %}
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading clearfix profil" data-parent="#accordion" data-toggle="collapse" data-target="#collapse7">
<h3 class="panel-title pull-left">
<i class="fa fa-envelope"></i>{% trans " Email settings" %}
</h3>
</div>
<div id="collapse7" class="panel-collapse collapse">
<div class="panel-body">
{% can_edit users %}
<a class="btn btn-primary btn-sm" role="button" href="{% url 'users:edit-email-settings' users.id %}">
<i class="fa fa-pencil"></i>{% trans " Edit email settings" %}
</a>
{% acl_end %}
</div>
<div class="panel-body">
{% if local_email_accounts_enabled %}
<div class="table-responsive">
<table class="table">
<tr>
<th colspan="2">{% trans "Contact email address" %}</th>
<td colspan="2">{{ users.get_mail }}</td>
</tr>
<tr>
<th>{% trans "Enable the local email account" %}</th>
<td>{{ users.local_email_enabled | tick }}</td>
<th>{% trans "Enable the local email redirection" %}</th>
<td>{{ users.local_email_redirect | tick }}</td>
</tr>
</table>
<p>{% trans "The contact email address is the email address where we send emails to contact you. If you would like to use your external email address for that, you can either disable your local email address or enable the local email redirection." %}</p>
</div>
{% if users.local_email_enabled %}
{% can_create EMailAddress users.id %}
<a class="btn btn-primary btn-sm" role="button" href="{% url 'users:add-emailaddress' users.id %}">
<i class="fa fa-plus-square"></i>{% trans " Add an email address" %}
</a>
{% acl_end %}
{% if emailaddress_list %}
{% include "users/aff_emailaddress.html" with emailaddress_list=emailaddress_list %}
{% endif %}
{% endif %}
{% else %}
<div class="table-responsive">
<table class="table">
<tr>
<th>{% trans "Contact email address" %}</th>
<td>{{ users.get_mail }}</td>
</tr>
</table>
</div>
{% endif %}
</div>
</div>
</div>
</div>
{% endblock %}