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/balance.html | 107 ++++++++++++++++++++++++++++++ templates/base.html | 91 ++++++++++++++++++++++++++ templates/category/create.html | 51 +++++++++++++++ templates/category/table.html | 38 +++++++++++ templates/category/update.html | 85 ++++++++++++++++++++++++ templates/error.html | 17 +++++ templates/income/create.html | 89 +++++++++++++++++++++++++ templates/income/table.html | 55 ++++++++++++++++ templates/income/update.html | 117 +++++++++++++++++++++++++++++++++ templates/login.html | 29 +++++++++ templates/macros/paging.html | 55 ++++++++++++++++ templates/payment/create.html | 120 ++++++++++++++++++++++++++++++++++ templates/payment/table.html | 128 ++++++++++++++++++++++++++++++++++++ templates/payment/update.html | 144 +++++++++++++++++++++++++++++++++++++++++ templates/report/list.j2 | 14 ++++ templates/report/report.j2 | 50 ++++++++++++++ templates/statistics.html | 29 +++++++++ 17 files changed, 1219 insertions(+) create mode 100644 templates/balance.html create mode 100644 templates/base.html create mode 100644 templates/category/create.html create mode 100644 templates/category/table.html create mode 100644 templates/category/update.html create mode 100644 templates/error.html create mode 100644 templates/income/create.html create mode 100644 templates/income/table.html create mode 100644 templates/income/update.html create mode 100644 templates/login.html create mode 100644 templates/macros/paging.html create mode 100644 templates/payment/create.html create mode 100644 templates/payment/table.html create mode 100644 templates/payment/update.html create mode 100644 templates/report/list.j2 create mode 100644 templates/report/report.j2 create mode 100644 templates/statistics.html (limited to 'templates') diff --git a/templates/balance.html b/templates/balance.html new file mode 100644 index 0000000..15da854 --- /dev/null +++ b/templates/balance.html @@ -0,0 +1,107 @@ +{% extends "base.html" %} + +{% block title %} + Équilibre +{% endblock title %} + +{% block main %} + +
+ {% if exceeding_payers %} + + {% else %} +

+ Les paiements sont équilibrés. +

+ {% endif %} + + {% if incomes_from %} +

+ Revenus +

+ +
+
+ + Montant + Part +
+ {% for user_income in user_incomes %} +
+ + {{ user_income.0 }} + + + {{ user_income.1 | euros() }} + + + {% if total_income > 0 %} + {{ user_income.1 / total_income * 100 | round() }} % + {% else %} + – + {% endif %} + +
+ {% endfor %} +
+ + Total + + + {{ total_income | euros() }} + + + 100 % + +
+
+ {% endif %} + +

+ Paiements +

+ +
+
+ + Montant + Part +
+ {% for user_payment in user_payments %} +
+ + {{ user_payment.0 }} + + + {{ user_payment.1 | euros() }} + + + {% if total_payments > 0 %} + {{ user_payment.1 / total_payments * 100 | round() }} % + {% else %} + – + {% endif %} + +
+ {% endfor %} +
+ + Total + + + {{ total_payments | euros() }} + + + 100 % + +
+
+
+ +{% endblock main %} diff --git a/templates/base.html b/templates/base.html new file mode 100644 index 0000000..f403d41 --- /dev/null +++ b/templates/base.html @@ -0,0 +1,91 @@ + + + + + + Budget — {% block title %}{% endblock title %} + + + + + + +
+ +
+
Budget
+ {% if connected_user %} +
+ {{ connected_user.name }} + +
+ {% endif %} +
+ + {% if connected_user %} +
+ + + Paiements + + + + Revenus + + + + Catégories + + + + Équilibre + + + + Statistiques + + +
+ {% endif %} + +
+ +
+ {% block main %}{% endblock main %} +
+ + + + + diff --git a/templates/category/create.html b/templates/category/create.html new file mode 100644 index 0000000..e206898 --- /dev/null +++ b/templates/category/create.html @@ -0,0 +1,51 @@ +{% extends "base.html" %} + +{% block title %} + Nouvelle catégorie +{% endblock title %} + +{% block main %} + +
+

+ + Retour aux categories + +

+ +
+

+ Nouvelle catégorie +

