 <?php  if(priv($_SESSION['role'],'view','posts',$connect)!=1){exit(); }?>
 <div>
    <ul class="breadcrumb">
        <li>
            <a href="index.php">Home</a>
        </li>
        <li>
            <a href="index.php?page=servicesForCompany">  Services</a>
        </li>
    </ul>
</div>

<div class="row">
        <div class="box col-md-12">
            <div class="box-inner">
                <div class="box-header well" data-original-title="">
                    <h2><i class=" glyphicon glyphicon-th-list"></i> Services</h2>

                    <div class="box-icon">
                        <a href="#" class="btn btn-setting btn-round btn-default"><i
                                class="glyphicon glyphicon-cog"></i></a>
                        <a href="#" class="btn btn-minimize btn-round btn-default"><i
                                class="glyphicon glyphicon-chevron-up"></i></a>
                        <a href="#" class="btn btn-close btn-round btn-default"><i
                                class="glyphicon glyphicon-remove"></i></a>
                    </div>
                </div>
                <div class="box-content">
                
                <br />

                
               
                
                 
                 
                  
                       
                       
                       
                       
                       
                       
                       
                       
                       
                      
                  <fieldset>
<legend>Search</legend>
                       
                       
                       <form method="post"  class="login_form"  action="index.php?page=servicesForCompany">
<input type="hidden" name="optsearch" value="1" />
 
<div class="form-group">
<div class="row ">
<div class="col-md-2">Name</div>
<div class="col-md-4"><input type="text" name="Services_nameSearch" id="Services_nameSearch" class="form-control" placeholder="Services_name" value="<?php echo($_REQUEST['Services_nameSearch']); ?>" /></div>
<div class="col-md-2">Compnay </div>


<?php   if(Role($_SESSION['userID'],$connect)!=1){
	$compnay=" and compnayId='".getCompnay($connect,$_SESSION['userID'])."'";
}?>
<div class="col-md-4"><?php  Select("servicesId",$connect,"Please Select Services"," select * from services 
where 1=1
".$compnay,$_REQUEST['servicesId']); ?></div>


</div>
</div>

 
  

<div class="form-group">
<div class="row ">

<div class="col-md-12"><input type="submit" name="update_Services" value="Search Services" class="action-button"  style="width:120px"/></div>
</div>
</div>

</form>
                       
                       
                       
                       
                      
            </fieldset>           
                       
                       
                       
                       
                       
                       
                       
                       
                       
                       
                       <div class="row">
                       <div class="col-md-12">
                       
                         <table width="100%" border="0" cellspacing="0" cellpadding="0" class="table table-striped table-bordered bootstrap-datatable datatable responsive">
                                         
                         
                         
                           <tr>
                             <td>Services</td>
                             <td>Service name </td>
                             <td>Company</td>
                             <td align="center" valign="middle">Posts </td>
                           </tr>
                           <?php  
						   
						
			 
			 $query_Services="select * from services
 inner join Company on Company_id=compnayId
   
inner join servicesoperator on `Services_id`=`ServicesOperator_servicesID`
where 1=1 

" .$compnay; 
if($_REQUEST['Services_nameSearch']!=''){
	$query_Services=$query_Services." and Services_name like '%".$_REQUEST['Services_nameSearch']."%'";
	 
	}
	
	if($_REQUEST['servicesId']!=0){
	$query_Services=$query_Services." and Services_id = '".$_REQUEST['servicesId']."'";
	 
	}
// echo(	$query_Services);
		 
			 $Services_res=mysqli_query($connect,$query_Services);
			
			 if($Services_res){
				 while($row=mysqli_fetch_assoc($Services_res))
				 {
				
			  ?>
						
                           <tr>
                              <td><?php echo($row['ServicesOperator_name']); ?></td>
                             <td><?php echo($row['Services_name']); ?></td>
                             <td><?php echo($row['Company_name']); ?></td>
                             <td align="center" valign="middle">
                              <?php  if(priv($_SESSION['role'],'up','posts',$connect)==1){?>
                             <a href="index.php?page=ContentPosts&sid=<?php  echo($row['Services_id']); ?>&soid=<?php  echo($row['ServicesOperator_id']); ?>"  > 
                              <i class="glyphicon glyphicon-edit icon-white"></i> Posts</a>
                              
                              <?php //  <i class="glyphicon glyphicon-trash icon-white"></i> Delete
                               ?>
                               
                               </a> <?php } ?>
                              </td>
                           </tr>
                           
                           
                           <?php  }}?>
                        
                  </table>
                  <br />


                 
                  </div></div>
                   
                </div>
            </div>
        </div>