diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/templates/add-invoice.html | 48 | ||||
-rw-r--r-- | app/templates/add-item.html | 20 | ||||
-rw-r--r-- | app/templates/add_product.html | 44 | ||||
-rw-r--r-- | app/templates/base.html | 60 | ||||
-rw-r--r-- | app/templates/errors/item-not-found.html | 14 | ||||
-rw-r--r-- | app/templates/home.html | 18 | ||||
-rw-r--r-- | app/templates/modules/calculator.html | 8 | ||||
-rw-r--r-- | app/templates/modules/catalog.html | 35 | ||||
-rw-r--r-- | app/templates/modules/creator.html | 8 | ||||
-rw-r--r-- | app/templates/modules/customers.html | 43 | ||||
-rw-r--r-- | app/templates/modules/invoices.html | 44 | ||||
-rw-r--r-- | app/templates/modules/logger.html | 136 | ||||
-rw-r--r-- | app/templates/modules/orders.html | 37 | ||||
-rw-r--r-- | app/templates/modules/products.html | 51 | ||||
-rw-r--r-- | app/templates/preview-invoice.html | 106 |
15 files changed, 542 insertions, 130 deletions
diff --git a/app/templates/add-invoice.html b/app/templates/add-invoice.html new file mode 100644 index 0000000..92748be --- /dev/null +++ b/app/templates/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/add-item.html b/app/templates/add-item.html new file mode 100644 index 0000000..acffa87 --- /dev/null +++ b/app/templates/add-item.html @@ -0,0 +1,20 @@ +{# -*- mode: web; -*- #} + +{% extends "base.html" %} + + +{% block title %}Add a new {{ item }}{% endblock %} +{% block content %} + +{# 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> + +{% endblock %} diff --git a/app/templates/add_product.html b/app/templates/add_product.html deleted file mode 100644 index ad7ea0a..0000000 --- a/app/templates/add_product.html +++ /dev/null @@ -1,44 +0,0 @@ -{# -*- mode: jinja2; -*- #} - -{% extends "base.html" %} -{% import "bootstrap/wtf.html" as wtf %} - -{% block content %} - - {% block title %}Add a New Product{% endblock %} - - {% if message %} - - {# the form was submitted and message exists #} - <p class="lead"><strong>{{ message }}</strong></p> - {# links #} - <p><a href="{{ url_for('add_product') }}" class="button">Submit another product.</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 #} - <p class="lead alert alert-primary">Add a new sock to our inventory.</p> -<p class="ml-4"><a href="/fapg/home" class="button">Return to the index.</a></p> -{# 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, thanks to WTForms #} -{{ wtf.quick_form(form) }} - -{% endif %} -{% endblock %} diff --git a/app/templates/base.html b/app/templates/base.html index 0b53b5c..b5f507d 100644 --- a/app/templates/base.html +++ b/app/templates/base.html @@ -1,30 +1,40 @@ -{# -*- mode: jinja2; -*- #} +{# -*- 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>Farm Manager</title> - <meta name="author" content="Marius Peter"> - <meta name="description" content="A draft page for Farm Manager."> - <!-- <link rel="icon" href="/favicon.ico"> --> - <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> - <ul> - {% for module in modules %} - <li><a href="/module/{{ module.name }}" class="button">{{ module.name }}</a></li> - {% endfor %} - </ul> - </nav> - <div id="content"> - {% block content %}{% endblock %} - </div> - <!-- <script src="js/scripts.js"></script> --> - </body> + <head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to"> + <title>Farm Manager</title> + <meta name="author" content="Marius Peter"> + <meta name="description" content="A draft page for Farm Manager."> + <!-- <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> + <a href="/" class="button">Home</a> + <h1>{% block title %}{% endblock %}</h1> + <ul> + {% for module in modules %} + <li><a href="/modules/{{ module.name }}" class="button">{{ module.name }}</a></li> + {% endfor %} + </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 %} + <ul class="flashes"> + {% for category, message in messages %} + <li class="alert alert-{{ category }}">{{ message }}</li> + {% endfor %} + </ul> + {% endif %} + {% endwith %} + <!-- <script src="js/scripts.js"></script> --> + </body> </html> diff --git a/app/templates/errors/item-not-found.html b/app/templates/errors/item-not-found.html new file mode 100644 index 0000000..3afc5db --- /dev/null +++ b/app/templates/errors/item-not-found.html @@ -0,0 +1,14 @@ +{% extends "base.html" %} + +{% block title %} +Item not found +{% endblock %} + +{% block content %} +<p> + Item <strong>{{item }}</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 a9bac51..f518554 100644 --- a/app/templates/home.html +++ b/app/templates/home.html @@ -1,22 +1,22 @@ -<!-- -*- mode: jinja2; -*- --> +{# -*- mode: web; -*- #} {% extends "base.html" %} {% block title %} - Welcome, {{ user.name_first }}! +Welcome, {{ user.name_first }}! {% endblock %} {% block content %} - <p>You are logged in as <strong>{{ user }}</strong> on +<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 %} - </dl> +<h2>Available modules</h2> +<dl> + {% for module in modules %} + <dt style="font-weight: bold">{{ module.name }}</dt><dd>{{ module.description }}<dd> + {% endfor %} +</dl> {% endblock %} diff --git a/app/templates/modules/calculator.html b/app/templates/modules/calculator.html deleted file mode 100644 index f951a17..0000000 --- a/app/templates/modules/calculator.html +++ /dev/null @@ -1,8 +0,0 @@ -{% extends "base.html" %} -{% block title %} -Calculator -{% endblock %} - -{% block content %} -<i>insert module content here.</i> -{% endblock %} diff --git a/app/templates/modules/catalog.html b/app/templates/modules/catalog.html deleted file mode 100644 index 857c654..0000000 --- a/app/templates/modules/catalog.html +++ /dev/null @@ -1,35 +0,0 @@ -<!-- -*- mode: jinja2; -*- --> - -{% extends "base.html" %} -{% block title %} - Catalog -{% endblock %} - -{% block content %} - <i>insert module content here.</i> - - <p> - <a href="{{ url_for('add_product') }}" class="button">Add product to your catalog</a> - </p> - - <table> - <thead> - <tr> - <th>Name</th> - <th>Price</th> - <th>Supplier</th> - <th>Updated</th> - </tr> - </thead> - <tbody> - {% for product in catalog %} - <tr> - <td>{{ product.name }}</td> - <td>{{ product.price }}</td> - <td>{{ product.supplier }}</td> - <td>{{ product.updated }}</td> - </tr> - {% endfor %} - </tbody> - </table> -{% endblock %} diff --git a/app/templates/modules/creator.html b/app/templates/modules/creator.html deleted file mode 100644 index 588f428..0000000 --- a/app/templates/modules/creator.html +++ /dev/null @@ -1,8 +0,0 @@ -{% extends "base.html" %} -{% block title %} -Creator -{% endblock %} - -{% block content %} -<i>insert module content here.</i> -{% endblock %} diff --git a/app/templates/modules/customers.html b/app/templates/modules/customers.html new file mode 100644 index 0000000..c693097 --- /dev/null +++ b/app/templates/modules/customers.html @@ -0,0 +1,43 @@ +{# -*- mode: web; -*- #} + +{% extends "base.html" %} +{% block title %} +Customers +{% 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>Name</th> + <th>City</th> + <th>Phone</th> + <th>E-mail</th> + </tr> + </thead> + <tbody> + {% for customer in customers %} + <tr> + <td><button>edit</button></td> + {% if customer.website %} + <td><a href="{{ customer.website }}">{{ customer.name }}</a></td> + {% else %} + <td>{{ customer.name }}</td> + {% endif %} + <td>{{ customer.city }}</td> + <td>{{ customer.phone }}</td> + {% if customer.email %} + <td><a href="mailto:{{ customer.email }}">{{ customer.email }}</a></td> + {% else %} + <td></td> + {% endif %} + </tr> + {% endfor %} + </tbody> +</table> +{% endblock %} diff --git a/app/templates/modules/invoices.html b/app/templates/modules/invoices.html new file mode 100644 index 0000000..76fe267 --- /dev/null +++ b/app/templates/modules/invoices.html @@ -0,0 +1,44 @@ +{# -*- mode: jinja2; -*- #} + +{% extends "base.html" %} +{% block title %} + Products +{% endblock %} + +{% block content %} + + <div id="actions"> + <a href="{{ url_for('add_invoice') }}" class="button">New invoice</a> + </div> + + <i>Track your invoices and create new ones here.</i> + + <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> + </thead> + <tbody> + {% for invoice in invoices %} + <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 %} + + </tr> + {% endfor %} + </tbody> + </table> +{% endblock %} diff --git a/app/templates/modules/logger.html b/app/templates/modules/logger.html index 7ba93b3..f3321e9 100644 --- a/app/templates/modules/logger.html +++ b/app/templates/modules/logger.html @@ -1,8 +1,142 @@ +{# -*- mode: web; -*- #} + {% extends "base.html" %} + {% block title %} Logger {% endblock %} {% block content %} -<i>insert module content here.</i> + + +<div id="actions"> + <a href="{{ url_for('add_item', item='log') }}" class="button">Add log</a> +</div> + +<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> + <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> + <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> + <td>{{ target.primary_key }}</td> + <td>Target</td> + <td>{{ target.date_time_updated }}</td> + <td>{{ target.nno3 }}</td> + <td>{{ target.p }}</td> + <td>{{ target.k }}</td> + <td>{{ target.ca }}</td> + <td>{{ target.mg }}</td> + <td>{{ target.s }}</td> + <td>{{ target.na }}</td> + <td>{{ target.cl }}</td> + <td>{{ target.fe }}</td> + <td>{{ target.zn }}</td> + <td>{{ target.b }}</td> + <td>{{ target.mn }}</td> + <td>{{ target.cu }}</td> + <td>{{ target.mo }}</td> + <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> + {% 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' ) }}"> + <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> + <td>{{ log.k }}</td> + <td>{{ log.ca }}</td> + <td>{{ log.mg }}</td> + <td>{{ log.s }}</td> + <td>{{ log.na }}</td> + <td>{{ log.cl }}</td> + <td>{{ log.fe }}</td> + <td>{{ log.zn }}</td> + <td>{{ log.b }}</td> + <td>{{ log.mn }}</td> + <td>{{ log.cu }}</td> + <td>{{ log.mo }}</td> + <td>{{ log.si }}</td> + <td>{{ log.nnh4 }}</td> + </tr> + {% endfor %} + </tbody> +</table> {% endblock %} diff --git a/app/templates/modules/orders.html b/app/templates/modules/orders.html new file mode 100644 index 0000000..bf94d3d --- /dev/null +++ b/app/templates/modules/orders.html @@ -0,0 +1,37 @@ +{# -*- mode: web; -*- #} + +{% extends "base.html" %} +{% block title %} +Orders +{% 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> + <th>ID</th> + <th>Date</th> + <th>Customer</th> + <th>Content</th> + <th>Updated</th> + </tr> + </thead> + <tbody> + {% for order in orders %} + <tr> + <td>{{ order.id }}</td> + <td>{{ order.date }}</td> + <td>{{ order.customer }}</td> + <td>{{ order.content }}</td> + <td>{{ order.updated }}</td> + </tr> + {% endfor %} + </tbody> +</table> +{% endblock %} diff --git a/app/templates/modules/products.html b/app/templates/modules/products.html new file mode 100644 index 0000000..97b692a --- /dev/null +++ b/app/templates/modules/products.html @@ -0,0 +1,51 @@ +{# -*- mode: web; -*- #} + +{% extends "base.html" %} +{% block title %} +Products +{% endblock %} + +{% block content %} + + +<div id="actions"> + <a href="{{ url_for('add_item', item='product') }}" class="button">Add product</a> +</div> + +<i>Track products you sell here.</i> + +<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> + </thead> + <tbody> + {% for product in products %} + <tr> + <td> + <button>edit</button> + </td> + <td> + <form method="post" action="{{ url_for('delete_item', pk=product.primary_key, table='Product' ) }}"> + <button>delete</button> + </form> + </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 %} + + </tr> + {% endfor %} + </tbody> +</table> +{% endblock %} diff --git a/app/templates/preview-invoice.html b/app/templates/preview-invoice.html new file mode 100644 index 0000000..5ddeb00 --- /dev/null +++ b/app/templates/preview-invoice.html @@ -0,0 +1,106 @@ +{# -*- 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>New Invoice for {{ 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">Company Name</h2> + <div>455 Foggy Heights, AZ 85004, US</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">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> + </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> + </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> |