Initial commit - existing project files
This commit is contained in:
commit
c49798a9ea
82 changed files with 4304 additions and 0 deletions
40
static/css/customNumberInput.css
Normal file
40
static/css/customNumberInput.css
Normal file
|
@ -0,0 +1,40 @@
|
|||
/* custom number input */
|
||||
.customNumberInput {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
height: 2.2rem;
|
||||
width: 100% !important;
|
||||
}
|
||||
.customNumberInput button {
|
||||
min-width: 2.5rem !important;
|
||||
width: 2.5rem !important;
|
||||
padding: 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"] {
|
||||
max-height: 100%;
|
||||
width: 5rem;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
font-size: .9rem;
|
||||
color: var(--color);
|
||||
text-align: center;
|
||||
background: var(--glass-bg-color2);
|
||||
outline: none;
|
||||
border: none;
|
||||
border-radius: 0 !important;
|
||||
-webkit-appearance: textfield;
|
||||
-moz-appearance: textfield;
|
||||
appearance: textfield;
|
||||
}
|
11
static/css/deposit.css
Normal file
11
static/css/deposit.css
Normal file
|
@ -0,0 +1,11 @@
|
|||
#depositAmount {
|
||||
width: 10rem;
|
||||
}
|
||||
main {
|
||||
margin-top: 0;
|
||||
}
|
||||
@media only screen and (max-width: 700px) {
|
||||
main {
|
||||
margin-top: -15vh;
|
||||
}
|
||||
}
|
23
static/css/history.css
Normal file
23
static/css/history.css
Normal file
|
@ -0,0 +1,23 @@
|
|||
.history {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
width: 40%;
|
||||
min-width: 30rem;
|
||||
}
|
||||
.history td {
|
||||
padding-top: .4rem !important;
|
||||
padding-bottom: .4rem !important;
|
||||
font-size: .95rem;
|
||||
}
|
||||
.history .historyDate {
|
||||
margin-left: auto;
|
||||
text-align: right;
|
||||
font-size: .8rem !important;
|
||||
}
|
||||
/* mobile devices */
|
||||
@media only screen and (max-width: 700px) {
|
||||
.history {
|
||||
width: 90%;
|
||||
min-width: 90%;
|
||||
}
|
||||
}
|
45
static/css/index.css
Normal file
45
static/css/index.css
Normal file
|
@ -0,0 +1,45 @@
|
|||
.availableDrinksList {
|
||||
width: 50%;
|
||||
max-width: 45rem;
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: start;
|
||||
align-items: center;
|
||||
}
|
||||
.availableDrinksList li {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
height: fit-content;
|
||||
margin-bottom: .6rem;
|
||||
}
|
||||
.availableDrinksList li a {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
align-items: center;
|
||||
justify-content: start;
|
||||
color: var(--color);
|
||||
padding: .8rem 1.1rem;
|
||||
text-decoration: none;
|
||||
font-size: 1rem;
|
||||
}
|
||||
.availableDrinksList li a span:first-child {
|
||||
margin-right: 1rem !important;
|
||||
}
|
||||
.availableDrinksList li a span:last-child {
|
||||
margin-left: auto;
|
||||
text-align: right;
|
||||
font-size: 1rem;
|
||||
}
|
||||
/* mobile devices */
|
||||
@media only screen and (max-width: 700px) {
|
||||
.availableDrinksList {
|
||||
width: 95%;
|
||||
}
|
||||
.availableDrinksList li a {
|
||||
width: calc(100vw - (2 * .8rem)) !important;
|
||||
padding: .8rem !important;
|
||||
}
|
||||
}
|
117
static/css/login.css
Normal file
117
static/css/login.css
Normal file
|
@ -0,0 +1,117 @@
|
|||
/* login page */
|
||||
body.overflowHidden {
|
||||
overflow-y: hidden !important;
|
||||
overflow-x: hidden !important;
|
||||
}
|
||||
main {
|
||||
margin-top: 2vh;
|
||||
}
|
||||
main > h1 {
|
||||
display: none;
|
||||
}
|
||||
.userlistContainer {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: start;
|
||||
}
|
||||
.userlist {
|
||||
width: 50vw;
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
.userlist li {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: .8rem 1.1rem;
|
||||
margin-bottom: .5rem;
|
||||
text-align: center;
|
||||
}
|
||||
.userlistButton {
|
||||
font-size: 1.1rem;
|
||||
}
|
||||
.passwordOverlayContainer {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: start;
|
||||
background: var(--page-background);
|
||||
z-index: 40;
|
||||
}
|
||||
.passwordOverlay {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: start;
|
||||
align-items: center;
|
||||
margin-top: 10vh;
|
||||
}
|
||||
.passwordOverlay > form {
|
||||
min-width: unset;
|
||||
width: fit-content;
|
||||
}
|
||||
.passwordOverlay > form > h1 {
|
||||
margin-top: 3rem;
|
||||
margin-bottom: 3rem;
|
||||
}
|
||||
form input[type="password"], form input[type="text"] {
|
||||
width: 94%;
|
||||
padding-top: .5rem;
|
||||
padding-bottom: .5rem;
|
||||
font-size: 1rem;
|
||||
margin: .1rem 0;
|
||||
}
|
||||
.pinpad {
|
||||
margin-top: 3rem;
|
||||
margin-bottom: 2rem;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
max-width: 30vw;
|
||||
}
|
||||
.pinpad table {
|
||||
box-shadow: none !important;
|
||||
}
|
||||
.pinpad table tr, .pinpad td {
|
||||
padding: unset;
|
||||
background: unset;
|
||||
}
|
||||
.pinpad tr td button {
|
||||
height: 4.0rem;
|
||||
width: 4.1rem;
|
||||
font-size: 1.16rem;
|
||||
margin: .2rem !important;
|
||||
}
|
||||
@media only screen and (max-width: 700px) {
|
||||
.userlistContainer {
|
||||
width: 95vw;
|
||||
}
|
||||
.userlist {
|
||||
width: 100%;
|
||||
}
|
||||
.userlist li {
|
||||
width: 100%;
|
||||
padding-left: 0;
|
||||
padding-right: 0;
|
||||
}
|
||||
.pinpad table tr td button {
|
||||
height: 4.2rem;
|
||||
width: 4.2rem;
|
||||
font-size: 1.16rem;
|
||||
margin: .2rem;
|
||||
}
|
||||
.passwordOverlay {
|
||||
margin-top: 2rem;
|
||||
}
|
||||
}
|
372
static/css/main.css
Normal file
372
static/css/main.css
Normal file
|
@ -0,0 +1,372 @@
|
|||
/* VARIABLES */
|
||||
:root {
|
||||
/** FONT **/
|
||||
--font-family: 'Liberation Sans', sans-serif;
|
||||
/** colors **/
|
||||
--color: #fafafa;
|
||||
--color-error: rgb(255, 70, 70);
|
||||
/** glass **/
|
||||
--glass-bg-dropDown: #3a3b44ef;
|
||||
--glass-bg-dropDown-hover: #55565efa;
|
||||
--glass-bg-color1: #ffffff31;
|
||||
--glass-bg-color2: #ffffff1a;
|
||||
--glass-bg-hover-color1: #ffffff46;
|
||||
--glass-bg-hover-color2: #ffffff1a;
|
||||
--glass-blur: none;
|
||||
--glass-border-color: #ffffff77;
|
||||
--glass-bg: linear-gradient(var(--glass-bg-color1), var(--glass-bg-color2));
|
||||
--glass-bg-hover: linear-gradient(var(--glass-bg-hover-color1), var(--glass-bg-hover-color2));
|
||||
--glass-corner-radius: .3rem;
|
||||
/** page background **/
|
||||
--page-background-color1: #131d25;
|
||||
--page-background-color2: #311d30;
|
||||
--page-background: linear-gradient(-190deg, var(--page-background-color1), var(--page-background-color2));
|
||||
/** global message banner **/
|
||||
--bg-globalMessage: linear-gradient(135deg, #4b351c, #411d52, #1c404b);
|
||||
}
|
||||
@supports(backdrop-filter: blur(10px)) {
|
||||
:root {
|
||||
--glass-bg-dropDown: #ffffff1a;
|
||||
--glass-bg-dropDown-hover: #ffffff46;
|
||||
--glass-blur: blur(18px);
|
||||
}
|
||||
}
|
||||
/* BASE LAYOUT */
|
||||
body {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
width: 100vw;
|
||||
min-height: 100vh;
|
||||
font-family: var(--font-family);
|
||||
background: var(--page-background);
|
||||
color: var(--color);
|
||||
overflow-x: hidden;
|
||||
}
|
||||
.baseLayout {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: start;
|
||||
align-items: center;
|
||||
min-height: 100vh;
|
||||
width: 100vw;
|
||||
max-width: 100vw;
|
||||
}
|
||||
main {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: flex-start;
|
||||
align-items: center;
|
||||
flex-grow: 1;
|
||||
width: 100%;
|
||||
margin-top: calc(-14rem + 2vh);
|
||||
}
|
||||
.userPanel {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: center;
|
||||
align-items: flex-start;
|
||||
min-width: fit-content;
|
||||
margin-top: 1rem;
|
||||
pointer-events: none;
|
||||
}
|
||||
.userPanel > div {
|
||||
margin: 0 1rem;
|
||||
}
|
||||
.userBalanceWarn {
|
||||
color: var(--color-error);
|
||||
font-weight: bold;
|
||||
}
|
||||
.content {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: start;
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
flex-grow: 1;
|
||||
}
|
||||
main > h1 {
|
||||
margin-top: 0;
|
||||
}
|
||||
.globalMessage {
|
||||
width: 100vw;
|
||||
z-index: 999;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
background: var(--bg-globalMessage);
|
||||
padding: .3rem 0;
|
||||
}
|
||||
.globalMessage div {
|
||||
width: 96%;
|
||||
text-align: center;
|
||||
word-break: keep-all;
|
||||
word-wrap: break-word;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
/* DROP DOWN MENUS */
|
||||
.dropDownMenu {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: flex-start;
|
||||
align-items: center;
|
||||
border-radius: var(--glass-corner-radius);
|
||||
}
|
||||
.dropDownButton {
|
||||
width: fit-content;
|
||||
z-index: 190;
|
||||
box-shadow: none;
|
||||
text-align: center;
|
||||
justify-content: center;
|
||||
pointer-events: all;
|
||||
}
|
||||
.dropDownButton, .dropDownChoice {
|
||||
font-size: 1rem;
|
||||
}
|
||||
.dropDownButton > div::after {
|
||||
content: '\25BC';
|
||||
display: inline-block;
|
||||
transition: transform 100ms;
|
||||
padding: 0 .3rem;
|
||||
}
|
||||
.dropDownList {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
pointer-events: none;
|
||||
border-radius: var(--glass-corner-radius) !important;
|
||||
backdrop-filter: var(--glass-blur);
|
||||
z-index: 200;
|
||||
margin-top: .5rem;
|
||||
opacity: 0%;
|
||||
transition: opacity 100ms;
|
||||
}
|
||||
.dropDownChoice {
|
||||
box-shadow: none;
|
||||
border-radius: 0 !important;
|
||||
margin: 0;
|
||||
margin-top: -1px;
|
||||
text-align: center;
|
||||
justify-content: center;
|
||||
background: var(--glass-bg-dropDown) !important;
|
||||
backdrop-filter: none !important;
|
||||
}
|
||||
.dropDownChoice:hover {
|
||||
background: var(--glass-bg-dropDown-hover) !important;
|
||||
}
|
||||
.dropDownList :first-child {
|
||||
border-top-left-radius: var(--glass-corner-radius) !important;
|
||||
border-top-right-radius: var(--glass-corner-radius) !important;
|
||||
}
|
||||
.dropDownList :last-child {
|
||||
border-bottom-left-radius: var(--glass-corner-radius) !important;
|
||||
border-bottom-right-radius: var(--glass-corner-radius) !important;
|
||||
}
|
||||
.dropDownVisible .dropDownList {
|
||||
opacity: 100%;
|
||||
visibility: visible;
|
||||
pointer-events: visible;
|
||||
}
|
||||
.dropDownVisible > .dropDownButton > div::after {
|
||||
transform: rotate(180deg);
|
||||
}
|
||||
.userPanel .dropDownButton, .userPanel .dropDownChoice {
|
||||
font-size: 1.1rem;
|
||||
}
|
||||
/* FOOTER */
|
||||
.footer {
|
||||
z-index: 990;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
margin-top: auto;
|
||||
padding-top: 3rem;
|
||||
padding-bottom: .3rem;
|
||||
}
|
||||
.footer div {
|
||||
font-size: .95rem;
|
||||
margin-top: .15rem;
|
||||
margin-bottom: .15rem;
|
||||
}
|
||||
.footer div::after {
|
||||
margin-left: .5rem;
|
||||
content: "-";
|
||||
margin-right: .5rem;
|
||||
}
|
||||
.footer div:last-child::after {
|
||||
content: none;
|
||||
margin-left: 0;
|
||||
margin-right: 0;
|
||||
}
|
||||
/* TABLES */
|
||||
table {
|
||||
border-collapse: collapse;
|
||||
border-spacing: 0;
|
||||
text-align: left;
|
||||
border-radius: var(--glass-corner-radius);
|
||||
backdrop-filter: var(--glass-blur);
|
||||
}
|
||||
tr {
|
||||
background: var(--glass-bg-color1);
|
||||
}
|
||||
tr:nth-child(2n+2) {
|
||||
background: var(--glass-bg-color2);
|
||||
}
|
||||
/*
|
||||
Rounded corners on table cells apparently don't work with
|
||||
Firefox (91), so Firefox users won't have rounded corners
|
||||
on tables. Won't fix that by myself.
|
||||
*/
|
||||
table tr:first-child th:first-child {
|
||||
border-top-left-radius: var(--glass-corner-radius);
|
||||
}
|
||||
table tr:first-child th:last-child {
|
||||
border-top-right-radius: var(--glass-corner-radius);
|
||||
}
|
||||
table tr:last-child td:first-child {
|
||||
border-bottom-left-radius: var(--glass-corner-radius);
|
||||
}
|
||||
table tr:last-child td:last-child {
|
||||
border-bottom-right-radius: var(--glass-corner-radius);
|
||||
}
|
||||
/* - */
|
||||
td, th {
|
||||
padding: .5rem .8rem;
|
||||
}
|
||||
th {
|
||||
text-align: left;
|
||||
border-bottom: 1px solid var(--color);
|
||||
}
|
||||
/* FORMS */
|
||||
form {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
min-width: 18rem;
|
||||
height: max-content;
|
||||
}
|
||||
form .row {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
margin: .2rem 0;
|
||||
}
|
||||
form .row .column {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
}
|
||||
form h1 {
|
||||
font-size: 1.6rem;
|
||||
margin-bottom: 2rem;
|
||||
}
|
||||
form {
|
||||
font-size: 1.1rem;
|
||||
}
|
||||
form .customNumberInput {
|
||||
width: 100%;
|
||||
}
|
||||
form .statusInfo {
|
||||
margin-top: .5rem;
|
||||
}
|
||||
form .horizontalButtonList {
|
||||
margin-top: 2rem;
|
||||
width: 100%;
|
||||
}
|
||||
form .button, form button {
|
||||
font-size: 1rem;
|
||||
}
|
||||
/* BUTTONS & OTHER INPUT ELEMENTS */
|
||||
.button, button {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-family: var(--font-family);
|
||||
font-size: .9rem;
|
||||
text-decoration: none;
|
||||
text-align: center !important;
|
||||
background: var(--glass-bg);
|
||||
color: var(--color);
|
||||
padding: .6rem .8rem;
|
||||
outline: none;
|
||||
border: 1px solid var(--glass-border-color);
|
||||
border-radius: var(--glass-corner-radius);
|
||||
backdrop-filter: var(--glass-blur);
|
||||
cursor: pointer;
|
||||
user-select: none;
|
||||
}
|
||||
.button:hover, button:hover, .button:active, button:active {
|
||||
background: var(--glass-bg-hover);
|
||||
}
|
||||
.button:disabled, button:disabled {
|
||||
opacity: 40%;
|
||||
}
|
||||
a {
|
||||
color: var(--color);
|
||||
}
|
||||
input[type="number"] {
|
||||
-webkit-appearance: textfield;
|
||||
-moz-appearance: textfield;
|
||||
appearance: textfield;
|
||||
}
|
||||
input[type="number"]::-webkit-inner-spin-button {
|
||||
display: none;
|
||||
}
|
||||
input[type="text"], input[type="password"], input[type="number"] {
|
||||
background: var(--glass-bg-color2);
|
||||
outline: none;
|
||||
padding: .4rem .6rem;
|
||||
font-size: .9rem;
|
||||
color: var(--color);
|
||||
text-align: center;
|
||||
border: none;
|
||||
border-radius: var(--glass-corner-radius);
|
||||
}
|
||||
/**** CUSTOM CLASSES ****/
|
||||
.centeringFlex {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
text-align: center;
|
||||
padding: 2rem 1rem;
|
||||
}
|
||||
.horizontalButtonList {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: flex-end;
|
||||
justify-content: space-between;
|
||||
width: 100%;
|
||||
}
|
||||
.errorText {
|
||||
margin-top: 1rem;
|
||||
color: var(--color-error);
|
||||
}
|
||||
.nodisplay {
|
||||
display: none !important;
|
||||
}
|
||||
/* MISC / GENERAL */
|
||||
h1 {
|
||||
text-align: center;
|
||||
font-size: 1.8rem;
|
||||
}
|
||||
/* MOBILE OPTIMIZATIONS */
|
||||
@media only screen and (max-width: 700px) {
|
||||
.globalMessage span {
|
||||
width: 90%;
|
||||
}
|
||||
.userPanel {
|
||||
flex-direction: column;
|
||||
justify-content: start;
|
||||
align-items: center;
|
||||
}
|
||||
.userPanel > div {
|
||||
margin: 0;
|
||||
margin-bottom: .5rem;
|
||||
}
|
||||
}
|
11
static/css/order.css
Normal file
11
static/css/order.css
Normal file
|
@ -0,0 +1,11 @@
|
|||
main {
|
||||
margin-top: 0;
|
||||
}
|
||||
form {
|
||||
width: 22rem;
|
||||
}
|
||||
@media only screen and (max-width: 700px) {
|
||||
main {
|
||||
margin-top: -15vh;
|
||||
}
|
||||
}
|
69
static/css/statistics.css
Normal file
69
static/css/statistics.css
Normal file
|
@ -0,0 +1,69 @@
|
|||
.mainContainer {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: start;
|
||||
width: 100%;
|
||||
flex-grow: 1;
|
||||
}
|
||||
.statsHeading {
|
||||
min-width: max-content;
|
||||
margin-left: 2rem;
|
||||
margin-top: 0;
|
||||
}
|
||||
.tablesContainer {
|
||||
position: absolute;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: start;
|
||||
width: 95%;
|
||||
margin-top: 5rem;
|
||||
}
|
||||
.statisticsTable {
|
||||
margin-bottom: 2rem;
|
||||
padding-bottom: 1rem;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: start;
|
||||
align-items: center;
|
||||
text-align: center;
|
||||
}
|
||||
.statisticsTable h1 {
|
||||
margin-top: 0;
|
||||
font-size: 1.2rem;
|
||||
text-align: left;
|
||||
min-width: 10rem;
|
||||
text-align: center;
|
||||
}
|
||||
.statisticsTable table {
|
||||
min-width: 20vw;
|
||||
width: fit-content;
|
||||
}
|
||||
.statisticsTable th:last-child {
|
||||
text-align: right;
|
||||
}
|
||||
.statisticsTable td:last-child {
|
||||
text-align: right;
|
||||
}
|
||||
#statisticsDropDownMenu .dropDownList {
|
||||
z-index: 195;
|
||||
}
|
||||
@media only screen and (max-width: 700px) {
|
||||
.statisticsTable h1 {
|
||||
min-width: 90vw;
|
||||
}
|
||||
.statisticsTable table {
|
||||
min-width: 80vw;
|
||||
}
|
||||
.statisticsTable {
|
||||
margin-bottom: 2rem;
|
||||
padding-bottom: 1rem;
|
||||
}
|
||||
.statsHeading {
|
||||
margin-left: 0;
|
||||
margin-right: 0;
|
||||
padding-top: 1rem;
|
||||
padding-bottom: 2rem;
|
||||
}
|
||||
}
|
BIN
static/favicon.ico
Normal file
BIN
static/favicon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 43 KiB |
BIN
static/favicon.png
Normal file
BIN
static/favicon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 41 KiB |
30
static/js/customNumberInput.js
Normal file
30
static/js/customNumberInput.js
Normal file
|
@ -0,0 +1,30 @@
|
|||
{
|
||||
|
||||
document.addEventListener("DOMContentLoaded", () => {
|
||||
// get all customNumberInput Elements
|
||||
let custom_number_inputs = document.getElementsByClassName("customNumberInput");
|
||||
// Add Event Handler to the elements of the customNumberInputs
|
||||
[...custom_number_inputs].forEach(element => {
|
||||
// number input
|
||||
let numberFieldElement = element.getElementsByClassName("customNumberInputField")[0];
|
||||
// minus button
|
||||
element.getElementsByClassName("customNumberInput-minus")[0].addEventListener("click", () => {
|
||||
alterCustomNumberField(numberFieldElement, -1)
|
||||
});
|
||||
// plus button
|
||||
element.getElementsByClassName("customNumberInput-plus")[0].addEventListener("click", () => {
|
||||
alterCustomNumberField(numberFieldElement, +1)
|
||||
});
|
||||
})
|
||||
})
|
||||
|
||||
function alterCustomNumberField(numberFieldElement, n) {
|
||||
numberFieldElement.value = Math.min(
|
||||
Math.max(
|
||||
(parseInt(numberFieldElement.value) + n), numberFieldElement.min || Number.MIN_VALUE
|
||||
),
|
||||
numberFieldElement.max || Number.MAX_VALUE
|
||||
);
|
||||
}
|
||||
|
||||
}
|
49
static/js/deposit.js
Normal file
49
static/js/deposit.js
Normal file
|
@ -0,0 +1,49 @@
|
|||
document.addEventListener("DOMContentLoaded", () => {
|
||||
|
||||
// elements
|
||||
|
||||
let deposit_form = document.getElementById("depositForm");
|
||||
let status_info = document.getElementById("statusInfo");
|
||||
let deposit_submit_button = document.getElementById("depositSubmitBtn");
|
||||
|
||||
// event listener for deposit form
|
||||
// this implements a custom submit method
|
||||
|
||||
deposit_form.addEventListener("submit", (event) => {
|
||||
|
||||
deposit_submit_button.disabled = true;
|
||||
|
||||
event.preventDefault(); // Don't do the default submit action!
|
||||
|
||||
let xhr = new XMLHttpRequest();
|
||||
let formData = new FormData(deposit_form);
|
||||
|
||||
xhr.addEventListener("load", (event) => {
|
||||
|
||||
status_ = event.target.status;
|
||||
response_ = event.target.responseText;
|
||||
|
||||
if (status_ == 200 && response_ == "success") {
|
||||
status_info.innerText = "Success. Redirecting soon.";
|
||||
window.location.replace("/");
|
||||
}
|
||||
else {
|
||||
status_info.classList.add("errorText");
|
||||
status_info.innerText = "An error occured. Redirecting in 5 seconds...";
|
||||
window.setTimeout(() => { window.location.replace("/") }, 5000);
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
xhr.addEventListener("error", (event) => {
|
||||
status_info.classList.add("errorText");
|
||||
status_info.innerText = "An error occured. Redirecting in 5 seconds...";
|
||||
window.setTimeout(() => { window.location.replace("/") }, 5000);
|
||||
})
|
||||
|
||||
xhr.open("POST", "/api/deposit");
|
||||
xhr.send(formData);
|
||||
|
||||
});
|
||||
|
||||
})
|
1
static/js/logged_out.js
Normal file
1
static/js/logged_out.js
Normal file
|
@ -0,0 +1 @@
|
|||
window.location.replace("/");
|
87
static/js/login.js
Normal file
87
static/js/login.js
Normal file
|
@ -0,0 +1,87 @@
|
|||
{
|
||||
|
||||
// Define variables
|
||||
|
||||
let username_input;
|
||||
let password_input;
|
||||
let submit_button;
|
||||
let username_display;
|
||||
let password_overlay;
|
||||
let pw_overlay_cancel;
|
||||
let userlist_buttons;
|
||||
let pinpad_buttons;
|
||||
|
||||
|
||||
// Add event listeners after DOM Content loaded
|
||||
|
||||
document.addEventListener("DOMContentLoaded", () => {
|
||||
|
||||
// elements
|
||||
|
||||
username_input = document.getElementById("id_username");
|
||||
password_input = document.getElementById("id_password");
|
||||
submit_button = document.getElementById("submit_login");
|
||||
password_overlay = document.getElementById("passwordOverlayContainer");
|
||||
pw_overlay_cancel = document.getElementById("pwoCancel");
|
||||
|
||||
userlist_buttons = document.getElementsByClassName("userlistButton");
|
||||
pinpad_buttons = document.getElementsByClassName("pinpadBtn");
|
||||
|
||||
// event listeners
|
||||
|
||||
// [...<html-collection>] converts an html collection to an array
|
||||
|
||||
[...userlist_buttons].forEach(element => {
|
||||
element.addEventListener("click", () => {
|
||||
set_username(element.dataset.username);
|
||||
show_password_overlay();
|
||||
})
|
||||
});
|
||||
|
||||
[...pinpad_buttons].forEach(element => {
|
||||
element.addEventListener("click", () => {
|
||||
pinpad_press(element.dataset.btn);
|
||||
})
|
||||
})
|
||||
|
||||
pw_overlay_cancel.addEventListener("click", () => {
|
||||
hide_password_overlay();
|
||||
});
|
||||
|
||||
})
|
||||
|
||||
|
||||
function set_username(username) {
|
||||
username_input.value = username;
|
||||
}
|
||||
|
||||
function show_password_overlay() {
|
||||
|
||||
window.scrollTo(0, 0);
|
||||
password_overlay.classList.remove("nodisplay");
|
||||
document.body.classList.add("overflowHidden");
|
||||
//password_input.focus();
|
||||
|
||||
}
|
||||
|
||||
function hide_password_overlay() {
|
||||
|
||||
password_overlay.classList.add("nodisplay");
|
||||
document.body.classList.remove("overflowHidden");
|
||||
password_input.value = "";
|
||||
|
||||
}
|
||||
|
||||
function pinpad_press(key) {
|
||||
if (key == "enter") {
|
||||
submit_button.click();
|
||||
}
|
||||
else if (key == "x") {
|
||||
password_input.value = "";
|
||||
}
|
||||
else {
|
||||
password_input.value += key;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
21
static/js/main.js
Normal file
21
static/js/main.js
Normal file
|
@ -0,0 +1,21 @@
|
|||
document.addEventListener("DOMContentLoaded", () => {
|
||||
|
||||
let dropDownMenuElement = document.getElementById("dropDownMenu");
|
||||
let dropDownMenuButtonElement = document.getElementById("dropDownMenuButton");
|
||||
|
||||
if (dropDownMenuButtonElement != null) {
|
||||
|
||||
dropDownMenuButtonElement.addEventListener("click", () => {
|
||||
|
||||
if (dropDownMenuElement.classList.contains("dropDownVisible")) {
|
||||
dropDownMenuElement.classList.remove("dropDownVisible");
|
||||
}
|
||||
else {
|
||||
dropDownMenuElement.classList.add("dropDownVisible");
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
})
|
75
static/js/order.js
Normal file
75
static/js/order.js
Normal file
|
@ -0,0 +1,75 @@
|
|||
document.addEventListener("DOMContentLoaded", () => {
|
||||
|
||||
// elements
|
||||
|
||||
let order_number_of_drinks_input = document.getElementById("numberOfDrinks");
|
||||
let order_number_of_drinks_btn_a = document.getElementById("numberOfDrinksBtnA");
|
||||
let order_number_of_drinks_btn_b = document.getElementById("numberOfDrinksBtnB");
|
||||
let order_sum_element = document.getElementById("orderCalculatedSum");
|
||||
|
||||
let order_form = document.getElementById("orderForm");
|
||||
let status_info = document.getElementById("statusInfo");
|
||||
let order_submit_button = document.getElementById("orderSubmitBtn");
|
||||
|
||||
|
||||
// calculate & display sum
|
||||
|
||||
let order_price_per_drink = parseFloat(document.getElementById("pricePerDrink").dataset.drinkPrice);
|
||||
|
||||
function calculate_and_display_sum() {
|
||||
|
||||
setTimeout(() => {
|
||||
|
||||
let number_of_drinks = parseFloat(order_number_of_drinks_input.value);
|
||||
let calculated_sum = order_price_per_drink * number_of_drinks;
|
||||
order_sum_element.innerText = new Intl.NumberFormat(undefined, {minimumFractionDigits: 2}).format(calculated_sum);
|
||||
|
||||
}, 25);
|
||||
|
||||
}
|
||||
|
||||
order_number_of_drinks_input.addEventListener("input", calculate_and_display_sum);
|
||||
order_number_of_drinks_btn_a.addEventListener("click", calculate_and_display_sum);
|
||||
order_number_of_drinks_btn_b.addEventListener("click", calculate_and_display_sum);
|
||||
|
||||
|
||||
// custom submit method
|
||||
|
||||
order_form.addEventListener("submit", (event) => {
|
||||
|
||||
order_submit_button.disabled = true;
|
||||
|
||||
event.preventDefault(); // Don't do the default submit action!
|
||||
|
||||
let xhr = new XMLHttpRequest();
|
||||
let formData = new FormData(order_form);
|
||||
|
||||
xhr.addEventListener("load", (event) => {
|
||||
|
||||
status_ = event.target.status;
|
||||
response_ = event.target.responseText;
|
||||
|
||||
if (status_ == 200 && response_ == "success") {
|
||||
status_info.innerText = "Success.";
|
||||
window.location.replace("/");
|
||||
}
|
||||
else {
|
||||
status_info.classList.add("errorText");
|
||||
status_info.innerText = "An error occured.";
|
||||
window.setTimeout(() => { window.location.reload() }, 5000);
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
xhr.addEventListener("error", (event) => {
|
||||
status_info.classList.add("errorText");
|
||||
status_info.innerText = "An error occured.";
|
||||
window.setTimeout(() => { window.location.reload() }, 5000);
|
||||
})
|
||||
|
||||
xhr.open("POST", "/api/order-drink");
|
||||
xhr.send(formData);
|
||||
|
||||
});
|
||||
|
||||
})
|
42
static/js/statistics.js
Normal file
42
static/js/statistics.js
Normal file
|
@ -0,0 +1,42 @@
|
|||
{
|
||||
|
||||
let statistics_dropdown_choices;
|
||||
let statistics_tables;
|
||||
|
||||
let dropDownMenuActive = false;
|
||||
|
||||
document.addEventListener("DOMContentLoaded", () => {
|
||||
|
||||
// elements
|
||||
let statistics_dropdown_menu = document.getElementById("statisticsDropDownMenu");
|
||||
let statistics_dropdown_menu_button = document.getElementById("statisticsDropDownMenuButton");
|
||||
statistics_dropdown_choices = [...statistics_dropdown_menu.getElementsByClassName("sChoice")];
|
||||
statistics_tables = [...document.getElementsByClassName("statisticsTable")];
|
||||
|
||||
statistics_dropdown_menu_button.addEventListener("click", () => {
|
||||
if (statistics_dropdown_menu.classList.contains("dropDownVisible")) {
|
||||
statistics_dropdown_menu.classList.remove("dropDownVisible");
|
||||
}
|
||||
else {
|
||||
statistics_dropdown_menu.classList.add("dropDownVisible");
|
||||
}
|
||||
})
|
||||
|
||||
statistics_dropdown_choices.forEach(element => {
|
||||
|
||||
element.addEventListener("click", () => {
|
||||
changeStatisticsChoice(element.innerText, element.dataset.statistics_div);
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
function changeStatisticsChoice(choice_name, div_id) {
|
||||
statistics_tables.forEach(element => {
|
||||
element.classList.add("nodisplay");
|
||||
})
|
||||
document.getElementById(div_id).classList.remove("nodisplay");
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue