Fix HTML for index page

This commit is contained in:
Edgar P. Burkhart 2023-12-29 09:50:08 +01:00
parent 8652eb0b57
commit 4bb682fc88
Signed by: edpibu
GPG Key ID: 9833D3C5A25BD227
6 changed files with 64 additions and 48 deletions

View File

@ -41,7 +41,9 @@
</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_m %}
<div style="width: {% widthratio date.sum_m history.max -100 %}%"></div>
{% endif %}
{% if date.sum < 0 %}
<div class="tot" style="width:{% widthratio date.sum history.max -100 %}%">
<span>{{ date.sum|pmrvalue }}</span>
@ -49,7 +51,9 @@
{% endif %}
</td>
<td class="bar p">
<div style="width: {% widthratio date.sum_p history.max 100 %}%"></div>
{% if date.sum_p %}
<div style="width: {% widthratio date.sum_p history.max 100 %}%"></div>
{% endif %}
{% if date.sum > 0 %}
<div class="tot" style="width:{% widthratio date.sum history.max 100 %}%">
<span>{{ date.sum|pmrvalue }}</span>
@ -60,7 +64,7 @@
</tr>
{% else %}
<tr class="empty">
<td colspan="5" class="empty"></td>
<td colspan="6" class="empty"></td>
</tr>
{% endif %}
{% endfor %}
@ -94,6 +98,9 @@
<tr>
<th>{{ year.y }}</th>
{% for m in year.d %}
{% if forloop.parentloop.last and forloop.first %}
{% for _ in history.offset.0 %}<td></td>{% endfor %}
{% endif %}
{% if m %}
<td class="{% if m.sum > 0 %}p{% else %}m{% endif %}"
style="opacity: calc( sin( abs({% widthratio m.sum history.years_max 100 %}) / 400 * 1turn ) )">
@ -101,6 +108,9 @@
{% else %}
<td></td>
{% endif %}
{% if forloop.parentloop.first and forloop.last %}
{% for _ in history.offset.1 %}<td></td>{% endfor %}
{% endif %}
{% endfor %}
</tr>
{% endfor %}
@ -108,4 +118,3 @@
</tbody>
</table>
</div>
{{ history.years|json_script }}

View File

@ -26,23 +26,26 @@ def history(transaction_set):
has_transactions=Value(1),
).order_by("-month")
_data = [
{
"y": y,
"d": [
_history.filter(month=datetime.date(y, m + 1, 1)).first()
for m in range(
_first_month.month if _first_month.year == y else 0,
_last_month.month if _last_month.year == y else 12,
)
],
}
for y in range(
_first_month.year,
_last_month.year + 1,
)
]
return {
"years": [
{
"y": y,
"d": [
_history.filter(month=datetime.date(y, m + 1, 1)).first()
for m in range(
0,
_last_month.month if _last_month.year == y else 12,
)
],
}
for y in range(
_first_month.year,
_last_month.year + 1,
)
],
"years": _data,
"offset": [range(_first_month.month), range(12 - _last_month.month)],
"max": max(
_history.aggregate(
max=Max("sum_p", default=0),

View File

@ -3,15 +3,15 @@
<!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">
<link rel="stylesheet" href="{% static "main/css/main.css" %}" type="text/css">
<link rel="stylesheet" href="{% static "main/remixicon/remixicon.css" %}" type="text/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>

View File

@ -6,10 +6,10 @@
{{ block.super }}
<link rel="stylesheet"
href="{% static 'main/css/table.css' %}"
type="text/css" />
type="text/css">
<link rel="stylesheet"
href="{% static 'main/css/plot.css' %}"
type="text/css" />
type="text/css">
{% endblock %}
{% block body %}
<h2>{% translate "Accounts" %}</h2>

View File

@ -17,15 +17,17 @@
<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>
{% 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 %}

View File

@ -23,17 +23,19 @@
{% 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>
{% endif %}
<tr>
<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>
{% endif %}
</tr>
</thead>
<tbody>
{% for trans in transactions %}