mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-22 11:23:10 +00:00
Ajoute des acl cableur
This commit is contained in:
parent
765e06d0c6
commit
6911e422cb
12 changed files with 304 additions and 90 deletions
|
@ -18,7 +18,7 @@
|
||||||
<td>{{ facture.prix }}</td>
|
<td>{{ facture.prix }}</td>
|
||||||
<td>{{ facture.paiement }}</td>
|
<td>{{ facture.paiement }}</td>
|
||||||
<td>{{ facture.date }}</td>
|
<td>{{ facture.date }}</td>
|
||||||
<td><a class="btn btn-primary btn-sm" role="button" href="{% url 'cotisations:edit-facture' facture.id %}"><i class="glyphicon glyphicon-bitcoin"></i> Editer</a></td>
|
<td>{% if is_cableur %}<a class="btn btn-primary btn-sm" role="button" href="{% url 'cotisations:edit-facture' facture.id %}"><i class="glyphicon glyphicon-bitcoin"></i> Editer</a>{% endif %}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</table>
|
</table>
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
{% language 'fr' %}
|
{% language 'fr' %}
|
||||||
|
|
||||||
\nonstopmode
|
\nonstopmode
|
||||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
% Invoice Template
|
% Invoice Template
|
||||||
% LaTeX Template
|
% LaTeX Template
|
||||||
% Version 1.0 (3/11/12)
|
% Version 1.0 (3/11/12)
|
||||||
%
|
%% This template has been downloaded from:
|
||||||
% This template has been downloaded from:
|
|
||||||
% http://www.LaTeXTemplates.com
|
% http://www.LaTeXTemplates.com
|
||||||
%
|
%
|
||||||
% Original author:
|
% Original author:
|
||||||
|
@ -29,17 +29,12 @@
|
||||||
\documentclass[12pt]{article} % Use the custom invoice class (invoice.cls)
|
\documentclass[12pt]{article} % Use the custom invoice class (invoice.cls)
|
||||||
\usepackage[utf8]{inputenc}
|
\usepackage[utf8]{inputenc}
|
||||||
\usepackage[frenchb]{babel}
|
\usepackage[frenchb]{babel}
|
||||||
\usepackage{eurosym}
|
|
||||||
\usepackage{tabularx}
|
\usepackage{tabularx}
|
||||||
\usepackage[letterpaper,hmargin=0.79in,vmargin=0.79in]{geometry}
|
\usepackage[letterpaper,hmargin=0.79in,vmargin=0.79in]{geometry}
|
||||||
\usepackage[parfill]{parskip} % Do not indent paragraphs
|
|
||||||
\usepackage{fp} % Fixed-point arithmetic
|
|
||||||
\usepackage{calc} % Counters for totaling hours and cost
|
\usepackage{calc} % Counters for totaling hours and cost
|
||||||
\usepackage{longtable}
|
\usepackage{longtable}
|
||||||
\usepackage{graphicx}
|
\usepackage{graphicx}
|
||||||
\usepackage[absolute]{textpos}
|
|
||||||
\usepackage{calc}
|
\usepackage{calc}
|
||||||
\usepackage{xparse}
|
|
||||||
|
|
||||||
\pagestyle{empty} % No page numbers
|
\pagestyle{empty} % No page numbers
|
||||||
\linespread{1.5} % Line spacing
|
\linespread{1.5} % Line spacing
|
||||||
|
@ -84,7 +79,6 @@ Siret :
|
||||||
% TABLE OF EXPENSES
|
% TABLE OF EXPENSES
|
||||||
%----------------------------------------------------------------------------------------
|
%----------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
\begin{tabularx}{\textwidth}{|l|X|r|r|r|}
|
\begin{tabularx}{\textwidth}{|l|X|r|r|r|}
|
||||||
\hline
|
\hline
|
||||||
\textbf{Code} & \textbf{Désignation} & \textbf{Qté.} & \textbf{Prix Unit.} \euro & \textbf{Prix Tot.} \euro\\
|
\textbf{Code} & \textbf{Désignation} & \textbf{Qté.} & \textbf{Prix Unit.} \euro & \textbf{Prix Tot.} \euro\\
|
||||||
|
@ -120,5 +114,3 @@ Siret :
|
||||||
%----------------------------------------------------------------------------------------
|
%----------------------------------------------------------------------------------------
|
||||||
|
|
||||||
\end{document}
|
\end{document}
|
||||||
|
|
||||||
|
|
||||||
|
|
116
cotisations/templates/cotisations/factures_old.tex
Normal file
116
cotisations/templates/cotisations/factures_old.tex
Normal file
|
@ -0,0 +1,116 @@
|
||||||
|
{% load i18n %}
|
||||||
|
{% language 'fr' %}
|
||||||
|
|
||||||
|
\nonstopmode
|
||||||
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
% Invoice Template
|
||||||
|
% LaTeX Template
|
||||||
|
% Version 1.0 (3/11/12)
|
||||||
|
%% This template has been downloaded from:
|
||||||
|
% http://www.LaTeXTemplates.com
|
||||||
|
%
|
||||||
|
% Original author:
|
||||||
|
% Trey Hunner (http://www.treyhunner.com/)
|
||||||
|
%
|
||||||
|
% License:
|
||||||
|
% CC BY-NC-SA 3.0 (http://creativecommons.org/licenses/by-nc-sa/3.0/)
|
||||||
|
%
|
||||||
|
% Important note:
|
||||||
|
% This template requires the invoice.cls file to be in the same directory as
|
||||||
|
% the .tex file. The invoice.cls file provides the style used for structuring the
|
||||||
|
% document.
|
||||||
|
%
|
||||||
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
||||||
|
%----------------------------------------------------------------------------------------
|
||||||
|
% DOCUMENT CONFIGURATION
|
||||||
|
%----------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
\documentclass[12pt]{article} % Use the custom invoice class (invoice.cls)
|
||||||
|
\usepackage[utf8]{inputenc}
|
||||||
|
\usepackage[frenchb]{babel}
|
||||||
|
\usepackage{tabularx}
|
||||||
|
\usepackage[letterpaper,hmargin=0.79in,vmargin=0.79in]{geometry}
|
||||||
|
\usepackage{calc} % Counters for totaling hours and cost
|
||||||
|
\usepackage{longtable}
|
||||||
|
\usepackage{graphicx}
|
||||||
|
\usepackage{calc}
|
||||||
|
|
||||||
|
\pagestyle{empty} % No page numbers
|
||||||
|
\linespread{1.5} % Line spacing
|
||||||
|
|
||||||
|
\setlength{\doublerulesep}{\arrayrulewidth} % Double rules look like one thick one
|
||||||
|
\def \tab {\hspace*{3ex}} % Define \tab to create some horizontal white space
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
\begin{document}
|
||||||
|
%\newcommand{\product}[5][0][0][0][0][0]{
|
||||||
|
%\setlength{ptotal}{#3*\real{#4}}
|
||||||
|
%\addtolength{total}{#3*\real{#4}}
|
||||||
|
\DeclareDocumentCommand{\product}{ O{0} O{0} O{0} O{0} O{0} }{
|
||||||
|
#1 & #2 & #3 & #4 & #5 \\
|
||||||
|
\hline
|
||||||
|
}
|
||||||
|
|
||||||
|
%----------------------------------------------------------------------------------------
|
||||||
|
% HEADING SECTION
|
||||||
|
%----------------------------------------------------------------------------------------
|
||||||
|
\begin{titlepage}
|
||||||
|
\begin{textblock*}{4cm}(20mm,5mm)
|
||||||
|
%\includegraphics[scale=0.3]{% templatetag openbrace %}{{tpl_path}}/logo.png}
|
||||||
|
\end{textblock*}
|
||||||
|
\end{titlepage}
|
||||||
|
\hfil{\Huge\bf ReZo Metz}\hfil % Company providing the invoice
|
||||||
|
\bigskip\break % Whitespace
|
||||||
|
\hrule % Horizontal line
|
||||||
|
2 rue Edouard Belin \\ % Your address and contact information
|
||||||
|
57070 Metz \hfill augustin.lemesle@supelec.fr \\
|
||||||
|
Siret :
|
||||||
|
\\ \\
|
||||||
|
{\bf À :} \tab {{f.user.name}} {{f.user.surname}} \\ % Invoice recipient
|
||||||
|
|
||||||
|
{\bf Date:} \tab {{DATE}} \\ % Invoice date
|
||||||
|
|
||||||
|
{\bf Facture \no:} \tab {{fid}} \\ % Invoice number
|
||||||
|
|
||||||
|
%----------------------------------------------------------------------------------------
|
||||||
|
% TABLE OF EXPENSES
|
||||||
|
%----------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
\begin{tabularx}{\textwidth}{|l|X|r|r|r|}
|
||||||
|
\hline
|
||||||
|
\textbf{Code} & \textbf{Désignation} & \textbf{Qté.} & \textbf{Prix Unit.} \euro & \textbf{Prix Tot.} \euro\\
|
||||||
|
\hline
|
||||||
|
|
||||||
|
{% for a in f.article %}
|
||||||
|
\product[{{a.code}}][{{a.designation}}][{{a.nombre}}][{{a.pu|floatformat:2}}][{{a.ptotal|floatformat:2}}]
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
|
\hline
|
||||||
|
\end{tabularx}
|
||||||
|
|
||||||
|
%\setcounter{paid}{0}
|
||||||
|
%\setcounter{topay}{\real{\value{total}}-\value{paid}}
|
||||||
|
|
||||||
|
\hfill
|
||||||
|
\begin{tabular}{|l|r|}
|
||||||
|
\hline
|
||||||
|
\textbf{Total} & {{total|floatformat:2}}\euro \\
|
||||||
|
\textbf{Votre règlement} & {{paid|floatformat:2}}\euro \\
|
||||||
|
\hline
|
||||||
|
\textbf{À PAYER} & {{topay|floatformat:2}}\euro \\
|
||||||
|
\hline
|
||||||
|
\hline
|
||||||
|
|
||||||
|
\end{tabular}
|
||||||
|
|
||||||
|
\vspace{1.5cm} % Whitespace
|
||||||
|
\hrule % Horizontal line
|
||||||
|
\footnotesize{TVA non applicable, art. 293 B du CGI}
|
||||||
|
|
||||||
|
{% endlanguage %}
|
||||||
|
%----------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
\end{document}
|
71
cotisations/tex.py
Normal file
71
cotisations/tex.py
Normal file
|
@ -0,0 +1,71 @@
|
||||||
|
from django.template.loader import get_template
|
||||||
|
from django.template import TemplateDoesNotExist, Context
|
||||||
|
from django.http import HttpResponse, Http404, HttpResponseNotModified
|
||||||
|
from django.core.cache import cache
|
||||||
|
from django.conf import settings
|
||||||
|
from django.shortcuts import redirect
|
||||||
|
|
||||||
|
from tempfile import mkdtemp
|
||||||
|
import subprocess
|
||||||
|
import os
|
||||||
|
import shutil
|
||||||
|
from hashlib import md5
|
||||||
|
|
||||||
|
|
||||||
|
TEMP_PREFIX = getattr(settings, 'TEX_TEMP_PREFIX', 'render_tex-')
|
||||||
|
CACHE_PREFIX = getattr(settings, 'TEX_CACHE_PREFIX', 'render-tex')
|
||||||
|
CACHE_TIMEOUT = getattr(settings, 'TEX_CACHE_TIMEOUT', 86400) # 1 day
|
||||||
|
|
||||||
|
|
||||||
|
def render_tex(request, template, ctx={}):
|
||||||
|
doc = template.rsplit('/', 1)[-1].rsplit('.', 1)[0]
|
||||||
|
|
||||||
|
# Utile ? Parfois il faut le chemin absolu pour retrouver les images
|
||||||
|
#ctx.setdefault('tpl_path', os.path.join(settings.BASE_DIR, 'factures/templates/factures'))
|
||||||
|
|
||||||
|
try:
|
||||||
|
body = get_template(template).render(Context(ctx)).encode('utf-8')
|
||||||
|
except TemplateDoesNotExist:
|
||||||
|
raise Http404()
|
||||||
|
|
||||||
|
etag = md5(body).hexdigest()
|
||||||
|
if request.META.get('HTTP_IF_NONE_MATCH', '') == etag:
|
||||||
|
return HttpResponseNotModified()
|
||||||
|
|
||||||
|
cache_key = "%s:%s:%s" % (CACHE_PREFIX, template, etag)
|
||||||
|
pdf = cache.get(cache_key)
|
||||||
|
if pdf is None:
|
||||||
|
if b'\\nonstopmode' not in body:
|
||||||
|
raise ValueError("\\nonstopmode not present in document, cowardly refusing to process.")
|
||||||
|
|
||||||
|
tmp = mkdtemp(prefix=TEMP_PREFIX)
|
||||||
|
try:
|
||||||
|
with open("%s/%s.tex" % (tmp, doc), "w") as f:
|
||||||
|
f.write(str(body))
|
||||||
|
del body
|
||||||
|
|
||||||
|
error = subprocess.Popen(
|
||||||
|
["pdflatex", "%s.tex" % doc],
|
||||||
|
cwd=tmp,
|
||||||
|
stdin=open(os.devnull, "r"),
|
||||||
|
stderr=open(os.devnull, "wb"),
|
||||||
|
stdout=open(os.devnull, "wb")
|
||||||
|
).wait()
|
||||||
|
|
||||||
|
if error:
|
||||||
|
log = open("%s/%s.log" % (tmp, doc)).read()
|
||||||
|
return HttpResponse(log, content_type="text/plain")
|
||||||
|
|
||||||
|
pdf = open("%s/%s.pdf" % (tmp, doc)).read()
|
||||||
|
finally:
|
||||||
|
shutil.rmtree(tmp)
|
||||||
|
pass
|
||||||
|
|
||||||
|
if pdf:
|
||||||
|
cache.set(cache_key, pdf, CACHE_TIMEOUT)
|
||||||
|
|
||||||
|
res = HttpResponse(pdf, content_type="application/pdf")
|
||||||
|
res['ETag'] = etag
|
||||||
|
return res
|
||||||
|
|
||||||
|
|
|
@ -49,6 +49,7 @@ def create_cotis(facture, user, duration):
|
||||||
return
|
return
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
|
@permission_required('cableur')
|
||||||
def new_facture(request, userid):
|
def new_facture(request, userid):
|
||||||
try:
|
try:
|
||||||
user = User.objects.get(pk=userid)
|
user = User.objects.get(pk=userid)
|
||||||
|
@ -77,6 +78,7 @@ def new_facture_pdf(request):
|
||||||
return render_tex(request, 'cotisations/factures.tex', {'DATE':None})
|
return render_tex(request, 'cotisations/factures.tex', {'DATE':None})
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
|
@permission_required('cableur')
|
||||||
def edit_facture(request, factureid):
|
def edit_facture(request, factureid):
|
||||||
try:
|
try:
|
||||||
facture = Facture.objects.get(pk=factureid)
|
facture = Facture.objects.get(pk=factureid)
|
||||||
|
@ -167,6 +169,7 @@ def del_paiement(request):
|
||||||
return form({'factureform': paiement}, 'cotisations/facture.html', request)
|
return form({'factureform': paiement}, 'cotisations/facture.html', request)
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
|
@permission_required('cableur')
|
||||||
def add_banque(request):
|
def add_banque(request):
|
||||||
banque = BanqueForm(request.POST or None)
|
banque = BanqueForm(request.POST or None)
|
||||||
if banque.is_valid():
|
if banque.is_valid():
|
||||||
|
@ -206,24 +209,29 @@ def del_banque(request):
|
||||||
return form({'factureform': banque}, 'cotisations/facture.html', request)
|
return form({'factureform': banque}, 'cotisations/facture.html', request)
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
|
@permission_required('cableur')
|
||||||
def index_article(request):
|
def index_article(request):
|
||||||
is_trez = request.user.has_perms(('trésorier',))
|
is_trez = request.user.has_perms(('trésorier',))
|
||||||
article_list = Article.objects.order_by('name')
|
article_list = Article.objects.order_by('name')
|
||||||
return render(request, 'cotisations/index_article.html', {'article_list':article_list, 'is_trez':is_trez})
|
return render(request, 'cotisations/index_article.html', {'article_list':article_list, 'is_trez':is_trez})
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
|
@permission_required('cableur')
|
||||||
def index_paiement(request):
|
def index_paiement(request):
|
||||||
is_trez = request.user.has_perms(('trésorier',))
|
is_trez = request.user.has_perms(('trésorier',))
|
||||||
paiement_list = Paiement.objects.order_by('moyen')
|
paiement_list = Paiement.objects.order_by('moyen')
|
||||||
return render(request, 'cotisations/index_paiement.html', {'paiement_list':paiement_list, 'is_trez':is_trez})
|
return render(request, 'cotisations/index_paiement.html', {'paiement_list':paiement_list, 'is_trez':is_trez})
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
|
@permission_required('cableur')
|
||||||
def index_banque(request):
|
def index_banque(request):
|
||||||
is_trez = request.user.has_perms(('trésorier',))
|
is_trez = request.user.has_perms(('trésorier',))
|
||||||
banque_list = Banque.objects.order_by('name')
|
banque_list = Banque.objects.order_by('name')
|
||||||
return render(request, 'cotisations/index_banque.html', {'banque_list':banque_list, 'is_trez':is_trez})
|
return render(request, 'cotisations/index_banque.html', {'banque_list':banque_list, 'is_trez':is_trez})
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
|
@permission_required('cableur')
|
||||||
def index(request):
|
def index(request):
|
||||||
|
is_cableur = request.user.has_perms(('cableur',))
|
||||||
facture_list = Facture.objects.order_by('date').reverse()
|
facture_list = Facture.objects.order_by('date').reverse()
|
||||||
return render(request, 'cotisations/index.html', {'facture_list': facture_list})
|
return render(request, 'cotisations/index.html', {'facture_list': facture_list, 'is_cableur': is_cableur})
|
||||||
|
|
|
@ -191,17 +191,20 @@ def del_extension(request):
|
||||||
return form({'machineform': extension, 'interfaceform': None}, 'machines/machine.html', request)
|
return form({'machineform': extension, 'interfaceform': None}, 'machines/machine.html', request)
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
|
@permission_required('cableur')
|
||||||
def index(request):
|
def index(request):
|
||||||
interfaces_list = Interface.objects.order_by('pk')
|
interfaces_list = Interface.objects.order_by('pk')
|
||||||
return render(request, 'machines/index.html', {'interfaces_list': interfaces_list})
|
return render(request, 'machines/index.html', {'interfaces_list': interfaces_list})
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
|
@permission_required('cableur')
|
||||||
def index_machinetype(request):
|
def index_machinetype(request):
|
||||||
is_infra = request.user.has_perms(('infra',))
|
is_infra = request.user.has_perms(('infra',))
|
||||||
machinetype_list = MachineType.objects.order_by('type')
|
machinetype_list = MachineType.objects.order_by('type')
|
||||||
return render(request, 'machines/index_machinetype.html', {'machinetype_list':machinetype_list, 'is_infra':is_infra})
|
return render(request, 'machines/index_machinetype.html', {'machinetype_list':machinetype_list, 'is_infra':is_infra})
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
|
@permission_required('cableur')
|
||||||
def index_extension(request):
|
def index_extension(request):
|
||||||
is_infra = request.user.has_perms(('infra',))
|
is_infra = request.user.has_perms(('infra',))
|
||||||
extension_list = Extension.objects.order_by('name')
|
extension_list = Extension.objects.order_by('name')
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
<div id="wrap">
|
||||||
<nav class="navbar navbar-inverse">
|
<nav class="navbar navbar-inverse">
|
||||||
<div class="container-fluid">
|
<div class="container-fluid">
|
||||||
<div class="navbar-header">
|
<div class="navbar-header">
|
||||||
|
@ -62,7 +63,7 @@
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
<div class="container-fluid text-center">
|
<div id="main" class="container-fluid text-center">
|
||||||
<div class="row content">
|
<div class="row content">
|
||||||
<div class="col-sm-2 sidenav">
|
<div class="col-sm-2 sidenav">
|
||||||
{% block sidebar %}
|
{% block sidebar %}
|
||||||
|
@ -89,8 +90,9 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<footer class="navbar navbar-fixed-bottom">
|
<footer class="navbar">
|
||||||
<div class="containerfluid text-center">
|
<div class="containerfluid text-center">
|
||||||
<p>Re2o 2016 - Goulven Kermarec, Gabriel Détraz, Augustin Lemesle</p>
|
<p>Re2o 2016 - Goulven Kermarec, Gabriel Détraz, Augustin Lemesle</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -8,12 +8,14 @@ from topologie.forms import EditPortForm, EditSwitchForm, AddPortForm
|
||||||
from users.views import form
|
from users.views import form
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
|
@permission_required('cableur')
|
||||||
def index(request):
|
def index(request):
|
||||||
is_infra = request.user.has_perms(('infra',))
|
is_infra = request.user.has_perms(('infra',))
|
||||||
switch_list = Switch.objects.order_by('building', 'number')
|
switch_list = Switch.objects.order_by('building', 'number')
|
||||||
return render(request, 'topologie/index.html', {'switch_list': switch_list, 'is_infra':is_infra})
|
return render(request, 'topologie/index.html', {'switch_list': switch_list, 'is_infra':is_infra})
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
|
@permission_required('cableur')
|
||||||
def index_port(request, switch_id):
|
def index_port(request, switch_id):
|
||||||
is_infra = request.user.has_perms(('infra',))
|
is_infra = request.user.has_perms(('infra',))
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
<td>{{ ban.raison }}</td>
|
<td>{{ ban.raison }}</td>
|
||||||
<td>{{ ban.date_start }}</td>
|
<td>{{ ban.date_start }}</td>
|
||||||
<td>{{ ban.date_end }}</td>
|
<td>{{ ban.date_end }}</td>
|
||||||
<td><a class="btn btn-primary btn-sm" role="button" href="{% url 'users:edit-ban' ban.id %}"><i class="glyphicon glyphicon-pushpin"></i> Editer</a></td>
|
<td>{% if is_bofh %}<a class="btn btn-primary btn-sm" role="button" href="{% url 'users:edit-ban' ban.id %}"><i class="glyphicon glyphicon-pushpin"></i> Editer</a>{% endif %}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</table>
|
</table>
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
<td>{{ whitelist.raison }}</td>
|
<td>{{ whitelist.raison }}</td>
|
||||||
<td>{{ whitelist.date_start }}</td>
|
<td>{{ whitelist.date_start }}</td>
|
||||||
<td>{{ whitelist.date_end }}</td>
|
<td>{{ whitelist.date_end }}</td>
|
||||||
<td><a class="btn btn-primary btn-sm" role="button" href="{% url 'users:edit-whitelist' whitelist.id %}"><i class="glyphicon glyphicon-flag"></i> Editer</a></td>
|
<td>{% if is_cableur %}<a class="btn btn-primary btn-sm" role="button" href="{% url 'users:edit-whitelist' whitelist.id %}"><i class="glyphicon glyphicon-flag"></i> Editer</a>{% endif %}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</table>
|
</table>
|
||||||
|
|
|
@ -7,8 +7,8 @@
|
||||||
<h2>Adhérent</h2>
|
<h2>Adhérent</h2>
|
||||||
<a class="btn btn-primary btn-sm" role="button" href="{% url 'users:edit-info' user.id %}"><i class="glyphicon glyphicon-edit"></i> Editer</a>
|
<a class="btn btn-primary btn-sm" role="button" href="{% url 'users:edit-info' user.id %}"><i class="glyphicon glyphicon-edit"></i> Editer</a>
|
||||||
<a class="btn btn-primary btn-sm" role="button" href="{% url 'users:password' user.id %}"><i class="glyphicon glyphicon-lock"></i> Changer le mot de passe</a>
|
<a class="btn btn-primary btn-sm" role="button" href="{% url 'users:password' user.id %}"><i class="glyphicon glyphicon-lock"></i> Changer le mot de passe</a>
|
||||||
<a class="btn btn-primary btn-sm" role="button" href="{% url 'users:state' user.id %}"><i class="glyphicon glyphicon-flash"></i> Changer le statut</a>
|
{% if is_bureau %}<a class="btn btn-primary btn-sm" role="button" href="{% url 'users:state' user.id %}"><i class="glyphicon glyphicon-flash"></i> Changer le statut</a>
|
||||||
<a class="btn btn-primary btn-sm" role="button" href="{% url 'users:add-right' user.id %}"><i class="glyphicon glyphicon-ok"></i> Ajouter un droit</a>
|
<a class="btn btn-primary btn-sm" role="button" href="{% url 'users:add-right' user.id %}"><i class="glyphicon glyphicon-ok"></i> Ajouter un droit</a>{% endif %}
|
||||||
<br />
|
<br />
|
||||||
<br />
|
<br />
|
||||||
<table class="table table-striped">
|
<table class="table table-striped">
|
||||||
|
@ -87,21 +87,21 @@
|
||||||
<p>Aucune machine</p>
|
<p>Aucune machine</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<h2>Cotisations :</h2>
|
<h2>Cotisations :</h2>
|
||||||
<h4><a class="btn btn-primary btn-sm" role="button" href="{% url 'cotisations:new-facture' user.id %}"><i class="glyphicon glyphicon-piggy-bank"></i> Ajouter une cotisation</a></h4>
|
{% if is_cableur %}<h4><a class="btn btn-primary btn-sm" role="button" href="{% url 'cotisations:new-facture' user.id %}"><i class="glyphicon glyphicon-piggy-bank"></i> Ajouter une cotisation</a></h4>{% endif%}
|
||||||
{% if facture_list %}
|
{% if facture_list %}
|
||||||
{% include "cotisations/aff_cotisations.html" with facture_list=facture_list %}
|
{% include "cotisations/aff_cotisations.html" with facture_list=facture_list %}
|
||||||
{% else %}
|
{% else %}
|
||||||
<p>Aucune facture</p>
|
<p>Aucune facture</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<h2>Bannissements :</h2>
|
<h2>Bannissements :</h2>
|
||||||
<h4><a class="btn btn-primary btn-sm" role="button" href="{% url 'users:add-ban' user.id %}"><i class="glyphicon glyphicon-pushpin"></i> Ajouter un bannissement</a></h4>
|
{% if is_bofh %}<h4><a class="btn btn-primary btn-sm" role="button" href="{% url 'users:add-ban' user.id %}"><i class="glyphicon glyphicon-pushpin"></i> Ajouter un bannissement</a></h4>{% endif %}
|
||||||
{% if ban_list %}
|
{% if ban_list %}
|
||||||
{% include "users/aff_bans.html" with ban_list=ban_list %}
|
{% include "users/aff_bans.html" with ban_list=ban_list %}
|
||||||
{% else %}
|
{% else %}
|
||||||
<p>Aucun bannissement</p>
|
<p>Aucun bannissement</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<h2>Accès à titre gracieux :</h2>
|
<h2>Accès à titre gracieux :</h2>
|
||||||
<h4><a class="btn btn-primary btn-sm" role="button" href="{% url 'users:add-whitelist' user.id %}"><i class="glyphicon glyphicon-flag"></i> Accorder un accès à titre gracieux</a></h4>
|
{% if is_cableur %}<h4><a class="btn btn-primary btn-sm" role="button" href="{% url 'users:add-whitelist' user.id %}"><i class="glyphicon glyphicon-flag"></i> Accorder un accès à titre gracieux</a></h4>{% endif %}
|
||||||
{% if white_list %}
|
{% if white_list %}
|
||||||
{% include "users/aff_whitelists.html" with white_list=white_list %}
|
{% include "users/aff_whitelists.html" with white_list=white_list %}
|
||||||
{% else %}
|
{% else %}
|
||||||
|
|
|
@ -93,6 +93,7 @@ def form(ctx, template, request):
|
||||||
)
|
)
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
|
@permission_required('cableur')
|
||||||
def new_user(request):
|
def new_user(request):
|
||||||
user = InfoForm(request.POST or None)
|
user = InfoForm(request.POST or None)
|
||||||
if user.is_valid():
|
if user.is_valid():
|
||||||
|
@ -116,6 +117,7 @@ def edit_info(request, userid):
|
||||||
return form({'userform': user}, 'users/user.html', request)
|
return form({'userform': user}, 'users/user.html', request)
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
|
@permission_required('bureau')
|
||||||
def state(request, userid):
|
def state(request, userid):
|
||||||
try:
|
try:
|
||||||
user = User.objects.get(pk=userid)
|
user = User.objects.get(pk=userid)
|
||||||
|
@ -135,6 +137,7 @@ def state(request, userid):
|
||||||
return form({'userform': state}, 'users/user.html', request)
|
return form({'userform': state}, 'users/user.html', request)
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
|
@permission_required('bureau')
|
||||||
def password(request, userid):
|
def password(request, userid):
|
||||||
try:
|
try:
|
||||||
user = User.objects.get(pk=userid)
|
user = User.objects.get(pk=userid)
|
||||||
|
@ -185,6 +188,7 @@ def del_right(request):
|
||||||
return form({'userform': right}, 'users/user.html', request)
|
return form({'userform': right}, 'users/user.html', request)
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
|
@permission_required('bofh')
|
||||||
def add_ban(request, userid):
|
def add_ban(request, userid):
|
||||||
try:
|
try:
|
||||||
user = User.objects.get(pk=userid)
|
user = User.objects.get(pk=userid)
|
||||||
|
@ -205,6 +209,7 @@ def add_ban(request, userid):
|
||||||
return form({'userform': ban}, 'users/user.html', request)
|
return form({'userform': ban}, 'users/user.html', request)
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
|
@permission_required('bofh')
|
||||||
def edit_ban(request, banid):
|
def edit_ban(request, banid):
|
||||||
try:
|
try:
|
||||||
ban_instance = Ban.objects.get(pk=banid)
|
ban_instance = Ban.objects.get(pk=banid)
|
||||||
|
@ -219,6 +224,7 @@ def edit_ban(request, banid):
|
||||||
return form({'userform': ban}, 'users/user.html', request)
|
return form({'userform': ban}, 'users/user.html', request)
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
|
@permission_required('cableur')
|
||||||
def add_whitelist(request, userid):
|
def add_whitelist(request, userid):
|
||||||
try:
|
try:
|
||||||
user = User.objects.get(pk=userid)
|
user = User.objects.get(pk=userid)
|
||||||
|
@ -239,6 +245,7 @@ def add_whitelist(request, userid):
|
||||||
return form({'userform': whitelist}, 'users/user.html', request)
|
return form({'userform': whitelist}, 'users/user.html', request)
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
|
@permission_required('cableur')
|
||||||
def edit_whitelist(request, whitelistid):
|
def edit_whitelist(request, whitelistid):
|
||||||
try:
|
try:
|
||||||
whitelist_instance = Whitelist.objects.get(pk=whitelistid)
|
whitelist_instance = Whitelist.objects.get(pk=whitelistid)
|
||||||
|
@ -253,6 +260,7 @@ def edit_whitelist(request, whitelistid):
|
||||||
return form({'userform': whitelist}, 'users/user.html', request)
|
return form({'userform': whitelist}, 'users/user.html', request)
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
|
@permission_required('cableur')
|
||||||
def add_school(request):
|
def add_school(request):
|
||||||
school = SchoolForm(request.POST or None)
|
school = SchoolForm(request.POST or None)
|
||||||
if school.is_valid():
|
if school.is_valid():
|
||||||
|
@ -262,6 +270,7 @@ def add_school(request):
|
||||||
return form({'userform': school}, 'users/user.html', request)
|
return form({'userform': school}, 'users/user.html', request)
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
|
@permission_required('cableur')
|
||||||
def edit_school(request, schoolid):
|
def edit_school(request, schoolid):
|
||||||
try:
|
try:
|
||||||
school_instance = School.objects.get(pk=schoolid)
|
school_instance = School.objects.get(pk=schoolid)
|
||||||
|
@ -276,6 +285,7 @@ def edit_school(request, schoolid):
|
||||||
return form({'userform': school}, 'users/user.html', request)
|
return form({'userform': school}, 'users/user.html', request)
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
|
@permission_required('cableur')
|
||||||
def del_school(request):
|
def del_school(request):
|
||||||
school = DelSchoolForm(request.POST or None)
|
school = DelSchoolForm(request.POST or None)
|
||||||
if school.is_valid():
|
if school.is_valid():
|
||||||
|
@ -306,11 +316,14 @@ def index(request):
|
||||||
return render(request, 'users/index.html', {'users_list': connexion})
|
return render(request, 'users/index.html', {'users_list': connexion})
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
|
@permission_required('cableur')
|
||||||
def index_ban(request):
|
def index_ban(request):
|
||||||
|
is_bofh = request.user.has_perms(('bofh',))
|
||||||
ban_list = Ban.objects.order_by('date_start')
|
ban_list = Ban.objects.order_by('date_start')
|
||||||
return render(request, 'users/index_ban.html', {'ban_list': ban_list})
|
return render(request, 'users/index_ban.html', {'ban_list': ban_list, 'is_bofh':is_bofh})
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
|
@permission_required('cableur')
|
||||||
def index_white(request):
|
def index_white(request):
|
||||||
white_list = Whitelist.objects.order_by('date_start')
|
white_list = Whitelist.objects.order_by('date_start')
|
||||||
return render(
|
return render(
|
||||||
|
@ -320,6 +333,7 @@ def index_white(request):
|
||||||
)
|
)
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
|
@permission_required('cableur')
|
||||||
def index_school(request):
|
def index_school(request):
|
||||||
school_list = School.objects.order_by('name')
|
school_list = School.objects.order_by('name')
|
||||||
return render(request, 'users/index_schools.html', {'school_list':school_list})
|
return render(request, 'users/index_schools.html', {'school_list':school_list})
|
||||||
|
@ -344,6 +358,9 @@ def profil(request, userid):
|
||||||
if(is_whitelisted(users)):
|
if(is_whitelisted(users)):
|
||||||
end_whitelists = end_whitelist(users)
|
end_whitelists = end_whitelist(users)
|
||||||
list_droits = Right.objects.filter(user=users)
|
list_droits = Right.objects.filter(user=users)
|
||||||
|
is_bofh = request.user.has_perms(('bofh',))
|
||||||
|
is_bureau = request.user.has_perms(('bureau',))
|
||||||
|
is_cableur = request.user.has_perms(('cableur',))
|
||||||
return render(
|
return render(
|
||||||
request,
|
request,
|
||||||
'users/profil.html',
|
'users/profil.html',
|
||||||
|
@ -357,7 +374,10 @@ def profil(request, userid):
|
||||||
'end_whitelist': end_whitelists,
|
'end_whitelist': end_whitelists,
|
||||||
'end_adhesion': end_adhesion(users),
|
'end_adhesion': end_adhesion(users),
|
||||||
'actif':has_access(users),
|
'actif':has_access(users),
|
||||||
'list_droits': list_droits
|
'list_droits': list_droits,
|
||||||
|
'is_bofh': is_bofh,
|
||||||
|
'is_bureau': is_bureau,
|
||||||
|
'is_cableur': is_cableur,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue