Add route to view all orders
This commit is contained in:
parent
67c9a8486c
commit
6772c26166
2 changed files with 38 additions and 0 deletions
33
app/templates/orders_all.html
Normal file
33
app/templates/orders_all.html
Normal 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 %}
|
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue