{include file="left.tpl"}

<script src="../modules/editors/tinymce/tinymce.min.js"></script>
<script>
	jQuery(document).ready(function($)
	{
		<? if('{allow}' == '1') { ?>
			init_tinymce('text', 'lite', '{file_manager_theme}', '{file_manager}', '<? echo md5($conf->code); ?>');

			$('#msgsmile').popover({html: true, animation: true, trigger: 'click'});
			$('#msgsmile').on('show.bs.popover', function()
			{
				$(document).mouseup(function(e)
				{
					var container = $('.popover-content');

					if(container.has(e.target).length === 0)
					{
						$('#msgsmile').popover('hide');

						selected = 'gcms_smiles';
					}
				});
			});

			get_smiles('#msgsmile', 1);
		<? } ?>

		$('#ban').modal('hide');

		load_ban_comments('{id}');
	});

	function set_smile(elem)
	{
		var smile = '<img src="'+$(elem).attr('src')+'" class="g_smile" height="20px" width="20px"> ';

		tinymce.activeEditor.insertContent(smile);

		selected = 'gcms_smiles';
	}

	function close_ban(id, type, bid)
	{
		if(confirm('Вы уверены?'))
		{
			NProgress.start();

			$.ajax({
				type: 'POST',
				url: '../ajax/actions_c.php',
				data: 'phpaction=1&close_ban=1&token='+$('#token').val()+'&id='+id+'&type='+type+'&bid='+bid,
				dataType: 'json',
				success: function(result)
				{
					NProgress.done();

					if (result.status == 1)
					{
						setTimeout(show_ok, 500);

						$('#closed').html('<a href="../profile?id='+result.closed + '">'+result.closed_a+'</a>');

						$('#status').removeClass('text-success');
						$('#status').removeClass('text-success');
						$('#status').removeClass('text-danger');

						if(type == 1)
						{
							$('#status').addClass('text-success');
							$('#status').html('Разбанен');

							if(bid != '0')
								alert('Игрок разбанен автоматически.');
							else
								alert('Разбаньте игрока вручную.');
						}else{
							$('#status').addClass('text-danger');
							$('#status').html('Не разбанен');
						}
					}
					if (result.status == 2) {
						setTimeout(show_error, 500);
					}
				}
			})
		}
	}
</script>

<div class="content float-right">
	<div class="block">
		<div class="header">Информация</div>
		<div class="block-content">
			<table class="table-list">
				<tr class="bh">
					<td width="1%" align="center"><i class="fa fa-server" aria-hidden="true"></i></td>
					<td width="20%">Сервер:</td>
					<td>{server}</td>
				</tr>
				<tr class="bh">
					<td align="center"><i class="fa fa-user-circle-o" aria-hidden="true"></i></td>
					<td>Заявитель:</td>
					<td><a href="../profile?id={author_id}"><u>{author_login}</u></a></td>
				</tr>
				<tr class="bh">
					<td align="center"><i class="fa fa-address-book-o" aria-hidden="true"></i></td>
					<td>Ник:</td>
					<td>{nick}</td>
				</tr>
				<tr class="bh">
					<td align="center"><i class="fa fa-ban" aria-hidden="true"></i></td>
					<td>Причина:</td>
					<td>{reason}</td>
				</tr>
				<tr class="bh">
					<td align="center"><i class="fa fa-heartbeat" aria-hidden="true"></i></td>
					<td>Статус:</td>
					<td><span id="status" class="text-{color}">{status}</span></td>
				</tr>
				<tr>
					<td align="center"><i class="fa fa-clock-o" aria-hidden="true"></i></td>
					<td>Дата создания:</td>
					<td>{date}</td>
				</tr>
				<tr>
					<td align="center"><i class="fa fa-eye" aria-hidden="true"></i></td>
					<td>Рассмотрел:</td>
					<? if('{closed}' != '0') { ?>
						<td><a href="../profile?id={closed}"><u>{closed_a}</u></a></td>
					<? } else { ?>
						<td id="closed">{status}</td>
					<? } ?>
				</tr>
			</table>
			<div class="space m-t-5"></div>

			<div class="form-input">
				<label>Пояснение</label>
			</div>
			<p>{text}</p>

			<div class="space"></div>

			<? if(('{bid}' != '0') || (strripos($users_groups[$sessionrights]['rights'], "i") !== false)){ ?>
				<div class="form-input">
					<label>Операции</label>
				</div>
			<? } ?>
			<? if('{bid}' != '0'){ ?>
				<div class="btn blue float-left m-r-5" onclick="search_ban('{serv_id}')">Найти</div>

				<div id="ban" class="modal fade bs-example-modal-lg" tabindex="-1" role="dialog" aria-hidden="true">
					<div class="modal-dialog modal-lg">
						<div class="modal-content">
							<div class="modal-header">
								<h4 class="modal-title">Подробная информация</h4>
							</div>
							<div class="modal-body" id="baninfo">
							</div>
							<div class="modal-footer">
								<button type="button" class="btn btn-default" data-dismiss="modal">Закрыть</button>
							</div>
						</div>
					</div>
				</div>

				<input type="hidden" id="search_ban" value="{bid}">
			<? } ?>
			<? if(strripos($users_groups[$sessionrights]['rights'], "i") !== false){ ?>
				<div id="buttons">
					<div class="btn green float-left m-r-5" onclick="close_ban({id}, '1', '{bid}')">Разбанен</div>
					<div class="btn float-left m-r-5" onclick="close_ban({id}, '2', '{bid}')">Не разбанен</div>
				</div>
			<? } ?>
			<? if(strripos($users_groups[$sessionrights]['rights'], "o") !== false){ ?>
				<div class="btn red float-left" onclick="dell_ban({id})">Удалить</div>
			<? } ?>

			<div class="clear"></div>
		</div>
	</div>

	<div class="block">
		<div class="header">Доказательства</div>
		<div class="block-content">
			<div class="form-input">
				<label>Скриншоты</label>
			</div>
			<? if('{imgs}' == '0'){ ?>
				<div class="bs-callout bs-callout-error bs-mini"><p>Пользователь не прикрепил скриншотов.</p></div>
			<? } else { ?>
				<div class="upload-image">{imgs}</div>
			<? } ?>

			<div class="clear"></div>

			<div class="form-input">
				<label>Демо</label>
			</div>
			<? if('{imgs}' == '0'){ ?>
				<div class="bs-callout bs-callout-error bs-mini"><p>Пользователь не указал ссылку на демо.</p></div>
			<? } else { ?>
				<a href="{demo}" target="_blank"><div class="btn float-left" onclick="close_ban({id}, '2', '{bid}')">Скачать</div></a>
			<? } ?>

			<div class="clear"></div>
		</div>
	</div>

	<? if('{allow}' == '1') { ?>
		<link href="{site_host}templates/SquareLine/css/_small.css" rel="stylesheet">

		<div class="space"></div>

		<div class="block">
			<div class="header">Оставить комментарий</div>
			<div class="block-content">
				<textarea id="text" maxlenght="500"></textarea>

				<div class="message-send">
					<i class="fa fa-smile-o" data-container="body" data-content="empty" data-placement="top" data-toggle="popover" id="msgsmile"></i>

					<div class="btn float-right" onclick="send_ban_comment('{id}')">Отправить</div>
				</div>
			</div>
		</div>
		<div class="clear"></div>
	<? } ?>

	<div class="block">
		<div class="header">Комментарии</div>
		<div class="block-content">
			<div id="comments"></div>
		</div>
	</div>
</div>