haldis/app/templates/orders.html

95 lines
4.5 KiB
HTML
Raw Normal View History

2015-03-31 20:15:22 +02:00
{% extends 'layout.html' %}
{% set active_page = "orders" -%}
{% import "bootstrap/wtf.html" as wtf %}
{% import "utils.html" as util -%}
{% block container %}
2019-12-05 19:39:35 +01:00
<div class="row orders">
2015-03-31 20:15:22 +02:00
<div class="col-md-5">
2015-06-04 21:20:38 +02:00
{% if orders|count > 0 -%}
2015-03-31 20:15:22 +02:00
<h3>Open orders:</h3>
{% for order in orders %}
{{ util.render_order(order) }}
{% endfor %}
2015-06-04 21:20:38 +02:00
{% else %}
<h4>No orders available.</h4>
{% if not current_user.is_anonymous() %}
To create an order, fill in the form on the right.
{% else %}
Login to create an order, or ask someone else.
{% endif %}
{%- endif %}
2015-03-31 20:15:22 +02:00
</div>
{% if not current_user.is_anonymous() %}
<div class="col-md-push-1 col-md-6">
<h3>Create new order:</h3>
<div class="row darker">
<div class="col-sm-12">
<form method="post" action="{{ url_for('order_bp.order_create') }}">
2015-03-31 20:15:22 +02:00
{{ form.csrf_token }}
<div class="form-group select2 {{ 'has-errors' if form.courier_id.errors else ''}}">
{{ form.courier_id.label(class='control-label') }}<br>
{{ form.courier_id(class='form-control select') }}
{{ util.render_form_field_errors(form.courier_id) }}
2015-03-31 20:15:22 +02:00
</div>
<div class="form-group select2 {{ 'has-errors' if form.location_id.errors else ''}}{{ ' required' if form.location_id.flags.required }}">
{{ form.location_id.label(class='control-label') }}
{{ form.location_id(class='form-control select') }}
{{ util.render_form_field_errors(form.location_id) }}
</div>
{% if current_user.is_admin() %}
<div class="form-group{{ ' has-error' if form.starttime.errors }}{{ ' required' if form.starttime.flags.required }}{{ ' hidden' if not current_user.is_admin() }}">
{{ form.starttime.label(class='control-label') }}
<div class='input-group date' class='datetimepicker'>
{{ form.starttime(class='form-control datetimepicker') }}
<span class="input-group-addon">
<span class="glyphicon glyphicon-calendar"></span>
</span>
</div>
{{ util.render_form_field_errors(form.starttime) }}
</div>
{% endif %}
2015-06-18 14:39:42 +02:00
<div class="form-group{{ ' has-error' if form.stoptime.errors }}{{ ' required' if form.stoptime.flags.required }}">
2015-03-31 20:15:22 +02:00
{{ form.stoptime.label(class='control-label') }}
<div class='input-group date' class='datetimepicker'>
{{ form.stoptime(class='form-control datetimepicker') }}
<span class="input-group-addon">
<span class="glyphicon glyphicon-calendar"></span>
</span>
</div>
{{ util.render_form_field_errors(form.stoptime) }}
</div>
<div class="form-group">
{{ form.submit_button(class='btn btn-primary') }}
</div>
</form>
</div>
</div>
</div>
{% endif %}
</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') }}" />
2015-03-31 20:15:22 +02:00
{%- endblock %}
{% block scripts -%}
{{ super() }}
<script src="{{ url_for('static', filename='js/select2.min.js') }}"></script>
2015-03-31 20:15:22 +02:00
<script src="{{ url_for('static', filename='js/moment.min.js') }}"></script>
<script src="{{ url_for('static', filename='js/bootstrap-datetimepicker.min.js') }}"></script>
<script type="text/javascript">
$.ready(function(){
$('.select').select2();
$('.datetimepicker').datetimepicker({
format: 'DD-MM-YYYY HH:mm'
});
}());
</script>
2019-04-05 23:10:12 +02:00
{%- endblock %}