mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-12-22 23:13:46 +00:00
Merge branch 'new_profil' into 'master'
New profil See merge request federez/re2o!197
This commit is contained in:
commit
af35507c6d
2 changed files with 99 additions and 16 deletions
|
@ -28,19 +28,101 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
{% load logs_extra %}
|
||||
{% 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">{{ users.solde }}€</span>.
|
||||
<a class="btn btn-primary btn-sm" role="button" href="{% url 'cotisations:credit-solde' users.pk%}">
|
||||
<i class="fa fa-euro-sign"></i>
|
||||
Recharger
|
||||
</a>
|
||||
</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_adherent%}
|
||||
<div class="panel panel-danger">
|
||||
<div class="panel-heading dashboard">Non Connécté</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>
|
||||
Adhérer
|
||||
</a>
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="panel panel-success">
|
||||
<div class="panel-heading dashboard">Connécté</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="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>
|
||||
</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">
|
||||
|
|
|
@ -51,7 +51,7 @@ from reversion import revisions as reversion
|
|||
|
||||
from cotisations.models import Facture, Paiement
|
||||
from machines.models import Machine
|
||||
from preferences.models import GeneralOption
|
||||
from preferences.models import OptionalUser, GeneralOption, AssoOption
|
||||
from re2o.views import form
|
||||
from re2o.utils import (
|
||||
all_has_access,
|
||||
|
@ -112,8 +112,7 @@ 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()
|
||||
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)
|
||||
|
@ -914,6 +913,8 @@ def profil(request, users, **_kwargs):
|
|||
'ban_list': bans,
|
||||
'white_list': whitelists,
|
||||
'user_solde': user_solde,
|
||||
'solde_activated': Paiement.objects.filter(is_balance=True).exists(),
|
||||
'asso_name': AssoOption.objects.first().name
|
||||
}
|
||||
)
|
||||
|
||||
|
|
Loading…
Reference in a new issue