function declareProductBeCookingOrCooked(queueid,action) { var data = { queueid: queueid, action : action}; doAjax("POST","php/contenthandler.php?module=queue&command=declareProductBeCookingOrCooked",data,resultOfProductDeclaration,"could not declare product"); } 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(entriesToCook) { var aList = ''; $.each(entriesToCook, function (i, table) { aList += listOfTable(table); }); $("#listWithEntriesToCook").html(aList); $("#listWithEntriesToCook").trigger("create"); $(".preparedlistitem").off("click").on("click", function (e) { if ($(this).hasClass("cooking")) { declareProductBeCookingOrCooked($(this).attr("id"),"r"); } else { declareProductBeCookingOrCooked($(this).attr("id"),"c"); } getAndDisplayAllEntries(); }); } function listOfTable(table) { var tableid = table.tableid; var tablename = table.table; var maxWaitTime = table.maxwaittime; var aList = ''; return aList; } function fillTableWithCookedEntries(cookedEntries) { var theList = ''; $("#listWithCookedEntries").html(theList); $("#listWithCookedEntries").trigger("create"); $(".deliveredlistitem").off("click").on("click", function (e) { declareProductNOTBeCooked($(this).attr("id")); getAndDisplayAllEntries(); }); } function getAndDisplayAllEntries() { getEntriesToCook(); getCookedEntries(); }