<div class="col-lg-9 order-is-first">
	{if('{dell}' != '1')}
	<div class="block profile transparent">
		<div class="block_head">
			Профиль
		</div>
		
		<div class="row profile-page">
			<div class="col-lg-8">
				<div class="block">
					<div class="row">
						<div class="col-lg-4 profile-avatar">
							<img src="../{avatar}" alt="{login}">
							<div id="result_profile"></div>
							<ul class="collapsible-menu">
								<li class="collapsible">
									<a href="#">
										Действие <i class="fas fa-angle-down"></i>
									</a>
									<ul>
										{menu}
									</ul>
								</li>
							</ul>
						</div>

						<div class="col-lg-8 profile-info">
							<h2>
								{login}
								{if('{last_activity}' == 'Онлайн')}
									<small class="point"></small>
								{else}
									<small>{last_activity}</small>
								{/if}
							</h2>

							<span style="color: {group_color}">{group}</span>
							
							<div class="profile-data">
								<p>ID <b>{profile_id}</b></p>

								{if('{skype}' != '' && '{skype}' != '---')}
									<p>
										Skype
										<b>
											<a title="Добавить в скайп" href="skype:{skype}?add">{skype}</a>
										</b>
									</p>
								{/if}
								{if('{telegram}' != '')}
									<p>
										Телеграм
										<b>
											<a title="Написать в телеграм" target="_blank" href="https://telegram.me/{telegram}">@{telegram}</a>
										</b>
									</p>
								{/if}
								{if('{vk}' != '---')}
									<p>
										Вконтакте
										<b>
											<a title="Перейти в профиль Вконтакте" target="_blank" href="https://vk.com/{vk}" id="vk_user">
												<img src="../files/avatars/no_avatar.jpg" alt="">
												<span>Загрузка...</span>
											</a>
											<script>get_vk_profile_info('{vk_api}', '#vk_user img', '#vk_user span', '{vk}');</script>
										</b>
									</p>
								{/if}
								{if('{steam_api}' != '0')}
									<p>
										Steam
										<b>
											<a title="Перейти в профиль Steam" target="_blank" href="https://steamcommunity.com/profiles/{steam_api}/" id="steam_user">
												<img src="../files/avatars/no_avatar.jpg" alt="">
												<span>Загрузка...</span>
											</a>
											<script>get_user_steam_info('{steam_api}');</script>
										</b>
									</p>
								{/if}
                                {if(!empty($profile->steam_id) && $profile->steam_id != '---')}
                                <p id="fk">
                                  	Fastcup
                                  	<b>
                                      	<a title="Перейти в профиль" target="_blank" href="" id="fk_link">
                                        	<!--<img src="../files/avatars/no_avatar.jpg" alt="" class="vk_avatar_img2">-->
                                      		<span>Загрузка...</span>
                                      	</a>
                                        <script>
                                            var data = JSON.parse('<?php echo file_get_contents("https://fastcup.net/?act=api&plain=1&getUser=".$profile->steam_id); ?>');
                                            if(data.status == 'ok') {
                                                var skill = Math.round(data.result['game_stats'][0]['stat_rating'] / 10);
                                                if(skill < 60) {
                                                    skill = '[L-]: '+skill;
                                                } else if(skill > 60 && skill < 75) {
                                                    skill = '[LS]: '+skill;
                                                } else if(skill > 75 && skill < 85) {
                                                    skill = '[L+]: '+skill;
                                                } else if(skill > 85 && skill < 100) {
                                                    skill = '[M-]: '+skill;
                                                } else if(skill > 100 && skill < 115) {
                                                    skill = '[MS]: '+skill;
                                                } else if(skill > 115 && skill < 130) {
                                                    skill = '[M+]: '+skill;
                                                } else if(skill > 130 && skill < 140) {
                                                    skill = '[H-]: '+skill;
                                                } else if(skill > 140 && skill < 75) {
                                                    skill = '[HS] '+skill;
                                                } else if(skill > 140 && skill < 150) {
                                                    skill = '[H+]: '+skill;
                                                } else if(skill > 150 && skill < 165) {
                                                    skill = '[P-]: '+skill;
                                                } else if(skill > 165 && skill < 180) {
                                                    skill = '[PS]: '+skill;
                                                } else if(skill > 180 && skill < 195) {
                                                    skill = '[P+]: '+skill;
                                                } else if(skill > 195 && skill < 210) {
                                                    skill = '[G]: '+skill;
                                                }

                                                $("#fk_link").attr('href', 'https://fastcup.net/member.html?id='+data.result['id']);
                                                $("#fk_link span").html(data.result['name']+" | "+skill);
                                                $("#fk_link img").attr('src', 'http://cdn.fastcup.net/users/'+data.result['miniava']+'.jpg');
                                            } else {
                                                 $("#fk").fadeOut(1);
                                            }
                                        </script>
                                    </b>
                                </p>
                                {/if}
								{if('{fb}' != '0')}
									<p>
										Facebook
										<b>
											<a title="Профиль в Facebook" target="_blank" id="fb_user">
												<img src="../files/avatars/no_avatar.jpg" alt="">
												<span>Загрузка...</span>
											</a>
											<script> get_fb_profile_info('{fb_api}', '{fb}', '#fb_user', '#fb_user img', '#fb_user span'); </script>
										</b>
									</p>
								{/if}
							</div>
						</div>
					</div>
				</div>

				<div class="row">
					<div class="col-lg-6">
						<div class="block profile-data-secondary">
							<p>Ник на сервере <br><b>{nick}</b></p>
							<p>Префикс на сервере</br><b><? echo $profile->prefix?></b></p>
							<p>Дата регистрации <br><b>{regdate}</b></p>
							<p>Имя <br><b>{name}</b></p>
							<p>Дата рождения <br><b>{birth}</b></p>
						</div>
					</div>
					<div class="col-lg-6">
						<div class="block profile-data-secondary">
							<p>Провёл на проекте: <br><b><?php
							if($profile->steam_id == "0")
							{
							echo "Не указан Steam ID(<a href='https://fastkill.ru/pages/baza_znaniy'>Подробнее</a>)";
							} else {
							if(expand_seconds2($profile->game_time) == "Навсегда")
							{
							echo "0 часов 0 минут 0 секунд";
							} else {
							echo expand_seconds2($profile->game_time);
							}
							}
							?></b></p>
							<p>Сообщений <br><b>{answers}</b></p>
							<p>Спасибок <br><b>{thanks}</b></p>
							<p>Последняя тема <br><b>{if('{topic_id}' == '0')}Не просматривал форум{else}<a title="Перейти в тему" href="../forum/topic?id={topic_id}">{topic_name}</a>{/if}</b></p>
							<p>Рейтинг <br><b>{reit}</b></p>
						</div>
					</div>
				</div>
			</div>

			<div class="col-lg-4">
				{if(is_auth() && ('{profile_id}' == $_SESSION['id']))}
				<div class="block">
					<div class="block_head">
						Баланс
					</div>
					<div class="purse">
						<p>
							<font id="my_balance">{{$user->shilings}}</font> рублей
						</p>
						<small>
							Скидка: {{$user->proc}}%
						</small>

						<a href="../purse">Пополнить</a>
						<span data-target="#voucher" data-toggle="modal">Активировать ваучер</span>

						<a href="../purse">
							<img src="../templates/fastkill/img/purse.png">
						</a>
					</div>
				</div>

				<script>$('#voucher').modal('hide');</script>
				<div id="voucher" class="modal fade">
					<div class="modal-dialog">
						<div class="modal-content">
							<div class="modal-header">
								<button type="button" class="close" data-dismiss="modal" aria-label="Close">
									<span aria-hidden="true">×</span>
								</button>
								<h4 class="modal-title">Активация ваучера</h4>
							</div>
							<div class="modal-body">
								<input class="form-control personal" type="text" id="voucher_key" placeholder="ВВЕДИТЕ ВАУЧЕР" maxlength="50">
								<button class="btn btn-primary mt-2" onclick="activate_voucher();">Активировать</button><br>
								<div id="activate_result"></div>
							</div>
						</div>
					</div>
				</div>
				{/if}

				<div class="block">
					<div class="block_head">
						<a href="../friends?id={profile_id}">
							Друзья <small>[все]</small>
						</a>
					</div> 
					<div id="friends">
						{friends}
					</div>
				</div>
			</div>
		</div>
	</div>

	<div class="block transparent">
		<div class="block_head">
			Привилегии
		</div>
		<div class="block-min">
			<div class="table-responsive mb-0 block-body">
				<table class="table table-condensed table-bordered admins">
					<thead>
						<tr>
							<td>Сервер</td>
							<td>Идентификатор</td>
							<td>Тип</td>
							<td>Услуги</td>
						</tr>
					</thead>
					<tbody id="admins">
						{func Widgets:user_admins('{profile_id}')}
					</tbody>
				</table>
			</div>
		</div>
	</div>
	
	<div class="block transparent">
		<div class="block_head">
			Достижения 
		</div>
		<div class="block-min">
			<div class="table-responsive mb-0 block-body">
				<table class="table table-condensed table-bordered admins">
					<thead>
						<tr>
							<td>#</td>
							<td>Название</td>
							<td>Описание</td>
							<td>Статус (Дата открытия)</td>
						</tr>
					</thead>
					<tbody id="achievs">
					<script>get_user_achievs('{{$profile->steam_id}}');</script>
					</tbody>
				</table>
			</div>
		</div>
	</div>
	
	<div class="block transparent">
		<div class="block_head">
			Стена
		</div> 
		{if('{checker}' != '1')}
		<div class="block">
			<div id="add_new_comments">
				<textarea id="text" maxlenght="1000"></textarea>

				<div class="smile_input_forum mt-3">
					<input id="send_btn" class="btn btn-outline-primary" type="button" onclick="send_user_comment({profile_id});" value="Отправить"></input>
					<div id="smile_btn" class="smile_btn" data-container="body" data-toggle="popover" data-placement="top" data-content="empty"></div>
				</div>
			</div>
		</div>
		<script>
			$(document).ready(function() {
				init_tinymce("text", "lite", "{file_manager_theme}", "{file_manager}", "{{md5($conf->code)}}");
				get_smiles('#smile_btn');
			});

			$('#smile_btn').popover({ html: true, animation: true, trigger: "click" });
			$('#smile_btn').on('show.bs.popover', function () {
				$(document).mouseup(function (e) {
					var container = $(".popover-body");
					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';
			}
			function set_sticker(elem){
				var text = "sticker"+$(elem).attr("src");
				text = encodeURIComponent(text);
				send_user_comment({profile_id}, text);
				$('#smile_btn').popover('hide');
				selected = 'gcms_smiles';
			}
		</script>
		{/if}
		<div id="comments" class="mt-3">
			<div class="loader"></div>
		</div>
		<script>load_users_comments({profile_id},'first');</script>
	</div>

	{else}
	<p>Пользователь удален</p>
	{/if}
</div>
<div class="col-lg-3 order-is-last">
	{if(is_auth())}
		{include file="/home/navigation.tpl"}
	{else}
		{include file="/index/authorization.tpl"}
	{/if}

	<div class="block">
		<div class="block_head">
			Сообщения на форуме
		</div>
		<div id="last_activity">
			{func Widgets:user_forum_activity('{profile_id}', '3')}
		</div>
	</div>

	<div class="block">
		<div class="block_head">
			Заявки на разбан
		</div>
		<div id="mybans">
			{func Widgets:user_bans('{profile_id}', '3')}
		</div>
	</div>

	{if(is_auth())}
		{include file="/home/sidebar_secondary.tpl"}
	{else}
		{include file="/index/sidebar_secondary.tpl"}
	{/if}
</div>