Compare commits

..

No commits in common. "218a6aca6f340fe4baf24486a0f7b0d7bf81b6f7" and "b0716a65b72838e8d7f56318727a4af93a68364b" have entirely different histories.

15 changed files with 74 additions and 151 deletions

View file

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-01-04 16:04+0100\n"
"POT-Creation-Date: 2024-01-02 15:52+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,22 +37,6 @@ msgstr "Défaut"
msgid "Accounts"
msgstr "Comptes"
#: .\account\templates\account\account_detail.html:15
msgid "Edit account"
msgstr "Modifier le compte"
#: .\account\templates\account\account_detail.html:17
msgid "Statements"
msgstr "Relevés"
#: .\account\templates\account\account_detail.html:21
msgid "Transactions"
msgstr "Transactions"
#: .\account\templates\account\account_detail.html:26
msgid "History"
msgstr "Historique"
#: .\account\templates\account\account_form.html:5
msgid "Create account"
msgstr "Créer un compte"
@ -60,3 +44,15 @@ msgstr "Créer un compte"
#: .\account\templates\account\account_form.html:8
msgid "New account"
msgstr "Nouveau compte"
#: .\account\templates\account\account_form.html:14
msgid "Statements"
msgstr "Relevés"
#: .\account\templates\account\account_form.html:18
msgid "Transactions"
msgstr "Transactions"
#: .\account\templates\account\account_form.html:23
msgid "History"
msgstr "Historique"

View file

@ -1,30 +0,0 @@
{% extends "main/base.html" %}
{% load main_extras %}
{% load i18n %}
{% block title %}{{ object }} {{ block.super }}{% endblock %}
{% block link %}
{{ block.super }}
{% css "main/css/form.css" %}
{% 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 %}

View file

@ -8,3 +8,21 @@
{% translate "New account" %}
{% endblock %}
{% block h2 %}{{ form.instance.icon|remix }}{{ form.instance }}{% endblock %}
{% block tables %}
{% if not form.instance|adding %}
<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 %}
{% endif %}
{% endblock %}

View file

