From 11052951b74b9ad4b6a9412ae490086235f9154b Mon Sep 17 00:00:00 2001 From: Joris Date: Sun, 3 Jan 2021 13:40:40 +0100 Subject: Rewrite in Rust --- templates/report/list.j2 | 14 +++++++++++++ templates/report/report.j2 | 50 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+) create mode 100644 templates/report/list.j2 create mode 100644 templates/report/report.j2 (limited to 'templates/report') diff --git a/templates/report/list.j2 b/templates/report/list.j2 new file mode 100644 index 0000000..ef53244 --- /dev/null +++ b/templates/report/list.j2 @@ -0,0 +1,14 @@ +{% macro list(resource, action, xs) -%} + +{% if xs -%} + + {% set s = xs | length | pluralize -%} + + {{ xs | length }} {{ resource }}{{ s }} {{ action }}{{ s }} : + + {% for x in xs -%} + - {{ x.date }} {{ x.name }} {{ x.amount | euros() }} + {% endfor %} +{% endif -%} + +{% endmacro paging %} diff --git a/templates/report/report.j2 b/templates/report/report.j2 new file mode 100644 index 0000000..d36f3ce --- /dev/null +++ b/templates/report/report.j2 @@ -0,0 +1,50 @@ +{% import "report/list.j2" as list %} + +{% if exceeding_payers -%} + + Équilibre : + + {% for exceeding_payer in exceeding_payers -%} + - {{ exceeding_payer.0 }} : +{{ exceeding_payer.1 | euros() }} + {% endfor %} +{% else -%} + + Les paiements sont équilibrés. + +{% endif %}{# + +#}{{ list::list( + resource="paiement", + action="créé", + xs=payments | filter(attribute="action", value="Created") +) }}{# + +#}{{ list::list( + resource="paiement", + action="modifié", + xs=payments | filter(attribute="action", value="Updated") +) }}{# + +#}{{ list::list( + resource="paiement", + action="supprimé", + xs=payments | filter(attribute="action", value="Deleted") +) }}{# + +#}{{ list::list( + resource="revenu", + action="créé", + xs=incomes | filter(attribute="action", value="Created") +) }}{# + +#}{{ list::list( + resource="revenu", + action="modifié", + xs=incomes | filter(attribute="action", value="Updated") +) }}{# + +#}{{ list::list( + resource="revenu", + action="supprimé", + xs=incomes | filter(attribute="action", value="Deleted") +) }} -- cgit v1.2.3