<?php 

require_once("config/configDB.php"); 
require "userPermission.php";

$id  =  $_GET['id'];

$sql = mysqli_query($conn,"SELECT * FROM product_master WHERE id='$id' ");
 
$row=mysqli_fetch_array($sql,MYSQLI_ASSOC);


$productcode   = $row['productcode'];
$productname   = $row['productname'];
$product_tamil   = $row['product_tamil'];
$qty_type   = $row['qty_type'];
$purchase_rate   = $row['purchase_rate'];
$gst   = $row['gst'];
$hsn_code   = $row['hsn_code'];
$description   = $row['prodct_description'];
$product_type=$row['product_type'];


?>
<!DOCTYPE html>
<html>
<head>
    <title>Product Master</title>
    <?php require 'header.php' ?>

</head>
<body>
    <?php require 'menu.php' ?>
    <div class="container-fluid text-center">
    <div class="row col-sm-12">
      <strong><h3>Edit Product Master</h3></strong>
      </div>
    </div>
    <br><br>



<div class="container-fluid">
    <form class="form-horizontal" action="productMasterUpdate.php" method="post">
   
    <div class="form-group">
      <label class="control-label col-sm-3" for="email">Product Code</label>
      <div class="col-sm-5">
        <input type="text" class="form-control" placeholder="Enter Item Code" name="productcode" value='<?php echo $productcode; ?>' readonly>
        <input type="hidden" value='<?php echo $id; ?>' name="edit_id">
      </div>
      <label class="label-command col-sm-4" for="email">( Example : PRD0001)</label>
    </div>

    <div class="form-group">
      <label class="control-label col-sm-3" for="email">Product Name</label>
      <div class="col-sm-5">
        <input type="text" class="form-control" placeholder="Enter Product Name" name="productname" value='<?php echo $productname; ?>' required>
      </div>
    </div>
    
    
    <div class="form-group">
      <label class="control-label col-sm-3" for="email">Tamil Name</label>
      <div class="col-sm-5">
        <input type="text" class="form-control tamil" placeholder="Enter Product Name" name="product_tamil" id="product_tamil" value='<?php echo $product_tamil; ?>' required>
       
        </select>
      </div>
    </div>
    
    <div class="form-group">
      <label class="control-label col-sm-3" for="email">Qty Type</label>
      <div class="col-sm-5">
        <select class="form-control"  name="qty_type" required>
        <option><?php echo $qty_type; ?></option>
        <option>Box</option>
        <option>Nos</option>
        <option>Kgs</option>
        </select>
      </div>
    </div>
    
    <div class="form-group">
      <label class="control-label col-sm-3" for="email">Product Type</label>
      <div class="col-sm-5">
        <select class="form-control"  name="product_type" required>
        <option><?php echo $product_type; ?></option>
        <option>Return</option>
        <option>Sales</option>
        
       
        </select>
      </div>
    </div>

    <div class="form-group">
      <label class="control-label col-sm-3" for="email">Rate</label>
      <div class="col-sm-5">
        <input type="text" class="form-control" placeholder="Enter Purchase Rate" name="purchase_rate" value='<?php echo $purchase_rate; ?>' >
      </div>
    </div>
    <!--<div class="form-group">
      <label class="control-label col-sm-3" for="email">GST %</label>
      <div class="col-sm-5">
        <input type="text" class="form-control" placeholder="Enter GST Price per Unit" name="gst" value='<?php echo $gst; ?>' >
      </div>
    </div>
    <div class="form-group">
      <label class="control-label col-sm-3" for="email">HSN Code</label>
      <div class="col-sm-5">
        <input type="text" class="form-control" placeholder="Enter HSN Code" name="hsn_code" value='<?php echo $hsn_code; ?>' >
      </div>
    </div>-->
    <div class="form-group">
      <label class="control-label col-sm-3" for="email"> Description</label>
      <div class="col-sm-5">
        <input type="text" class="form-control" placeholder="Enter Item Description" name="description" value='<?php echo $description; ?>'>
      </div>
    </div>
    <div class="form-group">        
      <div class="col-sm-offset-2 col-sm-10">
        <button type="submit" class="btn btn-default">Submit</button>
      </div>
    </div>
  </form>   
</div>


    <?php require 'footer.php' ?>
    
    <SCRIPT language=JavaScript src="js/utf.js"></SCRIPT>
		<SCRIPT language=JavaScript src="js/tamil.js"></SCRIPT>
		
		<script>
			$(document).ready(function(){
				$('#product_tamil').on('keydown',function(event){
					if(event.which==121){
						$(this).toggleClass('tamil');
						return false;
					}
					if($(this).hasClass('tamil')){
						toggleKBMode(event);
					}else{
						return true;
					}
				});
				$('#product_tamil').on('keypress',function(event){
					if($(this).hasClass('tamil')){
						convertThis(event);
					}
				});
			});
		</script>
</body>
</html>