|
|
@@ -0,0 +1,121 @@
|
|
|
+/* WENN SICH DIE SATZUNG ÄNDERT EINFACH DIESE KONSTANTEN ANPASSEN (ALLE WERTE IN EURO)*/
|
|
|
+const GRUNDBETRAG = 0.50;
|
|
|
+
|
|
|
+const BONUS_50_BIS_79 = 10.00;
|
|
|
+
|
|
|
+const BONUS_80_BIS_99 = 14.00;
|
|
|
+
|
|
|
+const BONUS_100_BIS_149 = 20.00;
|
|
|
+
|
|
|
+const BONUS_150_BIS_199 = 30.00;
|
|
|
+
|
|
|
+const BONUS_MEHR_ALS_200 = 40.00;
|
|
|
+
|
|
|
+const AB_100_DOPPELT = false;
|
|
|
+///////////////////////////////////////////////////////////////////////////////
|
|
|
+/* ALLES UNTER DIESER ZEILE NICHT ANFASSEN, AUSSER DU WEISST WAS DU TUST!!!! */
|
|
|
+///////////////////////////////////////////////////////////////////////////////
|
|
|
+///////////////////////////////////////////////////////////////////////////////
|
|
|
+///////////////////////////////////////////////////////////////////////////////
|
|
|
+///////////////////////////////////////////////////////////////////////////////
|
|
|
+///////////////////////////////////////////////////////////////////////////////
|
|
|
+///////////////////////////////////////////////////////////////////////////////
|
|
|
+///////////////////////////////////////////////////////////////////////////////
|
|
|
+///////////////////////////////////////////////////////////////////////////////
|
|
|
+///////////////////////////////////////////////////////////////////////////////
|
|
|
+///////////////////////////////////////////////////////////////////////////////
|
|
|
+///////////////////////////////////////////////////////////////////////////////
|
|
|
+///////////////////////////////////////////////////////////////////////////////
|
|
|
+///////////////////////////////////////////////////////////////////////////////
|
|
|
+///////////////////////////////////////////////////////////////////////////////
|
|
|
+///////////////////////////////////////////////////////////////////////////////
|
|
|
+///////////////////////////////////////////////////////////////////////////////
|
|
|
+///////////////////////////////////////////////////////////////////////////////
|
|
|
+///////////////////////////////////////////////////////////////////////////////
|
|
|
+///////////////////////////////////////////////////////////////////////////////
|
|
|
+///////////////////////////////////////////////////////////////////////////////
|
|
|
+///////////////////////////////////////////////////////////////////////////////
|
|
|
+///////////////////////////////////////////////////////////////////////////////
|
|
|
+///////////////////////////////////////////////////////////////////////////////
|
|
|
+///////////////////////////////////////////////////////////////////////////////
|
|
|
+///////////////////////////////////////////////////////////////////////////////
|
|
|
+///////////////////////////////////////////////////////////////////////////////
|
|
|
+///////////////////////////////////////////////////////////////////////////////
|
|
|
+///////////////////////////////////////////////////////////////////////////////
|
|
|
+///////////////////////////////////////////////////////////////////////////////
|
|
|
+///////////////////////////////////////////////////////////////////////////////
|
|
|
+///////////////////////////////////////////////////////////////////////////////
|
|
|
+/* WIRKLICH NICHTS ANFASSEN!!!*/
|
|
|
+///////////////////////////////////////////////////////////////////////////////
|
|
|
+///////////////////////////////////////////////////////////////////////////////
|
|
|
+///////////////////////////////////////////////////////////////////////////////
|
|
|
+///////////////////////////////////////////////////////////////////////////////
|
|
|
+///////////////////////////////////////////////////////////////////////////////
|
|
|
+///////////////////////////////////////////////////////////////////////////////
|
|
|
+///////////////////////////////////////////////////////////////////////////////
|
|
|
+///////////////////////////////////////////////////////////////////////////////
|
|
|
+///////////////////////////////////////////////////////////////////////////////
|
|
|
+///////////////////////////////////////////////////////////////////////////////
|
|
|
+///////////////////////////////////////////////////////////////////////////////
|
|
|
+///////////////////////////////////////////////////////////////////////////////
|
|
|
+///////////////////////////////////////////////////////////////////////////////
|
|
|
+///////////////////////////////////////////////////////////////////////////////
|
|
|
+///////////////////////////////////////////////////////////////////////////////
|
|
|
+///////////////////////////////////////////////////////////////////////////////
|
|
|
+///////////////////////////////////////////////////////////////////////////////
|
|
|
+///////////////////////////////////////////////////////////////////////////////
|
|
|
+///////////////////////////////////////////////////////////////////////////////
|
|
|
+///////////////////////////////////////////////////////////////////////////////
|
|
|
+///////////////////////////////////////////////////////////////////////////////
|
|
|
+///////////////////////////////////////////////////////////////////////////////
|
|
|
+///////////////////////////////////////////////////////////////////////////////
|
|
|
+///////////////////////////////////////////////////////////////////////////////
|
|
|
+///////////////////////////////////////////////////////////////////////////////
|
|
|
+///////////////////////////////////////////////////////////////////////////////
|
|
|
+///////////////////////////////////////////////////////////////////////////////
|
|
|
+///////////////////////////////////////////////////////////////////////////////
|
|
|
+///////////////////////////////////////////////////////////////////////////////
|
|
|
+///////////////////////////////////////////////////////////////////////////////
|
|
|
+///////////////////////////////////////////////////////////////////////////////
|
|
|
+const inputField = document.getElementById("punkte-input");
|
|
|
+const submitBtn = document.getElementById("submit-btn");
|
|
|
+const outputContainer = document.getElementById("rechner-output");
|
|
|
+
|
|
|
+const evaluateBonuses = (value) => {
|
|
|
+ if (value >= 200) {
|
|
|
+ return BONUS_MEHR_ALS_200;
|
|
|
+ } else if (value >= 150) {
|
|
|
+ return BONUS_150_BIS_199;
|
|
|
+ } else if (value >= 100) {
|
|
|
+ return BONUS_100_BIS_149;
|
|
|
+ } else if (value >= 80) {
|
|
|
+ return BONUS_80_BIS_99;
|
|
|
+ } else if (value >= 50) {
|
|
|
+ return BONUS_50_BIS_79;
|
|
|
+ } else if (value < 50) {
|
|
|
+ return 0.00;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+submitBtn.addEventListener("click", (e) => {
|
|
|
+ let input = inputField.valueAsNumber;
|
|
|
+ console.debug(input);
|
|
|
+ let bonus = evaluateBonuses(input);
|
|
|
+ console.debug(bonus);
|
|
|
+ let result = 0.00;
|
|
|
+ if (AB_100_DOPPELT && input >= 100) {
|
|
|
+ result = 100 * GRUNDBETRAG;
|
|
|
+ input = input - 100;
|
|
|
+ result = result + (input * GRUNDBETRAG * 2);
|
|
|
+ } else {
|
|
|
+ result = input * GRUNDBETRAG;
|
|
|
+ }
|
|
|
+ result = result + bonus;
|
|
|
+ console.debug(result);
|
|
|
+ if (result.toString().includes(".")) {
|
|
|
+ result = result.toString().concat("0");
|
|
|
+ } else if (!result.toString().includes("NaN")) {
|
|
|
+ result = result.toString().concat(".00");
|
|
|
+ }
|
|
|
+ outputContainer.innerHTML = result;
|
|
|
+})
|