Add user group reference to orders
This commit is contained in:
parent
c839fce270
commit
bf8eb94117
2 changed files with 63 additions and 54 deletions
|
@ -155,60 +155,66 @@
|
||||||
|
|
||||||
<div class="box" id="order_info">
|
<div class="box" id="order_info">
|
||||||
<h3>Order information</h3>
|
<h3>Order information</h3>
|
||||||
<dl>
|
<div class="row">
|
||||||
<div>
|
<dl class="col-md-10 col-lg-8">
|
||||||
<dt>Order opens</dt>
|
<div>
|
||||||
<dd>{{ order.starttime.strftime("%Y-%m-%d, %H:%M") }}</dd>
|
<dt>Order opens</dt>
|
||||||
|
<dd>{{ order.starttime.strftime("%Y-%m-%d, %H:%M") }}</dd>
|
||||||
|
|
||||||
<dt>Order closes</dt>
|
<dt>Order closes</dt>
|
||||||
<dd>
|
<dd>
|
||||||
{% if order.stoptime %}
|
{% if order.stoptime %}
|
||||||
{% set stoptimefmt = (
|
{% set stoptimefmt = (
|
||||||
"%H:%M" if order.stoptime.date() == order.starttime.date()
|
"%H:%M" if order.stoptime.date() == order.starttime.date()
|
||||||
else "%Y-%m-%d, %H:%M"
|
else "%Y-%m-%d, %H:%M"
|
||||||
) %}
|
) %}
|
||||||
{{ order.stoptime.strftime(stoptimefmt) }} ({{ order.stoptime|countdown }})
|
{{ order.stoptime.strftime(stoptimefmt) }} ({{ order.stoptime|countdown }})
|
||||||
{% else %}
|
{% else %}
|
||||||
Never
|
Never
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</dd>
|
</dd>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<dt>Location</dt>
|
||||||
|
<dd>
|
||||||
|
{% if order.location %}
|
||||||
|
<a href="{{ url_for('general_bp.location', location_id=order.location_id) }}">{{ order.location_name }}</a>
|
||||||
|
{% else %}
|
||||||
|
{{ order.location_name }}
|
||||||
|
{% endif %}
|
||||||
|
</dd>
|
||||||
|
|
||||||
|
<dt>Courier</dt>
|
||||||
|
<dd>
|
||||||
|
{% if order.courier == None %}
|
||||||
|
{% if not current_user.is_anonymous() %}
|
||||||
|
<form action="{{ url_for('order_bp.volunteer', order_slug=order.slug) }}" method="post" style="display:inline">
|
||||||
|
<input type="submit" class="btn btn-primary btn-sm" value="Volunteer"></input>
|
||||||
|
</form>
|
||||||
|
{% else %}No-one yet{% endif %}
|
||||||
|
{% else %}
|
||||||
|
{{ order.courier.username }}
|
||||||
|
{% endif %}
|
||||||
|
</dd>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
<div class="col-md-2 col-lg-4">
|
||||||
|
<img src="https://dsa.ugent.be/api/verenigingen/{{ order.association }}/logo" class="img-responsive align-top" style="max-width:200px;width:100%">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
|
||||||
<dt>Location</dt>
|
|
||||||
<dd>
|
|
||||||
{% if order.location %}
|
|
||||||
<a href="{{ url_for('general_bp.location', location_id=order.location_id) }}">{{ order.location_name }}</a>
|
|
||||||
{% else %}
|
|
||||||
{{ order.location_name }}
|
|
||||||
{% endif %}
|
|
||||||
</dd>
|
|
||||||
|
|
||||||
<dt>Courier</dt>
|
|
||||||
<dd>
|
|
||||||
{% if order.courier == None %}
|
|
||||||
{% if not current_user.is_anonymous() %}
|
|
||||||
<form action="{{ url_for('order_bp.volunteer', order_slug=order.slug) }}" method="post" style="display:inline">
|
|
||||||
<input type="submit" class="btn btn-primary btn-sm" value="Volunteer"></input>
|
|
||||||
</form>
|
|
||||||
{% else %}No-one yet{% endif %}
|
|
||||||
{% else %}
|
|
||||||
{{ order.courier.username }}
|
|
||||||
{% endif %}
|
|
||||||
</dd>
|
|
||||||
</div>
|
|
||||||
</dl>
|
|
||||||
|
|
||||||
<div>
|
|
||||||
{% if order.can_close(current_user.id) -%}
|
|
||||||
<form action="{{ url_for('order_bp.close_order', order_slug=order.slug) }}" method="post" style="display:inline">
|
|
||||||
<input type="submit" class="btn btn-danger" value="Close"></input>
|
|
||||||
</form>
|
|
||||||
{% endif %}
|
|
||||||
{% if courier_or_admin %}
|
|
||||||
<a class="btn" href="{{ url_for('order_bp.order_edit', order_slug=order.slug) }}">Edit</a>
|
|
||||||
{%- endif %}
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{% if order.can_close(current_user.id) -%}
|
||||||
|
<form action="{{ url_for('order_bp.close_order', order_slug=order.slug) }}" method="post" style="display:inline">
|
||||||
|
<input type="submit" class="btn btn-danger" value="Close"></input>
|
||||||
|
</form>
|
||||||
|
{% endif %}
|
||||||
|
{% if courier_or_admin %}
|
||||||
|
<a class="btn" href="{{ url_for('order_bp.order_edit', order_slug=order.slug) }}">Edit</a>
|
||||||
|
{%- endif %}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="box" id="how_to_order">
|
<div class="box" id="how_to_order">
|
||||||
|
|
|
@ -1,14 +1,17 @@
|
||||||
{% macro render_order(order) -%}
|
{% macro render_order(order) -%}
|
||||||
<div class="row order_row">
|
<div class="row order_row">
|
||||||
<div class="col-md-8 col-lg-9 order_data">
|
<div class="col-md-6 col-lg-6 order_data">
|
||||||
<h5>{{ order.location_name }}</h5>
|
<h5>{{ order.location_name }}</h5>
|
||||||
<b class="amount_of_orders">{{ order.items.count() }} items ordered</b></p>
|
<b class="amount_of_orders">{{ order.items.count() }} items ordered for {{ order.association }}</b></p>
|
||||||
<p class="time_data">
|
<p class="time_data">
|
||||||
{% if order.stoptime %}
|
{% if order.stoptime %}
|
||||||
<span><b>Closes </b>{{ order.stoptime.strftime("%H:%M") }}</span>{{ order.stoptime|countdown }}
|
<span><b>Closes </b>{{ order.stoptime.strftime("%H:%M") }}</span>{{ order.stoptime|countdown }}
|
||||||
{% else %}open{% endif %}<br/>
|
{% else %}open{% endif %}<br/>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-4 col-lg-3 expand_button_wrapper">
|
<div class="col-md-3 col-lg-3">
|
||||||
|
<img src="https://dsa.ugent.be/api/verenigingen/{{ order.association }}/logo" class="img-responsive align-bottom" style="max-width:200px;width:100%">
|
||||||
|
</div>
|
||||||
|
<div class="col-md-3 col-lg-3 expand_button_wrapper">
|
||||||
<a class="btn btn-primary btn-block align-bottom expand_button" href="{{ url_for('order_bp.order_from_slug', order_slug=order.slug) }}">Expand</a>
|
<a class="btn btn-primary btn-block align-bottom expand_button" href="{{ url_for('order_bp.order_from_slug', order_slug=order.slug) }}">Expand</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in a new issue