<div class="col-md-6">
	<div class="block">
		<div class="block_head">
			<span class="glyphicon glyphicon-question-sign"></span> Вопрос
		</div>
		<div class="with_code">{text}</div>
	</div>
</div>
<div class="col-md-6">
	<div class="block">
		<div class="block_head">
			<span class="glyphicon glyphicon-align-left"></span> Информация
		</div>
		<p><span class="glyphicon glyphicon-tasks"></span> <b>Тема:</b> {name}</p>
		<p><span class="glyphicon glyphicon-user"></span> <b>Автор:</b> <a target="_blank" href="../profile?id={author_id}">{author_login}</a></p>
		<p>
			<span class="glyphicon glyphicon-map-marker"></span> <b>Статус:</b> 
			{if('{status}' == '1')}
				<span id="status" class="label label-info">Открыт</span>
			{else}
				<span id="status" class="label label-success">Закрыт</span>
			{/if}
		</p>
		<p><span class="glyphicon glyphicon-calendar"></span> <b>Дата</b> {date}</p>
		<hr>
		<span class="glyphicon glyphicon-th"></span> Файл <br>
		{if('{files}' == 'none')} 
			Пользователь не прикрепил файлов
		{else}
			<p><a target="_blank" class="btn2" href="../{{$ticket->files}}">Скачать файл <span class="glyphicon glyphicon-link"></span></a></p>
		{/if}
		{if(('{status}' == '1') or (is_worthy("l")))}
			<hr>
			<span class="glyphicon glyphicon-cog"></span> Действие <br>
		{/if}
		{if('{status}' == '1')}
			<button class="btn2" onclick="close_ticket('{id}')">Закрыть тикет <span class="glyphicon glyphicon-remove"></span></button>
		{/if}
		{if(is_worthy("l"))}
			<button class="btn2" onclick="dell_ticket('{id}')">Удалить тикет <span class="glyphicon glyphicon-trash"></span></button>
		{/if}
	</div>
</div>
<div class="col-md-12">
	<div class="block">
		<div class="block_head">
			<span class="glyphicon glyphicon-comment"></span> Комментарии
		</div>
		<div id="add_ticket_answer" class="mt-10">
			{if('{status}' == '1')}
				<textarea id="text" class="form-control maxMinW100" maxlenght="1000"></textarea>
				<div class="smile_input_forum">
					<input id="send_btn" class="btn2 mt-10" type="button" onclick="send_ticket_answer({id});" value="Отправить"></input>
					<div id="smile_btn" class="smile_btn visible-lg-inline-block" data-container="body" data-toggle="popover" data-placement="top" data-content="empty"></div>
				</div>
			{else}
				<div class="disabled_input form-control">Тикет закрыт <span class="glyphicon glyphicon-ban-circle"></span></div>
			{/if}
		</div>
		<div id="answers">
			<center><img src="{site_host}templates/{template}/img/loader.gif"></center><br>
		</div>
		<script>load_ticket_answers("{id}");</script>
	</div>
</div>
<script>
	$(document).ready(function() {
		init_tinymce("text", "lite", "{file_manager_theme}", "{file_manager}", "{{md5($conf->code)}}");
		get_smiles('#smile_btn', 1);
	});

	$('#smile_btn').popover({ html: true, animation: true, trigger: "click" });
	$('#smile_btn').on('show.bs.popover', function () {
		$(document).mouseup(function (e) {
			var container = $(".popover-content");
			if (container.has(e.target).length === 0){
				$('#smile_btn').popover('hide'); selected = 'gcms_smiles';
			}
		});
	});

	function set_smile(elem){
		var smile =  "<img src=\""+$(elem).attr("src")+"\" class=\"g_smile\" height=\"20px\" width=\"20px\">";
		tinymce.activeEditor.insertContent(smile);
		$('#smile_btn').popover('hide'); selected = 'gcms_smiles';
	}
</script>