<!DOCTYPE html>

{% extends "base.html" %}
{% block pagename %}offlinepage{% endblock %}
{% block title %} Edit test {{ job.n }}{% endblock %}

{% block headerblock %}mini{% endblock %}

{% block body %}

<script nonce='{{ common.CSP_SCRIPT_NONCE }}'>
function testForEnter(event) {
	if (event.ctrlKey && event.key === "Enter") {
		$("#firestarter-submit").click()
	}
	else if (event.key === "Enter")
		{        
        event.preventDefault();
    }
}

</script>

<div class="container-fluid maxw1000">
<h1>Edit test {{ job.n }} {% if job.name %} ({{ job.name }}){% endif %}</h1>
<br>
<form method="POST" action="edit" id="jobEditForm">
	{% csrf_token %}
	<input type="hidden" value="{{ job.n }}" name="job_update">
	<input type="hidden" value="" name="user">
	<div class="input-group firestarter-input">
		<span class="input-group-addon firestarter-input__title" id="input-group-addon__task">Project&emsp;</span>
		<select class="form-control selectpicker" data-live-search="true" data-style="btn-secondary" id="project_select" size="1" name="up_new">
			{% for project in projects %}
				{% if project == job.project %}
					<option selected value="{{ project.n }}">{{ project.name }}</option>
				{% else %}
					<option value="{{ project.n }}">{{ project.name }}</option>
				{% endif %}
			{% endfor %}
		</select>
	</div>
	<div class="input-group firestarter-input">
		<span class="input-group-addon firestarter-input__title">Name&emsp;</span>
		<input maxlength="120" type="text" class="form-control firestarter-input" placeholder="Name" value="{{ job.name }}" name="name_new" onkeydown="testForEnter(event);"/>
	</div>
	<div class="input-group firestarter-input">
		<span class="input-group-addon firestarter-input__title">Description&emsp;</span>
		<input type="text" rows="6" cols="60" class="form-control firestarter-input" placeholder="Description" value="{{ job.dsc }}" name="dsc_new" onkeydown="testForEnter(event);"/>
	</div>
	<div class="input-group firestarter-input">
		<span class="input-group-addon firestarter-input__title">Version&emsp;</span>
		<input maxlength="120" type="text" class="form-control firestarter-input" placeholder="Version" value="{{ job.ver }}" name="ver_new" onkeydown="testForEnter(event);"/>
	</div>
	<br>
	<input type="submit" value="Save" class="btn btn-brand">
</form>
</div>


<script nonce='{{ common.CSP_SCRIPT_NONCE }}' type="text/javascript">

$(document).ready(function(){
	
	$('#project_select').selectpicker();
	 
});
</script>

{% endblock %}