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

$sql_InvoiceQuery   = mysqli_query($conn,"SELECT count(*) as sitecode FROM vehiclereg");
$rowInvoiceCount    = mysqli_fetch_array($sql_InvoiceQuery,MYSQLI_ASSOC);
$sitecode_count      = $rowInvoiceCount['sitecode']+1;
?>

<!DOCTYPE html>
<html>
<head>
  
  <?php 
    require 'meta.php';  
    require 'header.php'; 
  ?>

</head>
<body>
    <?php require 'menu.php' ?>
<div class="container-fluid">
<h2 class="text-center">Vehicle Reg Master Details</h2><br>
    <form class="form-horizontal" action="vehicleregMasterInsert.php" method="post" id="siteMasterForm" onSubmit="return checkForm(this);" autocomplete="off">
      
    <div class="form-group">        
        
        <label class="control-label col-sm-4">Reg Code</label>
        <div class="col-sm-4">
        <input type="text" class="form-control input-lg" placeholder="Enter site code" readonly name="regcode" value="<?php echo "REG-".$sitecode_count; ?>" autocomplete="off" required> 
        </div>
        
    </div>
    <div class="form-group">        
        
        <label class="control-label col-sm-4">Reg Person Name</label>
        <div class="col-sm-4">
        <input type="text" class="form-control input-lg" placeholder="Enter Person Name" name="regname" autocomplete="off" required >
        </div>
        
    </div>
    
    <div class="form-group" >        
        
        <label class="control-label col-sm-4">Reg Address</label>
        <div class="col-sm-4">
        <textarea class="form-control input-lg" placeholder="Enter Reg Address" name="reg_address" autocomplete="off" required ></textarea>
        </div>
        
    </div>

       <div class="form-group">        
      <div class="col-sm-12 text-center">
        <button type="submit" name="myButton" class="btn btn-default btn-lg" id="btn">Save</button>
      </div>
    </div>
  </form>   
</div>


    <?php require 'footer.php' ?>
    <script type="text/javascript">var base_url = "<?= $base_url ?>";</script>
    <script type="text/javascript" src="siteMasterScript.js"></script>

  <script>

  var checkForm = function(form) {

    //
    // validate form fields
    //

    form.myButton.disabled = true;
    return true;
  };


</script>

</body>
</html>