<? global $vis_language; 
	include_once(VIS_PATH_CLASS.VIS_CLASS_PREFIX.'client.php');
	$database=new class_database();
	$client_object=new class_client($database);
	list($client_info, $clientdetails)=$client_object->get_client('client_id='.VIS_CLIENT_ID, '', 0, '', VIS_CLIENT_ID, VIS_LOCATION_AREA);
	$clientdetails=$clientdetails[0];
	$paging_list='';
    for($i=0;$i<$view_info['page_count'];$i++) $paging_list.='<option value="'.$i.'" '.(($invoice_info['page']==$i)?'selected="selected"':'').'>'.($i+1).'</option>';
    
   $status=$operation['vis_status'];  ?>
	<section  class="container">
   <div class="row">
	<div class="col-md-12">
	  <section class="container m-t-md">		
		<form class="vis_invoice_form" method="post" id="vis_task_form1" name="vis_task_form1">
		<div class="row padder clr" <? if($invoices==-1) echo 'style="display:none;"'; ?>>
		
		 

					 <div class="col-sm-12 m-t-xs m-b" id="sortedby">
      <div class="b-b" style="padding-bottom:10px;">		  
		       <div class="btn-group m-b-xs"> 
			       <a class="btn btn-xs btn-rounded <?php echo ($status == 0)?' btn-primary ':'btn-default'; ?> filtab" onclick="vis_load_page_sort(0);"><? echo $vis_language['TXTMYINVOICES']; ?></a>  
			   </div>
      <? if($clientdetails['is_manager']==1){?>
			   <div class="btn-group m-b-xs">
			       <a class="btn btn-xs btn-rounded <?php echo ($status == 4)?' btn-primary ':'btn-default'; ?> filtab" onclick="vis_load_page_sort(4);"><? echo $vis_language['TXTORGANIZATION'].' '.$vis_language['TXTINVOICES']; ?></a>  
			   </div>		
    <?}?>
      </div>
      </div>
   
      
			<div class="col-sm-9"></div>
			 <div class="col-sm-3 text-right text-center-xs tkt_right_menu m-t-n">
                        <ul class="pagination-sm pagination" id="task_pagination"></ul>
            </div>
              <input type="hidden" name="vis_status" id="vis_status" />
		</div>
		<div class="list-unstyled padder m-b-none table-responsive scroll-x" id="vis_invoice_list" <? if($invoices==-1) echo 'style="display:none;"'; ?>>
		  <? include_once(VIS_PATH_TEMPLATE.'invoice_list.php'); ?>
		</div>
		  <div class="row padder clr m-b m-t" <? if($invoices==-1) echo 'style="display:none;"'; ?>>
			<div class="col-sm-9"></div>
			<div class="col-sm-3 text-right text-center-xs tkt_right_menu">
                        <ul class="pagination-sm pagination" id="task_pagination1"></ul>
           </div>
		</div>
		<input type="hidden" name="vis_page" id="vis_page" value="">
		<input type="hidden" name="vis_module" value="billing">
		<input type="hidden" name="vis_operation" value="get_invoices">
		</form>
        <section class="wrapper fullFrame" id="no_record_found" <? if($invoices!=-1) echo 'style="display:none;"'; ?>>
            <div class="fullMiddle m-xl text-center h4"><?= $vis_language['TXTNOTHINGTODISPLAY']; ?></div>
        </section>
	  </section>
	</div>
  </div>
  </section>
 
<script>
<? if($view_info['page_count']>0) {?>
    $('.pagination-sm').twbsPagination({
		totalPages:<?php echo $view_info['page_count']; ?>,
		visiblePages:3,
		first:false,
		last:false,
		onPageClick: function (event, page) {     
		$.ajax({
		url: 'index.php',
		data: {'vis_module':"billing", 'vis_operation':"get_invoices", 'vis_page':page-1, 'vis_form':'vis_task_form1', 'vis_change':1, 'vis_status':"<?= $operation['vis_status']?>"},
		type: "POST",
		success: function(data) {            
			$("#vis_invoice_list").html(data);
		}
		});
          }
      });
<? }?>
function load_page(page) {
	$('#vis_page').val(page);
	$(".vis_invoice_form").submit();
}

 function vis_load_page_sort(status) {
   	$('#vis_status').val(status);
   	$("#vis_task_form1").submit();
   }
</script>
