2015-03-27 18:07:06 +01:00
|
|
|
{% extends "layout.html" %}
|
2015-03-27 21:57:37 +01:00
|
|
|
{% set active_page = "orders" -%}
|
|
|
|
|
2015-03-30 00:01:07 +02:00
|
|
|
{% import "utils.html" as util %}
|
|
|
|
|
2015-03-27 21:57:37 +01:00
|
|
|
{% block container %}
|
2015-03-27 18:07:06 +01:00
|
|
|
<div class="row">
|
2015-03-30 00:01:07 +02:00
|
|
|
<div class="col-md-push-1 col-md-10 darker"><!-- Shitty html-->
|
2015-03-28 10:49:28 +01:00
|
|
|
<h3>Order {{ order.id }}
|
2015-03-28 21:12:02 +01:00
|
|
|
{% if order.can_close(current_user.id) -%}
|
2015-03-28 02:01:30 +01:00
|
|
|
<a class="btn btn-danger" href="{{ url_for('.close_order', id=order.id) }}">Close</a><br/>
|
2015-03-28 10:49:28 +01:00
|
|
|
{%- endif %}</h3>
|
2015-03-28 23:21:43 +01:00
|
|
|
courrier: {{ order.courrier.username }}
|
2015-03-28 20:38:15 +01:00
|
|
|
{% if order.courrier == None and not current_user.is_anonymous() %}
|
2015-03-28 23:06:36 +01:00
|
|
|
<a href="{{ url_for('.volunteer', id=order.id) }}" class="btn btn-primary btn-sm">Volunteer</a>
|
2015-03-28 01:09:59 +01:00
|
|
|
{% endif %}
|
|
|
|
<br/>
|
2015-03-28 23:21:43 +01:00
|
|
|
location: <a href="{{ order.location.website }}">{{ order.location.name }}</a><br/>
|
|
|
|
<b>status:</b> {% if order.stoptime %}{{ order.stoptime|countdown }}{% else %}open{% endif %}<br/>
|
|
|
|
total price: {{ total_price|euro }}
|
2015-03-27 18:07:06 +01:00
|
|
|
</div>
|
2015-03-28 21:12:02 +01:00
|
|
|
{% if form -%}
|
2015-03-30 00:01:07 +02:00
|
|
|
<div class="col-md-push-1 col-md-10 darker">
|
2015-03-28 00:44:58 +01:00
|
|
|
<h4>Order:</h4>
|
2015-03-30 00:01:07 +02:00
|
|
|
<form method="post" action="{{ url_for('.order_item_create', id=order.id) }}">
|
|
|
|
{{ form.csrf_token }}
|
|
|
|
<div class="form-group {{ 'has-errors' if form.product_id.errors else ''}}">
|
|
|
|
{{ form.product_id.label(class='control-label') }}
|
|
|
|
{{ form.product_id(class='form-control select') }}
|
|
|
|
{{ util.render_form_field_errors(form.product_id) }}
|
|
|
|
</div>
|
|
|
|
{% if current_user.is_anonymous() %}
|
|
|
|
<div class="form-group{{ ' has-error' if form.name.errors }}{{ ' required' if form.name.flags.required }}">
|
|
|
|
{{ form.name.label(class='control-label') }}
|
|
|
|
{{ form.name(class='form-control') }}
|
|
|
|
{{ util.render_form_field_errors(form.name) }}
|
|
|
|
</div>
|
|
|
|
{% endif %}
|
|
|
|
<div class="form-group">
|
|
|
|
{{ form.submit_button(class='btn btn-primary') }}
|
|
|
|
</div>
|
|
|
|
</form>
|
2015-03-28 00:44:58 +01:00
|
|
|
</div>
|
2015-03-28 21:12:02 +01:00
|
|
|
{%- endif %}
|
2015-03-27 18:07:06 +01:00
|
|
|
</div>
|
2015-03-28 23:06:36 +01:00
|
|
|
<div class="row">
|
|
|
|
<div class="col-md-push-1 col-md-4 darker">
|
2015-03-29 11:46:08 +02:00
|
|
|
<h3>Items</h3>
|
2015-03-28 23:06:36 +01:00
|
|
|
{% for item in order.items %}
|
|
|
|
{{ item.get_name() }} - {{ item.product.name }} - {{ item.product.price|euro }}
|
|
|
|
{% if item.can_delete(order.id, current_user.id, session.get('anon_name', '')) -%}<a href="{{ url_for('.delete_item', order_id=order.id, item_id=item.id) }}"><span class="glyphicon glyphicon-remove"></span></a>{%- endif %}<br/>
|
|
|
|
{% endfor %}
|
|
|
|
</div>
|
|
|
|
<div class="col-md-push-3 col-md-4 darker">
|
|
|
|
<h3>Ordered products:</h3>
|
|
|
|
{% for key, value in order.group_by_product().items() %}
|
|
|
|
{{ key }} - {{ value }}<br/>
|
|
|
|
{% endfor %}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="row">
|
|
|
|
<div class="col-md-push-1 col-md-4 darker">
|
|
|
|
<h3>Debts</h3>
|
|
|
|
{% for key, value in order.group_by_user_pay().items() %}
|
|
|
|
{{ key }} - {{ value|euro }}<br/>
|
|
|
|
{% endfor %}
|
|
|
|
</div>
|
|
|
|
</div>
|
2015-03-30 00:01:07 +02:00
|
|
|
{% endblock %}
|
|
|
|
|
|
|
|
{% block styles %}
|
|
|
|
{{ super() }}
|
|
|
|
<link href="//cdnjs.cloudflare.com/ajax/libs/select2/4.0.0-rc.2/css/select2.min.css" rel="stylesheet" />
|
|
|
|
{% endblock %}
|
|
|
|
{% block scripts %}
|
|
|
|
{{ super() }}
|
|
|
|
<script src="//cdnjs.cloudflare.com/ajax/libs/select2/4.0.0-rc.2/js/select2.min.js"></script>
|
|
|
|
<script type="text/javascript">
|
|
|
|
$('.select').select2();
|
|
|
|
</script>
|
2015-03-27 18:07:06 +01:00
|
|
|
{% endblock %}
|