From caa0e1db19c0616031f7879d4298ed152b05f557 Mon Sep 17 00:00:00 2001 From: Marius Peter Date: Sun, 1 May 2022 21:38:59 +0200 Subject: Jinja2 templates. --- app/templates/add-invoice.html | 48 +++++++++++ app/templates/add-item.html | 20 +++++ app/templates/add_product.html | 44 ---------- app/templates/base.html | 60 ++++++++------ app/templates/errors/item-not-found.html | 14 ++++ app/templates/home.html | 18 ++-- app/templates/modules/calculator.html | 8 -- app/templates/modules/catalog.html | 35 -------- app/templates/modules/creator.html | 8 -- app/templates/modules/customers.html | 43 ++++++++++ app/templates/modules/invoices.html | 44 ++++++++++ app/templates/modules/logger.html | 136 ++++++++++++++++++++++++++++++- app/templates/modules/orders.html | 37 +++++++++ app/templates/modules/products.html | 51 ++++++++++++ app/templates/preview-invoice.html | 106 ++++++++++++++++++++++++ 15 files changed, 542 insertions(+), 130 deletions(-) create mode 100644 app/templates/add-invoice.html create mode 100644 app/templates/add-item.html delete mode 100644 app/templates/add_product.html create mode 100644 app/templates/errors/item-not-found.html delete mode 100644 app/templates/modules/calculator.html delete mode 100644 app/templates/modules/catalog.html delete mode 100644 app/templates/modules/creator.html create mode 100644 app/templates/modules/customers.html create mode 100644 app/templates/modules/invoices.html create mode 100644 app/templates/modules/orders.html create mode 100644 app/templates/modules/products.html create mode 100644 app/templates/preview-invoice.html 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 #} +

{{ item }}

