Add route to view all orders

This commit is contained in:
Jan-Pieter Baert 2020-01-31 12:25:02 +01:00
parent 67c9a8486c
commit 6772c26166
No known key found for this signature in database
GPG key ID: B19186932178234A
2 changed files with 38 additions and 0 deletions

View file

@ -0,0 +1,33 @@
{% extends 'layout.html' %}
{% set active_page = "orders" -%}
{% import "bootstrap/wtf.html" as wtf %}
{% import "utils.html" as util -%}
{% block container %}
<div class="row orders">
<div class="col-md-5">
{% if orders|count > 0 -%}
<h3>Open orders:</h3>
{% for order in orders %}
{{ util.render_order(order) }}
{% endfor %}
{% else %}
<h4>There are no orders in the history</h4>
{%- endif %}
</div>
</div>
</div>
{% endblock %}
{% block styles -%}
{{ super() }}
<link rel="stylesheet" href="{{ url_for('static', filename='css/select2.min.css') }}" />
<link rel="stylesheet" href="{{ url_for('static', filename='css/bootstrap-datetimepicker.min.css') }}" />
<link rel="stylesheet" href="{{ url_for('static', filename='css/select2-bootstrap.min.css') }}" />
{%- endblock %}
{% block scripts -%}
{{ super() }}
<script src="{{ url_for('static', filename='js/select2.min.js') }}"></script>
<script src="{{ url_for('static', filename='js/moment.min.js') }}"></script>
{%- endblock %}

View file

@ -27,6 +27,11 @@ def orders(form: OrderForm = None) -> str:
form.populate() form.populate()
return render_template("orders.html", orders=get_orders(), form=form) return render_template("orders.html", orders=get_orders(), form=form)
@order_bp.route("/all")
def all_orders() -> str:
"Generate the view of all orders"
# pylint: disable=C0121
return render_template("orders_all.html", orders=Order.query.filter(Order.public == True).all())
@order_bp.route("/create", methods=["POST"]) @order_bp.route("/create", methods=["POST"])
@login_required @login_required