fix(product_page): compare type as well and provide base class for parseInt (#18332)

This commit is contained in:
sahil28297 2019-07-15 16:54:41 +05:30 committed by Chinmay Pai
parent 1abd1e79a9
commit ec810a4a55

View File

@ -29,10 +29,10 @@ frappe.ready(function() {
.html(r.message.product_info.price.formatted_price_sales_uom + "<div style='font-size: small'>\
(" + r.message.product_info.price.formatted_price + " / " + r.message.product_info.uom + ")</div>");
if(r.message.product_info.in_stock==0) {
if(r.message.product_info.in_stock===0) {
$(".item-stock").html("<div style='color: red'> <i class='fa fa-close'></i> {{ _("Not in stock") }}</div>");
}
else if(r.message.product_info.in_stock==1) {
else if(r.message.product_info.in_stock===1) {
var qty_display = "{{ _("In stock") }}";
if (r.message.product_info.show_stock_qty) {
qty_display += " ("+r.message.product_info.stock_qty+")";
@ -75,13 +75,13 @@ frappe.ready(function() {
newVal = 0;
if (btn.attr('data-dir') == 'up') {
newVal = parseInt(oldValue) + 1;
newVal = Number.parseInt(oldValue) + 1;
} else if (btn.attr('data-dir') == 'dwn') {
if (parseInt(oldValue) > 1) {
newVal = parseInt(oldValue) - 1;
if (Number.parseInt(oldValue) > 1) {
newVal = Number.parseInt(oldValue) - 1;
}
else {
newVal = parseInt(oldValue);
newVal = Number.parseInt(oldValue);
}
}
input.val(newVal);