Updated forms and orders
This commit is contained in:
parent
79d8a93267
commit
dd4754ec0d
3 changed files with 13 additions and 8 deletions
|
@ -44,7 +44,6 @@ class AnonOrderItemForm(OrderItemForm):
|
||||||
if self.name.data is None:
|
if self.name.data is None:
|
||||||
self.name.data = session.get('anon_name', None)
|
self.name.data = session.get('anon_name', None)
|
||||||
|
|
||||||
|
|
||||||
def validate(self):
|
def validate(self):
|
||||||
rv = OrderForm.validate(self)
|
rv = OrderForm.validate(self)
|
||||||
if not rv:
|
if not rv:
|
||||||
|
|
|
@ -9,11 +9,13 @@
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-push-1 col-md-10 darker" id="info"><!-- Shitty html-->
|
<div class="col-md-push-1 col-md-10 darker" id="info"><!-- Shitty html-->
|
||||||
<h3 id="order-title">Order {{ order.id }}
|
<h3 id="order-title">Order {{ order.id }}
|
||||||
|
<div class="pull-right">
|
||||||
{% if order.can_close(current_user.id) -%}
|
{% if order.can_close(current_user.id) -%}
|
||||||
<a class="btn btn-danger pull-right" href="{{ url_for('.close_order', id=order.id) }}">Close</a><br/>
|
<a class="btn btn-danger" href="{{ url_for('.close_order', id=order.id) }}">Close</a>
|
||||||
{% endif %}{% if courier_or_admin %}
|
{% endif %}{% if courier_or_admin %}
|
||||||
<a class="btn btn-warning pull-right" href="{{ url_for('.order_edit', id=order.id) }}">Edit</a>
|
<a class="btn btn-warning" href="{{ url_for('.order_edit', id=order.id) }}">Edit</a>
|
||||||
{%- endif %}</h3>
|
{%- endif %}
|
||||||
|
</div></h3>
|
||||||
courier: {{ order.courrier.username }}
|
courier: {{ order.courrier.username }}
|
||||||
{% if order.courrier == None and not current_user.is_anonymous() %}
|
{% if order.courrier == None and not current_user.is_anonymous() %}
|
||||||
<a href="{{ url_for('.volunteer', id=order.id) }}" class="btn btn-primary btn-sm">Volunteer</a>
|
<a href="{{ url_for('.volunteer', id=order.id) }}" class="btn btn-primary btn-sm">Volunteer</a>
|
||||||
|
@ -101,14 +103,18 @@
|
||||||
|
|
||||||
{% block styles %}
|
{% block styles %}
|
||||||
{{ super() }}
|
{{ super() }}
|
||||||
<link href="//cdnjs.cloudflare.com/ajax/libs/select2/4.0.0-rc.2/css/select2.min.css" rel="stylesheet" />
|
<link href="//cdnjs.cloudflare.com/ajax/libs/select2/4.0.0/css/select2.min.css" rel="stylesheet" />
|
||||||
<link rel="stylesheet" href="{{ url_for('static', filename='css/select2-bootstrap.min.css') }}">
|
<link rel="stylesheet" href="{{ url_for('static', filename='css/select2-bootstrap.min.css') }}">
|
||||||
<link rel="stylesheet" href="{{ url_for('static', filename='css/print.css') }}">
|
<link rel="stylesheet" href="{{ url_for('static', filename='css/print.css') }}">
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block scripts %}
|
{% block scripts %}
|
||||||
{{ super() }}
|
{{ super() }}
|
||||||
<script src="//cdnjs.cloudflare.com/ajax/libs/select2/4.0.0-rc.2/js/select2.min.js"></script>
|
<script src="//cdnjs.cloudflare.com/ajax/libs/select2/4.0.0/js/select2.min.js"></script>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$('.select').select2();
|
$('.select').select2({
|
||||||
|
'sorter': function(results) {
|
||||||
|
return results.sort();
|
||||||
|
}
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -106,7 +106,7 @@ def item_paid(order_id, item_id):
|
||||||
if item.order.courrier_id == id or current_user.admin:
|
if item.order.courrier_id == id or current_user.admin:
|
||||||
item.paid = True
|
item.paid = True
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
flash('Paid %s by %s' % (item.product.name, item.user.username), 'success')
|
flash('Paid %s by %s' % (item.product.name, item.get_name()), 'success')
|
||||||
return redirect(url_for('.order', id=order_id))
|
return redirect(url_for('.order', id=order_id))
|
||||||
abort(404)
|
abort(404)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue