mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-16 16:33:12 +00:00
Un peu de style sur les formulaire d'edition de factures
This commit is contained in:
parent
017c48346f
commit
a4244070b1
4 changed files with 47 additions and 9 deletions
37
cotisations/templates/cotisations/edit_facture.html
Normal file
37
cotisations/templates/cotisations/edit_facture.html
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
{% extends "cotisations/sidebar.html" %}
|
||||||
|
{% load bootstrap3 %}
|
||||||
|
{% load staticfiles%}
|
||||||
|
|
||||||
|
{% block title %}Création et modification de factures{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
{% bootstrap_form_errors factureform %}
|
||||||
|
|
||||||
|
<form class="form" method="post">
|
||||||
|
{% csrf_token %}
|
||||||
|
<h3>Editer la facture</h3>
|
||||||
|
{% bootstrap_form factureform %}
|
||||||
|
{{ venteform.management_form }}
|
||||||
|
<h3>Articles de la facture</h3>
|
||||||
|
<table class="table table-striped">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Désignation</th>
|
||||||
|
<th>Quantité</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
{% for form in venteform.forms %}
|
||||||
|
{% bootstrap_form_errors form %}
|
||||||
|
<tr>
|
||||||
|
<td>{{ form.name }}</td>
|
||||||
|
<td>{{ form.number }}</td>
|
||||||
|
{% for hidden in form.hidden_fields %}
|
||||||
|
{{ hidden }}
|
||||||
|
{% endfor %}
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</table>
|
||||||
|
{% bootstrap_button "Créer ou modifier" button_type="submit" icon="star" %}
|
||||||
|
</form>
|
||||||
|
|
||||||
|
{% endblock %}
|
|
@ -10,11 +10,6 @@
|
||||||
<form class="form" method="post">
|
<form class="form" method="post">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
{% bootstrap_form factureform %}
|
{% bootstrap_form factureform %}
|
||||||
{{ venteform.management_form }}
|
|
||||||
{% for form in venteform.forms %}
|
|
||||||
{% bootstrap_form_errors form %}
|
|
||||||
{{ form.as_p }}
|
|
||||||
{% endfor %}
|
|
||||||
{% bootstrap_button "Créer ou modifier" button_type="submit" icon="star" %}
|
{% bootstrap_button "Créer ou modifier" button_type="submit" icon="star" %}
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
|
|
@ -9,16 +9,22 @@
|
||||||
|
|
||||||
<form class="form" method="post">
|
<form class="form" method="post">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
|
<h3>Nouvelle facture</h3>
|
||||||
{% bootstrap_form factureform %}
|
{% bootstrap_form factureform %}
|
||||||
{{ venteform.management_form }}
|
{{ venteform.management_form }}
|
||||||
|
<h3>Articles de la facture</h3>
|
||||||
<div id="form_set">
|
<div id="form_set">
|
||||||
{% for form in venteform.forms %}
|
{% for form in venteform.forms %}
|
||||||
<div class='product_to_sell'>
|
<div class='product_to_sell'>
|
||||||
{{ form.as_p }}
|
<p>
|
||||||
|
{{ form.as_table }}
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
|
<p>
|
||||||
<input class="btn btn-primary btn-sm" role="button" value="Ajouter un article" id="add_one">
|
<input class="btn btn-primary btn-sm" role="button" value="Ajouter un article" id="add_one">
|
||||||
|
</p>
|
||||||
<p>
|
<p>
|
||||||
Prix total : <span id="total_price">0,00</span> €
|
Prix total : <span id="total_price">0,00</span> €
|
||||||
</p>
|
</p>
|
||||||
|
@ -35,7 +41,7 @@
|
||||||
prices[{{ article.id|escapejs }}] = {{ article.prix }};
|
prices[{{ article.id|escapejs }}] = {{ article.prix }};
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
var template = `{{ venteform.empty_form.as_p }}`;
|
var template = `<p>{{ venteform.empty_form.as_table }}</p>`;
|
||||||
|
|
||||||
function add_article(){
|
function add_article(){
|
||||||
// Index start at 0 => new_index = number of items
|
// Index start at 0 => new_index = number of items
|
||||||
|
|
|
@ -134,7 +134,7 @@ def edit_facture(request, factureid):
|
||||||
vente_form.save()
|
vente_form.save()
|
||||||
messages.success(request, "La facture a bien été modifiée")
|
messages.success(request, "La facture a bien été modifiée")
|
||||||
return redirect("/cotisations/")
|
return redirect("/cotisations/")
|
||||||
return form({'factureform': facture_form, 'venteform': vente_form}, 'cotisations/facture.html', request)
|
return form({'factureform': facture_form, 'venteform': vente_form}, 'cotisations/edit_facture.html', request)
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
@permission_required('cableur')
|
@permission_required('cableur')
|
||||||
|
@ -241,7 +241,7 @@ def add_banque(request):
|
||||||
@permission_required('trésorier')
|
@permission_required('trésorier')
|
||||||
def edit_banque(request, banqueid):
|
def edit_banque(request, banqueid):
|
||||||
try:
|
try:
|
||||||
banque_instance = Article.objects.get(pk=banqueid)
|
banque_instance = Banque.objects.get(pk=banqueid)
|
||||||
except Banque.DoesNotExist:
|
except Banque.DoesNotExist:
|
||||||
messages.error(request, u"Entrée inexistante" )
|
messages.error(request, u"Entrée inexistante" )
|
||||||
return redirect("/cotisations/index_banque/")
|
return redirect("/cotisations/index_banque/")
|
||||||
|
|
Loading…
Reference in a new issue