<?php

require_once("head2Alt.php");
if(isset($_POST['post'])){

  $hnm=$_POST['hiD'];
    $ownID=$_POST['owniD'];
    $post=$_POST['post'];
    require_once("buda_connect.php");
    $con = new connect_class();

     if ($post=="Delete") {

            $room_no =$_POST['roomNo'];

             ?>

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

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

	
		//HOTEL NAVIGATION LINKS-->
         require_once("my_hotel_main_nav_link.php");
      //-MAIN NAVIGATION LINK END-->
 
?> 


       
 
      <ul>   <li id="liL"> <label id="main_lab">  ROOM SERVICES</label></li></ul>
                  
        


                    <ul>
                        <li id="liL">
                          <form action="roomImageUploadForm.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="Add images" name="post"  >

                        </form>

                        </li>

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

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


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

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

                        </form>
                        </li>

                         
                  </ul>
                 
   
 
 

<center>
 <table width="90%" id="table_border" class="rtab" ><tr><td colspan="6" align="center" ><label id="main_lab"> ROOM SERVICES</label> </td></tr>
 

 <?php
   $rM=$con->getHotelRoom($hnm);
 		if($rM->rowCount()<=0){
 			


 
								?>
<tr class="tr2">
              
               <td colspan="6"> 
								 No room detail uploaded
               </td>
</tr>

 
     

						<?php
							}

							else{
 
				?>

<tr class="tr1"><td width="10%"><label id="min_lab">ROOM NUMBER</label></td><td width="20%" ><label id="min_lab">ROOM NAME</label></td>
	 
<td   width="16%" ><label id="min_lab">COST/NIGHT</label></td>

 <td  width="20%" ><label id="min_lab">ROOM TYPE</label></td><td width="14%"><label id="min_lab">ROOM/STATUS</label></td>
<td width="20%" colspan="2" align="right" ><label id="min_lab"> </label></td>
 </tr>


				<?php			   
 		 
 		 

 		$val=$rM->fetchAll();
    
    foreach ($val as $key => $room) {
 				?>

 				<tr class="tr2" height="40px">
               <td>
                    <?php echo $room["room_no"];?>
                      

                </td>

                <td>

                     <?php echo $room["rname"];?>
                       
                </td>

                <td>

                      <?php echo $room["rcost"];?>
                      
                </td>

                <td >

                <?php echo $room["rtype"];?>
                  
                </td>

                <td>

                <?php echo $room["rstatus"];?>
                
                </td>

                <td align="right">
                   <form action="editRoom.php" method="POST">

                       <input type="hidden" value="<?php echo $room["room_no"];?>" name="roomNo" 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="myHotelRoomView.php" method="POST">

                       <input type="hidden" value="<?php echo $room["room_no"];?>" name="roomNo" 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="Delete">

                   </form>

                 </td>

        </tr>
                 <?php
 				} 
 			}
 			?>
 		 

<tr class="tr2">

               <td colspan="6">  


<!--HERE NAVIGATIO LINK ENDS-->
                              
               </td>
</tr>

</table>  </center>
<?php
}
else{
	echo "Oops!.. you internet connect is very slow to respond!..";
}
}
else
{
echo "Oops!.. you session has expired login again..";
}
 
require_once('footerIn.php');
?>

