summaryrefslogtreecommitdiff
path: root/app/templates
diff options
context:
space:
mode:
authorMarius Peter <marius.peter@tutanota.com>2022-06-05 14:20:40 +0200
committerMarius Peter <marius.peter@tutanota.com>2022-06-05 14:20:40 +0200
commit51c9fed15381421c4b7e8ba95af60b5204483d50 (patch)
tree9d4b9b9d55f44c9be23ab7f33c4a0b19ab9beaec /app/templates
First commit :baby:
Diffstat (limited to 'app/templates')
-rw-r--r--app/templates/base.html50
-rw-r--r--app/templates/home.html90
-rw-r--r--app/templates/modules/add-item.html19
-rw-r--r--app/templates/modules/invoices.html80
-rw-r--r--app/templates/modules/login.html16
-rw-r--r--app/templates/modules/register.html16
-rw-r--r--app/templates/modules/settings.html45
7 files changed, 316 insertions, 0 deletions
diff --git a/app/templates/base.html b/app/templates/base.html
new file mode 100644
index 0000000..7a63ddf
--- /dev/null
+++ b/app/templates/base.html
@@ -0,0 +1,50 @@
+{# -*- mode: web; -*- #}
+
+<!doctype html>
+
+<html lang="en">
+ <head>
+ <meta charset="utf-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to">
+ <title>mdl</title>
+ <meta name="author" content="Marius Peter">
+ <meta name="description" content="A draft page for mdl.">
+ <!-- <link rel="icon" href="{{ url_for('static', filename='img/favicon.png') }}"> -->
+ <link rel="stylesheet" href="{{ url_for('static', filename='styles/style.css') }}">
+ </head>
+ <body>
+ <nav id="user">
+ <div style="display: flex; align-items: baseline;">
+ <ul>
+ <li><a href="https:apps.mlnp.fr" class="button">Apps</a></li>
+ </ul>
+ <h1>{% block title %}{% endblock %}</h1>
+ </div>
+ <ul>
+ {% if current_user.is_authenticated %}
+ <li><a href="{{ url_for('common.settings') }}" class="button">Settings</a></li>
+ <li><a href="{{ url_for('auth.logout') }}" class="button">Logout</a></li>
+ {% else %}
+ <li><a href="{{ url_for('auth.login') }}" class="button">Login</a></li>
+ <li><a href="{{ url_for('auth.register') }}" class="button">Register</a></li>
+ {% endif %}
+ </ul>
+ </nav>
+ <div id="content">
+ {% block content %}{% endblock %}
+ </div>
+ {# Flashed messages added last, so that they appear on top of the content. #}
+ {% with messages = get_flashed_messages(with_categories=true) %}
+ {% if messages %}
+ <div id="flash">
+ <ul>
+ {% for category, message in messages %}
+ <li class="alert alert-{{ category }}">{{ message }}</li>
+ {% endfor %}
+ </ul>
+ </div>
+ {% endif %}
+ {% endwith %}
+ <!-- <script src="js/scripts.js"></script> -->
+ </body>
+</html>
diff --git a/app/templates/home.html b/app/templates/home.html
new file mode 100644
index 0000000..e4e690f
--- /dev/null
+++ b/app/templates/home.html
@@ -0,0 +1,90 @@
+{# -*- mode: web; -*- #}
+
+{% extends "base.html" %}
+
+{% block title %}
+{% if current_user.is_authenticated %}
+Welcome, {{ user.name_first }} {{ user.name_last }}!
+{% else %}
+Welcome to <code>mdl</code>, the music downloader
+{% endif %}
+{% endblock %}
+
+{% block actions %}
+{# <li><a href="{{ url_for('main.download_database') }}" class="button">Download database</a></li> #}
+{% endblock %}
+
+{% block content %}
+{% if current_user.is_authenticated %}
+<div id="downloads">
+ <div id="download-new">
+ <h2>New</h2>
+ <form action="{{ url_for('main.download_remote') }}" method="POST">
+ <fieldset>
+ <legend>Download audio from a URL to the server.</legend>
+ {% with form = form_download_remote %}
+ {{ form.csrf_token }}
+ {{ form.url.label() }}
+ {{ form.url() }}
+ {{ form.download_remote() }}
+ {% endwith %}
+ </fieldset>
+ </form>
+ </div>
+ {% if pending_files %}
+ <div id="download-pending">
+ <h2>Pending</h2>
+ {% for file in pending_files %}
+ <form action="#" method="POST">
+ <fieldset>
+ <legend>{{ file }}</legend>
+ </fieldset>
+ </form>
+ {% endfor %}
+ </div>
+ {% endif %}
+ {% if downloaded_files %}
+ <div id="download-finished">
+ <h2>Finished</h2>
+ {% for file in downloaded_files %}
+ <form action="{{ url_for('main.manage_remote') }}" method="POST">
+ <fieldset>
+ <legend>{{ file }}</legend>
+ {% with form = form_manage_remote %}
+ {{ form.csrf_token }}
+ {{ form.file_name(value=file) }}
+ {{ form.download_local() }}
+ {{ form.remove_remote() }}
+ {% endwith %}
+ </fieldset>
+ </form>
+ {% endfor %}
+ </div>
+ {% endif %}
+</div>
+<h2>Download history</h2>
+<table>
+ <thead>
+ <tr>
+ <th>ID</th>
+ <th>Title</th>
+ <th>Downloaded</th>
+ <th>User</th>
+ </tr>
+ </thead>
+ <tbody>
+ {% for file in download_history %}
+ <tr>
+ <td>{{ file.primary_key }}</td>
+ <td><a href="{{ file.url }}">{{ file.title }}</a></td>
+ <td>{{ file.date_time_downloaded }}</td>
+ <td>{{ file.user.username }}</td>
+ </tr>
+ {% endfor %}
+ </tbody>
+</table>
+{% else %}
+<p>You need to be logged in before using this web app.</p>
+{% endif %}
+
+{% endblock %}
diff --git a/app/templates/modules/add-item.html b/app/templates/modules/add-item.html
new file mode 100644
index 0000000..4eaee3d
--- /dev/null
+++ b/app/templates/modules/add-item.html
@@ -0,0 +1,19 @@
+{# -*- mode: web; -*- #}
+
+{% extends "base.html" %}
+
+
+{% block title %}Add {{ table }} item{% endblock %}
+{% block content %}
+
+<form action="{{ request.path }}" method="POST">
+ <fieldset>
+ <legend>Add a new item to our {{ table }} table.</legend>
+ {% for field in form %}
+ {{ field.label() }}<br/>
+ {{ field() }}<br/>
+ {% endfor %}
+ </fieldset>
+</form>
+
+{% endblock %}
diff --git a/app/templates/modules/invoices.html b/app/templates/modules/invoices.html
new file mode 100644
index 0000000..9e8f765
--- /dev/null
+++ b/app/templates/modules/invoices.html
@@ -0,0 +1,80 @@
+{# -*- mode: web; -*- #}
+
+{% extends "base.html" %}
+{% block title %}
+Invoices
+{% endblock %}
+
+{% block actions %}
+<li><a href="{{ url_for('common.add_item', module='invoices', table='Invoice') }}" class="button">Add invoice</a></li>
+<li></li>
+{% endblock %}
+
+{% block content %}
+<i>Track your invoices and create new ones here.</i><br/>
+
+{# Pagination Links #}
+{# gotten from https://betterprogramming.pub/simple-flask-pagination-example-4190b12c2e2e #}
+<center>
+ {# Loop through the number of pages to display a link for each #}
+ {% for page_num in invoices.iter_pages(left_edge=1, right_edge=1, left_current=1, right_current=2) %}
+ {% if page_num %}
+ {# Check for the active page and set the link to "Active" #}
+ {% if invoices.page == page_num %}
+ <a href="{{ url_for('invoices.view', page=page_num) }}"
+ class="button">
+ {{ page_num }}
+ </a>
+ {% else %}
+ <a href="{{ url_for('invoices.view', page=page_num) }}"
+ class="button button-light">
+ {{ page_num }}
+ </a>
+ {% endif %}
+ {% else %}
+ ...
+ {% endif %}
+ {% endfor %}
+</center>
+<table>
+ <thead>
+ <tr>
+ <th></th>
+ <th>ID</th>
+ <th>Created</th>
+ <th>Alternative Invoice ID</th>
+ <th>Customer Name</th>
+ <th>Customer Reference</th>
+ <th>Date Billed</th>
+ <th>Date Due</th>
+ <th>Amount (Net €)</th>
+ <th>Amount (Gross €)</th>
+ <th>Tax Amount (€)</th>
+ </tr>
+ </thead>
+ <tbody>
+ {% for invoice in invoices.items %}
+ <tr {% if invoice.archive == True %} style="color: dimgray" {% endif %}>
+ <td>
+ <form method="post" action="{{ url_for('common.edit_item', module='invoices', pk=invoice.primary_key, table='Invoice') }}">
+ <button>archive</button>
+ </form>
+ <form method="get" action="{{ url_for('invoices.preview', pk=invoice.primary_key) }}">
+ <button>preview</button>
+ </form>
+ </td>
+ <td>{{ invoice.primary_key }}</td>
+ <td>{{ invoice.date_time_created }}</td>
+ <td>{{ invoice.invoice_id_alt }}</td>
+ <td>{{ invoice.customer.name }}</td>
+ <td>{{ invoice.customer_reference }}</td>
+ <td>{{ invoice.date_billed }}</td>
+ <td>{{ invoice.date_due }}</td>
+ <td>{{ invoice.amount_net }}</td>
+ <td>{{ invoice.amount_gross }}</td>
+ <td>{{ invoice.amount_tax }}</td>
+ </tr>
+ {% endfor %}
+ </tbody>
+</table>
+{% endblock %}
diff --git a/app/templates/modules/login.html b/app/templates/modules/login.html
new file mode 100644
index 0000000..e66e6a4
--- /dev/null
+++ b/app/templates/modules/login.html
@@ -0,0 +1,16 @@
+{# -*- mode: web; -*- #}
+
+{% extends "base.html" %}
+
+{# the login form #}
+{% block content %}
+<form action="{{ url_for('auth.login') }}" method="POST">
+ <fieldset>
+ <legend>Login</legend>
+ {% for field in form %}
+ {{ field.label() }}
+ {{ field() }}<br/>
+ {% endfor %}
+ </fieldset>
+</form>
+{% endblock %}
diff --git a/app/templates/modules/register.html b/app/templates/modules/register.html
new file mode 100644
index 0000000..76fc1e2
--- /dev/null
+++ b/app/templates/modules/register.html
@@ -0,0 +1,16 @@
+{# -*- mode: web; -*- #}
+
+{% extends "base.html" %}
+
+{# the register form #}
+{% block content %}
+<form action="{{ url_for('auth.register') }}" method="POST">
+ <fieldset>
+ <legend>Register</legend>
+ {% for field in form %}
+ {{ field.label() }}
+ {{ field() }}<br/>
+ {% endfor %}
+ </fieldset>
+</form>
+{% endblock %}
diff --git a/app/templates/modules/settings.html b/app/templates/modules/settings.html
new file mode 100644
index 0000000..392ab47
--- /dev/null
+++ b/app/templates/modules/settings.html
@@ -0,0 +1,45 @@
+{# -*- mode: web; -*- #}
+
+{% extends "base.html" %}
+
+{% block title %}
+Settings for user {{ current_user.username }}
+{% endblock %}
+
+{% block content %}
+
+<p>Welcome, {{ current_user.name_first }} {{ current_user.name_last }}!</p>
+
+<h2>User profile</h2>
+
+<form method="post" action="{{ url_for('common.edit_item', module='settings', pk=current_user.primary_key, table='User' ) }}">
+ <button>edit</button>
+</form>
+
+<table>
+ <thead>
+ <tr>
+ <th>Field</th>
+ <th>Value</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>Username</td>
+ <td>{{ current_user.username }}</td>
+ </tr>
+ <tr>
+ <td>First Name</td>
+ <td>{{ current_user.name_first }}</td>
+ </tr>
+ <tr>
+ <td>Last Name</td>
+ <td>{{ current_user.name_last }}</td>
+ </tr>
+ <tr>
+ <td> Last Updated</td>
+ <td>{{ current_user.date_time_updated }}</td>
+ </tr>
+ </tbody>
+</table>
+{% endblock %}
Copyright 2019--2024 Marius PETER