update
Took 7 hours 48 minutes
This commit is contained in:
@ -3,7 +3,6 @@ import {IDrink} from "../database/IDrink";
|
||||
import {Modal} from "./Modal";
|
||||
import {ButtonType} from "./ButtonType";
|
||||
import {Pane} from "./Pane";
|
||||
import {setup} from "rpi-gpio";
|
||||
|
||||
export class WebHandler {
|
||||
private static containers = [];
|
||||
@ -63,110 +62,8 @@ ${ingredients}`*/ //todo
|
||||
}
|
||||
|
||||
static async openSetup() {
|
||||
// new
|
||||
this.openPane(Pane.SETUP);
|
||||
let menuBtn = document.getElementById("menuBtn") as HTMLButtonElement;
|
||||
let setupContainers = document.getElementById("setupContainers") as HTMLDivElement;
|
||||
menuBtn.disabled = true;
|
||||
|
||||
const containerAddBtn = document.getElementById("containerAddBtn") as HTMLButtonElement;
|
||||
containerAddBtn.onclick = () => {
|
||||
|
||||
|
||||
let con = document.createElement("div");
|
||||
|
||||
let containerName = document.createElement("p");
|
||||
containerName.innerText = "Behälter " + (setupContainers.getElementsByTagName("div").length + 1);
|
||||
con.classList.add("setupContainer");
|
||||
con.append(containerName);
|
||||
|
||||
let sensorTypeLabel = document.createElement("label");
|
||||
sensorTypeLabel.innerText = "Art des Sensors ";
|
||||
con.append(sensorTypeLabel);
|
||||
|
||||
let sensorType = document.createElement("select");
|
||||
sensorType.classList.add("input");
|
||||
let sensorTypeNone = document.createElement("option") as HTMLOptionElement;
|
||||
sensorTypeNone.innerText = "Keiner";
|
||||
sensorTypeNone.value = "0";
|
||||
sensorType.append(sensorTypeNone);
|
||||
let sensorTypeUltrasound = document.createElement("option") as HTMLOptionElement;
|
||||
sensorTypeUltrasound.innerText = "Ultraschall";
|
||||
sensorTypeUltrasound.value = "1";
|
||||
sensorType.append(sensorTypeUltrasound);
|
||||
let sensorTypeScale = document.createElement("option") as HTMLOptionElement;
|
||||
sensorTypeScale.innerText = "Wägezelle";
|
||||
sensorTypeScale.value = "2";
|
||||
sensorType.append(sensorTypeScale);
|
||||
con.append(sensorType);
|
||||
|
||||
con.append(document.createElement("br"));
|
||||
|
||||
|
||||
let selectPin = document.createElement("select");
|
||||
selectPin.style.display = "none";
|
||||
selectPin.classList.add("input");
|
||||
selectPin.style.display = "inline";
|
||||
|
||||
let noSel = document.createElement("option") as HTMLOptionElement;
|
||||
noSel.innerText = "Bitte wählen";
|
||||
noSel.value = "-1";
|
||||
noSel.disabled = true;
|
||||
|
||||
selectPin.append(noSel.cloneNode(true));
|
||||
selectPin.selectedIndex = 0;
|
||||
|
||||
const pins = [3, 5, 7, 8, 10, 11, 12, 13, 14, 15, 16, 18, 19, 21, 22, 23, 24, 26, 29, 31, 32, 33, 34, 35, 36, 37, 38, 40];
|
||||
for (let pin of pins) {
|
||||
let pinEle = document.createElement("option") as HTMLOptionElement;
|
||||
pinEle.innerText = "" + pin;
|
||||
pinEle.value = "" + pin;
|
||||
selectPin.append(pinEle);
|
||||
}
|
||||
|
||||
let pumpLabel = document.createElement("label");
|
||||
pumpLabel.innerText = "Pumpen Pin";
|
||||
con.append(pumpLabel);
|
||||
con.append(selectPin.cloneNode(true));
|
||||
|
||||
con.append(document.createElement("br"));
|
||||
|
||||
let sensor1Label = document.createElement("label");
|
||||
sensor1Label.innerText = "Sensor 1 Pin";
|
||||
con.append(sensor1Label);
|
||||
con.append(selectPin.cloneNode(true));
|
||||
|
||||
con.append(document.createElement("br"));
|
||||
|
||||
let sensor2Label = document.createElement("label");
|
||||
sensor2Label.innerText = "Sensor 2 Pin";
|
||||
con.append(sensor2Label);
|
||||
con.append(selectPin.cloneNode(true));
|
||||
|
||||
con.append(document.createElement("br"));
|
||||
|
||||
let removeBtn = document.createElement("button");
|
||||
removeBtn.classList.add("btn", "btn-danger");
|
||||
removeBtn.onclick = () => {
|
||||
con.classList.add("removeSlowly");
|
||||
setTimeout(() => {
|
||||
con.remove();
|
||||
let i = 1;
|
||||
for (let elementsByTagNameElement of setupContainers.getElementsByTagName("div")) {
|
||||
let e = elementsByTagNameElement.getElementsByTagName("p")[0] as HTMLParagraphElement;
|
||||
e.innerText = "Behälter " + i;
|
||||
i++;
|
||||
}
|
||||
}, 750);
|
||||
|
||||
}
|
||||
removeBtn.style.float = "right";
|
||||
removeBtn.innerText = "Entfernen";
|
||||
con.append(removeBtn);
|
||||
|
||||
setupContainers.append(con);
|
||||
|
||||
};
|
||||
return;
|
||||
|
||||
// old
|
||||
|
Reference in New Issue
Block a user