Compare commits

..

11 commits
20 ... main

35 changed files with 278 additions and 206 deletions

2
.gitignore vendored
View file

@ -1,7 +1,7 @@
/data/* /data/*
/data/logs/* /data/logs/*
/data/tls/* /data/tls/*
/data/static/* /data/django_static/*
/data/profilepictures/* /data/profilepictures/*
/data/archive/* /data/archive/*
!/data/logs/ !/data/logs/

View file

@ -1,4 +1,4 @@
# Drinks Manager (Season 3) # Drinks Manager
Note: This software is tailored to my own needs. Note: This software is tailored to my own needs.
I probably won't accept feature requests, and don't recommend you I probably won't accept feature requests, and don't recommend you

View file

@ -40,6 +40,7 @@ class Drink(models.Model):
do_not_count = models.BooleanField(default=False) do_not_count = models.BooleanField(default=False)
def delete(self, *args, **kwargs): def delete(self, *args, **kwargs):
# we flag the field as deleted.
self.deleted = True self.deleted = True
super().save() super().save()
@ -107,10 +108,9 @@ class Order(models.Model):
price_sum = models.DecimalField(max_digits=6, decimal_places=2, default=0, editable=False) price_sum = models.DecimalField(max_digits=6, decimal_places=2, default=0, editable=False)
content_litres = models.DecimalField(max_digits=6, decimal_places=3, default=0, editable=False) content_litres = models.DecimalField(max_digits=6, decimal_places=3, default=0, editable=False)
# TODO: Add more comments on how and why the save & delete functions are implemented
# address this in a refactoring issue.
def save(self, *args, **kwargs): def save(self, *args, **kwargs):
# saving this may affect other fields
# so we reimplement the save function
drink = Drink.objects.get(pk=self.drink.pk) drink = Drink.objects.get(pk=self.drink.pk)
if self._state.adding and drink.available > 0: if self._state.adding and drink.available > 0:
if not drink.do_not_count: if not drink.do_not_count:
@ -126,6 +126,7 @@ class Order(models.Model):
raise ValidationError("This entry can't be changed.") raise ValidationError("This entry can't be changed.")
def delete(self, *args, **kwargs): def delete(self, *args, **kwargs):
# when deleting, we affect other fields as well.
self.user.balance += self.price_sum self.user.balance += self.price_sum
self.user.save() self.user.save()
drink = Drink.objects.get(pk=self.drink.pk) drink = Drink.objects.get(pk=self.drink.pk)

View file

@ -1,14 +0,0 @@
document.addEventListener("DOMContentLoaded", () => {
let dropdownmenuElement = document.getElementById("dropdownmenu");
let dropdownmenuButtonElement = document.getElementById("dropdownmenu-button");
if (dropdownmenuButtonElement != null) {
dropdownmenuButtonElement.addEventListener("click", () => {
if (dropdownmenuElement.classList.contains("dropdownvisible")) {
dropdownmenuElement.classList.remove("dropdownvisible");
}
else {
dropdownmenuElement.classList.add("dropdownvisible");
}
})
}
});

View file

@ -25,7 +25,7 @@
<div class="flex flex-center"> <div class="flex flex-center">
{% translate "An error occured. Please log out and log in again." %} {% translate "An error occured. Please log out and log in again." %}
<br> <br>
<a href="/accounts/logout">log out</a> <a class="button" href="/accounts/logout">log out</a>
</div> </div>
{% endif %} {% endif %}
</main> </main>

View file

@ -8,20 +8,16 @@
{% block headAdditional %} {% block headAdditional %}
<link rel="stylesheet" href="/static/css/simple-keyboard.css"> <link rel="stylesheet" href="/static/css/simple-keyboard.css">
<link rel="stylesheet" href="/static/css/simple-keyboard_dark.css"> <link rel="stylesheet" href="/static/css/simple-keyboard_custom.css">
{% endblock %} {% endblock %}
{% block content %} {% block content %}
<h1 class="formheading">{% translate "Deposit" %}</h1>
<form id="customform" class="flex flex-column flex-center appform gap-1rem" action="/api/deposit"> <form id="customform" class="flex flex-column flex-center appform gap-1rem" action="/api/deposit">
{% csrf_token %} {% csrf_token %}
<h1 class="formheading">{% translate "Deposit" %}</h1>
<div class="flex forminput"> <div class="flex forminput">
<span>{% translate "Amount" %} {{ currency_suffix }}:</span> <input type="number" name="depositamount" class="keyboard-input depositamount" max="9999.99" min="1.00" step="0.01" placeholder="{% translate 'Amount' %} ({{ currency_suffix }})" autofocus required>
<span>
<input type="number" name="depositamount" class="keyboard-input" max="9999.99" min="1.00" step="0.01" autofocus required>
</span>
</div> </div>
<div id="statusinfo"></div>
<!-- Virtual Keyboard --> <!-- Virtual Keyboard -->
<div id="keyboard" class="simple-keyboard" data-layout="numeric"></div> <div id="keyboard" class="simple-keyboard" data-layout="numeric"></div>
<script src="/static/js/simple-keyboard.js"></script> <script src="/static/js/simple-keyboard.js"></script>
@ -31,6 +27,7 @@
<input type="submit" id="submitbtn" class="button" value='{% translate "confirm" %}'> <input type="submit" id="submitbtn" class="button" value='{% translate "confirm" %}'>
</div> </div>
</form> </form>
<div id="statusinfo"></div>
<script src="/static/js/custom_form.js"></script> <script src="/static/js/custom_form.js"></script>
<script src="/static/js/autoreload.js"></script> <script src="/static/js/autoreload.js"></script>
{% endblock %} {% endblock %}

View file

@ -2,6 +2,6 @@
<footer class="footer-container"> <footer class="footer-container">
<div class="flex flex-row flex-center flex-wrap footer"> <div class="flex flex-row flex-center flex-wrap footer">
<div>Version {{ app_version }}</div> <div>Version {{ app_version }}</div>
<div>Copyright (C) 2021, Julian Müller (ChaoticByte)</div> <div>Copyright (C) 2021-2025, Julian Müller (ChaoticByte)</div>
</div> </div>
</footer> </footer>

View file

@ -11,31 +11,31 @@
<div class="flex flex-column flex-center"> <div class="flex flex-column flex-center">
{% if drink and drink.available > 0 and not drink.deleted %} {% if drink and drink.available > 0 and not drink.deleted %}
{% if user.balance > 0 or user.allow_order_with_negative_balance %} {% if user.balance > 0 or user.allow_order_with_negative_balance %}
<h1 class="formheading">{% translate "Order" %}</h1>
<form id="orderform" class="flex flex-column flex-center appform gap-1rem"> <form id="orderform" class="flex flex-column flex-center appform gap-1rem">
{% csrf_token %} {% csrf_token %}
<h1 class="formheading">{% translate "Order" %}</h1>
<div class="forminfo"> <div class="forminfo">
<span>{% translate "Drink" %}:</span> <span>{% translate "Drink" %}</span>
<span>{{ drink.product_name }}</span> <span>{{ drink.product_name }}</span>
</div> </div>
<div class="forminfo"> <div class="forminfo">
<span>{% translate "Price per Item" %} ({{ currency_suffix }}):</span> <span>{% translate "Price per Item" %} ({{ currency_suffix }})</span>
<span id="priceperdrink" data-drink-price="{% localize off %}{{ drink.price }}{% endlocalize %}"> <span id="priceperdrink" data-drink-price="{% localize off %}{{ drink.price }}{% endlocalize %}">
{{ drink.price }} {{ drink.price }}
</span> </span>
</div> </div>
{% if not drink.do_not_count %} {% if not drink.do_not_count %}
<div class="forminfo"> <div class="forminfo">
<span>{% translate "Available" %}:</span> <span>{% translate "Available" %}</span>
<span>{{ drink.available }}</span> <span>{{ drink.available }}</span>
</div> </div>
{% endif %} {% endif %}
<div class="forminfo"> <div class="forminfo">
<span>{% translate "Sum" %} ({{ currency_suffix }}):</span> <span>{% translate "Sum" %} ({{ currency_suffix }})</span>
<span id="ordercalculatedsum">{{ drink.price }}</span> <span id="ordercalculatedsum">{{ drink.price }}</span>
</div> </div>
<div class="flex forminput"> <div class="flex forminput">
<span>{% translate "Count" %}:</span> <span>{% translate "Count" %}</span>
<span class="flex flex-row customnumberinput"> <span class="flex flex-row customnumberinput">
<button type="button" class="customnumberinput-minus" id="numberofdrinks-btn-minus">-</button> <button type="button" class="customnumberinput-minus" id="numberofdrinks-btn-minus">-</button>
{% if drink.do_not_count %} {% if drink.do_not_count %}
@ -48,19 +48,19 @@
<button type="button" class="customnumberinput-plus" id="numberofdrinks-btn-plus">+</button> <button type="button" class="customnumberinput-plus" id="numberofdrinks-btn-plus">+</button>
</span> </span>
</div> </div>
<div id="statusinfo"></div>
<input type="hidden" name="drinkid" id="drinkid" value="{{ drink.id }}"> <input type="hidden" name="drinkid" id="drinkid" value="{{ drink.id }}">
<div class="buttons"> <div class="buttons">
<a href="/" class="button">{% translate "cancel" %}</a> <a href="/" class="button">{% translate "cancel" %}</a>
<input type="submit" id="ordersubmitbtn" class="button" value='{% translate "order" %}'> <input type="submit" id="ordersubmitbtn" class="button" value='{% translate "order" %}'>
</div> </div>
</form> </form>
<div id="statusinfo"></div>
<script src="/static/js/order.js"></script> <script src="/static/js/order.js"></script>
<script src="/static/js/custom_number_input.js"></script> <script src="/static/js/custom_number_input.js"></script>
{% else %} {% else %}
<div class="flex flex-center"> <div class="flex flex-center flex-column">
<p>{% translate "Your balance is too low to order a drink." %}</p> <p>{% translate "Your balance is too low to order a drink." %}</p>
<a href="/">{% translate "back" %}</a> <a href="/" class="button">{% translate "back" %}</a>
</div> </div>
{% endif %} {% endif %}
{% else %} {% else %}

View file

@ -10,7 +10,7 @@
{% block headAdditional %} {% block headAdditional %}
<link rel="stylesheet" href="/static/css/simple-keyboard.css"> <link rel="stylesheet" href="/static/css/simple-keyboard.css">
<link rel="stylesheet" href="/static/css/simple-keyboard_dark.css"> <link rel="stylesheet" href="/static/css/simple-keyboard_custom.css">
{% endblock %} {% endblock %}
{% block content %} {% block content %}
@ -19,7 +19,7 @@
{% endif %} {% endif %}
<div class="flex flex-column gap-1rem nodisplay" id="passwordoverlay-container"> <div class="flex flex-column gap-1rem nodisplay" id="passwordoverlay-container">
<div class="passwordoverlay"> <div class="passwordoverlay">
<h1>{% translate "Log in" %}</h1> <h1 class="formheading">{% translate "Log in" %}</h1>
<form method="post" action="{% url 'login' %}" class="flex flex-center loginform"> <form method="post" action="{% url 'login' %}" class="flex flex-center loginform">
{% csrf_token %} {% csrf_token %}
<input type="text" name="username" autofocus="" autocapitalize="none" autocomplete="username" maxlength="150" required="" id="id_username"> <input type="text" name="username" autofocus="" autocapitalize="none" autocomplete="username" maxlength="150" required="" id="id_username">
@ -36,7 +36,7 @@
<script src="/static/js/simple-keyboard.js"></script> <script src="/static/js/simple-keyboard.js"></script>
<script src="/static/js/simple-keyboard_configure.js"></script> <script src="/static/js/simple-keyboard_configure.js"></script>
</div> </div>
<div class="flex flex-column flex-center"> <div class="flex flex-column flex-center userlist-container">
<h1>{% translate "Choose your account" %}</h1> <h1>{% translate "Choose your account" %}</h1>
<ul class="flex flex-center flex-wrap userlist"> <ul class="flex flex-center flex-wrap userlist">
{% for user_ in user_list %} {% for user_ in user_list %}

View file

@ -9,27 +9,21 @@
{% block content %} {% block content %}
{% if user.is_superuser or user.allowed_to_supply %} {% if user.is_superuser or user.allowed_to_supply %}
<h1 class="formheading">{% translate "Supply" %}</h1>
<form id="customform" class="flex flex-column flex-center appform gap-1rem" action="/api/supply"> <form id="customform" class="flex flex-column flex-center appform gap-1rem" action="/api/supply">
{% csrf_token %} {% csrf_token %}
<h1 class="formheading">{% translate "Supply" %}</h1>
<div class="flex forminput"> <div class="flex forminput">
<span>{% translate "Description" %}:</span> <input type="text" name="supplydescription" placeholder="{% translate 'Description' %}" autofocus required>
<span>
<input type="text" name="supplydescription" autofocus required>
</span>
</div> </div>
<div class="flex forminput"> <div class="flex forminput">
<span>{% translate "Price" %} ({{ currency_suffix }}):</span> <input type="number" name="supplyprice" max="9999.99" min="1.00" step="0.01" placeholder="{% translate 'Price' %} ({{ currency_suffix }})" required>
<span>
<input type="number" name="supplyprice" max="9999.99" min="1.00" step="0.01" required>
</span>
</div> </div>
<div id="statusinfo"></div>
<div class="buttons"> <div class="buttons">
<a href="/" class="button">{% translate "cancel" %}</a> <a href="/" class="button">{% translate "cancel" %}</a>
<input type="submit" id="submitbtn" class="button" value='{% translate "submit" %}'> <input type="submit" id="submitbtn" class="button" value='{% translate "submit" %}'>
</div> </div>
</form> </form>
<div id="statusinfo"></div>
<script src="/static/js/custom_form.js"></script> <script src="/static/js/custom_form.js"></script>
<script src="/static/js/custom_number_input.js"></script> <script src="/static/js/custom_number_input.js"></script>
{% else %} {% else %}

View file

@ -8,44 +8,37 @@
{% block headAdditional %} {% block headAdditional %}
<link rel="stylesheet" href="/static/css/simple-keyboard.css"> <link rel="stylesheet" href="/static/css/simple-keyboard.css">
<link rel="stylesheet" href="/static/css/simple-keyboard_dark.css"> <link rel="stylesheet" href="/static/css/simple-keyboard_custom.css">
{% endblock %} {% endblock %}
{% block content %} {% block content %}
<h1 class="formheading">{% translate "Transfer Money" %}</h1>
<form id="customform" class="flex flex-column flex-center appform gap-1rem" action="/api/transfer"> <form id="customform" class="flex flex-column flex-center appform gap-1rem" action="/api/transfer">
{% csrf_token %} {% csrf_token %}
<h1 class="formheading">{% translate "Transfer Money" %}</h1>
<div class="flex forminput"> <div class="flex forminput">
<span>{% translate "Recipient" %}:</span> <select name="recipientuser" id="transfer-recipient" required>
<span> <option value="" selected disabled>Recipient</option>
<select name="recipientuser" required> {% for user_ in user_list %}
<option></option> {% if user_.id != user.id %}
{% for user_ in user_list %} <option value="{{user_.id}}">
{% if user_.id != user.id %} {% if user_.first_name %}
<option value="{{user_.id}}"> {% if user_.last_name %}
{% if user_.first_name %} {{ user_.last_name }},
{% if user_.last_name %}
{{ user_.last_name }},
{% endif %}
{{ user_.first_name }}
{% elif user_.last_name %}
{{ user_.last_name }}
{% else %}
{{ user_.username }}
{% endif %} {% endif %}
{% endif %} {{ user_.first_name }}
</option> {% elif user_.last_name %}
{% endfor %} {{ user_.last_name }}
</select> {% else %}
</span> {{ user_.username }}
{% endif %}
{% endif %}
</option>
{% endfor %}
</select>
</div> </div>
<div class="flex forminput"> <div class="flex forminput">
<span>{% translate "Amount" %} {{ currency_suffix }}:</span> <input type="number" name="transferamount" class="keyboard-input" max="{{ user.balance }}" min="0.01" step="0.01" placeholder="{% translate 'Amount' %} ({{ currency_suffix }})" autofocus required>
<span>
<input type="number" name="transferamount" class="keyboard-input" max="{{ user.balance }}" min="0.01" step="0.01" autofocus required>
</span>
</div> </div>
<div id="statusinfo"></div>
<!-- Virtual Keyboard --> <!-- Virtual Keyboard -->
<div id="keyboard" class="simple-keyboard" data-layout="numeric"></div> <div id="keyboard" class="simple-keyboard" data-layout="numeric"></div>
<script src="/static/js/simple-keyboard.js"></script> <script src="/static/js/simple-keyboard.js"></script>
@ -55,6 +48,7 @@
<input type="submit" id="submitbtn" class="button" value='{% translate "confirm" %}'> <input type="submit" id="submitbtn" class="button" value='{% translate "confirm" %}'>
</div> </div>
</form> </form>
<div id="statusinfo"></div>
<script src="/static/js/custom_form.js"></script> <script src="/static/js/custom_form.js"></script>
<script src="/static/js/autoreload.js"></script> <script src="/static/js/autoreload.js"></script>
{% endblock %} {% endblock %}

View file

@ -18,18 +18,19 @@
<a class="button" href="/deposit">{% translate "Deposit" %}</a> <a class="button" href="/deposit">{% translate "Deposit" %}</a>
<a class="button" href="/accounts/logout">{% translate "Logout" %}</a> <a class="button" href="/accounts/logout">{% translate "Logout" %}</a>
<div class="dropdownmenu" id="dropdownmenu"> <div class="dropdownmenu" id="dropdownmenu">
<div id="dropdownnope"></div>
<button class="dropdownbutton" id="dropdownmenu-button"><img src="/static/material-icons/menu.svg"></button> <button class="dropdownbutton" id="dropdownmenu-button"><img src="/static/material-icons/menu.svg"></button>
<div class="dropdownlist"> <div class="dropdownlist">
<a class="button dropdownchoice" href="/history">{% translate "History" %}</a> <a class="dropdownchoice" href="/history">{% translate "History" %}</a>
<a class="button dropdownchoice" href="/statistics">{% translate "Statistics" %}</a> <a class="dropdownchoice" href="/statistics">{% translate "Statistics" %}</a>
{% if user.is_superuser or user.is_staff %} {% if user.is_superuser or user.is_staff %}
<a class="button dropdownchoice" href="/admin/">Admin Panel</a> <a class="dropdownchoice" href="/admin/">Admin Panel</a>
{% endif %} {% endif %}
<a class="button dropdownchoice" href="/transfer/">{% translate "Transfer" %}</a> <a class="dropdownchoice" href="/transfer/">{% translate "Transfer" %}</a>
{% if user.is_superuser or user.allowed_to_supply %} {% if user.is_superuser or user.allowed_to_supply %}
<a class="button dropdownchoice" href="/supply/">{% translate "Supply" %}</a> <a class="dropdownchoice" href="/supply/">{% translate "Supply" %}</a>
{% endif %} {% endif %}
<a class="button dropdownchoice" href="/accounts/password_change/">{% translate "Change Password" %}</a> <a class="dropdownchoice" href="/accounts/password_change/">{% translate "Change Password" %}</a>
</div> </div>
</div> </div>
</div> </div>

View file

@ -9,7 +9,8 @@
{$CADDY_HOSTS} { {$CADDY_HOSTS} {
# the tls certificates # the tls certificates
tls {$DATADIR}/tls/server.pem {$DATADIR}/tls/server-key.pem # tls {$DATADIR}/tls/server.pem {$DATADIR}/tls/server-key.pem
tls internal
route { route {
# profile pictures # profile pictures
file_server /profilepictures/* { file_server /profilepictures/* {
@ -17,7 +18,11 @@
} }
# static files # static files
file_server /static/* { file_server /static/* {
root {$DATADIR}/static/.. root {$ROOTDIR}
}
# django static files
file_server /django_static/* {
root {$DATADIR}/django_static/..
} }
# favicon # favicon
redir /favicon.ico /static/favicon.ico redir /favicon.ico /static/favicon.ico

View file

@ -149,8 +149,8 @@ LOCALE_PATHS = [
# Static files (CSS, JavaScript, Images) # Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/4.1/howto/static-files/ # https://docs.djangoproject.com/en/4.1/howto/static-files/
STATIC_URL = "static/" STATIC_URL = "django_static/"
STATIC_ROOT = BASE_DIR / "data" / "static" STATIC_ROOT = BASE_DIR / "data" / "django_static"
# Default primary key field type # Default primary key field type
# https://docs.djangoproject.com/en/4.1/ref/settings/#default-auto-field # https://docs.djangoproject.com/en/4.1/ref/settings/#default-auto-field

View file

@ -1,4 +1,4 @@
Django~=4.1 Django~=4.2
psycopg2~=2.9.5 psycopg2~=2.9
uvicorn~=0.20.0 uvicorn[standard]~=0.27
PyYAML~=6.0 PyYAML~=6.0

View file

@ -14,7 +14,7 @@ from time import sleep
from yaml import safe_load from yaml import safe_load
banner = """ ___ _ _ banner = r""" ___ _ _
| \ _ _ (_) _ _ | |__ ___ ___ | \ _ _ (_) _ _ | |__ ___ ___
| |) || '_|| || ' \ | / /(_-< |___| | |) || '_|| || ' \ | / /(_-< |___|
|___/ |_| |_||_||_||_\_\/__/ |___/ |_| |_||_||_||_\_\/__/
@ -131,6 +131,7 @@ if __name__ == "__main__":
["./venv/bin/python3", "./manage.py", "migrate", "--noinput"], env=os.environ).wait() ["./venv/bin/python3", "./manage.py", "migrate", "--noinput"], env=os.environ).wait()
# Caddy configuration via env # Caddy configuration via env
environment_caddy = os.environ environment_caddy = os.environ
environment_caddy["ROOTDIR"] = str(base_directory.absolute())
environment_caddy["DATADIR"] = str(data_directory.absolute()) environment_caddy["DATADIR"] = str(data_directory.absolute())
environment_caddy["CADDY_HOSTS"] = ", ".join(config["caddy"]["hosts"]) environment_caddy["CADDY_HOSTS"] = ", ".join(config["caddy"]["hosts"])
environment_caddy["HTTP_PORT"] = str(config["caddy"]["http_port"]) environment_caddy["HTTP_PORT"] = str(config["caddy"]["http_port"])

View file

@ -11,6 +11,6 @@ chmod -c -R g-w,o-rwx .gitignore
export PYTHONPATH="$basedir" export PYTHONPATH="$basedir"
export DJANGO_SETTINGS_MODULE="project.settings" export DJANGO_SETTINGS_MODULE="project.settings"
export APP_VERSION="20" export APP_VERSION="22"
exec ./scripts/_bootstrap.py "$@" exec ./scripts/_bootstrap.py "$@"

View file

@ -1,4 +1,4 @@
/* Font */ /* Fonts */
@font-face { @font-face {
font-family: "Inter"; font-family: "Inter";
@ -18,26 +18,39 @@
:root { :root {
--font-family: "Inter"; --font-family: "Inter";
--color: #fafafa; --color: #fafafa;
--color-error: #ff682c; --color-disabled: #ffffff50;
--bg-page-color: #222222; --color-error: #ff817c;
--bg-color: #4e4e4e; --bg-page: linear-gradient(
--bg-hover-color: #636363; -10deg,
--bg-color2: #383838; #071c29 10%,
--bg-hover-color2: #4a4a4a; #4a8897
--border-color: #808080; );
--bg-color: #ffffff35;
--bg-color2: #ffffff25;
--bg-hover-color: #ffffff50;
--border-color: #ffffff50;
--bg-globalmessage: #161616; --bg-globalmessage: #161616;
--border-radius: .5rem; --border-radius: .6rem;
--element-padding: .6rem .8rem;
} }
/* General */ /* General */
body,
input,
select,
button, .button
{
font-family: var(--font-family);
}
body { body {
margin: 0; margin: 0;
padding: 0; padding: 0;
width: 100vw; width: 100vw;
min-height: 100vh; min-height: 100vh;
font-family: var(--font-family); font-size: 17px;
background: var(--bg-page-color); background: var(--bg-page);
color: var(--color); color: var(--color);
overflow-x: hidden; overflow-x: hidden;
} }
@ -47,7 +60,7 @@ a {
} }
h1 { h1 {
font-size: 1.8rem; font-size: 28px;
} }
h1, h2, h3, h4 { h1, h2, h3, h4 {
@ -65,29 +78,36 @@ input[type="number"]::-webkit-inner-spin-button {
display: none; display: none;
} }
input[type="text"], input[type="password"], input[type="number"], select { input[type="text"],
padding: .6rem .8rem; input[type="password"],
text-align: center; input[type="number"],
font-size: 1rem; select {
padding: var(--element-padding);
text-align: center !important;
font-size: 16px;
color: var(--color); color: var(--color);
border: none; border: none;
outline: none; outline: none;
border-bottom: 1px solid var(--border-color); border: 1px solid var(--border-color);
border-radius: var(--border-radius); border-radius: var(--border-radius);
background: var(--bg-color); background: var(--bg-color);
font-family: "Inter"; }
input[type="text"]::placeholder,
input[type="password"]::placeholder,
input[type="number"]::placeholder,
select > option:disabled {
color: var(--color-disabled);
} }
select { select {
appearance: none; appearance: none;
-webkit-appearance: none; -webkit-appearance: none;
-moz-appearance: none; -moz-appearance: none;
height: 2.5rem;
background-image: url("/static/material-icons/arrow-drop-down.svg"); background-image: url("/static/material-icons/arrow-drop-down.svg");
background-repeat: no-repeat; background-repeat: no-repeat;
background-position: right; background-position: right;
background-size: 1.5rem; background-size: 1.5rem;
padding-right: 1.8rem;
} }
table { table {
@ -106,12 +126,6 @@ tr:nth-child(2n+2) > td {
background: var(--bg-color2); background: var(--bg-color2);
} }
/*
Rounded corners on table cells apparently don't work with
Firefox, so Firefox users won't have rounded corners
on tables. Can't fix that by myself.
*/
table tr:first-child th:first-child { table tr:first-child th:first-child {
border-top-left-radius: var(--border-radius); border-top-left-radius: var(--border-radius);
} }
@ -165,11 +179,7 @@ th {
flex-direction: row; flex-direction: row;
margin-top: 1rem; margin-top: 1rem;
width: 94%; width: 94%;
gap: 1rem; gap: 2rem;
}
.userinfo {
font-size: 1.05rem;
} }
.userinfo > span { .userinfo > span {
@ -224,7 +234,7 @@ main {
} }
.footer > div { .footer > div {
font-size: .95rem; font-size: 16px;
margin-top: .15rem; margin-top: .15rem;
margin-bottom: .15rem; margin-bottom: .15rem;
} }
@ -276,15 +286,6 @@ main {
gap: 1rem; gap: 1rem;
} }
.fill {
height: 100%;
width: 100%;
}
.fill-vertical {
height: 100%;
}
.buttons { .buttons {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
@ -297,24 +298,26 @@ main {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
font-family: var(--font-family);
text-decoration: none;
text-align: center !important;
background: var(--bg-color);
color: var(--color);
font-size: 1rem;
padding: .6rem .8rem;
outline: none; outline: none;
border: none; border: 1px solid var(--border-color);
border-bottom: 1px solid var(--border-color);
border-radius: var(--border-radius); border-radius: var(--border-radius);
cursor: pointer;
user-select: none;
box-sizing: content-box;
width: fit-content; width: fit-content;
} }
.button:hover, button:hover, .button:active, button:active { .button, button, .dropdownchoice {
padding: var(--element-padding);
font-size: 16px;
text-align: center !important;
text-decoration: none;
color: var(--color);
box-sizing: content-box;
cursor: pointer;
user-select: none;
background: var(--bg-color);
}
.button:hover, button:hover,
.button:active, button:active {
background: var(--bg-hover-color); background: var(--bg-hover-color);
} }
@ -322,30 +325,55 @@ main {
opacity: 40%; opacity: 40%;
} }
.appform > .forminfo { .formheading {
width: 100%; margin-bottom: 2rem;
}
.forminfo {
width: fit-content;
min-width: 16rem;
text-align: left; text-align: left;
display: flex; display: flex;
flex-direction: row; flex-direction: row;
justify-content: space-between; justify-content: space-between;
gap: 2rem; gap: 2rem;
padding-bottom: .15rem;
border-bottom: 1px solid #ffffff20;
} }
.forminfo > span:last-child { .forminfo > span:last-child {
float: right; float: right;
} }
.appform, .appform > * {
max-width: 90vw;
}
.appform > .forminput { .appform > .forminput {
width: 100%; width: 100%;
flex-direction: row; flex-direction: row;
justify-content: space-evenly; justify-content: space-between;
align-items: center; align-items: center;
flex-wrap: wrap; flex-wrap: wrap;
gap: 1rem; gap: 1rem;
} }
.appform > .statusinfo { .forminput > input, .forminput > select {
margin-top: .5rem; width: 100% !important;
}
.forminput > .keyboard-input, #transfer-recipient {
/* the keyboard has a 5px padding */
margin-left: 5px !important;
margin-right: 5px !important;
}
.appform > .buttons {
margin-top: 1rem;
}
#statusinfo {
margin-top: 1rem;
} }
.dropdownmenu { .dropdownmenu {
@ -356,6 +384,16 @@ main {
border-radius: var(--border-radius); border-radius: var(--border-radius);
} }
#dropdownnope {
position: fixed;
top: 0;
left: 0;
width: 100vw;
height: 100vh;
margin: 0;
padding: 0;
}
.dropdownbutton { .dropdownbutton {
z-index: 190; z-index: 190;
} }
@ -366,70 +404,69 @@ main {
} }
.dropdownlist { .dropdownlist {
margin-top: 3rem;
position: absolute; position: absolute;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
pointer-events: none; border-radius: var(--border-radius);
border-radius: var(--border-radius) !important; box-shadow: 0 0 .5rem #00000025;
z-index: 200; }
margin-top: 3.2rem;
.dropdownlist, #dropdownnope {
visibility: hidden;
opacity: 0%; opacity: 0%;
transition: opacity 100ms; pointer-events: none;
box-shadow: 0 .25rem 1rem #00000090; }
.dropdownvisible .dropdownlist,
.dropdownvisible #dropdownnope {
opacity: 100%;
background: #00000020;
visibility: visible;
pointer-events: visible;
z-index: 100;
} }
.dropdownchoice { .dropdownchoice {
border-radius: 0 !important; z-index: 200;
margin: 0; margin: 0;
text-align: center; text-decoration: none;
justify-content: center;
background: var(--bg-color2) !important;
backdrop-filter: none !important;
width: initial; width: initial;
min-width: max-content;
border-bottom: 1px solid var(--border-color);
border-left: 1px solid var(--border-color);
border-right: 1px solid var(--border-color);
}
.dropdownchoice:first-child {
border-top: 1px solid var(--border-color);
border-top-left-radius: var(--border-radius);
border-top-right-radius: var(--border-radius);
}
.dropdownchoice:last-child {
border-bottom: 1px solid var(--border-color);
border-bottom-left-radius: var(--border-radius);
border-bottom-right-radius: var(--border-radius);
} }
.dropdownchoice:hover { .dropdownchoice:hover {
background: var(--bg-hover-color2) !important; background: var(--bg-hover-color);
}
.dropdownlist :first-child {
border-top-left-radius: var(--border-radius) !important;
border-top-right-radius: var(--border-radius) !important;
}
.dropdownlist :last-child {
border-bottom-left-radius: var(--border-radius) !important;
border-bottom-right-radius: var(--border-radius) !important;
}
.dropdownvisible .dropdownlist {
opacity: 100%;
visibility: visible;
pointer-events: visible;
} }
.customnumberinput { .customnumberinput {
height: 2.5rem; height: 2.2rem;
display: flex;
flex-direction: row;
align-items: center;
gap: .25rem;
} }
.customnumberinput button { .customnumberinput button {
min-width: 2.5rem !important; width: 2.2rem !important;
width: 2.5rem !important; height: 2.2rem !important;
padding: 0; padding: 0;
margin: 0; margin: 0;
height: 100%;
}
.customnumberinput-minus {
border-bottom-right-radius: 0;
border-top-right-radius: 0;
z-index: 10;
}
.customnumberinput-plus {
border-bottom-left-radius: 0;
border-top-left-radius: 0;
z-index: 10;
} }
.customnumberinput input[type="number"] { .customnumberinput input[type="number"] {
@ -438,13 +475,13 @@ main {
padding: 0; padding: 0;
margin: 0; margin: 0;
background: var(--bg-color2); background: var(--bg-color2);
border-radius: 0 !important;
-webkit-appearance: textfield; -webkit-appearance: textfield;
-moz-appearance: textfield; -moz-appearance: textfield;
appearance: textfield; appearance: textfield;
} }
.errortext { .errortext {
font-weight: bold;
color: var(--color-error); color: var(--color-error);
} }
@ -454,6 +491,11 @@ main {
/* Login */ /* Login */
.userlist-container {
flex-grow: 1;
padding-bottom: 10vh;
}
.userlist { .userlist {
width: 60%; width: 60%;
list-style: none; list-style: none;
@ -463,8 +505,7 @@ main {
} }
.userlist > li { .userlist > li {
margin-bottom: .5rem; padding: .1rem .6rem;
padding: 0 .5rem;
} }
.userlist > li > img { .userlist > li > img {
@ -477,7 +518,7 @@ main {
.userlist > li > div { .userlist > li > div {
flex-grow: 1; flex-grow: 1;
text-align: center; text-align: center;
padding: .8rem 1.1rem; padding: .7rem 1.1rem;
} }
.loginform { .loginform {
@ -489,6 +530,18 @@ main {
margin-top: 0; margin-top: 0;
} }
#passwordoverlay-container {
position: fixed;
width: 100vw;
height: 100vh;
top: 0;
right: 0;
background: var(--bg-page);
align-items: center;
padding-top: 10vh;
z-index: 200;
}
/* Drinks List */ /* Drinks List */
.drinks-list { .drinks-list {
@ -505,7 +558,7 @@ main {
.drinks-list > li > .button { .drinks-list > li > .button {
width: 100%; width: 100%;
justify-content: space-between; justify-content: space-between;
padding: .8rem 1.1rem; padding: .7rem 1.1rem;
} }
/* Statistics */ /* Statistics */
@ -525,6 +578,19 @@ main {
width: 16rem; width: 16rem;
} }
/* Blur */
@supports (backdrop-filter: blur()) {
.dropdownvisible #dropdownnope {
backdrop-filter: blur(16px);
}
#passwordoverlay-container {
background: #00000020;
backdrop-filter: blur(64px); /* fallback */
backdrop-filter: blur(128px);
}
}
/* Responsive */ /* Responsive */
@media only screen and (max-width: 1200px) { @media only screen and (max-width: 1200px) {
@ -545,9 +611,10 @@ main {
} }
} }
@media only screen and (max-width: 700px) { @media only screen and (max-width: 860px) {
.userpanel { .userpanel {
flex-direction: column; flex-direction: column;
gap: 1rem;
} }
.userlist { .userlist {
gap: 0.25rem; gap: 0.25rem;
@ -566,7 +633,10 @@ main {
} }
.dropdownlist { .dropdownlist {
width: 14rem; width: 14rem;
right: calc(50vw - 7rem); right: calc(50vw - 7rem); /* regard width */
left: auto; left: auto;
} }
#keyboard {
display: none !important;
}
} }

View file

@ -6,6 +6,7 @@
max-width: 100%; max-width: 100%;
background: transparent; background: transparent;
font-family: "Inter"; font-family: "Inter";
font-size: 16px;
} }
.simple-keyboard.darkTheme .hg-button { .simple-keyboard.darkTheme .hg-button {
height: 50px; height: 50px;
@ -14,8 +15,8 @@
align-items: center; align-items: center;
background: var(--bg-color); background: var(--bg-color);
color: white; color: white;
border: none; border: 1px solid var(--border-color);
border-bottom: 1px solid var(--border-color); border-radius: var(--border-radius);
} }
.simple-keyboard.darkTheme .hg-button:active, .simple-keyboard.darkTheme .hg-button:active,
.simple-keyboard.darkTheme .hg-button:hover { .simple-keyboard.darkTheme .hg-button:hover {

View file

Before

Width:  |  Height:  |  Size: 43 KiB

After

Width:  |  Height:  |  Size: 43 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 41 KiB

After

Width:  |  Height:  |  Size: 41 KiB

Before After
Before After

View file

@ -35,6 +35,7 @@
function show_password_overlay() { function show_password_overlay() {
window.scrollTo(0, 0); window.scrollTo(0, 0);
passwordOverlayElement.classList.remove("nodisplay"); passwordOverlayElement.classList.remove("nodisplay");
passwordInputElement.focus()
} }
function hide_password_overlay() { function hide_password_overlay() {
passwordOverlayElement.classList.add("nodisplay"); passwordOverlayElement.classList.add("nodisplay");

21
static/js/main.js Normal file
View file

@ -0,0 +1,21 @@
document.addEventListener("DOMContentLoaded", () => {
let dropdownmenuElement = document.getElementById("dropdownmenu");
let dropdownmenuButtonElement = document.getElementById("dropdownmenu-button");
let dropdownmenuNopeElement = document.getElementById("dropdownnope");
function toggleDropDown() {
if (dropdownmenuElement.classList.contains("dropdownvisible")) {
dropdownmenuElement.classList.remove("dropdownvisible");
dropdownmenuNopeElement.classList.remove("dropdownvisible");
} else {
dropdownmenuElement.classList.add("dropdownvisible");
dropdownmenuNopeElement.classList.add("dropdownvisible");
}
}
if (dropdownmenuButtonElement != null) {
dropdownmenuButtonElement.addEventListener("click", toggleDropDown);
dropdownmenuNopeElement.addEventListener("click", () => {
dropdownmenuElement.classList.remove("dropdownvisible");
dropdownmenuNopeElement.classList.remove("dropdownvisible");
})
}
});

View file

Before

Width:  |  Height:  |  Size: 145 B

After

Width:  |  Height:  |  Size: 145 B

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 240 B

After

Width:  |  Height:  |  Size: 240 B

Before After
Before After