I'm working on a Point of Sale and I am using accounting.js to format a number on the amount that is being tendered in the payment module.
Apparently I want the field to have a floating value so I have this virtual numpad that when clicked it will concatenate the value per button like so:
But when I click on the decimal button it doesn't work. Here is what I have tried so far, unsure what I'm missing.
// Payment Numpad
$('section.payment-numpad .number-char').click(function(){
let num = $(this).data('action');
let defaultAmt = $('td.col-tendered.edit').text().replace(/,/g, "");
let tendered;
if(defaultAmt === "0.00"){
tendered = num;
}else{
tendered = defaultAmt + num;
}
$('td.col-tendered.edit').text(accounting.formatNumber(parseFloat(tendered)));
return false;
});
I also tried the .toFixed(2)
in accounting.js but still doesn't work.
UPDATE: Here is a video for reference