facture.html 1.28 KB
Newer Older
1
{% extends "cotisations/sidebar.html" %}
chirac's avatar
chirac committed
2
{% load bootstrap3 %}
3
{% load staticfiles%}
chirac's avatar
chirac committed
4 5 6 7

{% block title %}Création et modification de factures{% endblock %}

{% block content %}
8
{% bootstrap_form_errors factureform %}
chirac's avatar
chirac committed
9 10 11 12

<form class="form" method="post">
    {% csrf_token %}
    {% bootstrap_form factureform %}
Dalahro's avatar
Dalahro committed
13
    {{ venteform.management_form }}
14 15 16 17 18 19 20
    <div id="form_set">
    {% for form in venteform.forms %}
            {{ form.as_p }}
    {% endfor %}
    </div>
    <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="Supprimer un article" id="del_one">
chirac's avatar
chirac committed
21 22
    {% bootstrap_button "Créer ou modifier" button_type="submit" icon="star" %}
</form>
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41

<div id="empty_form" style="display:none">
    <table class='no_error'>
        {{ venteform.empty_form.as_p }}
    </table>
</div>

<script>
    $('#add_one').click(function() {
        var form_idx = $('#id_form-TOTAL_FORMS').val();
        $('#form_set').append($('#empty_form').html().replace(/__prefix__/g, form_idx));
        $('#id_form-TOTAL_FORMS').val(parseInt(form_idx) + 1);
    });
    $('#del_one').click(function() {
        var forms = $('.dynamic-form');
        $('#id_form-TOTAL_FORMS').val(forms.length);
    });
</script>

chirac's avatar
chirac committed
42
{% endblock %}