<?php
require('../head2Alts.php');

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

 $ownID=$_POST['owniD'];   
 $shopid=$_POST['shopid'];
 $getS=$scon->getSelectedShopOther($shopid);

 if ($getS->rowCount()>0) {
  $shop=$getS->fetch();

  $ownerD=$_POST['ownerD'];
 

?>

<center><table border="0" width="95%">
<tr>

	<td   height="50px" colspan="2" valign="top" >
		<ul id="lipad">
        
   <li>

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

	</li>
  <li  style="padding-left:50%;" >
     <form action="selectedShopItemDetailInOtherDirectOrder.php" method="post">

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

                      <input  type="hidden" name="ownerD" id="ownerD" value="<?php  echo $ownerD;?>">


                      <input   type="hidden" name="shopid" id="shopid" value="<?php  echo $shopid;?>">
 
                      <input class="subs" type="submit" value="Instant order placement" name="post">
            </form>
    </li>
  </ul>
  </td>
 </tr>
 <tr>
  <td colspan="2">
<ul>
  <li style="padding-right:3%;">
    <form id="order" action="buda_shoping_center.php" method="post">

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

                       
                      <input  class="spos" type="submit" value="My shop" name="post"> 

                 </form>  
     
  </li>
<li style="padding-right:70%;">
   <form id="order" action="defaultShopingCenterInOther.php" method="post">

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

                       
                      <input  class="spos" type="submit" value="Other shop" name="post"> 

                 </form> 
</li>
 
<li>
 <form id="order" action="itemViewInOther.php" method="post">

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

                       
                      <input  class="spos" type="submit" value="Item view" name="post"> 

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

            <label id="search_lab">
                       <i>
                          Search item here:-
                      </i> 
             </label>
                      <input   type="hidden" name="owniD" id="owniD" value="<?php  echo $ownID;?>">

                      <input  type="hidden" name="ownerD" id="ownerD" value="<?php  echo $ownerD;?>">


                      <input   type="hidden" name="shopid" id="shopid" value="<?php  echo $shopid;?>">

                      <input type="text" class="hotel_info" height="25px" name="searchValue" id="searchValue"  onkeyup ="submision()">
                      <input class="subs" type="submit" value="Search" name="post"><br>
                      <i>You can search by name and category.</i>
            
      </form>
    </td>
  </tr>
  <tr>
    
  <td colspan="2">
    <div id="ordercart">
      <?php
         $cc=$scon->getMyCurrentOrder($ownID,$shopid);
      if ($cc->rowCount()>0) {
         $bC=$cc->fetch();
         $batchID=$bC['batchID'];
         $Q=$scon->getMyCurrentBatch($ownID,$shopid,$batchID)->fetch();
         $QD=$scon->getMyCurrentOrderClosed($ownID,$shopid,$batchID); 
         if ($QD->rowCount()>0) {
          //$cD=$QD->fetch();
          $Qty=0;
          $value=0;
          $batch=substr(Date("Ymdhis"),2);
         }
         else{
          $batch=$bC['batchID'];
          $Qty=$Q['quantity'];
          $value=$Q['value']; 
         }
         
      }
      else{
        $Qty=0;
        $value=0;
        $batch=substr(Date("Ymdhis"),2);
      }
      ?>
      <ul>
        <li style="">
          Current order:<br/>
          Qty:<input type="submit" class="spos" name="qty" id="qty" value="<?php echo $Qty;?>">
          Value:<input type="submit" class="spos" name="value" id="value" value="<?php echo $value;?>">
          <form action="itemInbatchViewOtherIn.php" method="post">
          <input type="hidden" name="shopid" id="shopid" value="<?php echo $shopid;?>">
          <input type="hidden" name="batchID" id="batchID" value="<?php echo $batch;?>">
           <input type="hidden" name="owniD" id="owniD" value="<?php echo $ownID;?>">
           <input type="submit" name="post" class="spos" id="post" value="View detail">
           </form>
        </li>
      </ul>
    </div>
  </td>
</tr>
      
   
  <tr>
    <td colspan="2">
        <div  id="result" >
          <?php
        $post=$_POST['post'];
     if($post=="Search")
       {

        $searchValue=$_POST['searchValue'];
        if ($searchValue!="") {
           
       /// require("keypressThisShopItemSearchIn.php");
         }////////////////////EMPTY POST 
         else{
          ?>
          <p><label id="min_lab">
           Searching empty results!.. 
           </label>
           <?php

         }
       }
       
 ?>
      </div>
  </td>
</tr>
 
<?php  
  
$pm=$scon->getShopItemPricesOtherView($shopid,$ownerD);

if($pm->rowCount()>0){
   $pim=$pm->fetchAll();
   ?>
    <ul>
    <?php
   foreach ($pim as $key => $pi) {
   $itemid=$pi['itemID'];
/// 
  
  $item=$scon->getThisItem($itemid);
  if($item->rowCount()>0){
   $it=$item->fetch(); 
	 
   $itemid=$it['itemid'];
   
   
   ?>
  <tr>
		<td width="20%" height="auto" valign="top" align="center">
		<b><?php echo  $it['itemname'];?> profile image</b><p/>
		 
	       
					<img src="<?php echo $it['profileimages']; ?>" width="100%" id="pic">
		 
     
		</td>


		<td width="80%" valign="top"  align="justify">
			
            <b><?php echo  $it['itemname'];?></b>
                <p/>  

            <form id="order" action="itemMoreDetailOtherIn.php" method="post">

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

                      <input  type="hidden" name="ownerD"  value="<?php  echo $pi['ownerid'];?>">


                      <input   type="hidden" name="shopid"  value="<?php  echo $pi['shopid'];?>">


                      <input   type="hidden" name="itemid"  value="<?php  echo $pi['itemID'];?>">

 
                    
                      <input  id="item" type="submit" value="Order Now" name="post">--><b>Price: <?php echo $pi['currency']. $pi['price'];?></b>

                 </form>
 

                       <b>Other images</b><p/>
		            <?php
	   $profile=$it['profileimages'];
	   $itD=$scon->getThisItemImage($shopid,$itemid,$profile);
       if ($itD->rowCount()>0)
         {
   	        $itmD=$itD->fetchAll();
			?>
			<ul style="padding-top:0%">
			<?php
        foreach ($itmD as $key => $D)
         {
	 

	     ?>
				<li style="padding-top:0%; text-align:top; padding-left:0%;">
				<b><?php echo $D['imagename'] ?></b><br/>
				<img src="<?php echo $D['directory'] ?>" id="itemimage"><p/>
                <i><small>Posted:<?php echo $D['posteddate'] ?></small></i>
				</li>
		<?php
		 }
   	    
          }
   else
          {
             ?>
				<li> 
				No more images for the items!..<p/>
				</li>
		<?php
		 
          } 
		?>
		

                         <br><b>Description</b><p/>

                         <?php echo  $it['description'];?>

                 </form>
				 
		</td>
	</tr>
<?php
}
}
?>
</ul>
<?php
}
else
{
	?>
	<tr>
		<td colspan="2">
		Item not yet uploaded!..
			
		</td>
	</tr>
	<?php
}
?>
</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 ownID=$('#owniD').val();
    var ownerD=$('#ownerD').val(); 
    var shopid=$('#shopid').val();
    $('#result').empty();
    $.post('keypressThisShopItemSearchIn.php',{shopid:shopid,ownerD:ownerD,owniD:ownID,searchValue:searchValue},function(data){
      $('#result').html(data);

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