<!-- начало багтрекер -->
<div id="bt_main">
{include file="bug_tracker/toolbar.tpl"}

	<h2 id="summary_head">{$item->summary|escape}</h2>
	<h3 class="version">{t}Версия{/t}: {$versions[$item->version_id]|escape}</h3>
	{if access('approve,perform')}

	<form method="post" action="">
	<div id="bug_info" class="form-horizontal col-lg-4 pull-right">
		<input type="hidden" name="token" value="{$_user->token}" />
		<div class="form-group">
			<label class="col-lg-3 control-label" for="type-0">{t}Тип{/t}</label>
			<div class="col-lg-9">
				<select name="type" id="type-0" class="form-control">
					{html_options options=$bug_types selected=$item->type}
				</select>
			</div>
			<label class="col-lg-3 control-label" for="version_id-0">{t}Версия{/t}</label>
			<div class="col-lg-9">
				<select name="version_id" id="version_id-0" class="form-control">
					{html_options options=$versions selected=$item->version_id}
				</select>
			</div>
			<label class="col-lg-3 control-label" for="status-0">{t}Статус{/t}</label>
			<div class="col-lg-9">
				<select name="status" id="status-0" class="form-control">
					{html_options options=$statuses selected=$item->status}
				</select>
			</div>
			<label class="col-lg-3 control-label" for="importance-0">{t}Важность{/t}</label>
			<div class="col-lg-9">
				<select name="importance" id="importance-0" class="form-control">
					{html_options options=$importances selected=$item->importance}
				</select>
			</div>
		</div>
		<input type="submit" class="btn btn-default" value="{t}применить{/t}" />
	</div>
	</form>
	{else}
	<div id="bug_info">
		<b>{t}Тип{/t}:</b> {$bug_types[$item->type]}<br />
		<b>{t}Статус{/t}:</b> {$statuses[$item->status]}<br />
		<b>{t}Важность{/t}:</b> {$importances[$item->importance]}<br />
	</div>
	{/if}
	
	{if $_user->isNotGuest()}
		<script type="text/javascript">
			var token='{$_user->token}';
			var ajax_url='{url action="ajax" type="json"}';
		</script>
		<div class="clearfix"></div>
		<form class="checkbox">
			<label><input {if $item_subscribed}checked="checked" {/if}type="checkbox" onchange="subscribe(this, {$item->id})" /> Подписаться на тему</label>
		</form>
	{/if}
	
	<table id="bug_comments" class="current-theme table table-bordered">
	{foreach $posts as $post_id=>$post}
	<tr id="btc{$post->id}">
		<td class="user_data">
			{include file="login/user_item.tpl" user=$post->user}
		</td>
		<td class="bug_info">
			<div class="post-info">
				<div class="btn-group pull-right">
					{if access('user')}<a class="btn btn-default btn-xs" title="{t}ответить{/t}" href="{url action="reply" var1=$post->id}"><img class="icon" src="/skins/default/images/icons/simple_add.png" alt="{t}ответить{/t}" /></a>{/if}
					{if $post->isAccessEdit()}<a class="btn btn-default btn-xs" title="{t}исправить{/t}" href="{url action="edit" var1=$post->id}"><img class="icon" src="/skins/default/images/icons/simple_edit.png" alt="{t}исправить{/t}" /></a>{/if}
					{if $post->isAccessDelete()}<a class="btn btn-default btn-xs" title="{t}удалить{/t}" onclick="return confirm('{t}удалить?{/t}');" href="{url action="delete" var1=$post->id token=1}"><img class="icon" src="/skins/default/images/icons/simple_delete.png" alt="{t}удалить{/t}" /></a>{/if}	
				</div>
				<div class="smalltext">{$post->putdate|date_format:"d.m.Y"}</div>
			</div>
			<div class="post">{$post->msg_html}</div>
			{if $post->files}
				<br />{t}Файлы{/t}:
				{foreach $post->files as $file_id=>$file}
					{if !$file->image}<a class="bug_file" href="{$file->path}">{$file->name|escape}</a>{/if}
				{/foreach}
				<br />
				{foreach $post->files as $file_id=>$file}
					{if $file->image}<a class="bug_image" href="{$file->path['big']}" title="{$file->name|escape}"><img src="{$file->path['small']}" alt="{$file->name|escape}" /></a>{/if}
				{/foreach}
			{/if}
		</td></tr>
	{/foreach}
	</table>
</div>
<!-- конец багтрекер -->