{% extends "base.html" %}

{% block title %}Error -
{% if error == "no_job" %}Unknown test{% endif %}
{% if error == "no_project" %}Unknown project{% endif %}
{% if error == "no_data_in_trail" %}No data yet{% endif %}
{% endblock %}

{% block headerblock %}maxi{% endblock %}

{% block navigation %}{% endblock %}

{% block sort %}{% endblock %}
{% block bages %}{% endblock %}
{% block body %}
<div class="container-fluid">
<div class="jumbotron" style="background-color: white;">
<table>
	<tr>
		<td style="vertical-align: top; padding-left: 30px;">
		<h2 style="margin-top: 0px;" class="errorpage__title">
			{% if error == "no_job" %}There's no such test{% endif %}
			{% if error == "no_project" %}There's no such project{% endif %}
			{% if error == "no_data_in_trail" %}This test has no data yet{% endif %}
            {% if error == "no_compare_jobs" %}No jobs to compare selected{% endif %}
		</h2>
		<div class="errorpage__text">
			{% if error == "no_job" %}It might have been deleted or never existed at all.{% endif %}
			{% if error == "no_project" %}Please check the URI.{% endif %}
			{% if error == "no_data_in_trail" %}Page refreshes every 10 seconds.
                {% if owner %}
                    <div class="b-global-error__onlinestop">
                        <button type="button" class="btn btn-secondary" id="online_stop" style="margin-top: 35px;">
                              Stop test
                        </button>
                        <div class="input-group" id="online_stop__dialog" style="display: none; margin-top: 35px;">
                            <span class="input-group-addon" id="basic-addon3">
                               Stop test?
                            </span>
                            <span class="input-group-btn">
                                <button type="button" class="btn btn-danger" id="online_stop__ok" data-job="{{ job.n }}">
                                             Yes
                                </button>
                                <button type="button" class="btn btn-secondary" id="online_stop__cancel">
                                             No
                                </button>
                            </span>
                        </div>
                    </div>
                    <div class="b-global-error__onlineredirect">

                        <span class="b-overload-onlinepage__loading_img fa fa-circle-o-notch fa-spin"></span>&ensp;Stopping ...

                    </div>
                    <script nonce='{{ common.CSP_SCRIPT_NONCE }}' type="text/javascript">
                        $('#online_stop').on('click', function(event) {
                            $(this).hide();
                            $('#online_stop__dialog').show()
                        });

                        $('#online_stop__cancel').on('click', function(event) {
                            $('#online_stop__dialog').hide();
                            $('#online_stop').show()
                        });

                        $('#online_stop__ok').on('click', function(event) {
                            var job = $(this).data('job');
                            $.ajax({
                                url : '/api/jobclose_frontend?job_n=' + job,
                                type : 'GET',
                                async: false,
                                success: function(){
                                    window.location = '/' + job
                                }
                            })
                        })
                    </script>
                {% endif %}
			{% endif %}
            {% if error == "no_compare_jobs" %}
			<div>
			<form method="POST" action="/compare/add_jobs" style="white-space: nowrap;">
				<div class="input-group firestarter-input">
					{% csrf_token %}
					<input class="form-control" type="text" maxlength="64" value="" placeholder="Job numbers separated by comma" size="20" id="jobs" name="jobs">
                    <input hidden checked type="checkbox" value="errorpage" name="errorpage">
				      <span class="input-group-btn">
				      	<input class="btn btn-secondary" type="submit" value="Add">
				      </span>
				</div>
			</form>
			</div>
			{% endif %}
		</div>
		</td>
	</tr>
</table>
</div>
</div>



{% endblock %}