
let close = document.getElementById('close');

$(document).ready(function () {
    mp.trigger("CEF:VehicleLook_Loaded");
});

function setDrivers(driversJson) {
    var drivers = JSON.parse(driversJson);
    var listTag = $("#drivers-list");
    drivers.forEach(driver => {
        var name = driver.Name;
        var dateTime = new Date(driver.Time);

        var date = `${dateTime.getDay()}.${dateTime.getMonth()}.${dateTime.getFullYear()}`;
        var time = `${dateTime.getHours()}:${dateTime.getMinutes()}:${dateTime.getSeconds()}`;

        var infoLine = `${name} am ${date} um ${time} Uhr`;
        var listItemTag = `<li>${infoLine}</li>`;
        listTag.append(listItemTag);
    });
}

close.onclick = function closeWindow() {
    mp.trigger('removeLookMenu');
}