<?php 
  if (!isset($_SESSION['username'])) {
    $_SESSION['msg'] = "To access this page, Login is required";
    header('location: login.php');
  }  ?>

<!DOCTYPE>
<html lang="en">
<head>
<title></title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
* {
  box-sizing: border-box;
}

body {
  margin: 0;
}

#loader {  position: absolute;  left:60%;  top: 50%;  z-index: 1;  width:30px;  height: 30px;  margin: -76px 0 0 -76px;  border-radius: 50%;   border-top: 2px solid #007AA5;  border-right: 1px solid #007AA5; border-left: 1px solid white;
border-bottom: 2px solid white;   -webkit-animation: spin 2s linear infinite;  animation: spin 2s linear infinite;}
#myDiv { display: none; }

@-webkit-keyframes spin {  0% { -webkit-transform: rotate(0deg); }  100% { -webkit-transform: rotate(360deg); }}

@keyframes spin {  0% { transform: rotate(0deg); }  100% { transform: rotate(360deg); }}

/* Add animation to "page content" */
.animate-bottom {  position: relative;  -webkit-animation-name: animatebottom;  -webkit-animation-duration: 1s;
  animation-name: animatebottom;  animation-duration: 1s}

@-webkit-keyframes animatebottom {  from { bottom:-100px; opacity:0 }  to { bottom:0px; opacity:1 }}

@keyframes animatebottom {   from{ bottom:-70px; opacity:.3 }  to{ bottom:0; opacity:1 }}


.top-top {float: left; font-size: x-small;color:#848482; width: 100%; padding: 10px; margin-bottom: 2%;}
.col-products {  float: left;  width:100%;   padding: 15px;  font-size: small; background: whitesmoke;}
.col-products-a {  float: left;  width:80%; background: white;  padding: 15px;  font-size: small; box-shadow: 1px 1px 1px 2px #EDEAE0;  border-bottom: 2px solid #ED872D ;}
.col-products-b {  float: left;  width:20%; background: whitesmoke;  padding: 10px;  font-size: small; box-shadow: 2px 3px 2px 2px whitesmoke;}
.product-review { float: left; background: white; padding: 10px; width: 100%;  border-bottom: 2px solid #ED872D ; }
.product-review p { font-size: x-small;  padding: 3px;}
.product-image { width: 100%; height: 200px; }

label{margin-left: 1%; float: left; margin-top: 5px;}
label a {color: red; font-weight: bold;}
input[type=submit] {  background:#007AA5;  color: white; font-weight: bold;  padding: 10px 12px; float: right; border: none;  border-radius: 4px;  cursor: pointer;  margin-top:1%; font-size: x-small;}
input[type=submit]:hover {  opacity: .6;}


.f1, .f2{width:33.33%; padding: 10px; float:left;}
.f3{ width: 100%; padding: 10px; }

.error { float: left;  width:98%;   margin: 6px auto;   padding: 10px;   border: 1px solid #a94442; font-size: small; 
  color: #a94442;   background: #f2dede;   border-radius: 5px;   text-align: left;  margin-bottom: 3%;}


 input[type=text],[type=file]{ width: 100%;  padding: 8px;  border: 1px solid #ccc;  border-radius: 4px;   box-sizing: border-box;  margin-top: 6px;  margin-bottom: 16px;  resize: vertical; background:white; color:#4B5320; font-weight: bold;}
 input[type=file]{ background: white;  width: 100%;  padding: 4px;  border: 1px solid #ccc;  border-radius: 4px;   box-sizing: border-box;  margin-top: 6px;  margin-bottom: 16px;  resize: vertical; color:#4B5320; font-weight: bold;}
 input[type=text2], select { opacity: .6; background: white; width: 100%;  padding: 10px;  border: 1px solid #ccc;  border-radius: 4px;   box-sizing: border-box;  margin-top: 1%;  margin-bottom: 16px;  resize: vertical;  color:#4B5320; font-weight: bold; font-family: helvetica, sans-serif;   font-size: small;}
/* Clear floats after the col-productss */
.row:after {
  content: "";
  display: table;
  clear: both;
}

@media screen and (max-width:600px) {
  .col-products {  width: 100%; padding:8px;  }
  .col-products-a, .col-products-b {width: 100%; float: left; padding: 10px;}
  .f1, .f2, .f3{width:100%; padding: 15px; float:left;  } 
 label, input[type=text2],[type=file],[type=file], select, textarea{ margin-bottom: 0%; margin-top: 0%; }


}

</style>
</head>
<body>

</head>
<body onload="myFunction()" style="margin:0;">

<div id="loader"></div>

<div style="display:none;" id="myDiv" class="animate-bottom">



<div class="row">


  <div class="col-products">
    <nav class="col-products-a">

 <form  method="POST"   enctype="multipart/form-data" >

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

<?php include('errors.php') ?>

<div class="f2">
<label> Products Category  <a> * </a> </label>
<select name="category" type="readonly" >
<option><?php echo $category; ?></option>
<option>
   <?php include ("inc/config.php");
$sql = "SELECT * FROM categories ";
if($result = $conn->query($sql)){
if($result->num_rows > 0){
while($row = $result->fetch_array()){



echo "\n" . $row['Category_name'] . ""; ?>
</option>
<option><?php }} } ?> </option>

</select>

</div>
 
<div class="f1">
<label>Product Name  <a> * </a></label>
<input type="text2" name="name"  value="<?php echo $name; ?>" placeholder="Maisha Mabati" readonly >
</div>


<div class="f1">
<label>Product Size  <a> * </a> </label>
<input type="text2" name="size" required="autofocus" value="<?php echo $size; ?>" placeholder="3 Metres" readonly >
</div>


<div class="f1">
<label>Product Price (per piece)  <a> * </a></label>
<input type="text2" name="price" required="autofocus" value="<?php echo $price; ?>" placeholder="590" readonly>
</div>


<div class="f1">
<label>Quantity -  <a> Available Items </a></label>
<input type="text" name="quantity" required="autofocus" value="<?php echo $quantity; ?>" placeholder="50" readonly >
</div>


<div class="f1">
<label>Quantity  Received -  <a> Currently * </a></label>
<input type="text" name="quantity_1" required="autofocus" value="<?php echo $quantity_1; ?>" placeholder="50"  >
</div>


 
 <center><input type="submit"  name="update" value="Add Quantity Received"></center>
</form>
</nav>

 <nav class="col-products-b">
  <nav class="product-review"><h4>Product Image preview</h4>
  <img class="product-image" src="../product-images/<?php echo $image; ?>">
  <p>Image Name - <?php echo $image; ?> </p>


</nav>
 </nav>


</nav>
</div>
</div>
</div>

<script>
var myVar;

function myFunction() {
  myVar = setTimeout(showPage, 500);
}

function showPage() {
  document.getElementById("loader").style.display = "none";
  document.getElementById("myDiv").style.display = "block";
}
</script>
</body>
</html>
     
