fix for main page calculator
This commit is contained in:
parent
858d687d0e
commit
bcbecf68da
@ -35,7 +35,7 @@ function calculate(param, value)
|
||||
{
|
||||
for(let i in response) { calculation[i] = parseInt(response[i], 10); }
|
||||
|
||||
$("#calculator_car_price_text").text(calculation['car_price'].toLocaleString()+" ₽");
|
||||
$("#calculator_car_price_text").find('output').text(calculation['car_price'].toLocaleString());
|
||||
$("#calculator_monthly_payment_value").text(calculation['monthly_payment'].toLocaleString());
|
||||
$("#calculator_tax_savings_value").text((calculation['tax_savings'] + calculation['vat_reimbursement']).toLocaleString());
|
||||
$("#calculator_tax_savings_percent").text(Math.round((calculation['tax_savings']+calculation['vat_reimbursement']) / (calculation['car_price'] / 100)));
|
||||
@ -45,7 +45,6 @@ function calculate(param, value)
|
||||
function calculator_car_price_save()
|
||||
{
|
||||
var v = parseInt($("#calculator_car_price_input").val(), 10);
|
||||
console.log(v, calculation['CAR_PRICE_MIN'], calculation['CAR_PRICE_MAX']);
|
||||
if(v >= calculation['CAR_PRICE_MIN'] && v <= calculation['CAR_PRICE_MAX'])
|
||||
{
|
||||
var $input_range_car_price = $(`#calculation_car_price`);
|
||||
@ -68,21 +67,18 @@ $(function()
|
||||
var selector = '[data-rangeslider]';
|
||||
var $element = $(selector);
|
||||
|
||||
// For ie8 support
|
||||
var textContent = ('textContent' in document) ? 'textContent' : 'innerText';
|
||||
|
||||
// Example functionality to demonstrate a value feedback
|
||||
function valueOutput(element)
|
||||
{
|
||||
var value = element.value;
|
||||
var output = element.parentNode.getElementsByTagName('output')[0] || element.parentNode.parentNode.getElementsByTagName('output')[0];
|
||||
var output = $(element).parent().parent().find('output');
|
||||
|
||||
if($(element).data('slider-name') === "car_price")
|
||||
{
|
||||
output[textContent] = parseInt(value, 10).toLocaleString();
|
||||
output.text(parseInt(value, 10).toLocaleString());
|
||||
}
|
||||
else
|
||||
{
|
||||
output[textContent] = value;
|
||||
output.text(value);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user