<div class="pd-15">
	<div class="block">
		<div class="block_head">
			Создать тикет
		</div>
		<div class="form-group">
			<h4><span class="glyphicon glyphicon-comment"></span> Тема </h4>
			<input type="text" class="form-control" id="name" maxlength="255" autocomplete="off">
		</div>
		<div class="form-group">
			<h4><span class="glyphicon glyphicon-pencil"></span> Текст</h4>
			<textarea id="text" class="form-control maxMinW100" rows="10" maxlength="2000"></textarea>
		</div>
		<form enctype="multipart/form-data" action="../ajax/actions_a.php" method="POST" id="load_file_form">
			<input class="disp-n vis-h" type="text" id="token" name="token" value="{token}">
			<input class="disp-n vis-h" type="text" id="load_file" name="load_file" value="1">
			<input class="disp-n vis-h" type="text" id="phpaction" name="phpaction" value="1">
			<input type="file" class="input-file f-l" name="file" id="file">
			<button id="load_btn" type="submit" class="btn2 btn-cancel f-l btn-big ml-10">Загрузить</button>
			<br><br>
			<div id="load_file_result"></div>
		</form>
		<small class="mt-10" id="load_error_message">* Разрешаемое расширение файла: rar, zip, 7z, jpg, jpeg, png</small>
		<div id="ticket_result"></div>
		<button onclick="add_ticket();" type="button" class="btn2 btn-lg">Создать</button><br>
	</div>
</div>

<script>
	$(document).ready(function() {
		init_tinymce("text", "lite", "{file_manager_theme}", "{file_manager}", "{{md5($conf->code)}}");
	});
	$("#load_file_form").submit(function (event){
		event.preventDefault();
		var data = new FormData($('#load_file_form')[0]);
		$.ajax({
			type: "POST",
			url: "../ajax/actions_a.php",
			data: data,
			contentType: false,
			processData: false,
			beforeSend: function() {
				$('#load_btn').empty();
				$('#load_btn').append('<img id="file_loader" src="{site_host}templates/{template}/img/loader.gif">');
			}
		}).done(function (html) {
			$("#load_file_result").empty();
			$("#load_file_result").append(html);
			$('#load_btn').empty();
			$('#load_btn').append('Загрузить');
			$('#load_file_form')[0].reset();
		});
	});
</script>