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

$brandid   =    $_GET['id'];

$sql  = mysqli_query($conn,"SELECT brand_name, brand_type,id FROM brand_master where id=".$brandid." ");
$row  = mysqli_fetch_array($sql,MYSQLI_ASSOC);

$brandname   = $row['brand_name'];
$brandtype   = $row['brand_type'];




?>

<!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">Edit Brand Details</h2><br>
    <form class="form-horizontal" action="brandMasterUpdate.php" method="post" id="brandMasterFrom">
      <div class="form-group">        
        
        <label class="control-label col-sm-4">Brand Name </label>
        <div class="col-sm-4">
          <input type="text" class="form-control input-lg" value="<?php echo $brandname; ?>" name="brandname" autocomplete="off">
          <input type="hidden" class="form-control input-lg" value="<?php echo $brandid; ?>" name="brandid">
        </div>
        
      </div>
      <div class="form-group">        
        
        <label class="control-label col-sm-4">Item Type *</label>
        <div class="col-sm-4">
          <select class="form-control input-lg selectpicker" data-live-search="true" name="brandtype">
            <option value="transport" <?php if( $brandtype == "transport" ): ?> selected="selected"<?php endif; ?> >Transport Vehicle</option>
            <option value="equipment" <?php if( $brandtype == "equipment" ): ?> selected="selected"<?php endif; ?>>Equipment Vehicle</option>
           <!-- <option value="diesel" <?php if( $brandtype == "diesel" ): ?> selected="selected"<?php endif; ?>>Diesel</option>
            
            <option value="oil" <?php if( $brandtype == "oil" ): ?> selected="selected"<?php endif; ?>>Oil</option>
            <option value="tyre" <?php if( $brandtype == "tyre" ): ?> selected="selected"<?php endif; ?>>Tyre</option>-->
          </select>      
        </div>     
      
      </div>     
      
     <div class="form-group">        
      <div class="col-sm-12 text-center">
          <button type="submit" class="btn btn-default btn-lg">Save</button>
      </div>
    </div>
  </form>   
</div>


  <?php require 'footer.php' ?>
  <script>
	$(document).ready(function(){
	  $('#brandMasterFrom').bootstrapValidator({
        // To use feedback icons, ensure that you use Bootstrap v3.1.0 or later
        feedbackIcons: {
            valid: 'glyphicon glyphicon-ok',
            invalid: 'glyphicon glyphicon-remove',
            validating: 'glyphicon glyphicon-refresh'
        },
        fields: {
          brandname: {
                message: 'The brand name is not valid',
                validators: {
                    notEmpty: {
                        message: 'The  brand name is required and cannot be empty'
                    }
                }
            },
            brandtype: {
                message: 'The brand type is not valid',
                validators: {
                    notEmpty: {
                        message: 'The brand type is required and cannot be empty'
                    }
                }
          }
        }
    });
    

	});
</script>


</body>
</html>