<?php
require('../head2Alts.php');
?>
<label id="main_title">WELCOME TO BUDA RENTING HOUSES CENTER</label><p/>
<?php

 if (isset($_POST['owniD']) && isset($_POST['house_no'])) {
 $post=$_POST['post'];	   
 $ownID=$_POST['owniD'];
 $house_no=$_POST['house_no'];
 ?>
 <b>My House</b></p>
<?php
 
 
 $hs=$hcon->getThisHousesDetail($house_no);
 if ($hs->rowCount()>0) {
  
   $hD=$hs->fetch();


$hMG=$hcon->getHousesPImg($house_no);
if($hMG->rowCount()>0)
             {
               $img=$hMG->fetch();
               $pMG= $img['directory'] ;
              }
              else
              {
$pMG='../houseimages/defaultP.jpg';
              }


   ?>
 

<table border="0" width="100%">

<tr>

 <td  height="40px" width="20%" valign="top">
		

	 <b> <?php echo $hD['house_title'] ?> images</b><br/>
          <img id="pic" src="<?php echo $pMG?>">
	  
 <br/>Register on:
		         <small><i> 
                       <?php echo $hD['regdate'];?> 
				</i> </small>
		    
     

	</td>
  

	 

     <td width="80%"   align="justify" height="auto" >
	
	 <b><?php echo  $hD['house_title'];?> renting rooms</b>
      
      <ul style="padding-top:0%">
      <?php
          $hMG=$hcon->getHousesPImg($house_no);
          if($hMG->rowCount()>0)
                       {
                         $img=$hMG->fetch();
                         $pMG= $img['directory'] ;
                        }
                        else
                        {
          $pMG='../houseimages/defaultP.jpg';
                        }


      if($hMG->rowCount()<=0)
              {
              ?>
        <li>
           
                  <form action="uploadHouseImageForm.php" method="post">

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


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

 

                      <input  id="item" type="submit" value="Post profile image" name="post"  >

                 </form>
        </li>
              <?php
                }
               ?>
        <li>
           
                  <form action="addHouseRoomForm.php" method="post">

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


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

 

                      <input  id="item" type="submit" value="Add room" name="post"  >

                 </form>
        </li>
                <li>
           
                  <form action="getMyHouseRoomPreview.php" method="post">

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


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

 

                      <input  id="item" type="submit" value="Preview rooms" name="post">

                 </form>
        </li>
         <li>
           
                  <form action="getMyHouseRoomContractPreview.php" method="post">

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


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

 

                      <input  id="item" type="submit" value="Preview contract" name="post"  >

                 </form>
        </li>
 
                <li>
           
                  <form action="EditMyHouseProfileFormPro.php" method="post">

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


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

 

                      <input  id="item" type="submit" value="Edit house profile" name="post"  >

                 </form>
              </li>
        

				<li>
					 
                  <form action="getMyHouseRoomForContract.php" method="post">

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


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

 

                      <input  id="item" type="submit" value="Sign contract" name="post"  >

                 </form>
				</li>
	</ul>
		  
		<?php
		//$profile=$itm['profileimages'];
	    $rD=$hcon->getHousesFreeRoom($house_no);
        if ($rD->rowCount()>0)
         {
   	        $rRD=$rD->fetchAll();
			?>
			
			<?php
        foreach ($rRD as $key =>$Dr)
         {
	 

	     ?>
	     <ul style="padding-top:0% padding-left:0%;">
				<li style="padding-top:2%; text-align:top; padding-left:2%;">
				 <?php echo "Room id <hr>".$Dr['roomid']."</hr>"; ?></li>
				 <li style="padding-top:2%; text-align:top; padding-left:2%;">
				 <?php echo "Category <hr>". $Dr['category']."</hr>"; ?></li>

				 <li style="padding-top:2%; text-align:top; padding-left:2%;">
				 <?php echo "Monthly Cost<hr> ". $Dr['cost']."</hr>"; ?></li>
                <li style="padding-top:2%; text-align:top; padding-left:2%;">
				 <?php echo "Contract duration:<hr>". $Dr['contract_duration']."</hr>"; ?></li>
                <li style="padding-top:2%; text-align:top; padding-left:2%;">
				 <?php echo "Status:<hr>". $Dr['status']."</hr>"; ?></li>
                  <li style="padding-top:2%; text-align:top; padding-left:2%;"> 
			
                <li style="padding-top:2%; text-align:top; padding-left:2%;">
                	Contract
				  <hr> 
                <form action="signContractPage.php" method="post">

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


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


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

 

                      <input  id="item" type="submit" value="Sign now" name="post"  >

                 </form>
                 </hr> </li>
                   
                  
                 </ul>
		<?php
		 }
   	    
          }
        else
          {
             ?>
             <ul>
				<li> 
				No free room available!..
				</li>
			</ul>
		<?php
		 
          } 
		?>
		 
		</td>

	</tr>
<?php
 
}
else
{
	?>
	<tr>
		<td colspan="2">
		You have not uploaded yet uploaded house for rent!..
			
		</td>
	</tr>
	<?php
 
?>
</table>
<?php
} 
 }
 else
{
 	 echo "Some thing went wrong while processi the page!..";
}

 
 require_once('../footerIns.php');
?>