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>
|
</th>
|
||||||
<td class="value">{{ date.sum_m|pmrvalue }}</td>
|
<td class="value">{{ date.sum_m|pmrvalue }}</td>
|
||||||
<td class="bar m">
|
<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 %}
|
{% if date.sum < 0 %}
|
||||||
<div class="tot" style="width:{% widthratio date.sum history.max -100 %}%">
|
<div class="tot" style="width:{% widthratio date.sum history.max -100 %}%">
|
||||||
<span>{{ date.sum|pmrvalue }}</span>
|
<span>{{ date.sum|pmrvalue }}</span>
|
||||||
|
@ -49,7 +51,9 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
<td class="bar p">
|
<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 %}
|
{% if date.sum > 0 %}
|
||||||
<div class="tot" style="width:{% widthratio date.sum history.max 100 %}%">
|
<div class="tot" style="width:{% widthratio date.sum history.max 100 %}%">
|
||||||
<span>{{ date.sum|pmrvalue }}</span>
|
<span>{{ date.sum|pmrvalue }}</span>
|
||||||
|
@ -60,7 +64,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
{% else %}
|
{% else %}
|
||||||
<tr class="empty">
|
<tr class="empty">
|
||||||
<td colspan="5" class="empty"></td>
|
<td colspan="6" class="empty"></td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
@ -94,6 +98,9 @@
|
||||||
<tr>
|
<tr>
|
||||||
<th>{{ year.y }}</th>
|
<th>{{ year.y }}</th>
|
||||||
{% for m in year.d %}
|
{% for m in year.d %}
|
||||||
|
{% if forloop.parentloop.last and forloop.first %}
|
||||||
|
{% for _ in history.offset.0 %}<td></td>{% endfor %}
|
||||||
|
{% endif %}
|
||||||
{% if m %}
|
{% if m %}
|
||||||
<td class="{% if m.sum > 0 %}p{% else %}m{% endif %}"
|
<td class="{% if m.sum > 0 %}p{% else %}m{% endif %}"
|
||||||
style="opacity: calc( sin( abs({% widthratio m.sum history.years_max 100 %}) / 400 * 1turn ) )">
|
style="opacity: calc( sin( abs({% widthratio m.sum history.years_max 100 %}) / 400 * 1turn ) )">
|
||||||
|
@ -101,6 +108,9 @@
|
||||||
{% else %}
|
{% else %}
|
||||||
<td></td>
|
<td></td>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% if forloop.parentloop.first and forloop.last %}
|
||||||
|
{% for _ in history.offset.1 %}<td></td>{% endfor %}
|
||||||
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
@ -108,4 +118,3 @@
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
{{ history.years|json_script }}
|
|
||||||
|
|
|
@ -26,23 +26,26 @@ def history(transaction_set):
|
||||||
has_transactions=Value(1),
|
has_transactions=Value(1),
|
||||||
).order_by("-month")
|
).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 {
|
return {
|
||||||
"years": [
|
"years": _data,
|
||||||
{
|
"offset": [range(_first_month.month), range(12 - _last_month.month)],
|
||||||
"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,
|
|
||||||
)
|
|
||||||
],
|
|
||||||
"max": max(
|
"max": max(
|
||||||
_history.aggregate(
|
_history.aggregate(
|
||||||
max=Max("sum_p", default=0),
|
max=Max("sum_p", default=0),
|
||||||
|
|
|
@ -3,15 +3,15 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="fr">
|
<html lang="fr">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8" />
|
<meta charset="utf-8">
|
||||||
<meta name="viewport" content="width=device-width,initial-scale=1" />
|
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||||
<title>
|
<title>
|
||||||
{% block title %}Nummi{% endblock %}
|
{% block title %}Nummi{% endblock %}
|
||||||
</title>
|
</title>
|
||||||
{% block link %}
|
{% block link %}
|
||||||
<link rel="icon" href="{% static "main/svg/logo.svg" %}" type="image/svg+xml" />
|
<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/css/main.css" %}" type="text/css">
|
||||||
<link rel="stylesheet" href="{% static "main/remixicon/remixicon.css" %}" type="text/css" />
|
<link rel="stylesheet" href="{% static "main/remixicon/remixicon.css" %}" type="text/css">
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
@ -19,7 +19,7 @@
|
||||||
{% spaceless %}
|
{% spaceless %}
|
||||||
<nav>
|
<nav>
|
||||||
<h1>
|
<h1>
|
||||||
<img src="{% static "main/svg/logo.svg" %}" alt="" />
|
<img src="{% static "main/svg/logo.svg" %}" alt="">
|
||||||
Nummi
|
Nummi
|
||||||
</h1>
|
</h1>
|
||||||
<ul>
|
<ul>
|
||||||
|
|
|
@ -6,10 +6,10 @@
|
||||||
{{ block.super }}
|
{{ block.super }}
|
||||||
<link rel="stylesheet"
|
<link rel="stylesheet"
|
||||||
href="{% static 'main/css/table.css' %}"
|
href="{% static 'main/css/table.css' %}"
|
||||||
type="text/css" />
|
type="text/css">
|
||||||
<link rel="stylesheet"
|
<link rel="stylesheet"
|
||||||
href="{% static 'main/css/plot.css' %}"
|
href="{% static 'main/css/plot.css' %}"
|
||||||
type="text/css" />
|
type="text/css">
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block body %}
|
{% block body %}
|
||||||
<h2>{% translate "Accounts" %}</h2>
|
<h2>{% translate "Accounts" %}</h2>
|
||||||
|
|
|
@ -17,15 +17,17 @@
|
||||||
<col class="value" span="3">
|
<col class="value" span="3">
|
||||||
</colgroup>
|
</colgroup>
|
||||||
<thead>
|
<thead>
|
||||||
<th>{{ "check"|remix }}</th>
|
<tr>
|
||||||
<th>{{ "attachment"|remix }}</th>
|
<th>{{ "check"|remix }}</th>
|
||||||
<th>{% translate "Date" %}</th>
|
<th>{{ "attachment"|remix }}</th>
|
||||||
{% if not account %}
|
<th>{% translate "Date" %}</th>
|
||||||
<th colspan="2">{% translate "Account" %}</th>
|
{% if not account %}
|
||||||
{% endif %}
|
<th colspan="2">{% translate "Account" %}</th>
|
||||||
<th>{% translate "Value" %}</th>
|
{% endif %}
|
||||||
<th>{% translate "Difference" %}</th>
|
<th>{% translate "Value" %}</th>
|
||||||
<th>{% translate "Transactions" %}</th>
|
<th>{% translate "Difference" %}</th>
|
||||||
|
<th>{% translate "Transactions" %}</th>
|
||||||
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{% for snap in statements %}
|
{% for snap in statements %}
|
||||||
|
|
|
@ -23,17 +23,19 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</colgroup>
|
</colgroup>
|
||||||
<thead>
|
<thead>
|
||||||
<th>{{ "attachment"|remix }}</th>
|
<tr>
|
||||||
<th>{% translate "Date" %}</th>
|
<th>{{ "attachment"|remix }}</th>
|
||||||
<th>{% translate "Name" %}</th>
|
<th>{% translate "Date" %}</th>
|
||||||
<th>{% translate "Value" %}</th>
|
<th>{% translate "Name" %}</th>
|
||||||
<th>{% translate "Trader" %}</th>
|
<th>{% translate "Value" %}</th>
|
||||||
{% if not category %}
|
<th>{% translate "Trader" %}</th>
|
||||||
<th colspan="2">{% translate "Category" %}</th>
|
{% if not category %}
|
||||||
{% endif %}
|
<th colspan="2">{% translate "Category" %}</th>
|
||||||
{% if not account %}
|
{% endif %}
|
||||||
<th colspan="2">{% translate "Account" %}</th>
|
{% if not account %}
|
||||||
{% endif %}
|
<th colspan="2">{% translate "Account" %}</th>
|
||||||
|
{% endif %}
|
||||||
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{% for trans in transactions %}
|
{% for trans in transactions %}
|
||||||
|
|
Loading…
Reference in a new issue