<style type="text/css">.pagination{ margin:0px;}</style>
<? global $vis_language;



 $header_title=$vis_language['TXTREPORTS'];
  $view_info['page_count']=(count($client)==0)?0:ceil(count($client)/3);
 
 
  ?>
 
 <? if(isset($request_data['incorrect']) && $request_data['incorrect']=='email') { ?>
   <script> $("#vis_submit_msg_div").show(); $("#vis_submit_msg_div").html('<? echo $vis_language['MSGCLTEMAILEXIST']; ?>'); </script><? }
	if(isset($operation['reg_message']) && $operation['reg_message']!='') { ?><script> $("#vis_submit_msg_div").show(); $("#vis_submit_msg_div").html('<? echo $operation['reg_message']; ?>'); </script><? } ?>
 
			<section class="container">
				<div class="container m-t-md">
					<div class="row">
						<div class="col-md-12">
							<section class="panel shadow-none">
 
							<form class="vis_contacts_form" method="post">
 
							<div class="form-group">
 
							</div>
 
						<div id="msg"></div>
 
					<div class="col-sm-3 text-center-xs">
					<div class="text-muted pull-center-responsive label_page"><? echo $vis_language['TXTDURATION']; ?>:</div>
					<select id="duration" name="duration" class="form-control input-sm selectpicker" onchange="showData(this.value)">
						<option value=""><? echo $vis_language['TXTSELECT']; ?></option>
						<option value="1"><? echo $vis_language['TXTLASTDAYS']; ?></option>
						<option value="2"><? echo $vis_language['TXTLASTSEVENDAYS']; ?></option>
						<option value="3"><? echo $vis_language['TXTLASTTWENTYFOURHOURS']; ?></option>
						<option value="4"><? echo $vis_language['TXTCUSTOM']; ?></option>
 
					</select>
					</div>
				<div class=" col-sm-2 text-center-xs" id='divid' style="display:none;">
				<div class="text-muted pull-center label_page"><? echo $vis_language['TXTFROM']; ?>:</div>
 
				<div class="text-muted pull-center from_date"><input type="text" name="from_date" id="vis_<?= $operation['vis_operation'] ?>_from_date" value="<?= date(VIS_EDITDATETIMEPICKER_FORMAT,strtotime(date('Y-m-d H:i')." -3 months") + VIS_TIMEZONE);?>" class="input-sm form-control " /></div>
				</div>
				<div class="col-sm-2" id='divid1' style="display:none;">
				<div class="text-muted pull-center label_page"><? echo $vis_language['TXTTO']; ?>:</div>
 
				<div class="text-muted pull-center to_date"><input type="text" name="to_date" id="vis_<?= $operation['vis_operation'] ?>_to_date" value="" class="input-sm form-control " /></div>
				</div>
 
				<div class=" col-sm-2 text-center-xs">
 
				<div class="text-muted pull-center label_page"><? echo $vis_language['TXTTYPE']; ?>:</div>
 
 


				  <select name="status" id="status" class="form-control input-sm selectpicker " <? if(count($type_list) > 10) echo 'data-live-search="true"' ?>>
 
				<option value="0"><? echo $vis_language['TXTSELECT']; ?></option>
			<?php if($type_list!=-1) for($i=0;$i<count($type_list);$i++)
 
 
			echo '<option value="'.$type_list[$i]['type_id'].'">'. $type_list[$i]['type_name'].'</option>'; ?>
			</select>  
 
			 
 
 
			</div>
			<div class="col-sm-1 text-center-xs">
			<div class="text-muted pull-center label_page">&nbsp;&nbsp;&nbsp;&nbsp;</div>
			<button id="btn_submit_ticket" type="button" class="btn btn-primary btn-sm " onclick="submitreport(); "><? echo $vis_language['TXTGENERATE']; ?></button></div>
			</div>
 
 
 
				</div> 
			<div class="list-unstyled padder m-b-none " id="vis_report_list_div" >
 
			</div>
 
 
			<br><br><br><br><br><br><br> <br><br> 
 
			</form>
 
		</section>
		</div>
	</div>
	</div>
</section>
<script>
function showData(data)
{
 var answer=document.getElementById("duration");
 if(answer[answer.selectedIndex].value=="4")
 {
  document.getElementById("divid").style.display="block";
  document.getElementById("divid1").style.display="block";
 }
 else
 {
  document.getElementById("divid").style.display="none";
  document.getElementById("divid1").style.display="none";
 }
 //document.getElementById('vis_client_group_ticket_report1_details').innerHTML = "";
 //document.getElementById("vis_export_rpt_client_group_ticket_report1").style.display="none";
}
</script>
<script type="text/javascript">

 $('.from_date').datetimepicker({
 format: "<?php echo VIS_DATETIMEPICKER_FORMAT;?>"
  });
  $('.to_date').datetimepicker({
 format: "<?php echo VIS_DATETIMEPICKER_FORMAT;?>"
  });
  $('.to_date').click();
  $('.bootstrap-datetimepicker-widget').hide();
</script>
<script>
function submitreport() {
   

$.ajax({
url: 'index.php',
dataType: 'json',
 data: {'vis_module':"client", 'vis_operation':"ticket_by_type", 'vis_duration':$("#duration").val(), 'vis_type':$("#status").val(), 'vis_from_date':$("#vis_type_report_from_date").val(), 'vis_to_date':$("#vis_type_report_to_date").val()  },
type: "POST",
success: function(data) {
if(data.vis_msg=='true')
{
$("#vis_submit_err_div").show();
$("#vis_report_list_div").html('');
 $("#vis_submit_err_div").html(data.vis_error_msg); window.scrollTo(0,0);
 setTimeout(function(){$("#vis_submit_err_div").hide();},1000);
}else{
$("#vis_report_list_div").html(data.report_list);
$("#datatables").wrap('<div class="table-responsive"></div>');
}


}
 

});
 

}
</script>
<script type="text/javascript">
$(document).on('click','.selectpicker',function(e){
	var winwdt=$(window).width();
	if(winwdt <810){
var lilen=$(this).next('#lst').children('ul').children().length;
$(this).next('#lst').css('overflow-y','scroll');
		if(lilen <3 && lilen>1)
		{$(this).next('#lst').css('min-height',(40*parseInt(lilen))+'px');
		}else{		$(this).next('#lst').css('min-height','120px');}
	}
	});
</script>