+{# links #} +

Submit another {{ item }}

+

Return to the index

+ +{% 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 %} + +{% endfor %} +{% endif %} +{% endwith %} +{# end of flash #} + + +{# the form #} +
+
+ Add a new {{ item }} to our database. + {% for field in form %} + {{ field.label() }} + {{ field() }}
+ {% endfor %} +
+
+ +{% 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 #} +
+
+ Add a new {{ item }} to our database. + {% for field in form %} + {{ field.label() }} + {{ field() }}
+ {% endfor %} +
+
+ +{% 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 #} -

{{ message }}

- {# links #} -

Submit another product.

-

Return to the index.

- -{% else %} - - {# the form is displayed when template opens via GET not POST #} -

Add a new sock to our inventory.

-

Return to the index.

-{# 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 %} - - {% 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; -*- #} - - - - Farm Manager - - - - - - - -
- {% block content %}{% endblock %} -
- - + + + + Farm Manager + + + + + + + +
+ {% block content %}{% endblock %} +
+ {# Flashed messages added last, so that they appear on top of the content. #} + {% with messages = get_flashed_messages(with_categories=true) %} + {% if messages %} + + {% endif %} + {% endwith %} + + 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 %} +

+ Item {{item }} could not found. +

+

+ If you'd like to suggest a feature, please send us an e-mail. +

+{% 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: web; -*- #} {% extends "base.html" %} {% block title %} - Welcome, {{ user.name_first }}! +Welcome, {{ user.name_first }}! {% endblock %} {% block content %} -

You are logged in as {{ user }} on +

You are logged in as {{ user }} on project {{ project }}.

-

Available modules

-
- {% for module in modules %} -
{{ module.name }}
{{ module.description }}
- {% endfor %} -
+

Available modules

+
+ {% for module in modules %} +
{{ module.name }}
{{ module.description }}
+ {% endfor %} +
{% 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 %} -insert module content here. -{% 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 @@ - - -{% extends "base.html" %} -{% block title %} - Catalog -{% endblock %} - -{% block content %} - insert module content here. - -

- Add product to your catalog -

- - - - - - - - - - - - {% for product in catalog %} - - - - - - - {% endfor %} - -
NamePriceSupplierUpdated
{{ product.name }}{{ product.price }}{{ product.supplier }}{{ product.updated }}
-{% 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 %} -insert module content here. -{% 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 %} +
+ Add customer +
+ + + + + + + + + + + + + {% for customer in customers %} + + + {% if customer.website %} + + {% else %} + + {% endif %} + + + {% if customer.email %} + + {% else %} + + {% endif %} + + {% endfor %} + +
NameCityPhoneE-mail
{{ customer.name }}{{ customer.name }}{{ customer.city }}{{ customer.phone }}{{ customer.email }}
+{% 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 %} + +
+ New invoice +
+ + Track your invoices and create new ones here. + + + + + + + + + + + + + {% for invoice in invoices %} + + + + + + + {% if product.date_time_updated %} + + {% else %} + + {% endif %} + + + {% endfor %} + +
ActionsNamePrice (net)Price (gross)Updated
{{ product.name }}{{ product.price_net }}{{ product.price_gross }}{{ product.date_time_updated }}{{ product.date_time_created }}
+{% 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 %} -insert module content here. + + +
+ Add log +
+ +Track operating logs. + +

Most recent target

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ActionsIDTypeUpdatedNNO3PKCaMgSNaClFeZnBMnCuMoSiNNH4
+ + +
+ +
+
{{ target.primary_key }}Target{{ target.date_time_updated }}{{ target.nno3 }}{{ target.p }}{{ target.k }}{{ target.ca }}{{ target.mg }}{{ target.s }}{{ target.na }}{{ target.cl }}{{ target.fe }}{{ target.zn }}{{ target.b }}{{ target.mn }}{{ target.cu }}{{ target.mo }}{{ target.si }}{{ target.nnh4 }}
+ +

Logs

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + {% for log in logs %} + + + + + {% if log.target == "True" %} + + {% else %} + + {% endif %} + + + + + + + + + + + + + + + + + + + {% endfor %} + +
ActionsIDTypeUpdatedNNO3PKCaMgSNaClFeZnBMnCuMoSiNNH4
+ + +
+ +
+
{{ log.primary_key }}TargetLog{{ log.date_time_updated }}{{ log.nno3 }}{{ log.p }}{{ log.k }}{{ log.ca }}{{ log.mg }}{{ log.s }}{{ log.na }}{{ log.cl }}{{ log.fe }}{{ log.zn }}{{ log.b }}{{ log.mn }}{{ log.cu }}{{ log.mo }}{{ log.si }}{{ log.nnh4 }}
{% 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 %} +Track your orders and their payment status here. + +

+ Add order +

+ + + + + + + + + + + + + {% for order in orders %} + + + + + + + + {% endfor %} + +
IDDateCustomerContentUpdated
{{ order.id }}{{ order.date }}{{ order.customer }}{{ order.content }}{{ order.updated }}
+{% 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 %} + + +
+ Add product +
+ +Track products you sell here. + + + + + + + + + + + + + {% for product in products %} + + + + + + + {% if product.date_time_updated %} + + {% else %} + + {% endif %} + + + {% endfor %} + +
ActionsNamePrice (net)Price (gross)Updated
+ + +
+ +
+
{{ product.name }}{{ product.price_net }}{{ product.price_gross }}{{ product.date_time_updated }}{{ product.date_time_created }}
+{% 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; -*- #} + + + + + + + + New Invoice for {{ customer.name }} + + + + + + +
+
+ +
+

Company Name

+
455 Foggy Heights, AZ 85004, US
+
(602) 519-0450
+
company@example.com
+
+ +
+
+
+
+
INVOICE TO:
+

John Doe

+
796 Silver Harbour, TX 79273, US
+ +
+
+

INVOICE 3-2-1

+
Date of Invoice: 01/06/2014
+
Due Date: 30/06/2014
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
#DESCRIPTIONUNIT PRICEQUANTITYTOTAL
01

Website Design

Creating a recognizable design solution based on the company's existing visual identity
$40.0030$1,200.00
02

Website Development

Developing a Content Management System-based Website
$40.0080$3,200.00
03

Search Engines Optimization

Optimize the site for search engines (SEO)
$40.0020$800.00
SUBTOTAL$5,200.00
TAX 25%$1,300.00
GRAND TOTAL$6,500.00
+
Thank you!
+
+
NOTICE:
+
A finance charge of 1.5% will be made on unpaid balances after 30 days.
+
+
+ + +
+ + -- cgit v1.2.3