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 %}
+
+ {% for exceeding_payer in exceeding_payers %}
+ -
+ {{ exceeding_payer.0 }} : +{{ exceeding_payer.1 | euros() }}
+
+ {% endfor %}
+
+ {% else %}
+
+ Les paiements sont équilibrés.
+
+ {% endif %}
+
+ {% if incomes_from %}
+
+ Revenus
+
+
+
+
+ {% 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
+
+
+
+
+ {% 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 %}
+
+
+
+
+
+
+
+
+
+ {% 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 %}
+
+
+
+{% 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 %}
+
+
+
+ {% if not categories %}
+
+
+ Il n’y a aucune catégorie.
+
+
+ {% else %}
+
+
+
+ {% 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 %}
+
+
+
+
+
+ {% 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 %}
+
+
+
+{% 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 %}
+
+
+
+ {% if not incomes %}
+
+
+ Il n’y a aucun revenu.
+
+
+ {% else %}
+
+
+
+ {{ 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 %}
+
+
+
+
+
+ {% 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 %}
+
+
+
+{% 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 %}
+
+
+
+{% 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 not payments %}
+
+
+ Aucun paiement ne correspond à votre recherche.
+
+
+ {% else %}
+
+
+ {{ count | numeric }} paiement{{ count | pluralize }} comptabilisant {{ total_cost | euros() }}.
+
+
+
+
+ {{ 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 %}
+
+
+
+
+
+ {% 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 %}
+
+
+
+
+
+
+ {{ json_categories }}
+
+
+
+ {{ json_incomes }}
+
+
+
+ {{ json_payments }}
+
+
+
+
+{% endblock main %}
--
cgit v1.2.3