8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-11-25 22:22:26 +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> <tr>
<th>Téléphone obligatoirement requis</th> <th>Téléphone obligatoirement requis</th>
<td>{{ useroptions.is_tel_mandatory }}</td> <td>{{ useroptions.is_tel_mandatory }}</td>
<th>Activation du solde pour les utilisateurs</th> <th>Auto inscription</th>
<td>{{ useroptions.user_solde }}</td> <td>{{ useroptions.self_adhesion }}</td>
</tr> </tr>
<tr> <tr>
<th>Champ gpg fingerprint</th> <th>Champ gpg fingerprint</th>
<td>{{ useroptions.gpg_fingerprint }}</td> <td>{{ useroptions.gpg_fingerprint }}</td>
{% if useroptions.user_solde %} <th>Shell par défaut des utilisateurs</th>
<th>Solde négatif</th> <td>{{ useroptions.shell_default }}</td>
<td>{{ useroptions.solde_negatif }}</td>
{% endif %}
</tr> </tr>
<tr> <tr>
<th>Creations d'adhérents par tous</th> <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> <th>Creations de clubs par tous</th>
<td>{{ useroptions.all_can_create_club }}</td> <td>{{ useroptions.all_can_create_club }}</td>
</tr> </tr>
<tr>
<th>Activation du solde pour les utilisateurs</th>
<td>{{ useroptions.user_solde }}</td>
{% if useroptions.user_solde %} {% if useroptions.user_solde %}
<th>Solde négatif</th>
<td>{{ useroptions.solde_negatif }}</td>
</tr>
<tr> <tr>
<th>Solde maximum</th> <th>Solde maximum</th>
<td>{{ useroptions.max_solde }}</td> <td>{{ useroptions.max_solde }}</td>
<th>Montant minimal de rechargement en ligne</th> <th>Montant minimal de rechargement en ligne</th>
<td>{{ useroptions.min_online_payment }}</td> <td>{{ useroptions.min_online_payment }}</td>
</tr> </tr>
{% endif %} {% else %}
<tr>
<th>Auto inscription</th>
<td>{{ useroptions.self_adhesion }}</td>
<th>Shell par défaut des utilisateurs</th>
<td>{{ useroptions.shell_default }}</td>
</tr> </tr>
{% endif%}
<tr> <tr>
<th>Extension mail interne</th> <th>Extension mail interne</th>
<td>{{ useroptions.mail_extension }}</td> <td>{{ useroptions.mail_extension }}</td>

View file

@ -108,7 +108,6 @@ footer a {
overflow-y: visible; overflow-y: visible;
} }
/* For tables with long text in cells */ /* For tables with long text in cells */
.table.long_text{ .table.long_text{
@ -124,3 +123,42 @@ td.long_text{
th.long_text{ th.long_text{
width: 60%; 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,22 +27,100 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% load acl %} {% load acl %}
{% block title %}Profil{% endblock %} {% block title %}Profil{% endblock %}
{% block content %} {% block content %}
<h2>{{ users.surname }} {{users.name}}</h2> <div align="center">
<p>Vous êtes {% if users.end_adhesion != None %}<span class="label label-success"> <h2>Bienvenue {{users.name}} {{ users.surname }}</h2>
un {{ users.class_name | lower}}</span>{% else %}<span class="label label-danger"> </div>
non adhérent</span>{% endif %} et votre connexion est {% if users.has_access %} <div class="dashboard_container">
<span class="label label-success">active</span>{% else %}<span class="label label-danger">désactivée</span>{% endif %}.</p> <div class="row">
{% if user_solde %} {% if solde_activated %}
<p>Votre solde est de <span class="badge">{{ user.solde }}€</span>. <div class="col-sm-6 col-md-4">
{% if allow_online_payment %} {% else %}
<a class="btn btn-primary btn-sm" role="button" href="{% url 'cotisations:recharge' %}"> <div class="col-sm-6 col-md-6">
<i class="fa fa-euro-sign"></i> {% endif %}
Recharger <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> </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 %} {% endif %}
</p> </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 %} {% 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-group" id="accordion">
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading clearfix" data-parent="#accordion" data-toggle="collapse" data-target="#collapse1"> <div class="panel-heading clearfix" data-parent="#accordion" data-toggle="collapse" data-target="#collapse1">
@ -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 <i class="fa fa-user"></i> Informations détaillées
</h3> </h3>
</div> </div>
<div class="panel-collapse collapse in" id="collapse1"> <div class="panel-collapse collapse" id="collapse1">
<div class="panel-body"> <div class="panel-body">
<a class="btn btn-primary btn-sm" role="button" href="{% url 'users:edit-info' users.id %}"> <a class="btn btn-primary btn-sm" role="button" href="{% url 'users:edit-info' users.id %}">
<i class="fa fa-edit"></i> <i class="fa fa-edit"></i>

View file

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