<? global $vis_language;?>
<section id="breadcrumb" class="row m-b m-l-none m-r-none">
	<div class="col-sm-4" id="url_header">
	  <h3 class="m-b-xs text-black"><? echo $vis_language['TXTCLICKDESK']; ?></h3>
	  <div>
		 <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 class="active"><? echo $vis_language['TXTCLICKDESK']; ?></li>
		 </ul>
	  </div>
	</div>  
</section>

<div class="col-lg-12">
   <form name="vis_<?php echo $operation['vis_operation']; ?>_form" id="vis_<?php echo $operation['vis_operation']; ?>_form">
   <input type="hidden" name="vis_current_operation" value="<?php echo $operation['vis_current_operation']; ?>" />
	  <section class="panel panel-default">
         <div class="row wrapper clr">
           	<div  class="col-sm-12 pull-right text-center-xs">
             <!--<div class="pull-right" id="paging">
                 <select name="page_no" id="page_no" class="form-control input-sm selectpicker pull-right paging v-middle" onchange="vis_change_livechat_page(this);">
				   <?php if($chat_object->pages>1){
							 for($p=0;$p<$chat_object->pages;$p++){
								$page_no = $p+1;
								 if($page == $page_no)
								    $chk = 'selected="selected"';
								 else
								    $chk  = '';
							 	echo '<option '.$chk.' value="'.$page_no.'">'.$page_no.'</option>';
							 }
						 }else{
							 echo '<option>1</option>';
						 }?>
                  </select>
                   <div class="text-muted pull-right label_page"><? echo $vis_language['TXTPAGE'];?>:</div>
              </div>-->
                <div class="col-lg-3 m-l-n">
                 <div class="col-sm-2 text-muted label_page"><?= $vis_language['TXTDOMAIN'];?>:</div>
                 <div class="col-sm-6">
                      <select class='form-control selectpicker' name="vis_domain" id="vis_domain" <? if(count($department) > 10) echo 'data-live-search="true"' ?>>
                           <option value=""><?=$vis_language['TXTSELECTDOMAIN']?></option>
                         <?php if($departments!=-1) for($i=0;$i<count($department);$i++) echo '<option value="'.$department[$i]['domain_id'].'">'.$department[$i]['domain_name'].'</option>'; ?>
                      </select>
                  </div>
                </div>
             <div class="col-lg-3 m-l-n">
                 <label class="col-sm-4 control-label"><? echo $vis_language['TXTVISITOREMAIL']; ?></label>
                <div class="col-sm-8">
                        <input type="text" class="form-control input-sm" name="vis_visitor_email" id="vis_visitor_email" value="<? echo $livechat_details['user_name']; ?>" />
                </div>
             </div>
               <div class="col-lg-3 m-l-n">           
                   <a class="btn btn-primary btn-sm"  onclick="vis_show_chat();"><? echo $vis_language['TXTFETCHCHAT']; ?></a>              
             </div>
              </div>
         </div>
              <div class="table-responsive scroll-x" id="vis_livechat_list" style="display:none;">			
              </div>
      </section>
   </form>
</div>

<script>
    function vis_show_chat() {
        var domain = document.getElementById('vis_domain').value;
        var email = document.getElementById('vis_visitor_email').value;  
        if(domain == '')
        {
          $("#vis_global_msg_div").visInterface("load_global_message", "<? echo $vis_language['MSGPLSSELECTDOMAIN'];?>");
            return false;  
        }
        else if(email =='') {
            $("#vis_global_msg_div").visInterface("load_global_message", "<? echo $vis_language['MSGENTERVISITOREMAILADDRESS'];?>");
            return false;
        }        
        else $('#vis_livechat_list').visExecution('load_area', {'vis_module':'chat', 'vis_operation':'clickdesk_chat','vis_email':email,'vis_domain':domain});
    }
   	
	$('.from_date').datetimepicker({
                    format: "<?php echo VIS_DATETIMEPICKER_FORMAT;?>"
                });
	$('.to_date').datetimepicker({
                    format: "<?php echo VIS_DATETIMEPICKER_FORMAT;?>"
                });	
$(document).ready(function() {
$('#datatable').dataTable({
       "bPaginate" : true,
	    "iDisplayLength": 25,
		"sDom": 'ltipr',
		  "bLengthChange": false,
		    "bInfo": false,
		"aoColumns": [null,	null, null, null, null, null]
	});
});
</script>
