ordersprinter/waiter.html

945 lines
33 KiB
HTML
Raw Normal View History

2020-11-19 22:44:19 +01:00
<html>
<head>
<title>Ansicht Kellner</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
<link rel="stylesheet" type="text/css" href="css/bestformat.css">
<link rel="stylesheet" href="php/3rdparty/orderstyle/orderstyle.min.css" />
<link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" />
<link rel="stylesheet" href="php/3rdparty/jquery.mobile-1.4.0.min.css" type="text/css" />
<script src="php/3rdparty/jquery-2.0.3.min.js"></script>
<script src="php/3rdparty/jquery.mobile-1.4.0.min.js"></script>
</head>
<style>
@media screen
{
#workprintarea {display: none;}
}
@media print
{
#waiterui,#thefooter3,#header3,#info-page,#details-page,#modulemenu-room,#modulemenu-table,#modulemenu-prod {display: none;}
}
@media print
{
#workprintarea {width: 100%;};
}
</style>
<script>
function initializeMainMenu(menuid,user,version,forward) {
$.ajax({ type: "GET",
dataType: "json",
url: "php/contenthandler.php?module=admin&command=getJsonMenuItemsAndVersion",
async: false,
success : function(moduleEntries)
{
$("#" + user).html(moduleEntries.user);
$("#" + version).html("v" + moduleEntries.version);
var li='<li data-role="list-divider" data-theme="b" data-role="heading">Module</li>';
$.each(moduleEntries.menu, function (i, module) {
var name = module.name;
var link = module.link;
if (forward) {
li += '<li data-theme="e"><a class="modules" href="#" id="menu_' + link + '">' + name + '</a></li>';
} else {
li += '<li data-theme="e"><a href="' + link + '" target="_top">' + name + '</a></li>';
}
});
$(menuid).empty().append(li).promise().done(function () {
refreshList(menuid);
})
},
error: function( text ) { alert( "Sorry, Hauptmenue nicht erhalten!" );
}
});
}
function refreshList(selector) {
if ( $(selector).hasClass('ui-listview')) {
$(selector).listview('refresh');
} else {
$(selector).trigger('create');
}
}
function moduleForward(linkid) {
var neworders = $("#typprodpage").data("neworders");
if (neworders.length == 0) {
var linkParts = linkid.split("_");
window.location.href = linkParts[1];
} else {
alert("Es sind noch ungesendete Orders vorhanden!");
hideMenuProd();
}
}
function getPayPrintType() {
doJsonAjax("GET", "php/contenthandler.php?module=admin&command=getPayPrintType", null, insertPayPrintType, "Fehler Druckkonfiguration");
}
function insertPayPrintType(payPrintType) {
$("#workprintarea").data("payPrintType",payPrintType);
}
function getUserHasRightForPaydesk() {
doJsonAjax("GET", "php/contenthandler.php?module=admin&command=hasUserPaydeskRight", null, hasUserPaydeskRight, "Fehler Kassenberechtigung");
}
function hasUserPaydeskRight(userRight) {
$("#gopaydesk_btn").data("allowed",userRight);
}
function hideMenuRoom() {
$( "#modulepanel-room" ).panel( "close" );
$("#menuswitchroom").off("click").on("click", function (e) {
$("#menuswitch").trigger("mouseout");
e.stopImmediatePropagation();
e.preventDefault();
$( "#modulepanel-room" ).panel( "open" );;
});
}
function hideMenuTable() {
$( "#modulepanel-table" ).panel( "close" );
$("#menuswitchtable").off("click").on("click", function (e) {
$("#menuswitch").trigger("mouseout");
e.stopImmediatePropagation();
e.preventDefault();
$( "#modulepanel-table" ).panel( "open" );;
});
}
function hideMenuProd() {
$( "#modulepanel-prod" ).panel( "close" );
$("#menuswitchprod").off("click").on("click", function (e) {
$("#menuswitch").trigger("mouseout");
e.stopImmediatePropagation();
e.preventDefault();
$( "#modulepanel-prod" ).panel( "open" );;
});
}
function addProductToQueue(tableid,productid) {
var option=$('#optionfield').val();
$('#optionfield').val("");
var entry = [productid,option];
var neworders = $("#typprodpage").data("neworders");
neworders[neworders.length] = entry;
$("#typprodpage").data("neworders",neworders);
updateNewOrdersList();
}
function updateNewOrdersList() {
var i=0;
var neworders = $("#typprodpage").data("neworders");
if (neworders.length == 0) {
$('#changetable_btn').closest('.ui-btn').show();
$('#sendorder_btn').closest('.ui-btn').hide();
} else {
$('#changetable_btn').closest('.ui-btn').hide();
$('#sendorder_btn').closest('.ui-btn').show();
}
var li = "<li data-role=\"list-divider\" data-theme=\"b\" data-role=\"heading\">Neue Order</li>";
for (i=0;i<neworders.length;i++) {
var entry = neworders[i];
var lname = getProdName(entry[0]);
var optiontext = "";
if (entry[1] != '') {
optiontext = "&nbsp;<i>(" + entry[1] + ")</i>";
}
li += '<li data-theme="c" data-icon="arrow-d"><a href="#" id="new_' + entry[0] + '" class="neworder_el">' + lname + optiontext + '</a></li>';
}
$("#neworders").html(li);
refreshList("#neworders");
binding_neworderelem();
}
function binding_neworderelem() {
$(".neworder_el").off("click").on("click", function (e) {
e.stopImmediatePropagation();
e.preventDefault();
var index = $("#neworders li").index($(this).closest("li")) - 1;
var neworders = $("#typprodpage").data("neworders");
neworders.splice(index, 1);
$("#typprodpage").data("neworders",neworders);
updateNewOrdersList();
});
}
function sendNewOrders(fct) {
var roominfo = $("#typprodpage").data("table-info");
var tableid = roominfo[1];
var neworders = $("#typprodpage").data("neworders");
if (neworders.length != 0) {
var data = {
tableid: tableid,
prods: neworders
}
$("#typprodpage").data("neworders",[]);
doJsonAjax("POST","php/contenthandler.php?module=queue&command=addProductListToQueue",data,fct,"Fehler bei Produktversand");
} else {
fct();
}
}
function reloadPage() {
window.location.href = "waiter.html";
}
// removeProductFromQueue
function removeProductFromQueue(queueid) {
$.ajax({ type: "POST",
url: "php/contenthandler.php?module=queue&command=removeProductFromQueue",
data : { queueid: queueid },
async: false,
success : function(text) {},
error: function( text ) {
alert( "Sorry, Fehler bei Produktentfernung!" );
}
});
}
//pageinit event for first page
//triggers only once
//write all your on-load functions and event handlers pertaining to page1
$(document).on("pageinit", "#info-page", function () {
initializeMainMenu("#modulemenu-room","loggedinuser1","versioninfo1",false);
initializeMainMenu("#modulemenu-table","loggedinuser2","versioninfo2",false);
initializeMainMenu("#modulemenu-prod","loggedinuser3","versioninfo3",true);
$(".modules").off("click").on("click", function (e) {
$("#menuswitch").trigger("mouseout");
e.stopImmediatePropagation();
e.preventDefault();
moduleForward(this.id);
});
hideMenuRoom();
$.getJSON("php/contenthandler.php?module=roomtables&command=showAllRooms",function(roomtableinfo) {
$("#details-page").data("allroomtables",roomtableinfo);
var noOfRooms = roomtableinfo.length;
var allRooms = roomtableinfo; // default: rooms
if (noOfRooms == 1) {
allRooms = roomtableinfo[0]["tables"];
$("#info-page").data("type","t");
$("#roomtableheader").html("Tische");
} else {
$("#info-page").data("type","r");
$("#roomtableheader").html("R<>ume");
}
var li = "";
//container for $li to be added
$.each(allRooms, function (i, name) {
//store index value in array as id of the <a> tag
li += '<li data-theme="f"><a href="#" id="' + i + '" class="info-go">' + name.name + '</a></li>';
});
//append list to ul
$("#room-list").append(li).promise().done(function () {
//wait for append to finish - thats why you use a promise()
//done() will run after append is done
//add the click event for the redirection to happen to #details-page
$(this).off("click").on("click", "a", function (e) {
e.stopImmediatePropagation();
e.preventDefault();
//store the information in the next page's data
// this.id = html-Zeile des Eintrags = ID-1 des Raumes)))
// roomtableinfo[this.id]["name"] = "Drinnen" z.B.
if ($("#info-page").data("type") == "t") {
var tableid = allRooms[this.id]["id"];
var tablename = allRooms[this.id]["name"];
var roomtable_array= new Array(-1,tableid,tablename);
$("#typprodpage").data("table-info", roomtable_array);
$("#typprodpage").data("neworders",[]);
$.mobile.changePage("#typprodpage");
} else {
var roomdetail = allRooms[this.id];
$("#details-page").data("roomdetail", roomdetail);
$.mobile.changePage("#details-page");
}
});
//refresh list to enhance its styling.
refreshList(this);
});
});
}
);
// Now we prepare the second page (tables) for display
$(document).on("pagebeforeshow", "#details-page", function () {
hideMenuTable();
//get from data - you put this here when the "a" wa clicked in the previous page
var roomdetail = $(this).data("roomdetail");
var tables = roomdetail["tables"];
var li = '<li data-role=\"list-divider\" data-theme=\"b\" data-role=\"heading\">Tische</li>'; // init
$.each(tables, function( index, value ) {
li += '<li data-theme="e"><a href="#" id="' + index + '" class="info-go">' + value["name"] + '</a></li>';
});
//append list to ul
$("#tables-list").empty().append(li).promise().done(function () {
$(this).off("click").on("click", ".info-go", function (e) {
e.stopImmediatePropagation();
e.preventDefault();
// this.id = Nummer des Eintrags in der Liste der Tische (d.h. 8. Eintrag k<>nnte Tisch 10 sein)
var roomid = roomdetail["id"]; // hier ist roomdetail das alte, nicht das von oben!!!
var tableid = tables[this.id]["id"];
var tablename = tables[this.id]["name"];
var roomtable_array= new Array(roomid,tableid,tablename);
$("#typprodpage").data("table-info", roomtable_array); // das passt hier noch nicht!
$("#typprodpage").data("neworders",[]);
$.mobile.changePage("#typprodpage");
});
//refresh list to enhance its styling.
refreshList(this);
});
});
function createHtmlListOfEntries(entries) {
var li = "<li data-role=\"list-divider\" data-theme=\"b\" data-role=\"heading\">Auswahl</li>";
$.each(entries, function (i, name) {
if (entries[i]["type"] == "t") {
li += '<li data-theme="d"><a href="#" id="' + i + '">' + name.name + '</a></li>';
} else {
li += '<li data-theme="c" data-icon="plus"><a href="#" id="' + i + '">' + name.name + '</a></li>';
}
});
return li;
}
function attachAndDisplayFirstRefTypes(jsonTypesAndProds) {
$("#typprodpage").data("types_prods",jsonTypesAndProds);
displayTypesProds(0);
}
function listOfTypesProds(ref) {
var li = "<li data-role=\"list-divider\" data-theme=\"b\" data-role=\"heading\">Auswahl</li>";
var prodtypes = $("#typprodpage").data("types_prods");
$.each(prodtypes.types,function(i,aType) {
if (parseInt(aType.ref) == ref) {
li += '<li data-theme="d"><a href="#" id="t_' + aType.id + '">' + aType.name + '</a></li>';
}
});
$.each(prodtypes.prods,function(i,aProd) {
if (parseInt(aProd.ref) == ref) {
li += '<li data-theme="c" data-icon="plus"><a href="#" id="p_' + aProd.id + '">' + aProd.name + '</a></li>';
}
});
if (ref != 0) {
li += '<li data-theme="f" data-icon="back"><a href="#" id="t_0"><i>Anderes Produkt</i></a></li>';
}
return li;
}
function getProdEntry(prodid) {
var prodtypes = $("#typprodpage").data("types_prods");
var i=0;
var allprods = prodtypes.prods;
for (i=0;i<allprods.length;i++) {
var aProd = allprods[i];
if (parseInt(aProd.id) == prodid) {
return aProd;
}
}
return null;
}
function getProdAudio(prodid) {
var aProd = getProdEntry(prodid);
if (aProd != null) {
return aProd.audio;
} else {
return "";
}
}
function getProdName(prodid) {
var aProd = getProdEntry(prodid);
if (aProd != null) {
return aProd.longname;
} else {
return "FEHLER!";
}
}
function displayTypesProds(ref) {
var li = listOfTypesProds(parseInt(ref));
$("#typeproducts-list").empty().append(li).promise().done(function () {
refreshList("#typeproducts-list");
$(this).off("click").on("click", "a", function (e) {
e.stopImmediatePropagation();
e.preventDefault();
var theId = this.id;
var idParts = theId.split("_");
if (idParts[0] == 't') {
displayTypesProds(idParts[1]);
} else {
// Product was selected:
// 1. add the product to the table
// 2. go back in the prodtypes at the beginning
var prodid = idParts[1];
var roominfo = $("#typprodpage").data("table-info");
var tableid = roominfo[1];
addProductToQueue(tableid,prodid);
var audioFile = getProdAudio(parseInt(prodid));
if (audioFile != "") {
// play sound!
var audioUrl = "customer/" + audioFile;
if (audioFile.match(/mp3$/)) {
$("#audiofile").html('<source src=' + audioUrl + ' type="audio/mpeg" />');
} else if (audioFile.match(/ogg$/)) {
$("#audiofile").html('<source src=' + audioUrl + ' type="audio/ogg" />');
} else if (audioFile.match(/wav$/)) {
$("#audiofile").html('<source src=' + audioUrl + ' type="audio/wav" />');
}
var vol = parseInt($("#typprodpage").data("ordervolume")) / 10.0;
document.getElementById('audiofile').volume=vol;
document.getElementById('audiofile').load();
document.getElementById('audiofile').play();
}
var urlProdOfTableNotDelivered = "php/contenthandler.php?module=queue&command=getJsonLongNamesOfProdsForTableNotDelivered&"
+ "tableid=" + tableid;
var prodListToFill = "#orderedprod-list-0";
fillNotDeliveredProductsOfATable(urlProdOfTableNotDelivered,prodListToFill);
displayTypesProds(0);
refreshList("#typeproducts-list");
}
});
});
}
function fillTypeProdList(ref) {
if (ref == 0) {
// initial call -> retrieve all prods and types
doJsonAjax("GET","php/contenthandler.php?module=products&command=getAllTypesAndAvailProds",null,attachAndDisplayFirstRefTypes,"Produktkatalog nicht abrufbar");
} else {
displayTypesProds(ref);
}
return;
}
function fillNotDeliveredProductsOfATable(urlProdOfTableNotDelivered,prodListToFill) {
$.getJSON(urlProdOfTableNotDelivered,function(prodOfTable) {
var li = "<li data-role=\"list-divider\" data-theme=\"b\" data-role=\"heading\">K<EFBFBD>che/Bar</li>";
$.each(prodOfTable, function (i, name) {
var optiontext = "";
if (name.option != '') {
optiontext = "&nbsp;(" + name.option + ")";
}
if (name.isready == '0') {
li += '<li data-theme="c" data-icon="delete" class="notdelprod"><a href="#" id="' + i + '">' + name.longname + optiontext + '</a></li>';
} else {
li += '<li data-theme="f" data-icon="delete" class="notdelprod"><a href="#" id="' + i + '">' + name.longname + optiontext + '</a></li>';
}
});
$(prodListToFill).empty().append(li).promise().done(function () {
// now set as data the queueid
var index=0;
$(".notdelprod").each(function() {
$(this).data("queueid",prodOfTable[index].queueid);
index++;
});
$(this).off("click").on("click", "a", function (e) {
e.stopImmediatePropagation();
e.preventDefault();
//alert ("Remove: id=" + prodOfTable[this.id]["queueid"]); // this.id=Zeile (0..ende)
var isReady = prodOfTable[this.id]["isready"];
var isPaid = prodOfTable[this.id]["isPaid"];
if ((isPaid == "1") && (isReady=="1")) {
var dialogText = "Produkt wurde schon zubereitet und bezahlt";
var this_elem = this;
areYouSure("Entfernen?", dialogText, "Ja", function() {
removeProductFromQueue(prodOfTable[this_elem.id]["queueid"]);
fillNotDeliveredProductsOfATable(urlProdOfTableNotDelivered,prodListToFill);
});
} else if (isReady=="1") {
var dialogText = "Produkt wurde schon zubereitet.";
var this_elem = this;
areYouSure("Entfernen?", dialogText, "Ja", function() {
removeProductFromQueue(prodOfTable[this_elem.id]["queueid"]);
fillNotDeliveredProductsOfATable(urlProdOfTableNotDelivered,prodListToFill);
});
} else if (isPaid == "1") {
var dialogText = "Produkt wurde schon bezahlt.";
var this_elem = this;
areYouSure("Entfernen?", dialogText, "Ja", function() {
removeProductFromQueue(prodOfTable[this_elem.id]["queueid"]);
fillNotDeliveredProductsOfATable(urlProdOfTableNotDelivered,prodListToFill);
});
} else {
removeProductFromQueue(prodOfTable[this.id]["queueid"]);
fillNotDeliveredProductsOfATable(urlProdOfTableNotDelivered,prodListToFill);
}
});
$(this).off("swipe").on("swipe", "a", function (e) {
e.stopImmediatePropagation();
e.preventDefault();
//alert ("Remove: id=" + prodOfTable[this.id]["queueid"]); // this.id=Zeile (0..ende)
removeProductFromQueue(prodOfTable[this.id]["queueid"]);
fillNotDeliveredProductsOfATable(urlProdOfTableNotDelivered,prodListToFill);
});
refreshList(this);
});
}); // ende json call
}
function fillOrderVolume(volume) {
$("#typprodpage").data("ordervolume",volume);
}
//Now we prepare the product page (level 0) for display
$(document).on("pagebeforeshow", "#typprodpage", function () {
hideMenuProd();
getPayPrintType();
doJsonAjax("GET","php/contenthandler.php?module=admin&command=getOrderVolume",null,fillOrderVolume,"Keine Ordertoninformation");
$("#workprintarea").html("");
//get from data - you put this here when the "a" wa clicked in the previous page
var roomtable_info = $(this).data("table-info");
var roomid = roomtable_info[0];
var tableid = roomtable_info[1];
$("#changetablewhatdialog").data("fromtableid",tableid);
var tablename = roomtable_info[2];
$("#typprodpage h1").html("Tisch: " + tablename);
$("#optionfield").val(""); // clear option field
fillTypeProdList(0);
// now the products that are assigned to table but yet not delivered
var urlProdOfTableNotDelivered = "php/contenthandler.php?module=queue&command=getJsonLongNamesOfProdsForTableNotDelivered&"
+ "tableid=" + tableid;
var prodListToFill = "#orderedprod-list-0";
fillNotDeliveredProductsOfATable(urlProdOfTableNotDelivered,prodListToFill);
$("#workprint_btn").data("tableid",tableid);
$("#gopaydesk_btn").data("tableid",tableid);
$("#workprint_btn").data("tablename",tablename);
bindPrintButton();
bindGoPayDeskButton();
bindChangetableButton();
bindSendNewOrdersButton();
// "Paydesk-button" enable/disable
getUserHasRightForPaydesk();
updateNewOrdersList();
});
function bindSendNewOrdersButton() {
$("#sendorder_btn").off("click").on("click", function (e) {
e.stopImmediatePropagation();
e.preventDefault();
sendNewOrders(reloadPage);
});
}
function bindPrintButton() {
$("#workprint_btn").off("click").on("click", function (e) {
$("#workprint_btn").trigger("mouseout");
e.stopImmediatePropagation();
e.preventDefault();
sendNewOrders(printTheWorkItems);
});
}
function printTheWorkItems() {
doJsonAjax("GET","php/contenthandler.php?module=queue&command=getNotPrintedWorkItemsAndDeclareThemPrinted",
{tableid : $("#workprint_btn").data("tableid") }, fillPrintAreaAndPrint, "Druckfehler");
}
function bindGoPayDeskButton() {
$("#gopaydesk_btn").off("click").on("click", function (e) {
e.stopImmediatePropagation();
e.preventDefault();
sendNewOrders(goToPayDesk);
});
}
function goToPayDesk() {
var userRight = $("#gopaydesk_btn").data("allowed");
if (userRight.toLowerCase() == "yes") {
window.location.href = "paydesk.html?t=" + $("#gopaydesk_btn").data("tableid");
} else {
alert("Fehlendes Benutzerrecht f<>r Kasse");
}
}
function createRoomOrTableList(roomtableinfo,titel) {
var li = '<li data-role="list-divider" data-theme="b" data-role="heading">' + titel + '</li>';
$.each(roomtableinfo, function (i, name) {
li += '<li data-theme="f"><a href="#" id="r_' + i + '" class="info-go">' + name.name + '</a></li>';
});
return li;
}
function displayTableDialog(tableinfo,initialChange) {
$("#header_tchange").html("Tischauswahl");
var li = createRoomOrTableList(tableinfo,"Tische");
$("#roomOrTableList").empty().append(li).promise().done(function () {
if (initialChange) {
$.mobile.changePage("#tablechangedialog");
}
refreshList("#roomOrTableList");
$(this).off("click").on("click", ".info-go", function (e) {
e.stopImmediatePropagation();
e.preventDefault();
var table = ($(this).attr("id")).split("_")[1];
$("#changetablewhatdialog").data("totableid",tableinfo[table].id);
$.mobile.changePage("#changetablewhatdialog");
});
});
}
function moveOrderItemsFromTables(alsoNotPayedItems) {
var fromTableId = $("#changetablewhatdialog").data("fromtableid");
var toTableId = $("#changetablewhatdialog").data("totableid");
var notDelProd = [];
$(".notdelprod").each(function() {
var el = $(this);
var queueid = $(this).data("queueid");
notDelProd[notDelProd.length] = queueid;
});
var data = {
fromTableId:fromTableId,
toTableId:toTableId,
alsoNotPayed:(alsoNotPayedItems ? 1 : 0),
queueids:notDelProd
};
doJsonAjax("POST", "php/contenthandler.php?module=queue&command=changeTable", data, resultOfChangeTable, "Fehler Tischwechsel");
}
function moveNotDeliveredItems() {
moveOrderItemsFromTables(false);
}
function moveNotPayedAndNotDeliveredItems() {
moveOrderItemsFromTables(true);
}
function resultOfChangeTable(jsonResult) {
if (jsonResult.status != "OK") {
alert("Fehler " + jsonResult.code + ": " + jsonResult.msg + "\n\nM<6E>glicherweise hat ein Kollege\nin der Zwischenzeit Produkte zugestellt.");
} else {
alert("Tischwechsel durchgef<65>hrt!");
}
window.location.href = "waiter.html";
}
function bindChangetableButton() {
$("#changetable_btn").off("click").on("click", function (e) {
e.stopImmediatePropagation();
e.preventDefault();
var allRoomTables = $("#details-page").data("allroomtables");
var noOfRooms = allRoomTables.length;
if (noOfRooms == 1) {
displayTableDialog(allRoomTables[0].tables,true);
} else {
$("#header_tchange").html("Raumauswahl");
var li = createRoomOrTableList(allRoomTables,"R<>ume");
$("#roomOrTableList").empty().append(li).promise().done(function () {
$.mobile.changePage("#tablechangedialog");
refreshList("#roomOrTableList");
$(this).off("click").on("click", ".info-go", function (e) {
e.stopImmediatePropagation();
e.preventDefault();
var roomid = ($(this).attr("id")).split("_")[1];
displayTableDialog(allRoomTables[roomid].tables,false);
});
});
}
});
$("#move_not_del_items").off("click").on("click", function (e) {
e.stopImmediatePropagation();
e.preventDefault();
moveNotDeliveredItems();
});
$("#move_notDel_notPayed_items").off("click").on("click", function (e) {
e.stopImmediatePropagation();
e.preventDefault();
moveNotPayedAndNotDeliveredItems();
});
}
function createHtmlOfKind(workItems,kind) {
var text = "";
$.each(workItems, function (i, item) {
var kindOfItem = item.kind;
var longname = item.longname;
var option = item.option;
if (kind == kindOfItem) {
text += longname + "<br><i>" + option + "</i><br><br>";
}
});
return text;
}
function arrayContainsKind(workItems,kind) {
var result = false;
for (var i=0; i < workItems.length; i++) {
var item = workItems[i];
var kindOfItem = item.kind;
if (kind == kindOfItem) {
result= true;
}
}
return result;
}
function fillPrintAreaAndPrint(jsonContent) {
updateNotDeliveredList();
var currentTime = new Date();
var hours = currentTime.getHours();
var minutes = currentTime.getMinutes();
var timeStamp = "<i>Erstellung: " + hours + ":" + minutes + "</i>";
if (jsonContent.status == "OK") {
var printdata = jsonContent.msg;
var result = arrayContainsKind(printdata,0);
var payPrintType = $("#workprintarea").data("payPrintType");
var totalHtml = "";
if (arrayContainsKind(printdata,0)) {
var foodHeaderLine = "<h1>Speisen f<>r " + $("#workprint_btn").data("tablename") + "</h1><br>";
var foodText = foodHeaderLine + "<br>" + timeStamp + "<br><br>" + createHtmlOfKind(printdata,0) + "<br><br>";
if (payPrintType == 's') {
printJob(foodText,1);
} else {
totalHtml = foodText;
}
}
if (arrayContainsKind(printdata,1)) {
var drinkHeaderLine = "<h1>Getr<EFBFBD>nke f<>r " + $("#workprint_btn").data("tablename") + "</h1><br>";
var drinkText = drinkHeaderLine + "<br>" + timeStamp + "<br><br>" + createHtmlOfKind(printdata,1) + "<br><br>";
if (payPrintType == 's') {
printJob(drinkText,2);
} else {
totalHtml += "<br>" + drinkText;
}
}
if (payPrintType == 'l') {
$("#workprintarea").html(totalHtml);
window.print();
}
updateNewOrdersList();
} else {
alert ("Druckdaten konnten nicht angefordert werden");
}
}
function printJob(htmlText, theType) {
doJsonAjax("POST","php/contenthandler.php?module=printqueue&command=queuePrintJob",
{content : htmlText, type: theType }, null, "Druckfehler");
}
function updateNotDeliveredList() {
var roomtable_info = $("#typprodpage").data("table-info");
var tableid = roomtable_info[1];
var urlProdOfTableNotDelivered = "php/contenthandler.php?module=queue&command=getJsonLongNamesOfProdsForTableNotDelivered&"
+ "tableid=" + tableid;
var prodListToFill = "#orderedprod-list-0";
fillNotDeliveredProductsOfATable(urlProdOfTableNotDelivered,prodListToFill);
}
function doJsonAjax(getOrPost,url,data,functionToCallIfSuccess,errorMsg) {
$.ajax({ type: getOrPost,
url: url,
dataType: "json",
data: data,
async: false,
success : function(jsonContent)
{
if (functionToCallIfSuccess != null) {
functionToCallIfSuccess(jsonContent);
}
},
error: function( text ) {
alert( "Kommunikationsfehler zum Server: " + errorMsg);
}
});
}
function areYouSure(text1, text2, button, callback) {
$("#sure .sure-1").text(text1);
$("#sure .sure-2").text(text2);
$("#sure .sure-do").text(button).on("click.sure", function() {
callback();
$(this).off("click.sure");
});
$.mobile.changePage("#sure");
}
</script>
<!--first page -->
<div data-role="page" id="info-page">
<div data-role="panel" id="modulepanel-room" data-position="right" data-display="overlay">
<ul data-role="listview" id="modulemenu-room" data-divider-theme="a" data-inset="true">
<li data-role="list-divider" data-theme="b" data-role="heading">Module</li>
</ul>
</div><!-- /panel -->
<div data-role="header" data-theme="b" data-position="fixed">
<h1>Raum-Tisch</h1>
<div data-type="horizontal" style="top:0px;position:absolute;float:right;z-index:10;display:inline;" align="right" class="ui-btn-right">
<a href="#" data-role="button" data-icon="arrow-d" data-ajax="false" id="menuswitchroom">Module</a>
</div>
</div>
<div data-role="content">
<ul data-role="listview" id="room-list" data-divider-theme="a" data-inset="true">
<li data-role="list-divider" data-theme="b" data-role="heading" id=roomtableheader>R<EFBFBD>ume</li>
</ul>
</div>
<div data-role="footer" data-theme="b" id="thefooter1">
<div class="ui-grid-a">
<div class="ui-block-a userinfo" id="loggedinuser1"></div>
<div class="ui-block-b grid_right" id="versioninfo1"></div>
</div><!-- /grid-a -->
</div>
</div>
<!--second page -->
<div data-role="page" id="details-page">
<div data-role="panel" id="modulepanel-table" data-position="right" data-display="overlay">
<ul data-role="listview" id="modulemenu-table" data-divider-theme="a" data-inset="true">
<li data-role="list-divider" data-theme="b" data-role="heading">Module</li>
</ul>
</div><!-- /panel -->
<div data-role="header" data-theme="b" data-position="fixed"><a href="#" data-rel="back" data-role="button" data-icon="arrow-l">&nbsp;</a>
<h1>Tischauswahl</h1>
<div data-type="horizontal" style="top:0px;position:absolute;float:right;z-index:10;display:inline;" align="right" class="ui-btn-right">
<a href="#" data-role="button" data-icon="arrow-d" data-ajax="false" id="menuswitchtable">Module</a>
</div>
</div>
<div data-role="content">
<ul data-role="listview" id="tables-list" data-divider-theme="a" data-inset="true">
<li data-role="list-divider" data-theme="b" data-role="heading">Tische</li>
</ul>
</div>
<div data-role="footer" data-theme="b" id="thefooter2">
<div class="ui-grid-a">
<div class="ui-block-a userinfo" id="loggedinuser2"></div>
<div class="ui-block-b grid_right" id="versioninfo2"></div>
</div><!-- /grid-a -->
</div>
</div>
<!--third page (types and products)-->
<div data-role="page" id="typprodpage">
<audio id=audiofile>
<source src="customer/ding.wav" type="audio/wav" />
</audio>
<div data-role="panel" id="modulepanel-prod" data-position="right" data-display="overlay">
<ul data-role="listview" id="modulemenu-prod" data-divider-theme="a" data-inset="true">
<li data-role="list-divider" data-theme="b" data-role="heading">Module</li>
</ul>
</div><!-- /panel -->
<div id='header3' data-role="header" data-theme="b" data-position="fixed"><a href="#" data-rel="back" data-role="button" data-icon="arrow-l">&nbsp;</a>
<h1>Produktauswahl</h1>
<div data-type="horizontal" style="top:0px;position:absolute;float:right;z-index:10;display:inline;" align="right" class="ui-btn-right">
<a href="#" data-role="button" data-icon="arrow-d" data-ajax="false" id="menuswitchprod">Module</a>
</div>
</div>
<div data-role="content" class="print" id="waiterui">
<ul data-role="listview" id="typeproducts-list" data-divider-theme="a" data-inset="true">
<li data-role="list-divider" data-theme="b" data-role="heading">Auswahl</li>
</ul>
<input type="text" id="optionfield" value="" data-mini="true" placeholder="Bemerkung" />
<input type="button" id="sendorder_btn" value="Bestellung senden" data-mini="true" data-theme="e" />
<input type="button" id="workprint_btn" value="Arbeitsbon" data-mini="true" data-theme="e" />
<input type="button" id="gopaydesk_btn" value="-> Kasse" data-mini="true" data-theme="e" />
<input type="button" id="changetable_btn" value="Tischwechsel" data-mini="true" data-theme="e" />
<ul data-role="listview" id="neworders" data-divider-theme="b" data-inset="true">
<li data-role="list-divider" data-theme="b" data-role="heading">Neue Produkte</li>
</ul>
<ul data-role="listview" id="orderedprod-list-0" data-divider-theme="e" data-inset="true">
<li data-role="list-divider" data-theme="d" data-role="heading">K<EFBFBD>che/Bar</li>
</ul>
</div>
<div id=workprintarea class="print"></div>
<div data-role="footer" data-theme="b" id="thefooter3">
<div class="ui-grid-a">
<div class="ui-block-a userinfo" id="loggedinuser3"></div>
<div class="ui-block-b grid_right" id="versioninfo3"></div>
</div><!-- /grid-a -->
</div>
</div>
<!-- Dialog page -->
<div data-role="dialog" id="sure" data-title="Entfernen?">
<div data-role="content">
<h3 class="sure-1">?</h3>
<p class="sure-2">?</p>
<a href="#" class="sure-do" data-role="button" data-theme="b" data-rel="back">Ja</a>
<a href="#" data-role="button" data-theme="c" data-rel="back">Nein</a>
</div>
</div>
<!-- Dialog page -->
<div data-role="dialog" id="tablechangedialog" data-title="Tischwechsel">
<div data-role="content">
<h3 class="sure-1" id="header_tchange">?</h3>
<p class="roomtabletitel">
<div data-role="content">
<ul data-role="listview" id="roomOrTableList" data-divider-theme="a" data-inset="true">
</ul>
</div>
</p>
<a href="#" data-role="button" data-theme="c" data-rel="back">Abbrechen</a>
</div>
</div> <!-- tablechangedialog -->
<div data-role="dialog" id="changetablewhatdialog" data-title="Tischwechsel">
<div data-role="content">
<h3 class="sure-1">Auswahl der Orderelemente</h3>
<p class="roomtabletitel">Welche Orderelemente sollen dem neuen Tisch zugewiesen werden?
<div data-role="content">
<a href="#" data-role="button" data-theme="f" data-rel="back" id="move_not_del_items">nicht zugestellte</a>
<a href="#" data-role="button" data-theme="f" data-rel="back" id="move_notDel_notPayed_items">nicht zugestellte, nicht bezahlte</a>
</div>
</p>
<a href="#" data-role="button" data-theme="c" data-rel="back">Zur<EFBFBD>ck</a>
</div>
</div> <!-- changetablewhatdialog -->
</body>
</html>