<?  global $vis_language;

?>	
	<div id='integration_details'>
		<div class="form-group">
		<label class="col-sm-2 control-label"><? echo $vis_language['TXTURL']; ?></label>
		<div class="col-sm-10">
			<input type="text" class="form-control input-sm" name="vis_url" id="vis_url" value="<? echo $hipchat_details['billing_url']; ?>" />
		</div>
	</div>
	<div class="form-group">
		<label class="col-sm-2 control-label"><? echo $vis_language['TXTAUTHTOKEN']; ?></label>
		<div class="col-sm-10">
			 <input type="text" class="form-control input-sm" name="vis_auth_token" id="vis_auth_token" value="<? echo $hipchat_details['api_key']; ?>" />
		</div>
	</div>

	<div class="form-group">
		<label class="col-sm-2 control-label" ><? echo $vis_language['TXTSTATUS']; ?></label>
		<div class="col-sm-10">
			<label class="switch"  value="1"<? if($hipchat_details['is_enabled']!=1) echo 'radio-no-uncheck'; ?>  >
			<input type="checkbox"  name="vis_status_hipchat"  id="vis_status_hipchat" value="1" <? if($hipchat_details['is_enabled']==1 || !isset($hipchat_details['is_enabled'])) echo ' checked="checked"'; ?> > 
			<span></span>
			</label>
		</div>
	</div>
	<input type="hidden" name="vis_integration_id"  id="vis_integration_id" value="<? echo $hipchat_details['integration_id']; ?>"/>
	<div class="line b-b line-lg pull-in" ></div><br/>
	<div class="form-group">
		<div class="col-sm-4 col-sm-offset-2">
			<button type="button" class="btn btn-primary" onclick="$('#vis_workpanel_div').visExecution('submit_form',{'vis_module':'setting', 'vis_operation':'update_hipchat_setting', 'vis_form':'vis_integration_form'})"><? echo (isset($hipchat_details) && $hipchat_details!=-1)?$vis_language['TXTUPDATE']:$vis_language['TXTADD']; ?></button>
                        <? if($hipchat_details !=-1 && !empty($hipchat_details)) {?>
			<button type="button" class="btn btn-primary m-l" id="delete" onclick="check_all_domains()" <a href="javascript:void(0);" data-toggle="ajaxModal"><? echo $vis_language['TXTDELETE']; ?></a></button>
                        <? } ?>
		</div>
	</div>	
</div>	
<script>
function check_all_domains(){
	
	var domain = $('#vis_domain').val();
	if ($('#vis_all_domains').is(':checked'))
	{
		$('#delete').attr('data-modal-arguments', 'vis_module=setting&vis_operation=get_hipchat_delete&vis_all_domains=1&vis_integration_id=<? echo $hipchat_details['integration_id']; ?>&vis_static_area=vis_hipchat_delete_form&vis_domain='+domain);
	}
	else
	{
		$('#delete').attr('data-modal-arguments', 'vis_module=setting&vis_operation=get_hipchat_delete&vis_integration_id=<? echo $hipchat_details['integration_id']; ?>&vis_static_area=vis_hipchat_delete_form&vis_domain='+domain);//delete_hipchat_setting
	}	
}

</script>
