<?php 
  require_once("config/configDB.php"); 
  require "userPermission.php";
  require "vehicleMasterFetchData.php";
?>
<!DOCTYPE html>
<html>
<head>
    <?php 
      require 'meta.php'; 
      require 'header.php'; 
    ?>
    
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script>
$(document).ready(function(){ 
$('#regname').change(function(){  
//alert("ji");
	  var query=$(this).val();
	 
	             $.ajax({  
                     url:"pickregaddress.php",  
                     method:"POST",  
                     data:{query:query},
                     success:function(data)  
                     {  
					      //alert(data);
						  var data2 = data.split("||");
                          $('#reg_address').val("");  
                          $('#reg_address').val(data2[0]);
						  
                         
                         
                     }  
                });  
      }); 
}); 
</script>
</head>
<body>
    <?php require 'menu.php' ?>
<div class="container-fluid col-sm-12 col-xs-12">
<h2 class="text-center">Vehicle Details</h2><br>
    <form class="form-horizontal" action="vehicleMasterInsert.php" method="post" id="vehicleMasterForm" onSubmit="return checkForm(this);" autocomplete="off">
      
      <div class=" col-sm-12 row">
        <div class=" col-sm-2"></div>  
        <div class="col-sm-4 col-xs-12 form-group">
          <label class="control-label" >vehicle No</label>
          <input type="text" class="form-control input-lg" placeholder="Enter vehicle Number" name="vehicleno" autocomplete="off" required > 
        </div>
        <div class="col-sm-4 col-xs-12 form-group">
          <label class="control-label" >Vehicle Type</label>
          <select class="form-control input-lg selectpicker brandtype_select" data-live-search="true" name="brandtype">
         
          <?php   echo $sqlBrandtype; ?>
          </select> 
        </div>
      </div>

      <div class=" col-sm-12 row">
        <div class=" col-sm-2"></div>  
        <div class="col-sm-4 col-xs-12 form-group">
          <label class="control-label" >Brand Name</label>
          <div class="brandname_selected">
            <select class="form-control input-lg brandname_select selectpicker" data-live-search="true" name="brandname" id="brandname_select">
              
              <?php   echo $sqlBrandname;        ?>
            </select>
          </div>
        </div>
        <div class="col-sm-4 col-xs-12 form-group">
          <label class="control-label" >Model</label>
          <input type="text" class="form-control input-lg" placeholder="Enter Model" name="model" autocomplete="off" >
        </div>
      </div>

      <div class=" col-sm-12 row">
        <div class=" col-sm-2"></div>  
        <div class="col-sm-4 col-xs-12 form-group">
          <label class="control-label" >Purchase Date</label>
          <input type="text" class="form-control input-lg datepicker-purchase"  name="purchasedate" autocomplete="off">
        </div>
        <div class="col-sm-4 col-xs-12 form-group">
          <label class="control-label" >Opening KM</label>
          <input type="text" class="form-control input-lg" placeholder="Enter km" name="openingkm" autocomplete="off" >
        </div>
      </div>

      <div class=" col-sm-12 row">
        <div class=" col-sm-2"></div>  
        <div class="col-sm-4 col-xs-12 form-group">
          <label class="control-label" >Vehicle Type</label>
          <select class="form-control input-lg vehicletype_select selectpicker" data-live-search="true" name="vehicletype">
            <!--<option disabled selected>Please select your option</option>-->
            <option value="new">New</option>
            <option value="used">Used</option>
          </select>
        </div>
        <div class="col-sm-4 col-xs-12 form-group">
          <label class="control-label" >Ownership</label>
          <select class="form-control input-lg ownership_select selectpicker" data-live-search="true" name="ownership">
              <!--<option disabled selected>Please select your option</option>-->
              <option value="owned">Owned</option>
              <option value="leased">Leased</option>
          </select>
        </div>
      </div>


<div class=" col-sm-12 row">
        <div class=" col-sm-2"></div>  
        <div class="col-sm-4 col-xs-12 form-group">
        <label class="control-label" >Reg Name</label>
         <select class="form-control input-lg ownership_select selectpicker" data-live-search="true" name="regname" id="regname">
              <option  selected>Please select Reg Name</option>
              <?php echo $sqlregname;?>
          </select>
        </div>
        <div class="col-sm-4 col-xs-12 form-group">
          <label class="control-label" >Reg Address</label>
          <input type="text"  class="form-control input-lg" placeholder="Enter Address" name="reg_address" id="reg_address" autocomplete="off" required>
        </div>
      </div>

<div class=" col-sm-12 row">
        <div class=" col-sm-2"></div> 
        
        <div class="col-sm-4 col-xs-12 form-group">
          <label class="control-label" >Opening Hrs</label>
          <input type="text" class="form-control input-lg" placeholder="Enter Hours" name="openinghrs" autocomplete="off" required>
        </div> 
        <div class="col-sm-4 col-xs-12 form-group">
          <label class="control-label" >Company  Mileage</label>
          <input type="text" class="form-control input-lg" placeholder="Enter Company Milieage" name="companymileage" autocomplete="off" required>
        </div> 
        
      </div>
    
<div class=" col-sm-12 row">
        <div class=" col-sm-2"></div> 
        
        
        
        
      </div>
       
      

      

      





      





      

    <div class="form-group">        
      <div class="col-sm-12 text-center">
        <button type="submit"  name="myButton" class="btn btn-default btn-lg">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="vehicleMasterScript.js"></script>

<script>

  var checkForm = function(form) {

    //
    // validate form fields
    //

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


</script>

<!--<script type="text/javascript" src="js/plugin/jquery-ui.min.js"></script>

    <script>
    
$(document).ready(function() {
              
      
                
    $(".datepicker-sale").datepicker({
       
        dateFormat: 'yy-mm-dd',
        onSelect: function (dateStr) {
            var min = $(this).datepicker('getDate'); // Get selected date
            $("#toDate").datepicker('option', 'minDate', min || '0'); // Set other min, default to today
        }
    });

    

			} );

</script>-->

</body>
</html>