fix(product_page): compare type as well and provide base class for parseInt (#18332)
This commit is contained in:
parent
1abd1e79a9
commit
ec810a4a55
@ -29,10 +29,10 @@ frappe.ready(function() {
|
|||||||
.html(r.message.product_info.price.formatted_price_sales_uom + "<div style='font-size: small'>\
|
.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>");
|
(" + 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>");
|
$(".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") }}";
|
var qty_display = "{{ _("In stock") }}";
|
||||||
if (r.message.product_info.show_stock_qty) {
|
if (r.message.product_info.show_stock_qty) {
|
||||||
qty_display += " ("+r.message.product_info.stock_qty+")";
|
qty_display += " ("+r.message.product_info.stock_qty+")";
|
||||||
@ -75,13 +75,13 @@ frappe.ready(function() {
|
|||||||
newVal = 0;
|
newVal = 0;
|
||||||
|
|
||||||
if (btn.attr('data-dir') == 'up') {
|
if (btn.attr('data-dir') == 'up') {
|
||||||
newVal = parseInt(oldValue) + 1;
|
newVal = Number.parseInt(oldValue) + 1;
|
||||||
} else if (btn.attr('data-dir') == 'dwn') {
|
} else if (btn.attr('data-dir') == 'dwn') {
|
||||||
if (parseInt(oldValue) > 1) {
|
if (Number.parseInt(oldValue) > 1) {
|
||||||
newVal = parseInt(oldValue) - 1;
|
newVal = Number.parseInt(oldValue) - 1;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
newVal = parseInt(oldValue);
|
newVal = Number.parseInt(oldValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
input.val(newVal);
|
input.val(newVal);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user