Fix HTML for index page
This commit is contained in:
parent
8652eb0b57
commit
4bb682fc88
6 changed files with 64 additions and 48 deletions
|
@ -41,7 +41,9 @@
|
|||
</th>
|
||||
<td class="value">{{ date.sum_m|pmrvalue }}</td>
|
||||
<td class="bar m">
|
||||
{% 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">
|
||||
{% 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 }}
|
||||
|
|
|
@ -26,14 +26,13 @@ def history(transaction_set):
|
|||
has_transactions=Value(1),
|
||||
).order_by("-month")
|
||||
|
||||
return {
|
||||
"years": [
|
||||
_data = [
|
||||
{
|
||||
"y": y,
|
||||
"d": [
|
||||
_history.filter(month=datetime.date(y, m + 1, 1)).first()
|
||||
for m in range(
|
||||
0,
|
||||
_first_month.month if _first_month.year == y else 0,
|
||||
_last_month.month if _last_month.year == y else 12,
|
||||
)
|
||||
],
|
||||
|
@ -42,7 +41,11 @@ def history(transaction_set):
|
|||
_first_month.year,
|
||||
_last_month.year + 1,
|
||||
)
|
||||
],
|
||||
]
|
||||
|
||||
return {
|
||||
"years": _data,
|
||||
"offset": [range(_first_month.month), range(12 - _last_month.month)],
|
||||
"max": max(
|
||||
_history.aggregate(
|
||||
max=Max("sum_p", default=0),
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
<col class="value" span="3">
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{{ "check"|remix }}</th>
|
||||
<th>{{ "attachment"|remix }}</th>
|
||||
<th>{% translate "Date" %}</th>
|
||||
|
@ -26,6 +27,7 @@
|
|||
<th>{% translate "Value" %}</th>
|
||||
<th>{% translate "Difference" %}</th>
|
||||
<th>{% translate "Transactions" %}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for snap in statements %}
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
{% endif %}
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{{ "attachment"|remix }}</th>
|
||||
<th>{% translate "Date" %}</th>
|
||||
<th>{% translate "Name" %}</th>
|
||||
|
@ -34,6 +35,7 @@
|
|||
{% if not account %}
|
||||
<th colspan="2">{% translate "Account" %}</th>
|
||||
{% endif %}
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for trans in transactions %}
|
||||
|
|
Loading…
Reference in a new issue