<? global $vis_language; ?>
<section id="breadcrumb" class="row m-b m-l-none m-r-none">
		<div class="col-sm-6">
		<h3 class="m-b-xs text-black"><span><? echo $vis_language['TXTGOOGLEAPP'];?></span></h3>
		<ul class="breadcrumb bg-empty no-border m-b-xxs no-padder">
			<li><a class="link" href="#/home/quick_view/<? echo $vis_language['TXTHOME']; ?>"><? echo $vis_language['TXTHOME'];?></a></li>
			<li><a class="link" href="#/setting/setting_menu/<? echo $vis_language['TXTSETTINGS'];?>" onclick="$('#vis_workpanel_div').visExecution('load_module','<? echo $vis_language['TXTSETTINGS'];?>',{'vis_module':'setting','vis_operation':'setting_menu'});"><? echo $vis_language['TXTSETTINGS'];?></a></li>
			<li class="active"><? echo $vis_language['TXTGOOGLEAPP'];?></li>
		</ul>
	</div>
</section>
<section class="padder">
	<section class='panel panel-default'>
		<header class="panel-heading sub_header"><? echo $vis_language['TXTGOOGLEAPP']; ?></header>
		<div class="panel-body">
			<form method="post" name="vis_integration_form" id="vis_integration_form" class="form-horizontal">
					

<div id="access_gcal">
	<div class="form-group">
	<label class="col-sm-2 control-label" ><? echo  $vis_language['TXTCLIENTID']; ?></label>
	<div class="col-sm-10">
		<input class="form-control input-sm" type="text" name="vis_host" id="vis_host" value="<? echo $gcal_details['host_name']; ?>">
	</div>
</div>
	<input class="form-control input-sm" type="hidden" name="vis_prefix" id="vis_prefix" value="gmail">
<div class="form-group">
	<label class="col-sm-2 control-label" ><? echo  $vis_language['TXTCLIENTSECRETE']; ?></label>
	<div class="col-sm-10">
		<input class="form-control input-sm" type="text" name="vis_username" id="vis_username" value="<? echo $gcal_details['user_name']; ?>">
	</div>
</div>
<div class="form-group">
	<label class="col-sm-2 control-label" ><? echo $vis_language['TXTAPIKEY']; ?></label>
	<div class="col-sm-10">
		<input class="form-control input-sm" type="text" name="vis_dbname" id="vis_dbname" value="<? echo $gcal_details['db_name']; ?>">
	</div>
</div>	
<div class="form-group">
		<label class="col-sm-2 control-label"><? echo $vis_language['TXTREDIRECTURL']; ?></label>
		<div class="col-sm-10">
			<input type="text" class="form-control input-sm" name="vis_url" id="vis_url" value="<? echo $gcal_details['billing_url'];?>" />
		</div>
	</div>			
 
 <? //THIS ONE FOR GOOGLE DRIVE ON OFF ?>
<div class="form-group" id="cal_drive_btns">
	<label class="col-sm-2 control-label" ><? echo $vis_language['TXTGOOGLECALENDER']; ?></label>
	<div class="col-sm-1">
		<label class="switch"  value="1"<? if($gcal_details['admin_password']!=1) echo 'radio-no-uncheck'; ?> >
		
		<input type="checkbox"  name="vis_status_gcalendar_state"  id="vis_status_gcalendar_state" <? if($gcal_details['admin_password']==1) echo ' checked="checked"'; ?> > 
		<span></span>
		</label>
	</div>
 </div>
 <div class="form-group">
	<label class="col-sm-2 control-label" ><? echo $vis_language['TXTGOOGLEDRIVE']; ?></label>
	<div class="col-sm-1">
		<label class="switch"  value="1" <? if($gcal_details['admin_user']!=1) echo 'radio-no-uncheck'; ?>>
		<input type="checkbox"  name="vis_status_gdrive_state"  id="vis_status_gdrive_state" <? if($gcal_details['admin_user']==1) echo ' checked="checked"'; ?> > 
		<span></span>
		</label>
	</div>
</div>

<? //THIS ONE FOR GOOGLE DRIVE ON OFF ?>
 
 <div class="form-group">
	<label class="col-sm-2 control-label" ><? echo $vis_language['TXTSTATUS'];//THIS ONE LABLE FOR THE STATUS  ?></label>
	<div class="col-sm-1">
		<label class="switch"  value="1"<? if($gcal_details['is_enabled']!=1) echo 'radio-no-uncheck'; ?>  >
		<input type="checkbox"  name="vis_status_gcal"  id="vis_status_gcal"  value="1" <? if($gcal_details['is_enabled']==1) echo ' checked="checked"'; ?> > 
		<span></span>
		</label>
	</div>
</div>
 
</div>


<input type="hidden" name="vis_integration_id_gcal"  id="vis_integration_id_gcal" value="<? echo $gcal_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_googleapp_setting', 'vis_form':'vis_integration_form'})"><? echo $vis_language['TXTSAVE']; ?></button>
            <? if(!empty($gcal_details)) {?>
            <button type="button" class="btn btn-primary m-l" onclick="$('#vis_workpanel_div').visExecution('submit_form',{'vis_module':'setting', 'vis_operation':'delete_googleapp_setting', 'vis_form':'vis_integration_form'})"><? echo $vis_language['TXTDELETE']; ?></button>
            <? } ?>
		</div>
	</div>
</form>
			</div>
	</section>
</section>
<script>
/* if(!$('#vis_status_gcal').is(":checked")){ $('#access_gcal').hide();}

function toggle_status_gcal(){
	if($('#vis_status_gcal').is(":checked")){ $('#access_gcal').show();}
	else { $('#access_gcal').hide();}
} */
</script>
<script>

//if(!$('#vis_status_gcal').is(":checked")){ $('#access_gcal').hide();$('#btn_group').hide();$('#cal_drive_btns').hide();}

function toggle_status_gcal(){
	if($('#vis_status_gcal').is(":checked")){ $('#access_gcal').show();$('#btn_group').show();$('#cal_drive_btns').show();}
	else { $('#access_gcal').hide();$('#btn_group').hide();$('#cal_drive_btns').hide();}
}
</script>
<script>
$('input[type=checkbox]').change(function()
{
		if(($('#vis_status_gcalendar_state').is(':checked')))
		{
			$('#vis_status_gcalendar_state').attr('value',1);
		}
		else
		{
		    $('#vis_status_gcalendar_state').attr('value',0);
		}
		if(($('#vis_status_gdrive_state').is(':checked')))
		{
			$('#vis_status_gdrive_state').attr('value',1);
		}
		else
		{
		    $('#vis_status_gdrive_state').attr('value',0);
		}

});
</script>
