<!DOCTYPE html>

{% extends "base.html" %}
{% block pagename %}mobilepage{% endblock %}
{% block title %} Редактирование стрельбы {{ job.n }}{% endblock %}

{% block body %}

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

</script>


<div class="container-fluid">
<h1>Редактирование мобильной стрельбы {{ job.n }}</h1>
<br>
<form method="POST" action="edit" style="white-space: nowrap;">
	{% 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" style="width: 150px; text-align: left;">Имя стрельбы&nbsp;</span>
		<input maxlength="120" type="text" class="form-control firestarter-input" placeholder="Имя" value="{{ job.name }}" name="name_new" onkeydown="testForEnter(event);"/>
	</div>
	<div class="input-group firestarter-input">
		<span class="input-group-addon" style="width: 150px; text-align: left;">Описание&emsp;</span>
		<input type="text" class="form-control firestarter-input" placeholder="Описание" value="{{ job.dsc }}" name="dsc_new" onkeydown="testForEnter(event);"/>
	</div>
	<div class="input-group firestarter-input">
		<span class="input-group-addon" style="width: 150px; text-align: left;" id="input-group-addon__task">Задача&emsp;</span>
		<select class="form-control selectpicker" data-live-search="true" data-style="btn-secondary" id="task_select" size="1" name="task_new">
			{% for task in tasks %}
				{% if task.key == job.task %}
					<option selected value="{{ task.key }}">{{ task.key }}</option>
				{% else %}
					<option value="{{ task.key }}">{{ task.key }}</option>
				{% endif %}
			{% endfor %}
		</select>
	</div>
	<div class="input-group firestarter-input">
		<span class="input-group-addon" style="width: 150px; text-align: left;">Устройство&emsp;</span>
		<input maxlength="120" type="text" class="form-control firestarter-input" placeholder="Типа айфончик или нексус" value="{{ job.device_model }}" name="device_model_new" onkeydown="testForEnter(event);"/>
	</div>
	<div class="input-group firestarter-input">
		<span class="input-group-addon" style="width: 150px; text-align: left;">Операционка&emsp;</span>
		<input maxlength="120" type="text" class="form-control firestarter-input" placeholder="Версия операционной системы" value="{{ job.device_os }}" name="device_os_new" onkeydown="testForEnter(event);"/>
	</div>
	<div class="input-group firestarter-input">
		<span class="input-group-addon" style="width: 150px; text-align: left;">Приложение&emsp;</span>
		<input maxlength="120" type="text" class="form-control firestarter-input" placeholder="Приложение" value="{{ job.app }}" name="app_new" onkeydown="testForEnter(event);"/>
	</div>
	<div class="input-group firestarter-input">
		<span class="input-group-addon" style="width: 150px; text-align: left;">Версия&emsp;</span>
		<input maxlength="120" type="text" class="form-control firestarter-input" placeholder="Версия приложения" value="{{ job.ver }}" name="ver_new" onkeydown="testForEnter(event);"/>
	</div>
	<div class="input-group firestarter-input">
		<span class="input-group-addon" style="width: 150px; text-align: left;" id="input-group-addon__task">Компонент&emsp;</span>
		<select class="form-control selectpicker" data-live-search="true" data-style="btn-secondary" id="component_select" size="1" name="component_new">
			<option value=""></option>
			{% for component in components %}
				{% if component.name == job.component %}
					<option selected value="{{ component.n }}">{{ component.name }}</option>
				{% else %}
					<option value="{{ component.n }}">{{ component.name }}</option>
				{% endif %}
			{% endfor %}
		</select>
	</div>
	<br>
	<input type="submit" value="Сохранить" class="btn btn-brand">
</form>
</div>


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

$(document).ready(function(){
	
	$('#task_select').selectpicker();
	$('#component_select').selectpicker();
	$('#target_select').selectpicker();
	 
});
</script>
<link href="/media/css/firestarter.css" type="text/css" rel="stylesheet" />

{% endblock %}