@ -6,8 +6,7 @@ from . import views
urlpatterns = [
path("new", views.AccountCreateView.as_view(), name="new_account"),
path("<account>", views.AccountDetailView.as_view(), name="account"),
path("<account>/edit", views.AccountUpdateView.as_view(), name="edit_account"),
path("<account>", views.AccountUpdateView.as_view(), name="account"),
path(
"<account>/transactions",
views.AccountTListView.as_view(),

View file

@ -1,12 +1,7 @@
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,
NummiDetailView,
NummiUpdateView,
)
from main.views import NummiCreateView, NummiDeleteView, NummiUpdateView
from statement.views import StatementListView
from transaction.views import TransactionListView
@ -55,36 +50,6 @@ class AccountDeleteView(NummiDeleteView):
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.get("object")
_transactions = account.transaction_set.all()
if _transactions.count() > _max:
data["transactions_url"] = reverse_lazy(
"account_transactions", args=(account.pk,)
)
_statements = account.statement_set.all()
if _statements.count() > _max:
data["statements_url"] = reverse_lazy(
"account_statements", args=(account.pk,)
)
return data | {
"transactions": _transactions[:8],
"new_statement_url": reverse_lazy(
"new_statement", kwargs={"account": account.pk}
),
"statements": _statements[:8],
"history": history(account.transaction_set),
}
class AccountMixin:
def get_queryset(self):
self.account = get_object_or_404(

View file

@ -70,7 +70,7 @@
{% endif %}
{% if m %}
<td class="{% if m.sum > 0 %}p{% else %}m{% endif %}"
style="--opacity: {% calendar_opacity m.sum history.max.sum %}"
style="background-color: color-mix(in hsl, currentcolor {% calendar_opacity m.sum history.max.sum %}, white)"
title="{{ m.sum|pmrvalue }}">{% up_down_icon m.sum %}</td>
{% else %}
<td></td>

View file

@ -30,11 +30,11 @@ def empty_calendar_cells_end(n):
@register.simple_tag
def up_down_icon(val):
if val > 0:
return remix("arrow-up-s", "green")
return remix("arrow-up-s", "green w")
elif val < 0:
return remix("arrow-down-s", "red")
return remix("arrow-down-s", "red w")
return remix("equal", "white")
return ""
@register.simple_tag

View file

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-01-04 16:04+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"
@ -37,21 +37,37 @@ msgstr "Relevés"
msgid "Transactions"
msgstr "Transactions"
#: .\main\templates\main\base.html:51 .\main\templates\main\list.html:10
#: .\main\templates\main\base.html:51 .\main\templates\main\index.html:39
msgid "Create account"
msgstr "Créer un compte"
#: .\main\templates\main\base.html:56
msgid "Create statement"
msgstr "Créer un relevé"
#: .\main\templates\main\base.html:61
msgid "Create category"
msgstr "Créer une catégorie"
#: .\main\templates\main\base.html:66
msgid "Create transaction"
msgstr "Créer une transaction"
#: .\main\templates\main\base.html:71 .\main\templates\main\list.html:10
#: .\main\templates\main\list.html:34
msgid "Search"
msgstr "Rechercher"
#: .\main\templates\main\base.html:54
#: .\main\templates\main\base.html:74
msgid "Log out"
msgstr "Se déconnecter"
#: .\main\templates\main\base.html:59 .\main\templates\main\form\login.html:6
#: .\main\templates\main\base.html:79 .\main\templates\main\form\login.html:6
#: .\main\templates\main\login.html:11
msgid "Log in"
msgstr "Se connecter"
#: .\main\templates\main\base.html:65
#: .\main\templates\main\base.html:85
#, python-format
msgid "Logged in as <strong>%(user)s</strong>"
msgstr "Connecté en tant que <strong>%(user)s</strong>"
@ -101,39 +117,22 @@ msgstr "Compte"
msgid "Balance"
msgstr "Solde"
#: .\main\templates\main\index.html:19 .\main\templates\main\index.html:30
msgid "Edit"
msgstr "Modifier"
#: .\main\templates\main\index.html:34
#: .\main\templates\main\index.html:32
msgid "No account"
msgstr "Aucun compte"
#: .\main\templates\main\index.html:41
msgid "Create account"
msgstr "Créer un compte"
#: .\main\templates\main\index.html:48
#: .\main\templates\main\index.html:47
msgid "Categories"
msgstr "Catégories"
#: .\main\templates\main\index.html:54
msgid "Create category"
msgstr "Créer une catégorie"
#: .\main\templates\main\index.html:53
msgid "No category"
msgstr "Aucune catégorie"
#: .\main\templates\main\index.html:61
#: .\main\templates\main\index.html:62
msgid "History"
msgstr "Historique"
#: .\main\views.py:69
#: .\main\views.py:68
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"

View file

@ -9,7 +9,6 @@ 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;

View file

@ -232,27 +232,18 @@ footer {
font-weight: normal;
&.green,
&.red,
&.white {
&.red {
color: 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;
height: 1.5rem;
width: 1.5rem;
line-height: 1.5rem;
}
}

View file

@ -101,16 +101,11 @@ table.full-width col.bar {
td {
text-align: center;
background-color: color-mix(
in hsl,
var(--td-bg, var(--bg)) var(--opacity),
var(--bg)
);
&.p {
--td-bg: var(--green);
color: var(--green);
}
&.m {
--td-bg: var(--red);
color: var(--red);
}
}
}

View file

@ -16,7 +16,6 @@
<tr>
<th colspan="2">{% translate "Account" %}</th>
<th>{% translate "Balance" %}</th>
<th>{% translate "Edit" %}</th>
</tr>
</thead>
<tbody>
@ -27,19 +26,16 @@
<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>
<td class="empty" colspan="3">{% translate "No account" %}</td>
</tr>
{% endfor %}
</tbody>
<tfoot>
<tr class="new">
<td colspan="4">
<td colspan="3">
<a href="{% url "new_account" %}">{% translate "Create account" %}</a>
</td>
</tr>

View file

@ -9,7 +9,6 @@ from django.utils.translation import gettext as _
from django.views.generic import (
CreateView,
DeleteView,
DetailView,
ListView,
TemplateView,
UpdateView,
@ -77,10 +76,6 @@ 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")