diff --git a/refunding/templates/refunding/elements_list.html b/refunding/templates/refunding/elements_list.html new file mode 100644 index 0000000..f8ef4f6 --- /dev/null +++ b/refunding/templates/refunding/elements_list.html @@ -0,0 +1,18 @@ +{% if elements %} + {% if sum %} +

+ Total : {{ sum }}€ +

+ {% endif %} +
+ {% for e in elements %} +
+ {{ e.title }} le {{ e.date|date:"SHORT_DATE_FORMAT" }} : {{ e.eur_value }}€ +
+ {% endfor %} +
+{% else %} +

+ {% firstof default_nothing "Nothing here..." %} +

+{% endif %} \ No newline at end of file diff --git a/refunding/templates/refunding/payments.html b/refunding/templates/refunding/payments.html new file mode 100644 index 0000000..1725d42 --- /dev/null +++ b/refunding/templates/refunding/payments.html @@ -0,0 +1,7 @@ +{% extends 'base.html' %} +{% load l10n %} + +{% block content %} +

{% block title %}Payments to refund{% endblock %}

+ {% include 'refunding/elements_list.html' with elements=payments %} +{% endblock %} \ No newline at end of file diff --git a/refunding/templates/refunding/payments_list.html b/refunding/templates/refunding/payments_list.html deleted file mode 100644 index 1aeafff..0000000 --- a/refunding/templates/refunding/payments_list.html +++ /dev/null @@ -1,22 +0,0 @@ -{% extends 'base.html' %} -{% load l10n %} - -{% block content %} -

{% block title %}Payments to refund{% endblock %}

- {% if payments %} -

- Total : {{ sum }}€ -

-
- {% for payment in payments %} -
- {{ payment.title }} le {{ payment.date|date:"SHORT_DATE_FORMAT" }} : {{ payment.eur_value }}€ -
- {% endfor %} -
- {% else %} -

- {% firstof default_nothing "Nothing here..." %} -

- {% endif %} -{% endblock %} \ No newline at end of file diff --git a/refunding/templates/refunding/refunds.html b/refunding/templates/refunding/refunds.html new file mode 100644 index 0000000..4ea7d35 --- /dev/null +++ b/refunding/templates/refunding/refunds.html @@ -0,0 +1,7 @@ +{% extends 'base.html' %} +{% load l10n %} + +{% block content %} +

{% block title %}Latest refunds{% endblock %}

+ {% include 'refunding/elements_list.html' with elements=refunds %} +{% endblock %} \ No newline at end of file diff --git a/refunding/templates/refunding/refunds_list.html b/refunding/templates/refunding/refunds_list.html deleted file mode 100644 index af0ecdd..0000000 --- a/refunding/templates/refunding/refunds_list.html +++ /dev/null @@ -1,19 +0,0 @@ -{% extends 'base.html' %} -{% load l10n %} - -{% block content %} -

{% block title %}Latest refunds{% endblock %}

- {% if refunds %} -
- {% for refund in refunds %} -
- {{ refund.title }} le {{ refund.date|date:"SHORT_DATE_FORMAT" }} : {{ payment.amount }}€ -
- {% endfor %} -
- {% else %} -

- {% firstof default_nothing "Nothing here..." %} -

- {% endif %} -{% endblock %} \ No newline at end of file diff --git a/refunding/views.py b/refunding/views.py index 0bbf631..a4fb96b 100644 --- a/refunding/views.py +++ b/refunding/views.py @@ -13,7 +13,7 @@ def not_refunded_payments(request): 'sum': sum, 'default_nothing': 'No payment to be refunded.' } - return render(request, "refunding/payments_list.html", context) + return render(request, "refunding/payments.html", context) @login_required @@ -23,4 +23,4 @@ def latest_refunds(request): 'refunds': refunds, 'default_nothing': 'No refund to show.' } - return render(request, "refunding/refunds_list.html", context) + return render(request, "refunding/refunds.html", context)