ordersprinter/webapp/waiter.html

254 lines
71 KiB
HTML

<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=utf-8">
<meta name="author" content="Stefan Pichel">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.2.3">
<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-1.11.3.min.js"></script>
<script src="php/3rdparty/jquery.mobile-1.4.5.min.js"></script>
<script src="elements/tablemap.js"></script>
</head>
<style>
@media screen
{
#workprintarea {display: none;}
}
@media print
{
#waiterui,#thefooter3,#header3,#info-page,#tables-page,#modulemenu-room,#modulemenu-table,#modulemenu-prod,#discard_new_orders_no,#searchField,#searchResult {display: none;}
}
@media print
{
#workprintarea {width: 100%;};
}
</style>
<script>
var W_TABLES=["Tische","Tables","Mesas"];var W_ATABLE=["Tisch","Table","Mesa"];var W_ROOMS=["Räume","Rooms","Espacios"];var W_SELECTION=["Auswahl","Selection","Selección"];var W_LAST_SELECTED=["zuletzt","last","seleccionado"];var W_FAVS=["Favoriten","Favorites","Favoritos"];var W_NEW_ORDER=["Neue Order","New Orders","Ordenes nuevas"];var W_KIT_BAR=["nicht serviert/unbezahlt","unserved/unpaid","no servido/impagado"];var W_OTHER_PROD=["Auswahl Produktkategorie","Select product categroy","Categoría diferente"];var W_WORK_TICKET=["Arbeitsbon","Work ticket","Tique de trabajar"];var W_NOTE=["Bemerkung","Comment","Comentario"];var W_SEND_ORDERS=["Bestellung senden","Send orders","Enviar Ordenes"];var W_TO_PAYDESK=["-> Kasse","-> Paydesk","-> Caja"];var W_TABLECHANGE=["Tischwechsel","Change table","Cambiar mesa"];var W_ROOMTABLE=["Raum-Tisch","Room-Table","Espacio-Mesa"];var W_TABLE_SEL=["Tischauswahl","Select table","Qué mesa?"];var W_UNDELIV_INFO=["Liste enthält die Produkte die noch in der Küchen-/Baransicht sind, sowie unbezahlte Produkte, die die Bereitstellungsansicht nicht durchlaufen.","List contains the products which are still in kitchen or bar view, as well as unpaid products that do not pass the supplydesk view.","La lista contiene los productos que estan todavía en modulo de cocina/bar, también productos impagados que no pasan vista de productos preparados."];var W_REMOVE_ERROR=["Ansicht nicht mehr aktuell - Liste wird neu geladen.","View is obsolete - List will be reloaded.","Vista no esta actual - vamos a actualisar la lista."];var W_FOOD_FOR=["Speisen für","Food for","Comidas para"];var W_DRINKS_FOR=["Getränke für","Beverage for","Bebidas para"];var W_ACT_NEW_ORD_EL=["Aktion auswählen","Select action","Que acción?"];var W_ACT_CHANGE=["Ändern","Modify","Modificar"];var W_ACT_CHANGE_ALL=["Alle Ändern","Modify all","Modificar todo"];var W_ACT_CHANGE_ONE=["Einen Artikel ändern","Modify one item","Modificar un artículo"];var W_APPLY=["Anwenden","Apply","Aplicar"];var W_CANCEL=["Abbrechen","Cancel","Cancelar"];var W_STILL_UNSENT_ORDERS=["Es sind noch ungesendete Orders vorhanden!","There are unsent orders in the list","Hay elementos in la liste que no han enviados"];var W_EXTRAS=["Extras/Optionen","Add-ons/Options","Opciones"];var W_OPEN_PANEL=["Extras-Auswahl noch offen","Add-ons selection still open","Selección de opciones todavía abierta"];var W_DEL=["Löschen","Delete","Removar"];var W_MSG=["Nachricht","Message","Mensaje"];var W_CHANGE_PRICE=["Neuer Preis: ","New price: ","Cambiar precio: "];var W_PRICE=["Preis","Price","Precio"];var W_WRONG_FORMAT=["Falsches Zahlenformat","Wrong number format","Formato de precio incorecto"];var W_TOGO=["Außer-Haus-Verkauf","Sale with Tax No 2","Venta IVA 2"];var W_YES=["Ja","Yes","Si"];var W_NO=["Nein","No","No"];var W_DISCARD_NO_ASK=["Es sind noch ungesendete Orders vorhanden! Sollen diese verworfen werden?","There are still unsent orders. Do you want to discard them?","Hay todavía ordenes non-enviados. Removarlos?"];var W_DISCARD_HEADER=["Neue Orders verwerfen?","Discard new orders?","Removar ordenes nuevos?"];var W_SEARCH=["Produktsuche","Product search","Buscar producto"];var W_SEARCHRESULTS=["Suchergebnis","Search Result","Encontrado"];var W_WRONG_PIN=["Falscher Stornocode","Wrong cancel code","Codigo falso"];var W_NO_ORDERS=["Keine gebuchten Orders vorhanden!","No orders available!","No hay ningún orden!"];var W_TO_PAY=["offen","to pay","a pagar"];var W_MOVE_PRODS=["Produkte verschieben","Move products","Productos a otra mesa"];var W_NO_PRODS_SELECTED=["Es wurden keine Produkte ausgewählt!","You have not chosen any products!","No ha seleccionado ningún producto!"];var W_MAX_PRICE_EXCEEDED=["Der Maximalwert für den Preis wurde überschritten!","The max. value for the price is exceeded!","El valor del precio es más que el maximum!"];var W_REORDER=["Nachbestellen","Reorder","Order una vez mas"];var W_REMOVE=["Entfernen","Remove","Removar"];var W_SELALL=["Alles auswählen","Select all","Elegir todo"];var W_UNSELALL=["Alles abwählen","Unselect all","No elegir nada"];var CHANGE_ALL=0;var CHANGE_ONE=1;var WORKFLOW_DIGI_WORK=0;var WORKFLOW_DIGI=1;var WORKFLOW_WORK=2;var WORKFLOW_WORK_SEND=3;function Grouping(b,a){this.set=b;this.sortedset=[];this.group=function(){this.sortedset=[];for(var g=0;g<this.set.length;g++){var e=this.set[g];if(this.sortedset.length==0){e.count=1;e.ids=[e.id];this.sortedset[this.sortedset.length]=e}else{var f=a(e);var k=false;for(j=0;j<this.sortedset.length;j++){var l=this.sortedset[j];var c=a(l);if(f==c){l.count=l.count+1;var h=l.ids;h[h.length]=e.id;k=true;break}}if(!k){e.count=1;e.ids=[e.id];this.sortedset[this.sortedset.length]=e}}}};this.outputList=function(e){var c="";for(var g=0;g<this.sortedset.length;g++){var f=this.sortedset[g];c+=e(f)}return c};this.getItemsOfRow=function(m){var l=this.sortedset[m];var h=l.ids;var e=[];for(var f=0;f<h.length;f++){var k=h[f];for(var g=0;g<this.set.length;g++){var c=this.set[g];if(c.id==k){e[e.length]=c;break}}}return e};this.popSortedEntry=function(f){var c=this.sortedset[f];var e=c.ids;var h=e.pop();var g=this.popSetEntry(h);this.group();return g};this.popSetEntry=function(f){for(var e=0;e<this.set.length;e++){var c=this.set[e];if(c.id==f){this.set.splice(e,1);return c}}};this.getSourceSet=function(){return this.set};this.getGroupedList=function(){return this.sortedset}}var lang=0;var nextPage="";var workflowconfig=0;var decpoint=".";var currency="";var rightchangeprice=0;var supplyright=0;var keeptypelevel=1;var applyExtraBtnPos=1;var prominentsearch=0;var discount1=50;var discount2=20;var discount3=10;var osroombtnsize=0;var ostablebtnsize=0;var osprodbtnsize=0;var neworders=[];var groupedNewOrders={count:[],joinedvals:[],name:[],prodids:[],extras:[],origidxs:[],changedPrices:[],togos:[]};var levelOneType=0;var w_extras=[];var w_allextras=[];var extrasMenuOpen=false;var tminfo=null;var htmlComments="";var predefinedComments="";var cancelunpaidcode="";var notDeliveredProdsAvailable=false;var selectedProdCount=1;var currentRoomIndex=0;var isTogoOrderSelected=false;var idOfHigherType=0;var tableListActive=false;var queueIdsOfTakeAway=[];var lastSelectedProduct="";var waitergopayprint=0;var prodsToMove=[];var allselected=0;function toHtml(a){return(a.replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;"))}function setLanguage(h){lang=h;$("#roomtableheader2").html(W_ROOMTABLE[lang]);$("#tableselection").html(W_TABLE_SEL[lang]);$("#actiontxt").html(W_ACT_NEW_ORD_EL[lang]);$("#actdeltxt").html(W_DEL[lang]);$("#discard_new_orders_yes").html(W_YES[lang]);$("#discard_new_orders_no").html(W_NO[lang]);$("#discardnewordersask").html(W_DISCARD_NO_ASK[lang]);$("#discardnoheader").html(W_DISCARD_HEADER[lang]);$("#moveprods").html(W_MOVE_PRODS[lang]);var f="";if(prominentsearch==0){f+='<div id=searchResult></div><div><input type="text" id="searchField" value="" data-mini="true" placeholder="'+W_SEARCH[lang]+'" />'}else{f+='<div><input type="text" id="searchField" value="" data-mini="true" placeholder="'+W_SEARCH[lang]+'" autofocus /><div id=searchResult></div>'}f+="</div>";var e='<div class="ui-grid-a"> <div class="ui-block-a" id="commentgridfield" style="width:80%"><input type="text" id="optionfield" value="" data-mini="true" placeholder="'+W_NOTE[lang]+'" /></div> <div class="ui-block-b" id="predefcommentgridfield" style="width:20%"><select name="select-comment" id="select-comment"></select></div> </div>';if(prominentsearch==0){$("#searchposition-normal").html(f)}else{$("#searchposition-prominent").html(f)}var b=e;if((workflowconfig==WORKFLOW_DIGI_WORK)||(workflowconfig==WORKFLOW_DIGI)||(workflowconfig==WORKFLOW_WORK_SEND)){b+='<a data-role="button" data-theme="e" class="osbigbtn" id="sendorder_btn">'+W_SEND_ORDERS[lang]+"</a>"}if((workflowconfig==WORKFLOW_DIGI_WORK)||(workflowconfig==WORKFLOW_WORK)||(workflowconfig==WORKFLOW_WORK_SEND)){b+='<a data-role="button" data-theme="e" class="osbigbtn" id="workprint_btn">'+W_WORK_TICKET[lang]+"</a>"}b+='<a data-role="button" data-theme="e" class="osbigbtn" id="gopaydesk_btn">'+W_TO_PAYDESK[lang]+'</a><input type="button" id="changetable_btn" value="'+W_TABLECHANGE[lang]+'" data-mini="true" data-theme="e" />';$("#commandbuttons").html(b);$("#waiterui").trigger("create");var c='<div class="ui-grid-a"> <div class="ui-block-a" id="actcommentgridfield" style="width:80%"><input type="text" id="act-optionfield" value="" data-mini="true" placeholder="'+W_NOTE[lang]+'" /></div> <div class="ui-block-b" id="actpredefcommentgridfield" style="width:20%"><select name="act-select-comment" id="act-select-comment"></select></div> </div>';$("#actremark").html(c);if(rightchangeprice==1){var a='<input type="text" id="act-changepricefield" value="" data-mini="true" placeholder="'+W_CHANGE_PRICE[lang]+'" />';$("#actchangepricesection").html(a);var g='<div class="ui-grid-c">';g+='<div class="ui-block-a" style="width:30%"><a href="#" data-role="button" data-theme="c" id="discount1">'+discount1+" %</a></div>";g+='<div class="ui-block-b" style="width:30%"><a href="#" data-role="button" data-theme="c" id="discount2">'+discount2+" %</a></div>";g+='<div class="ui-block-c" style="width:30%"><a href="#" data-role="button" data-theme="c" id="discount3">'+discount3+" %</a></div>";g+="</div>";$("#actdiscount").html(g)}$("#actionneworderconfirm_all").html(W_ACT_CHANGE_ALL[lang]);$("#actionneworderconfirm_one").html(W_ACT_CHANGE_ONE[lang]);$("#actionnewordercancel").html(W_CANCEL[lang]);$("#select-comment").off("click").on("click",function(k){k.stopImmediatePropagation();k.preventDefault();var i=$("#select-comment").find(":selected").val();$("#optionfield").val(i)});$("#act-select-comment").off("click").on("click",function(k){k.stopImmediatePropagation();k.preventDefault();var i=$("#act-select-comment").find(":selected").val();$("#act-optionfield").val(i)});$("#discard_new_orders_no").off("click").on("click",function(i){i.stopImmediatePropagation();i.preventDefault();parent.history.back()});$("#discard_new_orders_no").off("click").on("click",function(i){i.stopImmediatePropagation();i.preventDefault();parent.history.back()});$("#discard_new_orders_yes").off("click").on("click",function(i){i.stopImmediatePropagation();i.preventDefault();neworders=[];gotoOtherPage($("#discardnewordersdlg").data("link"))});$("#prodbackbtn").off("click").on("click",function(i){if(neworders.length!=0){i.stopImmediatePropagation();i.preventDefault();hideMenuProd();$("#discardnewordersdlg").data("link","back_table");$.mobile.changePage("#discardnewordersdlg")}else{parent.history.back()}});$("#searchField").off("keyup").on("keyup",function(i){generateSearchResults()})}function generateSearchResults(){var e=$("#searchField").val().trim().toLowerCase();if(e.length<3){$("#searchResult").html("")}else{var c=getProdSizeClass();var b='<ul data-role="listview" id="search-list" data-divider-theme="a" data-inset="true">';b+='<li data-role="list-divider" data-theme="b" data-role="heading">'+W_SEARCHRESULTS[lang]+"</li>";var a=$("#typprodpage").data("types_prods_sorted");$.each(a,function(g,h){var f=h.longname;if(f.toLowerCase().indexOf(e)>=0){b+='<li data-theme="c" data-icon="false"><a href="#" id="sr_'+h.id+'" class="searchresult '+c+'">'+toHtml(f);b+=createSearchProdInfoTxt(h.id);b+="</a></li>"}});b+="</ul>";$("#searchResult").html(b);$("#searchResult").trigger("create");$(".srinfo").off("click").on("click",function(i){i.stopImmediatePropagation();i.preventDefault();var f=this.id.split("_")[1];var h=getProdEntry(f);var g=h.price;alert(W_PRICE[lang]+": "+g+" "+currency)});$(".srplus").off("click").on("click",function(h){h.stopImmediatePropagation();h.preventDefault();var g=this.id.split("_")[1];var f=getSearchProdCount(g);$("#srprodcount_"+g).html(f+1)});$(".srminus").off("click").on("click",function(h){h.stopImmediatePropagation();h.preventDefault();var g=this.id.split("_")[1];var f=getSearchProdCount(g);if(f==2){$("#srprodcount_"+g).html("");selectedProdCount=1}else{if(f>2){$("#srprodcount_"+g).html(f-1)}}});$(".searchresult").off("click").on("click",function(g){g.stopImmediatePropagation();g.preventDefault();var f=this.id.split("_")[1];selectedProdCount=getSearchProdCount(f);clearSearchAndGoToHigherTypeIfExtrasOpen();levelOneType=0;handleClickOnProd(f)})}}function fillGenCommentsList(f){if(f.status!="OK"){alert("Fehler "+f.code+": "+f.msg);return}var b='<option value=""></option>';var e=f.msg;var c=0;for(c=0;c<e.length;c++){var a=e[c].comment;a=toHtml(a);b+='<option value="'+a+'">'+a+"</option>"}htmlComments=b;predefinedComments=b;$("#select-comment").html(b);$("#select-comment").selectmenu("refresh")}function initializeMainMenu(a,h,e,i,g){$("#"+e).html("&nbsp;"+a.user);$("#"+i).html(a.version+"&nbsp;");var k='<li data-role="list-divider" data-theme="b" data-role="heading">Module</li>';$.each(a.menu,function(n,m){var l=m.name;var o=m.link;if(g){k+='<li data-theme="e"><a class="modules" href="#" id="menu_'+o+'">'+l+"</a></li>"}else{k+='<li data-theme="e"><a class="modulebutton" href="'+o+'" target="_top">'+l+"</a></li>"}});$(h).empty().append(k).promise().done(function(){refreshList(h)});if(h=="#modulemenu-room"){var c=a.waitermessage;if(c!=""){$("#waitermessage").show();var b='<li data-role="list-divider" data-theme="b" data-role="heading">'+W_MSG[lang]+"</li>";var f='<li data-theme="d">'+c+"</li>";$("#waitermessage").html(b+f);refreshList("#waitermessage")}else{$("#waitermessage").hide()}}$(".modulebutton").off("click").on("click",function(m){var l=$(this).attr("href");doJsonAjaxAsync("POST","php/contenthandler.php?module=admin&command=setLastModuleOfUser",{view:l},null,"Problem Benutzerdatenpflege",false)})}function refreshList(a){if($(a).hasClass("ui-listview")){$(a).listview("refresh")}else{$(a).trigger("create")}}function gotoOtherPage(a){var b=a.split("_");if(b[0]=="menu"){doJsonAjax("POST","php/contenthandler.php?module=admin&command=setLastModuleOfUser",{view:b[1]},null,null);setTimeout(function(){document.location.href=b[1]},250)}else{if(b[0]=="back"){$("#discardnewordersdlg").dialog("close");parent.history.back()}}}function moduleForward(a){if(neworders.length==0){gotoOtherPage(a)}else{hideMenuProd();$("#discardnewordersdlg").data("link",a);$.mobile.changePage("#discardnewordersdlg")}}function getPayPrintType(){doJsonAjax("GET","php/contenthandler.php?module=admin&command=getPayPrintType",null,insertPayPrintType,"Fehler Druckkonfiguration")}function insertPayPrintType(a){$("#workprintarea").data("payPrintType",a)}function getUserHasRightForPaydesk(){doJsonAjax("GET","php/contenthandler.php?module=admin&command=hasUserPaydeskRight",null,hasUserPaydeskRight,"Fehler Kassenberechtigung")}function hasUserPaydeskRight(a){$("#gopaydesk_btn").data("allowed",a)}function hideMenuRoom(){$("#modulepanel-room").panel("close");$("#menuswitch").off("click").on("click",function(a){a.stopImmediatePropagation();a.preventDefault();$("#modulepanel-room").panel("open")})}function hideMenuTable(){$("#modulepanel-table").panel("close");$("#menuswitchtable").off("click").on("click",function(a){a.stopImmediatePropagation();a.preventDefault();$("#modulepanel-table").panel("open")})}function hideMenuProd(){$("#modulepanel-prod").panel("close");$("#menuswitchprod").off("click").on("click",function(a){a.stopImmediatePropagation();a.preventDefault();$("#modulepanel-prod").panel("open")})}function addProductToQueueNoGuiUpdate(f,l,g,c,e){var b=getProdProperties(f);var a=b.name;var h=b.price;var m={name:a,option:l,extras:g,prodid:f,price:h,changedPrice:c,togo:e};for(var k=0;k<selectedProdCount;k++){neworders[neworders.length]={name:m.name,option:m.option,extras:m.extras,prodid:m.prodid,price:m.price,changedPrice:m.changedPrice,togo:m.togo}}selectedProdCount=1}function addProductToQueue(f,g,c,e){var l=$("#optionfield").val();$("#optionfield").val("");$("#select-comment").html(htmlComments);$("#select-comment").selectmenu("refresh");var b=getProdProperties(f);var a=b.name;lastSelectedProduct=a;$("#lastselectedprod").html(lastSelectedProdToStr());var h=b.price;var m={name:a,option:l,prodid:f,price:h,extras:g,changedPrice:c,togo:e};for(var k=0;k<selectedProdCount;k++){neworders[neworders.length]={name:m.name,option:m.option,extras:m.extras,prodid:m.prodid,price:m.price,changedPrice:m.changedPrice,togo:m.togo}}selectedProdCount=1;updateNewOrdersGui()}function updateNewOrdersList(){var f=0;if(neworders.length==0){$("#changetable_btn").closest(".ui-btn").show();$("#sendorder_btn").closest(".ui-btn").hide();$("#workprint_btn").closest(".ui-btn").hide()}else{$("#changetable_btn").closest(".ui-btn").hide();$("#sendorder_btn").closest(".ui-btn").show();$("#workprint_btn").closest(".ui-btn").show()}var m='<li data-role="list-divider" data-theme="b" data-role="heading">'+W_NEW_ORDER[lang]+"</li>";var l=groupedNewOrders.count.length;for(f=0;f<l;f++){var k=toHtml(groupedNewOrders.name[f]);var h=groupedNewOrders.option[f];var g=groupedNewOrders.count[f];if(g>1){k="<span style='font-size: 23px;'>"+g.toString()+"x</span> "+k}var e=groupedNewOrders.prodids[f];if(h!=""){h="<p>"+toHtml(h)+"</p>"}var b=groupedNewOrders.changedPrices[f];var a=groupedNewOrders.togos[f];var n="";var c=groupedNewOrders.extras[f];if((c!=null)&&(c!="")){n="<span style='font-size: 14px;'><i>"+c+"</i></span>"}if(b!="NO"){b=b.replace(".",decpoint);if(a!=0){m+='<li data-theme="c" data-icon="arrow-d"><a href="#" id="new_'+e+'" class="neworder_el '+getProdSizeClass()+'">'+k+h+n+" ("+b+" - To-Go)</a></li>"}else{m+='<li data-theme="c" data-icon="arrow-d"><a href="#" id="new_'+e+'" class="neworder_el '+getProdSizeClass()+'">'+k+h+n+" ("+b+")</a></li>"}}else{if(a!=0){m+='<li data-theme="c" data-icon="arrow-d"><a href="#" id="new_'+e+'" class="neworder_el '+getProdSizeClass()+'">'+k+h+n+" - To-Go</a></li>"}else{m+='<li data-theme="c" data-icon="arrow-d"><a href="#" id="new_'+e+'" class="neworder_el '+getProdSizeClass()+'">'+k+h+n+"</a></li>"}}}$("#neworders").html(m);refreshList("#neworders");binding_neworderelem()}function getProdSizeClass(){if(osprodbtnsize==1){return("osprod-1")}else{if(osprodbtnsize==2){return("osprod-2")}}return""}function binding_neworderelem(){$(".neworder_el").off("click").on("click",function(c){c.stopImmediatePropagation();c.preventDefault();var b=$("#neworders li").index($(this).closest("li"))-1;var a={count:groupedNewOrders.count[b],name:groupedNewOrders.name[b],price:groupedNewOrders.price[b],option:groupedNewOrders.option[b],extras:groupedNewOrders.extras[b],prodid:groupedNewOrders.prodids[b],origidxs:groupedNewOrders.origidxs[b],changedPrices:groupedNewOrders.changedPrices[b],togos:groupedNewOrders.togos[b]};$("#actiononneworderel").data("entry",a);$("#actiononneworderel").data("newcount",a.count);$("#actiononneworderel").data("groupedListIndex",b);$("#act-optionfield").val(a.option);$("#togocheckbox").prop("checked",a.togos==1?true:false);actionSelOnNewOrderElem()})}function sendNewOrders(c,f,a){var g=$("#typprodpage").data("table-info");var b=g[1];if(neworders.length!=0){var e={tableid:b,prods:neworders,print:(c?1:0),payprinttype:f};$("#typprodpage").data("neworders",[]);if(f=="s"){doJsonAjax("POST","php/contenthandler.php?module=queue&command=addProductListToQueue",e,a,"Fehler bei Produktversand")}else{doJsonAjax("POST","php/contenthandler.php?module=queue&command=addProductListToQueue",e,fillPrintAreaAndPrint,"Fehler bei Produktversand")}}else{if(c&&notDeliveredProdsAvailable){}}}function reloadPage(){tableListActive=false;setTimeout(function(){document.location.href="waiter.html"},250)}function gotoTablePage(){var a=$("#tables-page").data("allroomtables");var b=a.length;if(!isTogoOrderSelected||(b==1)){$.mobile.changePage("#tables-page")}else{reloadPage()}}function removeProductFromQueue(a,c,f,e,b){if(!b){alert(W_WRONG_PIN[lang]);return}$.ajax({type:"POST",dataType:"json",url:"php/contenthandler.php?module=queue&command=removeProductFromQueue",data:{queueid:a,isPaid:c,isCooking:f,isReady:e},async:false,success:function(k){if(k.status!="OK"){alert(W_REMOVE_ERROR[lang])}var i=$("#typprodpage").data("table-info");var g=i[1];var h="php/contenthandler.php?module=queue&command=getJsonLongNamesOfProdsForTableNotDelivered&tableid="+g;fillNotDeliveredProductsOfATable(h)},error:function(g){alert("Sorry, Fehler bei Produktentfernung!")}})}function reorderProduct(e,a,f){var c=[];for(var b=0;b<a.length;b++){c[c.length]={id:a[b],name:f[b]}}addProductToNewOrdersList(e,c)}function getWaiterSettings(){doJsonAjax("GET","php/contenthandler.php?module=admin&command=getWaiterSettings",null,insertWaiterSettings,"Fehler Konfigurationsdaten")}function insertWaiterSettings(c){var a=c.isUserLoggedIn;if(a!=1){setTimeout(function(){document.location.href="index.html"},250)}else{var b=c.config;workflowconfig=b.workflowconfig;decpoint=b.decpoint;currency=b.currency;rightchangeprice=c.rightchangeprice;supplyright=c.supplyright;keeptypelevel=c.keeptypelevel;applyExtraBtnPos=c.extrasapplybtnpos;prominentsearch=b.prominentsearch;waitergopayprint=b.waitergopayprint;discount1=b.discount1;discount2=b.discount2;discount3=b.discount3;setLanguage(c.userlanguage);if(rightchangeprice==1){$("#changepricesection").show()}else{$("#changepricesection").hide()}if((b.cancelunpaidcode!=null)&&(b.cancelunpaidcode!="")){cancelunpaidcode=b.cancelunpaidcode}else{cancelunpaidcode=""}osroombtnsize=c.buttonsizes.roombtnsize;ostablebtnsize=c.buttonsizes.tablebtnsize;osprodbtnsize=c.buttonsizes.prodbtnsize;initializeMainMenu(c.jsonMenuItemsAndVersion,"#modulemenu-room","loggedinuser1","versioninfo1",false);initializeMainMenu(c.jsonMenuItemsAndVersion,"#modulemenu-table","loggedinuser2","versioninfo2",false);initializeMainMenu(c.jsonMenuItemsAndVersion,"#modulemenu-prod","loggedinuser3","versioninfo3",true);doJsonAjax("GET","php/contenthandler.php?module=products&command=getAllGeneralComments",null,fillGenCommentsList,"Fehler Bemerkungsdatensatz");getTableMapPreferences();neworders=[];updateNewOrdersGui();initializeEverything()}}$(document).ready(function(){intervalGetPrinterStatus(5)});$(document).on("pageinit","#info-page",function(){fetchTypeProdsFromServer();getWaiterSettings();fetchMenuInInterval(60);intervalFetchRoomTableInfoFromServer(10)});function intervalFetchRoomTableInfoFromServer(b){var a=setInterval(function(){if(tableListActive){doJsonAjaxAsync("GET","php/contenthandler.php?module=products&command=getAllTypesAndAvailProds",null,updateTableViewIfListStillOpen,true)}},b*1000)}function intervalGetPrinterStatus(b){var a=setInterval(function(){doJsonAjaxAsync("GET","php/contenthandler.php?module=admin&command=isPrinterServerActive",null,setPrinterStatus,true)},b*1000)}function setPrinterStatus(a){if(a.status==="OK"){if(a.msg===0){$(".printerstatus").show();return}}$(".printerstatus").hide()}function updateTableViewIfListStillOpen(){$.getJSON("php/contenthandler.php?module=roomtables&command=showAllRooms",function(a){if(tableListActive){insertTableList(a)}})}function fetchMenuInInterval(b){var a=setInterval(function(){fetchTypeProdsFromServer()},b*1000)}function getTableMapPreferences(){doJsonAjax("GET","php/tablemap.php?command=getTableMapPreferences",null,insertTMInfo,"Keine TM-Information")}function insertTMInfo(a){tminfo=a}function updateTableList(){$.getJSON("php/contenthandler.php?module=roomtables&command=showAllRooms",function(a){insertTableList(a)})}function insertTableList(e){var c=e.roomstables;$("#tables-page").data("allroomtables",c);var f=c.length;var a=c;if(f==1){$("#info-page").data("type","t");$("#tables-page").data("roomdetail",c[0]);nextPage="typprodpage"}else{$("#info-page").data("type","r");$("#roomtableheader").html(W_ROOMS[lang]);var b=a[currentRoomIndex];$("#tables-page").data("roomdetail",b)}displayTablesListOrMap("#tables-list")}function initializeEverything(){lastSelectedProduct="";$(".modules").off("click").on("click",function(a){a.stopImmediatePropagation();a.preventDefault();moduleForward(this.id)});hideMenuRoom();$.getJSON("php/contenthandler.php?module=roomtables&command=showAllRooms",function(h){queueIdsOfTakeAway=h.takeawayReadyQueueIds;var g=h.roomstables;$("#tables-page").data("allroomtables",g);var i=g.length;var b=g;if(i==1){$("#info-page").data("type","t");$("#tables-page").data("roomdetail",g[0]);nextPage="tables-page";currentRoomIndex=0;$.mobile.changePage("#tables-page");$("#tableselbackbtn").hide()}else{$("#info-page").data("type","r");$("#roomtableheader").html(W_ROOMS[lang]);var a="";var e="";if(osroombtnsize==1){e="osroom-1"}else{if(osroombtnsize==2){e="osroom-2"}}$.each(b,function(l,k){a+='<li data-theme="f"><a href="#" id="'+l+'" class="info-go '+e+'">'+k.name+"</a></li>"});a+='<li data-theme="e"><a href="#" class="togoorder '+e+'">'+W_TOGO[lang];var f=h.takeawayprice;var c=f.replace(".",decpoint)+" "+currency;if(f!=0){a+=" ("+W_TO_PAY[lang]+": "+c+")"}a+=createServeInfo(null,h.takeawayprodcount,h.takeawayprodready);a+="</a></li>";$("#room-list").append(a).promise().done(function(){bindTogoOrdering();bindServeClick();$(this).off("click").on("click","a",function(l){l.stopImmediatePropagation();l.preventDefault();var k=b[this.id];currentRoomIndex=this.id;isTogoOrderSelected=false;$("#tables-page").data("roomdetail",k);nextPage="tables-page";$.mobile.changePage("#tables-page")});refreshList(this)})}})}function shallDisplayRoom(b){for(var a=0;a<tminfo.length;a++){if(tminfo[a].roomid==b){return{show:tminfo[a].displaymap==1?true:false,pos:tminfo[a].tablepositions}}}return{show:false}}function handleClickInTablemap(a){forwardDisplayToProductView.call(this,a.roomid,a.tableid,a.tablename)}$(document).on("pagebeforeshow","#tables-page",function(){lastSelectedProduct="";tableListActive=true;if(nextPage==""){reloadPage()}hideMenuTable();checkForLogIn();$("#searchField").val("");generateSearchResults();$("#tableselbackbtn").off("click").on("click",function(a){a.stopImmediatePropagation();a.preventDefault();tableListActive=false;$.mobile.changePage("#info-page")});updateTableList()});$(document).on("pagebeforeshow","#changetablewhatdialog",function(){var a=$("#changetablewhatdialog").data("fromtableid");doJsonAjax("GET","php/contenthandler.php?module=queue&command=getProdsForTableChange",{tableId:a},insertProductsToChangeTableDlg,"Tischartikel")});function insertProductsToChangeTableDlg(a){if(a.status!="OK"){alert("Fehler");return}prodsToMove=a.msg;allselected=1;updateProdToMoveList();$("#selectallnothing").off("click").on("click",function(f){f.stopImmediatePropagation();f.preventDefault();allselected=1-allselected;for(var c=0;c<prodsToMove.length;c++){var b=prodsToMove[c];if(allselected===1){b["class"]="selecteditem"}else{b["class"]="unselecteditem"}}updateProdToMoveList()})}function updateProdToMoveList(){if(allselected===1){$("#selectallnothing_txt").html(W_UNSELALL[lang])}else{$("#selectallnothing_txt").html(W_SELALL[lang])}var a="";for(var f=0;f<prodsToMove.length;f++){var c=prodsToMove[f];var k="prodToMove_"+f;var b=" (unbezahlt)";var h="e";if(c["class"]===undefined){c["class"]="selecteditem"}var e=c["class"];if(e=="unselecteditem"){h="a"}if(c.status==="unpaid_undelivered"){b=" (unbezahlt, nicht serviert)"}if((workflowconfig==WORKFLOW_WORK)||(workflowconfig==WORKFLOW_WORK_SEND)){b=""}var g="<span class='"+e+"'>"+c.productname+b+"</span>";a+="<li data-theme='"+h+"' class='prodToMoveEl' id='"+k+"' >"+g+"</li>"}$("#productsToMoveList").html(a);refreshList("#productsToMoveList");handleClickOnMoveableProd()}function handleClickOnMoveableProd(){$(".prodToMoveEl").off("click").on("click",function(f){f.stopImmediatePropagation();f.preventDefault();var b=this.id.split("_")[1];var a=prodsToMove[b];var c=a["class"];if(c=="unselecteditem"){a["class"]="selecteditem"}else{a["class"]="unselecteditem"}updateProdToMoveList()});$("#moveprods").off("click").on("click",function(k){k.stopImmediatePropagation();k.preventDefault();var g=[];for(var f=0;f<prodsToMove.length;f++){var m=prodsToMove[f];var l=m["class"];if(l=="selecteditem"){g[g.length]=m.queueid}}if(g.length===0){alert(W_NO_PRODS_SELECTED[lang])}else{var b=g.join();var h=$("#changetablewhatdialog").data("fromtableid");var a=$("#changetablewhatdialog").data("totableid");var c={fromTableId:h,toTableId:a,queueids:b};doJsonAjax("POST","php/contenthandler.php?module=queue&command=changeTable",c,resultOfChangeTable,"Fehler Tischwechsel")}})}function createTextAreaForChangeTable(b){var a="<textarea class='changetableprodlist'>";for(var c=0;c<b.length;c++){var e=b[c];a+=e.mycount+"x "+e.productname+"\n"}a+="</textarea>";return a}function displayTablesListOrMap(h){var g=$("#tables-page").data("roomdetail");if($("#info-page").data("type")=="t"){$("#tableselbackbtn").hide()}else{$("#tableselbackbtn").show()}var a=g.id;var l=g.tables;var i=shallDisplayRoom(a);var c=$("#info-page").data("type");if(i.show){$(h).hide();d=new Date();$("#mapimgpart").attr("src","php/tablemap.php?command=getTableMapImgAsPng&showBubbles=0&roomid="+a+"&"+d.getTime());$("#tablemapcontent").show();var b=new Tablemap(a,null,"");var e=b.createOverlay("#mapimgpart",i.pos,W_TO_PAY[lang],decpoint,currency,l,ostablebtnsize);$("#tableoverlay").html(e);b.bindingForOverlaySelection(handleClickInTablemap.bind(this),a,l);if(c=="t"){var k='<li data-theme="d"><a href="#" class="togoorder '+f+'">'+W_TOGO[lang]+"</a></li></ul>";$("#tables-list-togo").html(k);$("#togoarea").show();refreshList("#tables-list-togo");bindTogoOrdering();bindServeClick()}}else{$(h).show();$("#togoarea").hide();$("#tablemapcontent").hide();var k='<li data-role="list-divider" data-theme="b" data-role="heading">'+W_TABLES[lang]+"</li>";var f="";if(ostablebtnsize==1){f="ostable-1"}else{if(ostablebtnsize==2){f="ostable-2"}}$.each(l,function(p,s){var r=s.pricesum;var n=r.replace(".",decpoint)+" "+currency;var o=s.prodcount;var m=s.prodready;var q=s.readyQueueIds;if(r!=0){k+='<li data-theme="e" data-icon="false"><a href="#" id="'+p+'" class="info-go tbusy '+f+'">'+s.name+" ("+W_TO_PAY[lang]+": "+n+")"+createServeInfo(s.id,o,m)+"</a></li>"}else{k+='<li data-theme="e" data-icon="false"><a href="#" id="'+p+'" class="info-go tempty '+f+'">'+s.name+createServeInfo(s.id,o,m)+"</a></li>"}});if(c=="t"){k+='<li data-theme="f" data-icon="false"><a href="#" class="togoorder '+f+'">'+W_TOGO[lang]+"</a></li>"}$(h).empty().append(k).promise().done(function(){bindTogoOrdering();bindServeClick();$(this).off("click").on("click",".info-go",function(p){p.stopImmediatePropagation();p.preventDefault();var o=g;var m=l[this.id]["id"];var n=l[this.id]["name"];forwardDisplayToProductView.call(this,a,m,n)});refreshList(this)})}}function bindServeClick(){$(".prodreadyicon").off("click").on("click",function(l){l.stopImmediatePropagation();l.preventDefault();var f=this.id.split("_")[1];var h=queueIdsOfTakeAway;if((f!=null)&&(f!="n")){var a=$("#tables-page").data("roomdetail");var c=a.tables;for(var b=0;b<c.length;b++){var g=c[b];if(g.id==f){h=g.readyQueueIds}}}if(h.length>0){var k=h.join();doJsonAjax("POST","php/contenthandler.php?module=queue&command=declareMultipleProductsDelivered",{queueids:k},updateAfterDelivery,"Bereitstellung")}})}function updateAfterDelivery(a){if(tableListActive){updateTableList()}else{reloadPage()}}function bindTogoOrdering(){$(".togoorder").off("click").on("click",function(a){a.stopImmediatePropagation();a.preventDefault();isTogoOrderSelected=true;forwardDisplayToProductView.call(this,0,0,W_TOGO[lang])})}function forwardDisplayToProductView(b,a,c){neworders=[];updateNewOrdersGui();var e=new Array(b,a,c);$("#typprodpage").data("table-info",e);nextPage="typprodpage";$.mobile.changePage("#typprodpage");neworders=[];updateNewOrdersGui()}function attachAndDisplayFirstRefTypes(e){$("#typprodpage").data("types_prods",e);var a=e.prods;var c=[];for(var b=0;b<a.length;b++){var g=a[b];var f={id:g.id,name:g.name,longname:g.longname,audio:g.audio,ref:g.ref,favorite:g.favorite,price:g.price,tax:g.tax,extras:g.extras};c[c.length]=f}c.sort(prodcompare);$("#typprodpage").data("types_prods_sorted",c)}function prodcompare(e,c){return e.longname.localeCompare(c.longname)}function listOfExtras(c){var l=getProdSizeClass();var k='<li data-role="list-divider" data-theme="b" data-role="heading">'+W_EXTRAS[lang]+"</li>";if(applyExtraBtnPos!=1){k+='<li data-theme="c"><a href="#" id="extra_atop_'+c+'" class="extrasel '+l+'">'+W_APPLY[lang]+"</a></li>"}for(var f=0;f<w_allextras.length;f++){var e=w_allextras[f];var a=e.extraid;var g=e.name;var b="d";var h="delete";if(w_extras.indexOf(a)>=0){b="f";h="check"}k+='<li data-theme="'+b+'" data-icon="'+h+'"><a href="#" id="extra_'+a+"_"+c+'" class="extrasel '+l+'">'+toHtml(g)+"</a></li>"}if(applyExtraBtnPos!=2){k+='<li data-theme="c"><a href="#" id="extra_abottom_'+c+'" class="extrasel '+l+'">'+W_APPLY[lang]+"</a></li>"}k+=createHigherLine(l);return k}function bindExtrasSel(){$(".extrasel").off("click").on("click",function(m){m.stopImmediatePropagation();m.preventDefault();var a=this.id.split("_");var b=a[1];var f=a[2];if((b=="abottom")||(b=="atop")){var k=getProdEntry(f);var c=k.extras;var n=[];for(var h=0;h<c.length;h++){var g=c[h];var b=g.extraid;var l=g.name;if(w_extras.indexOf(b)>=0){n[n.length]={id:b,name:l}}}addProductToNewOrdersList(f,n)}else{if(w_extras.indexOf(b)>=0){w_extras.splice(w_extras.indexOf(b),1)}else{w_extras[w_extras.length]=b}var o=listOfExtras(f);$("#typeproducts-list").html(o);refreshList("#typeproducts-list");bindExtrasSel();bindHigherButtons()}})}function lastSelectedProdToStr(){return" ("+W_LAST_SELECTED[lang]+": "+lastSelectedProduct+")"}function listOfTypesProds(e){var a='<li data-role="list-divider" data-theme="b" data-role="heading" >'+W_SELECTION[lang]+"<span id=lastselectedprod>";if(lastSelectedProduct!=""){a+=lastSelectedProdToStr()}a+="</span></li>";var b=$("#typprodpage").data("types_prods");var c=getProdSizeClass();$.each(b.types,function(g,f){if(parseInt(f.ref)==e){a+='<li data-theme="d"><a href="#" id="t_'+f.id+'" class="'+c+'">'+toHtml(f.name)+"</a></li>"}});$.each(b.prods,function(f,g){if(parseInt(g.ref)==e){a+='<li data-theme="c" data-icon="false"><a href="#" id="p_'+g.id+'" class="'+c+'">'+toHtml(g.name);a+=createProdInfoTxt(g.id);a+="</a></li>"}});if(e!=0){a+=createHigherLine(c)}return a}function createHigherLine(b){var a='<li data-theme="f" data-icon="false">';a+='<div class="ui-grid-a">';a+='<div class="ui-block-a typetop"><img src="img/top.png" /></div>';a+='<div class="ui-block-b typehigher"><img src="img/higher.png" /></div>';a+="</div>";a+="</li>";return a}function createProdInfoTxt(b){var a="<span class='prodcount' id=prodcount_"+b+" style='text-align:center;'></span>";a+="<div class='prodinfo' id=pinfo_"+b+"><img src='img/i.png' /></div>";a+="<div class='prodplus' id=pplus_"+b+"><img src='img/plus.png' /></div>";a+="<div class='prodminus' id=pminus_"+b+"><img src='img/minus.png' /></div>";return a}function createSearchProdInfoTxt(b){var a="<span class='srprodcount' id=srprodcount_"+b+" style='text-align:center;'></span>";a+="<div class='srinfo' id=srinfo_"+b+"><img src='img/i.png' /></div>";a+="<div class='srplus' id=srplus_"+b+"><img src='img/plus.png' /></div>";a+="<div class='srminus' id=srminus_"+b+"><img src='img/minus.png' /></div>";return a}function createServeInfo(e,c,b){if(supplyright==0){return""}if(e==null){e="n"}if(b>0){var a="<span class='prodreadycount' style='text-align:center;'>"+b+"("+c+")</span>";if(b>=c){a+="<div class='prodreadyicon' id='prodreadyicon_"+e+"'><img src='img/servecheck.png' /></div>"}else{a+="<div class='prodreadyicon' id='prodreadyicon_"+e+"'><img src='img/serve.png' /></div>"}return a}else{return""}}function getProdEntry(e){var b=$("#typprodpage").data("types_prods");var c=0;var a=b.prods;for(c=0;c<a.length;c++){var f=a[c];if(parseInt(f.id)==e){return f}}return null}function getProdAudio(a){var b=getProdEntry(a);if(b!=null){return b.audio}else{return""}}function getProdProperties(a){var b=getProdEntry(a);if(b!=null){return{name:b.longname,price:b.price}}else{return"FEHLER!"}}function fillFavArea(){var e='<ul data-role="listview" id="favorites-list" data-divider-theme="a" data-inset="true">';e+='<li data-role="list-divider" data-theme="b" data-role="heading">'+W_FAVS[lang]+"</li>";var b=$("#typprodpage").data("types_prods");var c=getProdSizeClass();var a=false;$.each(b.prods,function(f,g){if(parseInt(g.favorite)==1){a=true;e+='<li data-theme="c" data-icon="false"><a href="#" id="p_'+g.id+'" class="fav '+c+'">'+toHtml(g.longname);e+=createProdInfoTxt(g.id);e+="</a></li>"}});e+="</ul>";if(a){$("#favarea").html(e);$("#favarea").trigger("create")}else{$("#favarea").html("");$("#favarea").trigger("create")}}function bindFavEvent(){$(".fav").off("click").on("click",function(b){b.stopImmediatePropagation();b.preventDefault();levelOneType=0;var a=this.id.split("_")[1];selectedProdCount=getProdCount(a);handleClickOnProd(a)})}function displayTypesProds(c,b){window.scrollTo(0,0);if(c==0){fillFavArea();bindFavEvent()}else{$("#favarea").html("")}if(b==null){idOfHigherType=c;var a=listOfTypesProds(parseInt(c));extrasMenuOpen=false}else{var a=listOfExtras(parseInt(c));extrasMenuOpen=true}$("#typeproducts-list").empty().append(a).promise().done(function(){refreshList("#typeproducts-list");$(this).off("click").on("click","a",function(i){i.stopImmediatePropagation();i.preventDefault();$("#searchField").val("");generateSearchResults();var g=this.id;var f=g.split("_");if(f[0]=="t"){if(c==0){levelOneType=f[1];c=f[1]}displayTypesProds(f[1],null)}else{var h=f[1];selectedProdCount=getProdCount(h);handleClickOnProd(h)}});bindHigherButtons()});$(".prodinfo").off("click").on("click",function(i){i.stopImmediatePropagation();i.preventDefault();var f=this.id.split("_")[1];var h=getProdEntry(f);var g=h.price;alert(W_PRICE[lang]+": "+g+" "+currency)});$(".prodplus").off("click").on("click",function(h){h.stopImmediatePropagation();h.preventDefault();var g=this.id.split("_")[1];var f=getProdCount(g);$("#prodcount_"+g).html(f+1)});$(".prodminus").off("click").on("click",function(h){h.stopImmediatePropagation();h.preventDefault();var g=this.id.split("_")[1];var f=getProdCount(g);if(f==2){$("#prodcount_"+g).html("");selectedProdCount=1}else{if(f>2){$("#prodcount_"+g).html(f-1)}}})}function getHigherType(){var c=$("#typprodpage").data("types_prods");var b=c.types;var f=0;if(!extrasMenuOpen){for(var e=0;e<b.length;e++){var a=b[e];if(a.id==idOfHigherType){f=a.ref;break}}}else{f=idOfHigherType}return f}function clearSearchAndGoToHigherTypeIfExtrasOpen(){$("#searchField").val("");generateSearchResults();var a=getHigherType();displayTypesProds(a,null)}function bindHigherButtons(){$(".typehigher").off("click").on("click",function(a){a.stopImmediatePropagation();a.preventDefault();clearSearchAndGoToHigherTypeIfExtrasOpen()});$(".typetop").off("click").on("click",function(a){a.stopImmediatePropagation();a.preventDefault();$("#searchField").val("");generateSearchResults();displayTypesProds(0,null)})}function getProdCount(c){var b=1;var a=$("#prodcount_"+c).html();if(a!=""){b=parseInt(a)}return b}function getSearchProdCount(c){var b=1;var a=$("#srprodcount_"+c).html();if(a!=""){b=parseInt(a)}return b}function handleClickOnProd(b){var c=getProdEntry(b);var a=c.extras;if((a!=null)&&(a.length>0)){w_extras=[];w_allextras=a;idOfHigherType=c.ref;displayTypesProds(b,a);bindExtrasSel()}else{addProductToNewOrdersList(b,null)}}function addProductToNewOrdersList(f,e){var i=$("#typprodpage").data("table-info");var c=i[1];addProductToQueue(f,e,"NO",0);var a=getProdAudio(parseInt(f));var b=parseInt($("#typprodpage").data("ordervolume"))/10;if(a!=""){var h="customer/"+a;if(a.match(/mp3$/)){$("#audiofile").html('<source src="'+h+'" type="audio/mpeg" />')}else{if(a.match(/ogg$/)){$("#audiofile").html('<source src="'+h+'" type="audio/ogg" />')}else{if(a.match(/wav$/)){$("#audiofile").html('<source src="'+h+'" type="audio/wav" />')}}}document.getElementById("audiofile").load();document.getElementById("audiofile").volume=b;document.getElementById("audiofile").play()}else{if(b>0.5){beep()}}var g="php/contenthandler.php?module=queue&command=getJsonLongNamesOfProdsForTableNotDelivered&tableid="+c;fillNotDeliveredProductsOfATable(g);if(keeptypelevel==0){displayTypesProds(levelOneType,null)}else{if(extrasMenuOpen){displayTypesProds(idOfHigherType,null)}}refreshList("#typeproducts-list")}function beep(){var a=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//uQZAUAB1WI0PZugAAAAAoQwAAAEk3nRd2qAAAAACiDgAAAAAAABCqEEQRLCgwpBGMlJkIz8jKhGvj4k6jzRnqasNKIeoh5gI7BJaC1A1AoNBjJgbyApVS4IDlZgDU5WUAxEKDNmmALHzZp0Fkz1FMTmGFl1FMEyodIavcCAUHDWrKAIA4aa2oCgILEBupZgHvAhEBcZ6joQBxS76AgccrFlczBvKLC0QI2cBoCFvfTDAo7eoOQInqDPBtvrDEZBNYN5xwNwxQRfw8ZQ5wQVLvO8OYU+mHvFLlDh05Mdg7BT6YrRPpCBznMB2r//xKJjyyOh+cImr2/4doscwD6neZjuZR4AgAABYAAAABy1xcdQtxYBYYZdifkUDgzzXaXn98Z0oi9ILU5mBjFANmRwlVJ3/6jYDAmxaiDG3/6xjQQCCKkRb/6kg/wW+kSJ5//rLobkLSiKmqP/0ikJuDaSaSf/6JiLYLEYnW/+kXg1WRVJL/9EmQ1YZIsv/6Qzwy5qk7/+tEU0nkls3/zIUMPKNX/6yZLf+kFgAfgGyLFAUwY//uQZAUABcd5UiNPVXAAAApAAAAAE0VZQKw9ISAAACgAAAAAVQIygIElVrFkBS+Jhi+EAuu+lKAkYUEIsmEAEoMeDmCETMvfSHTGkF5RWH7kz/ESHWPAq/kcCRhqBtMdokPdM7vil7RG98A2sc7zO6ZvTdM7pmOUAZTnJW+NXxqmd41dqJ6mLTXxrPpnV8avaIf5SvL7pndPvPpndJR9Kuu8fePvuiuhorgWjp7Mf/PRjxcFCPDkW31srioCExivv9lcwKEaHsf/7ow2Fl1T/9RkXgEhYElAoCLFtMArxwivDJJ+bR1HTKJdlEoTELCIqgEwVGSQ+hIm0NbK8WXcTEI0UPoa2NbG4y2K00JEWbZavJXkYaqo9CRHS55FcZTjKEk3NKoCYUnSQ0rWxrZbFKbKIhOKPZe1cJKzZSaQrIyULHDZmV5K4xySsDRKWOruanGtjLJXFEmwaIbDLX0hIPBUQPVFVkQkDoUNfSoDgQGKPekoxeGzA4DUvnn4bxzcZrtJyipKfPNy5w+9lnXwgqsiyHNeSVpemw4bWb9psYeq//uQZBoABQt4yMVxYAIAAAkQoAAAHvYpL5m6AAgAACXDAAAAD59jblTirQe9upFsmZbpMudy7Lz1X1DYsxOOSWpfPqNX2WqktK0DMvuGwlbNj44TleLPQ+Gsfb+GOWOKJoIrWb3cIMeeON6lz2umTqMXV8Mj30yWPpjoSa9ujK8SyeJP5y5mOW1D6hvLepeveEAEDo0mgCRClOEgANv3B9a6fikgUSu/DmAMATrGx7nng5p5iimPNZsfQLYB2sDLIkzRKZOHGAaUyDcpFBSLG9MCQALgAIgQs2YunOszLSAyQYPVC2YdGGeHD2dTdJk1pAHGAWDjnkcLKFymS3RQZTInzySoBwMG0QueC3gMsCEYxUqlrcxK6k1LQQcsmyYeQPdC2YfuGPASCBkcVMQQqpVJshui1tkXQJQV0OXGAZMXSOEEBRirXbVRQW7ugq7IM7rPWSZyDlM3IuNEkxzCOJ0ny2ThNkyRai1b6ev//3dzNGzNb//4uAvHT5sURcZCFcuKLhOFs8mLAAEAt4UWAAIABAAAAAB4qbHo0tIjVkUU//uQZAwABfSFz3ZqQAAAAAngwAAAE1HjMp2qAAAAACZDgAAAD5UkTE1UgZEUExqYynN1qZvqIOREEFmBcJQkwdxiFtw0qEOkGYfRDifBui9MQg4QAHAqWtAWHoCxu1Yf4VfWLPIM2mHDFsbQEVGwyqQoQcwnfHeIkNt9YnkiaS1oizycqJrx4KOQjahZxWbcZgztj2c49nKmkId44S71j0c8eV9yDK6uPRzx5X18eDvjvQ6yKo9ZSS6l//8elePK/Lf//IInrOF/FvDoADYAGBMGb7FtErm5MXMlmPAJQVgWta7Zx2go+8xJ0UiCb8LHHdftWyLJE0QIAIsI+UbXu67dZMjmgDGCGl1H+vpF4NSDckSIkk7Vd+sxEhBQMRU8j/12UIRhzSaUdQ+rQU5kGeFxm+hb1oh6pWWmv3uvmReDl0UnvtapVaIzo1jZbf/pD6ElLqSX+rUmOQNpJFa/r+sa4e/pBlAABoAAAAA3CUgShLdGIxsY7AUABPRrgCABdDuQ5GC7DqPQCgbbJUAoRSUj+NIEig0YfyWUho1VBBBA//uQZB4ABZx5zfMakeAAAAmwAAAAF5F3P0w9GtAAACfAAAAAwLhMDmAYWMgVEG1U0FIGCBgXBXAtfMH10000EEEEEECUBYln03TTTdNBDZopopYvrTTdNa325mImNg3TTPV9q3pmY0xoO6bv3r00y+IDGid/9aaaZTGMuj9mpu9Mpio1dXrr5HERTZSmqU36A3CumzN/9Robv/Xx4v9ijkSRSNLQhAWumap82WRSBUqXStV/YcS+XVLnSS+WLDroqArFkMEsAS+eWmrUzrO0oEmE40RlMZ5+ODIkAyKAGUwZ3mVKmcamcJnMW26MRPgUw6j+LkhyHGVGYjSUUKNpuJUQoOIAyDvEyG8S5yfK6dhZc0Tx1KI/gviKL6qvvFs1+bWtaz58uUNnryq6kt5RzOCkPWlVqVX2a/EEBUdU1KrXLf40GoiiFXK///qpoiDXrOgqDR38JB0bw7SoL+ZB9o1RCkQjQ2CBYZKd/+VJxZRRZlqSkKiws0WFxUyCwsKiMy7hUVFhIaCrNQsKkTIsLivwKKigsj8XYlwt/WKi2N4d//uQRCSAAjURNIHpMZBGYiaQPSYyAAABLAAAAAAAACWAAAAApUF/Mg+0aohSIRobBAsMlO//Kk4soosy1JSFRYWaLC4qZBYWFRGZdwqKiwkNBVmoWFSJkWFxX4FFRQWR+LsS4W/rFRb/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////VEFHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAU291bmRib3kuZGUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMjAwNGh0dHA6Ly93d3cuc291bmRib3kuZGUAAAAAAAAAACU=");a.play()}function fetchTypeProdsFromServer(){doJsonAjaxAsync("GET","php/contenthandler.php?module=products&command=getAllTypesAndAvailProds",null,attachAndDisplayFirstRefTypes,true)}var waitProdTimer=null;function fillTypeProdList(b){var a=$("#typprodpage").data("types_prods");if(a!=undefined){displayTypesProds(b,null)}else{waitProdTimer=setInterval(function(){var c=$("#typprodpage").data("types_prods");if(c!=undefined){clearInterval(waitProdTimer);displayTypesProds(b,null)}},200)}}function fillTypeProdList_(a){displayTypesProds(a,null)}function createTxtAssignedProd(e){var b="";if(e.option!=""){b="&nbsp;("+toHtml(e.option)+")"}var c=e.longname;if(e.togo==1){c="To-Go: "+c}if(e.pricechanged==1){c+=" - "+e.price.replace(".",decpoint)}var a="";if(e.isready=="1"){a+=" &#9758"}if(e.isCooking=="1"){a+=" &#9832"}if(e.isPaid=="1"){a+=" &#9745"}return toHtml(c)+b+a+"<br>"+createExtraParagraph(e.extras)}function createListElOfAssignedProd(b){var a="";if("count" in b){if(b.count>1){a=b.count+"x "}}if(b.isready=="0"){return'<li data-theme="c" data-icon="delete" class="notdelprod"><a href="#" >'+a+createTxtAssignedProd(b)+"</a></li>"}else{return'<li data-theme="f" data-icon="delete" class="notdelprod"><a href="#" >'+a+createTxtAssignedProd(b)+"</a></li>"}}function fillAssignedProdList(b){if(b.length>0){notDeliveredProdsAvailable=true}else{notDeliveredProdsAvailable=false}$("#cancelcodefield").val("");if(cancelunpaidcode!=""){if(b.length>0){$("#cancelcodearea").show()}else{$("#cancelcodearea").hide()}}else{$("#cancelcodearea").hide()}var c=new Grouping(b,createTxtAssignedProd);c.group();var a='<li data-role="list-divider" data-theme="b" data-role="heading" id=\'undeliveredheader\'>'+W_KIT_BAR[lang]+"</li>";a+=c.outputList(createListElOfAssignedProd);$("#orderedprod-list-0").html(a);refreshList("#orderedprod-list-0");$("#undeliveredheader").off("click").on("click",function(f){f.stopImmediatePropagation();f.preventDefault();alert(W_UNDELIV_INFO[lang])});bindingOfAssignedProds(c)}function bindingOfAssignedProds(a){$(".notdelprod").off("click").on("click","a",function(k){k.stopImmediatePropagation();k.preventDefault();var g=true;if(cancelunpaidcode!=""){if($("#cancelcodefield").val()!=cancelunpaidcode){g=false}}var b=$(this).closest("li");var n=$("#orderedprod-list-0 li").index(b)-1;var h=a.getItemsOfRow(n);var p=h[0];var c=p.id;var m=p.isready;var i=p.isPaid;var o=p.isCooking;if((i=="1")&&(m=="1")){var f="Entfernen oder nachbestellen?";var l=this;doYouWantDelOrReorder("Produkt wurde schon zubereitet und bezahlt",f,W_REMOVE[lang],function(){removeProductFromQueue(c,i,o,m,g)},function(){reorderProduct(p.prodid,p.extrasids,p.extras)})}else{if(m=="1"){var f="Entfernen oder nachbestellen?";var l=this;doYouWantDelOrReorder("Produkt wurde schon zubereitet.",f,W_REMOVE[lang],function(){removeProductFromQueue(c,i,o,m,g)},function(){reorderProduct(p.prodid,p.extrasids,p.extras)})}else{if(i=="1"){var f="Entfernen oder nachbestellen?";var l=this;doYouWantDelOrReorder("Produkt wurde schon bezahlt.",f,W_REMOVE[lang],function(){removeProductFromQueue(c,i,o,m,g)},function(){reorderProduct(p.prodid,p.extrasids,p.extras)})}else{if(o=="1"){var f="Entfernen oder nachbestellen?";var l=this;doYouWantDelOrReorder("Produkt wird soeben zubereitet.",f,W_REMOVE[lang],function(){removeProductFromQueue(c,i,o,m,g)},function(){reorderProduct(p.prodid,p.extrasids,p.extras)})}else{var f="Entfernen oder nachbestellen?";var l=this;doYouWantDelOrReorder("",f,W_REMOVE[lang],function(){removeProductFromQueue(c,i,o,m,g)},function(){reorderProduct(p.prodid,p.extrasids,p.extras)})}}}}})}function fillNotDeliveredProductsOfATable(a){doJsonAjaxAsync("GET",a,null,fillAssignedProdList,true)}function fillOrderVolume(a){$("#typprodpage").data("ordervolume",a)}function checkForLogIn(){doJsonAjax("GET","php/contenthandler.php?module=admin&command=isUserAlreadyLoggedIn",null,handleTestForLoggedIn,null)}function handleTestForLoggedIn(a){if(a!="YES"){setTimeout(function(){document.location.href="index.html"},250)}}function getPrinterStatusStr(){return' <img src="img/printerstatus.png" class="printerstatus" style="display:none;" />'}$(document).on("pagebeforeshow","#typprodpage",function(){lastSelectedProduct="";tableListActive=false;if(nextPage==""){reloadPage()}$("#tablemapcontent").hide();$.ajaxSetup({cache:false});hideMenuProd();getPayPrintType();checkForLogIn();doJsonAjax("GET","php/contenthandler.php?module=admin&command=getOrderVolume",null,fillOrderVolume,"Keine Ordertoninformation");$("#workprintarea").html("");var a=$(this).data("table-info");var c=a[0];var b=a[1];$("#changetablewhatdialog").data("fromtableid",b);var e=a[2];$("#typprodpage h1").html(W_ATABLE[lang]+": "+e+getPrinterStatusStr());$("#optionfield").val("");fillTypeProdList(0);var f="php/contenthandler.php?module=queue&command=getJsonLongNamesOfProdsForTableNotDelivered&tableid="+b;fillNotDeliveredProductsOfATable(f);$("#workprint_btn").data("tableid",b);$("#gopaydesk_btn").data("tableid",b);$("#workprint_btn").data("tablename",e);bindPrintButton();bindGoPayDeskButton();bindChangetableButton();bindSendNewOrdersButton();getUserHasRightForPaydesk()});function bindSendNewOrdersButton(){$("#sendorder_btn").off("click").on("click",function(a){a.stopImmediatePropagation();a.preventDefault();lastSelectedProduct="";if(extrasMenuOpen){alert(W_OPEN_PANEL[lang])}else{sendNewOrders(false,"s",gotoTablePage)}})}function bindPrintButton(){$("#workprint_btn").off("click").on("click",function(b){b.stopImmediatePropagation();b.preventDefault();lastSelectedProduct="";if(extrasMenuOpen){alert(W_OPEN_PANEL[lang])}else{if(neworders.length>0){var a=$("#workprintarea").data("payPrintType");sendNewOrders(true,a,gotoTablePage)}else{alert(W_NO_ORDERS[lang])}}})}function bindGoPayDeskButton(){$("#gopaydesk_btn").off("click").on("click",function(b){b.stopImmediatePropagation();b.preventDefault();lastSelectedProduct="";if(neworders.length>0){var a=$("#workprintarea").data("payPrintType");if(waitergopayprint==1){sendNewOrders(true,a,goToPayDesk)}else{sendNewOrders(false,a,goToPayDesk)}}else{if(notDeliveredProdsAvailable){goToPayDesk()}else{alert(W_NO_ORDERS[lang])}}})}function goToPayDesk(){var a=$("#gopaydesk_btn").data("allowed");if(a.toLowerCase()=="yes"){window.location.href="paydesk.html?t="+$("#gopaydesk_btn").data("tableid")}else{alert("Fehlendes Benutzerrecht für Kasse")}}function createRoomOrTableList(b,c){var a='<li data-role="list-divider" data-theme="b" data-role="heading">'+c+"</li>";$.each(b,function(f,e){a+='<li data-theme="f"><a href="#" id="r_'+f+'" class="info-go">'+e.name+"</a></li>"});return a}function handleClickInChangeTablemap(a){$("#changetablewhatdialog").data("totableid",a.tableid);$.mobile.changePage("#changetablewhatdialog")}function displayTableDialog(e,g,c){$("#header_tchange").html("Tischauswahl");var f=shallDisplayRoom(e);if(f.show){$("#roomOrTableList").hide();$("#tablemapcontentchangetable").show();d=new Date();$("#mapimgpartchangetable").attr("src","php/tablemap.php?command=getTableMapImgAsPng&roomid="+e+"&"+d.getTime());var b=new Tablemap(e,null,"");b.bindingForSelection("#mapimgpartchangetable",handleClickInChangeTablemap.bind(this),f.pos,e);if(c){$.mobile.changePage("#tablechangedialog")}$("#changetablebackbtn").off("click").on("click",function(h){$("#tablemapcontentchangetable").hide();$("#roomOrTableList").show()})}else{$("#roomOrTableList").show();var a=createRoomOrTableList(g,"Tische");$("#roomOrTableList").empty().append(a).promise().done(function(){if(c){$.mobile.changePage("#tablechangedialog")}refreshList("#roomOrTableList");$(this).off("click").on("click",".info-go",function(i){i.stopImmediatePropagation();i.preventDefault();var h=($(this).attr("id")).split("_")[1];$("#changetablewhatdialog").data("totableid",g[h].id);$.mobile.changePage("#changetablewhatdialog")})})}}function resultOfChangeTable(a){if(a.status!="OK"){alert("Fehler "+a.code+": "+a.msg+"\n\nMöglicherweise hat ein Kollege\nin der Zwischenzeit Produkte zugestellt.")}else{alert("Tischwechsel durchgeführt!")}window.location.href="waiter.html"}function bindChangetableButton(){$("#changetable_btn").off("click").on("click",function(c){c.stopImmediatePropagation();c.preventDefault();var b=$("#tables-page").data("allroomtables");var f=b.length;if(f==1){displayTableDialog(b[0].id,b[0].tables,true)}else{$("#header_tchange").html("Raumauswahl");var a=createRoomOrTableList(b,W_ROOMS[lang]);$("#roomOrTableList").empty().append(a).promise().done(function(){$.mobile.changePage("#tablechangedialog");refreshList("#roomOrTableList");$(this).off("click").on("click",".info-go",function(h){h.stopImmediatePropagation();h.preventDefault();var g=($(this).attr("id")).split("_")[1];displayTableDialog(b[g].id,b[g].tables,false)})})}})}function createHtmlOfKind(e,a,k){var g="";for(var b=0;b<e.length;b++){var l=e[b];var f=l.longname;var c=l.anoption;var h=createExtraParagraph(l.extras);if((a==l.kind)&&(k==l.printer)){g+=f+"<br><i>"+c+"</i><br>"+h+"<br><br>"}}return g}function createExtraParagraph(b){if((b==null)||(b=="")){return""}var c="";for(var a=0;a<b.length;a++){c+="+ "+toHtml(b[a])+"<br>"}return c}function arrayContainsKind(b,e,g){var a=false;for(var c=0;c<b.length;c++){var f=b[c];if((e==f.kind)&&(g==f.printer)){a=true}}return a}function fillPrintAreaAndPrint(o){updateNotDeliveredList();var a=new Date();var n="0"+a.getHours();var h="0"+a.getMinutes();n=n.substr(-2);h=h.substr(-2);var i="<i>Erstellung: "+n+":"+h+"</i>";if(o.status=="OK"){var b=o.msg;var f=$("#workprintarea").data("payPrintType");var g="";var m=$("#workprint_btn").data("tablename");if(arrayContainsKind(b,0,1)){var e="<h1>Speisen für "+m+" (Printer 1)</h1><br>";var l=e+"<br>"+i+"<br><br>"+createHtmlOfKind(b,0,1)+"<br><br>";g+=l+"<br>"}if(arrayContainsKind(b,0,2)){var e="<h1>Speisen für "+m+" (Printer 2)</h1><br>";var l=e+"<br>"+i+"<br><br>"+createHtmlOfKind(b,0,2)+"<br><br>";g+=l+"<br>"}if(arrayContainsKind(b,1,1)){var c="<h1>Getränke für "+m+" (Printer 1)</h1><br>";var k=c+"<br>"+i+"<br><br>"+createHtmlOfKind(b,1,1)+"<br><br>";g+=k+"<br>"}if(arrayContainsKind(b,1,2)){var c="<h1>Getränke für "+m+" (Printer 2)</h1><br>";var k=c+"<br>"+i+"<br><br>"+createHtmlOfKind(b,1,2)+"<br><br>";g+=k+"<br>"}$("#workprintarea").html(g);window.print();setTimeout(function(){document.location.href="waiter.html"},250)}else{alert("Druckdaten konnten nicht angefordert werden")}}function printJob(h,c,f,b,g,a){var e={header:h,table:c,timestamp:f,prods:b,type:g,printer:a};doJsonAjax("POST","php/contenthandler.php?module=printqueue&command=queueWorkPrintJob",e,null,"Druckfehler")}function updateNotDeliveredList(){var a=$("#typprodpage").data("table-info");var c=a[1];var e="php/contenthandler.php?module=queue&command=getJsonLongNamesOfProdsForTableNotDelivered&tableid="+c;var b="#orderedprod-list-0";fillNotDeliveredProductsOfATable(e)}function doJsonAjax(a,b,f,e,c){$.ajax({type:a,url:b,dataType:"json",data:f,async:true,success:function(g){if(e!=null){e(g)}},error:function(k,g,h){if(c!=null){var i=c+", Status: "+g+", Error:"+h+", Msg: "+k.responseText+" ("+b+")";alert("Kommunikationsfehler zum Server: "+i)}}})}function doJsonAjaxAsync(a,b,e,c,f){$.ajax({type:a,url:b,dataType:"json",data:e,async:f,success:function(g){if(c!=null){c(g)}},error:function(i,g,h){}})}function doYouWantDelOrReorder(e,f,c,b,a){$("#delOrReorderDlg .sure-1").text(f);$("#delOrReorderDlg .sure-2").text(e);$("#delOrReorderDlg .sure-cancel").text(W_CANCEL[lang]);$("#delOrReorderDlg .sure-do").text(c).off("click.delOrReorderDlg").on("click.delOrReorderDlg",function(){b()});$("#delOrReorderDlg .reorder").text(W_REORDER[lang]).off("click.delOrReorderDlg").on("click.delOrReorderDlg",function(){a()});$(this).off("click.delOrReorderDlg");$.mobile.changePage("#delOrReorderDlg")}function areYouSure(c,b,a,e){$("#sure .sure-1").text(c);$("#sure .sure-2").text(b);$("#sure .sure-do").text(a).off("click.sure").on("click.sure",function(){e()});$(this).off("click.sure");$.mobile.changePage("#sure")}function changePriceInActPanel(a){if(rightchangeprice){$("#act-changepricefield").val(a.toFixed(2).replace(".",decpoint))}}function actionSelOnNewOrderElem(){var b=$("#actiononneworderel").data("entry");var a=$("#actiononneworderel").data("newcount");$("#act_count").html(a);$("#act_name").html(b.name+" ("+b.price+" "+currency+")");if(b.option!=""){$("#act_option").html(" ("+b.option+")")}if(rightchangeprice){if(b.changedPrices!="NO"){$("#act-changepricefield").val(b.changedPrices)}}$("#act-select-comment").html(predefinedComments);$.mobile.changePage("#actiononneworderel");if(a==1){$("#actionneworderconfirm_all").html(W_ACT_CHANGE[lang]);$("#actionneworderconfirm_one").hide()}else{$("#actionneworderconfirm_all").html(W_ACT_CHANGE_ALL[lang]);$("#actionneworderconfirm_one").html(W_ACT_CHANGE_ONE[lang]);$("#actionneworderconfirm_one").show()}$("#act-select-comment").selectmenu("refresh");$("#togocheckbox").checkboxradio("refresh");$("#actminusone").off("click").on("click",function(c){c.stopImmediatePropagation();c.preventDefault();reduceOneNewOrderItem();actionSelOnNewOrderElem($("#actiononneworderel").data("entry"),$("#actiononneworderel").data("groupedListIndex"))});$("#actplusone").off("click").on("click",function(c){c.stopImmediatePropagation();c.preventDefault();increaseOneNewOrderItem();actionSelOnNewOrderElem($("#actiononneworderel").data("entry"),$("#actiononneworderel").data("groupedListIndex"))});$("#actdel").off("click").on("click",function(c){delOneNewOrderItem();actionSelOnNewOrderElem($("#actiononneworderel").data("entry"),$("#actiononneworderel").data("groupedListIndex"));actionNewOrderConfirm(CHANGE_ONE)});$("#actionneworderconfirm_all").off("click").on("click",function(c){c.stopImmediatePropagation();c.preventDefault();$("#actiononneworderel").dialog("close");actionNewOrderConfirm(CHANGE_ALL)});$("#actionneworderconfirm_one").off("click").on("click",function(c){c.stopImmediatePropagation();c.preventDefault();$("#actiononneworderel").dialog("close");actionNewOrderConfirm(CHANGE_ONE)});$("#actionnewordercancel").off("click").on("click",function(c){binding_neworderelem()});$("#discount1").off("click").on("click",function(f){f.stopImmediatePropagation();f.preventDefault();var c=b.price;changePriceInActPanel(c-c*discount1/100)});$("#discount2").off("click").on("click",function(f){f.stopImmediatePropagation();f.preventDefault();var c=b.price;changePriceInActPanel(c-c*discount2/100)});$("#discount3").off("click").on("click",function(f){f.stopImmediatePropagation();f.preventDefault();var c=b.price;changePriceInActPanel(c-c*discount3/100)})}function actionNewOrderConfirm(h){var c=$("#actiononneworderel").data("entry");var n=$("#act-optionfield").val();if(rightchangeprice==1){var f=$("#act-changepricefield").val().trim();f=f.replace(",",".");if(f>999.99){alert(W_MAX_PRICE_EXCEEDED[lang]);return}if(f==""){f="NO"}else{if(!$.isNumeric(f)){alert(W_WRONG_FORMAT[lang]);return}else{$("#act-changepricefield").val("")}}}else{f="NO"}var g=$("#togocheckbox").prop("checked");if(g){g=1}else{g=0}if(h==CHANGE_ONE){var b=c.origidxs;neworders[b[0]].option=n;neworders[b[0]].changedPrice=f;neworders[b[0]].togo=g}else{var b=c.origidxs;for(m=0;m<b.length;m++){var p=b[m];neworders[p].option=n;neworders[p].changedPrice=f;neworders[p].togo=g}}$("#act-optionfield").val("");var s=c.count;var a=$("#actiononneworderel").data("newcount");var o=a-s;if(o<0){var e=0-o;var b=c.origidxs;var m=0;for(m=0;m<e;m++){var r=b.pop();neworders.splice(r,1)}}if(o>0){var b=c.origidxs;var q=b[0];var l=neworders[q].prodid;var f=neworders[q].changedPrice;var g=neworders[q].togo;var n=neworders[q].option;var k=neworders[q].extras;for(m=0;m<o;m++){addProductToQueueNoGuiUpdate(l,n,k,f,g)}}updateNewOrdersGui()}function updateNewOrdersGui(){groupedNewOrders=group(neworders);updateNewOrdersList()}function reduceOneNewOrderItem(){var a=$("#actiononneworderel").data("newcount");if(a>0){$("#actiononneworderel").data("newcount",a-1)}}function delOneNewOrderItem(){$("#actiononneworderel").data("newcount",0)}function increaseOneNewOrderItem(){var b=$("#actiononneworderel").data("entry");var a=$("#actiononneworderel").data("newcount");$("#actiononneworderel").data("newcount",a+1)}function group(h){var x=[];var e=[];var z=[];var s=[];var o=[];var g=[];var v=[];var w=[];var a=[];var m=[];var y={count:x,joinedvals:e,name:z,price:s,option:o,extras:g,prodids:v,origidxs:w,changedPrices:a,togos:m};var u=0;for(u=0;u<h.length;u++){var r=h[u];var z=r.name;var s=r.price;var o=r.option;var p=r.prodid;var f=r.changedPrice;var l=r.togo;var c=r.extras;var b="";if(c!=null){for(var t=0;t<c.length;t++){b+="<p>+ "+toHtml(c[t].name)+"</p>"}}var q=z+"-"+o+"-"+b;if(f!="NO"){q=z+"-"+o+"-"+b+f}if(l==1){q+=" - To-Go"}var k=y.joinedvals.indexOf(q);if(k>=0){y.count[k]=y.count[k]+1;idxarr=y.origidxs[k];idxarr[idxarr.length]=u;y.origidxs[k]=idxarr}else{var n=y.count.length;y.count[n]=1;y.joinedvals[n]=q;y.name[n]=z;y.price[n]=s;y.option[n]=o;y.extras[n]=b;y.prodids[n]=p;y.changedPrices[n]=f;y.togos[n]=l;y.origidxs[n]=[u]}}return y};</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><span id="roomtableheader2">Raum-Tisch</span> <img src="img/printerstatus.png" class="printerstatus" style="display:none;" /></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="menuswitch">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äume <img src="img/printerstatus.png" class="printerstatus" style="display:none;" /></li>
</ul>
<ul data-role="listview" id="waitermessage" data-divider-theme="a" data-inset="true">
</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="tables-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 id="tableselbackbtn" href="#" data-rel="back" data-role="button" data-icon="arrow-l">&nbsp;</a>
<h1><span id="tableselection">Tischauswahl</span> <img src="img/printerstatus.png" class="printerstatus" style="display:none;" /></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 id=tablemapcontent style="position: relative;width:100%;display:none;">
<img id="mapimgpart" style="width:100%;position: relative;left: 0;top: 0;" src=img/empty-room.png />
<div id=tableoverlay></div>
</div>
<div id=togoarea>
<ul data-role="listview" id="tables-list-togo" data-divider-theme="a" data-inset="true">
</ul>
</div>
</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/ping.mp3" type="audio/mpeg" />
</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 id="prodbackbtn" href="#" 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" id="waiterui">
<div id="searchposition-prominent"></div>
<ul data-role="listview" id="typeproducts-list" class="print" data-divider-theme="a" data-inset="true">
<li data-role="list-divider" data-theme="b" data-role="heading" >Auswahl <span class='waitinfo'><img id="prodsellist" src="php/3rdparty/images/ajax-loader.gif" /></span></li>
</ul>
<div id="favarea"></div>
<div id="searchposition-normal"></div>
<div id="commandbuttons"></div>
<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üche/Bar</li>
</ul>
<div id=cancelcodearea>
<form><input id=cancelcodefield type="password" placeholder="Storno-Code" /></form>
</div>
</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>
<div data-role="dialog" id="delOrReorderDlg" 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="#" class="sure-cancel" data-role="button" data-theme="c" data-rel="back">Nein</a>
<a href="#" class="reorder" data-role="button" data-theme="e" data-rel="back">Nachbestellung</a>
</div>
</div>
<!-- Dialog page -->
<div data-role="dialog" id="actiononneworderel" data-title="Aktion?">
<div data-role="content">
<h3><span id="actiontxt">Aktion vornehmen</span></h3>
<p class="sure-2">
<div style="text-align: center;font-weight: bold;">
<span id="act_count"></span>x <span id="act_name"></span> <span id="act_option"></span><br>
</div>
<a href="#" data-role="button" data-theme="c" data-rel="back" id="actminusone">-1</a>
<a href="#" data-role="button" data-theme="c" data-rel="back" id="actplusone">+1</a>
<div data-role="fieldcontain">
<fieldset data-role="controlgroup">
<input type="checkbox" name="togocheckbox" id="togocheckbox" class="custom" data-theme="c" />
<label for="togocheckbox">To-Go</label>
</fieldset>
</div>
<a href="#" data-role="button" data-theme="d" data-rel="back" id="actdel"><span id=actdeltxt>x</span></a>
<div id="actremark"></div>
<div id="actdiscount"></div>
<div id=actchangepricesection></div>
</p>
<a href="#" class="sure-do" data-role="button" data-theme="f" data-rel="back" id="actionneworderconfirm_all">Ja</a>
<a href="#" class="sure-do" data-role="button" data-theme="f" data-rel="back" id="actionneworderconfirm_one">Ja</a>
<a href="#" data-role="button" data-theme="b" data-rel="back" id="actionnewordercancel">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 id=tablemapcontentchangetable style="display:none;">
<img id="mapimgpartchangetable" style="width:100%;" src=img/empty-room.png />
</div>
</div>
</p>
<a id="changetablebackbtn" 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?</p>
<div data-role="controlgroup" data-type="horizontal" id="paybuttongroup">
<a href="#" data-role="button" data-theme="b" data-icon="check" id="selectallnothing"><span id="selectallnothing_txt">Alles/nichts auswählen</span></a>
</div>
<ul id="productsToMoveList" data-role="listview" class="scrolllistview" data-inset="true">
</ul>
<p id=changetablecontent>
</p>
<div data-role="content">
<a href="#" data-role="button" data-theme="f" data-rel="back" id="moveprods">Anwenden</a>
<a href="#" data-role="button" data-theme="c" data-rel="back">Zurück</a>
</div>
</div>
</div> <!-- changetablewhatdialog -->
<div data-role="dialog" id="discardnewordersdlg" data-title="Behandlung neue Orders">
<div data-role="content">
<h3 class="sure-1" id=discardnoheader>Neue Orders verwerfen</h3>
<p class="roomtabletitel" id=discardnewordersask>Es sind noch ungesendete Orders vorhanden! Sollen diese verworfen werden?
<div data-role="content">
<div class="ui-grid-a">
<div class="ui-block-a"><a href="#" data-role="button" data-theme="f" id="discard_new_orders_no">Nein</a></div>
<div class="ui-block-b"><a href="#" data-role="button" data-theme="d" id="discard_new_orders_yes">Ja</a></div>
</div><!-- /grid-a -->
</div>
</p>
</div>
</div> <!-- discardnewordersdlg -->
</body>
</html>