forked from DGNum/gestioCOF
Affichage et auth sur les caisses et relevés
- Auth K-Fêt fonctionne - Affichage repris
This commit is contained in:
parent
74c3f07c66
commit
90e8ece783
|
@ -1,22 +1,36 @@
|
|||
{% extends "kfet/base.html" %}
|
||||
|
||||
{% block title %}Caisses{% endblock %}
|
||||
{% block title %}Liste des caisses{% endblock %}
|
||||
{% block content-header-title %}Caisses{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="btn-group btn-group-lg">
|
||||
<a class="btn btn-primary" href="{% url 'kfet.checkout.create' %}">Créer une caisse</a>
|
||||
<div class="col-sm-4 col-md-3 col-content-left">
|
||||
<div class="content-left">
|
||||
<div class="content-left-top text-center">
|
||||
<div class="line">{{ checkouts|length }} caisses</div>
|
||||
</div>
|
||||
<div class="buttons">
|
||||
<a class="btn btn-primary btn-lg" href="{% url 'kfet.checkout.create' %}">Créer un compte</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-8 col-md-9 col-content-right">
|
||||
{% include 'kfet/base_messages.html' %}
|
||||
<div class="content-right">
|
||||
<div class="content-right-block">
|
||||
<h2>Liste des caisses</h2>
|
||||
<div>
|
||||
<ul>
|
||||
{% for checkout in checkouts %}
|
||||
<li><a href="{% url 'kfet.checkout.read' checkout.pk %}">{{ checkout }}</a></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
||||
|
|
|
@ -16,6 +16,9 @@
|
|||
<p class="help">{{ field.help_text|safe }}</p>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% if not perms.kfet.add_checkout %}
|
||||
<input type="password" name="KFETPASSWORD">
|
||||
{% endif %}
|
||||
<input type="submit" value="Enregistrer">
|
||||
</form>
|
||||
|
||||
|
|
|
@ -6,21 +6,17 @@
|
|||
{% block content %}
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="btn-group btn-group-lg">
|
||||
<a class="btn btn-primary{% if checkout.is_protected %} disabled{% endif %}" href="{% url 'kfet.checkout.update' checkout.pk %}">Modifier</a>
|
||||
<a class="btn btn-primary" href="{% url 'kfet.checkoutstatement.create' checkout.pk %}">Effectuer un relevé</a>
|
||||
<div class="col-sm-4 col-md-3 col-content-left">
|
||||
<div class="content-left">
|
||||
{% include 'kfet/left_checkout.html' %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p>Nom: {{ checkout.name }}</p>
|
||||
<p>Valide du {{ checkout.valid_from|date:'l j F Y, G:i' }} au {{ checkout.valid_to|date:'l j F Y, G:i' }}</p>
|
||||
<p>Créée par: {{ checkout.created_by }}</p>
|
||||
<p>Balance: {{ checkout.balance }} €</p>
|
||||
<p>Protected: {{ checkout.is_protected }}</p>
|
||||
|
||||
Relevés:
|
||||
<div class="col-sm-8 col-md-9 col-content-right">
|
||||
{% include "kfet/base_messages.html" %}
|
||||
<div class="content-right">
|
||||
<div class="content-right-block">
|
||||
<h2>Relevés</h2>
|
||||
<div>
|
||||
{% with statements=checkout.statements.all %}
|
||||
{% if not statements %}
|
||||
Pas de relevé
|
||||
|
@ -32,6 +28,10 @@ Relevés:
|
|||
</ul>
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
||||
|
|
|
@ -6,6 +6,16 @@
|
|||
|
||||
{% block content %}
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-4 col-md-3 col-content-left">
|
||||
<div class="content-left">
|
||||
{% include 'kfet/left_checkout.html' %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-8 col-md-9 col-content-right">
|
||||
{% include "kfet/base_messages.html" %}
|
||||
<div class="content-right">
|
||||
<div class="content-right-block">
|
||||
<form action="" method="post">
|
||||
{% csrf_token %}
|
||||
{% for field in form %}
|
||||
|
@ -16,8 +26,15 @@
|
|||
<p class="help">{{ field.help_text|safe }}</p>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% if not perms.kfet.add_checkout %}
|
||||
<input type="password" name="KFETPASSWORD">
|
||||
{% endif %}
|
||||
<input type=submit value="Mettre à jour">
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
|
|
|
@ -5,12 +5,27 @@
|
|||
|
||||
{% block content %}
|
||||
|
||||
En caisse : {{ checkout.balance }}
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-4 col-md-3 col-content-left">
|
||||
<div class="content-left">
|
||||
{% include 'kfet/left_checkout.html' %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-8 col-md-9 col-content-right">
|
||||
{% include "kfet/base_messages.html" %}
|
||||
<div class="content-right">
|
||||
<div class="content-right-block">
|
||||
<form action="" method="post">
|
||||
{% csrf_token %}
|
||||
{{ form.as_p }}
|
||||
{% if not perms.ket.add_checkoutstatement %}
|
||||
<input type="password" name="KFETPASSWORD">
|
||||
{% endif %}
|
||||
<input type="submit" value="Enregistrer">
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
||||
|
|
13
kfet/templates/kfet/left_checkout.html
Normal file
13
kfet/templates/kfet/left_checkout.html
Normal file
|
@ -0,0 +1,13 @@
|
|||
<div class="content-left-top">
|
||||
<div class="line trigramme">{{ checkout.name }}</div>
|
||||
<div class="line balance">{{ checkout.balance|floatformat:2 }} €</div>
|
||||
<div class="block">
|
||||
<div class="line">Valide du {{ checkout.valid_from|date:'l j F Y, G:i' }}</div>
|
||||
<div class="line">au {{ checkout.valid_to|date:'l j F Y, G:i' }}</div>
|
||||
<div class="line">Créée par {{ checkout.created_by }}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="buttons">
|
||||
<a class="btn btn-primary btn-lg {% if checkout.is_protected %} disabled{% endif %}" href="{% url 'kfet.checkout.update' checkout.pk %}">Modifier</a>
|
||||
<a class="btn btn-primary btn-lg" href="{% url 'kfet.checkoutstatement.create' checkout.pk %}">Effectuer un relevé</a>
|
||||
</div>
|
|
@ -403,7 +403,8 @@ class CheckoutStatementCreate(SuccessMessageMixin, CreateView):
|
|||
def form_valid(self, form):
|
||||
# Checking permission
|
||||
if not self.request.user.has_perm('kfet.add_checkoutstatement'):
|
||||
raise PermissionDenied
|
||||
form.add_error(None, 'Permission refusée')
|
||||
return self.form_invalid(form)
|
||||
# Creating
|
||||
form.instance.checkout_id = self.kwargs['pk_checkout']
|
||||
form.instance.by = self.request.user.profile.account_kfet
|
||||
|
|
Loading…
Reference in a new issue