<?php
require('head2AltStaff.php');

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

       $ownID=$_POST['owniD'];   
      $shopid=$_POST['shopid'];
 $getS=$myAgrocon->getSelectedShopOther($shopid);
 if ($getS->rowCount()>0) {
  $shop=$getS->fetch();

?>


<center><table border="0" width="80%">
<tr>
	<td colspan="2" height="50px" valign="top">
		

	  <label id="main_title"><?php echo $shop['shopname'];?></label>

	</td>
 </tr>
 <tr>
 	<td colspan="2" height="80px" valign="top">
 	
   <?php
    /// require_once('shopNavLink.php');
  ?>

 		
 	</td>
 </tr>
 <tr>
  <td colspan="2" align="center">
    
      <form action="selectedShopItemDetailout.php" method="post">

            <label id="search_lab">
                       <i>
                          Search shop item here:-
                      </i> 
             </label>
                      <input type="text" class="hotel_info" height="25px" name="searchValue" id="searchValue" onkeyup ="submision()">
                       <input type="hidden"   name="shopid" id="shopid" value="<?php echo $shop['shopid'];?>">
                       <input type="hidden"   name="owniD" id="owniD" value="<?php echo $shop['ownerid'];?>" >


                     <!-- <input class="subs" type="submit" value="Search" name="search" id="search" >--><br>
                      <i>You can search by name or category or description..</i>
            
      </form>
     
      <div  id="result" >
       <?php
      if(isset($_POST['search']))
        {

        $searchValue=$_POST['searchValue'];
       if ($searchValue!=""){
         require_once('searchThisShopItem.php');
        } 
      }
        ?>
      </div>
  </td>

</tr>
 <tr><td colspan="2" align="center">

<table border="1" width="100%" style="border-color:white" id="output">
    
    <tr><td id="td_height" ><label id="inner_top">NAME</label></td> <td><label id="inner_top">WEIGHT / VOLUME</label></td>
              <td><label id="inner_top">CATEGORY</label></td>

                <!--<td id="td_height" ><label id="inner_top">MANUFACTURE/VENDOR</label></td>


                <td id="td_height" ><label id="inner_top">DESCRIPTION</label></td>-->
 
                <td id="td_height" ><label id="inner_top">PRICE</label></td>  
 
 
                </tr>  
<?php
$shopid=$shop['shopid']; 
  ///////
$pm=$myAgrocon->getShopItemPrices($shopid,$ownID);

if($pm->rowCount()>0){
   $pim=$pm->fetchAll();
 
   foreach ($pim as $key => $pi) {
   $itemid=$pi['itemID'];
/// 
  
  $item=$myAgrocon->getThisItem($itemid);
  if($item->rowCount()>0){
   $it=$item->fetch(); 
	 
   $itemid=$it['itemid'];
   
   
   ?>

<tr><td id="td_height" >

     <label id="inner_lab"> <?php echo $it["itemname"];?> </label></td>

     <td><label id="inner_lab"><?php echo $it["itemtype"];?> </label></td>

     <td id="td_height" ><label id="inner_lab"><?php echo $it["itemcategory"];?> </label></td>

     <!--<td><label id="inner_lab"><?php //echo $it["vendor"];?> </label></td>

     <td><label id="inner_lab"><?php //echo $it["description"];?> </label></td>-->
 


     <td ><label id="inner_lab"><?php echo $pi["price"];?> </label></td>

      
   </tr> 
   
<?php
}
}
 
}
?>
</table>
</td></tr>
</table> </center>
<?php
}
else{
	echo "NETWORK ERROR!..";
    }
}
 else
{
 	 echo "Some thing went wrong while processi the page!..";
}

?>
<script>

  function submision(){
    
    var searchValue=$('#searchValue').val();

    var shopid=$('#shopid').val();
    var ownID=$('#owniD').val();
    $('#result').empty();
    $.post('searchThisShopItem.php',{searchValue:searchValue,shopid:shopid,owniD:ownID},function(data){
      $('#result').html(data);

    });
  }
</script>
<?php
// require_once('../footerIns.php');
?>