Skip to content
Snippets Groups Projects
Commit a3f71259 authored by Omar Ibrahim Arfa's avatar Omar Ibrahim Arfa
Browse files

fix versioning issue

parent 151ccfd0
No related branches found
No related tags found
No related merge requests found
......@@ -59,9 +59,9 @@ function selectOrder() {
function checkInputs() {
"use strict";
const selectInput = document.getElementById('warenkorb');
const address = document.getElementById('address');
const button = document.getElementById('submitButton');
const selectInput = document.getElementById("warenkorb");
const address = document.getElementById("address");
const button = document.getElementById("submitButton");
// Check conditions
const selectHasOptions = selectInput.options.length > 0;
......@@ -75,7 +75,7 @@ function checkInputs() {
window.onload = function init() {
"use strict";
document.getElementById('address').addEventListener('input', checkInputs);
document.getElementById("address").addEventListener("input", checkInputs);
};
document.addEventListener(
......
console.log("Loading Kunde.js ...");
function loadData() {
"use strict";
var url = "./Kundenstatus.php";
......@@ -16,6 +14,7 @@ function loadData() {
if (request.responseText != null) {
var responseData = JSON.parse(request.responseText);
console.log(responseData);
process(responseData);
} else {
console.error ("Dokument ist leer");
......@@ -27,7 +26,7 @@ function loadData() {
request.onerror = function () {
"use strict";
console.error('Netzwerkfehler')
console.error("Netzwerkfehler");
};
//request.onreadystatechange = processData;
......@@ -83,10 +82,68 @@ function process(data) {
}
window.onload = function () {
"use strict";
loadData();
}
window.setInterval (loadData, 2000);
function buildOrder(parentNode, id, pizzaObj) {
"use strict";
let orderMainNode = document.createElement("fieldset");
orderMainNode.id = id;
let orderLegend = document.createElement("legend");
orderLegend.id = id + ".legend";
orderLegend.innerText = "Bestellung " + id;
orderMainNode.append(orderLegend);
buildPizza(orderMainNode, pizzaObj);
parentNode.append(orderMainNode);
}
function buildPizza(orderMainNode, pizzaObj) {
"use strict";
let pizzaList = pizzaObj.pizzaList;
for (let pizza of pizzaList) {
let pizzaName = pizza.name;
let orderedArticleID = pizza.orderedArticleID;
let pizzaStatus = pizza.status;
let pizzaNode = document.createElement("fieldset");
let pizzaLegend = document.createElement("legend");
pizzaNode.id = "pizzaNode." + orderedArticleID;
pizzaLegend.innerText = "Pizza " + pizzaName;
pizzaNode.append(pizzaLegend);
buildInputs(pizzaNode, orderedArticleID, pizzaStatus);
orderMainNode.append(pizzaNode);
}
}
function buildInputs(pizzaNode, orderedArticleID, status) {
"use strict";
let statusArray = [
"Bestellt", "Im Ofen", "Fertig",
"Unterwegs", "Geliefert"
];
for (let value = 0; value < 5; value++) {
let inputLabel = document.createElement("label");
pizzaNode.append(inputLabel);
inputLabel.innerText = statusArray[value];
let inputRadio = document.createElement("input");
inputLabel.append(inputRadio);
inputRadio.type = "radio";
inputRadio.name = orderedArticleID;
inputRadio.value = value.toString();
inputRadio.disabled = true;
if (value === status) {
inputRadio.checked = true;
}
}
}
window.setInterval (loadData, 2000);
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment