1
0
mirror of https://gitlab.crans.org/bde/nk20 synced 2025-06-24 03:08:47 +02:00

Use custom inputs for date picker and amounts

This commit is contained in:
Yohann D'ANELLO
2020-03-27 13:50:02 +01:00
parent 45b14ed1bd
commit f81e2b5b5b
16 changed files with 518 additions and 62 deletions

View File

@ -1,7 +1,7 @@
{% extends "base.html" %}
{% load static %}
{% load i18n %}
{% load crispy_forms_tags pretty_money %}
{% load crispy_forms_tags %}
{% block content %}
<p><a class="btn btn-default" href="{% url 'treasury:invoice_list' %}">{% trans "Invoices list" %}</a></p>
<form method="post" action="">
@ -26,18 +26,8 @@
{% endif %}
<tr class="row-formset">
<td>{{ form.designation }}</td>
<td>{{ form.quantity }} </td>
<td>
{# Use custom input for amount, with the € symbol #}
<div class="input-group">
<input type="number" name="product_set-{{ forloop.counter0 }}-amount" step="0.01"
id="id_product_set-{{ forloop.counter0 }}-amount"
value="{{ form.instance.amount|cents_to_euros }}">
<div class="input-group-append">
<span class="input-group-text"></span>
</div>
</div>
</td>
<td>{{ form.quantity }}</td>
<td>{{ form.amount }}</td>
{# These fields are hidden but handled by the formset to link the id and the invoice id #}
{{ form.invoice }}
{{ form.id }}
@ -64,15 +54,7 @@
<tr class="row-formset">
<td>{{ formset.empty_form.designation }}</td>
<td>{{ formset.empty_form.quantity }} </td>
<td>
<div class="input-group">
<input type="number" name="product_set-__prefix__-amount" step="0.01"
id="id_product_set-__prefix__-amount">
<div class="input-group-append">
<span class="input-group-text"></span>
</div>
</div>
</td>
<td>{{ formset.empty_form.amount }}</td>
{{ formset.empty_form.invoice }}
{{ formset.empty_form.id }}
</tr>