8
0
Fork 0
mirror of https://gitlab.federez.net/re2o/re2o synced 2024-07-15 10:44:46 +00:00

Merge branch 'better_user' into crans

This commit is contained in:
chirac 2018-06-26 22:33:34 +02:00
commit 415a393bfa
4 changed files with 155 additions and 37 deletions

View file

@ -40,16 +40,14 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<tr>
<th>Téléphone obligatoirement requis</th>
<td>{{ useroptions.is_tel_mandatory }}</td>
<th>Activation du solde pour les utilisateurs</th>
<td>{{ useroptions.user_solde }}</td>
<th>Auto inscription</th>
<td>{{ useroptions.self_adhesion }}</td>
</tr>
<tr>
<th>Champ gpg fingerprint</th>
<td>{{ useroptions.gpg_fingerprint }}</td>
{% if useroptions.user_solde %}
<th>Solde négatif</th>
<td>{{ useroptions.solde_negatif }}</td>
{% endif %}
<th>Shell par défaut des utilisateurs</th>
<td>{{ useroptions.shell_default }}</td>
</tr>
<tr>
<th>Creations d'adhérents par tous</th>
@ -57,20 +55,23 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<th>Creations de clubs par tous</th>
<td>{{ useroptions.all_can_create_club }}</td>
</tr>
{% if useroptions.user_solde %}
<tr>
<th>Solde maximum</th>
<td>{{ useroptions.max_solde }}</td>
<th>Montant minimal de rechargement en ligne</th>
<td>{{ useroptions.min_online_payment }}</td>
<th>Activation du solde pour les utilisateurs</th>
<td>{{ useroptions.user_solde }}</td>
{% if useroptions.user_solde %}
<th>Solde négatif</th>
<td>{{ useroptions.solde_negatif }}</td>
</tr>
<tr>
<th>Solde maximum</th>
<td>{{ useroptions.max_solde }}</td>
<th>Montant minimal de rechargement en ligne</th>
<td>{{ useroptions.min_online_payment }}</td>
</tr>
{% endif %}
<tr>
<th>Auto inscription</th>
<td>{{ useroptions.self_adhesion }}</td>
<th>Shell par défaut des utilisateurs</th>
<td>{{ useroptions.shell_default }}</td>
{% else %}
</tr>
{% endif%}
<tr>
<th>Extension mail interne</th>
<td>{{ useroptions.mail_extension }}</td>

View file

