<? 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"><? echo $operation['view_title'];?></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> <a href="#/setting/view_form_groups/<? echo $vis_language['TXTCUSTOMGROUP']; ?>" onclick="$('#vis_workpanel_div').visExecution('load_module','<? echo $vis_language['TXTCUSTOMGROUP']; ?>',{'vis_module':'setting','vis_operation':'view_form_groups'});" class="link"><? echo $operation['view_title']; ?></a></li>
         <li class="active"> <? echo $vis_language['TXTADDFORMGROUP'];?></li>
      </ul>
      <div>
      </div>
   </div>
</section>
<section class="padder">
   <section class="panel panel-default">
      <header class="panel-heading sub_header"><? echo $vis_language['TXTADDFORMGROUP']; ?></header>
      <div class="panel-body">
         <form  class="form-horizontal" id="vis_formgroup_form" name="vis_formgroup_form" method="post">
            <div class="form-group">
               <label class="col-sm-2 control-label"><? echo $vis_language['TXTTITLE']; ?></label>
               <div class="col-sm-10">
                  <input class="form-control input-sm" type="text" name="vis_formgroup_name" id="vis_formgroup_name" >
               </div>
            </div>
			 <div class="form-group">
               <label class="col-sm-2 control-label"><? echo $vis_language['TXTDISPLAYTITLE']; ?></label>
               <div class="col-sm-10">
                  <input class="form-control input-sm" type="text" name="vis_form_name" id="vis_form_name" >
               </div>
            </div>
            <div class="form-group">
               <label class="col-sm-2 control-label"><? echo $vis_language['TXTDISPLAYORDER']; ?></label>
               <div class="col-sm-10">
                  <input class="form-control input-sm" type="text" name="vis_displayorder" id="vis_displayorder" value="0">
               </div>
            </div>
			<div class="form-group">
               <label class="col-sm-2 control-label"><? echo $vis_language['TXTFORMTYPE']; ?></label>
               <div class="col-sm-10">
                  <div class="radio i-checks m-r-lg pull-left">
						<label><input name="vis_formtype" id="vis_formtype" type="radio" value="1" onclick="show_note('note_email');"  checked ><i></i> <? echo $vis_language['TXTEMAIL']; ?></label>
					</div>
					<div class="radio i-checks m-r-lg pull-left">
						<label><input name="vis_formtype" id="vis_formtype" type="radio" value="0" onclick="show_note('note_call');" ><i></i> <? echo $vis_language['TXTCALL']; ?></label>
					</div>
               </div>
            </div>
			<div class="form-group">
               <label class="col-sm-2 control-label"> </label>
               <div class="col-sm-10">                 
						<label id="note_email"><?php echo $vis_language['MSGMANDATORYEMAILFIELD']; ?></label>
						<label id="note_call" style="display:none;"><?php echo $vis_language['MSGMANDATORYCALLFIELD']; ?></label>		
               </div>
            </div>
			<div class="form-group">
               <label class="col-sm-2 control-label"><? echo $vis_language['TXTEBABLECAPTCHA']; ?></label>
               <div class="col-sm-10">
                  <div class="radio i-checks m-r-lg pull-left">
						<label><input name="vis_captcha" id="vis_captcha" type="radio" value="1"  ><i></i> <? echo $vis_language['TXTYES']; ?></label>
					</div>
					<div class="radio i-checks m-r-lg pull-left">
						<label><input name="vis_captcha" id="vis_captcha" type="radio" value="0" checked ><i></i> <? echo $vis_language['TXTNO']; ?></label>
					</div>
               </div>
            </div>
			<div class="form-group">
               <label class="col-sm-2 control-label"><? echo $vis_language['TXTFORMHEADER']; ?></label>
               <div class="col-sm-10">
                  <div class="radio i-checks m-r-lg pull-left">
						<label><input name="vis_hdformheader" id="vis_hdformheader" type="radio" value="1"  checked  ><i></i> <? echo $vis_language['TXTYES']; ?></label>
					</div>
					<div class="radio i-checks m-r-lg pull-left">
						<label><input name="vis_hdformheader" id="vis_hdformheader" type="radio" value="0"><i></i> <? echo $vis_language['TXTNO']; ?></label>
					</div>
               </div>
            </div>
			<div class="form-group">
		          <label class="col-sm-2 control-label"><? echo $vis_language['TXTDEPARTMENT']; ?></label>
                    <div class="col-sm-10">
						<select name="vis_department" id="vis_department_new" class="form-control input-sm selectpicker"<? if(count($departments)>10) echo ' data-live-search="true"';?> onchange="get_channel_list(this.value);"><?
							if($departments!=-1) for($i=0;$i<count($departments); $i++)
							echo '<option value="'.$departments[$i]['domain_id'].':'.$departments[$i]['department_id'].'">'.$departments[$i]['domain_name'].' :: '.$departments[$i]['department_name'].'</option>' ?>
							</select>
					</div>
            </div>
			<div class="form-group">
               <label class="col-sm-2 control-label"><? echo $vis_language['TXTSUBJECT']; ?></label>
               <div class="col-sm-10">
                  <input class="form-control input-sm" type="text" name="vis_subject" id="vis_subject" >
               </div>
            </div>
			
			
            <!--<div class="form-group">
               <label class="col-sm-2 control-label"><? echo $vis_language['TXTDESCRIPTION']; ?></label>
               <div class="col-sm-10">
                  <textarea class="form-control input-sm" type="text" name="vis_description" id="vis_description" ></textarea>
               </div>
            </div>-->
			<div class="form-group">
               <label class="col-sm-2 control-label"><? echo $vis_language['TXTSCRIPT']; ?></label>
               <div class="col-sm-10">
                  <textarea class="form-control input-sm" type="text" name="vis_script" id="vis_script"  placeholder="<? echo $vis_language['TXTOPTIONAL']; ?>" ></textarea>
               </div>
            </div>
            <div class="form-group">
               <label class="col-sm-2 control-label"><? echo $vis_language['TXTSTATUS']; ?></label>
               <div class="col-sm-1">
                  <label class="switch">
                  <input type="checkbox" checked="checked" name="vis_status"  id="vis_status" >
                  <span ></span>
                  </label>
               </div>
            </div>
			 <? if($language_details!=-1) { ?>
            <div class="form-group">
               <div class="col-sm-12"><h5><? echo $vis_language['MSGLANGTRANSFORFORMFIELDGROUP']; ?></h5></div>
            </div>
            <div class="line b-b line-lg pull-in"></div>
            <br/>
            <?
               for($i=0;$i<count($language_details);$i++) { ?>
            <div class="form-group">
               <label class="col-sm-2 control-label"><? echo $language_details[$i]['language_name']; ?></label>
               <div class="col-sm-10">
                  <input class="form-control input-sm" type="text" name="vis_language_<? echo $language_details[$i]['language_id']; ?>" type="text" value="<? echo $priority_lang[$language_details[$i]['language_id']]; ?>" />
               </div>
            </div>
            <?
               }
               }  ?>
            <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="add_form_group();"><? echo $vis_language['TXTADD']; ?></button>
               </div>
            </div>
      </div>
      </form>
      </div>
   </section>
</section>
<script>
function add_form_group(){
	var string = $("#vis_script").val();
	var encodedString = btoa(string);
     //console.log(encodedString); 
	var decodedString = atob(encodedString);
     //console.log(decodedString); 
	 $('#vis_workpanel_div').visExecution('submit_form',{'vis_module':'setting', 'vis_operation':'add_form_group', 'vis_script_base_enc':encodedString, 'vis_form':'vis_formgroup_form'})
}
   $(".selectpicker").selectpicker();
   function show_note(id){
	   if(id=='note_email'){
		   $("#note_email").show();
		   $("#note_call").hide();
	   }else{
		   $("#note_email").hide();
		   $("#note_call").show();
	   }
   }
 
</script>
