{include file="left.tpl"}

<script src="../templates/admin/js/timepicker/timepicker.js"></script>
<script src="../templates/admin/js/timepicker/jquery-ui-timepicker-addon.js"></script>
<script src="../templates/admin/js/timepicker/jquery-ui-timepicker-addon-i18n.min.js"></script>
<script>
	jQuery(document).ready(function($)
	{
		load_adminlist('{server}');

		get_services3_adm('{server}');
		change_type();
	});

	function local_change_serv()
	{
		location.href = '../edit_admins?server='+$('#server').val();
	}

	function local_change_service()
	{
		get_tarifs3_adm($('#services option:selected').val());
	}

	function change_type()
	{
		$('#data_inputs').show();

		func_change_class($('#type option:selected').val());
	}

	function change_admin_type(id)
	{
		$('#data_inputs_'+id).show();

		func_change_class($('#type_'+id+' option:selected').val());
	}

	function load_adminlist(server)
	{
		$.ajax({
			type: 'POST',
			url: '../templates/SquareLine/php/admins_edit.php',
			data: 'token='+$('#token').val()+'&server='+server,
			success: function(data)
			{
				$('#admins').html(data);
			}
		});
	}

	function server_info(id)
	{
		$.ajax({
			type: 'POST',
			url: '../templates/SquareLine/php/server.php',
			data: 'token='+$('#token').val()+'&id='+id,
			success: function(data)
			{
				$('#server_info_'+id).html(data);
			}
		});
	}
</script>

<div class="content float-right">
	<div class="block" id="add_admin_area">
		<div class="header">Покупка услуг</div>

		<div class="block-content" id="store_form">
			<div class="form-input">
				<label for="server">Игровой сервер</label>
				<select id="server" onchange="local_change_serv()">{servers}</select>
			</div>
			<div class="form-input">
				<label for="services">Услуга</label>
				<select id="services" onchange="local_change_service()"><option>Загрузка...</option></select>
			</div>
			<div class="form-input">
				<label for="tarifs">Период</label>
				<select id="tarifs"><option>Загрузка...</option></select>
			</div>
			<div class="form-input">
				<label for="type">Тип привязки</label>
				<select id="type" onchange="change_type()">
					<? if($conf->peg_1 != 2){ ?><option id="point" value="1">Ник + пароль</option><? } ?>
					<? if($conf->peg_2 != 2){ ?><option value="2">SteamID</option><? } ?>
					<? if($conf->peg_3 != 2){ ?><option value="3">SteamID + пароль</option><? } ?>
				</select>
			</div>
			<div class="form-input disp-n" id="data_inputs">
				<label>Данные</label>
				<input type="text" class="disp-n" maxlength="32" id="nick" placeholder="Введите свой ник">
				<input type="text" class="disp-n" maxlength="32" id="steam_id" placeholder="Введите свой SteamID">
				<input type="text" class="m-t-5 disp-n" maxlength="32" id="pass" placeholder="Придумайте пароль">
			</div>
			<div class="form-input">
				<label for="user_id">ID профиля на сайте:</label>
				<input id="user_id" placeholder="Введите id профиля" type="number">
			</div>
			<div class="message-send">
				<div class="btn green float-left" id="buy">Добавить</div>
				<div id="answer" class="btn red float-right disp-n">Нет</div>
			</div>
			<div class="clear"></div>
			<div id="buy_result"></div>
		</div>
	</div>
	<div id="admins"><div class="bs-callout bs-callout-info bs-mini-info m-l-5 m-b-5 m-r-5 m-t-5"><p>Выполняется загрузка...</p></div></div>
</div>	