Unterricht 10.07.
This commit is contained in:
Generated
+1
-1
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
@@ -5,18 +5,18 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Haushaltsplaner</title>
|
||||
<link rel="stylesheet" href="./style.css">
|
||||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11" defer></script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<main>
|
||||
<h1>Haushaltsbuch</h1>
|
||||
<div class="input-container">
|
||||
<form onsubmit="fuegeEintragHinzu()" class="input-container">
|
||||
<input type="text" id="beschreibung" placeholder="Beschreibung" required>
|
||||
<input type="number" id="betrag" placeholder="Betrag" required>
|
||||
<input type="date" id="datum" required>
|
||||
<input type="submit" value="Hinzufügen" id="hinzufuegenButton" onclick="fuegeEintragHinzu()">
|
||||
</div>
|
||||
<input type="submit" value="Hinzufügen" id="hinzufuegenButton">
|
||||
</form>
|
||||
|
||||
<h2>Einträge</h2>
|
||||
<ul id="eintragListe"></ul>
|
||||
|
||||
@@ -6,8 +6,7 @@ function ladeEintraege() {
|
||||
const eintraege = JSON.parse(localStorage.getItem('eintraege')) || [];
|
||||
eintragListe.innerHTML = '';
|
||||
|
||||
let gesamtEinnahmen = 0;
|
||||
let gesamtAusgaben = 0;
|
||||
let bilanz = 0;
|
||||
|
||||
eintraege.forEach((eintrag, index) => {
|
||||
const li = document.createElement('li');
|
||||
@@ -17,14 +16,9 @@ function ladeEintraege() {
|
||||
|
||||
eintragListe.appendChild(li);
|
||||
|
||||
if (eintrag.betrag >= 0) {
|
||||
gesamtEinnahmen += parseFloat(eintrag.betrag)
|
||||
} else {
|
||||
gesamtAusgaben += parseFloat(eintrag.betrag);
|
||||
}
|
||||
});
|
||||
bilanz += parseFloat(eintrag.betrag)
|
||||
|
||||
const bilanz = gesamtEinnahmen + gesamtAusgaben;
|
||||
});
|
||||
|
||||
document.getElementById('bilanz').textContent = `${bilanz.toFixed(2)}`;
|
||||
}
|
||||
@@ -66,14 +60,8 @@ function fuegeEintragHinzu() {
|
||||
const betrag = document.getElementById('betrag').value;
|
||||
const datum = document.getElementById('datum').value;
|
||||
|
||||
if (beschreibung && betrag && datum) {
|
||||
const eintraege = JSON.parse(localStorage.getItem('eintraege')) || [];
|
||||
|
||||
eintraege.push({'beschreibung': beschreibung, 'betrag': betrag, 'datum': datum});
|
||||
|
||||
console.log({beschreibung, betrag, datum});
|
||||
console.log({'beschreibung': beschreibung, 'betrag': betrag, 'datum': datum});
|
||||
|
||||
localStorage.setItem('eintraege', JSON.stringify(eintraege));
|
||||
|
||||
ladeEintraege();
|
||||
@@ -82,9 +70,6 @@ function fuegeEintragHinzu() {
|
||||
document.getElementById('betrag').value = '';
|
||||
document.getElementById('datum').value = '';
|
||||
|
||||
} else {
|
||||
Swal.fire("Bitte alle Felder ausfüllen")
|
||||
}
|
||||
}
|
||||
|
||||
ladeEintraege();
|
||||
@@ -11,11 +11,11 @@ main {
|
||||
padding: 1em;
|
||||
}
|
||||
|
||||
.input-container {
|
||||
.form-container {
|
||||
display: flex;
|
||||
gap: .7em;
|
||||
}
|
||||
|
||||
.input-container input {
|
||||
.form-container input {
|
||||
height: 2em;
|
||||
}
|
||||
@@ -161,9 +161,6 @@
|
||||
E-Mail: mail@mustermann.de<br>
|
||||
Website: www.mustermann.de
|
||||
</p>
|
||||
|
||||
|
||||
|
||||
<p>
|
||||
<strong>Bei redaktionellen Inhalten:</strong><br>
|
||||
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="de">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Aufgabenliste</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<link rel="icon" href="./media/img/icon.png">
|
||||
<link rel="stylesheet" href="./style.css">
|
||||
|
||||
<!-- Externe Stylesheets und Scripts für Design und Icons -->
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
|
||||
|
||||
<!-- SweetAlert2 -->
|
||||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11" defer></script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="container schatten-farbverlauf">
|
||||
<div class="aufgaben-app">
|
||||
<h2><img src="./media/img/icon.png" alt="Applogo"> Aufgabenliste</h2>
|
||||
<div class="input-container">
|
||||
<input type="text" id="input-box" placeholder="Neue Aufgabe eintragen...">
|
||||
<button class="swal2-toast" onclick="neueAufgabe()"><i class="material-icons">add</i></button>
|
||||
</div>
|
||||
<ul id="todo-list-container"></ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="./script.js" defer></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
Binary file not shown.
Binary file not shown.
|
After Width: | Height: | Size: 2.3 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 4.3 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 2.1 KiB |
@@ -0,0 +1,22 @@
|
||||
const inputBox = document.querySelector("#input-box");
|
||||
const todoListContainer = document.querySelector("#todo-list-container");
|
||||
function neueAufgabe(){
|
||||
inputBox.focus();
|
||||
|
||||
if (inputBox.value === '') {
|
||||
return;
|
||||
}
|
||||
|
||||
let newListItem = document.createElement('li');
|
||||
newListItem.textContent = inputBox.value;
|
||||
todoListContainer.appendChild(newListItem);
|
||||
saveData();
|
||||
inputBox.value = '';
|
||||
}
|
||||
|
||||
function saveData()
|
||||
{
|
||||
localStorage.setItem('data', todoListContainer.innerHTML);
|
||||
}
|
||||
|
||||
todoListContainer.innerHTML = localStorage.getItem('data') || '';
|
||||
@@ -0,0 +1,60 @@
|
||||
@font-face {
|
||||
font-family: 'Fira-Sans';
|
||||
src: url("./media/fonts/FiraSans-Regular.ttf") format("truetype");
|
||||
}
|
||||
|
||||
html {
|
||||
font-size: 20px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
* {
|
||||
font-family: 'Fira-Sans', sans-serif;
|
||||
}
|
||||
|
||||
.container {
|
||||
margin: auto;
|
||||
border-radius: 1em;
|
||||
corner-shape: squircle bevel;
|
||||
width: clamp(400px, 60vw, 800px);
|
||||
}
|
||||
|
||||
|
||||
.aufgaben-app {
|
||||
margin: 10px;
|
||||
padding: 10px;
|
||||
border-radius: 1em;
|
||||
corner-shape: squircle bevel;
|
||||
background-color: ivory;
|
||||
}
|
||||
|
||||
.aufgaben-app h2 {
|
||||
font-size: 2rem;
|
||||
}
|
||||
|
||||
.aufgaben-app h2 img {
|
||||
max-height: 1em;
|
||||
}
|
||||
|
||||
.input-container {
|
||||
display: flex;
|
||||
flex-wrap: nowrap;
|
||||
gap: 1em;
|
||||
}
|
||||
|
||||
.input-container #input-box {
|
||||
flex-grow: 1;
|
||||
}
|
||||
|
||||
.input-container button {
|
||||
cursor: pointer;
|
||||
background-color: lightskyblue;
|
||||
border-radius: 100%;
|
||||
corner-shape: squircle;
|
||||
}
|
||||
|
||||
|
||||
.schatten-farbverlauf {
|
||||
background: linear-gradient(45deg, red, orange, yellow, green, blue, violet, pink);
|
||||
padding: 3px;
|
||||
}
|
||||
Reference in New Issue
Block a user