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.db import connection
|
||||
from django.utils.translation import gettext
|
||||
|
||||
|
||||
COMBINE_ALPHABET = "abcdefghijklmnopqrstuvwxyz"
|
||||
|
@ -44,11 +45,13 @@ def select_history(user, language_code="en") -> list:
|
|||
user_id = user.pk
|
||||
result = _db_select(f"""
|
||||
select
|
||||
price_sum as "sum",
|
||||
concat(
|
||||
price_sum, '{settings.CURRENCY_SUFFIX} - ',
|
||||
product_name, ' (',
|
||||
product_name,
|
||||
' (',
|
||||
content_litres::real, -- converting to real removes trailing zeros
|
||||
'l) x ', amount) as "text",
|
||||
'l) x ', amount
|
||||
) as "text",
|
||||
datetime
|
||||
from app_order
|
||||
where user_id = {user_id}
|
||||
|
@ -56,7 +59,8 @@ def select_history(user, language_code="en") -> list:
|
|||
union
|
||||
|
||||
select
|
||||
concat(transaction_sum, '{settings.CURRENCY_SUFFIX} - Deposit') as "text",
|
||||
transaction_sum as "sum",
|
||||
'{gettext("Deposit")}' as "text",
|
||||
datetime
|
||||
from app_userdeposits_view
|
||||
where user_id = {user_id}
|
||||
|
@ -64,7 +68,8 @@ def select_history(user, language_code="en") -> list:
|
|||
union
|
||||
|
||||
select
|
||||
concat(transaction_sum, '{settings.CURRENCY_SUFFIX} - ', comment) as "text",
|
||||
transaction_sum as "sum",
|
||||
comment as "text",
|
||||
datetime
|
||||
from app_registertransaction
|
||||
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;
|
||||
""")
|
||||
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
|
||||
|
||||
|
||||
|
|
|
@ -127,7 +127,6 @@ th {
|
|||
|
||||
.globalmessage > div {
|
||||
width: 96%;
|
||||
text-align: center;
|
||||
word-break: keep-all;
|
||||
word-wrap: break-word;
|
||||
box-sizing: border-box;
|
||||
|
@ -140,10 +139,6 @@ th {
|
|||
gap: 1rem;
|
||||
}
|
||||
|
||||
.userinfo {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.userinfo > span {
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
@ -232,6 +227,14 @@ main {
|
|||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.text-align-right {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.text-align-center {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.gap-1rem {
|
||||
gap: 1rem;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{% if global_message != "" %}
|
||||
<div class="flex flex-center globalmessage">
|
||||
<div class="flex flex-center globalmessage text-align-center">
|
||||
<div>{{ global_message }}</div>
|
||||
</div>
|
||||
{% endif %}
|
|
@ -11,13 +11,13 @@
|
|||
{% if history %}
|
||||
<table class="history">
|
||||
<tr>
|
||||
<th>{% translate "last 30 actions" %}</th>
|
||||
<th></th>
|
||||
<th colspan="3">{% translate "last 30 actions" %}</th>
|
||||
</tr>
|
||||
{% for h in history %}
|
||||
<tr>
|
||||
<td>{{ h.0 }}</td>
|
||||
<td class="historydate">{{ h.1 }}</td>
|
||||
<td class="text-align-right">{{ h.0 }} {{ currency_suffix }}</td>
|
||||
<td>{{ h.1 }}</td>
|
||||
<td>{{ h.2 }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
{% load static %}
|
||||
|
||||
<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 != "" %}
|
||||
{{ user.first_name }} {{ user.last_name }} ({{ user.username }}){% else %}{{ user.username }}{% endif %}
|
||||
-
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue