summaryrefslogtreecommitdiffstats
path: root/templates
diff options
context:
space:
mode:
authorJokler <jokler@protonmail.com>2020-06-21 06:37:46 +0200
committerJokler <jokler@protonmail.com>2020-06-21 06:37:46 +0200
commite6468b012d5b33dd16992652da57f11dd5a6e82f (patch)
treee89add440df79d4036b9b44d8c77ee6d69e67201 /templates
downloadjoklerpoints-e6468b012d5b33dd16992652da57f11dd5a6e82f.tar.gz
joklerpoints-e6468b012d5b33dd16992652da57f11dd5a6e82f.zip
Initial commitHEADmaster
Diffstat (limited to 'templates')
-rw-r--r--templates/admin.htm22
-rw-r--r--templates/base.htm18
-rw-r--r--templates/login.htm19
-rw-r--r--templates/settings.htm31
-rw-r--r--templates/transactions.htm40
-rw-r--r--templates/transfer.htm31
6 files changed, 161 insertions, 0 deletions
diff --git a/templates/admin.htm b/templates/admin.htm
new file mode 100644
index 0000000..db4aa03
--- /dev/null
+++ b/templates/admin.htm
@@ -0,0 +1,22 @@
+{% extends "base.htm" %}
+
+{% block title %}Administration{% endblock %}
+
+{% block content %}
+<h1>User Creation</h1>
+<form class="fixed-form" action="/admin" method="POST">
+ <label for="user">Username</label>
+ <input type="text" placeholder="Enter Username" name="user" required>
+
+ <label for="password">Password</label>
+ <input type="password" placeholder="Enter Password" name="password" required>
+
+ <label for="user">Balance</label>
+ <input type="text" placeholder="Enter Balance" name="balance" required>
+
+ <button type="submit">Create User</button>
+</form>
+{% endblock %}
+
+<!-- vim: expandtab sw=2 ts=2
+-->
diff --git a/templates/base.htm b/templates/base.htm
new file mode 100644
index 0000000..b55244d
--- /dev/null
+++ b/templates/base.htm
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<html lang="en">
+ <head>
+ <meta charset="UTF-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+ <meta http-equiv="X-UA-Compatible" content="ie=edge">
+ <link rel="stylesheet" href="/static/css/style.css">
+ <title>{% block title %}{{ title }} - xyz {% endblock %}</title>
+ </head>
+ <body>
+ <main>
+ {% block content %}{% endblock %}
+ </main>
+ </body>
+</html>
+
+<!-- vim: expandtab sw=2 ts=2
+-->
diff --git a/templates/login.htm b/templates/login.htm
new file mode 100644
index 0000000..e107aeb
--- /dev/null
+++ b/templates/login.htm
@@ -0,0 +1,19 @@
+{% extends "base.htm" %}
+
+{% block title %}Login{% endblock %}
+
+{% block content %}
+<h1>Login</h1>
+{% if failed -%}
+ <div class="error">Invalid Login Data</div>
+{% endif -%}
+<form class="fixed-form" action="/login" method="POST">
+ <input type="text" placeholder="Enter Username" name="user" required>
+ <input type="password" placeholder="Enter Password" name="password" required>
+
+ <button type="submit">Login</button>
+</form>
+{% endblock %}
+
+<!-- vim: expandtab sw=2 ts=2
+-->
diff --git a/templates/settings.htm b/templates/settings.htm
new file mode 100644
index 0000000..5b53a64
--- /dev/null
+++ b/templates/settings.htm
@@ -0,0 +1,31 @@
+{% extends "base.htm" %}
+
+{% block title %}Settings{% endblock %}
+
+{% block content %}
+<h1>User Settings</h1>
+
+<h2>Change Password</h2>
+<a class="button" href="/transactions">Go Back</a>
+
+{% match result %}
+ {% when PasswordResult::Success %}
+ <div class="success">Password change was successful</div>
+ {% when PasswordResult::InvalidOld -%}
+ <div class="error">Old password was incorrect</div>
+ {% when PasswordResult::Missmatch -%}
+ <div class="error">New passwords were not the same</div>
+ {% when PasswordResult::Empty -%}
+{% endmatch %}
+
+<form class="fixed-form highlight-bg" action="/reset-password" method="POST">
+ <input type="password" placeholder="Enter Old Password" name="old-password" required>
+ <input type="password" placeholder="Enter New Password" name="new-password" required>
+ <input type="password" placeholder="Re-Enter New Password" name="confirm-password" required>
+
+ <button type="submit">Confirm</button>
+</form>
+{% endblock %}
+
+<!-- vim: expandtab sw=2 ts=2
+-->
diff --git a/templates/transactions.htm b/templates/transactions.htm
new file mode 100644
index 0000000..f2b93ba
--- /dev/null
+++ b/templates/transactions.htm
@@ -0,0 +1,40 @@
+{% extends "base.htm" %}
+
+{% block title %}Transactions{% endblock %}
+
+{% block content %}
+<h1>{{ name }}'s Transactions</h1>
+<h2>{{ amount|fmt_points }}</h2>
+<div class="settings">
+ <a class="button" href="/transfer">Transfer Points</a>
+ <a class="button" href="/settings">Settings</a>
+ <a class="button" href="/logout">Logout</a>
+</div>
+<table>
+ <tr>
+ <td>Time</td>
+ <td>Amount</td>
+ <td>Balance</td>
+ <td>Other</td>
+ <td>Purpose</td>
+ </tr>
+ {% for transaction in transactions %}
+ <tr>
+ <td>{{ transaction.date }}</td>
+ {% if name == transaction.sender -%}
+ <td class="minus text-right">-{{ transaction.amount }}</td>
+ <td class="text-right">{{ transaction.sender_balance }}</td>
+ <td>{{ transaction.receiver }}</td>
+ {% else -%}
+ <td class="plus text-right">{{ transaction.amount }}</td>
+ <td class="text-right">{{ transaction.receiver_balance }}</td>
+ <td>{{ transaction.sender }}</td>
+ {% endif -%}
+ <td>{{ transaction.purpose }}</td>
+ </tr>
+ {% endfor %}
+</table>
+{% endblock %}
+
+<!-- vim: expandtab sw=2 ts=2
+-->
diff --git a/templates/transfer.htm b/templates/transfer.htm
new file mode 100644
index 0000000..1c484db
--- /dev/null
+++ b/templates/transfer.htm
@@ -0,0 +1,31 @@
+{% extends "base.htm" %}
+
+{% block title %}Transfer Points{% endblock %}
+
+{% block content %}
+<h1>Transfer Points</h1>
+<h2>{{ balance|fmt_points }}</h2>
+<a class="button" href="/transactions">Go Back</a>
+
+{% match error %}
+ {% when TransferResult::ZeroPoints %}
+ <div class="error">You have to send at least 1 JKP</div>
+ {% when TransferResult::SelfSend %}
+ <div class="error">You can not send points to yourself</div>
+ {% when TransferResult::TransferError %}
+ <div class="error">An error occured during the transfer</div>
+ {% when TransferResult::Empty %}
+{% endmatch %}
+
+<form class="fixed-form" action="/transfer" method="POST">
+ <input type="text" placeholder="Enter Receiver" name="recipient" value="{{ recipient }}" required>
+ <input type="text" placeholder="Enter Amount" name="amount"
+ {% if amount != 0 %} value="{{ amount }}" {% endif %} required>
+ <input type="text" placeholder="Enter Purpose" name="purpose" value="{{ purpose }}" required>
+
+ <button type="submit">Doomp eet</button>
+</form>
+{% endblock %}
+
+<!-- vim: expandtab sw=2 ts=2
+-->