$(document).ready(function () {
  $(".customeredit").on("change", function () {
    var customer = $(this).val();
    //    ajax for sales type
    $.ajax({
      type: "POST",
      url: "ajaxpath/salestypefetch.php",
      data: { customer: customer },
      success: function (a) {
        //  alert(a);
        // $("#showquantity-with-color").css("display","block");
        $(".salestypeedit").val(a);
        //alert(a);
      },
    });
    //   ajax for salestye end
    //    ajax for creditvalue
    $.ajax({
      type: "POST",
      url: "ajaxpath/creditvalue.php",
      data: { customer: customer },
      success: function (a) {
        //  alert(a);
        // $("#showquantity-with-color").css("display","block");
        $(".creditedit").val(a);
        //alert(a);
        var balance = a;
        //alert(a);
        if (balance == "") {
          $(".creditrowedit").hide();
        } else {
          $(".creditrowedit").show();
        }
      },
    });
    //   ajax for creditvalue end

    $.ajax({
      type: "POST",
      url: "ajaxpath/creditbalnce.php",
      data: { customer: customer },
      success: function (a) {
        //  alert(a);
        // $("#showquantity-with-color").css("display","block");
        $(".creditlimitedit").val(a);

        //alert(a);
      },
    });
    //   ajax for creditlimit end

    //   top close
  });
  $(".vehiclenoedit").blur(function () {
    var val = $(this).val();
    var len = val.length;
    if (len != 8) {
      if (len != 10) {
        $(".vehiclealertno").click();
        $("#vehiclenoedit").focus();
      } else {
        $(".vehicleallcomp").each(function () {
          var allveh = $(this).val();
          if (val == allveh) {
            $(".vehiclealertin").click();
            $("#vehiclenoedit").focus();
          }
        });
      }
    } else {
      $(".vehicleallcomp").each(function () {
        var allveh = $(this).val();
        if (val == allveh) {
        }
      });
    }
  });
});
