summaryrefslogtreecommitdiff
path: root/app/templates
diff options
context:
space:
mode:
authorMarius Peter <marius.peter@tutanota.com>2022-05-15 13:16:37 +0200
committerMarius Peter <marius.peter@tutanota.com>2022-05-15 13:16:37 +0200
commit1dad22d3e45d6506c8624e3a7111240fcc4ab786 (patch)
tree35d2c1e84215c6e6a52979bbff0cbc2e8cf77ace /app/templates
parent3aee6067123cd8afd985f68847e6bb476a853bb0 (diff)
Templates.
Diffstat (limited to 'app/templates')
-rw-r--r--app/templates/base.html41
-rw-r--r--app/templates/errors/item-not-found.html2
-rw-r--r--app/templates/errors/table-not-found.html14
-rw-r--r--app/templates/home.html26
-rw-r--r--app/templates/modules-promo.html22
-rw-r--r--app/templates/modules/add-invoice.html (renamed from app/templates/add-invoice.html)0
-rw-r--r--app/templates/modules/add-item.html (renamed from app/templates/add-item.html)7
-rw-r--r--app/templates/modules/customers.html18
-rw-r--r--app/templates/modules/edit-item.html19
-rw-r--r--app/templates/modules/ferti.html (renamed from app/templates/modules/logger.html)65
-rw-r--r--app/templates/modules/invoice-preview.html (renamed from app/templates/preview-invoice.html)20
-rw-r--r--app/templates/modules/invoices.html96
-rw-r--r--app/templates/modules/login.html16
-rw-r--r--app/templates/modules/orders.html8
-rw-r--r--app/templates/modules/products.html18
-rw-r--r--app/templates/modules/register.html16
-rw-r--r--app/templates/modules/settings.html57
17 files changed, 316 insertions, 129 deletions
diff --git a/app/templates/base.html b/app/templates/base.html
index b5f507d..e847149 100644
--- a/app/templates/base.html
+++ b/app/templates/base.html
@@ -13,26 +13,51 @@
<link rel="stylesheet" href="{{ url_for('static', filename='styles/style.css') }}">
</head>
<body>
- <nav>
- <a href="/" class="button">Home</a>
- <h1>{% block title %}{% endblock %}</h1>
+ <nav id="user">
+ <div style="display: flex; align-items: baseline;">
+ <ul>
+ <li><a href="{{ url_for('main.home') }}" class="button">Home</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>
+ {% if current_user.is_authenticated %}
+ <nav id="modules">
<ul>
{% for module in modules %}
<li><a href="/modules/{{ module.name }}" class="button">{{ module.name }}</a></li>
{% endfor %}
+
+ </ul>
+ </nav>
+ <nav id="actions">
+ <ul>
+ {% block actions %}{% endblock %}
</ul>
</nav>
+ {% endif %}
<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 %}
- <ul class="flashes">
- {% for category, message in messages %}
- <li class="alert alert-{{ category }}">{{ message }}</li>
- {% endfor %}
- </ul>
+ <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> -->
diff --git a/app/templates/errors/item-not-found.html b/app/templates/errors/item-not-found.html
index 3afc5db..edc73e2 100644
--- a/app/templates/errors/item-not-found.html
+++ b/app/templates/errors/item-not-found.html
@@ -6,7 +6,7 @@ Item not found
{% block content %}
<p>
- Item <strong>{{item }}</strong> could not found.
+ Item <strong>{{ item }}</strong> could not found.
</p>
<p>
If you'd like to suggest a feature, please send us an e-mail.
diff --git a/app/templates/errors/table-not-found.html b/app/templates/errors/table-not-found.html
new file mode 100644
index 0000000..cc001fd
--- /dev/null
+++ b/app/templates/errors/table-not-found.html
@@ -0,0 +1,14 @@
+{% extends "base.html" %}
+
+{% block title %}
+Table not found
+{% endblock %}
+
+{% block content %}
+<p>
+ Table <strong>{{ table }}</strong> could not found.
+</p>
+<p>
+ If you'd like to suggest a feature, please send us an e-mail.
+</p>
+{% endblock %}
diff --git a/app/templates/home.html b/app/templates/home.html
index f518554..ace98e9 100644
--- a/app/templates/home.html
+++ b/app/templates/home.html
@@ -3,20 +3,32 @@
{% extends "base.html" %}
{% block title %}
-Welcome, {{ user.name_first }}!
+{% if current_user.is_authenticated %}
+Welcome, {{ user.name_first }} {{ user.name_last }}!
+{% else %}
+Welcome to the ERP for the FAPG!
+{% endif %}
{% endblock %}
+{% block actions %}
+<li><a href="{{ url_for('main.download_database') }}" class="button">Download database</a></li>
+{% endblock %}
{% block content %}
-
-<p>You are logged in as <strong>{{ user }}</strong> on
- project <strong>{{ project }}</strong>.</p>
-
<h2>Available modules</h2>
<dl>
{% for module in modules %}
- <dt style="font-weight: bold">{{ module.name }}</dt><dd>{{ module.description }}<dd>
- {% endfor %}
+ <dt>
+ {% if current_user.is_authenticated %}
+ {# Send to actual module page #}
+ <a href="/modules/{{ module.name }}">{{ module.name }}</a>
+ {% else %}
+ {# Send to module promo section #}
+ <a href="/modules#{{ module.name }}">{{ module.name }}</a>
+ {% endif %}
+ </dt>
+ <dd>{{ module.description }}</dd>
+ {% endfor %}
</dl>
{% endblock %}
diff --git a/app/templates/modules-promo.html b/app/templates/modules-promo.html
new file mode 100644
index 0000000..46b8964
--- /dev/null
+++ b/app/templates/modules-promo.html
@@ -0,0 +1,22 @@
+{# -*- mode: web; -*- #}
+
+{% extends "base.html" %}
+
+{% block title %}
+List of modules
+{% endblock %}
+
+{% block actions %}
+{% endblock %}
+
+{% block content %}
+<h2>Modules for all your needs!</h2>
+<dl>
+ {% for module in modules %}
+ <p>
+{{ module }}
+ </p>
+ {% endfor %}
+</dl>
+
+{% endblock %}
diff --git a/app/templates/add-invoice.html b/app/templates/modules/add-invoice.html
index 92748be..92748be 100644
--- a/app/templates/add-invoice.html
+++ b/app/templates/modules/add-invoice.html
diff --git a/app/templates/add-item.html b/app/templates/modules/add-item.html
index acffa87..356ce9f 100644
--- a/app/templates/add-item.html
+++ b/app/templates/modules/add-item.html
@@ -3,13 +3,12 @@
{% extends "base.html" %}
-{% block title %}Add a new {{ item }}{% endblock %}
+{% block title %}Add {{ table }} item{% endblock %}
{% block content %}
-{# the form #}
-<form action="{{ url_for('add_item', item=item) }}" method="POST">
+<form action="{{ request.path }}" method="POST">
<fieldset>
- <legend>Add a new {{ item }} to our database.</legend>
+ <legend>Add a new item to our {{ table }} table.</legend>
{% for field in form %}
{{ field.label() }}
{{ field() }}<br/>
diff --git a/app/templates/modules/customers.html b/app/templates/modules/customers.html
index c693097..64ed4c2 100644
--- a/app/templates/modules/customers.html
+++ b/app/templates/modules/customers.html
@@ -5,15 +5,17 @@
Customers
{% endblock %}
+{% block actions %}
+<li><a href="{{ url_for('common.add_item', module='customers', table='Customer' ) }}" class="button">Add customer</a></li>
+{% endblock %}
+
{% block content %}
-<div id="actions">
- <a href="{{ url_for('add_item', item='customer') }}" class="button">Add customer</a>
-</div>
<table>
<thead>
<tr>
<th></th>
+ <th>ID</th>
<th>Name</th>
<th>City</th>
<th>Phone</th>
@@ -23,7 +25,15 @@ Customers
<tbody>
{% for customer in customers %}
<tr>
- <td><button>edit</button></td>
+ <td>
+ <form method="post" action="{{ url_for('common.edit_item', module='customers', pk=customer.primary_key, table='Customer') }}">
+ <button>edit</button>
+ </form>
+ <form method="post" action="{{ url_for('common.delete_item', module='customers', pk=customer.primary_key, table='Customer') }}">
+ <button>delete</button>
+ </form>
+ </td>
+ <td>{{ customer.primary_key }}</td>
{% if customer.website %}
<td><a href="{{ customer.website }}">{{ customer.name }}</a></td>
{% else %}
diff --git a/app/templates/modules/edit-item.html b/app/templates/modules/edit-item.html
new file mode 100644
index 0000000..194aa77
--- /dev/null
+++ b/app/templates/modules/edit-item.html
@@ -0,0 +1,19 @@
+{# -*- mode: web; -*- #}
+
+{% extends "base.html" %}
+
+
+{% block title %}Edit {{ table }} item{% endblock %}
+{% block content %}
+
+<form action="{{ request.path }}" method="POST">
+ <fieldset>
+ <legend>Edit item #{{ pk }} in our {{ table }} table.</legend>
+ {% for field in form %}
+ {{ field.label() }}
+ {{ field() }}<br/>
+ {% endfor %}
+ </fieldset>
+</form>
+
+{% endblock %}
diff --git a/app/templates/modules/logger.html b/app/templates/modules/ferti.html
index f3321e9..549059b 100644
--- a/app/templates/modules/logger.html
+++ b/app/templates/modules/ferti.html
@@ -6,22 +6,20 @@
Logger
{% endblock %}
-{% block content %}
-
+{% block actions %}
+<li><a href="{{ url_for('common.add_item', module='ferti', table='FertiLog') }}" class="button">Add log</a></li>
+<li><a href="{{ url_for('common.add_item', module='ferti', table='FertiTarget') }}" class="button">Add target</a></li>
+{% endblock %}
-<div id="actions">
- <a href="{{ url_for('add_item', item='log') }}" class="button">Add log</a>
-</div>
+{% block content %}
<i>Track operating logs.</i>
-<p>Most recent target</p>
<table>
<thead>
<tr>
<th colspan=2><i>Actions</i></th>
<th>ID</th>
- <th>Type</th>
<th>Updated</th>
<th>NNO3</th>
<th>P</th>
@@ -42,17 +40,11 @@ Logger
</tr>
</thead>
<tbody>
- <tr>
- <td>
- <button>edit</button>
- </td>
- <td>
- <form method="post" action="{{ url_for('delete_item', pk=target.primary_key, table='Log' ) }}">
- <button>delete</button>
- </form>
- </td>
+ {% if target %}
+ <tr class="latest-target">
+ <td></td>
+ <td></td>
<td>{{ target.primary_key }}</td>
- <td>Target</td>
<td>{{ target.date_time_updated }}</td>
<td>{{ target.nno3 }}</td>
<td>{{ target.p }}</td>
@@ -71,53 +63,18 @@ Logger
<td>{{ target.si }}</td>
<td>{{ target.nnh4 }}</td>
</tr>
- </tbody>
-</table>
-
-<p>Logs</p>
-
-<table>
- <thead>
- <tr>
- <th colspan=2><i>Actions</i></th>
- <th>ID</th>
- <th>Type</th>
- <th>Updated</th>
- <th>NNO3</th>
- <th>P</th>
- <th>K</th>
- <th>Ca</th>
- <th>Mg</th>
- <th>S</th>
- <th>Na</th>
- <th>Cl</th>
- <th>Fe</th>
- <th>Zn</th>
- <th>B</th>
- <th>Mn</th>
- <th>Cu</th>
- <th>Mo</th>
- <th>Si</th>
- <th>NNH4</th>
- </tr>
- </thead>
- <tbody>
+ {% endif %}
{% for log in logs %}
<tr>
<td>
<button>edit</button>
</td>
<td>
- <form method="post" action="{{ url_for('delete_item', pk=log.primary_key, table='Log' ) }}">
+ <form method="post" action="{{ url_for('modules.delete_item', pk=log.primary_key, table='Fertilog' ) }}">
<button>delete</button>
</form>
</td>
<td>{{ log.primary_key }}</td>
- {% if log.target == "True" %}
- <td>Target</td>
- {% else %}
- <td>Log</td>
- {% endif %}
<td>{{ log.date_time_updated }}</td>
<td>{{ log.nno3 }}</td>
<td>{{ log.p }}</td>
diff --git a/app/templates/preview-invoice.html b/app/templates/modules/invoice-preview.html
index 5ddeb00..f86f9a2 100644
--- a/app/templates/preview-invoice.html
+++ b/app/templates/modules/invoice-preview.html
@@ -6,7 +6,7 @@
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to">
- <title>New Invoice for {{ customer.name }}</title>
+ <title>Invoice preview for {{ invoice.customer.name }}</title>
<meta name="author" content="Marius Peter">
<meta name="description" content="A new invoice for your project.">
<!-- <link rel="icon" href="{{ url_for('static', filename='img/favicon.png') }}"> -->
@@ -19,8 +19,8 @@
<img src="{{ url_for('static', filename='img/logo.png') }}">
</div>
<div id="company">
- <h2 class="name">Company Name</h2>
- <div>455 Foggy Heights, AZ 85004, US</div>
+ <h2 class="name">FAPG</h2>
+ <div>Route de Versonnex</div>
<div>(602) 519-0450</div>
<div><a href="mailto:company@example.com">company@example.com</a></div>
</div>
@@ -30,14 +30,16 @@
<div id="details" class="clearfix">
<div id="client">
<div class="to">INVOICE TO:</div>
- <h2 class="name">John Doe</h2>
- <div class="address">796 Silver Harbour, TX 79273, US</div>
- <div class="email"><a href="mailto:john@example.com">john@example.com</a></div>
+ <h2 class="name">{{ invoice.customer.name }}</h2>
+ <div class="address">{{ invoice.customer.address }}</div>
+ {% if invoice.customer.email %}
+ <div class="email"><a href="mailto:{{ invoice.customer.email }}">{{ invoice.customer.email }}</a></div>
+ {% endif %}
</div>
<div id="invoice">
- <h1>INVOICE 3-2-1</h1>
- <div class="date">Date of Invoice: 01/06/2014</div>
- <div class="date">Due Date: 30/06/2014</div>
+ <h1>INVOICE {{ invoice.invoice_id_alt }}</h1>
+ <div class="date">Date of Invoice: {{ invoice.date_billed }}</div>
+ <div class="date">Due Date: {{ invoice.date_due }}</div>
</div>
</div>
<table cellspacing="0" cellpadding="0" border="0">
diff --git a/app/templates/modules/invoices.html b/app/templates/modules/invoices.html
index 76fe267..55a4b87 100644
--- a/app/templates/modules/invoices.html
+++ b/app/templates/modules/invoices.html
@@ -1,44 +1,80 @@
-{# -*- mode: jinja2; -*- #}
+{# -*- mode: web; -*- #}
{% extends "base.html" %}
{% block title %}
- Products
+Invoices
{% endblock %}
-{% block content %}
+{% block actions %}
+<li><a href="{{ url_for('common.add_item', module='invoices', table='Invoice') }}" class="button">Add invoice</a></li>
+<li></li>
+{% endblock %}
- <div id="actions">
- <a href="{{ url_for('add_invoice') }}" class="button">New invoice</a>
- </div>
+{% block content %}
+<i>Track your invoices and create new ones here.</i><br/>
- <i>Track your invoices and create new ones here.</i>
-
- <table>
+<center>
+{% 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 colspan=2><i>Actions</i></th>
- <th>Name</th>
- <th>Price (net)</th>
- <th>Price (gross)</th>
- <th>Updated</th>
- </tr>
+ <tr>
+ <th><i>Actions</i></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 %}
+ {% for invoice in invoices.items %}
<tr>
- <td><button>edit</button></td>
- <td><button formaction="/">delete</button></td>
- <td>{{ product.name }}</td>
- <td>{{ product.price_net }}</td>
- <td>{{ product.price_gross }}</td>
- {% if product.date_time_updated %}
- <td>{{ product.date_time_updated }}</td>
- {% else %}
- <td>{{ product.date_time_created }}</td>
- {% endif %}
-
+ <td>
+ <form method="post" action="{{ url_for('common.delete_item', module='invoices', pk=invoice.primary_key, table='Invoice') }}">
+ <button>delete</button>
+ </form>
+ <form method="post" action="{{ url_for('common.edit_item', module='invoices', pk=invoice.primary_key, table='Invoice') }}">
+ <button>edit</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 %}
+ {% endfor %}
</tbody>
- </table>
+</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/orders.html b/app/templates/modules/orders.html
index bf94d3d..fd0c13b 100644
--- a/app/templates/modules/orders.html
+++ b/app/templates/modules/orders.html
@@ -5,13 +5,13 @@
Orders
{% endblock %}
+{% block actions %}
+<a href="{{ url_for('add_item', item='order') }}" class="button">Add order</a>
+{% endblock %}
+
{% block content %}
<i>Track your orders and their payment status here.</i>
-<p>
- <a href="{{ url_for('add_item', item='order') }}" class="button">Add order</a>
-</p>
-
<table>
<thead>
<tr>
diff --git a/app/templates/modules/products.html b/app/templates/modules/products.html
index 97b692a..fda1afd 100644
--- a/app/templates/modules/products.html
+++ b/app/templates/modules/products.html
@@ -5,12 +5,11 @@
Products
{% endblock %}
-{% block content %}
-
+{% block actions %}
+<li><a href="{{ url_for('common.add_item', module='products', table='Product') }}" class="button">Add product</a></li>
+{% endblock %}
-<div id="actions">
- <a href="{{ url_for('add_item', item='product') }}" class="button">Add product</a>
-</div>
+{% block content %}
<i>Track products you sell here.</i>
@@ -18,6 +17,7 @@ Products
<thead>
<tr>
<th colspan=2><i>Actions</i></th>
+ <th>ID</th>
<th>Name</th>
<th>Price (net)</th>
<th>Price (gross)</th>
@@ -28,13 +28,15 @@ Products
{% for product in products %}
<tr>
<td>
- <button>edit</button>
- </td>
+ <form method="post" action="{{ url_for('common.edit_item', module='products', pk=product.primary_key, table='Product') }}">
+ <button>edit</button>
+ </form> </td>
<td>
- <form method="post" action="{{ url_for('delete_item', pk=product.primary_key, table='Product' ) }}">
+ <form method="post" action="{{ url_for('common.delete_item', module='products', pk=product.primary_key, table='Product') }}">
<button>delete</button>
</form>
</td>
+ <td>{{ product.primary_key }}</td>
<td>{{ product.name }}</td>
<td>{{ product.price_net }}</td>
<td>{{ product.price_gross }}</td>
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..0b8f0c0
--- /dev/null
+++ b/app/templates/modules/settings.html
@@ -0,0 +1,57 @@
+{# -*- mode: web; -*- #}
+
+{% extends "base.html" %}
+
+{% block title %}
+Settings for user {{ current_user.username }}
+{% endblock %}
+
+{% block content %}
+
+<p>Welcome, {{ current_user.username }}!</p>
+
+<h2>User profile</h2>
+
+<form method="post" action="{{ url_for('common.edit_item', module='settings', pk=current_user.primary_key, table='Users' ) }}">
+ <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>E-mail</td>
+ <td>{{ current_user.email }}</td>
+ </tr>
+ <tr>
+ <td>Phone (mobile)</td>
+ <td>{{ current_user.phone_mobile }}</td>
+ </tr>
+ <tr>
+ <td>Phone (alt)</td>
+ <td>{{ current_user.phone_alternative }}</td>
+ </tr>
+ <tr>
+ <td> Last Updated</td>
+ <td>{{ current_user.date_time_updated }}</td>
+ </tr>
+ </tbody>
+</table>
+{% endblock %}
Copyright 2019--2024 Marius PETER