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

<table border="0" class="shop_default">
<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="buda_shoping_centerout.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 
//////////// 
   if(isset($_POST['search']))
       {

        $searchValue=$_POST['searchValue'];

        if ($searchValue!="") {
           
          $myS=$scon->getShopBySearch($searchValue);
         
         }
         else{

        $myS=$scon->getShop();

         }
        }
        else
        {
         
        $myS=$scon->getShop();
       } 
       ////////////
if($myS->rowCount()>0){
 $sho=$myS->fetchAll();
 foreach ($sho as $key => $shop) {
  $shopid=$shop['shopid'];
  $ownID=$shop['ownerid']; 

?>
<tr>
	<td valign="top" width="15%"> 
          <ol class="homeD">

                <li>
                    
                 <form action="shopShelf.php" method="post">
                 <!--<form action="selectedShopItemDetailout.php" method="post">-->
 
                     <input class="hi" type="hidden" name="shopid"  value="<?php echo $shop['shopid'];?>">

                <input class="hi" type="hidden" name="owniD"  value="<?php echo $shop["ownerid"];?>">
                    <input  class="pos" type="submit" value="<?php echo $shop['shopname'];?>" name="post"  >

                 </form>
                <?php echo "(". $shop['phoneno'].")";?>
                </li>
              </ol> 
  </td>

  <td valign="bottom" width="85%"><br/><br/>

  <?php
  /*<!----
SHOP LOCATION SUMMARRY
    
 <label id="main_lab">LOCATION AND CONTACT INFORMATION</label><p/>

     <ul>
        <li id="padli">
          <label id="min_lab">NAME</label>
          <p/><i><?php echo $shop['shopname'];?></i>
        </li>
         <!--<li id="padli">
          <label id="min_lab">STREET</label>

          <p/><i><?php// echo $shop['street'];?></i>
        </li>
        <li>
          <label id="min_lab">WARD</label>

          <p/><i><?php// echo $shop['ward'];?></i>

        </li>

        <li id="padli">
          <label id="min_lab">DISTRICT</label>

          <p/><i><?php echo $shop['district'];?></i>
        </li>-->
        <li id="padli">
          <label id="min_lab">REGION</label>

          <p/><i><?php echo $shop['region'];?></i>
        </li>
        <li id="padli">
          <label id="min_lab">COUNTRY</label>

          <p/><i><?php echo $shop['country'];?></i>
        </li>

        <li id="padli">
          <label id="min_lab">PHONE NUMBER</label>

          <p/><i><?php echo $shop['phoneno'];?></i>
        </li>

        <li id="padli">
          <label id="min_lab">EMAIL ADDRESS</label>

          <p/><i><?php echo $shop['email'];?></i>
        </li>

       <!-- <li id="padli">
          <label id="min_lab">POSTAL ADDRESS</label>

          <p/><i><?php //echo $shop['postAddress'];?></i>
        </li>
        <li id="padli">
          <label id="min_lab">POPULAR MARK</label>

          <p/><i><?php// echo $shop['popularmark'];?></i>
        </li> -->
     </ul><p/>

    <!--SHOP LOCATION ENDS-->
	<br/><label id="main_lab">PRODUCTS</label><p/>
	*/
$pm=$scon->getShopItemPrices($shopid,$ownID);

if($pm->rowCount()>0){
 $pim=$pm->fetchAll();
 $count=$pm->rowCount();
 $div=floor($count/10);
 $mod=$count % 10;
 $chec=0;
 $draw=10 - $mod;
 ?>
 
 
 <table  style="border: 4px solid white;margin-top:12px;"> 
 <?php
foreach ($pim as $key => $pi) {
$itemid=$pi['itemID'];
$item=$scon->getThisItem($itemid);
if($item->rowCount()>0){
   $it=$item->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="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 $shop["ownerid"];?>">
                <input class="hi" type="hidden" name="itemid"  value="<?php echo $it['itemid'];?>">

                <input  class="spos" type="submit" value="More 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  $it['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 $shop["ownerid"];?>">
                <input class="hi" type="hidden" name="itemid"  value="<?php echo $it['itemid'];?>">

                <input  class="spos" type="submit" value="More detail" name="post"  >

                 </form>

			
		         </td>

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