mirror of
https://github.com/nanoy42/coope
synced 2024-12-26 00:43:46 +00:00
293 lines
No EOL
9.2 KiB
HTML
293 lines
No EOL
9.2 KiB
HTML
{% extends "base.html" %}
|
|
{% load static %}
|
|
{% block entete %}{% if self %}Mon Profil{% else %}Profil de {{user}}{% endif %}{%endblock%}
|
|
|
|
{% block navbar %}
|
|
<ul>
|
|
<li><a href="#first">{% if self %}Mes informations {% else %} Informations {% endif %}</a>
|
|
</li>
|
|
<li><a href="#second">{% if self %}Mes dernières consommations {% else %} Dernières consommations {% endif %}</a>
|
|
</li>
|
|
<li><a href="#third">{% if self %}Mes derniers rechargements{% else %}Derniers rechargements {% endif %}</a>
|
|
</li>
|
|
<li><a href="#fourth">{% if self %} Mes cotisations {% else %} Cotisations {% endif %}</a></li>
|
|
<li><a href="#fifth">{% if self %} Mes accès gracieux {% else %} Accès gracieux {% endif %}</a></li>
|
|
</ul>
|
|
{% endblock %}
|
|
{% block content %}
|
|
<section id="first" class="main">
|
|
<div class="content">
|
|
<header class="major">
|
|
<h2>{% if self %} Mes informations {% else %} Informations {% endif %}</h2>
|
|
</header>
|
|
<div class="row">
|
|
<div class="12u">
|
|
<ul class="alt" id="informationsClient">
|
|
<li>
|
|
<b>Nom : </b>{{user.last_name}}<span class="tabulation">
|
|
<b>Prénom : </b>{{user.first_name}}</span><span class="tabulation">
|
|
<b>École : </b>{{user.profile.school}}</span>
|
|
</li>
|
|
<li><b>Pseudo : </b>{{user.username}}<span class="tabulation">
|
|
<b>Mail: </b> {{user.email}}</span>
|
|
</li>
|
|
<li>
|
|
<b>Date inscription : </b>{{user.date_joined}}<span class="tabulation">
|
|
<b>Fin de cotisation: </b> {{user.profile.cotisationEnd|default:"Aucune cotisation"}}</span>
|
|
</li>
|
|
<li><b>Solde : </b>{{user.profile.balance}}<span class="tabulation">
|
|
<b>Crédit : </b>{{user.profile.credit}}</span><span class="tabulation">
|
|
<b>Débit : </b>{{user.profile.debit}}</span>
|
|
</li>
|
|
<li><b>Groupe(s) : </b>{{user.groups.all|join:", "}}</li>
|
|
<li>
|
|
<b>Position au classement : </b>{{user.profile.rank}}<span class="tabulation">
|
|
<b>Quantité d'alcool ingérée : </b>{{user.profile.alcohol | floatformat:"-2"}} kg</span><span class="tabulation">
|
|
<b>Nombre de pinte(s) non rendue(s) : </b> {{ user.pintes_owned_currently.count }} </span>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
<div class="12u">
|
|
<ul class="alt">
|
|
<li>
|
|
{% if self or perms.users.can_change_user %}
|
|
<span><a href="{% url 'users:editUser' user.pk %}">Modifier {{self | yesno:"mes,les"}} informations</a></span>
|
|
{% endif %}
|
|
{% if self %}
|
|
<span class="tabulation"><a href="{% url 'users:editPassword' user.pk %}">Changer mon mot de passe</a></span>
|
|
{% endif %}
|
|
{% if perms.users.can_reset_password %}
|
|
<span class="tabulation"><a href="{% url 'users:resetPassword' user.pk %}">Réinitialiser le mot de passe</a></span>
|
|
{% endif %}
|
|
{% if perms.users.can_change_user_perm %}
|
|
<span class="tabulation"><a href="{% url 'users:editGroups' user.pk %}">Changer les groupes</a></span>
|
|
{% endif %}
|
|
{% if request.user.is_staff %}
|
|
{% if user.is_staff %}
|
|
<span class="tabulation"><a href="">Retirer des admins</a></span>
|
|
{% else %}
|
|
<span class="tabulation"><a href="">Ajouter aux admins</a></span>
|
|
{% endif %}
|
|
{% endif %}
|
|
{% if request.user.is_superuser %}
|
|
{% if user.is_superuser %}
|
|
<span class="tabulation"><a href="">Retirer des superusers</a></span>
|
|
{% else %}
|
|
<span class="tabulation"><a href="">Ajouter aux superusers</a></span>
|
|
{% endif %}
|
|
{% endif %}
|
|
{% if perms.auth.change_user %}
|
|
<span class="tabulation"><a href="{% url 'users:switchActivateUser' user.pk %}">{{ user.is_active | yesno:"Désa,A"}}ctiver</a></span>
|
|
{% endif %}
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<section class="row uniform">
|
|
<canvas id="myChart" width="2000px" height="2000px"></canvas>
|
|
<script src="{% static 'chart.min.js' %}"></script>
|
|
<script>
|
|
var ctx = document.getElementById("myChart").getContext('2d');
|
|
var myChart = new Chart(ctx, {
|
|
type: 'pie',
|
|
data: {
|
|
labels: [{% for p in products %}"{{p}}", {% endfor %}],
|
|
datasets: [{
|
|
label: '# of Votes',
|
|
data: [{% for q in quantities %}{{q}}, {% endfor %}],
|
|
backgroundColor: [
|
|
'rgba(255, 99, 132, 0.2)',
|
|
'rgba(54, 162, 235, 0.2)',
|
|
'rgba(255, 206, 86, 0.2)',
|
|
'rgba(75, 192, 192, 0.2)',
|
|
'rgba(153, 102, 255, 0.2)',
|
|
'rgba(255, 159, 64, 0.2)'
|
|
],
|
|
borderColor: [
|
|
'rgba(255,99,132,1)',
|
|
'rgba(54, 162, 235, 1)',
|
|
'rgba(255, 206, 86, 1)',
|
|
'rgba(75, 192, 192, 1)',
|
|
'rgba(153, 102, 255, 1)',
|
|
'rgba(255, 159, 64, 1)'
|
|
],
|
|
borderWidth: 1
|
|
}]
|
|
},
|
|
options: {
|
|
scales: {
|
|
yAxes: [{
|
|
ticks: {
|
|
beginAtZero:true
|
|
}
|
|
}]
|
|
}
|
|
}
|
|
});
|
|
</script>
|
|
</section>
|
|
</section>
|
|
<section id="second" class="main">
|
|
<header class="major">
|
|
<h2>{{self | yesno:"Mes dernières,Dernières"}} consommations</h2>
|
|
<p>(Affichage des 10 dernières entrées : <a href="{% url 'users:allConsumptions' user.pk 1 %}">Voir toutes les entrées</a>)</p>
|
|
</header>
|
|
<section id="transactions">
|
|
<div class="table-wrapper">
|
|
<table>
|
|
<thead id="headTransaction">
|
|
<tr>
|
|
<th>Produit</th>
|
|
<th>Quantité</th>
|
|
<th>Montant</th>
|
|
<th>Type de Paiement</th>
|
|
<th>Date</th>
|
|
<th>Annuler</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody id="bodyTransaction">
|
|
{% for c in lastConsumptions %}
|
|
<tr>
|
|
<td>{{c.product}}</td>
|
|
<td>{{c.quantity}}</td>
|
|
<td>{{c.amount}}</td>
|
|
<td>{{c.paymentMethod}}</td>
|
|
<td>{{c.date}}</td>
|
|
<td>{% if perms.gestion.delete_consumptionhistory %}<a href="{% url 'gestion:cancelConsumption' c.pk %}" class="button small">Annuler</a>{% endif %}</td>
|
|
</tr>
|
|
{%endfor%}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</section>
|
|
</section>
|
|
<section id="secondbis" class="main">
|
|
<header class="major">
|
|
<h2>{{self | yesno:"Mes derniers,Derniers"}} menus</h2>
|
|
<p>(Affichage des 5 dernières entrées : <a href="{% url 'users:allMenus' user.pk 1 %}">Voir toutes les entrées</a>)</p>
|
|
</header>
|
|
<section id="transactions">
|
|
<div class="table-wrapper">
|
|
<table>
|
|
<thead id="headTransaction">
|
|
<tr>
|
|
<th>Menu</th>
|
|
<th>Quantité</th>
|
|
<th>Montant</th>
|
|
<th>Type de Paiement</th>
|
|
<th>Date</th>
|
|
<th>Annuler</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody id="bodyTransaction">
|
|
{% for m in lastMenus %}
|
|
<tr>
|
|
<td>{{m.menu}}</td>
|
|
<td>{{m.quantity}}</td>
|
|
<td>{{m.amount}}</td>
|
|
<td>{{m.paymentMethod}}</td>
|
|
<td>{{m.date}}</td>
|
|
<td>{% if perms.gestion.delete_menuhistory %}<a href="{% url 'gestion:cancelMenu' m.pk %}" class="button small">Annuler</a>{% endif %}</td>
|
|
</tr>
|
|
{%endfor%}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</section>
|
|
</section>
|
|
<section id="third" class="main">
|
|
<header class="major">
|
|
<h2>{{self | yesno:"Mes derniers,Derniers"}} rechargements</h2>
|
|
<p>(Affichage des 5 dernières entrées : <a href="{% url 'users:allReloads' user.pk 1 %}">Voir toutes les entrées</a>)</p>
|
|
</header>
|
|
<section>
|
|
<div class="table-wrapper">
|
|
<table>
|
|
<thead>
|
|
<tr>
|
|
<th>Montant</th>
|
|
<th>Type de Rechargement</th>
|
|
<th>Date</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{% for reload in reloads %}
|
|
<tr>
|
|
<td>{{reload.amount}}€</td>
|
|
<td>{{reload.PaymentMethod}}</td>
|
|
<td>{{reload.date}}</td>
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</section>
|
|
</section>
|
|
|
|
<section id="fourth" class="main">
|
|
<header class="major">
|
|
<h2>{{ self | yesno:"Mes cotisations,Cotisations"}}</h2>
|
|
</header>
|
|
<section>
|
|
<a class="button" href="{% url 'users:addCotisationHistory' user.pk %}">Ajouter une cotisation</a><br><br>
|
|
<div class="table-wrapper">
|
|
<table>
|
|
<thead>
|
|
<tr>
|
|
<th>Montant</th>
|
|
<th>Durée</th>
|
|
<th>Date de paiement</th>
|
|
<th>Moyen de paiement</th>
|
|
<th>Date de fin</th>
|
|
<th>Etat</th>
|
|
<th>Modération</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{% for cotisation in cotisations %}
|
|
<tr>
|
|
<td>{{cotisation.amount}}€</td>
|
|
<td>{{cotisation.duration}} jours</td>
|
|
<td>{{cotisation.paymentDate}}</td>
|
|
<td>{{cotisation.paymentMethod}}</td>
|
|
<td>{{cotisation.endDate}}</td>
|
|
<td>{{cotisation.valid}}</td>
|
|
<td>{% if perms.users.validate_cotisationHistory %}<a class="button small" href="{% url 'users:validateCotisationHistory' cotisation.pk %}">Valider</a> <a class="button small" href="{% url 'users:invalidateCotisationHistory' cotisation.pk %}">Invalider</a>{% endif %}</td>
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</section>
|
|
</section>
|
|
|
|
<section id="fifth" class="main">
|
|
<header class="major">
|
|
<h2>{{ self | yesno:"Mes accès gracieux,Accès gracieux"}}</h2>
|
|
</header>
|
|
<section>
|
|
<a class="button" href="{% url 'users:addWhiteListHistory' user.pk %}">Ajouter un accès à titre gracieux</a><br><br>
|
|
<div class="table-wrapper">
|
|
<table>
|
|
<thead>
|
|
<tr>
|
|
<th>Date de l'ajout</th>
|
|
<th>Date de fin</th>
|
|
<th>Durée</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{% for whitelist in whitelists %}
|
|
<tr>
|
|
<td>{{whitelist.paymentDate}}</td>
|
|
<td>{{whitelist.endDate}}</td>
|
|
<td>{{whitelist.duration}} jours</td>
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</section>
|
|
</section>
|
|
{%endblock%} |