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

<table border="0" class="shop_default">
 <tr>
	<td colspan="2"> 

	  <label id="main_lab">AVAILABLE SHOPS ITEMS VIEW</label>

    </td>
 </tr>
 <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="itemViewInOther.php" method="post">

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

                      <input type="text" class="hotel_info" height="25px" name="searchValue" id="searchValue" onkeyup ="submision()">

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

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

</tr>
<?php 
// 
 $myS=$scon->getShop();
     
       ////////////
if($myS->rowCount()>0){
 $sho=$myS->fetchAll();
 foreach ($sho as $key => $shop) {
  $shopid=$shop['shopid'];
  $ownerD=$shop['ownerid'];
  echo "<tr><td colspan='2'><b>".$shop['shopname']." shop</b></td></tr></table>";
 $pitm=$scon->getShopItemPricesOtherView($shopid,$ownerD);

if($pitm->rowCount()>0){
 $pm=$pitm->fetchAll();
 
 $count=$pitm->rowCount();
 $div=floor($count/10);
 $mod=$count % 10;
 $chec=0;
 $draw=10 - $mod;
 ?>
	
 <table  style="border: 4px solid white;margin-top:12px;">
 <?php
 foreach ($pm as $key => $pi) {
$itemid=$pi['itemID'];
$SI=$scon->getThisItem($itemid);
 
	if ($SI->rowCount()>0)
	{
		$it=$SI->fetch();
		  if($div>0)
		    {
		     $chec++;
		     if($chec==1)
    		     {
    		         echo "<tr>";
    		     }
		 
		
			?>

             

            <td style="width:10%;border: 4px solid white;" valign="top"> 
                             
             <img src="<?php echo $it['profileimages'];?> " style="width:100%; height:80px; border-radius: 12px;"/>
               <center><i> <b><?php echo  $pi['currency'].":".$pi['price'];?></b></i><br/> 

                <small><?php echo $it['itemname'];?></small><p/>
                <form action="itemMoreDetailOtherIn.php" method="post">
 
                      <input class="hi" type="hidden" name="shopid"  value="<?php echo $pi['shopid'];?>">

                    <input class="hi" type="hidden" name="owniD"  value="<?php echo $ownID;?>">
                      
                    <input class="hi" type="hidden" name="ownerD"  value="<?php echo $pi["ownerid"];?>">
                      <input class="hi" type="hidden" name="itemid"  value="<?php echo $pi['itemID'];?>">

                      <input  class="spos" type="submit" value="<?php echo $it['itemtype'];?>" name="post"  >

                 </form>



        
                   </td>

			
		    	<?php
		     	if($chec==10)
        			{
        			    echo "</tr>";
        			    $chec=0;
        			    $div--;
        			}
        			
        	 	
        			
	        }
	        
	   else if($div<=0){
	            
	       //////////////
	        
	        $chec++;
	        if($mod > 0)
		    {
		     if($chec==1)
    		     {
    		         echo "<tr>";
    		     }
		 
			  ?>
	 
	         <td style="width:10%;border: 4px solid white;" valign="top"> 
                             
              <img src="<?php echo $it['profileimages'];?> " style="width:100%; height:80px; border-radius: 12px;"/>
               <center><i> <b><?php echo  $pi['currency'].":".$pi['price'];?></b></i><br/> 

                <small><?php echo $it['itemname'];?></small><p/>
                <form action="itemMoreDetailOtherIn.php" method="post">
 
                      <input class="hi" type="hidden" name="shopid"  value="<?php echo $pi['shopid'];?>">

                    <input class="hi" type="hidden" name="owniD"  value="<?php echo $ownID;?>">
                      
                    <input class="hi" type="hidden" name="ownerD"  value="<?php echo $pi["ownerid"];?>">
                      <input class="hi" type="hidden" name="itemid"  value="<?php echo $pi['itemID'];?>">

                      <input  class="spos" type="submit" value="<?php echo $it['itemtype'];?>" name="post"  >

                 </form>

	            <?php
		     	if($chec==$count%10)
        			{
        			     
        			   ?> 
        			   <td colspan="<?php echo $draw;?>">  </td>;
        			    </tr>
        			    <?php
        			    $chec=0;
        			    $mod--;
        			}
	        }
	       ////////////////
	       
	     }
	        
		}
		}
	 ?>
	</table>
<?php
	 
 }
 else
{
  ?>
  
   <p/>Item not yet uploaded!..<p/> 
    
  <?php
}
}
	?>

	


	</td>

</tr>
 
	

<?php
  	 
 }	

else{ 
	?>
	<tr>
		<td colspan="2">
			
      <?php

      //////////// 
   if(isset($_POST['search']))
       {

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

         }
       }
       else{
        // ?>
          <p><label id="min_lab">
           No shop available!.. 
           </label>
           <?php
       } 
       ////////////
      ?>
		</td>

	</tr>
  </table>
<?php
}
//}
//else{
 // echo "Connect Error Reload again";
//}

?>
<script>

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

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

    });
  }
/* 
$(document).ready(function(){
  
$('#search').keyup(function(){
  var searchValue= $('#search').val();
  $trim(searchValue); 
  if (searchValue!='') {
    $.ajax({
      url:"searchItemOut.php",
      method:"POST",
      data:{searchValue:searchValue},
      success:function(data){
        $('#result').html(data);
      }
    });

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