Endabgabe Second Commit

This commit is contained in:
Ben 2020-07-24 15:19:43 +02:00
parent b506e972d9
commit 8c3240d434
100 changed files with 2038 additions and 1067 deletions

4
.gitignore vendored
View File

@ -3,4 +3,6 @@ package-lock.json
mongodb/
data/
Aufgaben/Aufgabe_10_2020-07-01
Aufgaben/Aufgabe_10_2020-07-01
Endabgabe/#archiv

View File

@ -20,8 +20,7 @@
<form id="myForm" method="" action="">
<!--https://theoneandgis.herokuapp.com-->
<label for="vorname" method="get">
Vorname
<label for="vorname" method="get">Vorname
</label><br>
<input type="text" id="vorname" name="vorname" value="Vorname" onfocus="this.value=''"><br>

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

View File

@ -0,0 +1,9 @@
02.07.2020 | 21:31 | https://pixabay.com/de/illustrations/ice-cream-dessert-sweet-süßwaren-3490976/
02.07.2020 | 21:32 | https://pixabay.com/de/photos/sonnenaufgang-boot-ruderboot-1014712/
02.07.2020 | 21:35 | https://pixabay.com/de/photos/softeis-softeistüte-eis-schokoeis-50845/
02.07.2020 | 21:40 | https://pixabay.com/de/photos/trinken-glas-gießen-bar-pub-eis-1870139/
02.07.2020 | 21:52 | https://freiburg.stadtbesten.de/wp-content/uploads/sites/4/2017/06/ice-cream-cone-1274894_1920.jpg
17.07.2020 | 21:51 | https://5.imimg.com/data5/GG/MY/MY-52641035/paper-bowl-with-paper-lid-500x500.jpg
17.07.2020 | 23:55 | https://pixabay.com/de/photos/bunte-streusel-s%C3%BC%C3%9Fwaren-lose-50723/
18.07.2020 | 00:13 | https://pixabay.com/get/53e0dd40424fad00f5d8997cc2293f7d1139d9f85254784c752d78d3904d_1920.jpg
18.07.2020 | 00:29 | https://pixabay.com/get/52e7d4464c53ab14f6d1867dda29327f1d3cdae3544c704c7c2a7bd69344cd51_1920.jpg

Binary file not shown.

View File

@ -9,4 +9,12 @@
4) Die Datenstruktur der Datenbanken wird schriftlich durchdacht
4.2) Ich habe zwar heute nix geschafft, aber ich habe innerlich geweint, weil ich mit der Datenbank net klar komme :D
5) Die Datenbanken sind inzwischen fast einsatzfähig. Ich versuche zunächst die Shopseite zu zeichnen und schaue dann, was draus wird. Viel mitschreiben tu ich heute eher nicht.
5) Die Datenbanken sind inzwischen fast einsatzfähig. Ich versuche zunächst die Shopseite zu zeichnen und schaue dann, was draus wird. Viel mitschreiben tu ich heute eher nicht.
6) Es sollte ziemlich klar sein, dass dieses Dokument nur mäßig mitgeschrieben wird. Ich habe im Backend die Datenbank zum Laufen bekommen, musste jedoch den Eintrag der Bestellung runterkürzen. Diesen Eintrag versuche ich nach und nach durch weitere Angaben zu ergänzen.
7) Jede Nummer hier steht für einen neuen Tag. Ich habe festgestellt, dass das Sortieren der Objekte für große Probleme sorgt.
7.1) Ich habe die Hauptseiten fertig. Es fehlen noch die laufende Darstellung und die Administrator-Seite. Mein Code ist trotzdem gefühlt Müll...
8) Zugegeben, ich hab jetzt 1-2 Tage ausgelassen. Inzwischen nimmt alles seine Funktionalität an und ich verstehe das JSON-Format auch immer besser. Ich wollte einfach noch einen Eintrag hier machen, bevor ich am Ende ankomme ^^
8.1) Ich habe zu viel Zeit an den Image-Containern im Meme-Bereich verschwendet und es sieht nicht mal gut aus....

View File

@ -1,82 +0,0 @@
[
{
"category-name": "Eis-Sorten",
"id": "eisSorten",
"products": [
{
"product-name": "Blaubeere",
"price": 0.80,
"imgName": "filler.jpg",
},
{
"product-name": "Waldmeister",
"price": 0.80,
"imgName": "filler.jpg",
}
]
},
{
"category-name": "Eis-Typ",
"id": "eisTyp",
"products": [
{
"product-name": "Waffel",
"price": 0.20,
"imgName": "filler.jpg",
},
{
"product-name": "Becher",
"price": 0.20,
"imgName": "filler.jpg",
},
{
"product-name": "Eigenbedarf",
"price": 0.00,
"imgName": "filler.jpg",
"annotation": "Mit eigenen Bechern, Waffeln usw. müssen Sie nichts weiter dafür zahlen",
}
]
},
{
"title": "Toppings",
"id": "toppings",
"products": [
{
"product-name": "Bunte Streusel",
"price": 0.25,
"imgName": "filler.jpg",
},
{
"product-name": "Schoko Streusel",
"price": 0.25,
"imgName": "filler.jpg",
},
{
"product-name": "Mini Marshmellows",
"price": 0.25,
"imgName": "filler.jpg",
}
]
},
{
"title": "Extras",
"id": "extras",
"products": [
{
"product-name": "Servietten",
"price": 0.00,
"imgName": "filler.jpg",
},
{
"product-name": "Extra Waffel",
"price": 0.10,
"imgName": "filler.jpg",
},
{
"product-name": "Eiswürfel (2 Stück)",
"price": 0.00,
"imgName": "filler.jpg",
}
]
}
]

View File

@ -1,153 +0,0 @@
[
{
"title": "Special Offers!",
"id": "special",
"products": [
{
"title": "Color: Rainbow",
"price": 3279.99,
"size": "4m²",
"imgName": "grass-rainbow-square.png",
"description": "If you can't choose one color, go and catch them all!"
},
{
"title": "Color: White",
"price": 3279.99,
"size": "4m²",
"imgName": "grass-white.png",
"description": "The appearance of many sparkling stars on your garden floor."
},
{
"title": "Color: Black",
"price": 3279.99,
"size": "4m²",
"imgName": "grass-black.png",
"description": "Dark as the night. Be careful not to form a black hole!"
},
{
"title": "Pattern: Murica",
"price": 3279.99,
"size": "4m²",
"imgName": "grass-green-murica.png",
"description": "Texas, Trump, Guns & Hamburgers"
},
{
"title": "Pattern: Schachbrett",
"price": 3279.99,
"size": "4m²",
"imgName": "grass-green-chess-square.png",
"description": "Show your intellect on your own lawn and embarrass your opponents!"
}
]
},
{
"title": "Bunte Gräser",
"id": "bunt",
"products": [
{
"title": "Color: Green",
"price": 2339.99,
"size": "4m²",
"imgName": "grass-green.png",
"description": "The standard model in our range. Ensures a natural look and pleasant freshness in your living room!"
},
{
"title": "Color: Desert",
"price": 2339.99,
"size": "4m²",
"imgName": "grass-yellow.png",
"description": "Summer, sun and oh my god, I'm hot! Are they pyramids in my garden ?!"
},
{
"title": "Color: Beach",
"price": 2339.99,
"size": "4m²",
"imgName": "grass-orange.png",
"description": "Summer, sun and hot feelings!"
},
{
"title": "Pattern: Hell",
"price": 2339.99,
"size": "4m²",
"imgName": "grass-red.png",
"description": "Look into the abyss that could await you after your death and invite guests to it!"
},
{
"title": "Pattern: Unicorn",
"price": 2339.99,
"size": "4m²",
"imgName": "grass-pink.png",
"description": "PINK FLUFFY UNICORN, DANCING ON RAINBOWS (which you can also buy in here) !!!"
},
{
"title": "Pattern: Grape",
"price": 2339.99,
"size": "4m²",
"imgName": "grass-purple.png",
"description": "It looks purple. Do you have to say more?"
},
{
"title": "Pattern: Atlantic",
"price": 2339.99,
"size": "4m²",
"imgName": "grass-blue.png",
"description": "Blue like the ocean. A deep look and mysterious nature."
}
]
},
{
"title": "Green-Tones",
"id": "grün",
"products": [
{
"title": "Green: 3B",
"price": 3499.99,
"size": "10m²",
"imgName": "grass-green-dark-3.png",
"description": "Green in every way. Nothing more to know about it."
},
{
"title": "Green: 2B",
"price": 3499.99,
"size": "10m²",
"imgName": "grass-green-dark-2.png",
"description": "Green in every way. Nothing more to know about it."
},
{
"title": "Green: B",
"price": 3499.99,
"size": "10m²",
"imgName": "grass-green-dark-1.png",
"description": "Green in every way. Nothing more to know about it."
},
{
"title": "Green: HB",
"price": 2339.99,
"size": "10m²",
"imgName": "grass-green.png",
"description": "The standard model in our range. Ensures a natural look and pleasant freshness in your living room!"
},
{
"title": "Green: H",
"price": 3499.99,
"size": "10m²",
"imgName": "grass-green-light-1.png",
"description": "Green in every way. Nothing more to know about it."
},
{
"title": "Green: 2H",
"price": 3499.99,
"size": "10m²",
"imgName": "grass-green-light-2.png",
"description": "Green in every way. Nothing more to know about it."
},
{
"title": "Green: 3H",
"price": 3499.99,
"size": "10m²",
"imgName": "grass-green-light-3.png",
"description": "Green in every way. Nothing more to know about it."
}
]
}
]

View File

@ -1 +0,0 @@
{"version":3,"file":"useMongo.js","sourceRoot":"","sources":["useMongo.ts"],"names":[],"mappings":";;;AAAA,iCAAiC;AAEjC,IAAiB,WAAW,CAkG3B;AAlGD,WAAiB,WAAW;IAMxB,IAAI,kBAAoC,CAAC;IACzC,IAAI,gBAAkC,CAAC;IACvC,IAAI,iBAAmC,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CAAC;AAEL,CAAC,EA9FgB,UAAU,GAAV,kBAAU,KAAV,kBAAU,QA8F1B"}

View File

@ -0,0 +1,113 @@
@media screen and (min-width: 0px) {
body {
background-image: url(../html-shop/images/background.png);
}
#tableDiv {
display: flex;
flex-direction: column;
align-items: center;
width: 100%;
font-size: 20px;
}
#tableDiv button {
background-color: transparent;
border: solid black 2px;
font-weight: bold;
}
table {
margin: 10px 0px;
width: 90%;
text-align: left;
border: solid black 2px;
padding: 0px 5%;
background-color: rgb(0, 102, 255);
color: white;
}
th, td {
width: 40%;
}
.removeButton {
margin: 10px 0px;
width: 90%;
}
.buttonDiv {
margin: 10px 0px;
width: 90%;
display: flex;
flex-direction: row;
justify-content: space-evenly;
}
.buttonDiv button {
width: 45%;
}
div#formDiv {
width: 90%;
padding: 10px 5%;
border: solid black 2px;
}
form#myForm {
display: flex;
flex-direction: column;
justify-content: center;
padding: 0px 5px;
}
form#myForm input, form#myForm label, form#myForm button {
margin: 2px 5%;
}
form#myForm button {
min-height: 30px;
}
}
@media screen and (min-width: 601px) {
.removeButton {
width: 70%;
height: 40px;
}
table {
width: 70%;
}
.buttonDiv {
margin: 10px 0px;
width: 70%;
}
.buttonDiv button {
height: 40px;
width: 45%;
}
}
@media screen and (min-width: 1025px) {
.removeButton {
width: 40%;
}
table {
width: 40%;
}
.buttonDiv {
width: 40%;
}
.buttonDiv button {
width: 45%;
}
#tableDiv .removeOne:hover, #tableDiv .removeButton:hover {
background-color: red;
}
#tableDiv .editOne:hover {
background-color: yellow;
}
div#formDiv {
width: 60%;
}
form#myForm button:hover {
background-color: green;
}
}

View File

@ -0,0 +1,45 @@
<!DOCTYPE html>
<html lang="de">
<head>
<title>Administrator</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="../index.css">
<link rel="stylesheet" href="admin.css">
<script src='https://kit.fontawesome.com/a076d05399.js' crossorigin="anonymous" SameSite="Secure"></script>
<script src="../script-frontend/admin.js" defer></script>
</head>
<body>
<header>
<div class="top-nav">
<div id="logo">
<a href="../index.html"><img src="../html-landing-page/images/nice-ice-logo.png" alt=""></a>
</div>
<div id="warenkorb">
<a href="../html-warenkorb/warenkorb.html"><i class='fas fa-shopping-cart'></i>&nbsp;<span>0</span></a>
</div>
</div>
</header>
<nav>
<div class="bottom-nav">
<ul>
<a href="admin.html"><li>Administrator</li></a>
<a href="../html-memes/memes.html"><li>Über uns</li></a>
</ul>
</div>
</nav>
<main>
<div id="tableDiv">
</div>
</main>
<footer>
<div>
<span>( - Disclaimer - )</span>
<span>Ich verdiene mit dieser Website kein Geld</span>
</div>
</footer>
</body>
</html>

View File

@ -1,5 +0,0 @@
02.07.2020 | 21:31 | https://pixabay.com/de/illustrations/ice-cream-dessert-sweet-süßwaren-3490976/
02.07.2020 | 21:32 | https://pixabay.com/de/photos/sonnenaufgang-boot-ruderboot-1014712/
02.07.2020 | 21:35 | https://pixabay.com/de/photos/softeis-softeistüte-eis-schokoeis-50845/
02.07.2020 | 21:40 | https://pixabay.com/de/photos/trinken-glas-gießen-bar-pub-eis-1870139/
02.07.2020 | 21:52 | https://freiburg.stadtbesten.de/wp-content/uploads/sites/4/2017/06/ice-cream-cone-1274894_1920.jpg

Binary file not shown.

Before

Width:  |  Height:  |  Size: 152 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 84 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 577 KiB

View File

@ -1,90 +0,0 @@
body {
font-size: 20px;
margin: 0px;
height: 100vh;
width: 100vw;
background-image: url(images/sunrise-1014712_1920.jpg);
background-position: 50% 10%;
background-repeat: no-repeat;
background-size: cover;
}
.top-nav {
color: white;
background-color: black;
display: grid;
grid-template-columns: 70% 25%;
grid-column-gap: 5%;
text-align: center;
height: 10vh;
}
.top-nav a {
text-decoration: none;
color: white;
}
.top-nav #warenkorb {
font-size: 30px;
position: relative;
right: 10px;
}
.top-nav #logo, #warenkorb {
display: flex;
flex-direction: row;
align-items: center;
align-content: center;
justify-content: center;
}
.top-nav img {
height: 60px;
width: 220px;
}
.bottom-nav {
background-color: hsla(0, 0%, 0%, 0%);
text-align: center;
}
.bottom-nav ul {
list-style: none;
margin: 0px;
padding: 5px;
}
.bottom-nav ul li {
background-color: rgb(0, 102, 255);
margin: 10px 0px;
border: solid rgb(0, 25, 136) 2px;
border-radius: 10px;
}
.bottom-nav ul a {
text-decoration: none;
color: white;
}
.bestellbox {
font-size: 30px;
position: relative;
top: 200px;
background-color: rgba(58, 58, 58, 0.8);
color: white;
display: flex;
flex-direction: column;
justify-content: space-evenly;
align-items: center;
margin: 0px 10px;
border-radius: 10px;
}
.bestellbox span {
margin: 5px 0px;
}
.bestellbox a {
text-decoration: none;
color: white;
}
.bestellbox #box-togo, #box-tostay {
background-color: rgba(128, 128, 128, 0.8);
box-shadow: 3px 3px 3px white;
text-align: center;
width: 95%;
margin: 10px 0px;
border-radius: 10px;
}

