diff options
Diffstat (limited to 'app/templates/modules')
-rw-r--r-- | app/templates/modules/add-invoice.html | 48 | ||||
-rw-r--r-- | app/templates/modules/add-item.html | 19 | ||||
-rw-r--r-- | app/templates/modules/customers.html | 18 | ||||
-rw-r--r-- | app/templates/modules/edit-item.html | 19 | ||||
-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 | 108 | ||||
-rw-r--r-- | app/templates/modules/invoices.html | 96 | ||||
-rw-r--r-- | app/templates/modules/login.html | 16 | ||||
-rw-r--r-- | app/templates/modules/orders.html | 8 | ||||
-rw-r--r-- | app/templates/modules/products.html | 18 | ||||
-rw-r--r-- | app/templates/modules/register.html | 16 | ||||
-rw-r--r-- | app/templates/modules/settings.html | 57 |
12 files changed, 388 insertions, 100 deletions
diff --git a/app/templates/modules/add-invoice.html b/app/templates/modules/add-invoice.html new file mode 100644 index 0000000..92748be --- /dev/null +++ b/app/templates/modules/add-invoice.html @@ -0,0 +1,48 @@ +{# -*- mode: web; -*- #} + +{% extends "base.html" %} + + +{% block title %}Add a new invoice{% endblock %} +{% block content %} + +{% if message %} +{# the form was submitted and message exists #} +<p><strong>{{ item }}</strong></p> +{# links #} +<p><a href="{{ url_for('add_item', item=item) }}" class="button">Submit another {{ item }}</a></p> +<p><a href="/fapg/home">Return to the index</a></p> + +{% else %} +{# the form is displayed when template opens via GET not POST #} + +{# show flash - based on WTForms validators see +https://pythonprogramming.net/flash-flask-tutorial/ +get_flashed_messages() exists here because of flash() in the route +function #} + +{% with errors = get_flashed_messages() %} {% if errors %} +{% for err in errors %} +<div class="alert alert-danger alert-dismissible" role="alert"> + <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button> + {{ err }} +</div> +{% endfor %} +{% endif %} +{% endwith %} +{# end of flash #} + + +{# the form #} +<form action="{{ url_for('add_item', item=item) }}" method="POST"> + <fieldset> + <legend>Add a new {{ item }} to our database.</legend> + {% for field in form %} + {{ field.label() }} + {{ field() }}<br/> + {% endfor %} + </fieldset> +</form> + +{% endif %} +{% endblock %} diff --git a/app/templates/modules/add-item.html b/app/templates/modules/add-item.html new file mode 100644 index 0000000..356ce9f --- /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() }} + {{ field() }}<br/> + {% endfor %} + </fieldset> +</form> + +{% endblock %} 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/modules/invoice-preview.html b/app/templates/modules/invoice-preview.html new file mode 100644 index 0000000..f86f9a2 --- /dev/null +++ b/app/templates/modules/invoice-preview.html @@ -0,0 +1,108 @@ +{# -*- 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>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') }}"> --> + <link rel="stylesheet" href="{{ url_for('static', filename='styles/invoice.css') }}"> + </head> + <body> + <div id="content"> + <header class="clearfix"> + <div id="logo"> + <img src="{{ url_for('static', filename='img/logo.png') }}"> + </div> + <div id="company"> + <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> + + </header> + <main> + <div id="details" class="clearfix"> + <div id="client"> + <div class="to">INVOICE TO:</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 {{ 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"> + <thead> + <tr> + <th class="no">#</th> + <th class="desc">DESCRIPTION</th> + <th class="unit">UNIT PRICE</th> + <th class="qty">QUANTITY</th> + <th class="total">TOTAL</th> + </tr> + </thead> + <tbody> + <tr> + <td class="no">01</td> + <td class="desc"><h3>Website Design</h3>Creating a recognizable design solution based on the company's existing visual identity</td> + <td class="unit">$40.00</td> + <td class="qty">30</td> + <td class="total">$1,200.00</td> + </tr> + <tr> + <td class="no">02</td> + <td class="desc"><h3>Website Development</h3>Developing a Content Management System-based Website</td> + <td class="unit">$40.00</td> + <td class="qty">80</td> + <td class="total">$3,200.00</td> + </tr> + <tr> + <td class="no">03</td> + <td class="desc"><h3>Search Engines Optimization</h3>Optimize the site for search engines (SEO)</td> + <td class="unit">$40.00</td> + <td class="qty">20</td> + <td class="total">$800.00</td> + </tr> + </tbody> + <tfoot> + <tr> + <td colspan="2"></td> + <td colspan="2">SUBTOTAL</td> + <td>$5,200.00</td> + </tr> + <tr> + <td colspan="2"></td> + <td colspan="2">TAX 25%</td> + <td>$1,300.00</td> + </tr> + <tr> + <td colspan="2"></td> + <td colspan="2">GRAND TOTAL</td> + <td>$6,500.00</td> + </tr> + </tfoot> + </table> + <div id="thanks">Thank you!</div> + <div id="notices"> + <div>NOTICE:</div> + <div class="notice">A finance charge of 1.5% will be made on unpaid balances after 30 days.</div> + </div> + </main> + <footer> + Invoice was created on a computer and is valid without the signature and seal. + </footer> + + </div> + </body> +</html> 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 %} |