var KB_READY = ["Zubereitet","Ready","Preparado"]; var KB_MAX_WAIT = ["Max. Wartezeit: ","Max. waited: ","Tiempo de espera: "]; var KB_TO_MAKE = ["Herzustellen","To prepare","Para preparar"]; var KB_TO_FINISHED = ["Fertig","Ready to serve","Completo"]; var KB_TABLE = ["Tisch","Table","Mesa"]; var isInitialized = false; var displayWorkToDo = false; var displayFinished = false; var displayHeaderFooter = false; var cookedEntries = null; var entriesToCook = null; var user = ""; var beepordered = 0; var oneclickcooked = 0; function beep() { var snd = new Audio("data:audio/wav;base64,//uQRAAAAWMSLwUIYAAsYkXgoQwAEaYLWfkWgAI0wWs/ItAAAGDgYtAgAyN+QWaAAihwMWm4G8QQRDiMcCBcH3Cc+CDv/7xA4Tvh9Rz/y8QADBwMWgQAZG/ILNAARQ4GLTcDeIIIhxGOBAuD7hOfBB3/94gcJ3w+o5/5eIAIAAAVwWgQAVQ2ORaIQwEMAJiDg95G4nQL7mQVWI6GwRcfsZAcsKkJvxgxEjzFUgfHoSQ9Qq7KNwqHwuB13MA4a1q/DmBrHgPcmjiGoh//EwC5nGPEmS4RcfkVKOhJf+WOgoxJclFz3kgn//dBA+ya1GhurNn8zb//9NNutNuhz31f////9vt///z+IdAEAAAK4LQIAKobHItEIYCGAExBwe8jcToF9zIKrEdDYIuP2MgOWFSE34wYiR5iqQPj0JIeoVdlG4VD4XA67mAcNa1fhzA1jwHuTRxDUQ//iYBczjHiTJcIuPyKlHQkv/LHQUYkuSi57yQT//uggfZNajQ3Vmz+Zt//+mm3Wm3Q576v////+32///5/EOgAAADVghQAAAAA//uQZAUAB1WI0PZugAAAAAoQwAAAEk3nRd2qAAAAACiDgAAAAAAABCqEEQRLCgwpBGMlJkIz8jKhGvj4k6jzRnqasNKIeoh5gI7BJaC1A1AoNBjJgbyApVS4IDlZgDU5WUAxEKDNmmALHzZp0Fkz1FMTmGFl1FMEyodIavcCAUHDWrKAIA4aa2oCgILEBupZgHvAhEBcZ6joQBxS76AgccrFlczBvKLC0QI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uj9mpu9Mpio1dXrr5HERTZSmqU36A3CumzN/9Robv/Xx4v9ijkSRSNLQhAWumap82WRSBUqXStV/YcS+XVLnSS+WLDroqArFkMEsAS+eWmrUzrO0oEmE40RlMZ5+ODIkAyKAGUwZ3mVKmcamcJnMW26MRPgUw6j+LkhyHGVGYjSUUKNpuJUQoOIAyDvEyG8S5yfK6dhZc0Tx1KI/gviKL6qvvFs1+bWtaz58uUNnryq6kt5RzOCkPWlVqVX2a/EEBUdU1KrXLf40GoiiFXK///qpoiDXrOgqDR38JB0bw7SoL+ZB9o1RCkQjQ2CBYZKd/+VJxZRRZlqSkKiws0WFxUyCwsKiMy7hUVFhIaCrNQsKkTIsLivwKKigsj8XYlwt/WKi2N4d//uQRCSAAjURNIHpMZBGYiaQPSYyAAABLAAAAAAAACWAAAAApUF/Mg+0aohSIRobBAsMlO//Kk4soosy1JSFRYWaLC4qZBYWFRGZdwqKiwkNBVmoWFSJkWFxX4FFRQWR+LsS4W/rFRb/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////VEFHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAU291bmRib3kuZGUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMjAwNGh0dHA6Ly93d3cuc291bmRib3kuZGUAAAAAAAAAACU="); snd.play(); } function declareProductBeCookingOrCooked(queueid,action) { window.setTimeout(function(){declareProductBeCookingOrCooked_orig(queueid,action)},100); } function declareProductBeCookingOrCooked_orig(queueid,action) { var data = { queueid: queueid, action : action}; doAjax("POST","php/contenthandler.php?module=queue&command=declareProductBeCookingOrCooked",data,resultOfProductDeclaration,"could not declare product",false); } function resultOfProductDeclaration(jsonText) { if (jsonText.status != "OK") { alert("Fehler " + jsonText.code + ": " + jsonText.msg); } } function declareProductNOTBeCooked(queueid) { var data = { queueid: queueid }; doAjax("POST","php/contenthandler.php?module=queue&command=declareProductNotBeCooked",data,resultOfProductDeclaration,"could not unmake product"); } function fillTableWithEntriesToCook(answer) { if (answer.status == "OK") { entriesToCook = answer.msg.tocook; fillTableWithEntriesToCookCore(); bindEntriesToCook(); var newproductsToPrepare = answer.msg.newproducts; if ((newproductsToPrepare == 1) && (beepordered == 1)) { beep(); } } } function removeOrRedeclareAnIdFromPrepared(theId,doRemove) { $.each(entriesToCook, function (j, table) { var aList = table.queueitems; var tablename = table.table; var i=0; var found = false; for (i=0;i'; } var icon = "check"; var status = "not_cooking"; var label = toHtml(entry.longname); if (entry.isguestorder == 1) { label = "" + label + ""; } if (entry.cooking != '') { theme ='d'; status = "cooking"; label += " (" + entry.cooking + ")"; } var extratxt = createExtraParagraph(entry.extras); var entryToAdd = { name: label + extratxt, isguestorder: entry.isguestorder, cooking: entry.cooking, queueid: entry.id, option: option, waiticon: entry.waiticon }; var setLength = qset.length; qset[setLength] = entryToAdd; }); var grouped = groupItemToMake(qset); var aList = ''; return aList; } function fillTableWithCookedEntries(entries) { cookedEntries = entries; fillTableWithCookedEntriesCore(); bindCookedEntries(); } function bindCookedEntries() { $(".deliveredlistitem").off("click").on("click", function (e) { var idlist = this.id; var idarr = idlist.split("_"); var firstid = idarr[0]; // this is the id to handle! declareProductNOTBeCooked(firstid); getAndDisplayAllEntries(); }); } function fillTableWithCookedEntriesCore() { if ((cookedEntries != null) && (cookedEntries.length > 0)) { var qset = []; $.each(cookedEntries, function (i, entry) { var option = ''; if (entry.option != '') { var theComment = toHtml(entry.option); option = '

' + theComment + '

'; } var label = toHtml(entry.longname); var extratxt = createExtraParagraph(entry.extras); var table = entry.tablename; var entryToAdd = { name: label + extratxt, queueid: entry.id, option: option, extras: extratxt, table: table }; var setLength = qset.length; qset[setLength] = entryToAdd; }); var grouped = groupMadeItems(qset); var theList = ''; $("#listWithCookedEntries").html(theList); $("#listWithCookedEntries").trigger("create"); } else { $("#listWithCookedEntries").html(""); } } function handleGlobalRefresh(name) { parent.frames[name].location.reload(); getAndDisplayAllEntries(); } function getAndDisplayAllEntries() { checkForLogIn(); if (isInitialized) { if (displayWorkToDo) { getEntriesToCook(); } if (displayFinished) { getCookedEntries(); } } } function getGeneralConfigItems() { doAjax("GET", "php/contenthandler.php?module=admin&command=getGeneralConfigItems", null, insertGeneralConfigItems, "Fehler Konfigurationsdaten"); doAjax("GET","php/contenthandler.php?module=admin&command=getJsonMenuItemsAndVersion",null,setUser,"Benutzerdaten nicht übermittelt"); } function setUser(userAndVersion) { user = userAndVersion.user; } function insertGeneralConfigItems(configResult) { if (configResult.status == "OK") { var values = configResult.msg; beepordered = values.beepordered; oneclickcooked = values.oneclickcooked; setLanguage(values.userlanguage); isInitialized = true; if (displayHeaderFooter) { initializeMainMenu("#modulemenu"); } else { $("#modulepanel").hide(); $("#menuswitch").hide(); $("#thefooterr").hide(); } initializeEverything(); setHeadlines(); getAndDisplayAllEntries(); } else { setTimeout(function(){document.location.href = "index.html"},250); // not logged in } } function setWorkMode(urlsuffix) { displayWorkToDo = true; displayFinished = true; displayHeaderFooter = true; return; } /** * Not possible in setWorkMode, because set Lang would overwrite. * So set headlines in method that can be called later */ function setHeadlines() { if (!displayHeaderFooter) { if (displayWorkToDo) { $("#moduleheadline").html(KB_TO_MAKE[lang]); } else if (displayFinished) { $("#moduleheadline").html(KB_TO_FINISHED[lang]); } $("#headerline").trigger("create"); } } function groupMadeItems(theSet) { var counts = []; var joinedvals = []; var names = []; var isguestorders = []; var options = []; var extras = []; var tables = []; var queueids = []; var grouped = { counts:counts, joinedvals : joinedvals, names: names, isguestorders: isguestorders, options: options, extras: extras, tables: tables, queueids : queueids }; var i=0; for (i=0;i= 0) { grouped.counts[index] = grouped.counts[index] + 1; var queueidsarr = grouped.queueids[index]; queueidsarr[queueidsarr.length] = queueid; grouped.queueids[index] = queueidsarr; } else { var gLength = grouped.counts.length; grouped.counts[gLength] = 1; grouped.joinedvals[gLength] = joinedNeedle; grouped.names[gLength] = name; grouped.isguestorders[gLength] = isguestorder; grouped.options[gLength] = option; grouped.extras[gLength] = extras; grouped.tables[gLength] = table; grouped.queueids[gLength] = [queueid]; } } return grouped; } function groupItemToMake(theSet) { var counts = []; var joinedvals = []; var names = []; var isguestorders = []; var options = []; var cookings = []; var waiticons = []; var queueids = []; var grouped = { counts:counts, joinedvals : joinedvals, names: names, isguestorders: isguestorders, options: options, cookings: cookings, waiticons: waiticons, queueids : queueids }; var i=0; for (i=0;i= 0) { grouped.counts[index] = grouped.counts[index] + 1; var queueidsarr = grouped.queueids[index]; queueidsarr[queueidsarr.length] = queueid; grouped.queueids[index] = queueidsarr; } else { var gLength = grouped.counts.length; grouped.counts[gLength] = 1; grouped.joinedvals[gLength] = joinedNeedle; grouped.names[gLength] = name; grouped.isguestorders[gLength] = isguestorder; grouped.options[gLength] = option; grouped.cookings[gLength] = cooking; grouped.waiticons[gLength] = waiticon; grouped.queueids[gLength] = [queueid]; } } return grouped; }