Endabgabe First Commit
|
@ -1,6 +1,5 @@
|
||||||
node_modules/
|
node_modules/
|
||||||
package-lock.json
|
package-lock.json
|
||||||
Endabgabe/
|
|
||||||
mongodb/
|
mongodb/
|
||||||
data/
|
data/
|
||||||
|
|
||||||
|
|
|
@ -6,11 +6,11 @@ var clientSide;
|
||||||
(function (clientSide) {
|
(function (clientSide) {
|
||||||
document.querySelector("#abschicken").addEventListener("click", sendData);
|
document.querySelector("#abschicken").addEventListener("click", sendData);
|
||||||
function sendData() {
|
function sendData() {
|
||||||
communicate("https://theoneandgis.herokuapp.com", "mongo", "send", "");
|
communicate("http://localhost:8100", "mongo", "send", "");
|
||||||
}
|
}
|
||||||
document.querySelector("#abfragen").addEventListener("click", retrieveData);
|
document.querySelector("#abfragen").addEventListener("click", retrieveData);
|
||||||
function retrieveData() {
|
function retrieveData() {
|
||||||
communicate("https://theoneandgis.herokuapp.com", "mongo", "retrieve", "");
|
communicate("http://localhost:8100", "mongo", "retrieve", "");
|
||||||
}
|
}
|
||||||
function removeData(_event) {
|
function removeData(_event) {
|
||||||
let target = _event.target;
|
let target = _event.target;
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
{"version":3,"file":"client.js","sourceRoot":"","sources":["client.ts"],"names":[],"mappings":";AAAA,gIAAgI;AAChI,uBAAuB;AACvB,oCAAoC;AAEpC,IAAU,UAAU,CA+EnB;AA/ED,WAAU,UAAU;IAMI,QAAQ,CAAC,aAAa,CAAC,aAAa,CAAE,CAAC,gBAAgB,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;IAC/F,SAAS,QAAQ;QACb,WAAW,CAAC,oCAAoC,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,CAAC,CAAC;IAC3E,CAAC;IAEmB,QAAQ,CAAC,aAAa,CAAC,WAAW,CAAE,CAAC,gBAAgB,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;IACjG,SAAS,YAAY;QACjB,WAAW,CAAC,oCAAoC,EAAE,OAAO,EAAE,UAA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;QACD,OAAO,UAAU,CAAC;IACtB,CAAC;IAED,SAAS,iBAAiB;QACtB,IAAI,aAAa,GAAkC,QAAQ,CAAC,gBAAgB,CAAC,eAAe,CAAC,CAAC;QAC9F,KAAK,MAAM,QAAQ,IAAI,aAAa;YAChC,QAAQ,CAAC,gBAAgB,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;IACvD,CAAC;AAEL,CAAC,EA/ES,UAAU,KAAV,UAAU,QA+EnB"}
|
|
@ -10,12 +10,12 @@ namespace clientSide {
|
||||||
|
|
||||||
(<HTMLButtonElement>document.querySelector("#abschicken")).addEventListener("click", sendData);
|
(<HTMLButtonElement>document.querySelector("#abschicken")).addEventListener("click", sendData);
|
||||||
function sendData(): void {
|
function sendData(): void {
|
||||||
communicate("https://theoneandgis.herokuapp.com", "mongo", "send", "");
|
communicate("http://localhost:8100", "mongo", "send", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
(<HTMLButtonElement>document.querySelector("#abfragen")).addEventListener("click", retrieveData);
|
(<HTMLButtonElement>document.querySelector("#abfragen")).addEventListener("click", retrieveData);
|
||||||
function retrieveData(): void {
|
function retrieveData(): void {
|
||||||
communicate("https://theoneandgis.herokuapp.com", "mongo", "retrieve", "");
|
communicate("http://localhost:8100", "mongo", "retrieve", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
function removeData(_event: Event): void {
|
function removeData(_event: Event): void {
|
||||||
|
|
|
@ -30,6 +30,8 @@ var ServerSide;
|
||||||
_response.setHeader("content-type", "application/json");
|
_response.setHeader("content-type", "application/json");
|
||||||
_response.setHeader("Access-Control-Allow-Origin", "*");
|
_response.setHeader("Access-Control-Allow-Origin", "*");
|
||||||
if (_request.url.includes("/mongo")) {
|
if (_request.url.includes("/mongo")) {
|
||||||
|
console.log(" myQueryString: ", myQueryString);
|
||||||
|
console.log(" <string>_request.url: ", _request.url);
|
||||||
await mongoAction(_response, myQueryString, _request.url);
|
await mongoAction(_response, myQueryString, _request.url);
|
||||||
}
|
}
|
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AC,EA7DgB,UAAU,GAAV,kBAAU,KAAV,kBAAU,QA6D1B"}
|
|
@ -38,6 +38,8 @@ export namespace ServerSide {
|
||||||
_response.setHeader("Access-Control-Allow-Origin", "*");
|
_response.setHeader("Access-Control-Allow-Origin", "*");
|
||||||
|
|
||||||
if ( (<string>_request.url).includes("/mongo") ) {
|
if ( (<string>_request.url).includes("/mongo") ) {
|
||||||
|
console.log(" myQueryString: ", myQueryString);
|
||||||
|
console.log(" <string>_request.url: ", <string>_request.url);
|
||||||
await mongoAction( _response, myQueryString , (<string>_request.url) );
|
await mongoAction( _response, myQueryString , (<string>_request.url) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
After Width: | Height: | Size: 83 KiB |
|
@ -0,0 +1,14 @@
|
||||||
|
Reiter:
|
||||||
|
• Administrator
|
||||||
|
• Über uns
|
||||||
|
• Kontakt
|
||||||
|
• zu den Artikeln
|
||||||
|
• zum Warenkorb
|
||||||
|
|
||||||
|
Ideen:
|
||||||
|
Sonder-Zusammenstellung mit einer besonderen Zutat
|
||||||
|
|
||||||
|
Anmerkungen:
|
||||||
|
• Eine Zusammenstellung sollte in einem Array gespeichert werden, damit man mehrere bestellen kann
|
||||||
|
• für den Disclaimer könnte eine Transition als hover angewandt werden
|
||||||
|
• Vermutlich ist ein gutes frontend notwendig, um ein anständiged Backend umzusetzen
|
|
@ -0,0 +1,12 @@
|
||||||
|
1) Ich mach mir Gedanken, wie die Hauptseite zunächst aussehen soll
|
||||||
|
|
||||||
|
2) Mitunter bediene ich mich an meiner alten JSON Datei, um eine Übersicht möglicher Produkte anzufertigen
|
||||||
|
→ eine Liste mit wenigen Grundprodukten wurde zu Testzwecken angefertigt
|
||||||
|
|
||||||
|
3) Eine vorsätzliche html wird für erste Versuche un Ansätze erstellt
|
||||||
|
3.1) Diese wird nach einem neuen Design anhand der Main-Page aufgebaut
|
||||||
|
|
||||||
|
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.
|
|
@ -0,0 +1,82 @@
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"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",
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
|
@ -0,0 +1,153 @@
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"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."
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
After Width: | Height: | Size: 556 KiB |
After Width: | Height: | Size: 463 KiB |
After Width: | Height: | Size: 53 KiB |
After Width: | Height: | Size: 351 KiB |
|
@ -0,0 +1,13 @@
|
||||||
|
=> usage
|
||||||
|
|
||||||
|
/mongo || call Database
|
||||||
|
=> /mongo/nameOfCollection
|
||||||
|
|
||||||
|
/nameOfCollection || choose, which Collection you're calling
|
||||||
|
=> /nameOfCollection/furtherCommand
|
||||||
|
|
||||||
|
/findCollection || return a whole collection
|
||||||
|
/findEntry || return a single entry
|
||||||
|
|
||||||
|
/insertEntry || insert a single entry
|
||||||
|
/removeEntry || remove a single entry
|
|
@ -0,0 +1,95 @@
|
||||||
|
"use strict";
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
exports.handleMongo = void 0;
|
||||||
|
const Mongo = require("mongodb");
|
||||||
|
var handleMongo;
|
||||||
|
(function (handleMongo) {
|
||||||
|
let productsCollection;
|
||||||
|
let ordersCollection;
|
||||||
|
let currentCollection;
|
||||||
|
let dbUrl = "";
|
||||||
|
function chooseUrl(_whichDB) {
|
||||||
|
if (_whichDB == "local")
|
||||||
|
dbUrl = "mongodb://127.0.0.1:27017/";
|
||||||
|
if (_whichDB == "remote")
|
||||||
|
dbUrl = "mongodb+srv://AdminForUse:XV8MXEdBYuwXtQnc@ichstudieremitgis-jfrz9.mongodb.net/IchStudiereMitGiS?retryWrites=true&w=majority";
|
||||||
|
}
|
||||||
|
async function connectDB(_whichDB) {
|
||||||
|
chooseUrl(_whichDB);
|
||||||
|
let options = { useNewUrlParser: true, useUnifiedTopology: true };
|
||||||
|
let mongoClient = new Mongo.MongoClient(dbUrl, options);
|
||||||
|
await mongoClient.connect();
|
||||||
|
productsCollection = mongoClient.db("NiceIce").collection("Orders");
|
||||||
|
console.log("Database connection: ", productsCollection != undefined);
|
||||||
|
}
|
||||||
|
handleMongo.connectDB = connectDB;
|
||||||
|
async function connectCollection(_collection) {
|
||||||
|
if (_collection == "products")
|
||||||
|
currentCollection = productsCollection;
|
||||||
|
else if (_collection == "orders")
|
||||||
|
currentCollection = ordersCollection;
|
||||||
|
}
|
||||||
|
handleMongo.connectCollection = connectCollection;
|
||||||
|
function insertEntry(_collection, _order) {
|
||||||
|
connectCollection(_collection);
|
||||||
|
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 });
|
||||||
|
}
|
||||||
|
handleMongo.removeEntry = removeEntry;
|
||||||
|
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 findOneData(_order: Personalien): Promise<void> {
|
||||||
|
let test2: any = await content.findOne(_order);
|
||||||
|
console.log("findOneData: ", test2);
|
||||||
|
//console.log(test2.name);
|
||||||
|
}
|
||||||
|
|
||||||
|
function removeData(_order: Personalien): void {
|
||||||
|
content.remove(_order);
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
})(handleMongo = exports.handleMongo || (exports.handleMongo = {}));
|
||||||
|
//# sourceMappingURL=useMongo.js.map
|
|
@ -0,0 +1 @@
|
||||||
|
{"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,CAAC;IACxC,IAAI,KAAK,GAAW,EAAE,CAAC;IAEvB,SAAS,SAAS,CAAC,QAAgB;QAC/B,IAAI,QAAQ,IAAI,OAAO;YACnB,KAAK,GAAG,4BAA4B,CAAC;QACzC,IAAI,QAAQ,IAAI,QAAQ;YACpB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AiB,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;QAE1C,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE,MAAM,CAAC,CAAC;QACrC;;;;;;;WAOG;IACP,CAAC;IAvBqB,wBAAY,eAuBjC,CAAA;IAEM,KAAK,UAAU,WAAW,CAAC,WAAmB,EAAE,MAAkB;QACrE,iBAAiB,CAAC,WAAW,CAAC,CAAC;QAC/B,IAAI,EAAE,GAAmB,MAAM,CAAC,GAAG,CAAC;QACpC,IAAI,KAAK,GAAmB,IAAI,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;QACnD,MAAM,iBAAiB,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;IACxD,CAAC;IALqB,uBAAW,cAKhC,CAAA;IAEM,KAAK,UAAU,cAAc,CAAC,WAAmB;QACpD,iBAAiB,CAAC,WAAW,CAAC,CAAC;QAC/B,kDAAkD;QAClD,uDAAuD;QACvD,IAAI,eAAe,GAAiB,MAAM,iBAAiB,CAAC,IAAI,EAAE,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC;QACnG,OAAO,eAAe,CAAC;IAC3B,CAAC;IANqB,0BAAc,iBAMnC,CAAA;IAED;;;;;;;;;;;;;;;;;MAiBE;AAEN,CAAC,EAlGgB,WAAW,GAAX,mBAAW,KAAX,mBAAW,QAkG3B"}
|
|
@ -0,0 +1,101 @@
|
||||||
|
import * as Mongo from "mongodb";
|
||||||
|
|
||||||
|
export namespace handleMongo {
|
||||||
|
|
||||||
|
export interface ProduktObj {
|
||||||
|
[type: string]: string | string[] | number | undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
let productsCollection: Mongo.Collection;
|
||||||
|
let ordersCollection: Mongo.Collection;
|
||||||
|
let currentCollection: Mongo.Collection;
|
||||||
|
let dbUrl: string = "";
|
||||||
|
|
||||||
|
function chooseUrl(_whichDB: string): void {
|
||||||
|
if (_whichDB == "local")
|
||||||
|
dbUrl = "mongodb://127.0.0.1:27017/";
|
||||||
|
if (_whichDB == "remote")
|
||||||
|
dbUrl = "mongodb+srv://AdminForUse:XV8MXEdBYuwXtQnc@ichstudieremitgis-jfrz9.mongodb.net/IchStudiereMitGiS?retryWrites=true&w=majority";
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function connectDB(_whichDB: string): Promise<void> { // _url: string
|
||||||
|
chooseUrl(_whichDB);
|
||||||
|
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");
|
||||||
|
console.log("Database connection: ", productsCollection != undefined);
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function connectCollection(_collection: string): Promise<void> {
|
||||||
|
if (_collection == "products")
|
||||||
|
currentCollection = productsCollection;
|
||||||
|
else if (_collection == "orders")
|
||||||
|
currentCollection = ordersCollection;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function insertEntry(_collection: string, _order: ProduktObj): void {
|
||||||
|
connectCollection(_collection);
|
||||||
|
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 });
|
||||||
|
}
|
||||||
|
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
|
||||||
|
async function findOneData(_order: Personalien): Promise<void> {
|
||||||
|
let test2: any = await content.findOne(_order);
|
||||||
|
console.log("findOneData: ", test2);
|
||||||
|
//console.log(test2.name);
|
||||||
|
}
|
||||||
|
|
||||||
|
function removeData(_order: Personalien): void {
|
||||||
|
content.remove(_order);
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,91 @@
|
||||||
|
"use strict";
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
exports.ServerSide = void 0;
|
||||||
|
const Http = require("http");
|
||||||
|
const url = require("url");
|
||||||
|
const useMongo_1 = require("./useMongo");
|
||||||
|
//import {testThis } from "mongo.js";
|
||||||
|
var ServerSide;
|
||||||
|
(function (ServerSide) {
|
||||||
|
console.log("Starting server");
|
||||||
|
let port = Number(process.env.PORT);
|
||||||
|
if (!port)
|
||||||
|
port = 8100;
|
||||||
|
let server = Http.createServer();
|
||||||
|
server.addListener("request", handleRequest);
|
||||||
|
server.addListener("listening", handleListen);
|
||||||
|
server.listen(port);
|
||||||
|
let myArgs = process.argv.slice(2);
|
||||||
|
let whichDB = myArgs[0];
|
||||||
|
useMongo_1.handleMongo.connectDB(whichDB);
|
||||||
|
function handleListen() {
|
||||||
|
console.log("Your server Listening");
|
||||||
|
}
|
||||||
|
async function handleRequest(_request, _response) {
|
||||||
|
console.log("https://theoneandgis.herokuapp.com" + `${_request.url}`);
|
||||||
|
let myData = url.parse(`${_request.url}`, true);
|
||||||
|
let myQuery = myData.query;
|
||||||
|
let myQueryString = JSON.stringify(myQuery);
|
||||||
|
let responseUrlString = _request.url;
|
||||||
|
//let splitString: string = (<string>_request.url).slice(0, 9);
|
||||||
|
let post = {};
|
||||||
|
_response.setHeader("content-type", "application/json");
|
||||||
|
_response.setHeader("Access-Control-Allow-Origin", "*");
|
||||||
|
console.log("_request.method", _request.method);
|
||||||
|
if (_request.method == "POST") {
|
||||||
|
let body = "";
|
||||||
|
_request.on("data", data => {
|
||||||
|
body += data;
|
||||||
|
});
|
||||||
|
_request.on("end", async () => {
|
||||||
|
post = JSON.parse(body);
|
||||||
|
console.log("post: ", post);
|
||||||
|
post = await JSON.parse(body);
|
||||||
|
responseUrlString = "/mongo/orders/insertEntry";
|
||||||
|
handleAction(_request, _response, myQueryString, responseUrlString, post);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
await handleAction(_request, _response, myQueryString, responseUrlString, {});
|
||||||
|
}
|
||||||
|
_response.end();
|
||||||
|
}
|
||||||
|
async function handleAction(_request, _response, _myQueryString, _responseUrlString, _orderObj) {
|
||||||
|
console.log("handleAction", _orderObj);
|
||||||
|
let whichCollection = "products";
|
||||||
|
if (_responseUrlString.includes("/products")) {
|
||||||
|
whichCollection = "products";
|
||||||
|
}
|
||||||
|
if (_responseUrlString.includes("/orders")) {
|
||||||
|
whichCollection = "products";
|
||||||
|
}
|
||||||
|
if (_responseUrlString.includes("/mongo")) {
|
||||||
|
await mongoAction(_response, _myQueryString, whichCollection, _responseUrlString, _orderObj);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
if (_command.includes("/findEntry")) {
|
||||||
|
console.log("/findEntry");
|
||||||
|
}
|
||||||
|
/*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);
|
||||||
|
_response.write(_query); // technically no response
|
||||||
|
}
|
||||||
|
if (_command.includes("/removeEntry")) {
|
||||||
|
await useMongo_1.handleMongo.removeEntry(_whichCollection, myJsonObj);
|
||||||
|
_response.write(`{"":""}`); // technically no response
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})(ServerSide = exports.ServerSide || (exports.ServerSide = {}));
|
||||||
|
//# sourceMappingURL=useServer.js.map
|
|
@ -0,0 +1 @@
|
||||||
|
{"version":3,"file":"useServer.js","sourceRoot":"","sources":["useServer.ts"],"names":[],"mappings":";;;AA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,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,0BAA0B;SACzD;IACL,CAAC;AAEL,CAAC,EA9FgB,UAAU,GAAV,kBAAU,KAAV,kBAAU,QA8F1B"}
|
|
@ -0,0 +1,102 @@
|
||||||
|
import * as Http from "http";
|
||||||
|
import * as url from "url";
|
||||||
|
import { ParsedUrlQuery } from "querystring";
|
||||||
|
import { handleMongo as useMongo } from "./useMongo";
|
||||||
|
|
||||||
|
//import {testThis } from "mongo.js";
|
||||||
|
|
||||||
|
export namespace ServerSide {
|
||||||
|
|
||||||
|
console.log("Starting server");
|
||||||
|
let port: number = Number(process.env.PORT);
|
||||||
|
if (!port)
|
||||||
|
port = 8100;
|
||||||
|
|
||||||
|
let server: Http.Server = Http.createServer();
|
||||||
|
server.addListener("request", handleRequest);
|
||||||
|
server.addListener("listening", handleListen);
|
||||||
|
server.listen(port);
|
||||||
|
|
||||||
|
let myArgs: string[] = process.argv.slice(2);
|
||||||
|
let whichDB: string = myArgs[0];
|
||||||
|
useMongo.connectDB(whichDB);
|
||||||
|
|
||||||
|
function handleListen(): void {
|
||||||
|
console.log("Your server Listening");
|
||||||
|
}
|
||||||
|
|
||||||
|
async function handleRequest(_request: Http.IncomingMessage, _response: Http.ServerResponse): Promise<void> {
|
||||||
|
console.log("https://theoneandgis.herokuapp.com" + `${_request.url}`);
|
||||||
|
|
||||||
|
let myData: url.UrlWithParsedQuery = url.parse(`${_request.url}`, true);
|
||||||
|
let myQuery: ParsedUrlQuery = myData.query;
|
||||||
|
let myQueryString: string = JSON.stringify(myQuery);
|
||||||
|
let responseUrlString: string = <string>_request.url;
|
||||||
|
//let splitString: string = (<string>_request.url).slice(0, 9);
|
||||||
|
let post: useMongo.ProduktObj = {};
|
||||||
|
|
||||||
|
_response.setHeader("content-type", "application/json");
|
||||||
|
_response.setHeader("Access-Control-Allow-Origin", "*");
|
||||||
|
console.log("_request.method", _request.method);
|
||||||
|
if (_request.method == "POST") {
|
||||||
|
let body: string = "";
|
||||||
|
_request.on("data", data => {
|
||||||
|
body += data;
|
||||||
|
});
|
||||||
|
_request.on("end", async () => {
|
||||||
|
post = JSON.parse(body);
|
||||||
|
console.log("post: ", post);
|
||||||
|
post = await JSON.parse(body);
|
||||||
|
responseUrlString = "/mongo/orders/insertEntry";
|
||||||
|
handleAction(_request, _response, myQueryString, responseUrlString, post);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
await handleAction(_request, _response, myQueryString, responseUrlString, {});
|
||||||
|
}
|
||||||
|
|
||||||
|
_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";
|
||||||
|
if ( _responseUrlString.includes("/products") ) {
|
||||||
|
whichCollection = "products";
|
||||||
|
}
|
||||||
|
if (_responseUrlString.includes("/orders")) {
|
||||||
|
whichCollection = "products";
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( _responseUrlString.includes("/mongo") ) {
|
||||||
|
await mongoAction(_response, _myQueryString, whichCollection, _responseUrlString, _orderObj);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function mongoAction(_response: Http.ServerResponse, _query: string, _whichCollection: string, _command: string, _orderObj: useMongo.ProduktObj): Promise<void> {
|
||||||
|
let myJsonObj: useMongo.ProduktObj = JSON.parse(_query);
|
||||||
|
console.log("mongoAction", _orderObj);
|
||||||
|
|
||||||
|
if (_command.includes("/findCollection")) {
|
||||||
|
let value: useMongo.ProduktObj[] = await useMongo.findCollection(_whichCollection);
|
||||||
|
let handlThis: string = JSON.stringify(value);
|
||||||
|
_response.write(handlThis);
|
||||||
|
}
|
||||||
|
if (_command.includes("/findEntry")) {
|
||||||
|
console.log("/findEntry");
|
||||||
|
}
|
||||||
|
/*if (_command.includes("/insertObject")) {
|
||||||
|
await useMongo.insertObject(_whichCollection, _orderObj);
|
||||||
|
//_response.write(_query); // technically no response
|
||||||
|
}*/
|
||||||
|
if (_command.includes("/insertEntry")) {
|
||||||
|
useMongo.insertEntry( _whichCollection, myJsonObj);
|
||||||
|
_response.write(_query); // technically no response
|
||||||
|
}
|
||||||
|
if (_command.includes("/removeEntry")) {
|
||||||
|
await useMongo.removeEntry(_whichCollection, myJsonObj);
|
||||||
|
_response.write(`{"":""}`); // technically no response
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,5 @@
|
||||||
|
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
|
After Width: | Height: | Size: 50 KiB |
After Width: | Height: | Size: 940 KiB |
After Width: | Height: | Size: 152 KiB |
After Width: | Height: | Size: 42 KiB |
After Width: | Height: | Size: 84 KiB |
After Width: | Height: | Size: 577 KiB |
After Width: | Height: | Size: 198 KiB |
|
@ -0,0 +1,90 @@
|
||||||
|
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;
|
||||||
|
}
|
|
@ -0,0 +1,25 @@
|
||||||
|
body {
|
||||||
|
font-size: 40px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.top-nav #warenkorb {
|
||||||
|
font-size: 70px;
|
||||||
|
}
|
||||||
|
.top-nav img {
|
||||||
|
height: 100px;
|
||||||
|
width: 380px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bestellbox {
|
||||||
|
font-size: 50px;
|
||||||
|
margin: 0px 20px;
|
||||||
|
border-radius: 20px;
|
||||||
|
}
|
||||||
|
.bestellbox span {
|
||||||
|
margin: 10px 0px;
|
||||||
|
}
|
||||||
|
.bestellbox #box-togo, #box-tostay {
|
||||||
|
width: 90%;
|
||||||
|
margin: 20px 0px;
|
||||||
|
border-radius: 20px;
|
||||||
|
}
|
|
@ -0,0 +1,45 @@
|
||||||
|
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);
|
||||||
|
}
|
|
@ -0,0 +1,141 @@
|
||||||
|
"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
|
|
@ -0,0 +1 @@
|
||||||
|
{"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;IAClB,CAAC;IAGD,SAAS,SAAS;QACd,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,2DAA2D;YAC3D,MAAM,CAAC,SAAS,GAAG,GAAG,CAAC,EAAE,CAAC;YACT,QAAQ,CAAC,aAAa,CAAC,iBAAiB,CAAE,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;SAC9E;IACL,CA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,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC,CAAC;gBACjD,OAAO,CAAC,GAAG,CAAC,oBAAoB,EAAE,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC,CAAC;gBACjE,MAAM;aACT;SACJ;QACD;;;qDAG6C;IACjD,CAAC;IAED,SAAS,YAAY,CAAC,QAAgB,EAAE,aAA2B;QAC/D,IAAI,cAAc,GAAW,CAAC,CAAC;QAC/B,KAAK,IAAI,CAAC,GAAW,CAAC,EAAE,CAAC,GAAG,YAAY,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YAClD,IAAI,WAAW,GAAW,YAAY,CAAC,CAAC,CAAC,CAAC;YAC1C,IAAI,WAAW,CAAC,QAAQ,CAAS,aAAa,CAAC,QAAQ,CAAC;gBACpD,cAAc,EAAE,CAAC;YACrB,IAAI,cAAc,IAAI,QAAQ,EAAE;gBAC5B,KAAK,CAAC,wCAAwC,GAAG,QAAQ,CAAC,CAAC;gBAC3D,OAAO,IAAI,CAAC;aACf;SACJ;QACD,OAAO,KAAK,CAAC;IACjB,CAAC;IAID,SAAS,QAAQ;QACb,UAAU,EAAE,CAAC;QACb,YAAY,GAAG,EAAE,CAAC;QAClB,gBAAgB,EAAE,CAAC;IACvB,CAAC;IAED,SAAS,UAAU;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"}
|
|
@ -0,0 +1,170 @@
|
||||||
|
//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() + "]");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,65 @@
|
||||||
|
<!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>
|
|
@ -0,0 +1,25 @@
|
||||||
|
"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
|
|
@ -0,0 +1 @@
|
||||||
|
{"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"}
|
|
@ -0,0 +1,31 @@
|
||||||
|
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());
|
||||||
|
}*/
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
After Width: | Height: | Size: 50 KiB |
After Width: | Height: | Size: 262 KiB |
|
@ -0,0 +1,37 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<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>
|
||||||
|
</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>
|
||||||
|
</div>
|
||||||
|
<div id="warenkorb">
|
||||||
|
<a href="#"><i class='fas fa-shopping-cart'></i> <span>0</span></a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
<main>
|
||||||
|
<div id="test"></div>
|
||||||
|
<div id="orderContainer"></div>
|
||||||
|
<div id="productContainer"></div>
|
||||||
|
<div id="buttonContainer"></div>
|
||||||
|
</main>
|
||||||
|
<footer>
|
||||||
|
<div>
|
||||||
|
<!--Disclaimer-->
|
||||||
|
</div>
|
||||||
|
</footer>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -0,0 +1,38 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
|
||||||
|
<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="warenkorb.js" defer></script>
|
||||||
|
<title>Document</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>
|
||||||
|
</div>
|
||||||
|
<div id="warenkorb">
|
||||||
|
<a href="#"><i class='fas fa-shopping-cart'></i> <span>0</span></a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
<main>
|
||||||
|
<button id="confirmOrder">confirm order</button>
|
||||||
|
<button id="sendOrder">send order</button>
|
||||||
|
<div id="check"></div>
|
||||||
|
</main>
|
||||||
|
<footer>
|
||||||
|
<div>
|
||||||
|
<!--Disclaimer-->
|
||||||
|
</div>
|
||||||
|
</footer>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
|
@ -0,0 +1,47 @@
|
||||||
|
"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
|
|
@ -0,0 +1 @@
|
||||||
|
{"version":3,"file":"warenkorb.js","sourceRoot":"","sources":["warenkorb.ts"],"names":[],"mappings":";AAAA,6CAA6C;AAE/B,QAAQ,CAAC,aAAa,CAAC,eAAe,CAAE,CAAC,gBAAgB,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;AAC/E,QAAQ,CAAC,aAAa,CAAC,YAAY,CAAE,CAAC,gBAAgB,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;AAM5F,IAAI,UAAU,GAAa,EAAE,CAAC;AAC9B,IAAI,WAAW,GAAW,CAAC,CAAC;AAE5B,KAAK,UAAU,UAAU;IACrB,KAAK,MAAM,GAAG,IAAI,YAAY,EAAE;QAC5B,IAAI,YAAY,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,IAAI,EAAE;YACnC,IAAI,OAAO,GAAW,YAAY,CAAC,OAAO,CAAC,GAAG,CAAE,CAAC;YACjD,IAAI,UAAU,GAAmB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K,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"}
|
|
@ -0,0 +1,56 @@
|
||||||
|
//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
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,9 @@
|
||||||
|
@media screen and (min-width: 0px) {
|
||||||
|
@import url("html-index/index-01-phone.css");
|
||||||
|
}
|
||||||
|
@media screen and (min-width: 601px) {
|
||||||
|
@import url("html-index/index-02-tablet.css");
|
||||||
|
}
|
||||||
|
@media screen and (min-width: 1025px) {
|
||||||
|
@import url("html-index/index-03-desktop.css");
|
||||||
|
}
|
|
@ -0,0 +1,45 @@
|
||||||
|
<!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-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>
|
||||||
|
<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>
|
||||||
|
</div>
|
||||||
|
<div id="warenkorb">
|
||||||
|
<a href="#"><i class='fas fa-shopping-cart'></i> <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>
|
||||||
|
</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>
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
<footer>
|
||||||
|
<div>
|
||||||
|
<!--Disclaimer-->
|
||||||
|
</div>
|
||||||
|
</footer>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -10,7 +10,7 @@
|
||||||
},
|
},
|
||||||
"devDependencies": {},
|
"devDependencies": {},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "node Aufgaben/Aufgabe_11_2020-07-08/server.js remote"
|
"start": "node Endabgabe/backend/useServer.js remote"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
|