commit
b6b058f346
14 changed files with 101 additions and 36 deletions
|
@ -45,10 +45,13 @@ class CustomUserAdmin(UserAdmin):
|
||||||
|
|
||||||
fieldsets_ = list((*UserAdmin.fieldsets,))
|
fieldsets_ = list((*UserAdmin.fieldsets,))
|
||||||
fieldsets_.insert(1, (
|
fieldsets_.insert(1, (
|
||||||
"Balance",
|
"Balance",
|
||||||
{"fields": ("balance", "allow_order_with_negative_balance")},
|
{"fields": ("balance", "allow_order_with_negative_balance")},
|
||||||
)
|
))
|
||||||
)
|
fieldsets_.insert(2, (
|
||||||
|
"Profile Picture",
|
||||||
|
{"fields": ("profile_picture_filename",)},
|
||||||
|
))
|
||||||
fieldsets = tuple(fieldsets_)
|
fieldsets = tuple(fieldsets_)
|
||||||
|
|
||||||
list_display = ["username", "balance", "is_active", "allow_order_with_negative_balance"]
|
list_display = ["username", "balance", "is_active", "allow_order_with_negative_balance"]
|
||||||
|
|
|
@ -20,6 +20,7 @@ class User(AbstractUser):
|
||||||
|
|
||||||
balance = models.DecimalField(max_digits=8, decimal_places=2, default=0.00)
|
balance = models.DecimalField(max_digits=8, decimal_places=2, default=0.00)
|
||||||
allow_order_with_negative_balance = models.BooleanField(default=False)
|
allow_order_with_negative_balance = models.BooleanField(default=False)
|
||||||
|
profile_picture_filename = models.CharField(default="default.svg", max_length=25)
|
||||||
|
|
||||||
def delete(self, *args, **kwargs):
|
def delete(self, *args, **kwargs):
|
||||||
self.balance = 0
|
self.balance = 0
|
||||||
|
|
|
@ -35,5 +35,6 @@
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<script src="/static/js/deposit.js"></script>
|
<script src="/static/js/deposit.js"></script>
|
||||||
|
<script src="/static/js/autoreload.js"></script>
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -33,4 +33,6 @@
|
||||||
{% translate "No history." %}
|
{% translate "No history." %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
<script src="/static/js/autoreload.js"></script>
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -44,4 +44,6 @@
|
||||||
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
<script src="/static/js/autoreload.js"></script>
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -97,4 +97,6 @@
|
||||||
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
<script src="/static/js/autoreload.js"></script>
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
{% extends "baseLayout.html" %}
|
{% extends "baseLayout.html" %}
|
||||||
|
|
||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
|
{% load static %}
|
||||||
|
|
||||||
{% block title %}
|
{% block title %}
|
||||||
{% translate "Drinks - Login" %}
|
{% translate "Drinks - Login" %}
|
||||||
|
@ -68,19 +69,20 @@
|
||||||
<ul class="userlist">
|
<ul class="userlist">
|
||||||
{% for user_ in user_list %}
|
{% for user_ in user_list %}
|
||||||
<li class="userlistButton button" data-username="{{ user_.username }}">
|
<li class="userlistButton button" data-username="{{ user_.username }}">
|
||||||
|
<img src="{% static 'profilepictures/'|add:user_.profile_picture_filename %}">
|
||||||
|
<div>
|
||||||
|
{% if user_.first_name %}
|
||||||
|
|
||||||
{% if user_.first_name %}
|
{% if user_.last_name %}
|
||||||
|
{{ user_.last_name }},
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
{% if user_.last_name %}
|
{{ user_.first_name }}
|
||||||
{{ user_.last_name }},
|
|
||||||
|
{% else %}
|
||||||
|
{{ user_.username }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
</div>
|
||||||
{{ user_.first_name }}
|
|
||||||
|
|
||||||
{% else %}
|
|
||||||
{{ user_.username }}
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
</li>
|
</li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
|
|
|
@ -146,4 +146,6 @@
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<script src="/static/js/autoreload.js"></script>
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -1,18 +1,22 @@
|
||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
|
{% load static %}
|
||||||
|
|
||||||
<div class="userPanel">
|
<div class="userPanel">
|
||||||
<div class="userInfo">
|
<div class="userInfo">
|
||||||
{% if user.first_name != "" %}
|
<img src="{% static 'profilepictures/'|add:user.profile_picture_filename %}">
|
||||||
{% translate "User" %}: {{ user.first_name }} {{ user.last_name }} ({{ user.username }})
|
<span>
|
||||||
{% else %}
|
{% if user.first_name != "" %}
|
||||||
{% translate "User" %}: {{ user.username }}
|
{% translate "User" %}: {{ user.first_name }} {{ user.last_name }} ({{ user.username }})
|
||||||
{% endif %}
|
{% else %}
|
||||||
-
|
{% translate "User" %}: {{ user.username }}
|
||||||
{% if user.balance < 0.01 %}
|
{% endif %}
|
||||||
<span class="userBalanceWarn">{% translate "Balance" %}: {{ user.balance }}{{ currency_suffix }}</span>
|
-
|
||||||
{% else %}
|
{% if user.balance < 0.01 %}
|
||||||
<span>{% translate "Balance" %}: {{ user.balance }}{{ currency_suffix }}</span>
|
<span class="userBalanceWarn">{% translate "Balance" %}: {{ user.balance }}{{ currency_suffix }}</span>
|
||||||
{% endif %}
|
{% else %}
|
||||||
|
<span>{% translate "Balance" %}: {{ user.balance }}{{ currency_suffix }}</span>
|
||||||
|
{% endif %}
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="horizontalButtonList">
|
<div class="horizontalButtonList">
|
||||||
<a class="button" id="navBarBtnHome" href="/">Home</a>
|
<a class="button" id="navBarBtnHome" href="/">Home</a>
|
||||||
|
|
|
@ -2,5 +2,5 @@
|
||||||
|
|
||||||
export DJANGO_SK_ABS_FP="$(pwd)/config/secret_key.txt"
|
export DJANGO_SK_ABS_FP="$(pwd)/config/secret_key.txt"
|
||||||
export STATIC_FILES="$(pwd)/static/"
|
export STATIC_FILES="$(pwd)/static/"
|
||||||
export APP_VERSION="11"
|
export APP_VERSION="12"
|
||||||
export PYTHONPATH="$(pwd)/packages/"
|
export PYTHONPATH="$(pwd)/packages/"
|
||||||
|
|
|
@ -25,14 +25,27 @@ main > h1 {
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
.userlist li {
|
.userlist > li {
|
||||||
display: flex;
|
display: flex;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
padding: .8rem 1.1rem;
|
|
||||||
margin-bottom: .5rem;
|
margin-bottom: .5rem;
|
||||||
|
padding: 0 .5rem;
|
||||||
|
}
|
||||||
|
.userlist > li > img {
|
||||||
|
margin-right: auto;
|
||||||
|
margin-left: 0;
|
||||||
|
height: 2rem;
|
||||||
|
width: 2rem;
|
||||||
|
}
|
||||||
|
.userlist > li > div {
|
||||||
|
display: flex;
|
||||||
|
flex-grow: 1;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
padding: .8rem 1.1rem;
|
||||||
}
|
}
|
||||||
.userlistButton {
|
.userlistButton {
|
||||||
font-size: 1.1rem;
|
font-size: 1.1rem;
|
||||||
|
@ -102,11 +115,6 @@ form .horizontalButtonList {
|
||||||
.userlist {
|
.userlist {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
.userlist li {
|
|
||||||
width: 100%;
|
|
||||||
padding-left: 0;
|
|
||||||
padding-right: 0;
|
|
||||||
}
|
|
||||||
.pinpad table tr td button {
|
.pinpad table tr td button {
|
||||||
height: 4.2rem;
|
height: 4.2rem;
|
||||||
width: 4.2rem;
|
width: 4.2rem;
|
||||||
|
|
|
@ -67,10 +67,17 @@ main {
|
||||||
align-items: center;
|
align-items: center;
|
||||||
margin-top: 1rem;
|
margin-top: 1rem;
|
||||||
font-size: 1rem;
|
font-size: 1rem;
|
||||||
width: 90%;
|
width: 94%;
|
||||||
}
|
}
|
||||||
.userInfo span {
|
.userInfo > span {
|
||||||
font-size: 1.1rem;
|
font-size: 1.1rem;
|
||||||
|
vertical-align: middle;
|
||||||
|
}
|
||||||
|
.userInfo > img {
|
||||||
|
vertical-align: middle;
|
||||||
|
width: 1.8rem;
|
||||||
|
height: 1.8rem;
|
||||||
|
margin: .5rem;
|
||||||
}
|
}
|
||||||
.userPanel > .horizontalButtonList {
|
.userPanel > .horizontalButtonList {
|
||||||
margin-left: auto;
|
margin-left: auto;
|
||||||
|
|
3
static/js/autoreload.js
Normal file
3
static/js/autoreload.js
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
setInterval(() => {
|
||||||
|
location.reload();
|
||||||
|
}, 1000*60*2); // reload after 2 minutes
|
28
static/profilepictures/default.svg
Normal file
28
static/profilepictures/default.svg
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||||
|
|
||||||
|
<svg
|
||||||
|
width="16"
|
||||||
|
height="16"
|
||||||
|
viewBox="0 0 16 16"
|
||||||
|
version="1.1"
|
||||||
|
id="svg5"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
xmlns:svg="http://www.w3.org/2000/svg">
|
||||||
|
<defs
|
||||||
|
id="defs2" />
|
||||||
|
<g
|
||||||
|
id="layer1">
|
||||||
|
<circle
|
||||||
|
style="fill:#808080;fill-opacity:1;stroke:#fffcfe;stroke-opacity:1"
|
||||||
|
id="path848"
|
||||||
|
cx="8"
|
||||||
|
cy="4.5"
|
||||||
|
r="2.5" />
|
||||||
|
<path
|
||||||
|
style="fill:#7f7f7f;fill-opacity:1;stroke:#fffcff;stroke-opacity:1"
|
||||||
|
id="path3433"
|
||||||
|
d="m -3,-13.499699 a 5,5 0 0 1 -2.5,4.3301274 5,5 0 0 1 -5,0 5,5 0 0 1 -2.5,-4.3301274 h 5 z"
|
||||||
|
transform="scale(-1)" />
|
||||||
|
</g>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 740 B |
Loading…
Add table
Add a link
Reference in a new issue