+ + {% if error %} +
{{ error }}
+ {% endif %} + + + + + + + +
+ +
+
+
+ +{% endblock main %} diff --git a/templates/category/table.html b/templates/category/table.html new file mode 100644 index 0000000..896304a --- /dev/null +++ b/templates/category/table.html @@ -0,0 +1,38 @@ +{% extends "base.html" %} + +{% block title %} + Catégories +{% endblock title %} + +{% block main %} + +
+ Nouveau +
+ + {% if not categories %} + +
+ Il n’y a aucune catégorie. +
+ + {% else %} + +
+ {% for category in categories %} + + + {{ category.name }} + + + {% endfor %} +
+ + {% endif %} +{% endblock main %} diff --git a/templates/category/update.html b/templates/category/update.html new file mode 100644 index 0000000..a4c1481 --- /dev/null +++ b/templates/category/update.html @@ -0,0 +1,85 @@ +{% extends "base.html" %} + +{% block title %} + Catégorie {{ id }} +{% endblock title %} + +{% block main %} + +
+

+ + Retour aux catégories + +

+ + {% if error %} +
{{ error }}
+ {% endif %} + + {% if not category %} + + La catégorie n’a pas été trouvée. + + {% else %} + +
+

Modification

+ + + + + + + +
+ +
+
+ +
+

Suppression

+ + {% if is_category_used %} +

+ La catégorie ne peut pas être supprimée car elle est actuellement + utilisée. +

+ {% else %} + + + + +
+ +
+ {% endif %} +
+ + {% endif %} +
+ +{% endblock main %} diff --git a/templates/error.html b/templates/error.html new file mode 100644 index 0000000..b3049a9 --- /dev/null +++ b/templates/error.html @@ -0,0 +1,17 @@ +{% extends "base.html" %} + +{% block title %} + {{ title }} +{% endblock title %} + +{% block main %} +

+ {{ message }} +

+ +

+ + Retour à l’accueil + +

+{% endblock main %} diff --git a/templates/income/create.html b/templates/income/create.html new file mode 100644 index 0000000..b74dddd --- /dev/null +++ b/templates/income/create.html @@ -0,0 +1,89 @@ +{% extends "base.html" %} + +{% block title %} + Nouveau revenu +{% endblock title %} + +{% block main %} + +
+

+ + Retour aux revenus + +

+ +
+

+ Nouveau revenu +

+ + {% if error %} +
{{ error }}
+ {% endif %} + + + + + {% set user_id = form.user_id | default(value="" ~ connected_user.id) %} + + + + + {% set month_index = form.month | default(value="" ~ current_month) %} + + + + + + + +
+ +
+
+
+ +{% endblock main %} diff --git a/templates/income/table.html b/templates/income/table.html new file mode 100644 index 0000000..efd82a7 --- /dev/null +++ b/templates/income/table.html @@ -0,0 +1,55 @@ +{% import "macros/paging.html" as paging %} + +{% extends "base.html" %} + +{% block title %} + Revenus +{% endblock title %} + +{% block main %} + +
+ + Nouveau + +
+ + {% if not incomes %} + +
+ Il n’y a aucun revenu. +
+ + {% else %} + +
+
+ Montant + Personne + Mois +
+ {% for income in incomes %} + + + {{ income.amount | euros() }} + + {{ income.user }} + {{ income.date }} + + {% endfor %} +
+ + {{ paging::paging( + url="/incomes", + page=page, + max_page=max_page + ) }} + + {% endif %} +{% endblock main %} diff --git a/templates/income/update.html b/templates/income/update.html new file mode 100644 index 0000000..6dd649a --- /dev/null +++ b/templates/income/update.html @@ -0,0 +1,117 @@ +{% extends "base.html" %} + +{% block title %} + Revenu {{ id }} +{% endblock title %} + +{% block main %} + +
+

+ + Retour aux revenus + +

+ + {% if error %} +
{{ error }}
+ {% endif %} + + {% if not income %} + + Le revenu n’a pas été trouvé. + + {% else %} + +
+

Modification

+ + + + + {% set user_id = form.user_id | default(value="" ~ income.user_id) %} + + + + + {% set month_index = form.month | default(value="" ~ income.month) %} + + + + + + + +
+ +
+
+ +
+

Suppression

+ + {% if is_category_used %} +

+ La catégorie ne peut pas être supprimée car elle est actuellement + utilisée. +

