
<?php
require('../head2Alts.php');
 if (isset($_POST['shopid']) && isset($_POST['owniD']) && isset($_POST['itemid'])) {
 $post=$_POST['post'];	 
 $shopid=$_POST['shopid'];
 $itemid=$_POST['itemid']; 
 $ownID=$_POST['owniD'];
 $ownerD=$_POST['ownerD'];
 $getS=$scon->getMyShopItem($shopid);
 if ($getS->rowCount()>0) {
  $shop=$getS->fetch();
 $pD=$scon->getItemOfThisPrice($itemid,$shopid,$ownerD);
  $pi=$pD->fetch();
?>
 

<table border="0" width="100%" >

<tr>
	<td colspan="3" height="40px" >
		

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

	</td>
 </tr>
 <tr>
  <td colspan="3">
<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>   
  
<?php
$item=$scon->getThisItem($itemid);
if($item->rowCount()>0){
   $itm=$item->fetch(); 
	  
   ?>

   <tr>

	<td   rowspan="3" width="20%" valign="top">
	 
	</td>

     <td width="20%"   align="justify" height="auto" >
		     <b><?php echo  $itm['itemname'];?> profile  summmary</b>
     </td>


	<td   height="40px" width="60%">


		<b> <?php echo $itm['itemname'] ?> images<br/>
	</td>
</tr>
  <tr>
      
		 
	
	 <td align="justify" >

					 <img src="<?php echo $itm['profileimages'] ?>" id="pic" >
		<p/> 
             <form id="order" action="selectedItemForPurchaseOtherIn.php" method="post">

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

                      <input  type="hidden" name="ownerD"  value="<?php echo $ownerD;?>">
 
                      <input class="hi" type="hidden" name="shopid"  value="<?php echo $shopid;?>">


                      <input class="hi" type="hidden" name="itemid"  value="<?php echo $itm['itemid'];?>">


                      <!--<input class="hi" type="hidden" name="itemcost"  value="<?php //echo $itm['itemcost'];?>">--


                    Quantity: <input class="Qty" type="text" name="quantity" id="quantity" value="1"><br>
                    <sub id="cn"></sub><p>-->


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

                 </form>
  	         </td>
          <td valign="top">
          	<!---///////////////////-->
        <?php
		$profile=$itm['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']; ?><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!..
				</li>
		<?php
		 
          } 
		?>
		</ul>

          	<!----///////////////////-->
	
         </td>
  	       </tr>
  	         <tr><td colspan="2" align="justify">
			<ul id="lipad">

				<li id="pad"> 
                     <i>Item id:</i> <?php echo $itm['itemid'];?> 
				</li>
			<li id="pad"> 
                     <i>Saling price:</i> <?php echo $pi['currency'].":". $pi['price'];?> 
				</li>
				<li id="pad"> 
                     <i>Item type:</i> <?php echo $itm['itemtype'];?> 
				</li>

				<li id="pad"> 
                     <i>Category:</i> <?php echo $itm['itemcategory'];?> 
				</li>


				<li id="pad"> 
                     <i>Date posted:</i> <?php echo $itm['dateposted'];?> 
				</li>


				<li id="pad"> 
                     <i>Expire date:</i> <?php echo $itm['expiredate'];?> 
				</li>
			</ul>
			<b>Description</b><P/>

           <?php echo  $itm['description'];?>
     
		</td>

		 

	</tr>
<?php
 
}
else
{
	?>
	<tr>
		<td colspan="2">
		Item not yet uploaded!..
			
		</td>
	</tr>
	<?php
}
?>
</table>
<?php
}
else{
	echo "NETWORK ERROR!..";
    }
}
 else
{
 	 echo "Some thing went wrong while processi the page!..";
}

?>
<script type="text/javascript">
$("#order").on('submit',function(e){
  


var quantity=document.getElementById('quantity').value;
 
var nN =/[0-9]/i;
var j=0,k=0, g=0,i=0;

//////////////////
/////////////////////            CAR REGISTRATION   //////////////////
          //////////////////////////////////

 if(quantity==""){
  e.preventDefault();


        document.getElementById('cn').innerHTML="Item quantity required!..";
  }
 else{

      for(i=0;i<quantity.length;i++)
       {
         if(!quantity[i].match(nN))
          {
             j++;

           }
        }
      
       if(j>0)
         {
       
        e.preventDefault();
   
        document.getElementById('cn').innerHTML="Item quantity typed with error!.."; 
          }

         else
         {
 

          document.getElementById('cn').innerHTML="";

         }
   }
 
    j=0, i=0;
  
 

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