 <?php  if(priv($_SESSION['role'],'view','Company',$connect)!=1){exit(); }?>
 <div>
    <ul class="breadcrumb">
        <li>
            <a href="index.php">Home</a>
        </li>
        <li>
            <a href="index.php?page=Company"> Add Company</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> Company</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 />

                
              
                 
                  <?php  
				   if(priv($_SESSION['role'],'up','Company',$connect)==1)
				 if($_REQUEST['opt']==do_up){
					if($_REQUEST['Company_name']==''
 
	){
		
		echo("<div style='color:red'> Please Fill All Parameters </div>");
		}else{
 

 $Company_query="update Company
set 
Company_name='".post($connect,$_REQUEST['Company_name'])."'
 
 where Company_id='".post($connect,$_REQUEST['id'])."'
 
 
 ";
 
 
 
 $situation=mysqli_query($connect,$Company_query);
 if($situation){ echo("<div>Company Added SucessFully</div>");}
}
go("index.php?page=Company");
}
				 ?>
                 
                 
                
                 
                 
                 
                 
                 <?php  
				  if(priv($_SESSION['role'],'up','Company',$connect)==1)
				 if($_REQUEST['opt']==up){
					 
					 $Company_q="select * from Company where Company_id=".post($connect,$_REQUEST['id']);
					$Company_res=mysqli_query($connect,$Company_q);
					if($Company_res){
						$Company_row=mysqli_fetch_assoc($Company_res);
					
					 }
				 ?>
                 
                         
                   
                  <fieldset>
<legend>Update  service</legend>      
                   
                 
                 
                 <form method="post"  class="login_form" >
<input type="hidden" name="opt" value="do_up" />
<input type="hidden" name="id" value="<?php echo($Company_row['Company_id']); ?>" />
<div class="form-group">
<div class="row ">
<div class="col-md-5">Service Name </div>
<div class="col-md-4"><input type="text" name="Company_name" id="Company_name" class="form-control" placeholder="Company_name" value="<?php echo($Company_row['Company_name']); ?>" /></div>
</div>
</div>



 

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

<div class="col-md-12"><input type="submit" name="update_Company" value="update Company" class="action-button"  style="width:120px"/></div>
</div>
</div>

</form>
                 
                 
                 
                 
                 
                 
                 
                 
                 
                 
                 
                 
              


                       <br>
<br>
<br>
<br>






<br>
<br>   
                 
                 
                 
                 
              </fieldset>   
                 
                 
                 
                  <?php  
				 	}
				 ?>
                 
                 
                 
                
                 <!-----      end update Company       -->
                 
                
               <!-----       add Company       -->
                
                <?php 
				 if(priv($_SESSION['role'],'add','Company',$connect)==1)
			if($_REQUEST['opt']==do_add)
{
	
	if($_REQUEST['Company_name']==''
 
	){
		
		echo("<div style='color:red'> Please Fill All Parameters </div>");
		}else{
 

 $Company_query="insert into Company
set 
Company_name='".post($connect,$_REQUEST['Company_name'])."'
 ";
 
 
 
 $situation=mysqli_query($connect,$Company_query);
 if($situation){ echo("<div>Company Added SucessFully</div>");}
}

go("index.php?page=Company");

}
			
			
			
				 ?>
                
                
                
                   <?php 
				    if(priv($_SESSION['role'],'add','Company',$connect)==1)
				   if($_REQUEST['opt']==add)
				   { 
				   ?>
                   
                   
                   
                   
                   
                   
                  <fieldset>
<legend>Add New service</legend>      
                   
                   
                   
                   
                   
                   
                   
                       <form method="post"  class="login_form" >
<input type="hidden" name="opt" value="do_add" />
<div class="form-group">
<div class="row ">
<div class="col-md-5">Service Name </div>
<div class="col-md-4"><input type="text" name="Company_name" id="Company_name" class="form-control" placeholder="Company_name" /></div>

<div class="col-md-5">Compnay </div>
<div class="col-md-4"><input type="text" name="compnayId" id="compnayId" class="form-control" placeholder="Company" /></div>


</div>
</div>


 

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

<div class="col-md-12"><input type="submit" name="Add_Company" value="Add Company" class="action-button"  style="width:120px"/></div>
</div>
</div>

</form>







    </fieldset>












                       <br>
<br>
<br>
<br>






<br>
<br>

 <!-----      end  add Company       -->
                       
                       <?php } ?>
                       
                       
                       
                       
                       
                       
                       
                       
                       
                       
                       
                       
                      
                  <fieldset>
<legend>Search</legend>
                       
                       
                       <form method="post"  class="login_form"  action="index.php?page=Company">
<input type="hidden" name="optsearch" value="1" />
 
<div class="form-group">
<div class="row ">
<div class="col-md-5">Name</div>
<div class="col-md-4"><input type="text" name="Company_nameSearch" id="Company_nameSearch" class="form-control" placeholder="Company_name" value="<?php echo($_REQUEST['Company_nameSearch']); ?>" /></div>
</div>
</div>

 
  

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

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

</form>
                       
                       
                       
                       
                      
            </fieldset>           
                       
                       
                       
                       
                       
                       
                       
                       
                       
                       
                       <div class="row">
                       <div class="col-md-12">
                         <?php  if(priv($_SESSION['role'],'add','Company',$connect)==1){?>
                         <a href="index.php?page=Company&opt=add" ><i class="glyphicon glyphicon-plus icon-white"></i> Add new Company</a><br>
<?php  }  ?>
                         <table width="100%" border="0" cellspacing="0" cellpadding="0" class="table table-striped table-bordered bootstrap-datatable datatable responsive">
                                         
                         
                         
                           <tr>
                             <td>Service name </td>
                             <td align="center" valign="middle">update </td>
                           </tr>
                           <?php  
						   
						
			 
			 $query_Company="select * from Company
 
where 1=1

" ; 
if($_REQUEST['Company_nameSearch']!=''){
	$query_Company=$query_Company." and Company_name like '%".$_REQUEST['Company_nameSearch']."%'";
	 
	}
	
	
 
		 
			 $Company_res=mysqli_query($connect,$query_Company);
			
			 if($Company_res){
				 while($row=mysqli_fetch_assoc($Company_res))
				 {
				
			  ?>
						
                           <tr>
                             <td><?php echo($row['Company_name']); ?></td>
                             <td align="center" valign="middle">
                              <?php  if(priv($_SESSION['role'],'up','Company',$connect)==1){?>
                             <a href="index.php?page=Company&opt=up&id=<?php  echo($row['Company_id']); ?>"  > 
                              <i class="glyphicon glyphicon-edit icon-white"></i> Update</a>
                              
                              <?php //  <i class="glyphicon glyphicon-trash icon-white"></i> Delete
                               ?>
                               
                               </a> <?php } ?>
                              </td>
                           </tr>
                           
                           
                           <?php  }}?>
                        
                  </table>
                  <br />


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