@ -108,7 +108,6 @@ footer a {
overflow-y: visible;
}
/* For tables with long text in cells */
.table.long_text{
@ -124,3 +123,42 @@ td.long_text{
th.long_text{
width: 60%;
}
/* style for the user page */
.dashboard_container{
margin-top: 30px;
margin-bottom: 20px;
}
.panel-heading.dashboard{
text-align: center;
}
.panel-body.dashboard{
text-align: center;
height: 60px;
vertical-align:middle;
}
#grad_red {
background: red; /* For browsers that do not support gradients */
background: linear-gradient(#ff6363, #fefefe); /* Standard syntax (must be last) */
}
#grad_green {
background: green; /* For browsers that do not support gradients */
background: linear-gradient(#C8DD58,#4FB64A); /* Standard syntax (must be last) */
}
#grad_grey {
background: gray; /* For browsers that do not support gradients */
background: linear-gradient(#d4d4ff, #fefefe); /* Standard syntax (must be last) */
}
#grad_machines{
background: green;
background: linear-gradient(#c266e0,#fefefe)
}

View file

@ -27,21 +27,99 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% load acl %}
{% block title %}Profil{% endblock %}
{% block content %}
<h2>{{ users.surname }} {{users.name}}</h2>
<p>Vous êtes {% if users.end_adhesion != None %}<span class="label label-success">
un {{ users.class_name | lower}}</span>{% else %}<span class="label label-danger">
non adhérent</span>{% endif %} et votre connexion est {% if users.has_access %}
<span class="label label-success">active</span>{% else %}<span class="label label-danger">désactivée</span>{% endif %}.</p>
{% if user_solde %}
<p>Votre solde est de <span class="badge">{{ user.solde }}€</span>.
{% if allow_online_payment %}
<a class="btn btn-primary btn-sm" role="button" href="{% url 'cotisations:recharge' %}">
<i class="fa fa-euro-sign"></i>
Recharger
</a>
{% endif %}
</p>
{% endif %}
<div align="center">
<h2>Bienvenue {{users.name}} {{ users.surname }}</h2>
</div>
<div class="dashboard_container">
<div class="row">
{% if solde_activated %}
<div class="col-sm-6 col-md-4">
{% else %}
<div class="col-sm-6 col-md-6">
{% endif %}
<div class="col-12">
{% if users.is_ban%}
<div class="panel panel-danger">
<div class="panel-heading dashboard">Votre compte est banni</div>
<div class="panel-body dashboard">
<i class="text-danger">Fin du ban : {{user.end_ban|date:"d M Y"}}</i>
</div>
</div>
{% elif not users.is_connected%}
<div class="panel panel-danger">
<div class="panel-heading dashboard">Pas d'accès à internet</div>
<div class="panel-body dashboard">
<a class="btn btn-danger btn-sm" role="button" href="{% url 'cotisations:credit-solde' users.id %}">
<i class="fas fa-sign-in-alt"></i>
Payer ma connexion
</a>
</div>
</div>
{% else %}
<div class="panel panel-success">
<div class="panel-heading dashboard">Connecté</div>
<div class="panel-body dashboard">
<i class="text-success">Fin de connexion: {{user.end_adhesion|date:"d M Y"}}</i>
</div>
</div>
{% endif %}
</div>
</div>
{% if solde_activated %}
<div class="col-sm-6 col-md-4">
<div class="col-12">
<div class="panel panel-info">
<div class="panel-heading dashboard" data-parent="#accordion" data-toggle="collapse" data-target="#collapse4">
{{user.solde}} <i class="fas fa-euro-sign"></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-euro-sign"></i>
Modifier le solde
</a>
</div>
</div>
</div>
</div>
{% endif %}
{% if solde_activated %}
<div class="col-sm-6 col-md-4">
{% else %}
<div class="col-sm-6 col-md-6">
{% endif %}
<div class="col-12">
{% if nb_machines %}
<div class="panel panel-info">
<div class="panel-heading dashboard" data-parent="#accordion" data-toggle="collapse" data-target="#collapse3">
<span class="badge">{{nb_machines}}</span>
Machines
<i class="fa fa-desktop"></i>
</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>
Ajouter une machine
</a>
</div>
</div>
{% else %}
<div class="panel panel-warning">
<div class="panel-heading dashboard">Aucune 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>
Ajouter une machine
</a>
</div>
</div>
{% endif %}
</div>
</div>
</div>
</div>
<div class="panel-group" id="accordion">
<div class="panel panel-default">
@ -50,7 +128,7 @@ non adhérent</span>{% endif %} et votre connexion est {% if users.has_access %}
<i class="fa fa-user"></i> Informations détaillées
</h3>
</div>
<div class="panel-collapse collapse in" id="collapse1">
<div class="panel-collapse collapse" 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>
@ -253,7 +331,7 @@ non adhérent</span>{% endif %} et votre connexion est {% if users.has_access %}
<a class="btn btn-primary btn-sm" role="button" href="{% url 'machines:new-machine' users.id %}">
<i class="fa fa-desktop"></i>
Ajouter une machine
</a>
</a>
</div>
<div class="panel-body">
{% if machines_list %}

View file

@ -113,8 +113,8 @@ def new_user(request):
GTU_sum_up = GeneralOption.get_cached_value('GTU_sum_up')
GTU = GeneralOption.get_cached_value('GTU')
if user.is_valid():
user = user.save(commit=False)
user.save()
#user = user.save(commit=False)
user = user.save()
user.reset_passwd_mail(request)
messages.success(request, "L'utilisateur %s a été crée, un mail\
pour l'initialisation du mot de passe a été envoyé" % user.pseudo)
@ -957,6 +957,7 @@ def profil(request, users, **_kwargs):
'white_list': whitelists,
'user_solde': user_solde,
'allow_online_payment': allow_online_payment,
'solde_activated': OptionalUser.objects.first().user_solde
}
)