View File

@ -1,45 +0,0 @@
body {
font-size: 40px;
}
.top-nav #warenkorb a:hover {
color:rgb(0, 102, 255);
}
.bottom-nav {
background-color: rgb(0, 102, 255);
}
.bottom-nav ul {
font-size: 30px;
list-style: none;
display: flex;
flex-direction: row;
justify-content: space-evenly;
margin: 0px;
padding: 0px;
}
.bottom-nav ul li {
border: none;
}
.bottom-nav ul a {
text-decoration: none;
color: white;
}
.bottom-nav ul a:hover {
color: black;
}
.top-nav {
height: 15vh;
}
.top-nav img {
height: 120px;
width: 460px;
}
.bestellbox {
top: 150px;
}
.bestellbox #box-togo:hover, #box-tostay:hover {
background-color: rgb(0, 102, 255);
}

View File

Before

Width:  |  Height:  |  Size: 42 KiB

After

Width:  |  Height:  |  Size: 42 KiB

View File

Before

Width:  |  Height:  |  Size: 198 KiB

After

Width:  |  Height:  |  Size: 198 KiB

View File

@ -0,0 +1,35 @@
body {
background-image: url(images/sunrise-1014712_1920.jpg);
background-position-x: 50%;
background-repeat: no-repeat;
background-size: auto 100vh;
}
.bestellbox {
font-size: 30px;
position: relative;
top: 200px;
background-color: rgba(58, 58, 58, 0.8);
color: white;
display: flex;
flex-direction: column;
justify-content: space-evenly;
align-items: center;
margin: 0px 10px;
border-radius: 10px;
}
.bestellbox span {
margin: 5px 0px;
}
.bestellbox a {
text-decoration: none;
color: white;
}
.bestellbox #box-togo, #box-tostay {
background-color: rgba(128, 128, 128, 0.8);
box-shadow: 3px 3px 3px white;
text-align: center;
width: 95%;
margin: 10px 0px;
border-radius: 10px;
}

View File

@ -2,14 +2,6 @@ body {
font-size: 40px;
}
.top-nav #warenkorb {
font-size: 70px;
}
.top-nav img {
height: 100px;
width: 380px;
}
.bestellbox {
font-size: 50px;
margin: 0px 20px;

View File

@ -0,0 +1,11 @@
body {
font-size: 40px;
background-size: 100vw 100vh;
}
.bestellbox {
top: 150px;
}
.bestellbox #box-togo:hover, #box-tostay:hover {
background-color: rgb(0, 102, 255);
}

View File

Before

Width:  |  Height:  |  Size: 556 KiB

After

Width:  |  Height:  |  Size: 556 KiB

View File

Before

Width:  |  Height:  |  Size: 463 KiB

After

Width:  |  Height:  |  Size: 463 KiB

View File

Before

Width:  |  Height:  |  Size: 53 KiB

After

Width:  |  Height:  |  Size: 53 KiB

View File

Before

Width:  |  Height:  |  Size: 351 KiB

After

Width:  |  Height:  |  Size: 351 KiB

View File

@ -0,0 +1,61 @@
@media screen and (min-width: 0px) {
.top-nav {
color: white;
background-color: black;
display: flex;
flex-direction: column;
align-content: center;
justify-content: space-around;
text-align: center;
height: 10vh;
padding: 5px 0px;
}
.top-nav a {
font-size: 0px;
}
#imageBox {
display: flex;
flex-direction: column;
align-items: center;
justify-content: space-around;
width: 100%;
margin-top: 10px;
}
#imageBox div {
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-around;
margin-top: 10px;
width: 100%;
}
#imageBox img {
width: 100%;
border: solid black 3px;
border-radius: 20px;
}
#buttonRight, #buttonLeft {
height: 5vh;
width: 100%;
text-align: center;
background-color: rgba(0,0,0,75%);
font-weight: bold;
font-size: 1em;
color: white;
border: solid black 3px;
border-radius: 50px;
}
}
@media screen and (min-width: 601px) {
}
@media screen and (min-width: 1025px) {
#imageBox div {
width: 50%;
}
#imageBox img {
width: 50%;
max-height: 650px;
}
}

View File

@ -0,0 +1,44 @@
<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" media="screen and (min-width: 0px)" href="../html-landing-page/landing-page-01-phone.css">
<link rel="stylesheet" media="screen and (min-width: 601px)" href="../html-landing-page/landing-page-02-tablet.css">
<link rel="stylesheet" media="screen and (min-width: 1025px)" href="../html-landing-page/landing-page-03-desktop.css">
<link rel="stylesheet" href="../index.css">
<link rel="stylesheet" href="memes.css">
<script src='https://kit.fontawesome.com/a076d05399.js' crossorigin="anonymous" SameSite="Secure"></script>
<script src='../script-frontend/memes.js' defer></script>
<title>MEMS!</title>
</head>
<body>
<header>
<div class="top-nav">
<div id="logo">
<a href="../index.html"><img src="../html-landing-page/images/nice-ice-logo.png" alt=""></a>
</div>
</div>
</header>
<nav>
<div class="bottom-nav">
<ul>
<a href="../html-admin/admin.html"><li>Administrator</li></a>
<a href="memes.html"><li>Über uns</li></a>
</ul>
</div>
</nav>
<main>
<div id="imageBox">
<img src="images/GiSBeLike.png" alt="Some weird Memes" />
<div>
<button id="buttonLeft"><</button>
<button id="buttonRight">></button>
</div>
</div>
</main>
</body>
</html>

View File

@ -1,141 +0,0 @@
"use strict";
//mongodb + srv://AdminForUse:XV8MXEdBYuwXtQnc@ichstudieremitgis-jfrz9.mongodb.net/IchStudiereMitGiS?retryWrites=true&w=majority
//http://localhost:8100
//https://theoneandgis.herokuapp.com
var shop;
(function (shop) {
let obj = { "_id": 1, "category": "test" };
console.log(obj);
let serverUrl = "http://localhost:8100";
let storageArray = [];
let combinationCount = 0;
init();
async function init() {
printPage();
await getProductList();
addShopping();
}
function printPage() {
for (let i = 1; i <= 20; i++) {
let button = document.createElement("button");
button.setAttribute("id", "id_table_" + `${i}`);
//button.setAttribute("countNumber", "id_table_" + `${i}`);
button.innerHTML = `${i}`;
document.querySelector("#orderContainer").append(button);
}
}
async function getProductList() {
let url = serverUrl + "/mongo/products/findCollection" + "?";
let response = await fetch(url);
let jsonResponse = await response.json();
printProducts(jsonResponse);
printShopButton();
//let jsonString: string = JSON.stringify(jsonResponse); //formatCollection(jsonResponse);
//(<HTMLDivElement>document.querySelector("#test")).innerHTML = jsonString;
}
function printProducts(_jsonResponse) {
let categoryString = [];
for (const iterator of _jsonResponse) {
if (!categoryString.find(element => element == iterator.category)) {
categoryString.push(iterator.category);
let div = document.createElement("div");
div.setAttribute("id", "id_" + `${iterator.category}`);
document.querySelector("#productContainer").append(div);
let heading = document.createElement("h1");
heading.innerHTML = `${iterator.category}`;
document.querySelector(`#id_${iterator.category}`).append(heading);
}
}
for (const iterator of _jsonResponse) {
let div = document.createElement("div");
delete iterator._id;
div.innerHTML = `
<div class="${iterator.category}">
<div class="product_name">${iterator.name}</div>
<img src="images/filler.png" alt="Product" />
<button class="product_button" content=${JSON.stringify(iterator)}>in den Einkaufswagen</button>
</div>
`; //${ innerIterator.imageName }
document.querySelector(`#id_${iterator.category}`).append(div);
}
}
function printShopButton() {
let next = document.createElement("button");
let send = document.createElement("button");
next.setAttribute("id", "nextButton");
send.setAttribute("id", "sendButton");
next.innerHTML = "Nächstes Eis";
send.innerHTML = "Bestellung speichern";
document.querySelector("#buttonContainer").append(next);
document.querySelector("#buttonContainer").append(send);
document.querySelector("#nextButton").addEventListener("click", fixCount);
document.querySelector("#sendButton").addEventListener("click", addToLocal);
}
// Button Interaction
function addShopping() {
let buttonList = document.querySelectorAll(".product_button");
for (const iterator of buttonList)
iterator.addEventListener("click", sendProduct);
}
function sendProduct(_event) {
let target = _event.target;
let obj = JSON.parse(target.getAttribute("content"));
console.log(obj);
//console.log(target.getAttribute("content"));
addProduct(obj);
}
shop.sendProduct = sendProduct;
function addProduct(_targetString) {
//debugger;
switch (_targetString.category) {
case "container": {
if (checkMaximum(1, _targetString)) {
let index = storageArray.indexOf(storageArray.find(element => element = _targetString.category));
storageArray[index] = JSON.stringify(_targetString);
console.log(storageArray, storageArray.toLocaleString());
break;
}
else {
storageArray.push(JSON.stringify(_targetString));
break;
}
}
case "flavour": {
storageArray.push(JSON.stringify(_targetString));
console.log("_storageArray.push", JSON.stringify(_targetString));
break;
}
case "topping": {
storageArray.push(JSON.stringify(_targetString));
console.log("_storageArray.push", JSON.stringify(_targetString));
break;
}
}
/*for (const iterator of storageArray)
console.log(iterator);
storageArray.push(JSON.stringify(_targetString));
console.log(storageArray.toLocaleString());*/
}
function checkMaximum(_maximum, _targetString) {
let countOccurence = 0;
for (let i = 0; i < storageArray.length; i++) {
let checkString = storageArray[i];
if (checkString.includes(_targetString.category))
countOccurence++;
if (countOccurence == _maximum) {
alert("You've already reached the maximum of " + _maximum);
return true;
}
}
return false;
}
function fixCount() {
addToLocal();
storageArray = [];
combinationCount++;
}
function addToLocal() {
localStorage.setItem(`Combination${combinationCount}`, "[" + storageArray.toLocaleString() + "]");
}
})(shop || (shop = {}));
//# sourceMappingURL=createShop.js.map

View File

@ -1 +0,0 @@
{"version":3,"file":"createShop.js","sourceRoot":"","sources":["createShop.ts"],"names":[],"mappings":";AAAA,gIAAgI;AAChI,uBAAuB;AAEvB,oCAAoC;AACpC,IAAU,IAAI,CAoKb;AApKD,WAAU,IAAI;IAaV,IAAI,GAAG,GAAiB,EAAC,KAAK,EAAE,CAAC,EAAE,UAAU,EAAE,MAAM,EAAC,CAAC;IACvD,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAEjB,IAAI,SAAS,GAAW,uBAAuB,CAAC;IAEhD,IAAI,YAAY,GAAa,EAAE,CAAC;IAChC,IAAI,gBAAgB,GAAW,CAAC,CAAC;IAEjC,IAAI,EAAE,CAAC;IAEP,KAAK,UAAU,IAAI;QACf,SAAS,EAAE,CAAC;QACZ,MAAM,cAAc,EAAE,CAAC;QACvB,WAAW,EAAE,CAAC;IACl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;QACf,YAAY,CAAC,OAAO,CAAC,cAAc,gBAAgB,EAAE,EAAE,GAAG,GAAG,YAAY,CAAC,cAAc,EAAE,GAAG,GAAG,CAAC,CAAC;IACtG,CAAC;AAEL,CAAC,EApKS,IAAI,KAAJ,IAAI,QAoKb"}

View File

@ -1,170 +0,0 @@
//mongodb + srv://AdminForUse:XV8MXEdBYuwXtQnc@ichstudieremitgis-jfrz9.mongodb.net/IchStudiereMitGiS?retryWrites=true&w=majority
//http://localhost:8100
//https://theoneandgis.herokuapp.com
namespace shop {
interface Products {
_id: any;
category: string;
name: string;
price: number;
imageName: string;
}
interface LocalProduct {
[type: string]: string | number; //| string[] | undefined;
}
let obj: LocalProduct = {"_id": 1, "category": "test"};
console.log(obj);
let serverUrl: string = "http://localhost:8100";
let storageArray: string[] = [];
let combinationCount: number = 0;
init();
async function init(): Promise<void> {
printPage();
await getProductList();
addShopping();
}
function printPage(): void {
for (let i: number = 1; i <= 20; i++) {
let button: HTMLButtonElement = document.createElement("button");
button.setAttribute("id", "id_table_" + `${i}`);
//button.setAttribute("countNumber", "id_table_" + `${i}`);
button.innerHTML = `${i}`;
(<HTMLDivElement>document.querySelector("#orderContainer")).append(button);
}
}
async function getProductList(): Promise<void> {
let url: string = serverUrl + "/mongo/products/findCollection" + "?";
let response: Response = await fetch(url);
let jsonResponse: Products[] = await response.json();
printProducts(jsonResponse);
printShopButton();
//let jsonString: string = JSON.stringify(jsonResponse); //formatCollection(jsonResponse);
//(<HTMLDivElement>document.querySelector("#test")).innerHTML = jsonString;
}
function printProducts(_jsonResponse: Products[]): void {
let categoryString: string[] = [];
for (const iterator of _jsonResponse) {
if (!categoryString.find(element => element == iterator.category)) {
categoryString.push(iterator.category);
let div: HTMLHeadingElement = document.createElement("div");
div.setAttribute("id", "id_" + `${iterator.category}`);
(<HTMLDivElement>document.querySelector("#productContainer")).append(div);
let heading: HTMLHeadingElement = document.createElement("h1");
heading.innerHTML = `${iterator.category}`;
(<HTMLHeadingElement>document.querySelector(`#id_${iterator.category}`)).append(heading);
}
}
for (const iterator of _jsonResponse) {
let div: HTMLDivElement = document.createElement("div");
delete iterator._id;
div.innerHTML = `
<div class="${iterator.category}">
<div class="product_name">${iterator.name}</div>
<img src="images/filler.png" alt="Product" />
<button class="product_button" content=${JSON.stringify(iterator)}>in den Einkaufswagen</button>
</div>
`; //${ innerIterator.imageName }
(<HTMLElement>document.querySelector(`#id_${iterator.category}`)).append(div);
}
}
function printShopButton(): void {
let next: HTMLButtonElement = document.createElement("button");
let send: HTMLButtonElement = document.createElement("button");
next.setAttribute("id", "nextButton");
send.setAttribute("id", "sendButton");
next.innerHTML = "Nächstes Eis";
send.innerHTML = "Bestellung speichern";
(<HTMLDivElement>document.querySelector("#buttonContainer")).append(next);
(<HTMLDivElement>document.querySelector("#buttonContainer")).append(send);
(<HTMLElement>document.querySelector("#nextButton")).addEventListener("click", fixCount);
(<HTMLElement>document.querySelector("#sendButton")).addEventListener("click", addToLocal);
}
// Button Interaction
function addShopping(): void {
let buttonList: NodeListOf<HTMLButtonElement> = document.querySelectorAll(".product_button");
for (const iterator of buttonList)
iterator.addEventListener("click", sendProduct);
}
export function sendProduct(_event: Event): void {
let target: HTMLElement = (<HTMLElement>_event.target);
let obj: LocalProduct = JSON.parse(target.getAttribute("content")!);
console.log(obj);
//console.log(target.getAttribute("content"));
addProduct(obj);
}
function addProduct(_targetString: LocalProduct): void {
//debugger;
switch (_targetString.category) {
case "container": {
if (checkMaximum(1, _targetString)) {
let index: number = storageArray.indexOf(storageArray.find(element => element = <string>_targetString.category)!);
storageArray[index] = JSON.stringify(_targetString);
console.log(storageArray, storageArray.toLocaleString());
break;
}
else {
storageArray.push(JSON.stringify(_targetString));
break;
}
}
case "flavour": {
storageArray.push(JSON.stringify(_targetString));
console.log("_storageArray.push", JSON.stringify(_targetString));
break;
}
case "topping": {
storageArray.push(JSON.stringify(_targetString));
console.log("_storageArray.push", JSON.stringify(_targetString));
break;
}
}
/*for (const iterator of storageArray)
console.log(iterator);
storageArray.push(JSON.stringify(_targetString));
console.log(storageArray.toLocaleString());*/
}
function checkMaximum(_maximum: number, _targetString: LocalProduct): boolean {
let countOccurence: number = 0;
for (let i: number = 0; i < storageArray.length; i++) {
let checkString: string = storageArray[i];
if (checkString.includes(<string>_targetString.category))
countOccurence++;
if (countOccurence == _maximum) {
alert("You've already reached the maximum of " + _maximum);
return true;
}
}
return false;
}
function fixCount(): void {
addToLocal();
storageArray = [];
combinationCount++;
}
function addToLocal(): void {
localStorage.setItem(`Combination${combinationCount}`, "[" + storageArray.toLocaleString() + "]");
}
}