+ {% else %} + + + + +
+ +
+ {% endif %} +
+ + {% endif %} +
+ +{% endblock main %} diff --git a/templates/login.html b/templates/login.html new file mode 100644 index 0000000..fd4cfe9 --- /dev/null +++ b/templates/login.html @@ -0,0 +1,29 @@ +{% extends "base.html" %} + +{% block title %} + Connexion +{% endblock title %} + +{% block main %} + +
+
+ + {% if error %} +
{{ error }}
+ {% endif %} + + + + + + + +
+ +
+ +
+
+ +{% endblock main %} diff --git a/templates/macros/paging.html b/templates/macros/paging.html new file mode 100644 index 0000000..59ba617 --- /dev/null +++ b/templates/macros/paging.html @@ -0,0 +1,55 @@ +{% macro paging(url, page, max_page) %} + {% if url is containing("?") %} + {% set sign = "&" %} + {% else %} + {% set sign = "?" %} + {% endif %} + +
+ {% if page > 1 %} + + ❬❬ + + + ❬ + + {% else %} + + ❬❬ + + + ❬ + + {% endif %} + + {{ page }} / {{ max_page }} + + {% if page < max_page %} + + ❭ + + + ❭❭ + + {% else %} + + ❭ + + + ❭❭ + + {% endif %} +
+{% endmacro paging %} diff --git a/templates/payment/create.html b/templates/payment/create.html new file mode 100644 index 0000000..aea6fcd --- /dev/null +++ b/templates/payment/create.html @@ -0,0 +1,120 @@ +{% extends "base.html" %} + +{% block title %} + Nouveau paiement +{% endblock title %} + +{% block main %} + +
+

+ + Retour aux paiements + +

+ +
+

+ Nouveau paiement + {% if query.frequency != "Monthly" %} + ponctuel + {% else %} + mensuel + {% endif %} +

+ + {% if error %} +
{{ error }}
+ {% endif %} + + + + + + + + {% set user_id = form.user_id | default(value="" ~ connected_user.id) %} + + + + + {% set category_id = form.category_id | default(value="") %} + + + + + {% set date = form.date | default(value=now() | date(format="%Y-%m-%d")) %} + + {% if query.frequency != "Monthly" %} + + + {% else %} + + {% endif %} + + + +
+ +
+
+
+ +{% endblock main %} diff --git a/templates/payment/table.html b/templates/payment/table.html new file mode 100644 index 0000000..19b56b4 --- /dev/null +++ b/templates/payment/table.html @@ -0,0 +1,128 @@ +{% import "macros/paging.html" as paging %} + +{% extends "base.html" %} + +{% block title %} + Paiements +{% endblock title %} + +{% block main %} + +
+
+
+ {% if query.frequency == "Monthly" %} + + Ponctuels + + / + + Mensuels + + {% else %} + + Ponctuels + + / + + Mensuels + + {% endif %} +
+ + {% if query.frequency != "Monthly" %} + + {% endif %} +
+ + + Nouveau + +
+ + {% if not payments %} + +
+ Aucun paiement ne correspond à votre recherche. +
+ + {% else %} + +
+ {{ count | numeric }} paiement{{ count | pluralize }} comptabilisant {{ total_cost | euros() }}. +
+ +
+
+ Nom + Coût + Personne + Catégorie + {% if query.frequency != "Monthly" %} + Date + {% endif %} +
+ {% for payment in payments %} + + {{ payment.name }} + + {{ payment.cost | euros() }} + + {{ payment.user }} + + + {{ payment.category_name }} + + + {% if query.frequency != "Monthly" %} + + {{ payment.date }} + + {% endif %} + + {% endfor %} +
+ + {{ paging::paging( + url="/" ~ payments_params( + search=query.search, + frequency=query.frequency + ), + page=page, + max_page=max_page + ) }} + + {% endif %} +{% endblock main %} diff --git a/templates/payment/update.html b/templates/payment/update.html new file mode 100644 index 0000000..25e6915 --- /dev/null +++ b/templates/payment/update.html @@ -0,0 +1,144 @@ +{% extends "base.html" %} + +{% block title %} + Paiement {{ id }} +{% endblock title %} + +{% block main %} + +
+

+ + Retour aux paiements + +

+ + {% if error %} +
{{ error }}
+ {% endif %} + + {% if not payment %} + + Le paiement n’a pas été trouvé. + + {% else %} + +
+

Modification

+ + + + + + + + {% set user_id = form.user_id | default(value="" ~ payment.user_id) %} + + + + + {% set category_id = form.category_id | default(value="" ~ payment.category_id) %} + + + + + {% set date = form.date | default(value=payment.date) %} + + {% if payment.frequency == "Punctual" %} + + + {% else %} + + {% endif %} + +
+ +
+
+ +
+

Suppression

+ + + + + +
+ +
+
+ + {% endif %} +
+ +{% endblock main %} 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") +) }} diff --git a/templates/statistics.html b/templates/statistics.html new file mode 100644 index 0000000..badbc6d --- /dev/null +++ b/templates/statistics.html @@ -0,0 +1,29 @@ +{% extends "base.html" %} + +{% block title %} + Statistiques +{% endblock title %} + +{% block main %} + +
+ + +
+ + + + + + + + + +{% endblock main %} -- cgit v1.2.3