Add Taximeter

This commit is contained in:
Siga
2020-03-01 17:39:54 +01:00
parent edf06f4478
commit fb527f8c57
21 changed files with 404 additions and 56 deletions

View File

@@ -0,0 +1,64 @@
@font-face {
font-family: DS-Digital;
src: url(../../font/taximeter/DS-Digital.woff2) format("woff2"),url(../../font/taximeter/DS-Digital.woff) format("woff");
font-weight: 400;
font-style: normal
}
body {
width: 640px
}
h4 {
margin: 0
}
.taximeter-company {
background-color: #171717;
max-width: 100%
}
.taximeter-company__header {
text-align: center;
padding: 0;
margin: 0;
font-size: 170%;
font-family: DS-Digital;
color: #ff0
}
.taximeter {
max-width: 100%;
height: 80px;
padding: 1em;
display: flex;
justify-content: space-between;
background-color: #171717
}
.taximeter-element {
margin: 3px;
width: 200px;
height: 50px
}
.taximeter-header {
font-size: 170%;
color: red;
font-family: DS-Digital
}
.taximeter-output {
height: 40px;
max-width: 100%;
margin: 0;
font-family: DS-Digital;
font-size: 250%;
color: red;
display: block
}
.taximeter-output__additional {
font-size: 70%
}
/*# sourceMappingURL=main.css.map */

View File

@@ -0,0 +1,38 @@
<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Taximeter</title>
<link rel="stylesheet" href="../../css/taximeter/main.css">
</head>
<body>
<div class="taximeter-company">
<p class="taximeter-company__header">Downtown Cab Co.</p>
</div>
<div class="taximeter">
<div class="taximeter-element">
<h4 class="taximeter-header">Kilometer</h4>
<p class="taximeter-output">
<span id="taximeter-kilometer"></span>
<span class="taximeter-output__additional">KM</span>
</p>
</div>
<div class="taximeter-element">
<h4 class="taximeter-header">Preis / KM</h4>
<p class="taximeter-output">
<span id="taximeter-price-kilometer"></span>
<span class="taximeter-output__additional">$</span>
</p>
</div>
<div class="taximeter-element">
<h4 class="taximeter-header">Preis</h4>
<p class="taximeter-output">
<span id="taximeter-price"></span>
<span class="taximeter-output__additional">$</span>
</p>
</div>
</div>
</body>
<script src="../../js/taximeter/main.js"></script>
</html>

View File

@@ -0,0 +1,36 @@
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) {
UpdateTotalPrice();
KILOMETER.innerHTML = (Math.round((lastKilometer + Number.EPSILON) * 1000) / 1000).toString();
}
function UpdateTotalPrice() {
var TotalPrice = +lastKilometer * + price;
console.log(+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();
}