View File

@ -1,65 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="client.js" defer></script>
<title>Kapitel 11</title>
</head>
<body>
<button class="container">Becher</button>
<button id="blueberry">Blau</button>
<button id="raspberry">Rot</button>
<button id="streusel">bunte Streusel</button>
<hr>
<form id="myForm" method="" action="">
<!--https://theoneandgis.herokuapp.com-->
<label for="vorname" method="get">
Vorname
</label><br>
<input type="text" id="vorname" name="vorname" value="Vorname" onfocus="this.value=''"><br>
<label for="nachname">
Nachname
</label><br>
<input type="text" id="nachname" name="nachname" value="Nachname" onfocus="this.value=''"><br>
<label for="geburtsjahr">
Geburtsjahr
</label><br>
<input type="text" id="geburtsjahr" name="geburtsjahr" value="2000"><br>
<button type="button" id="abschicken"> Eintrag </button>
<button type="button" id="abfragen"> Abfrage </button>
</form>
<hr>
<div id="divResponse"></div>
<hr>
<div id="divDatabase"></div>
</body>
</html>
<style>
button,
label,
input,
div {
margin: 10px;
}
body{
background-color: black;
color: white;
}
</style>

View File

@ -1,25 +0,0 @@
"use strict";
var shop;
(function (shop) {
let countBall = 0;
let countTopping = 0;
let storageArray;
let storageObject;
function addProduct(_targetString) {
let storageProduct = [""];
console.log(_targetString);
storageProduct.push("category");
storageProduct.push("name");
storageProduct.push("price");
storageProduct.push("imageName");
}
shop.addProduct = addProduct;
function fixCount() {
console.log("I reached here");
}
shop.fixCount = fixCount;
/*export function addToLocal(): void {
localStorage.setItem("Combination", storageArray.toLocaleString());
}*/
})(shop || (shop = {}));
//# sourceMappingURL=handleShop.js.map

View File

@ -1 +0,0 @@
{"version":3,"file":"handleShop.js","sourceRoot":"","sources":["handleShop.ts"],"names":[],"mappings":";AAAA,IAAU,IAAI,CA6Bb;AA7BD,WAAU,IAAI;IAMV,IAAI,SAAS,GAAW,CAAC,CAAC;IAC1B,IAAI,YAAY,GAAW,CAAC,CAAC;IAC7B,IAAI,YAAsB,CAAC;IAC3B,IAAI,aAA2B,CAAC;IAEhC,SAAgB,UAAU,CAAC,aAAqB;QAC5C,IAAI,cAAc,GAAa,CAAC,EAAE,CAAC,CAAC;QACpC,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;QAC3B,cAAc,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAChC,cAAc,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAC5B,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC7B,cAAc,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IACrC,CAAC;IAPe,eAAU,aAOzB,CAAA;IAED,SAAgB,QAAQ;QACpB,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;IAClC,CAAC;IAFe,aAAQ,WAEvB,CAAA;IAED;;OAEG;AAGP,CAAC,EA7BS,IAAI,KAAJ,IAAI,QA6Bb"}

View File

@ -1,31 +0,0 @@
namespace shop {
interface LocalProduct {
[type: string]: string | number; //| string[] | undefined;
}
let countBall: number = 0;
let countTopping: number = 0;
let storageArray: String[];
let storageObject: LocalProduct;
export function addProduct(_targetString: string): void {
let storageProduct: String[] = [""];
console.log(_targetString);
storageProduct.push("category");
storageProduct.push("name");
storageProduct.push("price");
storageProduct.push("imageName");
}
export function fixCount(): void {
console.log("I reached here");
}
/*export function addToLocal(): void {
localStorage.setItem("Combination", storageArray.toLocaleString());
}*/
}

Binary file not shown.

View File

Before

Width:  |  Height:  |  Size: 50 KiB

After

Width:  |  Height:  |  Size: 50 KiB

View File

Before

Width:  |  Height:  |  Size: 262 KiB

After

Width:  |  Height:  |  Size: 262 KiB

View File

Before

Width:  |  Height:  |  Size: 940 KiB

After

Width:  |  Height:  |  Size: 940 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 292 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 187 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 93 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 107 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 204 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 127 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 128 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 110 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 118 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 192 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 120 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 87 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 204 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 439 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 148 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 101 KiB

View File

@ -0,0 +1,169 @@
@media screen and (min-width: 0px) {
body {
background-image: url(images/background.png);
text-align: center;
}
#topContainer {
display: flex;
flex-direction: column;
justify-content: space-evenly;
padding: 0px 10px 0px 10px;
margin: 20px 0px;
}
#topContainer > span {
border-bottom: solid 3px;
margin-bottom: 10px;
}
#topContainer button {
color: white;
background-color: rgb(0, 102, 255);
}
#productContainer > span {
width: 90%;
border-bottom: solid 3px;
margin-bottom: 10px;
}
#topTable {
display: flex;
flex-direction: row;
flex-wrap: wrap;
justify-content: space-evenly;
align-items: stretch;
padding: 0px;
}
#topTable button {
width: 23%;
margin: 4px 0px;
}
#topTake button {
width: 100%;
}
#topContainer{
padding: 10px;
}
#topContainer, #productContainer{
border: solid black;
margin: 20px 0px;
}
#extraSpan {
font-size: 25px;
color: red;
}
#buttonContainer{
display: flex;
flex-direction: column;
align-items: center;
border: solid black;
padding: 20px;
margin-bottom: 20px;
}
#containerDiv, #flavourDiv, #toppingDiv{
display: flex;
flex-direction: row;
flex-wrap: wrap;
justify-content: space-evenly;
margin: 20px 0px;
}
#containerDiv div, #flavourDiv div, #toppingDiv div{
margin: 10px 0px;
}
#container, #flavour, #topping{
margin: 20px 0px;
}
.container, .flavour, .topping{
width: 40%;
}
.container img {
border: solid black 3px;
border-radius: 50%;
}
.container img, .flavour img, .topping img {
width: 80%;
}
.container button, .flavour button, .topping button {
background-color: transparent;
border-radius: 5%;
}
#buttonContainer button {
width: 100%;
margin: 5px 0px;
color: white;
background-color: rgb(0, 102, 255);
border-radius: 20px;
}
#buttonContainer a {
width: 100%;
color: white;
text-decoration: none;
margin: 5px 0px;
}
#displayContainer {
display: flex;
flex-direction: row;
justify-content: center;
border: solid black 3px;
margin: 20px 0px;
min-height: 100px;
flex-wrap: wrap;
}
#displayContainer img {
width: 100px;
margin: 0px 5px;
}
}
@media screen and (min-width: 601px) {
#topTable button, #topTake button {
font-size: 30px;
}
#buttonContainer button {
font-size: 30px;
padding: 5px 0px;
}
#containerDiv div, #flavourDiv div, #toppingDiv div{
font-size: 30px;
align-items: center;
text-align: center;
}
.container, .flavour, .topping{
width: 30%;
}
#containerDiv button, #flavourDiv button, #toppingDiv button{
font-size: 25px;
}
}
@media screen and (min-width: 1025px) {
.container, .flavour, .topping{
width: 12%;
}
#topTable button {
width: 10%;
margin: 4px 0px;
}
#topTable button:hover, #topTake button:hover, #buttonContainer button:hover{
background-color: black;
color: rgb(0, 102, 255);
}
.container button:hover, .flavour button:hover, .topping button:hover {
background-color: white;
}
}

View File

@ -1,36 +1,76 @@
<!DOCTYPE html>
<html lang="en">
<html lang="de">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!--<link rel="stylesheet" href="../index.css">
<link rel="stylesheet" media="screen and (min-width: 0px)" href="../html-index/main-page-01-phone.css">
<link rel="stylesheet" media="screen and (min-width: 601px)" href="../html-index/main-page-02-tablet.css">
<link rel="stylesheet" media="screen and (min-width: 1025px)" href="../html-index/main-page-03-desktop.css"> -->
<script src="createShop.js" defer></script>
<script src="handleShop.js" defer></script>
<title>Document</title>
<link rel="stylesheet" href="../index.css">
<link rel="stylesheet" href="shop.css">
<script src='https://kit.fontawesome.com/a076d05399.js' crossorigin="anonymous" SameSite="Secure"></script>
<script src="../script-frontend/shop.js" defer></script>
<title>Shop</title>
</head>
<body>
<header>
<div class="top-nav">
<div id="logo">
<a href="../index.html"><img src="../html-index/images/nice-ice-logo.png" alt=""></a>
<a href="../index.html"><img src="../html-landing-page/images/nice-ice-logo.png" alt=""></a>
</div>
<div id="warenkorb">
<a href="#"><i class='fas fa-shopping-cart'></i>&nbsp;<span>0</span></a>
<a href="../html-warenkorb\warenkorb.html"><i class='fas fa-shopping-cart'></i>&nbsp;<span>0</span></a>
</div>
</div>
</header>
<nav>
<div class="bottom-nav">
<ul>
<a href="../html-admin/admin.html"><li>Administrator</li></a>
<a href="../html-memes/memes.html"><li>Über uns</li></a>
</ul>
</div>
</nav>
<main>
<div id="test"></div>
<div id="orderContainer"></div>
<div id="productContainer"></div>
<div id="buttonContainer"></div>
<div id="topContainer">
<span>Wohin wollen Sie das Eis?</span>
<div><span id="extraSpan">(Muss nur einmal pro Bestellvorgang ausgewählt werden)</span></div>
<div>
<span>Zum Tisch?</span>
<div id="topTable"></div>
</div>
<div>
<span>Zum Mitnehmen?</span>
<div id="topTake"></div>
</div>
</div>
<div id="productContainer">
<h1 id="containerHeader">Behälter (max 1)</h1>
<div id="containerDiv"></div>
<h1 id="flavourHeader">Eis Sorten (max 6)</h1>
<div id="flavourDiv"></div>
<h1 id="toppingHeader">Toppings (max 3)</h1>
<div id="toppingDiv"></div>
</div>
<div id="displayContainer">
<div id="behälter"></div>
<div id="eis1"></div>
<div id="eis2"></div>
<div id="eis3"></div>
<div id="eis4"></div>
<div id="eis5"></div>
<div id="eis6"></div>
<div id="topping1"></div>
<div id="topping2"></div>
<div id="topping3"></div>
</div>
<div id="buttonContainer">
<a href="#topContainer"><button id="resetButton">Eis zurücksetzen</button></a>
<a href="#topContainer"><button id="nextButton">Nächstes Eis</button></a>
<a href="../html-warenkorb/warenkorb.html"><button id="sendButton">Bestellung speichern</button></a>
</div>
</main>
<footer>
<div>
<!--Disclaimer-->
<span>( - Disclaimer - )</span>
<span>Ich verdiene mit dieser Website kein Geld</span>
</div>
</footer>
</body>

View File

@ -0,0 +1,92 @@
@media screen and (min-width: 0px) {
body {
background-image: url(../html-shop/images/background.png);
}
#mainContainer {
display: flex;
flex-direction: column;
align-items: center;
/*align-items: stretch;*/
}
div.product, form {
font-family: sans-serif;
display: flex;
flex-direction: column;
align-items: stretch;
border: dotted rgb(0, 25, 136) 3px;
border-radius: 50px;
background-color: rgba(0, 102, 255, 70%);
color: white;
padding: 10px;
align-items: center;
margin: 20px 0px;
}
div.product button {
background-color: rgba(0,0,0,50%);
border: solid rgb(0, 25, 136) 2px;
border-radius: 20px;
color: white;
}
div.product span {
display: block;
}
form {
padding: 20px 75px;
display: flex;
flex-direction: column;
align-items: center;
}
form input {
margin: 0px 0px 10px 0px;
}
button#sendOrder {
margin-bottom: 30px;
width: 90%;
color: white;
background-color: red;
border: solid black 3px;
border-radius: 50px;
font-size: 20px;
}
}
@media screen and (min-width: 601px) {
body {
font-size: 40px;
}
div.product button {
font-size: 25px;
}
button#sendOrder{
height: 50px;
font-size: 40px;
width: 75%;
}
form input {
font-size: 20px;
}
}
@media screen and (min-width: 1025px) {
div.product button:hover {
background-color: red;
}
button#sendOrder{
height: 50px;
font-size: 40px;
width: 50%;
}
button#sendOrder:hover{
background-color: black;
color: red;
}
}

View File

