<?php 
   require_once("headHotelStaff.php");
  

     
  	$post=$_POST['post'];
    $hnm=$_POST['hiD']; 
    $ownID=$_POST['owniD'];
  
  	if ($post=="Update") 
  	                 {
  		
    $serviceId=$_POST['serviceId'];
    $hnm=$_POST['hiD'];
    $sname=$_POST['sname'];
    $scost=$_POST['scost'];


    if($con->vSservice($serviceId) && $con->vScost($scost) && $con->vSname($sname))
      {
     ?>

     <center>
   
   <label id="succ">
    <?php  
    
     echo $con->UpdateAssService($scost,$serviceId,$sname,$hnm);
     ?>
   </label>
   </center> 

    <?php
      }
      else
      {
     ?>
    <center>
    <div>
    <sup>
    <?php 
     echo $con->eSname($sname)."<p/>";
     echo $con->eScost($scost)."<p/>"; 
    
     ?>
     </sup>
     </div>
    </center> 

     <?php
      }
  }

   if ($post=="Delete") {

       $serviceId=$_POST['serviceId'];
 
          ?>

     <center>
   
     <label id="succ">
     <?php  
      
       echo  $con->DeleteService($serviceId,$hnm);
     ?>
   
     </label>
     </center> 

    <?php
}

  	                

     if( isset($_POST['hiD']) && isset($_POST['owniD']))
     {

        $hnm=$_POST['hiD'];
        $ownID=$_POST['owniD']; 
       
      
    } 
 
 
?> 



 
<ul>
      <li id="liL">
                  <form action="addAssServiceStaff.php" method="post">

                     <input class="hi" type="hidden" name="owniD"  value="<?php echo $ownID;?>">


                      <input class="hi" type="hidden" name="hiD"  value="<?php echo $hnm;?>">

                      <input class="pos" type="submit" value="New Services" name="post"  >

                   </form>
                        
        </li>
    </ul>
  

<center>

<fieldset id="new_service_view_form">
<table  width="100%" id="table_border">
<tr >

<td align="left" colspan="3">

<label id="main_lab">ASSOCIATED SERVICES</label>

</td>

</tr>

<?php 
 $ro=$con->getAssServices($hnm);
 if($ro->rowCount()>0){
 	$re=$ro->fetchAll();
 	?>
 	<tr  class="tr1">

 	<td id="td_height" width="50%">
 	   
 	      <label id="min_lab">SERVICE</label>

 	</td>

 	<td>

 	<label id="min_lab">CHARGE (IF ANY)</label>

 	</td>
 	<td colspan="2">
 		
 	</td>

 	</tr>
 	<?php
foreach ($re as $key => $value) {
	?>
	<tr  class=""> 
	    
	    <td id="td_height">

	<?php echo $value["service"];?>
		

	</td>

	<td>

	<?php echo $value["charge"];?>
		

	</td>

	 


   <td align="right">
                  

                   <form action="editHotelAssServiceFormStaff.php" method="POST">

                       <input type="hidden" value="<?php echo $value["serviceId"];?>" name="serviceId" class="hi">

                       <input type="hidden" value="<?php echo $hnm;?>" name="hiD" class="hi">

                       <input type="hidden"  value="<?php echo $ownID;?>" name="owniD" class="hi">

                       <input type="submit" id="edit" name="post" value="Edit">

                   </form>
            </td> 
            <td align="right">
                         

                     <form action="hotelServicePageStaff.php" method="POST">

                       <input type="hidden" value="<?php echo $value["serviceId"];?>" name="serviceId" class="hi">

                       <input type="hidden" value="<?php echo $hnm;?>" name="hiD" class="hi">

                       <input type="hidden"  value="<?php echo $ownID;?>" name="owniD" class="hi">

                       <input type="submit" class="edit" name="post" value="Delete">

                   </form>
                    

    </td>


	</td>
	</tr>
<?php }}
else{

	?>

	<tr  class=""><td id="td_height" colspan="2">There is no any associated services currently available</td></tr>
	<?php
}
?>

</table>

</fieldset>
</center>

