Took 5 hours 35 minutes
This commit is contained in:
2022-11-23 18:39:47 +01:00
parent c933b9943d
commit 7307505175
17 changed files with 290 additions and 648 deletions

View File

@ -2,9 +2,11 @@ import {WebSocketPayload} from "../WebSocketPayload";
import {IDrink} from "../database/IDrink";
import {Pane} from "./Pane";
import {Setup} from "./Setup";
import {Modal} from "./Modal";
import {WebSocketEvent} from "../WebSocketEvent";
import {WebWebSocketHandler} from "./WebWebSocketHandler";
import {RequestType} from "../RequestType";
import {IJob} from "../database/IJob";
import {Modal} from "./Modal";
import {ButtonType} from "./ButtonType";
export class WebHandler {
static get currentPane(): Pane {
@ -42,10 +44,19 @@ export class WebHandler {
drinkName.innerText = drink.name;
drinkEle.onclick = () => {
let payload = new WebSocketPayload(WebSocketEvent.FILL, false, {drink: drink._id });
WebWebSocketHandler.send(payload);
WebWebSocketHandler.request(RequestType.STARTFILL, {drink: drink}).then((payload) => {
let data = payload.data.content as { success: boolean, job?: IJob };
if (!data.success) {
let modal = new Modal("fill", "Oh nein!");
let txt = document.createElement("p");
txt.innerHTML = `Es scheint so, als wäre nicht genug Inhalt in den Behältern, um den gewünschten Cocktail bereitzustellen.<br><br>Bitte wende dich an das Wartungspersonal.<br><br>`;
modal.addContent(txt);
modal.addButton(ButtonType.PRIMARY, "Schließen", () => modal.close());
modal.open();
}
});
}
/*