@ -1,36 +1,65 @@
<!DOCTYPE html>
<html lang="en">
<html lang="de">
<head>
<title>Warenkorb</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!--<link rel="stylesheet" href="../index.css">
<link rel="stylesheet" media="screen and (min-width: 0px)" href="../html-index/main-page-01-phone.css">
<link rel="stylesheet" media="screen and (min-width: 601px)" href="../html-index/main-page-02-tablet.css">
<link rel="stylesheet" media="screen and (min-width: 1025px)" href="../html-index/main-page-03-desktop.css"> -->
<script src="warenkorb.js" defer></script>
<title>Document</title>
<link rel="stylesheet" href="../index.css">
<link rel="stylesheet" href="warenkorb.css">
<script src='https://kit.fontawesome.com/a076d05399.js' crossorigin="anonymous" SameSite="Secure"></script>
<script src="../script-frontend/warenkorb.js" defer></script>
</head>
<style> body { font-size: 20px; } </style>
<body>
<header>
<div class="top-nav">
<div id="logo">
<a href="../index.html"><img src="../html-index/images/nice-ice-logo.png" alt=""></a>
<a href="../index.html"><img src="../html-landing-page/images/nice-ice-logo.png" alt=""></a>
</div>
<div id="warenkorb">
<a href="#"><i class='fas fa-shopping-cart'></i>&nbsp;<span>0</span></a>
</div>
</div>
</header>
<nav>
<div class="bottom-nav">
<ul>
<a href="../html-shop/shop.html"><li>Shop</li></a>
<a href="../html-admin/admin.html"><li>Administrator</li></a>
<a href="../html-memes/memes.html"><li>Über uns</li></a>
</ul>
</div>
</nav>
<main>
<button id="confirmOrder">confirm order</button>
<button id="sendOrder">send order</button>
<div id="check"></div>
<div id="mainContainer">
<div id="check"></div>
<form id="myForm" method="POST" action="">
<!--https://theoneandgis.herokuapp.com-->
<label for="vorname">Vorname</label>
<input type="text" id="vorname" name="vorname" value="Vorname" onfocus="this.value=''">
<label for="nachname">Nachname</label>
<input type="text" id="nachname" name="nachname" value="Nachname" onfocus="this.value=''">
<label for="straße">Straße</label>
<input type="text" id="straße" name="straße" value="Straße-Hausnummer" onfocus="this.value=''">
<label for="postleitzahl">Postleitzahl</label>
<input type="text" id="postleitzahl" name="postleitzahl" value="PLZ-Wohnort" onfocus="this.value=''">
</form>
<!--<button id="printOrder">print order</button>-->
<button id="sendOrder">Bestellung Abschicken</button>
<!--<button id="formButton">Send Form</button>-->
</div>
</main>
<footer>
<div>
<!--Disclaimer-->
<span>( - Disclaimer - )</span>
<span>Ich verdiene mit dieser Website kein Geld</span>
</div>
</footer>
</body>

View File

@ -1,47 +0,0 @@
"use strict";
//var lastname = localStorage.getItem("key");
document.querySelector("#confirmOrder").addEventListener("click", printOrder);
document.querySelector("#sendOrder").addEventListener("click", confirmOrder);
let orderArray = [];
let orderNumber = 0;
async function printOrder() {
for (const key in localStorage) {
if (localStorage.getItem(key) != null) {
let content = localStorage.getItem(key);
let contentObj = await JSON.parse(content);
let contentString = "{";
let countFlavour = 1;
let countTopping = 1;
for (const keys of contentObj)
if (keys.category == "container")
contentString += `"container"` + ":" + `"${keys.name}"` + ",";
for (const keys of contentObj)
if (keys.category == "flavour") {
contentString += `"flavour${countFlavour}"` + ":" + `"${keys.name}"` + ",";
countFlavour++;
}
for (const keys of contentObj)
if (keys.category == "topping") {
contentString += `"topping${countTopping}"` + ":" + `"${keys.name}"` + ",";
countTopping++;
}
contentString = contentString.slice(0, contentString.length - 1) + "}";
console.log("string", contentString);
orderArray.push(contentString);
document.querySelector("#check").innerHTML += content;
console.log(contentObj);
}
}
}
async function confirmOrder() {
for (const iterator of orderArray) {
await fetch("http://localhost:8100", {
method: "POST",
headers: {
"Content-Type": "text/plain"
},
body: iterator
});
}
}
//# sourceMappingURL=warenkorb.js.map

View File

@ -1 +0,0 @@
{"version":3,"file":"warenkorb.js","sourceRoot":"","sources":["warenkorb.ts"],"names":[],"m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I,GAAG,GAAG,GAAG,CAAC;oBAC3E,YAAY,EAAE,CAAC;iBAClB;YAEL,aAAa,GAAG,aAAa,CAAC,KAAK,CAAC,CAAC,EAAE,aAAa,CAAC,MAAM,GAAG,CAAC,CAAE,GAAG,GAAG,CAAC;YACxE,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,aAAa,CAAC,CAAC;YACrC,UAAU,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;YAEjB,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAE,CAAC,SAAS,IAAI,OAAO,CAAE;YACtE,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;SAC3B;KACJ;AACL,CAAC;AAED,KAAK,UAAU,YAAY;IACvB,KAAK,MAAM,QAAQ,IAAI,UAAU,EAAE;QAC/B,MAAM,KAAK,CAAC,uBAAuB,EAAE;YACjC,MAAM,EAAE,MAAM;YACd,OAAO,EAAE;gBACL,cAAc,EAAE,YAAY;aAC/B;YACD,IAAI,EAAE,QAAQ;SACjB,CAAC,CAAC;KACN;AACL,CAAC"}

View File

@ -1,56 +0,0 @@
//var lastname = localStorage.getItem("key");
(<HTMLElement>document.querySelector("#confirmOrder")).addEventListener("click", printOrder);
(<HTMLElement>document.querySelector("#sendOrder")).addEventListener("click", confirmOrder);
interface LocalProduct {
[type: string]: string | number; //| string[] | undefined;
}
let orderArray: string[] = [];
let orderNumber: number = 0;
async function printOrder(): Promise<void> {
for (const key in localStorage) {
if (localStorage.getItem(key) != null) {
let content: string = localStorage.getItem(key)!;
let contentObj: LocalProduct[] = await JSON.parse(content);
let contentString: string = "{";
let countFlavour: number = 1;
let countTopping: number = 1;
for (const keys of contentObj)
if (keys.category == "container")
contentString += `"container"` + ":" + `"${keys.name}"` + ",";
for (const keys of contentObj)
if (keys.category == "flavour") {
contentString += `"flavour${countFlavour}"` + ":" + `"${keys.name}"` + ",";
countFlavour++;
}
for (const keys of contentObj)
if (keys.category == "topping") {
contentString += `"topping${countTopping}"` + ":" + `"${keys.name}"` + ",";
countTopping++;
}
contentString = contentString.slice(0, contentString.length - 1 ) + "}";
console.log("string", contentString);
orderArray.push(contentString);
(<HTMLElement>document.querySelector("#check")).innerHTML += content ;
console.log(contentObj);
}
}
}
async function confirmOrder(): Promise<void> {
for (const iterator of orderArray) {
await fetch("http://localhost:8100", {
method: "POST",
headers: {
"Content-Type": "text/plain"
},
body: iterator
});
}
}

View File

@ -1,9 +1,145 @@
@media screen and (min-width: 0px) {
@import url("html-index/index-01-phone.css");
/* Die Seite ist auf Mindestbreite von 333px ausgelegt */
body {
font-size: 20px;
margin: 0px;
height: 100%;
width: 100%;
/*background-image: url(images/sunrise-1014712_1920.jpg);
background-position: 50% 10%;
background-repeat: no-repeat;
background-size: cover;*/
}
main {
padding: 0px 10px;
}
.top-nav {
color: white;
background-color: black;
display: grid;
grid-template-columns: 70% 25%;
grid-column-gap: 5%;
text-align: center;
height: 10vh;
}
.top-nav a {
font-size: 40px;
text-decoration: none;
color: white;
}
.top-nav #warenkorb {
font-size: 30px;
position: relative;
right: 10px;
}
.top-nav #logo, #warenkorb {
display: flex;
flex-direction: row;
align-items: center;
align-content: center;
justify-content: center;
}
.top-nav img {
height: 60px;
width: 220px;
}
.bottom-nav {
background-color: hsla(0, 0%, 0%, 0%);
text-align: center;
}
.bottom-nav ul {
list-style: none;
margin: 0px;
padding: 5px;
}
.bottom-nav ul li {
background-color: rgb(0, 102, 255);
margin: 10px 0px;
border: solid rgb(0, 25, 136) 2px;
border-radius: 10px;
}
.bottom-nav ul a {
text-decoration: none;
color: white;
}
footer div {
margin-top: 200px;
background-color: rgb(43, 43, 43);
color: white;
text-align: center;
font-size: 1em;
height: 200px;
width: 100%;
position: relative;
bottom: 0px;
display: flex;
flex-direction: column;
justify-content: space-evenly;
align-items: center;
}
}
@media screen and (min-width: 601px) {
@import url("html-index/index-02-tablet.css");
body {
font-size: 40px;
}
div.top-nav {
height: 120px;
}
.top-nav #warenkorb {
font-size: 70px;
}
.top-nav img {
height: 100px;
width: 380px;
}
}
@media screen and (min-width: 1025px) {
@import url("html-index/index-03-desktop.css");
body {
font-size: 40px;
}
.top-nav #warenkorb a:hover {
color:rgb(0, 102, 255);
}
div.top-nav {
height: 150px;
}
.top-nav img {
height: 120px;
width: 460px;
}
.bottom-nav {
background-color: rgb(0, 102, 255);
}
.bottom-nav ul {
font-size: 30px;
list-style: none;
display: flex;
flex-direction: row;
justify-content: space-evenly;
margin: 0px;
padding: 0px;
}
.bottom-nav ul li {
border: none;
}
.bottom-nav ul a {
text-decoration: none;
color: white;
}
.bottom-nav ul a:hover {
color: black;
}
}

View File

@ -3,43 +3,39 @@
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" media="screen and (min-width: 0px)" href="html-index/main-page-01-phone.css">
<link rel="stylesheet" media="screen and (min-width: 601px)" href="html-index/main-page-02-tablet.css">
<link rel="stylesheet" media="screen and (min-width: 1025px)" href="html-index/main-page-03-desktop.css">
<script src='https://kit.fontawesome.com/a076d05399.js'></script>
<link rel="stylesheet" media="screen and (min-width: 0px)" href="html-landing-page/landing-page-01-phone.css">
<link rel="stylesheet" media="screen and (min-width: 601px)" href="html-landing-page/landing-page-02-tablet.css">
<link rel="stylesheet" media="screen and (min-width: 1025px)" href="html-landing-page/landing-page-03-desktop.css">
<link rel="stylesheet" href="index.css">
<script src='https://kit.fontawesome.com/a076d05399.js' crossorigin="anonymous" SameSite="Secure"></script>
<script src="script-frontend/index.js" defer></script>
<title>Eisdile Olé</title>
</head>
<body>
<header>
<div class="top-nav">
<div id="logo">
<a href="#"><img src="html-index/images/nice-ice-logo.png" alt=""></a>
<a href="#"><img src="html-landing-page/images/nice-ice-logo.png" alt=""></a>
</div>
<div id="warenkorb">
<a href="#"><i class='fas fa-shopping-cart'></i>&nbsp;<span>0</span></a>
<a href="html-warenkorb\warenkorb.html"><i class='fas fa-shopping-cart'></i>&nbsp;<span>0</span></a>
</div>
</div>
</header>
<nav>
<div class="bottom-nav">
<ul>
<li><a href="#">Administrator</a></li>
<li><a href="#">About us</a></li>
<li><a href="#">Kontakt</a></li>
<a href="html-admin/admin.html"><li>Administrator</li></a>
<a href="html-memes/memes.html"><li>Über uns</li></a>
</ul>
</div>
</nav>
<main>
<div class="bestellbox">
<span> Was darf's sein? </span>
<a id="box-togo" href="html-shop/shop.html">Ice to go</a>
<a id="box-tostay" href="#">Gemütlich zum Tisch</a>
<span> Eis gefällig? </span>
<a id="box-togo" href="html-shop/shop.html">Na klar!</a>
<!--<a id="box-tostay" href="#">Gemütlich zum Tisch</a>-->
</div>
</main>
<footer>
<div>
<!--Disclaimer-->
</div>
</footer>
</body>
</html>

View File

@ -19,7 +19,8 @@ var handleMongo;
let options = { useNewUrlParser: true, useUnifiedTopology: true };
let mongoClient = new Mongo.MongoClient(dbUrl, options);
await mongoClient.connect();
productsCollection = mongoClient.db("NiceIce").collection("Orders");
productsCollection = mongoClient.db("NiceIce").collection("Products");
ordersCollection = mongoClient.db("NiceIce").collection("Orders");
console.log("Database connection: ", productsCollection != undefined);
}
handleMongo.connectDB = connectDB;
@ -32,64 +33,63 @@ var handleMongo;
handleMongo.connectCollection = connectCollection;
function insertEntry(_collection, _order) {
connectCollection(_collection);
console.log("_order", _order);
currentCollection.insertOne(_order);
}
handleMongo.insertEntry = insertEntry;
async function insertObject(_collection, _order) {
debugger;
connectCollection(_collection);
/*for (const key in _order[0]) {
key.split("_id");
}
delete _order[0]._id;
delete _order[1]._id;*/
console.log("this _collection: ", _order);
//let replacement: ProduktObj[] = JSON.parse(JSON.stringify(_order).split("_id").join("old_id"));
await currentCollection.insert(_order[0]);
await currentCollection.insert(_order[1]);
console.log("_collection: ", _order);
/*for (const iterator of _order) {
console.log(iterator);
//let insertion: string = JSON.stringify(iterator).replace("[", "").replace("]", "");
let replacement: ProduktObj[] = JSON.parse(JSON.stringify(iterator).split("_id").join("old_id"));
//let replacement: ProduktObj[] = JSON.parse(insertion.split("_id").join("old_id"));
await currentCollection.insert(replacement[0]);
console.log("replacement[0]", replacement[0]);
}*/
}
handleMongo.insertObject = insertObject;
async function removeEntry(_collection, _entry) {
connectCollection(_collection);
let id = _entry._id;
let objID = new Mongo.ObjectID(id);
await currentCollection.deleteOne({ "_id": objID });
if (!(_entry.id == undefined)) {
let id = _entry._id;
let objID = new Mongo.ObjectID(id);
await currentCollection.deleteOne({ "_id": objID });
}
else {
await currentCollection.deleteMany({ "Nr": _entry.Nr });
}
}
handleMongo.removeEntry = removeEntry;
async function countEntries(_collection) {
connectCollection(_collection);
let entryCount = await currentCollection.count({});
return entryCount;
}
handleMongo.countEntries = countEntries;
async function findCollection(_collection) {
connectCollection(_collection);
//await currentCollection.dropIndexes("category");
//await currentCollection.createIndex( { category: 1});
let foundCollection = await currentCollection.find().sort({ category: 1 }).toArray();
return foundCollection;
}
handleMongo.findCollection = findCollection;
/*
async function findManyData(_order: Personalien): Promise<string> {
let test: Mongo.Cursor = content.find(_order);
let testArray: Personalien[] = await test.toArray();
console.log( testArray );
return testArray.toString();
async function findEntry(_collection, _entry) {
connectCollection(_collection);
let id = _entry._id;
let objID = new Mongo.ObjectID(id);
let foundEntry = await currentCollection.findOne({ _id: objID });
return foundEntry;
}
async function findOneData(_order: Personalien): Promise<void> {
let test2: any = await content.findOne(_order);
console.log("findOneData: ", test2);
//console.log(test2.name);
handleMongo.findEntry = findEntry;
async function updateEntry(_collection, _entry) {
connectCollection(_collection);
let id = _entry._id;
let objID = new Mongo.ObjectID(id);
delete _entry._id;
console.log("entry", _entry);
if (_entry.orderCount != undefined)
currentCollection.updateOne({ _id: objID }, { $set: { orderCount: _entry.orderCount } });
else
currentCollection.updateOne({ _id: objID }, { $set: _entry });
}
function removeData(_order: Personalien): void {
content.remove(_order);
}
*/
handleMongo.updateEntry = updateEntry;
})(handleMongo = exports.handleMongo || (exports.handleMongo = {}));
//# sourceMappingURL=useMongo.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"useMongo.js","sourceRoot":"","sources":["useMongo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AAU,EAAW,MAAM,CAAC,UAAW,EAAC,EAAC,CAAC,CAAC;;YAE7F,iBAAiB,CAAC,SAAS,CAAC,EAAC,GAAG,EAAE,KAAK,EAAC,EAAE,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC,CAAC;IAClE,CAAC;IAVqB,uBAAW,cAUhC,CAAA;AAEL,CAAC,EA/FgB,WAAW,GAAX,mBAAW,KAAX,mBAAW,QA+F3B"}

