diff options
author | Joris | 2021-01-03 13:40:40 +0100 |
---|---|---|
committer | Joris | 2021-01-03 13:54:20 +0100 |
commit | 11052951b74b9ad4b6a9412ae490086235f9154b (patch) | |
tree | 64526ac926c1bf470ea113f6cac8a33158684e8d /templates/report | |
parent | 371449b0e312a03162b78797b83dee9d81706669 (diff) |
Rewrite in Rust
Diffstat (limited to 'templates/report')
-rw-r--r-- | templates/report/list.j2 | 14 | ||||
-rw-r--r-- | templates/report/report.j2 | 50 |
2 files changed, 64 insertions, 0 deletions
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") +) }} |