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

<table border="0"  class="shop_default" width="100%">
 <tr><td colspan="2" align="center" height="100px" valign="center">

<b>WELCOME TO ONLINE SHOPPERS</b></td></tr>
 <tr>
  <td colspan="2">
<ul>
  <li style="padding-right:3%;">
  <label id="lab"><a style="color:blue;" href="defaultShopingCenter.php">Shop view</a></label> 
  </li>
<li style="padding-right:70%;">
  <label id="lab"><a style="color:blue;" href="buda_shoping_centerout.php">Shop detail view</a></label> 
</li>
 
  <li>

  <label id="lab"><a style="color:blue;" href="itemViewOut.php">Item view</a></label> 
 </li>
</ul>
</td>
</tr>
 <tr>
  <td colspan="2" align="center">
    
      <form action="itemViewOut.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 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('searchItemOut.php');
        } 
      }
        ?>
      </div>
  </td>

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

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"> 
                             <!--background-repeat:no-repeat;background-size:100% 100%;" background="<?php //echo //$it['profileimages'];?>-->
                             
                             <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="itemMoreDetailOtherInout.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 $pi["ownerid"];?>">
                              <input class="hi" type="hidden" name="itemid"  value="<?php echo $pi['itemID'];?>">
         
                              <input  class="spos" type="submit" value="Detail" 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="itemMoreDetailOtherInout.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 $pi["ownerid"];?>">
                              <input class="hi" type="hidden" name="itemid"  value="<?php echo $pi['itemID'];?>">
         
                              <input  class="spos" type="submit" value="Detail" name="post"  >

                               </form>



                   </td>

			
		    	<?php
		     	if($chec==$count%10)
        			{
        			     
        			   ?> 
        			   <td colspan="<?php echo $draw;?>">  </td>;
        			    </tr>
        			    <?php
        			    $chec=0;
        			    $mod--;
        			}
	        }
	       ////////////////
	       
	       }
	        
		   }
		}
		   ?>
		   </table>
		   <?php
	 

	//else
	  // {
	   	//echo "Products for sale not yet uploaded!..";
	  // }
}
 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();
    $('#result').empty();
    $.post('searchItemOut.php',{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('../footers.php');
?> 