Improved history page and spacing between values and currency suffix + minor improvements to css
This commit is contained in:
parent
8702233934
commit
ac59aa0baa
6 changed files with 30 additions and 25 deletions
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.db import connection
|
from django.db import connection
|
||||||
|
from django.utils.translation import gettext
|
||||||
|
|
||||||
|
|
||||||
COMBINE_ALPHABET = "abcdefghijklmnopqrstuvwxyz"
|
COMBINE_ALPHABET = "abcdefghijklmnopqrstuvwxyz"
|
||||||
|
@ -44,11 +45,13 @@ def select_history(user, language_code="en") -> list:
|
||||||
user_id = user.pk
|
user_id = user.pk
|
||||||
result = _db_select(f"""
|
result = _db_select(f"""
|
||||||
select
|
select
|
||||||
|
price_sum as "sum",
|
||||||
concat(
|
concat(
|
||||||
price_sum, '{settings.CURRENCY_SUFFIX} - ',
|
product_name,
|
||||||
product_name, ' (',
|
' (',
|
||||||
content_litres::real, -- converting to real removes trailing zeros
|
content_litres::real, -- converting to real removes trailing zeros
|
||||||
'l) x ', amount) as "text",
|
'l) x ', amount
|
||||||
|
) as "text",
|
||||||
datetime
|
datetime
|
||||||
from app_order
|
from app_order
|
||||||
where user_id = {user_id}
|
where user_id = {user_id}
|
||||||
|
@ -56,7 +59,8 @@ def select_history(user, language_code="en") -> list:
|
||||||
union
|
union
|
||||||
|
|
||||||
select
|
select
|
||||||
concat(transaction_sum, '{settings.CURRENCY_SUFFIX} - Deposit') as "text",
|
transaction_sum as "sum",
|
||||||
|
'{gettext("Deposit")}' as "text",
|
||||||
datetime
|
datetime
|
||||||
from app_userdeposits_view
|
from app_userdeposits_view
|
||||||
where user_id = {user_id}
|
where user_id = {user_id}
|
||||||
|
@ -64,7 +68,8 @@ def select_history(user, language_code="en") -> list:
|
||||||
union
|
union
|
||||||
|
|
||||||
select
|
select
|
||||||
concat(transaction_sum, '{settings.CURRENCY_SUFFIX} - ', comment) as "text",
|
transaction_sum as "sum",
|
||||||
|
comment as "text",
|
||||||
datetime
|
datetime
|
||||||
from app_registertransaction
|
from app_registertransaction
|
||||||
where user_id = {user_id} and is_transfer = true
|
where user_id = {user_id} and is_transfer = true
|
||||||
|
@ -73,9 +78,6 @@ def select_history(user, language_code="en") -> list:
|
||||||
fetch first 30 rows only;
|
fetch first 30 rows only;
|
||||||
""")
|
""")
|
||||||
result = [list(row) for row in result]
|
result = [list(row) for row in result]
|
||||||
if language_code == "de": # reformat for german translation
|
|
||||||
for row in result:
|
|
||||||
row[0] = row[0].replace(".", ",")
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -127,7 +127,6 @@ th {
|
||||||
|
|
||||||
.globalmessage > div {
|
.globalmessage > div {
|
||||||
width: 96%;
|
width: 96%;
|
||||||
text-align: center;
|
|
||||||
word-break: keep-all;
|
word-break: keep-all;
|
||||||
word-wrap: break-word;
|
word-wrap: break-word;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
|
@ -140,10 +139,6 @@ th {
|
||||||
gap: 1rem;
|
gap: 1rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.userinfo {
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.userinfo > span {
|
.userinfo > span {
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
}
|
}
|
||||||
|
@ -232,6 +227,14 @@ main {
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.text-align-right {
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
.text-align-center {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
.gap-1rem {
|
.gap-1rem {
|
||||||
gap: 1rem;
|
gap: 1rem;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{% if global_message != "" %}
|
{% if global_message != "" %}
|
||||||
<div class="flex flex-center globalmessage">
|
<div class="flex flex-center globalmessage text-align-center">
|
||||||
<div>{{ global_message }}</div>
|
<div>{{ global_message }}</div>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
|
@ -11,13 +11,13 @@
|
||||||
{% if history %}
|
{% if history %}
|
||||||
<table class="history">
|
<table class="history">
|
||||||
<tr>
|
<tr>
|
||||||
<th>{% translate "last 30 actions" %}</th>
|
<th colspan="3">{% translate "last 30 actions" %}</th>
|
||||||
<th></th>
|
|
||||||
</tr>
|
</tr>
|
||||||
{% for h in history %}
|
{% for h in history %}
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{ h.0 }}</td>
|
<td class="text-align-right">{{ h.0 }} {{ currency_suffix }}</td>
|
||||||
<td class="historydate">{{ h.1 }}</td>
|
<td>{{ h.1 }}</td>
|
||||||
|
<td>{{ h.2 }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</table>
|
</table>
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
{% load static %}
|
{% load static %}
|
||||||
|
|
||||||
<div class="flex flex-center userpanel">
|
<div class="flex flex-center userpanel">
|
||||||
<div class="userinfo">
|
<div class="userinfo text-align-center">
|
||||||
<img src="/profilepictures/{{ user.profile_picture_filename|urlencode }}"><span>{% if user.first_name != "" %}
|
<img src="/profilepictures/{{ user.profile_picture_filename|urlencode }}"><span>{% if user.first_name != "" %}
|
||||||
{{ user.first_name }} {{ user.last_name }} ({{ user.username }}){% else %}{{ user.username }}{% endif %}
|
{{ user.first_name }} {{ user.last_name }} ({{ user.username }}){% else %}{{ user.username }}{% endif %}
|
||||||
-
|
-
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue