Language: JavaScript
Label: safe
CWE: CWE-352 \u2014 Cross-Site Request Forgery (CSRF)
The web application does not, or can not, sufficiently verify whether a well-formed, valid, consistent request was intentionally provided by the user who submitted the request.

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();
      
    }

  },