View File

@ -23,7 +23,8 @@ export namespace handleMongo {
let options: Mongo.MongoClientOptions = { useNewUrlParser: true, useUnifiedTopology: true };
let mongoClient: Mongo.MongoClient = new Mongo.MongoClient(dbUrl, options);
await mongoClient.connect();
productsCollection = mongoClient.db("NiceIce").collection("Orders");
productsCollection = mongoClient.db("NiceIce").collection("Products");
ordersCollection = mongoClient.db("NiceIce").collection("Orders");
console.log("Database connection: ", productsCollection != undefined);
}
@ -36,66 +37,62 @@ export namespace handleMongo {
export function insertEntry(_collection: string, _order: ProduktObj): void {
connectCollection(_collection);
console.log("_order", _order);
currentCollection.insertOne(_order);
}
export async function insertObject(_collection: string, _order: ProduktObj[]): Promise<void> {
debugger;
connectCollection(_collection);
/*for (const key in _order[0]) {
key.split("_id");
}
delete _order[0]._id;
delete _order[1]._id;*/
console.log("this _collection: ", _order);
//let replacement: ProduktObj[] = JSON.parse(JSON.stringify(_order).split("_id").join("old_id"));
await currentCollection.insert(_order[0]);
await currentCollection.insert(_order[1]);
console.log("_collection: ", _order);
/*for (const iterator of _order) {
console.log(iterator);
//let insertion: string = JSON.stringify(iterator).replace("[", "").replace("]", "");
let replacement: ProduktObj[] = JSON.parse(JSON.stringify(iterator).split("_id").join("old_id"));
//let replacement: ProduktObj[] = JSON.parse(insertion.split("_id").join("old_id"));
await currentCollection.insert(replacement[0]);
console.log("replacement[0]", replacement[0]);
}*/
}
export async function removeEntry(_collection: string, _entry: ProduktObj): Promise<void> {
connectCollection(_collection);
let id: string = <string>_entry._id;
let objID: Mongo.ObjectID = new Mongo.ObjectID(id);
await currentCollection.deleteOne({ "_id": objID });
if (!(_entry.id == undefined)) {
let id: string = <string>_entry._id;
let objID: Mongo.ObjectID = new Mongo.ObjectID(id);
await currentCollection.deleteOne({ "_id": objID });
}
else {
await currentCollection.deleteMany({ "Nr": _entry.Nr});
}
}
export async function countEntries(_collection: string): Promise<number> {
connectCollection(_collection);
let entryCount: number = await currentCollection.count({});
return entryCount;
}
export async function findCollection(_collection: string): Promise<ProduktObj[]> {
connectCollection(_collection);
//await currentCollection.dropIndexes("category");
//await currentCollection.createIndex( { category: 1});
let foundCollection: ProduktObj[] = await currentCollection.find().sort({ category: 1 }).toArray();
return foundCollection;
}
/*
async function findManyData(_order: Personalien): Promise<string> {
let test: Mongo.Cursor = content.find(_order);
let testArray: Personalien[] = await test.toArray();
console.log( testArray );
return testArray.toString();
export async function findEntry(_collection: string, _entry: ProduktObj): Promise<ProduktObj> {
connectCollection(_collection);
let id: string = <string>_entry._id;
let objID: Mongo.ObjectID = new Mongo.ObjectID(id);
let foundEntry: ProduktObj = await currentCollection.findOne({_id: objID})!;
return foundEntry;
}
async function findOneData(_order: Personalien): Promise<void> {
let test2: any = await content.findOne(_order);
console.log("findOneData: ", test2);
//console.log(test2.name);
export async function updateEntry(_collection: string, _entry: ProduktObj): Promise<void> {
connectCollection(_collection);
let id: string = <string>_entry._id;
let objID: Mongo.ObjectID = new Mongo.ObjectID(id);
delete _entry._id;
console.log("entry", _entry);
if (_entry.orderCount != undefined)
currentCollection.updateOne({_id: objID}, {$set: {orderCount: (<number>_entry.orderCount)}});
else
currentCollection.updateOne({_id: objID}, {$set: _entry});
}
function removeData(_order: Personalien): void {
content.remove(_order);
}
*/
}

View File

@ -4,7 +4,9 @@ exports.ServerSide = void 0;
const Http = require("http");
const url = require("url");
const useMongo_1 = require("./useMongo");
//import {testThis } from "mongo.js";
//mongodb + srv://AdminForUse:XV8MXEdBYuwXtQnc@ichstudieremitgis-jfrz9.mongodb.net/IchStudiereMitGiS?retryWrites=true&w=majority
//http://localhost:8100
//https://theoneandgis.herokuapp.com
var ServerSide;
(function (ServerSide) {
console.log("Starting server");
@ -22,9 +24,11 @@ var ServerSide;
console.log("Your server Listening");
}
async function handleRequest(_request, _response) {
console.log("https://theoneandgis.herokuapp.com" + `${_request.url}`);
console.log("http://web-url" + `${_request.url}`); // Hier müsste ggf. auch zu Heruko gewechselt werden, wenn es von Bedeutung ist
let myData = url.parse(`${_request.url}`, true);
let myQuery = myData.query;
console.log("myQuery", myQuery);
let myQueryObject = myQuery;
let myQueryString = JSON.stringify(myQuery);
let responseUrlString = _request.url;
//let splitString: string = (<string>_request.url).slice(0, 9);
@ -46,46 +50,59 @@ var ServerSide;
});
}
else {
await handleAction(_request, _response, myQueryString, responseUrlString, {});
await handleAction(_request, _response, myQueryString, responseUrlString, myQueryObject);
_response.end();
}
_response.end();
}
async function handleAction(_request, _response, _myQueryString, _responseUrlString, _orderObj) {
console.log("handleAction", _orderObj);
let whichCollection = "products";
let whichCollection = "";
if (_responseUrlString.includes("/products")) {
whichCollection = "products";
}
if (_responseUrlString.includes("/orders")) {
whichCollection = "products";
whichCollection = "orders";
}
if (_responseUrlString.includes("/mongo")) {
await mongoAction(_response, _myQueryString, whichCollection, _responseUrlString, _orderObj);
}
console.log("end");
_response.end();
}
async function mongoAction(_response, _query, _whichCollection, _command, _orderObj) {
let myJsonObj = JSON.parse(_query);
console.log("mongoAction", _orderObj);
if (_command.includes("/findCollection")) {
let value = await useMongo_1.handleMongo.findCollection(_whichCollection);
let handlThis = JSON.stringify(value);
_response.write(handlThis);
let handleThis = JSON.stringify(value);
console.log("handleThis", handleThis);
_response.write(handleThis);
}
if (_command.includes("/findEntry")) {
console.log("/findEntry");
let foundEntry = await useMongo_1.handleMongo.findEntry(_whichCollection, _orderObj);
console.log("foundEntry", foundEntry);
_response.write(JSON.stringify(foundEntry));
}
if (_command.includes("/updateEntry")) {
useMongo_1.handleMongo.updateEntry(_whichCollection, _orderObj);
_response.write(_query); // technically no response
}
/*if (_command.includes("/insertObject")) {
await useMongo.insertObject(_whichCollection, _orderObj);
//_response.write(_query); // technically no response
}*/
if (_command.includes("/insertEntry")) {
useMongo_1.handleMongo.insertEntry(_whichCollection, myJsonObj);
useMongo_1.handleMongo.insertEntry(_whichCollection, _orderObj); //myJsonObj
_response.write(_query); // technically no response
}
if (_command.includes("/removeEntry")) {
await useMongo_1.handleMongo.removeEntry(_whichCollection, myJsonObj);
_response.write(`{"":""}`); // technically no response
}
if (_command.includes("/countEntries")) {
let countNumber = await useMongo_1.handleMongo.countEntries(_whichCollection);
_response.write(`{"orderID":"${countNumber}"}`);
}
}
})(ServerSide = exports.ServerSide || (exports.ServerSide = {}));
//# sourceMappingURL=useServer.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"useServer.js","sourceRoot":"","sources":["useServer.ts"],"names":[],"mappings":";;;AAAA,6BAA6B;AAC7B,2BAA2B;AAE3B,yCAAqD;AAErD,gIAAgI;AAChI,uBAAuB;AACvB,oCAAoC;AAEpC,IAAiB,UAAU,CA4G1B;AA5GD,WAAiB,UAAU;IAEvB,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;IAC/B,IAAI,IAAI,GAAW,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAC5C,IAAI,CAAC,IAAI;QACL,IAAI,GAAG,IAAI,CAAC;IAEhB,IAAI,MAAM,GAAgB,IAAI,CAAC,YAAY,EAAE,CAAC;IAC9C,MAAM,CAAC,WAAW,CAAC,SAAS,EAAE,aAAa,CAAC,CAAC;IAC7C,MAAM,CAAC,WAAW,CAAC,WAAW,EAAE,YAAY,CAAC,CAAC;IAC9C,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAEpB,IAAI,MAAM,GAAa,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAC7C,IAAI,OAAO,GAAW,MAAM,CAAC,CAAC,CAAC,CAAC;IAChC,sBAAQ,CAAC,SA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,0BAA0B;SACzD;QACD,IAAI,QAAQ,CAAC,QAAQ,CAAC,eAAe,CAAC,EAAE;YACpC,IAAI,WAAW,GAAW,MAAM,sBAAQ,CAAC,YAAY,CAAC,gBAAgB,CAAC,CAAC;YACxE,SAAS,CAAC,KAAK,CAAC,eAAe,WAAW,IAAI,CAAC,CAAC;SACnD;IACL,CAAC;AAEL,CAAC,EA5GgB,UAAU,GAAV,kBAAU,KAAV,kBAAU,QA4G1B"}

View File

@ -3,7 +3,9 @@ import * as url from "url";
import { ParsedUrlQuery } from "querystring";
import { handleMongo as useMongo } from "./useMongo";
//import {testThis } from "mongo.js";
//mongodb + srv://AdminForUse:XV8MXEdBYuwXtQnc@ichstudieremitgis-jfrz9.mongodb.net/IchStudiereMitGiS?retryWrites=true&w=majority
//http://localhost:8100
//https://theoneandgis.herokuapp.com
export namespace ServerSide {
@ -26,10 +28,12 @@ export namespace ServerSide {
}
async function handleRequest(_request: Http.IncomingMessage, _response: Http.ServerResponse): Promise<void> {
console.log("https://theoneandgis.herokuapp.com" + `${_request.url}`);
console.log("http://web-url" + `${_request.url}`); // Hier müsste ggf. auch zu Heruko gewechselt werden, wenn es von Bedeutung ist
let myData: url.UrlWithParsedQuery = url.parse(`${_request.url}`, true);
let myQuery: ParsedUrlQuery = myData.query;
console.log("myQuery", myQuery);
let myQueryObject: useMongo.ProduktObj = myQuery;
let myQueryString: string = JSON.stringify(myQuery);
let responseUrlString: string = <string>_request.url;
//let splitString: string = (<string>_request.url).slice(0, 9);
@ -52,25 +56,26 @@ export namespace ServerSide {
});
}
else {
await handleAction(_request, _response, myQueryString, responseUrlString, {});
await handleAction(_request, _response, myQueryString, responseUrlString, myQueryObject);
_response.end();
}
_response.end();
}
async function handleAction(_request: Http.IncomingMessage, _response: Http.ServerResponse, _myQueryString: string, _responseUrlString: string, _orderObj: useMongo.ProduktObj): Promise<void> {
console.log("handleAction", _orderObj);
let whichCollection: string = "products";
let whichCollection: string = "";
if ( _responseUrlString.includes("/products") ) {
whichCollection = "products";
}
if (_responseUrlString.includes("/orders")) {
whichCollection = "products";
whichCollection = "orders";
}
if ( _responseUrlString.includes("/mongo") ) {
await mongoAction(_response, _myQueryString, whichCollection, _responseUrlString, _orderObj);
}
console.log("end");
_response.end();
}
async function mongoAction(_response: Http.ServerResponse, _query: string, _whichCollection: string, _command: string, _orderObj: useMongo.ProduktObj): Promise<void> {
@ -79,24 +84,35 @@ export namespace ServerSide {
if (_command.includes("/findCollection")) {
let value: useMongo.ProduktObj[] = await useMongo.findCollection(_whichCollection);
let handlThis: string = JSON.stringify(value);
_response.write(handlThis);
let handleThis: string = JSON.stringify(value);
console.log("handleThis", handleThis);
_response.write(handleThis);
}
if (_command.includes("/findEntry")) {
console.log("/findEntry");
let foundEntry: useMongo.ProduktObj = await useMongo.findEntry(_whichCollection, _orderObj);
console.log("foundEntry", foundEntry);
_response.write(JSON.stringify(foundEntry));
}
if (_command.includes("/updateEntry")) {
useMongo.updateEntry(_whichCollection, _orderObj);
_response.write(_query); // technically no response
}
/*if (_command.includes("/insertObject")) {
await useMongo.insertObject(_whichCollection, _orderObj);
//_response.write(_query); // technically no response
}*/
if (_command.includes("/insertEntry")) {
useMongo.insertEntry( _whichCollection, myJsonObj);
useMongo.insertEntry(_whichCollection, _orderObj); //myJsonObj
_response.write(_query); // technically no response
}
if (_command.includes("/removeEntry")) {
await useMongo.removeEntry(_whichCollection, myJsonObj);
_response.write(`{"":""}`); // technically no response
}
if (_command.includes("/countEntries")) {
let countNumber: number = await useMongo.countEntries(_whichCollection);
_response.write(`{"orderID":"${countNumber}"}`);
}
}
}

