{% load i18n %}

<p>
    {% blocktrans %}
    Please specify a coordinate ranges in x, y, z. The query will result in objects that have coordinates in the search box.
    {% endblocktrans %}
</p>

<p>
    {% blocktrans %}
    Optionally, you can specify the name of the resulting database table and/or asign a run id, to group associated queries in the job list. Please choose a queue with a suitable timeout for your query.
    {% endblocktrans %}
</p>

<div class="row fieldset">
    <div class="col-md-6">
        <formgroup
            data-id="x_min"
            data-type="text"
            data-label="{% trans 'X min' %}"
            data-model="service.forms.box.values.x_min"
            data-errors="service.forms.box.errors.x_min">
        </formgroup>
    </div>
    <div class="col-md-6">
        <formgroup
            data-id="x_max"
            data-type="text"
            data-label="{% trans 'X max' %}"
            data-model="service.forms.box.values.x_max"
            data-errors="service.forms.box.errors.x_max">
        </formgroup>
    </div>
</div>

<div class="row fieldset">
    <div class="col-md-6">
        <formgroup
            data-id="y_min"
            data-type="text"
            data-label="{% trans 'Y min' %}"
            data-model="service.forms.box.values.y_min"
            data-errors="service.forms.box.errors.y_min">
        </formgroup>
    </div>
    <div class="col-md-6">
        <formgroup
            data-id="y_max"
            data-type="text"
            data-label="{% trans 'Y max' %}"
            data-model="service.forms.box.values.y_max"
            data-errors="service.forms.box.errors.y_max">
        </formgroup>
    </div>
</div>

<div class="row fieldset">
    <div class="col-md-6">
        <formgroup
            data-id="z_min"
            data-type="text"
            data-label="{% trans 'Z min' %}"
            data-model="service.forms.box.values.z_min"
            data-errors="service.forms.box.errors.z_min">
        </formgroup>
    </div>
    <div class="col-md-6">
        <formgroup
            data-id="z_max"
            data-type="text"
            data-label="{% trans 'Z max' %}"
            data-model="service.forms.box.values.z_max"
            data-errors="service.forms.box.errors.z_max">
        </formgroup>
    </div>
</div>

<ul class="help-block list-unstyled">
    <li class="text-danger" ng-repeat="error in service.forms.box.errors.query">{$ error $}</li>
</ul>

<div class="row">
    <formgroup
        class="col-md-6"
        data-type="text"
        data-label="{% trans 'Table name' %}"
        data-model="service.forms.box.values.table_name"
        data-errors="service.forms.box.errors.table_name">
    </formgroup>
    <formgroup
        class="col-md-3"
        data-type="text"
        data-label="{% trans 'Run id' %}"
        data-model="service.forms.box.values.run_id"
        data-errors="service.forms.box.errors.run_id">
    </formgroup>
    <formgroup
        class="col-md-3"
        data-type="select"
        data-label="{% trans 'Queue' %}"
        data-model="service.active_queue"
        data-options="service.queues"
        data-options-label="text">
    </formgroup>
</div>

<button class="btn btn-primary" ng-click="service.forms.box.submit()">
    {% trans 'Submit new box search' %} <submitting />
</button>

<p class="text-danger" ng-if="service.forms.box.errors.detail">
    {$ service.forms.box.errors.detail $}
</p>
<p class="text-danger" ng-if="service.forms.box.errors.server_error">
    {% trans 'There has been an error on the server. Please contact the maintainers of this site, if the problem persists' %}
</p>
