Language: JavaScript
Label: safe
CWE: CWE-829 \u2014 Inclusion of Functionality from Untrusted Control Sphere
The product imports, requires, or includes executable functionality (such as a library) from a source that is outside of the intended control sphere.

Code:
  productDiscountCheck: function(event) {

    // Count Sub total for each product. 
    var netSalesPrice = $("#productSaleItemPrice").val();
    var Discount = $("#productSaleItemDiscount").val();
    
    if( event.key === "Enter" && Discount.indexOf("%") > 1 && Discount.replace("%","") >= 100) {

      // Display the error message
      Swal.fire({
        title: "Error!",
        text: "Discount Must be below of 100%",
        icon: "error"
      });

      $("#productSaleItemDiscount").val("");
      $("#productSaleItemDiscount").select();

      event.preventDefault();
      
    } else if ( event.key === "Enter" && Number(Discount) >= Number(netSalesPrice) && Discount.indexOf("%") < 1) {
      
      $("#productSaleItemDiscount").val("");
      $("#productSaleItemDiscount").select();

        // Prevent closing modal if presed enter when have discount problem
        if(event.key === "Enter") {
            event.preventDefault();
        }
  
      // Display the error message
      Swal.fire({
        title: "Error!",
        text: "Discount Must be below of product sale price",
        icon: "error"
      });

      event.preventDefault();
      
    }

  },