View File

@ -0,0 +1,190 @@
"use strict";
var frontShop;
(function (frontShop) {
let serverUrl = "https://theoneandgis.herokuapp.com";
init();
async function init() {
await getOrderList();
addListening();
fixCartCount();
}
async function getOrderList() {
let url = serverUrl + "/mongo/orders/findCollection" + "?";
let response = await fetch(url);
let jsonResponse = await response.json();
let previousNr = -1;
//(<HTMLDivElement>document.querySelector("#tableDiv")).innerHTML = JSON.stringify(jsonResponse);
for (const iterator of jsonResponse) {
if (iterator.orderCount != undefined)
continue;
let table = document.createElement("table");
if (previousNr != iterator.Nr) {
let button = document.createElement("button");
button.setAttribute("content", `${iterator.Nr}`);
button.classList.add("removeButton");
button.innerHTML = `Bestellung Nr. ${iterator.Nr} entfernen`;
document.querySelector("#tableDiv").append(button);
previousNr = iterator.Nr;
}
if (!(iterator.vorname == undefined)) {
table.innerHTML = `
<tr>
<th>Bestellung</th>
<td>Nr. ${iterator.Nr}</td>
<tr>
<tr>
<th>Preis</th>
<td>${iterator.orderPrice} </td>
</tr>
<th>Name</th>
<td>${iterator.vorname} ${iterator.nachname}</td>
</tr>
<tr>
<th>Straße</th>
<td>${iterator.straße}</td>
</tr>
<tr>
<th>Wohnort</th>
<td>${iterator.postleitzahl}</td>
</tr>
`;
}
else {
table.innerHTML += `
<tr>
<th>Bestellung</th>
<td>Nr. ${iterator.Nr}</td>
</tr>
<tr>
<th>Preis</th>
<td>${iterator.productPrice}</td>
</tr>`;
for (const key in iterator) {
switch (key) {
case ("container"):
table.innerHTML += `<tr><th>${key}</th><td>${iterator.container}</td></tr>`;
break;
case ("flavour1"):
table.innerHTML += `<tr><th>${key}</th><td>${iterator.flavour1}</td></tr>`;
break;
case ("flavour2"):
table.innerHTML += `<tr><th>${key}</th><td>${iterator.flavour2}</td></tr>`;
break;
case ("flavour3"):
table.innerHTML += `<tr><th>${key}</th><td>${iterator.flavour3}</td></tr>`;
break;
case ("flavour4"):
table.innerHTML += `<tr><th>${key}</th><td>${iterator.flavour4}</td></tr>`;
break;
case ("flavour5"):
table.innerHTML += `<tr><th>${key}</th><td>${iterator.flavour5}</td></tr>`;
break;
case ("flavour6"):
table.innerHTML += `<tr><th>${key}</th><td>${iterator.flavour6}</td></tr>`;
break;
case ("topping1"):
table.innerHTML += `<tr><th>${key}</th><td>${iterator.topping1}</td></tr>`;
break;
case ("topping2"):
table.innerHTML += `<tr><th>${key}</th><td>${iterator.topping2}</td></tr>`;
break;
case ("topping3"):
table.innerHTML += `<tr><th>${key}</th><td>${iterator.topping3}</td></tr>`;
break;
}
}
}
document.querySelector("#tableDiv").append(table);
let div = document.createElement("div");
div.classList.add("buttonDiv");
div.innerHTML = `
<button class="removeOne" content=${JSON.stringify(iterator._id)}> Entfernen </button>
<button class="editOne" content=${JSON.stringify(iterator)}> Bearbeiten </button> `;
document.querySelector("#tableDiv").append(div);
}
}
function addListening() {
let elementList = document.querySelectorAll(".removeOne");
for (const iterator of elementList)
iterator.addEventListener("click", removeDataID);
let elementList2 = document.querySelectorAll(".removeButton");
for (const iterator of elementList2)
iterator.addEventListener("click", removeDataNR);
let elementList3 = document.querySelectorAll(".editOne");
for (const iterator of elementList3)
iterator.addEventListener("click", editData);
}
async function removeDataID(_event) {
await removeData(_event, "id");
}
async function removeDataNR(_event) {
await removeData(_event, "order");
}
async function removeData(_event, _parameter) {
let target = _event.target;
let query = "";
if (_parameter == "id")
query = `_id=${target.getAttribute("content")}`;
else if (_parameter == "order")
query = `Nr=${target.getAttribute("content")}`;
console.log(query);
let url = serverUrl + "/mongo/orders/removeEntry/?" + query;
await fetch(url);
location.reload();
}
function editData(_event) {
let target = _event.target;
let obj = JSON.parse(target.getAttribute("content"));
let div = document.createElement("div");
div.setAttribute("id", "formDiv");
div.innerHTML = `<form id="myForm"></form>`;
if (document.querySelector("#myForm") != null)
document.querySelector("#tableDiv").removeChild(div);
document.querySelector("#tableDiv").append(div);
for (const iterator in obj) {
let label = document.createElement("label");
label.setAttribute("for", iterator);
label.innerHTML = `${iterator}`;
let input = document.createElement("input");
input.setAttribute("type", "text");
input.setAttribute("name", `${iterator}`);
input.setAttribute("id", `${iterator}`);
input.setAttribute("value", obj[iterator]);
if (iterator == "_id") {
input.setAttribute("readonly", "");
}
else {
input.setAttribute("onfocus", `if(this.value == "${obj[iterator]}") this.value=""`);
input.setAttribute("onblur", `if(this.value == "") this.value="${obj[iterator]}"`);
}
document.querySelector("#myForm").append(label);
document.querySelector("#myForm").append(input);
}
let button = document.createElement("button");
button.setAttribute("id", "setAttribute");
button.innerHTML = "Bestätigung";
button.addEventListener("click", confirmForm);
document.querySelector("#myForm").append(button);
}
async function confirmForm() {
let formData = new FormData(document.forms[0]);
let url = "";
//tslint:disable-next-line: no-any
let query = new URLSearchParams(formData);
url = serverUrl + "/" + "mongo" + "/" + "orders" + "/" + "updateEntry" + "/" + "?" + query.toString();
await fetch(url);
}
function fixCartCount() {
if (localStorage["CartCount"] != undefined)
localStorage.removeItem("CartCount");
let count = 0;
for (const key in localStorage) {
if (key.includes("Combination")) {
count++;
}
}
localStorage.setItem("CartCount", `${count}`);
document.querySelector("#warenkorb span").innerHTML = `${localStorage.CartCount}`;
}
})(frontShop || (frontShop = {}));
//# sourceMappingURL=admin.js.map

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,201 @@
namespace frontShop {
interface Products {
[type: string]: string | number;
}
let serverUrl: string = "https://theoneandgis.herokuapp.com";
init();
async function init(): Promise<void> {
await getOrderList();
addListening();
fixCartCount();
}
async function getOrderList(): Promise<void> {
let url: string = serverUrl + "/mongo/orders/findCollection" + "?";
let response: Response = await fetch(url);
let jsonResponse: Products[] = await response.json();
let previousNr: number = -1;
//(<HTMLDivElement>document.querySelector("#tableDiv")).innerHTML = JSON.stringify(jsonResponse);
for (const iterator of jsonResponse) {
if (iterator.orderCount != undefined)
continue;
let table: HTMLTableElement = document.createElement("table");
if (previousNr != iterator.Nr) {
let button: HTMLButtonElement = document.createElement("button");
button.setAttribute("content", `${iterator.Nr}`);
button.classList.add("removeButton");
button.innerHTML = `Bestellung Nr. ${iterator.Nr} entfernen`;
(<HTMLDivElement>document.querySelector("#tableDiv")).append(button);
previousNr = <number>iterator.Nr;
}
if (!(iterator.vorname == undefined)) {
table.innerHTML = `
<tr>
<th>Bestellung</th>
<td>Nr. ${iterator.Nr}</td>
<tr>
<tr>
<th>Preis</th>
<td>${iterator.orderPrice} </td>
</tr>
<th>Name</th>
<td>${iterator.vorname} ${iterator.nachname}</td>
</tr>
<tr>
<th>Straße</th>
<td>${iterator.straße}</td>
</tr>
<tr>
<th>Wohnort</th>
<td>${iterator.postleitzahl}</td>
</tr>
`;
}
else {
table.innerHTML += `
<tr>
<th>Bestellung</th>
<td>Nr. ${iterator.Nr}</td>
</tr>
<tr>
<th>Preis</th>
<td>${iterator.productPrice}</td>
</tr>`;
for (const key in iterator) {
switch (key) {
case ("container"): table.innerHTML += `<tr><th>${key}</th><td>${iterator.container}</td></tr>`;
break;
case ("flavour1"): table.innerHTML += `<tr><th>${key}</th><td>${iterator.flavour1}</td></tr>`;
break;
case ("flavour2"): table.innerHTML += `<tr><th>${key}</th><td>${iterator.flavour2}</td></tr>`;
break;
case ("flavour3"): table.innerHTML += `<tr><th>${key}</th><td>${iterator.flavour3}</td></tr>`;
break;
case ("flavour4"): table.innerHTML += `<tr><th>${key}</th><td>${iterator.flavour4}</td></tr>`;
break;
case ("flavour5"): table.innerHTML += `<tr><th>${key}</th><td>${iterator.flavour5}</td></tr>`;
break;
case ("flavour6"): table.innerHTML += `<tr><th>${key}</th><td>${iterator.flavour6}</td></tr>`;
break;
case ("topping1"): table.innerHTML += `<tr><th>${key}</th><td>${iterator.topping1}</td></tr>`;
break;
case ("topping2"): table.innerHTML += `<tr><th>${key}</th><td>${iterator.topping2}</td></tr>`;
break;
case ("topping3"): table.innerHTML += `<tr><th>${key}</th><td>${iterator.topping3}</td></tr>`;
break;
}
}
}
(<HTMLDivElement>document.querySelector("#tableDiv")).append(table);
let div: HTMLDivElement = document.createElement("div");
div.classList.add("buttonDiv");
div.innerHTML = `
<button class="removeOne" content=${JSON.stringify(iterator._id)}> Entfernen </button>
<button class="editOne" content=${JSON.stringify(iterator)}> Bearbeiten </button> `;
(<HTMLDivElement>document.querySelector("#tableDiv")).append(div);
}
}
function addListening(): void {
let elementList: NodeListOf<Element> = document.querySelectorAll(".removeOne");
for (const iterator of elementList)
iterator.addEventListener("click", removeDataID);
let elementList2: NodeListOf<Element> = document.querySelectorAll(".removeButton");
for (const iterator of elementList2)
iterator.addEventListener("click", removeDataNR);
let elementList3: NodeListOf<Element> = document.querySelectorAll(".editOne");
for (const iterator of elementList3)
iterator.addEventListener("click", editData);
}
async function removeDataID(_event: Event): Promise<void> {
await removeData(_event, "id");
}
async function removeDataNR(_event: Event): Promise<void> {
await removeData(_event, "order");
}
async function removeData(_event: Event, _parameter: string): Promise<void> {
let target: HTMLElement = (<HTMLElement>_event.target);
let query: string = "";
if (_parameter == "id")
query = `_id=${target.getAttribute("content")!}`;
else if (_parameter == "order")
query = `Nr=${target.getAttribute("content")!}`;
console.log(query);
let url: string = serverUrl + "/mongo/orders/removeEntry/?" + query;
await fetch(url);
location.reload();
}
function editData(_event: Event): void {
let target: HTMLElement = (<HTMLElement>_event.target);
let obj: Products = JSON.parse(target.getAttribute("content")!);
let div: HTMLDivElement = document.createElement("div");
div.setAttribute("id", "formDiv");
div.innerHTML = `<form id="myForm"></form>`;
if ((<HTMLFormElement>document.querySelector("#myForm")) != null)
(<HTMLDivElement>document.querySelector("#tableDiv")).removeChild(div);
(<HTMLDivElement>document.querySelector("#tableDiv")).append(div);
for (const iterator in obj) {
let label: HTMLLabelElement = document.createElement("label");
label.setAttribute("for", iterator);
label.innerHTML = `${iterator}`;
let input: HTMLInputElement = document.createElement("input");
input.setAttribute("type", "text");
input.setAttribute("name", `${iterator}`);
input.setAttribute("id", `${iterator}`);
input.setAttribute("value", <string>obj[iterator]);
if (iterator == "_id") {
input.setAttribute("readonly", "");
}
else {
input.setAttribute("onfocus", `if(this.value == "${<string>obj[iterator]}") this.value=""`);
input.setAttribute("onblur", `if(this.value == "") this.value="${<string>obj[iterator]}"`);
}
(<HTMLLabelElement>document.querySelector("#myForm")).append(label);
(<HTMLInputElement>document.querySelector("#myForm")).append(input);
}
let button: HTMLButtonElement = document.createElement("button");
button.setAttribute("id", "setAttribute");
button.innerHTML = "Bestätigung";
button.addEventListener("click", confirmForm);
(<HTMLInputElement>document.querySelector("#myForm")).append(button);
}
async function confirmForm(): Promise<void> {
let formData: FormData = new FormData(document.forms[0]);
let url: string = "";
//tslint:disable-next-line: no-any
let query: URLSearchParams = new URLSearchParams(<any>formData);
url = serverUrl + "/" + "mongo" + "/" + "orders" + "/" + "updateEntry" + "/" + "?" + query.toString();
await fetch(url);
}
function fixCartCount(): void {
if (localStorage["CartCount"] != undefined)
localStorage.removeItem("CartCount");
let count: number = 0;
for (const key in localStorage) {
if (key.includes("Combination")) {
count++;
}
}
localStorage.setItem("CartCount", `${count}`);
(<HTMLElement>document.querySelector("#warenkorb span")).innerHTML = `${localStorage.CartCount}`;
}
}

View File

@ -0,0 +1,18 @@
"use strict";
var frontShop;
(function (frontShop) {
fixCartCount();
function fixCartCount() {
if (localStorage["CartCount"] != undefined)
localStorage.removeItem("CartCount");
let count = 0;
for (const key in localStorage) {
if (key.includes("Combination")) {
count++;
}
}
localStorage.setItem("CartCount", `${count}`);
document.querySelector("#warenkorb span").innerHTML = `${localStorage.CartCount}`;
}
})(frontShop || (frontShop = {}));
//# sourceMappingURL=index.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";AACA,IAAU,SAAS,CAiBlB;AAjBD,WAAU,SAAS;IAEf,YAAY,EAAE,CAAC;IAEf,SAAS,YAAY;QACjB,IAAI,YAAY,CAAC,WAAW,CAAC,IAAI,SAAS;YACtC,YAAY,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;QACzC,IAAI,KAAK,GAAW,CAAC,CAAC;QACtB,KAAK,MAAM,GAAG,IAAI,YAAY,EAAE;YAC5B,IAAI,GAAG,CAAC,QAAQ,CAAC,aAAa,CAAC,EAAE;gBAC7B,KAAK,EAAE,CAAC;aACX;SACJ;QACD,YAAY,CAAC,OAAO,CAAC,WAAW,EAAE,GAAG,KAAK,EAAE,CAAC,CAAC;QAChC,QAAQ,CAAC,aAAa,CAAC,iBAAiB,CAAE,CAAC,SAAS,GAAG,GAAG,YAAY,CAAC,SAAS,EAAE,CAAC;IACrG,CAAC;AAEL,CAAC,EAjBS,SAAS,KAAT,SAAS,QAiBlB"}

