var lastKilometer = 0;
var price;

document.addEventListener('DOMContentLoaded', function () { });

const TOTAL_PRICE = document.getElementById("taximeter-price");
const PRICE_KM = document.getElementById("taximeter-price-kilometer");
const KILOMETER = document.getElementById("taximeter-kilometer");

function updateKilometer(km) {
    lastKilometer = +lastKilometer + +km;
    UpdateTotalPrice();
    KILOMETER.innerHTML = (Math.round((lastKilometer + Number.EPSILON) * 1000) / 1000).toString();
}


function UpdateTotalPrice() {
    var TotalPrice = +lastKilometer * + price;
    TOTAL_PRICE.innerHTML = Math.floor(TotalPrice).toString();
    mp.trigger("CEF:updateLastPrice", Math.floor(TotalPrice), Math.round((lastKilometer + Number.EPSILON) * 1000) / 1000);
}

function updateFarePrice() {
    document.getElementById("taximeter-price-kilometer").innerHTML = price.toString();
    document.getElementById("taximeter-kilometer").innerHTML = "-";
    document.getElementById("taximeter-price").innerHTML = "0";
}

function setFarePrice(price1) {
    price = price1;
    updateFarePrice();
}




