<html>
<?php include 'head.php';  ?>
<body>
<div class="col-lg-3 col-md-3 col-sm-3"></div>
<div class="col-lg-6 col-md-6 col-sm-6">
<form style="margin:20px;">

  <div class="form-group">
    <label for="ID">ID</label>
    <input type="text" class="form-control" id="txtCode"  placeholder="Enter Code" required>
  </div>

  <div class="form-group">
    <label for="Description">Description</label>
    <input type="text" class="form-control" id="txtDescription" placeholder="Description" required>
  </div>


  <div class="form-group">
  <label for="Description">Category</label>
  <select class="form-control form-control-lg" style="margin-bottom:20px;" id="txtCat">
  <option value="0">Select Type</option>
  <option value="Scratches">Scratches</option>
  <option value="Dents">Dents</option>
  <option value="Waves">Waves</option>
  <option value="Rust">Rust</option>
  <option value="Corrision">Corrision</option>
  <option value="Hole/Crack">Hole/Crack</option>
  <option value="Panel/windscreen">Panel/windscreen</option>
  <option value="Other Marking">Other Marking</option>

  </select>

  </div>

  <div class="form-group">
  <label for="Description">Type</label>
  <select class="form-control form-control-lg" style="margin-bottom:20px;" id="txtType">
  <option value="0">Select Type</option>
  <option value="B">B</option>
  <option value="G">G</option>
  <option value="E">E</option>
  </select>

  <small id="emailHelp" class="form-text text-muted">B - Body , G - Glass, E-Engine.</small>
  </div>

  <a  class="btn btn-primary" id="recordDesc">Update Record</a>

  </form>
  </div>
  <script>

$(document).ready(function() {



  $('#recordDesc').click(function() {
    var txtType = $('#txtType option:selected').val();
    var txtCat = $('#txtCat option:selected').val();
    if(txtType.length != "0" && txtCat.length != "0" ){

    $.post("updateDescItems.php",
    {
      id:$("#txtCode").val(),
      flaw:$("#txtDescription").val(),
      cat:txtCat,
      type:txtType

    },

     function( data ) {

       alert(data);
       location.reload();

    });


    }else{

      alert('Please Select Values');

    }

  });
});

</script>
</body>
</html>