View File

@ -0,0 +1,19 @@
namespace frontShop {
fixCartCount();
function fixCartCount(): void {
if (localStorage["CartCount"] != undefined)
localStorage.removeItem("CartCount");
let count: number = 0;
for (const key in localStorage) {
if (key.includes("Combination")) {
count++;
}
}
localStorage.setItem("CartCount", `${count}`);
(<HTMLElement>document.querySelector("#warenkorb span")).innerHTML = `${localStorage.CartCount}`;
}
}

View File

@ -0,0 +1,26 @@
"use strict";
// Konzept-Idee: https://www.w3schools.com/howto/howto_js_slideshow_gallery.asp
let pictureNames = ["GiSBeLike.png", "ItWasAllAMystery.png", "JsTs.png", "LearningTsBeLike.png"];
document.querySelector("#buttonLeft").addEventListener("click", previousImage);
document.querySelector("#buttonRight").addEventListener("click", nextImage);
function nextImage() {
changeImage(1);
}
function previousImage() {
changeImage(-1);
}
function changeImage(_vorzeichen) {
for (const iterator of pictureNames) {
let currentImage = document.querySelector("#imageBox img").getAttribute("src");
if (iterator == currentImage) {
if (pictureNames.indexOf(iterator) == pictureNames.length - 1 && _vorzeichen == +1)
document.querySelector("#imageBox img").setAttribute("src", `images/${pictureNames[0]}`);
else if (pictureNames.indexOf(iterator) == 0 && _vorzeichen == -1)
document.querySelector("#imageBox img").setAttribute("src", `images/${pictureNames[pictureNames.length - 1]}`);
else
document.querySelector("#imageBox img").setAttribute("src", `images/${pictureNames[pictureNames.indexOf(iterator) + _vorzeichen]}`);
break;
}
}
}
//# sourceMappingURL=memes.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"memes.js","sourceRoot":"","sources":["memes.ts"],"names":[],"mappings":";AAAA,+EAA+E;AAE/E,IAAI,YAAY,GAAa,CAAC,eAAe,EAAE,sBAAsB,EAAE,UAAU,EAAE,sBAAsB,CAAC,CAAC;AAE3G,QAAQ,CAAC,aAAa,CAAC,aAAa,CAAE,CAAC,gBAAgB,CAAC,OAAO,EAAE,aA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BeLike.png", "ItWasAllAMystery.png", "JsTs.png", "LearningTsBeLike.png"];
document.querySelector("#buttonLeft")!.addEventListener("click", previousImage);
document.querySelector("#buttonRight")!.addEventListener("click", nextImage);
function nextImage(): void {
changeImage(1);
}
function previousImage(): void {
changeImage(-1);
}
function changeImage(_vorzeichen: number): void {
for (const iterator of pictureNames) {
let currentImage: string = (<string>document.querySelector("#imageBox img")!.getAttribute("src"));
if (iterator == currentImage) {
if (pictureNames.indexOf(iterator) == pictureNames.length - 1 && _vorzeichen == +1)
document.querySelector("#imageBox img")!.setAttribute("src", `images/${pictureNames[0]}`);
else if (pictureNames.indexOf(iterator) == 0 && _vorzeichen == -1)
document.querySelector("#imageBox img")!.setAttribute("src", `images/${pictureNames[pictureNames.length - 1]}`);
else
document.querySelector("#imageBox img")!.setAttribute("src", `images/${pictureNames[pictureNames.indexOf(iterator) + _vorzeichen]}`);
break;
}
}
}

View File

@ -0,0 +1,143 @@
"use strict";
var frontShop;
(function (frontShop) {
let serverUrl = "https://theoneandgis.herokuapp.com";
let combinationArray = [];
let combinationCount = 0;
let tisch = "";
// create page
init();
async function init() {
printTopButtons();
await getProductList();
addButtonFunctions();
fixCartCount();
}
function printTopButtons() {
for (let i = 1; i <= 20; i++) {
let button = document.createElement("button");
button.setAttribute("id", "id_table_" + `${i}`);
button.setAttribute("content", `{"tisch":"${i}"}`);
button.classList.add("product_button");
button.innerHTML = `Tisch: ${i}`;
document.querySelector("#topTable").append(button);
}
let button = document.createElement("button");
button.setAttribute("id", "id_table_0");
button.setAttribute("content", `{"tisch":"0"}`);
button.innerHTML = "Zum Mitnehmen!";
document.querySelector("#topTake").append(button);
}
async function getProductList() {
let url = serverUrl + "/mongo/products/findCollection" + "?";
let response = await fetch(url);
let jsonResponse = await response.json();
printProducts(jsonResponse);
}
function printProducts(_jsonResponse) {
for (const iterator of _jsonResponse) {
delete iterator._id;
document.querySelector(`#${iterator.category}Div`).innerHTML += `
<div class="${iterator.category}">
<img src="images/${iterator.imageName}" alt="Product"/><br>
<div class="product_name">${iterator.name.replace("-", " ")}</div>
<button class="product_button" content=${JSON.stringify(iterator)}>Hinzufügen</button>
</div>
`;
}
}
function addButtonFunctions() {
let buttonList = document.querySelectorAll(".product_button");
for (const iterator of buttonList)
iterator.addEventListener("click", addProduct);
document.querySelector("#id_table_0").addEventListener("click", addProduct);
document.querySelector("#nextButton").addEventListener("click", addCurrent);
document.querySelector("#sendButton").addEventListener("click", addToLocal);
document.querySelector("#resetButton").addEventListener("click", clearCombination);
}
function addProduct(_event) {
let target = _event.target;
let product = JSON.parse(target.getAttribute("content"));
if (product.tisch != undefined) {
tisch = JSON.stringify(product);
console.log(tisch);
}
switch (product.category) {
case "container": {
if (checkMaximum(1, product)) {
let index = combinationArray.indexOf(combinationArray.find(_element => _element = product.category));
combinationArray[index] = JSON.stringify(product);
displayOrder();
}
else {
combinationArray.push(JSON.stringify(product));
displayOrder();
}
break;
}
case "flavour": {
if (!checkMaximum(6, product)) {
combinationArray.push(JSON.stringify(product));
displayOrder();
}
break;
}
case "topping": {
if (!checkMaximum(3, product)) {
combinationArray.push(JSON.stringify(product));
displayOrder();
}
break;
}
}
console.log("combinationArray", combinationArray);
}
function checkMaximum(_maximum, _targetString) {
let countOccurence = 0;
for (let i = 0; i < combinationArray.length; i++) {
let checkString = combinationArray[i];
if (checkString.includes(_targetString.category))
countOccurence++;
if (countOccurence == _maximum) {
alert("Die maximale Anzahl von " + _maximum + " wurde bereits erreicht");
return true;
}
}
return false;
}
function addCurrent() {
addToLocal();
clearCombination();
fixCartCount();
combinationCount++;
}
function clearCombination() {
combinationArray = [];
displayOrder();
}
function fixCartCount() {
if (localStorage["CartCount"] != undefined)
localStorage.removeItem("CartCount");
let count = 0;
for (const key in localStorage) {
if (key.includes("Combination")) {
count++;
}
}
localStorage.setItem("CartCount", `${count}`);
document.querySelector("#warenkorb span").innerHTML = `${localStorage.CartCount}`;
}
function addToLocal() {
combinationArray.push(tisch);
localStorage.setItem(`Combination${combinationCount}`, "[" + combinationArray.toLocaleString() + "]");
}
function displayOrder() {
document.querySelector("#displayContainer").innerHTML = "";
for (let i = combinationArray.length - 1; i > -1; i--) {
console.log(combinationArray[i]);
let obj = JSON.parse(combinationArray[i]);
document.querySelector("#displayContainer").innerHTML += `<img src="images/${obj.imageName}" alt=""/>`;
}
}
})(frontShop || (frontShop = {}));
//# sourceMappingURL=shop.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"shop.js","sourceRoot":"","sources":["shop.ts"],"names":[],"mappings":";AACA,IAAU,SAAS,CAiKlB;AAjKD,WAAU,SAAS;IAEf,IAAI,SAAS,GAAW,oCAAoC,CAAC;IAC7D,IAAI,gBAAgB,GAAa,EAAE,CAAC;IACpC,IAAI,gBAAgB,GAAW,CAAC,CAAC;IACjC,IAAI,KAAK,GAAW,EAAE,CAAC;IAMvB,cAAc;IAEd,IAAI,EAAE,CAAC;IAEP,KAAK,UAAU,IAAI;QACf,eAAe,EAAE,CAAC;QAClB,MAAM,cAAc,EAAE,CAAC;QACvB,kBAAkB,EAAE,CAAC;QACrB,YAAY,EAAE,CAAC;IACnB,CAAC;IAED,SAAS,eAAe;QACpB,KAAK,IAAI,CAAC,GAAW,CAAC,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,EAAE,EAAE;YAClC,IAAI,MAAM,GAAsB,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;YACjE,MAAM,CAAC,YAAY,CAAC,IAAI,EAAE,WAAW,GAAG,GAAG,CAAC,EAAE,CAAC,CAAC;YAChD,MAAM,CAAC,YAAY,CAAC,SAAS,EAAE,aAAa,CAAC,IAAI,CAAC,CAAC;YACnD,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;YACvC,MAAM,CAAC,SAAS,GAAG,UAAU,CAAC,EAAE,CAAC;YAChB,QAAQ,CAAC,aAAa,CAAC,WAAW,CAAE,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;SACxE;QACD,IA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gis.herokuapp.com";
let combinationArray: string[] = [];
let combinationCount: number = 0;
let tisch: string = "";
interface Products {
[type: string]: string | number;
}
// create page
init();
async function init(): Promise<void> {
printTopButtons();
await getProductList();
addButtonFunctions();
fixCartCount();
}
function printTopButtons(): void {
for (let i: number = 1; i <= 20; i++) {
let button: HTMLButtonElement = document.createElement("button");
button.setAttribute("id", "id_table_" + `${i}`);
button.setAttribute("content", `{"tisch":"${i}"}`);
button.classList.add("product_button");
button.innerHTML = `Tisch: ${i}`;
(<HTMLDivElement>document.querySelector("#topTable")).append(button);
}
let button: HTMLButtonElement = document.createElement("button");
button.setAttribute("id", "id_table_0");
button.setAttribute("content", `{"tisch":"0"}`);
button.innerHTML = "Zum Mitnehmen!";
(<HTMLDivElement>document.querySelector("#topTake")).append(button);
}
async function getProductList(): Promise<void> {
let url: string = serverUrl + "/mongo/products/findCollection" + "?";
let response: Response = await fetch(url);
let jsonResponse: Products[] = await response.json();
printProducts(jsonResponse);
}
function printProducts(_jsonResponse: Products[]): void {
for (const iterator of _jsonResponse) {
delete iterator._id;
(<HTMLElement>document.querySelector(`#${iterator.category}Div`)).innerHTML += `
<div class="${iterator.category}">
<img src="images/${iterator.imageName}" alt="Product"/><br>
<div class="product_name">${(<string>iterator.name).replace("-", " ")}</div>
<button class="product_button" content=${JSON.stringify(iterator)}>Hinzufügen</button>
</div>
`;
}
}
function addButtonFunctions(): void {
let buttonList: NodeListOf<HTMLButtonElement> = document.querySelectorAll(".product_button");
for (const iterator of buttonList)
iterator.addEventListener("click", addProduct);
(<HTMLButtonElement>document.querySelector("#id_table_0")).addEventListener("click", addProduct);
(<HTMLButtonElement>document.querySelector("#nextButton")).addEventListener("click", addCurrent);
(<HTMLButtonElement>document.querySelector("#sendButton")).addEventListener("click", addToLocal);
(<HTMLButtonElement>document.querySelector("#resetButton")).addEventListener("click", clearCombination);
}
function addProduct(_event: Event): void {
let target: HTMLElement = (<HTMLElement>_event.target);
let product: Products = JSON.parse(target.getAttribute("content")!);
if (product.tisch != undefined) {
tisch = JSON.stringify(product);
console.log(tisch);
}
switch (product.category) {
case "container": {
if (checkMaximum(1, product)) {
let index: number = combinationArray.indexOf(combinationArray.find(_element => _element = <string>product.category)!);
combinationArray[index] = JSON.stringify(product);
displayOrder();
}
else {
combinationArray.push(JSON.stringify(product));
displayOrder();
}
break;
}
case "flavour": {
if (!checkMaximum(6, product)) {
combinationArray.push(JSON.stringify(product));
displayOrder();
}
break;
}
case "topping": {
if (!checkMaximum(3, product)) {
combinationArray.push(JSON.stringify(product));
displayOrder();
}
break;
}
}
console.log("combinationArray", combinationArray);
}
function checkMaximum(_maximum: number, _targetString: Products): boolean {
let countOccurence: number = 0;
for (let i: number = 0; i < combinationArray.length; i++) {
let checkString: string = combinationArray[i];
if (checkString.includes(<string>_targetString.category))
countOccurence++;
if (countOccurence == _maximum) {
alert("Die maximale Anzahl von " + _maximum + " wurde bereits erreicht");
return true;
}
}
return false;
}
function addCurrent(): void {
addToLocal();
clearCombination();
fixCartCount();
combinationCount++;
}
function clearCombination(): void {
combinationArray = [];
displayOrder();
}
function fixCartCount(): void {
if (localStorage["CartCount"] != undefined)
localStorage.removeItem("CartCount");
let count: number = 0;
for (const key in localStorage) {
if (key.includes("Combination")) {
count++;
}
}
localStorage.setItem("CartCount", `${count}`);
(<HTMLElement>document.querySelector("#warenkorb span")).innerHTML = `${localStorage.CartCount}`;
}
function addToLocal(): void {
combinationArray.push(tisch);
localStorage.setItem(`Combination${combinationCount}`, "[" + combinationArray.toLocaleString() + "]");
}
function displayOrder(): void {
(<HTMLElement>document.querySelector("#displayContainer")).innerHTML = "";
for (let i: number = combinationArray.length - 1; i > -1; i--) {
console.log(combinationArray[i]);
let obj: Products = JSON.parse(combinationArray[i]);
(<HTMLElement>document.querySelector("#displayContainer")).innerHTML += `<img src="images/${obj.imageName}" alt=""/>`;
}
}
}

View File

