<?php namespace AloVoice; include("header.php"); ?>
<center><h2>Добро пожаловать в AloVoice BX24</h2></center>
	<div class="card">
		<div class="card-body">
			<h5 id="toggler_asterisk_settings" class="card-title">Введите параметры для сервера <strong>"<?php echo $_SERVER["HTTP_HOST"]?>"</strong></h5>
			
			<form id="sms-settings">
				<div class="card-text">
					<input type="hidden" name="save" value="Y">
					<input type="hidden" name="access_token" value="<?=$_REQUEST['AUTH_ID'];?>">
					<input type="hidden" name="refresh_token" value="<?=$_REQUEST['REFRESH_ID'];?>">
					<input type="hidden" name="expires_in" value="<?=$_REQUEST['AUTH_EXPIRES'];?>">
					<input type="hidden" name="domain" value="<?=$bxDomain;?>">
					<input type="hidden" name="member_id" value="<?=$_REQUEST['member_id'];?>">

					<div class="form-group"> 
						<label class="col-sm-2 col-form-label">Aдрес Битрикс24:</label> 
						<div class="col-sm-10"><input type="text" class="form-control"  value="<?php echo $bxDomain; ?>" disabled> </div>
					</div>
					
					<div class="form-group"> 
						<label class="col-sm-2 col-form-label">Aдрес AMI:</label> 
						<div class="col-sm-10"><input type="text" class="form-control" name="ami_host" id="ami_host" value="127.0.0.1"> </div> 
					</div>
					
					<div class="form-group"> 
						<label class="col-sm-2 col-form-label">Порт AMI:</label>
						<div class="col-sm-10"> <input type="text" class="form-control" name="ami_port" id="ami_port" value="5038"></div>
					</div>
					
					<div class="form-group"> <label class="col-sm-2 col-form-label">Пользователь AMI:</label> <div class="col-sm-10"><input type="text" class="form-control" name="ami_user" id="ami_user"> </div> </div>
					<div class="form-group"> <label class="col-sm-2 col-form-label">Пароль AMI:</label> <div class="col-sm-10"><input type="text" class="form-control" name="ami_pass" id="ami_pass"> </div> </div>
					<div class="form-group">
						<button type="submit" class="btn btn-primary btn btn-save">Сохранить</button>
					</div>
					
				</div>
			</form>
			<!--a href="#" class="btn btn-primary">Вернуться в Битрикс24</a-->
		</div>
	</div>
<script src="//api.bitrix24.com/api/v1/"></script>
<script>
BX24.init(function() {
	var size = BX24.getScrollSize();
	BX24.resizeWindow(size.scrollWidth, 400);
	BX24.fitWindow();

	console.log(size);

	$('#alv_install').submit(function(e) {

		e.preventDefault();
		
		BX24.installFinish();
		
	});
});
</script>
<?php include("footer.php"); ?>