Compare commits
74 commits
4bbb5de3c5
...
ee3ec21527
Author | SHA1 | Date | |
---|---|---|---|
ee3ec21527 | |||
ad020e476b | |||
0ff191e0a4 | |||
a6e84fbc13 | |||
7369b36ab1 | |||
63258147ee | |||
67e71b717b | |||
e41b989862 | |||
ca7cd790b5 | |||
9d50dc7154 | |||
218a6aca6f | |||
6bd83feafe | |||
b0716a65b7 | |||
8db2720f75 | |||
954ee9ce17 | |||
08b234a070 | |||
bf1d15574d | |||
ef90d52807 | |||
e4169bd1c3 | |||
e2f7a1dcc3 | |||
cc551c536c | |||
b3c9642adc | |||
b478286f47 | |||
6d14602dd2 | |||
0f1aba45ea | |||
05b7418162 | |||
d48818e455 | |||
9927cbbab4 | |||
e44e3a51f0 | |||
65d97f523c | |||
6b08113f60 | |||
e5cdf19fa3 | |||
b4c7f88b3d | |||
87c12f47e9 | |||
8ebb940f5b | |||
5ccae7f4a3 | |||
3fd87ff370 | |||
f8c0f9dced | |||
2ba21fbd10 | |||
35b26f2d10 | |||
57279b1cda | |||
47c4de8fbb | |||
1137cfc1cc | |||
2f32c2b80f | |||
60f84fe20d | |||
8b9af8e1a4 | |||
309281f5e1 | |||
75df57f42a | |||
3dbc31eebc | |||
caa113859d | |||
45b47dd1ba | |||
003902b43f | |||
0940904cd8 | |||
6b50de5e35 | |||
e4e0f56be0 | |||
ee043d3956 | |||
fe95222474 | |||
47d8ff0382 | |||
7f3b9c7b5c | |||
0e5b8ea85d | |||
715822e48f | |||
ee4e6b7ceb | |||
55923e7709 | |||
14755df86b | |||
a0bc1a6608 | |||
68ff2ae8ad | |||
17fe61c9c0 | |||
aeb22521f3 | |||
5013df903f | |||
c3ba376793 | |||
4bb682fc88 | |||
8652eb0b57 | |||
6f631607b8 | |||
9dbbd3d48e |
55 changed files with 1265 additions and 672 deletions
Binary file not shown.
|
@ -7,7 +7,7 @@ msgid ""
|
|||
msgstr ""
|
||||
"Project-Id-Version: \n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2023-04-22 15:16+0200\n"
|
||||
"POT-Creation-Date: 2024-01-04 16:18+0100\n"
|
||||
"PO-Revision-Date: 2023-04-22 15:17+0200\n"
|
||||
"Last-Translator: Edgar P. Burkhart <traduction@edgarpierre.fr>\n"
|
||||
"Language-Team: \n"
|
||||
|
@ -37,6 +37,22 @@ msgstr "Défaut"
|
|||
msgid "Accounts"
|
||||
msgstr "Comptes"
|
||||
|
||||
#: .\account\templates\account\account_detail.html:13
|
||||
msgid "Edit account"
|
||||
msgstr "Modifier le compte"
|
||||
|
||||
#: .\account\templates\account\account_detail.html:16
|
||||
msgid "Statements"
|
||||
msgstr "Relevés"
|
||||
|
||||
#: .\account\templates\account\account_detail.html:20
|
||||
msgid "Transactions"
|
||||
msgstr "Transactions"
|
||||
|
||||
#: .\account\templates\account\account_detail.html:25
|
||||
msgid "History"
|
||||
msgstr "Historique"
|
||||
|
||||
#: .\account\templates\account\account_form.html:5
|
||||
msgid "Create account"
|
||||
msgstr "Créer un compte"
|
||||
|
@ -44,15 +60,3 @@ msgstr "Créer un compte"
|
|||
#: .\account\templates\account\account_form.html:8
|
||||
msgid "New account"
|
||||
msgstr "Nouveau compte"
|
||||
|
||||
#: .\account\templates\account\account_form.html:13
|
||||
msgid "Statements"
|
||||
msgstr "Relevés"
|
||||
|
||||
#: .\account\templates\account\account_form.html:15
|
||||
msgid "Transactions"
|
||||
msgstr "Transactions"
|
||||
|
||||
#: .\account\templates\account\account_form.html:18
|
||||
msgid "History"
|
||||
msgstr "Historique"
|
||||
|
|
29
nummi/account/templates/account/account_detail.html
Normal file
29
nummi/account/templates/account/account_detail.html
Normal file
|
@ -0,0 +1,29 @@
|
|||
{% extends "main/base.html" %}
|
||||
{% load main_extras %}
|
||||
{% load i18n %}
|
||||
{% block title %}{{ object }} – {{ block.super }}{% endblock %}
|
||||
{% block link %}
|
||||
{{ block.super }}
|
||||
{% css "main/css/table.css" %}
|
||||
{% css "main/css/plot.css" %}
|
||||
{% endblock %}
|
||||
{% block body %}
|
||||
<h2>{{ object.icon|remix }}{{ object }}</h2>
|
||||
<p>
|
||||
<a href="{% url "edit_account" object.pk %}">{% translate "Edit account" %}</a>
|
||||
</p>
|
||||
<section>
|
||||
<h3>{% translate "Statements" %}</h3>
|
||||
{% include "statement/statement_table.html" %}
|
||||
</section>
|
||||
<section>
|
||||
<h3>{% translate "Transactions" %}</h3>
|
||||
{% include "transaction/transaction_table.html" %}
|
||||
</section>
|
||||
{% if history %}
|
||||
<section>
|
||||
<h3>{% translate "History" %}</h3>
|
||||
{% include "history/plot.html" %}
|
||||
</section>
|
||||
{% endif %}
|
||||
{% endblock %}
|
|
@ -8,15 +8,3 @@
|
|||
{% translate "New account" %}
|
||||
{% endblock %}
|
||||
{% block h2 %}{{ form.instance.icon|remix }}{{ form.instance }}{% endblock %}
|
||||
{% block tables %}
|
||||
{% if not form.instance|adding %}
|
||||
<h3>{% translate "Statements" %}</h3>
|
||||
{% include "statement/statement_table.html" %}
|
||||
<h3>{% translate "Transactions" %}</h3>
|
||||
{% include "transaction/transaction_table.html" %}
|
||||
{% if history.data %}
|
||||
<h3>{% translate "History" %}</h3>
|
||||
{% include "history/plot.html" %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
from django.urls import path
|
||||
from statement.views import StatementCreateView
|
||||
from transaction.views import TransactionMonthView
|
||||
from transaction.views import TransactionMonthView, TransactionYearView
|
||||
|
||||
from . import views
|
||||
|
||||
urlpatterns = [
|
||||
path("new", views.AccountCreateView.as_view(), name="new_account"),
|
||||
path("<account>", views.AccountUpdateView.as_view(), name="account"),
|
||||
path("<account>", views.AccountDetailView.as_view(), name="account"),
|
||||
path("<account>/edit", views.AccountUpdateView.as_view(), name="edit_account"),
|
||||
path(
|
||||
"<account>/transactions",
|
||||
views.AccountTListView.as_view(),
|
||||
|
@ -27,9 +28,14 @@ urlpatterns = [
|
|||
views.AccountDeleteView.as_view(),
|
||||
name="del_account",
|
||||
),
|
||||
path(
|
||||
"<account>/history/<int:year>",
|
||||
TransactionYearView.as_view(),
|
||||
name="account_transaction_year",
|
||||
),
|
||||
path(
|
||||
"<account>/history/<int:year>/<int:month>",
|
||||
TransactionMonthView.as_view(),
|
||||
name="transaction_month",
|
||||
name="account_transaction_month",
|
||||
),
|
||||
]
|
||||
|
|
|
@ -1,7 +1,12 @@
|
|||
from django.shortcuts import get_object_or_404
|
||||
from django.urls import reverse_lazy
|
||||
from history.utils import history
|
||||
from main.views import NummiCreateView, NummiDeleteView, NummiUpdateView
|
||||
from main.views import (
|
||||
NummiCreateView,
|
||||
NummiDeleteView,
|
||||
NummiDetailView,
|
||||
NummiUpdateView,
|
||||
)
|
||||
from statement.views import StatementListView
|
||||
from transaction.views import TransactionListView
|
||||
|
||||
|
@ -19,10 +24,20 @@ class AccountUpdateView(NummiUpdateView):
|
|||
form_class = AccountForm
|
||||
pk_url_kwarg = "account"
|
||||
|
||||
|
||||
class AccountDeleteView(NummiDeleteView):
|
||||
model = Account
|
||||
pk_url_kwarg = "account"
|
||||
|
||||
|
||||
class AccountDetailView(NummiDetailView):
|
||||
model = Account
|
||||
pk_url_kwarg = "account"
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
_max = 8
|
||||
data = super().get_context_data(**kwargs)
|
||||
account = data["form"].instance
|
||||
account = data.get("object")
|
||||
|
||||
_transactions = account.transaction_set.all()
|
||||
if _transactions.count() > _max:
|
||||
|
@ -45,11 +60,6 @@ class AccountUpdateView(NummiUpdateView):
|
|||
}
|
||||
|
||||
|
||||
class AccountDeleteView(NummiDeleteView):
|
||||
model = Account
|
||||
pk_url_kwarg = "account"
|
||||
|
||||
|
||||
class AccountMixin:
|
||||
def get_queryset(self):
|
||||
self.account = get_object_or_404(
|
||||
|
|
Binary file not shown.
|
@ -7,7 +7,7 @@ msgid ""
|
|||
msgstr ""
|
||||
"Project-Id-Version: \n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2023-11-25 12:05+0100\n"
|
||||
"POT-Creation-Date: 2024-01-04 16:18+0100\n"
|
||||
"PO-Revision-Date: 2023-04-22 15:18+0200\n"
|
||||
"Last-Translator: Edgar P. Burkhart <traduction@edgarpierre.fr>\n"
|
||||
"Language-Team: \n"
|
||||
|
@ -38,6 +38,18 @@ msgstr "Budget"
|
|||
msgid "Categories"
|
||||
msgstr "Catégories"
|
||||
|
||||
#: .\category\templates\category\category_detail.html:12
|
||||
msgid "Edit category"
|
||||
msgstr "Modifier la catégorie"
|
||||
|
||||
#: .\category\templates\category\category_detail.html:15
|
||||
msgid "Transactions"
|
||||
msgstr "Transactions"
|
||||
|
||||
#: .\category\templates\category\category_detail.html:20
|
||||
msgid "History"
|
||||
msgstr "Historique"
|
||||
|
||||
#: .\category\templates\category\category_form.html:5
|
||||
msgid "Create category"
|
||||
msgstr "Créer une catégorie"
|
||||
|
@ -46,14 +58,6 @@ msgstr "Créer une catégorie"
|
|||
msgid "New category"
|
||||
msgstr "Nouvelle catégorie"
|
||||
|
||||
#: .\category\templates\category\category_form.html:12
|
||||
msgid "Transactions"
|
||||
msgstr "Transactions"
|
||||
|
||||
#: .\category\templates\category\category_form.html:15
|
||||
msgid "History"
|
||||
msgstr "Historique"
|
||||
|
||||
#: .\category\templates\category\category_plot.html:15
|
||||
msgid "Expenses"
|
||||
msgstr "Dépenses"
|
||||
|
@ -62,10 +66,10 @@ msgstr "Dépenses"
|
|||
msgid "Income"
|
||||
msgstr "Revenus"
|
||||
|
||||
#: .\category\templates\category\category_plot.html:56
|
||||
#: .\category\templates\category\category_plot.html:62
|
||||
msgid "No transaction"
|
||||
msgstr "Aucune transaction"
|
||||
|
||||
#: .\category\templates\category\category_plot.html:64
|
||||
#: .\category\templates\category\category_plot.html:70
|
||||
msgid "Total"
|
||||
msgstr "Total"
|
||||
|
|
24
nummi/category/templates/category/category_detail.html
Normal file
24
nummi/category/templates/category/category_detail.html
Normal file
|
@ -0,0 +1,24 @@
|
|||
{% extends "main/base.html" %}
|
||||
{% load main_extras i18n %}
|
||||
{% block title %}{{ object }} – {{ block.super }}{% endblock %}
|
||||
{% block link %}
|
||||
{{ block.super }}
|
||||
{% css "main/css/table.css" %}
|
||||
{% css "main/css/plot.css" %}
|
||||
{% endblock %}
|
||||
{% block body %}
|
||||
<h2>{{ object.icon|remix }}{{ object }}</h2>
|
||||
<p>
|
||||
<a href="{% url "edit_category" object.pk %}">{% translate "Edit category" %}</a>
|
||||
</p>
|
||||
<section>
|
||||
<h3>{% translate "Transactions" %}</h3>
|
||||
{% include "transaction/transaction_table.html" %}
|
||||
</section>
|
||||
{% if history %}
|
||||
<section>
|
||||
<h3>{% translate "History" %}</h3>
|
||||
{% include "history/plot.html" %}
|
||||
</section>
|
||||
{% endif %}
|
||||
{% endblock %}
|
|
@ -8,11 +8,3 @@
|
|||
{% translate "New category" %}
|
||||
{% endblock %}
|
||||
{% block h2 %}{{ form.instance.icon|remix }}{{ form.instance }}{% endblock %}
|
||||
{% block tables %}
|
||||
<h3>{% translate "Transactions" %}</h3>
|
||||
{% include "transaction/transaction_table.html" %}
|
||||
{% if history.data %}
|
||||
<h3>{% translate "History" %}</h3>
|
||||
{% include "history/plot.html" %}
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{% load main_extras %}
|
||||
{% load main_extras statement_extras %}
|
||||
{% load i18n %}
|
||||
<div class="plot">
|
||||
<table class="full-width">
|
||||
|
@ -23,7 +23,9 @@
|
|||
<th scope="row" class="l">
|
||||
{% if cat.category %}
|
||||
{% if month %}
|
||||
<a href="{% url "transaction_month" cat.category month.year month.month %}">{{ cat.category__name }}</a>
|
||||
<a href="{% url "category_transaction_month" cat.category month.year month.month %}">{{ cat.category__name }}</a>
|
||||
{% elif year %}
|
||||
<a href="{% url "category_transaction_year" cat.category year.year %}">{{ cat.category__name }}</a>
|
||||
{% else %}
|
||||
{{ cat.category__name }}
|
||||
{% endif %}
|
||||
|
@ -32,24 +34,28 @@
|
|||
<td class="c">
|
||||
{% if cat.category %}{{ cat.category__icon|remix }}{% endif %}
|
||||
</td>
|
||||
<td class="value">{{ cat.sum_m|pmrvalue }}</td>
|
||||
<td class="value">{{ cat.sum_m|pmvalue }}</td>
|
||||
<td class="bar m">
|
||||
<div style="width: {% widthratio cat.sum_m max -100 %}%"></div>
|
||||
{% if cat.sum_m %}
|
||||
<div style="width: {% widthratio cat.sum_m max -100 %}%"></div>
|
||||
{% endif %}
|
||||
{% if cat.sum < 0 %}
|
||||
<div class="tot" style="width:{% widthratio cat.sum max -100 %}%">
|
||||
<span>{{ cat.sum|pmrvalue }}</span>
|
||||
<span>{{ cat.sum|pmvalue }}</span>
|
||||
</div>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td class="bar p">
|
||||
<div style="width: {% widthratio cat.sum_p max 100 %}%"></div>
|
||||
{% if cat.sum_p %}
|
||||
<div style="width: {% widthratio cat.sum_p max 100 %}%"></div>
|
||||
{% endif %}
|
||||
{% if cat.sum > 0 %}
|
||||
<div class="tot" style="width:{% widthratio cat.sum max 100 %}%">
|
||||
<span>{{ cat.sum|pmrvalue }}</span>
|
||||
<span>{{ cat.sum|pmvalue }}</span>
|
||||
</div>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td class="value">{{ cat.sum_p|pmrvalue }}</td>
|
||||
<td class="value">{{ cat.sum_p|pmvalue }}</td>
|
||||
</tr>
|
||||
{% empty %}
|
||||
<tr>
|
||||
|
@ -58,16 +64,16 @@
|
|||
{% endfor %}
|
||||
{% endspaceless %}
|
||||
</tbody>
|
||||
{% if categories %}
|
||||
<tfoot>
|
||||
<tfoot>
|
||||
{% if categories %}
|
||||
<tr>
|
||||
<th scope="row" colspan="2" class="l">{% translate "Total" %}</th>
|
||||
<td class="value">{{ total_m|pmrvalue }}</td>
|
||||
<td class="value">{{ total_m|pmvalue }}</td>
|
||||
<td class="bar m">
|
||||
<div style="width: {% widthratio total_m max -100 %}%"></div>
|
||||
{% if total < 0 %}
|
||||
<div class="tot" style="width:{% widthratio total max -100 %}%">
|
||||
<span>{{ total|pmrvalue }}</span>
|
||||
<span>{{ total|pmvalue }}</span>
|
||||
</div>
|
||||
{% endif %}
|
||||
</td>
|
||||
|
@ -75,13 +81,35 @@
|
|||
<div style="width: {% widthratio total_p max 100 %}%"></div>
|
||||
{% if total > 0 %}
|
||||
<div class="tot" style="width:{% widthratio total max 100 %}%">
|
||||
<span>{{ total|pmrvalue }}</span>
|
||||
<span>{{ total|pmvalue }}</span>
|
||||
</div>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td class="value">{{ total_p|pmrvalue }}</td>
|
||||
<td class="value">{{ total_p|pmvalue }}</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% if statement %}
|
||||
<tr>
|
||||
<th scope="row" class="l">{% translate "Expected total" %}</th>
|
||||
<td class="c">{{ total|check:statement.diff }}</td>
|
||||
<td></td>
|
||||
<td class="bar m">
|
||||
{% if statement.diff < 0 %}
|
||||
<div class="tot" style="width:{% widthratio statement.diff max -100 %}%">
|
||||
<span>{{ statement.diff|pmvalue }}</span>
|
||||
</div>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td class="bar p">
|
||||
{% if statement.diff >= 0 %}
|
||||
<div class="tot" style="width:{% widthratio statement.diff max 100 %}%">
|
||||
<span>{{ statement.diff|pmvalue }}</span>
|
||||
</div>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
|
|
|
@ -6,10 +6,11 @@ register = template.Library()
|
|||
|
||||
|
||||
@register.inclusion_tag("category/category_plot.html")
|
||||
def category_plot(transactions, **kwargs):
|
||||
def category_plot(transactions, budget=True, **kwargs):
|
||||
if budget:
|
||||
transactions = transactions.exclude(category__budget=False)
|
||||
categories = (
|
||||
transactions.exclude(category__budget=False)
|
||||
.values("category", "category__name", "category__icon")
|
||||
transactions.values("category", "category__name", "category__icon")
|
||||
.annotate(
|
||||
sum=models.Sum("value"),
|
||||
sum_m=models.Sum("value", filter=models.Q(value__lt=0)),
|
||||
|
|
|
@ -1,20 +1,26 @@
|
|||
from django.urls import path
|
||||
from transaction.views import TransactionMonthView
|
||||
from transaction.views import TransactionMonthView, TransactionYearView
|
||||
|
||||
from . import views
|
||||
|
||||
urlpatterns = [
|
||||
path("new", views.CategoryCreateView.as_view(), name="new_category"),
|
||||
path("<category>", views.CategoryUpdateView.as_view(), name="category"),
|
||||
path("<category>", views.CategoryDetailView.as_view(), name="category"),
|
||||
path("<category>/edit", views.CategoryUpdateView.as_view(), name="edit_category"),
|
||||
path(
|
||||
"<category>/transactions",
|
||||
views.CategoryTListView.as_view(),
|
||||
name="category_transactions",
|
||||
),
|
||||
path("<category>/delete", views.CategoryDeleteView.as_view(), name="del_category"),
|
||||
path(
|
||||
"<category>/history/<int:year>",
|
||||
TransactionYearView.as_view(),
|
||||
name="category_transaction_year",
|
||||
),
|
||||
path(
|
||||
"<category>/history/<int:year>/<int:month>",
|
||||
TransactionMonthView.as_view(),
|
||||
name="transaction_month",
|
||||
name="category_transaction_month",
|
||||
),
|
||||
]
|
||||
|
|
|
@ -1,7 +1,12 @@
|
|||
from django.shortcuts import get_object_or_404
|
||||
from django.urls import reverse_lazy
|
||||
from history.utils import history
|
||||
from main.views import NummiCreateView, NummiDeleteView, NummiUpdateView
|
||||
from main.views import (
|
||||
NummiCreateView,
|
||||
NummiDeleteView,
|
||||
NummiDetailView,
|
||||
NummiUpdateView,
|
||||
)
|
||||
from transaction.views import TransactionListView
|
||||
|
||||
from .forms import CategoryForm
|
||||
|
@ -18,10 +23,15 @@ class CategoryUpdateView(NummiUpdateView):
|
|||
form_class = CategoryForm
|
||||
pk_url_kwarg = "category"
|
||||
|
||||
|
||||
class CategoryDetailView(NummiDetailView):
|
||||
model = Category
|
||||
pk_url_kwarg = "category"
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
_max = 8
|
||||
data = super().get_context_data(**kwargs)
|
||||
category = data["form"].instance
|
||||
category = data["object"]
|
||||
|
||||
data["transactions"] = category.transaction_set.all()[:_max]
|
||||
if len(data["transactions"]) == _max:
|
||||
|
|
Binary file not shown.
|
@ -7,7 +7,7 @@ msgid ""
|
|||
msgstr ""
|
||||
"Project-Id-Version: \n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2023-04-22 15:16+0200\n"
|
||||
"POT-Creation-Date: 2024-01-03 15:51+0100\n"
|
||||
"PO-Revision-Date: 2023-04-22 15:18+0200\n"
|
||||
"Last-Translator: Edgar P. Burkhart <traduction@edgarpierre.fr>\n"
|
||||
"Language-Team: \n"
|
||||
|
@ -17,14 +17,18 @@ msgstr ""
|
|||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Generator: Poedit 3.2.2\n"
|
||||
|
||||
#: .\history\templates\history\plot.html:15
|
||||
#: .\history\templates\history\plot.html:17
|
||||
msgid "Month"
|
||||
msgstr "Mois"
|
||||
|
||||
#: .\history\templates\history\plot.html:16
|
||||
#: .\history\templates\history\plot.html:18
|
||||
msgid "Expenses"
|
||||
msgstr "Dépenses"
|
||||
|
||||
#: .\history\templates\history\plot.html:17
|
||||
#: .\history\templates\history\plot.html:19
|
||||
msgid "Income"
|
||||
msgstr "Revenus"
|
||||
|
||||
#: .\history\templates\history\plot.html:55
|
||||
msgid "Year"
|
||||
msgstr "Année"
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
{% load main_extras %}
|
||||
{% load history_extras %}
|
||||
{% load transaction_extras %}
|
||||
{% load i18n %}
|
||||
<div class="plot">
|
||||
<div class="history plot">
|
||||
<table class="full-width">
|
||||
<colgroup>
|
||||
<col class="icon">
|
||||
|
@ -18,46 +20,67 @@
|
|||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% spaceless %}
|
||||
{% for date in history.data %}
|
||||
<tr>
|
||||
<td class="icon">
|
||||
<span class="ri-{% if date.sum > 0 %}arrow-up-s-line green{% elif date.sum < 0 %}arrow-down-s-line red{% endif %}"></span>
|
||||
</td>
|
||||
<th class="date" scope="row">
|
||||
{% if date.has_transactions %}
|
||||
{% if account %}
|
||||
<a href="{% url "transaction_month" account=account.pk year=date.month.year month=date.month.month %}">{{ date.month|date:"Y-m" }}</a>
|
||||
{% elif category %}
|
||||
<a href="{% url "transaction_month" category=category.pk year=date.month.year month=date.month.month %}">{{ date.month|date:"Y-m" }}</a>
|
||||
{% for date in history.data reversed %}
|
||||
{% ifchanged %}
|
||||
{% if date.sum_m or date.sum_p %}
|
||||
<tr {% if not date.month.month|divisibleby:"2" %}class="even"{% endif %}>
|
||||
<td class="icon">{% up_down_icon date.sum %}</td>
|
||||
<th class="date" scope="row">
|
||||
{% if year %}
|
||||
{% month_url date.month fmt="F" %}
|
||||
{% else %}
|
||||
<a href="{% url "transaction_month" year=date.month.year month=date.month.month %}">{{ date.month|date:"Y-m" }}</a>
|
||||
{% month_url date.month %}
|
||||
{% endif %}
|
||||
{% else %}
|
||||
{{ date.month|date:"Y-m" }}
|
||||
{% endif %}
|
||||
</th>
|
||||
<td class="value">{{ date.sum_m|pmrvalue }}</td>
|
||||
<td class="bar m">
|
||||
<div style="width: {% widthratio date.sum_m history.max -100 %}%"></div>
|
||||
{% if date.sum < 0 %}
|
||||
<div class="tot" style="width:{% widthratio date.sum history.max -100 %}%">
|
||||
<span>{{ date.sum|pmrvalue }}</span>
|
||||
</div>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td class="bar p">
|
||||
<div style="width: {% widthratio date.sum_p history.max 100 %}%"></div>
|
||||
{% if date.sum > 0 %}
|
||||
<div class="tot" style="width:{% widthratio date.sum history.max 100 %}%">
|
||||
<span>{{ date.sum|pmrvalue }}</span>
|
||||
</div>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td class="value">{{ date.sum_p|pmrvalue }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
{% endspaceless %}
|
||||
</th>
|
||||
<td class="value">{{ date.sum_m|pmrvalue }}</td>
|
||||
<td class="bar m">{% plot_bar date.sum date.sum_m history.max.pm %}</td>
|
||||
<td class="bar p">{% plot_bar date.sum date.sum_p history.max.pm %}</td>
|
||||
<td class="value">{{ date.sum_p|pmrvalue }}</td>
|
||||
</tr>
|
||||
{% else %}
|
||||
<tr class="empty">
|
||||
<td colspan="6" class="empty"></td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
{% endifchanged %}
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="calendar">
|
||||
<table class="full-width">
|
||||
<thead>
|
||||
<tr>
|
||||
{% if not year %}
|
||||
<th scope="col">{% translate "Year" %}</th>
|
||||
{% endif %}
|
||||
{% calendar_head %}
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% regroup history.data by month.year as years_list %}
|
||||
{% for y, y_data in years_list reversed %}
|
||||
<tr>
|
||||
{% if not year %}
|
||||
<th class="date" scope="row">{% year_url y %}</th>
|
||||
{% endif %}
|
||||
{% for m in y_data %}
|
||||
{% if forloop.parentloop.last and forloop.first %}
|
||||
{% empty_calendar_cells_start m.month.month %}
|
||||
{% endif %}
|
||||
{% if m %}
|
||||
<td class="{% if m.sum > 0 %}p{% else %}m{% endif %}"
|
||||
style="--opacity: {% calendar_opacity m.sum history.max.sum %}"
|
||||
title="{{ m.sum|pmrvalue }}">{% up_down_icon m.sum %}</td>
|
||||
{% else %}
|
||||
<td></td>
|
||||
{% endif %}
|
||||
{% if forloop.parentloop.first and forloop.last %}
|
||||
{% empty_calendar_cells_end m.month.month %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
|
62
nummi/history/templatetags/history_extras.py
Normal file
62
nummi/history/templatetags/history_extras.py
Normal file
|
@ -0,0 +1,62 @@
|
|||
import math
|
||||
|
||||
from django import template
|
||||
from django.utils.safestring import mark_safe
|
||||
from main.templatetags.main_extras import pmrvalue, remix
|
||||
|
||||
register = template.Library()
|
||||
|
||||
|
||||
@register.simple_tag
|
||||
def calendar_opacity(v, vmax):
|
||||
return f"{math.sin(math.fabs(v/vmax)*math.pi/2):.0%}"
|
||||
|
||||
|
||||
@register.simple_tag
|
||||
def empty_calendar_cells(n):
|
||||
return mark_safe(n * "<td></td>")
|
||||
|
||||
|
||||
@register.simple_tag
|
||||
def empty_calendar_cells_start(n):
|
||||
return empty_calendar_cells(n - 1)
|
||||
|
||||
|
||||
@register.simple_tag
|
||||
def empty_calendar_cells_end(n):
|
||||
return empty_calendar_cells(12 - n)
|
||||
|
||||
|
||||
@register.simple_tag
|
||||
def up_down_icon(val):
|
||||
if val > 0:
|
||||
return remix("arrow-up-s", "green")
|
||||
elif val < 0:
|
||||
return remix("arrow-down-s", "red")
|
||||
|
||||
return remix("equal", "white")
|
||||
|
||||
|
||||
@register.simple_tag
|
||||
def plot_bar(s, sum_pm, s_max):
|
||||
_res = ""
|
||||
|
||||
if sum_pm:
|
||||
_w = abs(sum_pm / s_max)
|
||||
_res += f"""<div style="width: {_w:.1%}"></div>"""
|
||||
if sum_pm is not None and s * sum_pm > 0:
|
||||
_w = abs(s / s_max)
|
||||
_res += (
|
||||
f"""<div class="tot" style="width: {_w:.1%}">"""
|
||||
f"""<span>{pmrvalue(s)}</span></div>"""
|
||||
)
|
||||
|
||||
return mark_safe(_res)
|
||||
|
||||
|
||||
@register.simple_tag
|
||||
def calendar_head():
|
||||
months = range(1, 13)
|
||||
th = (f"""<th>{month:02d}</th>""" for month in months)
|
||||
|
||||
return mark_safe("".join(th))
|
|
@ -1,48 +1,47 @@
|
|||
from django.db import models
|
||||
from django.db.models import Func, Max, Min, Q, Sum, Value
|
||||
from django.db.models.functions import Now, TruncMonth
|
||||
import datetime
|
||||
|
||||
|
||||
class GenerateMonth(Func):
|
||||
function = "generate_series"
|
||||
template = "%(function)s(%(expressions)s, '1 month')::date"
|
||||
from django.db.models import Max, Min, Q, Sum
|
||||
from django.db.models.functions import Abs, TruncMonth
|
||||
|
||||
|
||||
def history(transaction_set):
|
||||
if not transaction_set.exists():
|
||||
return None
|
||||
|
||||
_transaction_month = transaction_set.values(month=TruncMonth("date")).order_by(
|
||||
"-date"
|
||||
)
|
||||
_months = (
|
||||
transaction_set.values(
|
||||
month=GenerateMonth(
|
||||
_transaction_month.last()["month"],
|
||||
Now(output_field=models.DateField()),
|
||||
)
|
||||
)
|
||||
.annotate(
|
||||
sum_m=Value(0), sum_p=Value(0), sum=Value(0), has_transactions=Value(0)
|
||||
)
|
||||
.difference(
|
||||
_transaction_month.annotate(
|
||||
sum_m=Value(0), sum_p=Value(0), sum=Value(0), has_transactions=Value(0)
|
||||
)
|
||||
)
|
||||
)
|
||||
_first_month = _transaction_month.last()["month"]
|
||||
_last_month = _transaction_month.first()["month"]
|
||||
|
||||
_history = _transaction_month.annotate(
|
||||
sum_p=Sum("value", filter=Q(value__gt=0)),
|
||||
sum_m=Sum("value", filter=Q(value__lt=0)),
|
||||
sum=Sum("value"),
|
||||
has_transactions=Value(1),
|
||||
).order_by("-month")
|
||||
|
||||
_data = [
|
||||
_history.filter(month=datetime.date(y, m + 1, 1)).first()
|
||||
or {"month": datetime.date(y, m + 1, 1), "sum": 0}
|
||||
for y in range(
|
||||
_first_month.year,
|
||||
_last_month.year + 1,
|
||||
)
|
||||
for m in range(
|
||||
_first_month.month - 1 if _first_month.year == y else 0,
|
||||
_last_month.month if _last_month.year == y else 12,
|
||||
)
|
||||
]
|
||||
|
||||
return {
|
||||
"data": _history.union(_months).order_by("-month"),
|
||||
"max": max(
|
||||
_history.aggregate(
|
||||
max=Max("sum_p", default=0),
|
||||
min=-Min("sum_m", default=0),
|
||||
).values(),
|
||||
),
|
||||
"data": _data,
|
||||
"max": {
|
||||
"pm": max(
|
||||
_history.aggregate(
|
||||
max=Max("sum_p", default=0),
|
||||
min=-Min("sum_m", default=0),
|
||||
).values(),
|
||||
),
|
||||
"sum": _history.aggregate(max=Max(Abs("sum")))["max"],
|
||||
},
|
||||
}
|
||||
|
|
Binary file not shown.
|
@ -7,7 +7,7 @@ msgid ""
|
|||
msgstr ""
|
||||
"Project-Id-Version: \n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2023-11-25 12:05+0100\n"
|
||||
"POT-Creation-Date: 2024-01-04 16:18+0100\n"
|
||||
"PO-Revision-Date: 2023-04-23 08:03+0200\n"
|
||||
"Last-Translator: Edgar P. Burkhart <traduction@edgarpierre.fr>\n"
|
||||
"Language-Team: \n"
|
||||
|
@ -21,67 +21,51 @@ msgstr ""
|
|||
msgid "User"
|
||||
msgstr "Utilisateur"
|
||||
|
||||
#: .\main\templates\main\base.html:27
|
||||
#: .\main\templates\main\base.html:28
|
||||
msgid "Skip to main content"
|
||||
msgstr "Aller au contenu principal"
|
||||
|
||||
#: .\main\templates\main\base.html:33
|
||||
#: .\main\templates\main\base.html:34
|
||||
msgid "Home"
|
||||
msgstr "Accueil"
|
||||
|
||||
#: .\main\templates\main\base.html:38 .\main\templates\main\index.html:40
|
||||
#: .\main\templates\main\base.html:39
|
||||
msgid "Statements"
|
||||
msgstr "Relevés"
|
||||
|
||||
#: .\main\templates\main\base.html:44 .\main\templates\main\index.html:24
|
||||
#: .\main\templates\main\base.html:45
|
||||
msgid "Transactions"
|
||||
msgstr "Transactions"
|
||||
|
||||
#: .\main\templates\main\base.html:50
|
||||
msgid "Create account"
|
||||
msgstr "Créer un compte"
|
||||
|
||||
#: .\main\templates\main\base.html:55
|
||||
msgid "Create statement"
|
||||
msgstr "Créer un relevé"
|
||||
|
||||
#: .\main\templates\main\base.html:60
|
||||
msgid "Create category"
|
||||
msgstr "Créer une catégorie"
|
||||
|
||||
#: .\main\templates\main\base.html:65
|
||||
msgid "Create transaction"
|
||||
msgstr "Créer une transaction"
|
||||
|
||||
#: .\main\templates\main\base.html:70 .\main\templates\main\list.html:10
|
||||
#: .\main\templates\main\list.html:36
|
||||
#: .\main\templates\main\base.html:51 .\main\templates\main\list.html:10
|
||||
#: .\main\templates\main\list.html:34
|
||||
msgid "Search"
|
||||
msgstr "Rechercher"
|
||||
|
||||
#: .\main\templates\main\base.html:73
|
||||
#: .\main\templates\main\base.html:54
|
||||
msgid "Log out"
|
||||
msgstr "Se déconnecter"
|
||||
|
||||
#: .\main\templates\main\base.html:78 .\main\templates\main\form\login.html:6
|
||||
#: .\main\templates\main\login.html:14
|
||||
#: .\main\templates\main\base.html:59 .\main\templates\main\form\login.html:6
|
||||
#: .\main\templates\main\login.html:11
|
||||
msgid "Log in"
|
||||
msgstr "Se connecter"
|
||||
|
||||
#: .\main\templates\main\base.html:84
|
||||
#: .\main\templates\main\base.html:65
|
||||
#, python-format
|
||||
msgid "Logged in as <strong>%(user)s</strong>"
|
||||
msgstr "Connecté en tant que <strong>%(user)s</strong>"
|
||||
|
||||
#: .\main\templates\main\confirm_delete.html:19
|
||||
#: .\main\templates\main\confirm_delete.html:15
|
||||
#, python-format
|
||||
msgid "Are you sure you want do delete <strong>%(object)s</strong> ?"
|
||||
msgstr "Êtes-vous sûr de vouloir supprimer <strong>%(object)s</strong> ?"
|
||||
|
||||
#: .\main\templates\main\confirm_delete.html:23
|
||||
#: .\main\templates\main\confirm_delete.html:19
|
||||
msgid "Cancel"
|
||||
msgstr "Annuler"
|
||||
|
||||
#: .\main\templates\main\confirm_delete.html:24
|
||||
#: .\main\templates\main\confirm_delete.html:20
|
||||
msgid "Confirm"
|
||||
msgstr "Confirmer"
|
||||
|
||||
|
@ -105,26 +89,51 @@ msgstr "Créer"
|
|||
msgid "Save"
|
||||
msgstr "Enregistrer"
|
||||
|
||||
#: .\main\templates\main\index.html:15
|
||||
#: .\main\templates\main\index.html:13
|
||||
msgid "Accounts"
|
||||
msgstr "Comptes"
|
||||
|
||||
#: .\main\templates\main\index.html:20
|
||||
#: .\main\templates\main\index.html:17
|
||||
msgid "Account"
|
||||
msgstr "Compte"
|
||||
|
||||
#: .\main\templates\main\index.html:18
|
||||
msgid "Balance"
|
||||
msgstr "Solde"
|
||||
|
||||
#: .\main\templates\main\index.html:19 .\main\templates\main\index.html:31
|
||||
msgid "Edit"
|
||||
msgstr "Modifier"
|
||||
|
||||
#: .\main\templates\main\index.html:36
|
||||
msgid "No account"
|
||||
msgstr "Aucun compte"
|
||||
|
||||
#: .\main\templates\main\index.html:28
|
||||
#: .\main\templates\main\index.html:43
|
||||
msgid "Create account"
|
||||
msgstr "Créer un compte"
|
||||
|
||||
#: .\main\templates\main\index.html:50
|
||||
msgid "Categories"
|
||||
msgstr "Catégories"
|
||||
|
||||
#: .\main\templates\main\index.html:34
|
||||
msgid "No category"
|
||||
msgstr "Aucune catégorie"
|
||||
#: .\main\templates\main\index.html:56
|
||||
msgid "Create category"
|
||||
msgstr "Créer une catégorie"
|
||||
|
||||
#: .\main\templates\main\index.html:44
|
||||
#: .\main\templates\main\index.html:63
|
||||
msgid "History"
|
||||
msgstr "Historique"
|
||||
|
||||
#: .\main\views.py:68
|
||||
#: .\main\views.py:69
|
||||
msgid "was created successfully"
|
||||
msgstr "a été créé avec succès"
|
||||
|
||||
#~ msgid "Create statement"
|
||||
#~ msgstr "Créer un relevé"
|
||||
|
||||
#~ msgid "Create transaction"
|
||||
#~ msgstr "Créer une transaction"
|
||||
|
||||
#~ msgid "No category"
|
||||
#~ msgstr "Aucune catégorie"
|
||||
|
|
|
@ -5,58 +5,65 @@ form ul.errorlist {
|
|||
margin: 0;
|
||||
}
|
||||
|
||||
form > table > tbody > tr > th {
|
||||
background: var(--bg-01);
|
||||
background-clip: padding-box;
|
||||
form {
|
||||
> table > tbody > tr > th {
|
||||
background: var(--bg-01);
|
||||
background-clip: padding-box;
|
||||
border-right: 1px solid var(--gray);
|
||||
}
|
||||
tbody :is(input, select, textarea) {
|
||||
font: inherit;
|
||||
border: none;
|
||||
background: transparent;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
line-height: 1.5;
|
||||
}
|
||||
input[type="checkbox"] {
|
||||
width: initial;
|
||||
}
|
||||
tfoot {
|
||||
text-align: right;
|
||||
}
|
||||
}
|
||||
form tbody input,
|
||||
form tbody select,
|
||||
form tbody textarea {
|
||||
font: inherit;
|
||||
border: none;
|
||||
background: var(--bg);
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
line-height: 1.5;
|
||||
}
|
||||
form input[type="checkbox"] {
|
||||
width: initial;
|
||||
}
|
||||
table.file-input tr {
|
||||
border: none;
|
||||
}
|
||||
table.file-input th {
|
||||
text-align: left;
|
||||
}
|
||||
table.file-input tr :first-child {
|
||||
padding-left: 0;
|
||||
}
|
||||
table.file-input tr :last-child {
|
||||
padding-right: 0;
|
||||
table.file-input {
|
||||
tr {
|
||||
border: none;
|
||||
|
||||
:first-child {
|
||||
padding-left: 0;
|
||||
}
|
||||
:last-child {
|
||||
padding-right: 0;
|
||||
}
|
||||
}
|
||||
th {
|
||||
text-align: left;
|
||||
}
|
||||
}
|
||||
|
||||
form tfoot {
|
||||
text-align: right;
|
||||
}
|
||||
.buttons input {
|
||||
font: inherit;
|
||||
line-height: 1.5;
|
||||
margin-left: var(--gap);
|
||||
border-radius: var(--radius);
|
||||
padding: 0 var(--gap);
|
||||
cursor: pointer;
|
||||
}
|
||||
.buttons input:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
.buttons input[type="submit"] {
|
||||
border: 0.1rem solid var(--green);
|
||||
background: var(--green-1);
|
||||
}
|
||||
.buttons input[type="reset"] {
|
||||
border: 0.1rem solid var(--red);
|
||||
background: var(--red-1);
|
||||
}
|
||||
.buttons a.del {
|
||||
color: var(--red);
|
||||
.buttons {
|
||||
input {
|
||||
font: inherit;
|
||||
line-height: 1.5;
|
||||
margin-left: var(--gap);
|
||||
border-radius: var(--radius);
|
||||
padding: 0 var(--gap);
|
||||
cursor: pointer;
|
||||
|
||||
&:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
&[type="submit"] {
|
||||
border: 0.1rem solid var(--green);
|
||||
background: var(--green-1);
|
||||
}
|
||||
&[type="reset"] {
|
||||
border: 0.1rem solid var(--red);
|
||||
background: var(--red-1);
|
||||
}
|
||||
}
|
||||
a.del {
|
||||
color: var(--red);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
@import "https://rsms.me/inter/inter.css";
|
||||
@import "https://cdn.jsdelivr.net/npm/remixicon@4.0.0/fonts/remixicon.css";
|
||||
|
||||
*,
|
||||
*::before,
|
||||
|
@ -39,7 +40,8 @@
|
|||
--border: 0.5em;
|
||||
--radius: 0.25em;
|
||||
|
||||
--num: "tnum", "ss01", "ss02", "case";
|
||||
--default-ffs: "dlig", "ss01", "ss04";
|
||||
--num: var(--default-ffs), "tnum", "case";
|
||||
}
|
||||
|
||||
body {
|
||||
|
@ -51,6 +53,7 @@ body {
|
|||
|
||||
display: grid;
|
||||
grid-template-columns: max-content 1fr;
|
||||
font-feature-settings: var(--default-ffs);
|
||||
}
|
||||
|
||||
p {
|
||||
|
@ -60,9 +63,29 @@ a {
|
|||
color: var(--text-link);
|
||||
text-decoration: none;
|
||||
display: inline-block;
|
||||
}
|
||||
a:hover {
|
||||
text-decoration: underline;
|
||||
|
||||
&:is(:hover, :focus) {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
&.big-link {
|
||||
margin-right: 1em;
|
||||
padding: 0 0.5em;
|
||||
|
||||
color: white;
|
||||
background: var(--green);
|
||||
border-radius: var(--radius);
|
||||
height: 1.5rem;
|
||||
line-height: 1.5rem;
|
||||
|
||||
[class^="ri-"] {
|
||||
margin-right: 0.5em;
|
||||
}
|
||||
&.add {
|
||||
color: var(--text-link);
|
||||
background: var(--bg-01);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.red {
|
||||
|
@ -83,6 +106,23 @@ main {
|
|||
grid-column: 2;
|
||||
grid-row: 1;
|
||||
overflow-x: hidden;
|
||||
h2.new {
|
||||
opacity: 0.8;
|
||||
}
|
||||
|
||||
.split {
|
||||
display: grid;
|
||||
column-gap: var(--gap);
|
||||
row-gap: var(--gap);
|
||||
grid-template-columns: 100%;
|
||||
@media (width > 720px) {
|
||||
grid-template-columns: max-content 1fr;
|
||||
}
|
||||
|
||||
& > section > :first-child {
|
||||
margin-top: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
nav {
|
||||
grid-column: 1;
|
||||
|
@ -95,38 +135,46 @@ nav {
|
|||
|
||||
background: var(--bg-01);
|
||||
line-height: 2rem;
|
||||
|
||||
h1 img {
|
||||
height: 1cap;
|
||||
}
|
||||
ul {
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
position: relative;
|
||||
}
|
||||
a {
|
||||
&.skip-link {
|
||||
font-weight: 300;
|
||||
|
||||
&:is(:active, :focus) {
|
||||
font-weight: 500;
|
||||
}
|
||||
}
|
||||
display: grid;
|
||||
grid-template-columns: 1fr max-content;
|
||||
align-items: baseline;
|
||||
|
||||
[class^="ri-"] {
|
||||
height: 1.5em;
|
||||
width: 1.5em;
|
||||
line-height: 1.5em;
|
||||
border-radius: var(--radius);
|
||||
}
|
||||
|
||||
&.cur {
|
||||
font-weight: 550;
|
||||
[class^="ri-"] {
|
||||
background: var(--text-link);
|
||||
color: var(--bg);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
nav h1 img {
|
||||
height: 1cap;
|
||||
}
|
||||
nav ul {
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
position: relative;
|
||||
}
|
||||
nav .skip-link {
|
||||
opacity: 0.8;
|
||||
font-weight: 300;
|
||||
}
|
||||
nav .skip-link:active,
|
||||
nav .skip-link:focus {
|
||||
opacity: initial;
|
||||
font-weight: 500;
|
||||
}
|
||||
nav a {
|
||||
display: block;
|
||||
}
|
||||
nav a.cur {
|
||||
font-weight: 550;
|
||||
}
|
||||
nav a.cur::after {
|
||||
content: "◎";
|
||||
position: absolute;
|
||||
right: 0;
|
||||
}
|
||||
nav > :first-child,
|
||||
main > :first-child {
|
||||
:is(nav, main) > :first-child,
|
||||
main > section:first-child > :first-child {
|
||||
margin-top: 0;
|
||||
}
|
||||
footer {
|
||||
|
@ -135,16 +183,46 @@ footer {
|
|||
font-weight: 250;
|
||||
}
|
||||
|
||||
#pagination {
|
||||
.pagination {
|
||||
text-align: center;
|
||||
font-feature-settings: var(--num);
|
||||
}
|
||||
#pagination a {
|
||||
width: 2rem;
|
||||
}
|
||||
#pagination a.cur {
|
||||
font-weight: 650;
|
||||
text-decoration: underline dotted;
|
||||
|
||||
a {
|
||||
min-width: 1rem;
|
||||
padding: 0 0.5rem;
|
||||
|
||||
&.cur {
|
||||
font-weight: 650;
|
||||
text-decoration: underline dotted;
|
||||
|
||||
&:is(:hover, :focus) {
|
||||
text-decoration: underline;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@media (width > 720px) {
|
||||
&.n3 {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, 1fr);
|
||||
width: max-content;
|
||||
margin: 0.5rem auto;
|
||||
|
||||
.prev {
|
||||
grid-column: 1;
|
||||
}
|
||||
.cur {
|
||||
grid-column: 2;
|
||||
}
|
||||
.next {
|
||||
grid-column: 3;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
& + section :first-child {
|
||||
margin-top: 0;
|
||||
}
|
||||
}
|
||||
|
||||
@media (width < 1024px) {
|
||||
|
@ -160,15 +238,34 @@ footer {
|
|||
height: initial;
|
||||
}
|
||||
}
|
||||
|
||||
a.big-link {
|
||||
margin-right: 1em;
|
||||
}
|
||||
a.big-link [class^="ri-"] {
|
||||
margin-right: 0.5em;
|
||||
}
|
||||
[class^="ri-"] {
|
||||
display: inline-block;
|
||||
text-align: center;
|
||||
font-weight: normal;
|
||||
|
||||
&.green,
|
||||
&.red,
|
||||
&.white {
|
||||
&.green {
|
||||
background: var(--green);
|
||||
color: var(--bg);
|
||||
}
|
||||
&.red {
|
||||
background: var(--red);
|
||||
color: var(--bg);
|
||||
}
|
||||
&.white {
|
||||
background: var(--bg-01);
|
||||
}
|
||||
border-radius: var(--radius);
|
||||
height: 1.5em;
|
||||
width: 1.5em;
|
||||
line-height: 1.5em;
|
||||
}
|
||||
|
||||
h2 & {
|
||||
margin-right: 0.5em;
|
||||
}
|
||||
}
|
||||
|
||||
h1,
|
||||
|
@ -188,9 +285,6 @@ h2 {
|
|||
h3 {
|
||||
font-size: 1.5rem;
|
||||
}
|
||||
main h2.new {
|
||||
opacity: 0.8;
|
||||
}
|
||||
p {
|
||||
margin: 0.5em 0;
|
||||
}
|
||||
|
@ -201,18 +295,42 @@ ul.messages {
|
|||
margin: 0;
|
||||
background: var(--bg-01);
|
||||
padding: 0;
|
||||
}
|
||||
ul.messages li {
|
||||
padding: calc(var(--gap) / 2) var(--gap);
|
||||
border-left: var(--border) solid var(--gray);
|
||||
|
||||
li {
|
||||
padding: calc(var(--gap) / 2) var(--gap);
|
||||
border-left: var(--border) solid var(--gray);
|
||||
|
||||
&.msg-level-25 {
|
||||
border-left-color: var(--green-1);
|
||||
}
|
||||
&.msg-level-30 {
|
||||
border-left-color: var(--red-1);
|
||||
}
|
||||
&.msg-level-40 {
|
||||
border-left-color: var(--red);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ul.messages li.msg-level-25 {
|
||||
border-left-color: var(--green-1);
|
||||
}
|
||||
ul.messages li.msg-level-30 {
|
||||
border-left-color: var(--red-1);
|
||||
}
|
||||
ul.messages li.msg-level-40 {
|
||||
border-left-color: var(--red);
|
||||
.backlinks {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, 1fr);
|
||||
|
||||
p {
|
||||
grid-column: 1;
|
||||
|
||||
&.back {
|
||||
grid-column: 2;
|
||||
text-align: right;
|
||||
|
||||
a {
|
||||
margin-right: 0;
|
||||
margin-left: 1em;
|
||||
[class^="ri-"] {
|
||||
margin-right: 0em;
|
||||
margin-left: 0.5em;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,76 +1,118 @@
|
|||
table.full-width col.bar {
|
||||
width: auto;
|
||||
}
|
||||
|
||||
.plot {
|
||||
overflow-x: auto;
|
||||
}
|
||||
|
||||
.plot td.bar {
|
||||
position: relative;
|
||||
padding: 0;
|
||||
}
|
||||
.plot td.bar div {
|
||||
position: absolute;
|
||||
height: 0.5rem;
|
||||
top: 0;
|
||||
}
|
||||
|
||||
.plot td.bar div:not(.tot) {
|
||||
width: 0;
|
||||
box-sizing: border-box;
|
||||
z-index: 1;
|
||||
display: inline-block;
|
||||
}
|
||||
.plot td.bar.p div {
|
||||
left: 0;
|
||||
border-radius: 0 var(--radius) var(--radius) 0;
|
||||
}
|
||||
.plot td.bar.m div {
|
||||
right: 0;
|
||||
border-radius: var(--radius) 0 0 var(--radius);
|
||||
}
|
||||
.plot td.bar.m div {
|
||||
background: var(--red-1);
|
||||
}
|
||||
.plot td.bar.p div {
|
||||
background: var(--green-1);
|
||||
}
|
||||
|
||||
.plot td.bar div.tot {
|
||||
z-index: 10;
|
||||
height: 0.5rem;
|
||||
}
|
||||
.plot td.bar.m div.tot {
|
||||
background: var(--red);
|
||||
}
|
||||
.plot td.bar.p div.tot {
|
||||
background: var(--green);
|
||||
}
|
||||
.plot td.bar div.tot span {
|
||||
position: absolute;
|
||||
display: inline-block;
|
||||
white-space: nowrap;
|
||||
margin: 0 var(--gap);
|
||||
font-weight: 650;
|
||||
top: 0.5rem;
|
||||
line-height: 1.5rem;
|
||||
height: 1.5rem;
|
||||
font-feature-settings: var(--num);
|
||||
}
|
||||
.plot td.bar.p div.tot span {
|
||||
left: 0;
|
||||
}
|
||||
.plot td.bar.m div.tot span {
|
||||
right: 0;
|
||||
}
|
||||
|
||||
@media (width < 720px) {
|
||||
.plot .bar {
|
||||
width: 0;
|
||||
td.bar {
|
||||
position: relative;
|
||||
padding: 0;
|
||||
overflow: hidden;
|
||||
@media (width < 720px) {
|
||||
width: 0;
|
||||
}
|
||||
|
||||
div {
|
||||
position: absolute;
|
||||
height: 0.5rem;
|
||||
top: 0;
|
||||
&:not(.tot) {
|
||||
width: 0;
|
||||
box-sizing: border-box;
|
||||
z-index: 1;
|
||||
display: inline-block;
|
||||
}
|
||||
&.tot {
|
||||
z-index: 10;
|
||||
height: 0.5rem;
|
||||
|
||||
span {
|
||||
position: absolute;
|
||||
display: inline-block;
|
||||
white-space: nowrap;
|
||||
margin: 0 var(--gap);
|
||||
font-weight: 650;
|
||||
top: 0.5rem;
|
||||
line-height: 1.5rem;
|
||||
height: 1.5rem;
|
||||
font-feature-settings: var(--num);
|
||||
}
|
||||
}
|
||||
}
|
||||
&.p div {
|
||||
left: 0;
|
||||
border-radius: 0 var(--radius) var(--radius) 0;
|
||||
background: var(--green-1);
|
||||
&.tot {
|
||||
background: var(--green);
|
||||
|
||||
span {
|
||||
left: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
&.m div {
|
||||
right: 0;
|
||||
border-radius: var(--radius) 0 0 var(--radius);
|
||||
background: var(--red-1);
|
||||
&.tot {
|
||||
background: var(--red);
|
||||
|
||||
span {
|
||||
right: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&.history tbody tr {
|
||||
background: initial;
|
||||
}
|
||||
tbody tr {
|
||||
&.empty {
|
||||
height: 0.5rem;
|
||||
}
|
||||
&.even {
|
||||
background: #eeeeff;
|
||||
}
|
||||
}
|
||||
|
||||
tfoot {
|
||||
background: var(--bg-01);
|
||||
}
|
||||
}
|
||||
|
||||
.plot tfoot {
|
||||
background: var(--bg-01);
|
||||
.calendar {
|
||||
overflow-x: auto;
|
||||
|
||||
margin-top: var(--gap);
|
||||
font-feature-settings: var(--num);
|
||||
|
||||
table {
|
||||
tbody tr {
|
||||
background: initial;
|
||||
&:not(:last-child) {
|
||||
border-bottom: none;
|
||||
}
|
||||
&:not(:first-child) {
|
||||
border-top: none;
|
||||
}
|
||||
|
||||
td {
|
||||
text-align: center;
|
||||
background-color: color-mix(
|
||||
in hsl,
|
||||
var(--td-bg, var(--bg)) var(--opacity),
|
||||
var(--bg)
|
||||
);
|
||||
&.p {
|
||||
--td-bg: var(--green);
|
||||
}
|
||||
&.m {
|
||||
--td-bg: var(--red);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,37 +1,52 @@
|
|||
.table,
|
||||
form {
|
||||
overflow-x: auto;
|
||||
width: 100%;
|
||||
}
|
||||
table {
|
||||
border-collapse: collapse;
|
||||
|
||||
&.full-width {
|
||||
width: 100%;
|
||||
|
||||
col {
|
||||
width: 8rem;
|
||||
}
|
||||
}
|
||||
col.icon {
|
||||
width: 1ch;
|
||||
}
|
||||
thead tr:not(.new) {
|
||||
background: var(--bg-01);
|
||||
}
|
||||
tr {
|
||||
border: 1px solid var(--gray);
|
||||
height: 2rem;
|
||||
line-height: 2rem;
|
||||
|
||||
tbody &:where(:nth-of-type(even)) {
|
||||
background: #eeeeff;
|
||||
}
|
||||
&.more,
|
||||
&.new {
|
||||
text-align: center;
|
||||
border-style: dashed;
|
||||
}
|
||||
}
|
||||
td,
|
||||
th {
|
||||
padding: 0 var(--gap);
|
||||
position: relative;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
&.empty {
|
||||
text-align: center;
|
||||
opacity: 0.8;
|
||||
font-weight: 300;
|
||||
}
|
||||
}
|
||||
}
|
||||
table.more tbody:last-child tr:last-child {
|
||||
border-bottom: 0.1rem dashed var(--gray);
|
||||
}
|
||||
table.full-width {
|
||||
width: 100%;
|
||||
}
|
||||
thead {
|
||||
background: var(--bg-01);
|
||||
}
|
||||
table.full-width col {
|
||||
width: 8rem;
|
||||
}
|
||||
table col.icon {
|
||||
width: 1ch;
|
||||
}
|
||||
tr {
|
||||
border: 0.1rem solid var(--gray);
|
||||
height: 2rem;
|
||||
line-height: 2rem;
|
||||
}
|
||||
td,
|
||||
th {
|
||||
padding: 0 var(--gap);
|
||||
position: relative;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.date,
|
||||
.value {
|
||||
font-feature-settings: var(--num);
|
||||
|
@ -47,8 +62,3 @@ th {
|
|||
.date {
|
||||
text-align: center;
|
||||
}
|
||||
td.empty {
|
||||
text-align: center;
|
||||
opacity: 0.8;
|
||||
font-weight: 300;
|
||||
}
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
{% load static %}
|
||||
{% load i18n %}
|
||||
{% load main_extras %}
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1" />
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<title>
|
||||
{% block title %}Nummi{% endblock %}
|
||||
</title>
|
||||
{% block link %}
|
||||
<link rel="icon" href="{% static "main/svg/logo.svg" %}" type="image/svg+xml" />
|
||||
<link rel="stylesheet" href="{% static "main/css/main.css" %}" type="text/css" />
|
||||
<link rel="stylesheet" href="{% static "main/remixicon/remixicon.css" %}" type="text/css" />
|
||||
<link rel="icon" href="{% static "main/svg/logo.svg" %}" type="image/svg+xml">
|
||||
{% css "main/css/main.css" %}
|
||||
{% endblock %}
|
||||
</head>
|
||||
<body>
|
||||
|
@ -19,7 +19,7 @@
|
|||
{% spaceless %}
|
||||
<nav>
|
||||
<h1>
|
||||
<img src="{% static "main/svg/logo.svg" %}" alt="" />
|
||||
<img src="{% static "main/svg/logo.svg" %}" alt="">
|
||||
Nummi
|
||||
</h1>
|
||||
<ul>
|
||||
|
@ -30,60 +30,52 @@
|
|||
<li>
|
||||
<a href="{% url "index" %}"
|
||||
class="home{% if request.resolver_match.url_name == "index" %} cur{% endif %}"
|
||||
accesskey="h">{% translate "Home" %}</a>
|
||||
accesskey="h">
|
||||
<span>{% translate "Home" %}</span>
|
||||
{{ "home"|remix }}
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{% url "statements" %}"
|
||||
class="{% if request.resolver_match.url_name == "statements" %}cur{% endif %}">
|
||||
{% translate "Statements" %}
|
||||
<span>{% translate "Statements" %}</span>
|
||||
{{ "file"|remix }}
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{% url "transactions" %}"
|
||||
class="{% if request.resolver_match.url_name == "transactions" %}cur{% endif %}">
|
||||
{% translate "Transactions" %}
|
||||
<span>{% translate "Transactions" %}</span>
|
||||
{{ "receipt"|remix }}
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{% url "new_account" %}"
|
||||
class="{% if request.resolver_match.url_name == "new_account" %}cur{% endif %}"
|
||||
accesskey="a">{% translate "Create account" %}</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{% url "new_statement" %}"
|
||||
class="{% if request.resolver_match.url_name == "new_statement" %}cur{% endif %}"
|
||||
accesskey="s">{% translate "Create statement" %}</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{% url "new_category" %}"
|
||||
class="{% if request.resolver_match.url_name == "new_category" %}cur{% endif %}"
|
||||
accesskey="c">{% translate "Create category" %}</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{% url "new_transaction" %}"
|
||||
class="{% if request.resolver_match.url_name == "new_transaction" %}cur{% endif %}"
|
||||
accesskey="t">{% translate "Create transaction" %}</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{% url "search" %}"
|
||||
class="{% if request.resolver_match.url_name == "search" %}cur{% endif %}"
|
||||
accesskey="r">{% translate "Search" %}</a>
|
||||
accesskey="r">
|
||||
<span>{% translate "Search" %}</span>
|
||||
{{ "search"|remix }}
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{% url "logout" %}" accesskey="l">{% translate "Log out" %}</a>
|
||||
{% blocktranslate %}Logged in as <strong>{{ user }}</strong>{% endblocktranslate %}
|
||||
</li>
|
||||
<li>
|
||||
<a href="{% url "logout" %}" accesskey="l">
|
||||
<span>{% translate "Log out" %}</span>
|
||||
{{ "close-circle"|remix }}
|
||||
</a>
|
||||
</li>
|
||||
{% else %}
|
||||
<li>
|
||||
<a {% if request.resolver_match.url_name == "login" %}class="cur"{% endif %}
|
||||
href="{% url "login" %}">{% translate "Log in" %}</a>
|
||||
href="{% url "login" %}">
|
||||
<span>{% translate "Log in" %}</span>
|
||||
{{ "user"|remix }}
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
{% if user.is_authenticated %}
|
||||
<p>
|
||||
{% blocktranslate %}Logged in as <strong>{{ user }}</strong>{% endblocktranslate %}
|
||||
</p>
|
||||
{% endif %}
|
||||
</nav>
|
||||
{% endspaceless %}
|
||||
{% endblock %}
|
||||
|
|
|
@ -4,12 +4,8 @@
|
|||
{% load i18n %}
|
||||
{% block link %}
|
||||
{{ block.super }}
|
||||
<link rel="stylesheet"
|
||||
href="{% static 'main/css/form.css' %}"
|
||||
type="text/css" />
|
||||
<link rel="stylesheet"
|
||||
href="{% static 'main/css/table.css' %}"
|
||||
type="text/css" />
|
||||
{% css "main/css/form.css" %}
|
||||
{% css "main/css/table.css" %}
|
||||
{% endblock %}
|
||||
{% block body %}
|
||||
{% spaceless %}
|
||||
|
|
|
@ -12,15 +12,9 @@
|
|||
{% endblock %}
|
||||
{% block link %}
|
||||
{{ block.super }}
|
||||
<link rel="stylesheet"
|
||||
href="{% static 'main/css/form.css' %}"
|
||||
type="text/css" />
|
||||
<link rel="stylesheet"
|
||||
href="{% static 'main/css/table.css' %}"
|
||||
type="text/css" />
|
||||
<link rel="stylesheet"
|
||||
href="{% static 'main/css/plot.css' %}"
|
||||
type="text/css" />
|
||||
{% css "main/css/form.css" %}
|
||||
{% css "main/css/table.css" %}
|
||||
{% css "main/css/plot.css" %}
|
||||
{% endblock %}
|
||||
{% block body %}
|
||||
{% with instance=form.instance %}
|
||||
|
@ -36,7 +30,7 @@
|
|||
{% block pre %}{% endblock %}
|
||||
<form method="post" enctype="multipart/form-data">
|
||||
{% csrf_token %}
|
||||
{% if instance|adding %}<input hidden name="next" value="{{ request.path }}" />{% endif %}
|
||||
{% if instance|adding %}<input hidden name="next" value="{{ request.path }}">{% endif %}
|
||||
{{ form }}
|
||||
</form>
|
||||
{% block tables %}{% endblock %}
|
||||
|
|
|
@ -29,11 +29,11 @@
|
|||
{% if not form.instance|adding %}
|
||||
<a class="del" href="{{ form.instance.get_delete_url }}">{% translate "Delete" %}</a>
|
||||
{% endif %}
|
||||
<input type="reset" value="{% translate "Reset" %}" />
|
||||
<input type="reset" value="{% translate "Reset" %}">
|
||||
{% if form.instance|adding %}
|
||||
<input type="submit" value="{% translate "Create" %}" />
|
||||
<input type="submit" value="{% translate "Create" %}">
|
||||
{% else %}
|
||||
<input type="submit" value="{% translate "Save" %}" />
|
||||
<input type="submit" value="{% translate "Save" %}">
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
</td>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{% extends "main/form/form_base.html" %}
|
||||
{% load i18n %}
|
||||
{% block buttons %}
|
||||
<input hidden value="{{ next }}" name="next" />
|
||||
<input type="reset" />
|
||||
<input type="submit" value="{% translate "Log in" %}" />
|
||||
<input hidden value="{{ next }}" name="next">
|
||||
<input type="reset">
|
||||
<input type="submit" value="{% translate "Log in" %}">
|
||||
{% endblock %}
|
||||
|
|
|
@ -4,44 +4,66 @@
|
|||
{% load i18n %}
|
||||
{% block link %}
|
||||
{{ block.super }}
|
||||
<link rel="stylesheet"
|
||||
href="{% static 'main/css/table.css' %}"
|
||||
type="text/css" />
|
||||
<link rel="stylesheet"
|
||||
href="{% static 'main/css/plot.css' %}"
|
||||
type="text/css" />
|
||||
{% css "main/css/table.css" %}
|
||||
{% css "main/css/plot.css" %}
|
||||
{% endblock %}
|
||||
{% block body %}
|
||||
<h2>{% translate "Accounts" %}</h2>
|
||||
<p>
|
||||
{% for acc in accounts %}
|
||||
<a class="big-link" href="{{ acc.get_absolute_url }}">{{ acc.icon|remix }}{{ acc }}</a>
|
||||
{% empty %}
|
||||
{% translate "No account" %}
|
||||
{% endfor %}
|
||||
</p>
|
||||
{% if transactions %}
|
||||
<h2>{% translate "Transactions" %}</h2>
|
||||
{% include "transaction/transaction_table.html" %}
|
||||
{% endif %}
|
||||
{% if categories %}
|
||||
<h2>{% translate "Categories" %}</h2>
|
||||
{% spaceless %}
|
||||
<p>
|
||||
{% for cat in categories %}
|
||||
<a class="big-link" href="{{ cat.get_absolute_url }}">{{ cat.icon|remix }}{{ cat }}</a>
|
||||
{% empty %}
|
||||
{% translate "No category" %}
|
||||
{% endfor %}
|
||||
</p>
|
||||
{% endspaceless %}
|
||||
{% endif %}
|
||||
{% if statements %}
|
||||
<h2>{% translate "Statements" %}</h2>
|
||||
{% include "statement/statement_table.html" %}
|
||||
{% endif %}
|
||||
{% if history.data %}
|
||||
<h2>{% translate "History" %}</h2>
|
||||
{% include "history/plot.html" %}
|
||||
<div class="split">
|
||||
<section class="accounts">
|
||||
<h2>{% translate "Accounts" %}</h2>
|
||||
<div class="table">
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="2">{% translate "Account" %}</th>
|
||||
<th>{% translate "Balance" %}</th>
|
||||
<th>{% translate "Edit" %}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for acc in accounts %}
|
||||
<tr>
|
||||
<td>{{ acc.icon|remix }}</td>
|
||||
<th class="l">
|
||||
<a href="{{ acc.get_absolute_url }}">{{ acc }}</a>
|
||||
</th>
|
||||
<td class="value">{{ acc.statement_set.first.value|value }}</td>
|
||||
<td>
|
||||
<a href="{% url "edit_account" acc.pk %}">{% translate "Edit" %}</a>
|
||||
</td>
|
||||
</tr>
|
||||
{% empty %}
|
||||
<tr>
|
||||
<td class="empty" colspan="4">{% translate "No account" %}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr class="new">
|
||||
<td colspan="4">
|
||||
<a href="{% url "new_account" %}">{% translate "Create account" %}</a>
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
</section>
|
||||
<section class="categories">
|
||||
<h2>{% translate "Categories" %}</h2>
|
||||
{% spaceless %}
|
||||
<p>
|
||||
{% for cat in categories %}
|
||||
<a class="big-link" href="{{ cat.get_absolute_url }}">{{ cat.icon|remix }}{{ cat }}</a>
|
||||
{% endfor %}
|
||||
<a class="big-link add" href="{% url "new_category" %}">{{ "add"|remix }}{% translate "Create category" %}</a>
|
||||
</p>
|
||||
{% endspaceless %}
|
||||
</section>
|
||||
</div>
|
||||
{% if history %}
|
||||
<section>
|
||||
<h2>{% translate "History" %}</h2>
|
||||
{% include "history/plot.html" %}
|
||||
</section>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
|
|
@ -13,28 +13,32 @@
|
|||
{% endblock %}
|
||||
{% block link %}
|
||||
{{ block.super }}
|
||||
<link rel="stylesheet"
|
||||
href="{% static 'main/css/table.css' %}"
|
||||
type="text/css" />
|
||||
{% css "main/css/table.css" %}
|
||||
{% endblock %}
|
||||
{% block body %}
|
||||
<h2>
|
||||
{% block h2 %}{% endblock %}
|
||||
</h2>
|
||||
{% if account %}
|
||||
<p>
|
||||
<a class="big-link" href="{{ account.get_absolute_url }}">{{ account.icon|remix }}{{ account }}</a>
|
||||
</p>
|
||||
{% endif %}
|
||||
{% if category %}
|
||||
<p>
|
||||
<a class="big-link" href="{{ category.get_absolute_url }}">{{ category.icon|remix }}{{ category }}</a>
|
||||
</p>
|
||||
{% endif %}
|
||||
{% if search %}
|
||||
<p>
|
||||
<a href="{% url "search" %}">{% translate "Search" %}</a>
|
||||
</p>
|
||||
{% if account or category or search %}
|
||||
<div class="backlinks">
|
||||
{% block backlinks %}
|
||||
{% if account %}
|
||||
<p>
|
||||
<a class="big-link" href="{{ account.get_absolute_url }}">{{ account.icon|remix }}{{ account }}</a>
|
||||
</p>
|
||||
{% endif %}
|
||||
{% if category %}
|
||||
<p>
|
||||
<a class="big-link" href="{{ category.get_absolute_url }}">{{ category.icon|remix }}{{ category }}</a>
|
||||
</p>
|
||||
{% endif %}
|
||||
{% if search %}
|
||||
<p>
|
||||
<a href="{% url "search" %}">{% translate "Search" %}</a>
|
||||
</p>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% include "main/pagination.html" %}
|
||||
{% block table %}{% endblock %}
|
||||
|
|
|
@ -1,14 +1,11 @@
|
|||
{% extends "main/base.html" %}
|
||||
{% load main_extras %}
|
||||
{% load static %}
|
||||
{% load i18n %}
|
||||
{% block link %}
|
||||
{{ block.super }}
|
||||
<link rel="stylesheet"
|
||||
href="{% static 'main/css/table.css' %}"
|
||||
type="text/css" />
|
||||
<link rel="stylesheet"
|
||||
href="{% static 'main/css/form.css' %}"
|
||||
type="text/css" />
|
||||
{% css "main/css/table.css" %}
|
||||
{% css "main/css/form.css" %}
|
||||
{% endblock %}
|
||||
{% block body %}
|
||||
<h2>{% translate "Log in" %}</h2>
|
||||
|
|
|
@ -1,9 +1,32 @@
|
|||
{% load i18n %}
|
||||
{% load i18n transaction_extras %}
|
||||
{% if page_obj %}
|
||||
<p id="pagination">
|
||||
<p class="pagination">
|
||||
{% for page in paginator.page_range %}
|
||||
<a href="?page={{ page }}"
|
||||
{% if page == page_obj.number %}class="cur"{% endif %}>{{ page }}</a>
|
||||
{% endfor %}
|
||||
</p>
|
||||
{% endif %}
|
||||
{% if month %}
|
||||
<p class="pagination">{% year_url month %}</p>
|
||||
<p class="pagination n3">
|
||||
{% if previous_month %}
|
||||
{% month_url previous_month fmt="F Y" %}
|
||||
{% endif %}
|
||||
{% month_url month cls="cur" fmt="F Y" %}
|
||||
{% if next_month %}
|
||||
{% month_url next_month fmt="F Y" %}
|
||||
{% endif %}
|
||||
</p>
|
||||
{% endif %}
|
||||
{% if year %}
|
||||
<p class="pagination n3">
|
||||
{% if previous_year %}
|
||||
{% year_url previous_year cls="prev" %}
|
||||
{% endif %}
|
||||
{% year_url year cls="cur" %}
|
||||
{% if next_year %}
|
||||
{% year_url next_year cls="next" %}
|
||||
{% endif %}
|
||||
</p>
|
||||
{% endif %}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
from django import template
|
||||
from django.templatetags.static import static
|
||||
from django.utils import formats
|
||||
from django.utils.safestring import mark_safe
|
||||
|
||||
|
@ -7,16 +8,16 @@ register = template.Library()
|
|||
|
||||
@register.filter
|
||||
def value(val, pm=False, r=2):
|
||||
if not val:
|
||||
if val is None:
|
||||
return ""
|
||||
_prefix = ""
|
||||
_suffix = " €"
|
||||
_val = formats.number_format(round(val, r), r, use_l10n=True, force_grouping=True)
|
||||
_val = formats.number_format(val, decimal_pos=r, use_l10n=True, force_grouping=True)
|
||||
|
||||
if val > 0:
|
||||
if pm:
|
||||
_prefix += "+ "
|
||||
else:
|
||||
elif val < 0:
|
||||
_val = _val[1:]
|
||||
_prefix += "− "
|
||||
|
||||
|
@ -38,14 +39,6 @@ def remix(icon, cls=""):
|
|||
return mark_safe(f"""<span class="ri-{icon}-line {cls}"></span>""")
|
||||
|
||||
|
||||
@register.filter
|
||||
def check(sum, diff):
|
||||
if sum == diff:
|
||||
return remix("check", "green")
|
||||
else:
|
||||
return remix("close", "red")
|
||||
|
||||
|
||||
@register.filter
|
||||
def extension(file):
|
||||
return file.name.split(".")[-1].upper()
|
||||
|
@ -59,3 +52,10 @@ def verbose_name(obj):
|
|||
@register.filter
|
||||
def adding(obj):
|
||||
return obj._state.adding
|
||||
|
||||
|
||||
@register.simple_tag
|
||||
def css(href):
|
||||
return mark_safe(
|
||||
f"""<link rel="stylesheet" href="{static(href)}" type="text/css">"""
|
||||
)
|
||||
|
|
|
@ -9,6 +9,7 @@ from django.utils.translation import gettext as _
|
|||
from django.views.generic import (
|
||||
CreateView,
|
||||
DeleteView,
|
||||
DetailView,
|
||||
ListView,
|
||||
TemplateView,
|
||||
UpdateView,
|
||||
|
@ -76,6 +77,10 @@ class NummiUpdateView(UserMixin, UpdateView):
|
|||
pass
|
||||
|
||||
|
||||
class NummiDetailView(UserMixin, DetailView):
|
||||
pass
|
||||
|
||||
|
||||
class NummiDeleteView(UserMixin, DeleteView):
|
||||
template_name = "main/confirm_delete.html"
|
||||
success_url = reverse_lazy("index")
|
||||
|
|
|
@ -7,7 +7,7 @@ msgid ""
|
|||
msgstr ""
|
||||
"Project-Id-Version: \n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2023-04-22 15:16+0200\n"
|
||||
"POT-Creation-Date: 2024-01-02 15:52+0100\n"
|
||||
"PO-Revision-Date: 2023-04-22 15:20+0200\n"
|
||||
"Last-Translator: Edgar P. Burkhart <traduction@edgarpierre.fr>\n"
|
||||
"Language-Team: \n"
|
||||
|
@ -18,7 +18,7 @@ msgstr ""
|
|||
"X-Generator: Poedit 3.2.2\n"
|
||||
|
||||
#: .\search\forms.py:7 .\search\templates\search\search.html:6
|
||||
#: .\search\templates\search\search.html:18
|
||||
#: .\search\templates\search\search.html:14
|
||||
#: .\search\templates\search\search_form.html:5
|
||||
msgid "Search"
|
||||
msgstr "Rechercher"
|
||||
|
|
|
@ -7,12 +7,8 @@
|
|||
{% endblock %}
|
||||
{% block link %}
|
||||
{{ block.super }}
|
||||
<link rel="stylesheet"
|
||||
href="{% static 'main/css/form.css' %}"
|
||||
type="text/css" />
|
||||
<link rel="stylesheet"
|
||||
href="{% static 'main/css/table.css' %}"
|
||||
type="text/css" />
|
||||
{% css "main/css/form.css" %}
|
||||
{% css "main/css/table.css" %}
|
||||
{% endblock %}
|
||||
{% block body %}
|
||||
<h2>{% translate "Search" %}</h2>
|
||||
|
|
|
@ -7,7 +7,7 @@ msgid ""
|
|||
msgstr ""
|
||||
"Project-Id-Version: \n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2023-11-25 12:05+0100\n"
|
||||
"POT-Creation-Date: 2024-01-03 15:51+0100\n"
|
||||
"PO-Revision-Date: 2023-04-22 15:22+0200\n"
|
||||
"Last-Translator: Edgar P. Burkhart <traduction@edgarpierre.fr>\n"
|
||||
"Language-Team: \n"
|
||||
|
@ -38,7 +38,7 @@ msgid "Start value"
|
|||
msgstr "Valeur initiale"
|
||||
|
||||
#: .\statement\models.py:29
|
||||
#: .\statement\templates\statement\statement_table.html:27
|
||||
#: .\statement\templates\statement\statement_table.html:30
|
||||
msgid "Difference"
|
||||
msgstr "Différence"
|
||||
|
||||
|
@ -66,7 +66,7 @@ msgid "Statements"
|
|||
msgstr "Relevés"
|
||||
|
||||
#: .\statement\templates\statement\statement_form.html:4
|
||||
#: .\statement\templates\statement\statement_table.html:5
|
||||
#: .\statement\templates\statement\statement_table.html:18
|
||||
msgid "Create statement"
|
||||
msgstr "Créer un relevé"
|
||||
|
||||
|
@ -74,32 +74,32 @@ msgstr "Créer un relevé"
|
|||
msgid "New statement"
|
||||
msgstr "Nouveau relevé"
|
||||
|
||||
#: .\statement\templates\statement\statement_form.html:22
|
||||
#: .\statement\templates\statement\statement_form.html:23
|
||||
msgid "Categories"
|
||||
msgstr "Catégories"
|
||||
|
||||
#: .\statement\templates\statement\statement_form.html:24
|
||||
#: .\statement\templates\statement\statement_table.html:28
|
||||
#: .\statement\templates\statement\statement_form.html:27
|
||||
#: .\statement\templates\statement\statement_table.html:31
|
||||
msgid "Transactions"
|
||||
msgstr "Transactions"
|
||||
|
||||
#: .\statement\templates\statement\statement_table.html:22
|
||||
#: .\statement\templates\statement\statement_table.html:25
|
||||
msgid "Date"
|
||||
msgstr "Date"
|
||||
|
||||
#: .\statement\templates\statement\statement_table.html:24
|
||||
#: .\statement\templates\statement\statement_table.html:27
|
||||
msgid "Account"
|
||||
msgstr "Compte"
|
||||
|
||||
#: .\statement\templates\statement\statement_table.html:26
|
||||
#: .\statement\templates\statement\statement_table.html:29
|
||||
msgid "Value"
|
||||
msgstr "Valeur"
|
||||
|
||||
#: .\statement\templates\statement\statement_table.html:56
|
||||
#: .\statement\templates\statement\statement_table.html:62
|
||||
msgid "No statement"
|
||||
msgstr "Aucun relevé"
|
||||
|
||||
#: .\statement\templates\statement\statement_table.html:64
|
||||
#: .\statement\templates\statement\statement_table.html:70
|
||||
msgid "View all statements"
|
||||
msgstr "Voir tous les relevés"
|
||||
|
||||
|
|
|
@ -1,15 +1,12 @@
|
|||
{% extends "main/form/base.html" %}
|
||||
{% load i18n main_extras category %}
|
||||
{% load i18n main_extras statement_extras category %}
|
||||
{% block title_new %}
|
||||
{% translate "Create statement" %}
|
||||
{% endblock %}
|
||||
{% block h2_new %}
|
||||
{% translate "New statement" %}
|
||||
{% endblock %}
|
||||
{% block h2 %}
|
||||
{{ form.instance.sum|check:form.instance.diff }}
|
||||
{{ form.instance }}
|
||||
{% endblock %}
|
||||
{% block h2 %}{{ form.instance }}{% endblock %}
|
||||
{% block pre %}
|
||||
{% if account %}
|
||||
<p>
|
||||
|
@ -19,9 +16,13 @@
|
|||
{% endblock %}
|
||||
{% block tables %}
|
||||
{% if not form.instance|adding %}
|
||||
<h3>{% translate "Categories" %}</h3>
|
||||
{% category_plot transactions %}
|
||||
<h3>{% translate "Transactions" %} ({{ form.instance.sum|pmvalue }} / {{ form.instance.diff|pmvalue }})</h3>
|
||||
{% include "transaction/transaction_table.html" %}
|
||||
<section>
|
||||
<h3>{% translate "Categories" %}</h3>
|
||||
{% category_plot transactions budget=False statement=object %}
|
||||
</section>
|
||||
<section>
|
||||
<h3>{% translate "Transactions" %}</h3>
|
||||
{% include "transaction/transaction_table.html" %}
|
||||
</section>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
|
|
@ -7,5 +7,6 @@
|
|||
{% translate "Statements" %}
|
||||
{% endblock %}
|
||||
{% block table %}
|
||||
{% url "new_statement" as new_statement_url %}
|
||||
{% include "statement/statement_table.html" %}
|
||||
{% endblock %}
|
||||
|
|
|
@ -1,10 +1,4 @@
|
|||
{% load main_extras %}
|
||||
{% load i18n %}
|
||||
{% if new_statement_url %}
|
||||
<p>
|
||||
<a href="{{ new_statement_url }}">{% translate "Create statement" %}</a>
|
||||
</p>
|
||||
{% endif %}
|
||||
{% load i18n main_extras statement_extras %}
|
||||
<div id="statements" class="table">
|
||||
<table class="full-width {% if statements_url %}more{% endif %}">
|
||||
<colgroup>
|
||||
|
@ -17,29 +11,36 @@
|
|||
<col class="value" span="3">
|
||||
</colgroup>
|
||||
<thead>
|
||||
<th>{{ "check"|remix }}</th>
|
||||
<th>{{ "attachment"|remix }}</th>
|
||||
<th>{% translate "Date" %}</th>
|
||||
{% if not account %}
|
||||
<th colspan="2">{% translate "Account" %}</th>
|
||||
{% if new_statement_url %}
|
||||
<tr class="new">
|
||||
<td colspan="{% if account %}6{% else %}8{% endif %}">
|
||||
<a href="{{ new_statement_url }}">{% translate "Create statement" %}</a>
|
||||
</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
<th>{% translate "Value" %}</th>
|
||||
<th>{% translate "Difference" %}</th>
|
||||
<th>{% translate "Transactions" %}</th>
|
||||
<tr>
|
||||
<th>{{ "check"|remix }}</th>
|
||||
<th>{{ "attachment"|remix }}</th>
|
||||
<th>{% translate "Date" %}</th>
|
||||
{% if not account %}
|
||||
<th colspan="2">{% translate "Account" %}</th>
|
||||
{% endif %}
|
||||
<th>{% translate "Value" %}</th>
|
||||
<th>{% translate "Difference" %}</th>
|
||||
<th>{% translate "Transactions" %}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for snap in statements %}
|
||||
<tr>
|
||||
{% if snap.sum == snap.diff %}
|
||||
<td class="c green">{{ "check"|remix }}</td>
|
||||
{% else %}
|
||||
<td class="c red">{{ "close"|remix }}</td>
|
||||
{% endif %}
|
||||
<td class="c">{{ snap.sum|check:snap.diff }}</td>
|
||||
<td class="c">
|
||||
{% if snap.file %}<a href="{{ snap.file.url }}">{{ "attachment"|remix }}</a>{% endif %}
|
||||
</td>
|
||||
<th class="date" scope="row">
|
||||
<a href="{{ snap.get_absolute_url }}">{{ snap.date|date:"Y-m-d" }}</a>
|
||||
<a href="{{ snap.get_absolute_url }}">
|
||||
<time datetime="{{ snap.date|date:"Y-m-d" }}">{{ snap.date|date:"Y-m-d" }}</time>
|
||||
</a>
|
||||
</th>
|
||||
{% if not account %}
|
||||
<td class="r">{{ snap.account.icon|remix }}</td>
|
||||
|
@ -57,10 +58,14 @@
|
|||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
{% if statements_url %}
|
||||
<tfoot>
|
||||
<tr class="more">
|
||||
<td colspan="{% if account %}6{% else %}8{% endif %}">
|
||||
<a href="{{ statements_url }}">{% translate "View all statements" %}</a>
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
{% endif %}
|
||||
</table>
|
||||
</div>
|
||||
{% if statements_url %}
|
||||
<p>
|
||||
<a href="{{ statements_url }}">{% translate "View all statements" %}</a>
|
||||
</p>
|
||||
{% endif %}
|
||||
|
|
14
nummi/statement/templatetags/statement_extras.py
Normal file
14
nummi/statement/templatetags/statement_extras.py
Normal file
|
@ -0,0 +1,14 @@
|
|||
from django import template
|
||||
from main.templatetags.main_extras import remix
|
||||
|
||||
register = template.Library()
|
||||
|
||||
|
||||
@register.filter
|
||||
def check(s, diff):
|
||||
if s is None:
|
||||
s = 0
|
||||
if s == diff:
|
||||
return remix("check", "green")
|
||||
else:
|
||||
return remix("close", "red")
|
Binary file not shown.
|
@ -7,7 +7,7 @@ msgid ""
|
|||
msgstr ""
|
||||
"Project-Id-Version: \n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2023-11-25 12:05+0100\n"
|
||||
"POT-Creation-Date: 2024-01-03 15:51+0100\n"
|
||||
"PO-Revision-Date: 2023-04-23 08:03+0200\n"
|
||||
"Last-Translator: Edgar P. Burkhart <traduction@edgarpierre.fr>\n"
|
||||
"Language-Team: \n"
|
||||
|
@ -22,8 +22,8 @@ msgid "Transaction"
|
|||
msgstr "Transaction"
|
||||
|
||||
#: .\transaction\models.py:19 .\transaction\models.py:89
|
||||
#: .\transaction\templates\transaction\invoice_table.html:9
|
||||
#: .\transaction\templates\transaction\transaction_table.html:28
|
||||
#: .\transaction\templates\transaction\invoice_table.html:10
|
||||
#: .\transaction\templates\transaction\transaction_table.html:32
|
||||
msgid "Name"
|
||||
msgstr "Nom"
|
||||
|
||||
|
@ -32,12 +32,11 @@ msgid "Description"
|
|||
msgstr "Description"
|
||||
|
||||
#: .\transaction\models.py:23
|
||||
#: .\transaction\templates\transaction\transaction_table.html:29
|
||||
msgid "Value"
|
||||
msgstr "Valeur"
|
||||
|
||||
#: .\transaction\models.py:25
|
||||
#: .\transaction\templates\transaction\transaction_table.html:27
|
||||
#: .\transaction\templates\transaction\transaction_table.html:31
|
||||
msgid "Date"
|
||||
msgstr "Date"
|
||||
|
||||
|
@ -46,7 +45,7 @@ msgid "Real date"
|
|||
msgstr "Date réelle"
|
||||
|
||||
#: .\transaction\models.py:28
|
||||
#: .\transaction\templates\transaction\transaction_table.html:30
|
||||
#: .\transaction\templates\transaction\transaction_table.html:35
|
||||
msgid "Trader"
|
||||
msgstr "Commerçant"
|
||||
|
||||
|
@ -55,7 +54,7 @@ msgid "Payment"
|
|||
msgstr "Paiement"
|
||||
|
||||
#: .\transaction\models.py:38
|
||||
#: .\transaction\templates\transaction\transaction_table.html:32
|
||||
#: .\transaction\templates\transaction\transaction_table.html:37
|
||||
msgid "Category"
|
||||
msgstr "Catégorie"
|
||||
|
||||
|
@ -64,12 +63,13 @@ msgid "Statement"
|
|||
msgstr "Relevé"
|
||||
|
||||
#: .\transaction\models.py:48
|
||||
#: .\transaction\templates\transaction\transaction_table.html:35
|
||||
#: .\transaction\templates\transaction\transaction_table.html:40
|
||||
msgid "Account"
|
||||
msgstr "Compte"
|
||||
|
||||
#: .\transaction\models.py:83
|
||||
#: .\transaction\templates\transaction\transaction_archive_month.html:11
|
||||
#: .\transaction\templates\transaction\transaction_archive_month.html:27
|
||||
#: .\transaction\templates\transaction\transaction_archive_year.html:31
|
||||
#: .\transaction\templates\transaction\transaction_list.html:4
|
||||
#: .\transaction\templates\transaction\transaction_list.html:7
|
||||
msgid "Transactions"
|
||||
|
@ -80,18 +80,18 @@ msgid "Invoice"
|
|||
msgstr "Facture"
|
||||
|
||||
#: .\transaction\models.py:94
|
||||
#: .\transaction\templates\transaction\invoice_table.html:10
|
||||
#: .\transaction\templates\transaction\invoice_table.html:20
|
||||
#: .\transaction\templates\transaction\invoice_table.html:11
|
||||
#: .\transaction\templates\transaction\invoice_table.html:22
|
||||
msgid "File"
|
||||
msgstr "Fichier"
|
||||
|
||||
#: .\transaction\models.py:123
|
||||
#: .\transaction\templates\transaction\transaction_form.html:19
|
||||
#: .\transaction\templates\transaction\transaction_form.html:20
|
||||
msgid "Invoices"
|
||||
msgstr "Factures"
|
||||
|
||||
#: .\transaction\templates\transaction\invoice_form.html:4
|
||||
#: .\transaction\templates\transaction\invoice_table.html:35
|
||||
#: .\transaction\templates\transaction\invoice_table.html:37
|
||||
msgid "Create invoice"
|
||||
msgstr "Créer une facture"
|
||||
|
||||
|
@ -99,21 +99,31 @@ msgstr "Créer une facture"
|
|||
msgid "New invoice"
|
||||
msgstr "Nouvelle facture"
|
||||
|
||||
#: .\transaction\templates\transaction\invoice_table.html:11
|
||||
#: .\transaction\templates\transaction\invoice_table.html:23
|
||||
#: .\transaction\templates\transaction\invoice_table.html:12
|
||||
#: .\transaction\templates\transaction\invoice_table.html:25
|
||||
msgid "Delete"
|
||||
msgstr "Supprimer"
|
||||
|
||||
#: .\transaction\templates\transaction\invoice_table.html:28
|
||||
#: .\transaction\templates\transaction\invoice_table.html:30
|
||||
msgid "No invoice"
|
||||
msgstr "Aucune facture"
|
||||
|
||||
#: .\transaction\templates\transaction\transaction_archive_month.html:14
|
||||
#: .\transaction\templates\transaction\transaction_archive_year.html:13
|
||||
msgid "Back"
|
||||
msgstr "Retour"
|
||||
|
||||
#: .\transaction\templates\transaction\transaction_archive_month.html:22
|
||||
#: .\transaction\templates\transaction\transaction_archive_year.html:26
|
||||
msgid "Categories"
|
||||
msgstr "Catégories"
|
||||
|
||||
#: .\transaction\templates\transaction\transaction_archive_year.html:20
|
||||
msgid "History"
|
||||
msgstr "Historique"
|
||||
|
||||
#: .\transaction\templates\transaction\transaction_form.html:5
|
||||
#: .\transaction\templates\transaction\transaction_table.html:5
|
||||
#: .\transaction\templates\transaction\transaction_table.html:25
|
||||
msgid "Create transaction"
|
||||
msgstr "Créer une transaction"
|
||||
|
||||
|
@ -121,10 +131,18 @@ msgstr "Créer une transaction"
|
|||
msgid "New transaction"
|
||||
msgstr "Nouvelle transaction"
|
||||
|
||||
#: .\transaction\templates\transaction\transaction_table.html:71
|
||||
#: .\transaction\templates\transaction\transaction_table.html:33
|
||||
msgid "Expenses"
|
||||
msgstr "Dépenses"
|
||||
|
||||
#: .\transaction\templates\transaction\transaction_table.html:34
|
||||
msgid "Income"
|
||||
msgstr "Recettes"
|
||||
|
||||
#: .\transaction\templates\transaction\transaction_table.html:87
|
||||
msgid "No transaction"
|
||||
msgstr "Aucune transaction"
|
||||
|
||||
#: .\transaction\templates\transaction\transaction_table.html:80
|
||||
#: .\transaction\templates\transaction\transaction_table.html:95
|
||||
msgid "View all transactions"
|
||||
msgstr "Voir toutes les transactions"
|
||||
|
|
|
@ -6,9 +6,11 @@
|
|||
<col class="desc" span="3">
|
||||
</colgroup>
|
||||
<thead>
|
||||
<th>{% translate "Name" %}</th>
|
||||
<th>{% translate "File" %}</th>
|
||||
<th>{% translate "Delete" %}</th>
|
||||
<tr>
|
||||
<th>{% translate "Name" %}</th>
|
||||
<th>{% translate "File" %}</th>
|
||||
<th>{% translate "Delete" %}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for invoice in transaction.invoices %}
|
||||
|
@ -20,21 +22,21 @@
|
|||
<a href="{{ invoice.file.url }}">{% translate "File" %} [{{ invoice.file|extension }}]</a>
|
||||
</td>
|
||||
<td>
|
||||
<a href="{{ invoice.get_delete_url }}">{% translate "Delete" %}
|
||||
</td>
|
||||
</tr>
|
||||
{% empty %}
|
||||
<tr>
|
||||
<td class="empty" colspan="3">{% translate "No invoice" %}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan="3">
|
||||
<a href="{% url "new_invoice" transaction.pk %}">{% translate "Create invoice" %}</a>
|
||||
<a href="{{ invoice.get_delete_url }}">{% translate "Delete" %}</a>
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
{% empty %}
|
||||
<tr>
|
||||
<td class="empty" colspan="3">{% translate "No invoice" %}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr class="more">
|
||||
<td colspan="3">
|
||||
<a href="{% url "new_invoice" transaction.pk %}">{% translate "Create invoice" %}</a>
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
|
|
|
@ -1,17 +1,28 @@
|
|||
{% extends "transaction/transaction_list.html" %}
|
||||
{% load i18n static category %}
|
||||
{% load i18n main_extras transaction_extras static category %}
|
||||
{% block link %}
|
||||
{{ block.super }}
|
||||
<link rel="stylesheet"
|
||||
href="{% static 'main/css/plot.css' %}"
|
||||
type="text/css" />
|
||||
{% css "main/css/plot.css" %}
|
||||
{% endblock %}
|
||||
{% block name %}{{ month|date:"F Y"|capfirst }}{% endblock %}
|
||||
{% block h2 %}{{ month|date:"F Y"|capfirst }}{% endblock %}
|
||||
{% block table %}
|
||||
<h3>{% translate "Transactions" %}</h3>
|
||||
{% block backlinks %}
|
||||
{{ block.super }}
|
||||
{% if not category %}
|
||||
<h3>{% translate "Categories" %}</h3>
|
||||
{% category_plot transactions month=month %}
|
||||
{% if account or category %}
|
||||
<p class="back">
|
||||
<a href="{% url "transaction_month" month.year month.month %}">{% translate "Back" %}{{ "arrow-go-back"|remix }}</a>
|
||||
</p>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
{% block table %}
|
||||
{% if not category %}
|
||||
<section>
|
||||
<h3>{% translate "Categories" %}</h3>
|
||||
{% category_plot transactions month=month %}
|
||||
</section>
|
||||
{% endif %}
|
||||
<section>
|
||||
<h3>{% translate "Transactions" %}</h3>
|
||||
{{ block.super }}
|
||||
</section>
|
||||
{% endblock %}
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
{% extends "transaction/transaction_list.html" %}
|
||||
{% load i18n main_extras static category %}
|
||||
{% block link %}
|
||||
{{ block.super }}
|
||||
{% css "main/css/plot.css" %}
|
||||
{% endblock %}
|
||||
{% block name %}{{ year|date:"Y" }}{% endblock %}
|
||||
{% block h2 %}{{ year|date:"Y" }}{% endblock %}
|
||||
{% block backlinks %}
|
||||
{{ block.super }}
|
||||
{% if account or category %}
|
||||
<p class="back">
|
||||
<a href="{% url "transaction_year" year.year %}">{% translate "Back" %}{{ "arrow-go-back"|remix }}</a>
|
||||
</p>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
{% block table %}
|
||||
{% if history %}
|
||||
<section>
|
||||
<h3>{% translate "History" %}</h3>
|
||||
{% include "history/plot.html" %}
|
||||
</section>
|
||||
{% endif %}
|
||||
{% if not category %}
|
||||
<section>
|
||||
<h3>{% translate "Categories" %}</h3>
|
||||
{% category_plot transactions year=year %}
|
||||
</section>
|
||||
{% endif %}
|
||||
<section>
|
||||
<h3>{% translate "Transactions" %}</h3>
|
||||
{{ block.super }}
|
||||
</section>
|
||||
{% endblock %}
|
|
@ -8,15 +8,17 @@
|
|||
{% translate "New transaction" %}
|
||||
{% endblock %}
|
||||
{% block pre %}
|
||||
{% if snapshot %}
|
||||
{% if statement %}
|
||||
<p>
|
||||
<a href="{{ snapshot.get_absolute_url }}">{{ snapshot }}</a>
|
||||
<a href="{{ statement.get_absolute_url }}">{{ statement }}</a>
|
||||
</p>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
{% block tables %}
|
||||
{% if not form.instance|adding %}
|
||||
<h3>{% translate "Invoices" %}</h3>
|
||||
{% include "transaction/invoice_table.html" %}
|
||||
<section>
|
||||
<h3>{% translate "Invoices" %}</h3>
|
||||
{% include "transaction/invoice_table.html" %}
|
||||
</section>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
|
|
@ -7,5 +7,6 @@
|
|||
{% translate "Transactions" %}
|
||||
{% endblock %}
|
||||
{% block table %}
|
||||
{% url "new_transaction" as new_transaction_url %}
|
||||
{% include "transaction/transaction_table.html" %}
|
||||
{% endblock %}
|
||||
|
|
|
@ -1,17 +1,13 @@
|
|||
{% load main_extras %}
|
||||
{% load main_extras transaction_extras %}
|
||||
{% load i18n %}
|
||||
{% if new_transaction_url %}
|
||||
<p>
|
||||
<a href="{{ new_transaction_url }}">{% translate "Create transaction" %}</a>
|
||||
</p>
|
||||
{% endif %}
|
||||
<div id="transactions" class="table">
|
||||
<table class="full-width {% if transactions_url %}more{% endif %}">
|
||||
<table class="full-width">
|
||||
<colgroup>
|
||||
<col class="icon">
|
||||
<col class="date">
|
||||
<col class="desc">
|
||||
<col class="value">
|
||||
<col class="value">
|
||||
<col class="desc">
|
||||
{% if not category %}
|
||||
<col class="icon">
|
||||
|
@ -23,17 +19,27 @@
|
|||
{% endif %}
|
||||
</colgroup>
|
||||
<thead>
|
||||
<th>{{ "attachment"|remix }}</th>
|
||||
<th>{% translate "Date" %}</th>
|
||||
<th>{% translate "Name" %}</th>
|
||||
<th>{% translate "Value" %}</th>
|
||||
<th>{% translate "Trader" %}</th>
|
||||
{% if not category %}
|
||||
<th colspan="2">{% translate "Category" %}</th>
|
||||
{% endif %}
|
||||
{% if not account %}
|
||||
<th colspan="2">{% translate "Account" %}</th>
|
||||
{% if new_transaction_url %}
|
||||
<tr class="new">
|
||||
<td colspan="{% tr_colspan %}">
|
||||
<a href="{{ new_transaction_url }}">{% translate "Create transaction" %}</a>
|
||||
</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
<tr>
|
||||
<th>{{ "attachment"|remix }}</th>
|
||||
<th>{% translate "Date" %}</th>
|
||||
<th>{% translate "Name" %}</th>
|
||||
<th>{% translate "Expenses" %}</th>
|
||||
<th>{% translate "Income" %}</th>
|
||||
<th>{% translate "Trader" %}</th>
|
||||
{% if not category %}
|
||||
<th colspan="2">{% translate "Category" %}</th>
|
||||
{% endif %}
|
||||
{% if not account %}
|
||||
<th colspan="2">{% translate "Account" %}</th>
|
||||
{% endif %}
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for trans in transactions %}
|
||||
|
@ -41,11 +47,23 @@
|
|||
<td class="c">
|
||||
{% for invoice in trans.invoices %}<a href="{{ invoice.file.url }}">{{ "attachment"|remix }}</a>{% endfor %}
|
||||
</td>
|
||||
<td class="date">{{ trans.date|date:"Y-m-d" }}</td>
|
||||
<td class="date">
|
||||
<time datetime="{{ trans.date|date:"Y-m-d" }}">
|
||||
{% if month %}
|
||||
{{ trans.date|date:"l d"|capfirst }}
|
||||
{% elif year %}
|
||||
{{ trans.date|date:"d F" }}
|
||||
{% else %}
|
||||
{{ trans.date|date:"Y-m-d" }}
|
||||
{% endif %}
|
||||
</time>
|
||||
</td>
|
||||
<th scope="row" class="l">
|
||||
<a href="{{ trans.get_absolute_url }}">{{ trans.name }}</a>
|
||||
</th>
|
||||
{% if trans.value >= 0 %}<td></td>{% endif %}
|
||||
<td class="value">{{ trans.value|pmvalue }}</td>
|
||||
{% if trans.value < 0 %}<td></td>{% endif %}
|
||||
<td>{{ trans.trader|default_if_none:"" }}</td>
|
||||
{% if not category %}
|
||||
{% if trans.category %}
|
||||
|
@ -66,17 +84,18 @@
|
|||
</tr>
|
||||
{% empty %}
|
||||
<tr>
|
||||
<td class="empty"
|
||||
colspan="{% if category and account %}5{% elif category or account %}7{% else %}9{% endif %}">
|
||||
{% translate "No transaction" %}
|
||||
</td>
|
||||
<td class="empty" colspan="{% tr_colspan %}">{% translate "No transaction" %}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
{% if transactions_url %}
|
||||
<tfoot>
|
||||
<tr class="more">
|
||||
<td colspan="{% tr_colspan %}">
|
||||
<a href="{{ transactions_url }}">{% translate "View all transactions" %}</a>
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
{% endif %}
|
||||
</table>
|
||||
</div>
|
||||
{% if transactions_url %}
|
||||
<p>
|
||||
<a href="{{ transactions_url }}">{% translate "View all transactions" %}</a>
|
||||
</p>
|
||||
{% endif %}
|
||||
|
|
46
nummi/transaction/templatetags/transaction_extras.py
Normal file
46
nummi/transaction/templatetags/transaction_extras.py
Normal file
|
@ -0,0 +1,46 @@
|
|||
import datetime
|
||||
|
||||
from django import template
|
||||
from django.template.defaultfilters import date
|
||||
from django.urls import reverse
|
||||
from django.utils.safestring import mark_safe
|
||||
|
||||
from ..utils import ac_url
|
||||
|
||||
register = template.Library()
|
||||
|
||||
|
||||
@register.simple_tag(takes_context=True)
|
||||
def month_url(context, month, cls="", fmt="Y-m"):
|
||||
url_name, url_params = ac_url(
|
||||
"transaction_month", {"year": month.year, "month": month.month}, context
|
||||
)
|
||||
|
||||
url = reverse(url_name, kwargs=url_params)
|
||||
return mark_safe(
|
||||
f"""<a class="{cls}" href="{url}"><time datetime="{date(month, "Y-m")}">"""
|
||||
f"""{date(month, fmt).capitalize()}</time></a>"""
|
||||
)
|
||||
|
||||
|
||||
@register.simple_tag(takes_context=True)
|
||||
def year_url(context, year, cls=""):
|
||||
if isinstance(year, datetime.date):
|
||||
year = year.year
|
||||
url_name, url_params = ac_url("transaction_year", {"year": year}, context)
|
||||
|
||||
url = reverse(url_name, kwargs=url_params)
|
||||
return mark_safe(
|
||||
f"""<a class="{cls}" href="{url}">"""
|
||||
f"""<time datetime="{year}">{year}</time></a>"""
|
||||
)
|
||||
|
||||
|
||||
@register.simple_tag(takes_context=True)
|
||||
def tr_colspan(context):
|
||||
ncol = 10
|
||||
if context.get("category"):
|
||||
ncol -= 2
|
||||
if context.get("account"):
|
||||
ncol -= 2
|
||||
return ncol
|
|
@ -4,6 +4,11 @@ from . import views
|
|||
|
||||
urlpatterns = [
|
||||
path("list", views.TransactionListView.as_view(), name="transactions"),
|
||||
path(
|
||||
"history/<int:year>",
|
||||
views.TransactionYearView.as_view(),
|
||||
name="transaction_year",
|
||||
),
|
||||
path(
|
||||
"history/<int:year>/<int:month>",
|
||||
views.TransactionMonthView.as_view(),
|
||||
|
|
9
nummi/transaction/utils.py
Normal file
9
nummi/transaction/utils.py
Normal file
|
@ -0,0 +1,9 @@
|
|||
def ac_url(url_name, url_params, context):
|
||||
if account := context.get("account"):
|
||||
url_name = "account_" + url_name
|
||||
url_params |= {"account": account.pk}
|
||||
elif category := context.get("category"):
|
||||
url_name = "category_" + url_name
|
||||
url_params |= {"category": category.pk}
|
||||
|
||||
return url_name, url_params
|
|
@ -2,7 +2,8 @@ from account.models import Account
|
|||
from category.models import Category
|
||||
from django.shortcuts import get_object_or_404
|
||||
from django.urls import reverse_lazy
|
||||
from django.views.generic.dates import MonthArchiveView
|
||||
from django.views.generic.dates import MonthArchiveView, YearArchiveView
|
||||
from history.utils import history
|
||||
from main.views import (
|
||||
NummiCreateView,
|
||||
NummiDeleteView,
|
||||
|
@ -109,11 +110,8 @@ class TransactionListView(NummiListView):
|
|||
context_object_name = "transactions"
|
||||
|
||||
|
||||
class TransactionMonthView(UserMixin, MonthArchiveView):
|
||||
class TransactionACMixin:
|
||||
model = Transaction
|
||||
date_field = "date"
|
||||
context_object_name = "transactions"
|
||||
month_format = "%m"
|
||||
|
||||
def get_queryset(self):
|
||||
if "account" in self.kwargs:
|
||||
|
@ -138,3 +136,25 @@ class TransactionMonthView(UserMixin, MonthArchiveView):
|
|||
if "account" in self.kwargs:
|
||||
return context_data | {"account": self.account}
|
||||
return context_data
|
||||
|
||||
|
||||
class TransactionMonthView(UserMixin, TransactionACMixin, MonthArchiveView):
|
||||
model = Transaction
|
||||
date_field = "date"
|
||||
context_object_name = "transactions"
|
||||
month_format = "%m"
|
||||
|
||||
|
||||
class TransactionYearView(UserMixin, TransactionACMixin, YearArchiveView):
|
||||
model = Transaction
|
||||
date_field = "date"
|
||||
context_object_name = "transactions"
|
||||
make_object_list = True
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context_data = super().get_context_data(**kwargs)
|
||||
h_data = context_data.get("transactions")
|
||||
if not (context_data.get("account") or context_data.get("category")):
|
||||
h_data = h_data.exclude(category__budget=False)
|
||||
|
||||
return context_data | {"history": history(h_data)}
|
||||
|
|
Loading…
Reference in a new issue