@ -0,0 +1,131 @@
"use strict";
var frontShop;
(function (frontShop) {
let serverUrl = "https://theoneandgis.herokuapp.com";
let orderArray = [];
let orderPrice = 0;
let orderNumber = 0;
init();
async function init() {
await setOrder();
await addButtonListener();
fixCartCount();
}
async function setOrder() {
//let formData: FormData = new FormData(document.forms[0]);
orderNumber = await getNumber();
for (const key in localStorage) {
if (localStorage.getItem(key) != null && key.includes("Combination")) {
let content = localStorage.getItem(key);
let contentObj = await JSON.parse(content);
let contentString = "{";
let countFlavour = 1;
let countTopping = 1;
let countPrice = 0;
let div = document.createElement("div");
div.classList.add("product");
div.innerHTML = ``;
for (const keys of contentObj)
if (keys.category == "container") {
contentString += `"container"` + ":" + `"${keys.name}"` + ",";
div.innerHTML += `<span>Behälter: ${keys.name}</span><br>`;
}
for (const keys of contentObj)
if (keys.category == "flavour") {
contentString += `"flavour${countFlavour}"` + ":" + `"${keys.name}"` + ",";
div.innerHTML += `<span>Kugel Nr. ${countFlavour}: ${keys.name}</span><br>`;
countFlavour++;
}
for (const keys of contentObj)
if (keys.category == "topping") {
contentString += `"topping${countTopping}"` + ":" + `"${keys.name}"` + ",";
div.innerHTML += `<span>Topping Nr. ${countTopping}: ${keys.name}</span><br>`;
countTopping++;
}
for (const keys of contentObj) {
if (keys.price != undefined) {
orderPrice += keys.price;
countPrice += keys.price;
}
}
for (const keys of contentObj) {
if (keys.tisch != undefined) {
contentString += `"tisch"` + ":" + `"${keys.tisch}"` + ",";
}
}
contentString += `"productPrice"` + ":" + `"${countPrice.toFixed(2)}"` + "," + `"Nr"` + ":" + `"${orderNumber}"` + ",";
//contentString += `"vorname"` + ":" + `"${formData.get("vorname")}"` + "," + `"nachname"` + ":" + `"${formData.get("nachname")}"` + ",";
//contentString += `"straße"` + ":" + `"${formData.get("straße")}"` + "," + `"postleitzahl"` + ":" + `"${formData.get("postleitzahl")}"` + ",";
contentString = contentString.slice(0, contentString.length - 1) + "}";
div.innerHTML += `<button class="removeButton" arrayIndex="${orderArray.length}" localName="${key}">Kombination Nr. ${orderArray.length + 1} entfernen</button>`;
orderArray.push(contentString);
document.querySelector("#check").append(div);
//(<HTMLDivElement>document.querySelector("#check")).innerHTML += contentString + "<br><br>";
}
}
}
/*async function saveForm(): Promise<void> {
let formData: FormData = new FormData(document.forms[0]);
let url: string = "";
//tslint:disable-next-line: no-any
let query: URLSearchParams = new URLSearchParams(<any>formData);
url = "http://localhost:8100" + "/" + "mongo" + "/" + "orders" + "/" + "insertEntry" + "/" + "?" + query.toString();
await fetch(url);
}*/
async function confirmOrder() {
let formData = new FormData(document.forms[0]);
let url = "";
//tslint:disable-next-line: no-any
let query = new URLSearchParams(formData);
url = serverUrl + "/" + "mongo" + "/" + "orders" + "/" + "insertEntry" + "/" + "?" + query.toString() + `&Nr=${orderNumber}` + `&orderPrice=${orderPrice.toFixed(2)}`;
await fetch(url);
for (const iterator of orderArray) {
await fetch(serverUrl, {
method: "POST",
headers: {
"Content-Type": "text/plain"
},
body: iterator
});
}
orderNumber++;
await fetch(serverUrl + "/mongo/orders/updateEntry" + "?_id=5f1a48d7a8f957baaa07cfeb&orderCount=" + orderNumber.toString());
localStorage.clear();
location.reload();
alert("Ihre Bestellung wurde eingereicht. Bitte melden Sie sich am Tresen, sobald Ihre Nummer aufgerufen wird! ♥");
}
async function getNumber() {
let response = await fetch(serverUrl + "/mongo/orders/findEntry?_id=5f1a48d7a8f957baaa07cfeb");
let orderObj = await response.json();
let orderObjNumber = parseFloat(orderObj.orderCount);
return orderObjNumber;
}
async function addButtonListener() {
//(<HTMLElement>document.querySelector("#printOrder")).addEventListener("click", setOrder);
document.querySelector("#sendOrder").addEventListener("click", confirmOrder);
//(<HTMLElement>document.querySelector("#formButton")).addEventListener("click", saveForm);
let elementList = document.querySelectorAll(".removeButton");
for (const iterator of elementList)
iterator.addEventListener("click", removeCombination);
}
function removeCombination(_event) {
localStorage.setItem("CartCount", `${parseFloat(localStorage.getItem("CartCount")) - 1}`);
let target = _event.target;
delete orderArray[parseFloat(target.getAttribute("arrayindex"))];
localStorage.removeItem(target.getAttribute("localname"));
location.reload();
}
function fixCartCount() {
if (localStorage["CartCount"] != undefined)
localStorage.removeItem("CartCount");
let count = 0;
for (const key in localStorage) {
if (key.includes("Combination")) {
count++;
}
}
localStorage.setItem("CartCount", `${count}`);
document.querySelector("#warenkorb span").innerHTML = `${localStorage.CartCount}`;
}
})(frontShop || (frontShop = {}));
//# sourceMappingURL=warenkorb.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"warenkorb.js","sourceRoot":"","sources":["warenkorb.ts"],"names":[],"mappings":";AACA,IAAU,SAAS,CAiJlB;AAjJD,WAAU,SAAS;IAEf,IAAI,SAAS,GAAW,oCAAoC,CAAC;IAC7D,IAAI,UAAU,GAAa,EAAE,CAAC;IAC9B,IAAI,UAAU,GAAW,CAAC,CAAC;IAC3B,IAAI,WAAW,GAAW,CAAC,CAAC;IAE5B,IAAI,EAAE,CAAC;IAEP,KAAK,UAAU,IAAI;QACf,MAAM,QAAQ,EAAE,CAAC;QACjB,MAAM,iBAAiB,EAAE,CAAC;QAC1B,YAAY,EAAE,CAAC;IACnB,CAAC;IAMD,KAAK,UAAU,QAAQ;QACnB,2DAA2D;QAC3D,WAAW,GAAG,MAAM,SAAS,EAAE,CAAC;QAChC,KAAK,MAAM,GAAG,IAAI,YAAY,EAAE;YAC5B,IAAI,YAAY,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,IAAI,IAAI,GAAG,CAAC,QAAQ,CAAC,aAAa,CAAC,EAAE;gBAClE,IAAI,OAAO,GAAW,YAAY,CAAC,OAAO,CAAC,GAAG,CAAE,CAAC;gBACjD,IAAI,UAAU,GAAe,MAAM,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;gBACvD,IAAI,aAAa,GAAW,GAAG,CAAC;gBAChC,IAAI,YAAY,GAAW,CAAC,CAAC;gBAC7B,IAAI,YAAY,GAAW,CAAC,CAAC;gBAC7B,IAAI,UAAU,GAAW,CAAC,CAAC;gBAE3B,IAAI,GAAG,GAAmB,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;gBACxD,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AAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAC3F,IAAI,MAAM,GAA8B,MAAM,CAAC,MAAO,CAAC;QACvD,OAAO,UAAU,CAAC,UAAU,CAAC,MAAM,CAAC,YAAY,CAAC,YAAY,CAAE,CAAC,CAAC,CAAC;QAClE,YAAY,CAAC,UAAU,CAAC,MAAM,CAAC,YAAY,CAAC,WAAW,CAAE,CAAC,CAAE;QAC5D,QAAQ,CAAC,MAAM,EAAE,CAAC;IACtB,CAAC;IAED,SAAS,YAAY;QACjB,IAAI,YAAY,CAAC,WAAW,CAAC,IAAI,SAAS;YACtC,YAAY,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;QACzC,IAAI,KAAK,GAAW,CAAC,CAAC;QACtB,KAAK,MAAM,GAAG,IAAI,YAAY,EAAE;YAC5B,IAAI,GAAG,CAAC,QAAQ,CAAC,aAAa,CAAC,EAAE;gBAC7B,KAAK,EAAE,CAAC;aACX;SACJ;QACD,YAAY,CAAC,OAAO,CAAC,WAAW,EAAE,GAAG,KAAK,EAAE,CAAC,CAAC;QAChC,QAAQ,CAAC,aAAa,CAAC,iBAAiB,CAAE,CAAC,SAAS,GAAG,GAAG,YAAY,CAAC,SAAS,EAAE,CAAC;IACrG,CAAC;AACL,CAAC,EAjJS,SAAS,KAAT,SAAS,QAiJlB"}

View File

@ -0,0 +1,147 @@
namespace frontShop {
let serverUrl: string = "https://theoneandgis.herokuapp.com";
let orderArray: string[] = [];
let orderPrice: number = 0;
let orderNumber: number = 0;
init();
async function init(): Promise<void> {
await setOrder();
await addButtonListener();
fixCartCount();
}
interface Products {
[type: string]: string | number;
}
async function setOrder(): Promise<void> {
//let formData: FormData = new FormData(document.forms[0]);
orderNumber = await getNumber();
for (const key in localStorage) {
if (localStorage.getItem(key) != null && key.includes("Combination")) {
let content: string = localStorage.getItem(key)!;
let contentObj: Products[] = await JSON.parse(content);
let contentString: string = "{";
let countFlavour: number = 1;
let countTopping: number = 1;
let countPrice: number = 0;
let div: HTMLDivElement = document.createElement("div");
div.classList.add("product");
div.innerHTML = ``;
for (const keys of contentObj)
if (keys.category == "container") {
contentString += `"container"` + ":" + `"${keys.name}"` + ",";
div.innerHTML += `<span>Behälter: ${keys.name}</span><br>`;
}
for (const keys of contentObj)
if (keys.category == "flavour") {
contentString += `"flavour${countFlavour}"` + ":" + `"${keys.name}"` + ",";
div.innerHTML += `<span>Kugel Nr. ${countFlavour}: ${keys.name}</span><br>`;
countFlavour++;
}
for (const keys of contentObj)
if (keys.category == "topping") {
contentString += `"topping${countTopping}"` + ":" + `"${keys.name}"` + ",";
div.innerHTML += `<span>Topping Nr. ${countTopping}: ${keys.name}</span><br>`;
countTopping++;
}
for (const keys of contentObj) {
if (keys.price != undefined) {
orderPrice += <number>keys.price;
countPrice += <number>keys.price;
}
}
for (const keys of contentObj) {
if (keys.tisch != undefined) {
contentString += `"tisch"` + ":" + `"${keys.tisch}"` + ",";
}
}
contentString += `"productPrice"` + ":" + `"${countPrice.toFixed(2)}"` + "," + `"Nr"` + ":" + `"${orderNumber}"` + ",";
//contentString += `"vorname"` + ":" + `"${formData.get("vorname")}"` + "," + `"nachname"` + ":" + `"${formData.get("nachname")}"` + ",";
//contentString += `"straße"` + ":" + `"${formData.get("straße")}"` + "," + `"postleitzahl"` + ":" + `"${formData.get("postleitzahl")}"` + ",";
contentString = contentString.slice(0, contentString.length - 1) + "}";
div.innerHTML += `<button class="removeButton" arrayIndex="${orderArray.length}" localName="${key}">Kombination Nr. ${orderArray.length + 1} entfernen</button>`;
orderArray.push(contentString);
(<HTMLDivElement>document.querySelector("#check")).append(div);
//(<HTMLDivElement>document.querySelector("#check")).innerHTML += contentString + "<br><br>";
}
}
}
/*async function saveForm(): Promise<void> {
let formData: FormData = new FormData(document.forms[0]);
let url: string = "";
//tslint:disable-next-line: no-any
let query: URLSearchParams = new URLSearchParams(<any>formData);
url = "http://localhost:8100" + "/" + "mongo" + "/" + "orders" + "/" + "insertEntry" + "/" + "?" + query.toString();
await fetch(url);
}*/
async function confirmOrder(): Promise<void> {
let formData: FormData = new FormData(document.forms[0]);
let url: string = "";
//tslint:disable-next-line: no-any
let query: URLSearchParams = new URLSearchParams(<any>formData);
url = serverUrl + "/" + "mongo" + "/" + "orders" + "/" + "insertEntry" + "/" + "?" + query.toString() + `&Nr=${orderNumber}` + `&orderPrice=${orderPrice.toFixed(2)}`;
await fetch(url);
for (const iterator of orderArray) {
await fetch(serverUrl, {
method: "POST",
headers: {
"Content-Type": "text/plain"
},
body: iterator
});
}
orderNumber++;
await fetch( serverUrl + "/mongo/orders/updateEntry" + "?_id=5f1a48d7a8f957baaa07cfeb&orderCount=" + orderNumber.toString());
localStorage.clear();
location.reload();
alert("Ihre Bestellung wurde eingereicht. Bitte melden Sie sich am Tresen, sobald Ihre Nummer aufgerufen wird! ♥");
}
async function getNumber(): Promise<number> {
let response: Response = await fetch(serverUrl + "/mongo/orders/findEntry?_id=5f1a48d7a8f957baaa07cfeb");
let orderObj: Products = await response.json();
let orderObjNumber: number = parseFloat(<string>orderObj.orderCount);
return orderObjNumber;
}
async function addButtonListener(): Promise<void> {
//(<HTMLElement>document.querySelector("#printOrder")).addEventListener("click", setOrder);
(<HTMLElement>document.querySelector("#sendOrder")).addEventListener("click", confirmOrder);
//(<HTMLElement>document.querySelector("#formButton")).addEventListener("click", saveForm);
let elementList: NodeListOf<Element> = document.querySelectorAll(".removeButton");
for (const iterator of elementList)
iterator.addEventListener("click", removeCombination);
}
function removeCombination(_event: Event): void {
localStorage.setItem("CartCount", `${parseFloat(localStorage.getItem("CartCount")!) - 1}`);
let target: HTMLElement = (<HTMLElement>_event.target);
delete orderArray[parseFloat(target.getAttribute("arrayindex")!)];
localStorage.removeItem(target.getAttribute("localname")!) ;
location.reload();
}
function fixCartCount(): void {
if (localStorage["CartCount"] != undefined)
localStorage.removeItem("CartCount");
let count: number = 0;
for (const key in localStorage) {
if (key.includes("Combination")) {
count++;
}
}
localStorage.setItem("CartCount", `${count}`);
(<HTMLElement>document.querySelector("#warenkorb span")).innerHTML = `${localStorage.CartCount}`;
}
}

View File

@ -10,7 +10,7 @@
},
"devDependencies": {},
"scripts": {
"start": "node Endabgabe/backend/useServer.js remote"
"start": "node Endabgabe/script-backend/useServer.js remote"
},
"repository": {
"type": "git",