2617 lines
83 KiB
HTML
2617 lines
83 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.1.12">
|
|
<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_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_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_UNPAID = ["unbezahlt","unpaid","no pagado"];
|
|
var W_UNDELIVERED = ["nicht serviert (+ unbezahlt)","not served (and unpaid)","no servidos (y non-pagado)"];
|
|
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!"];
|
|
|
|
function Grouping(set,hashFct) {
|
|
// initialization during construction of class
|
|
this.set = set;
|
|
|
|
// setting by group()
|
|
this.sortedset = [];
|
|
|
|
this.group = function() {
|
|
this.sortedset = [];
|
|
for (var i=0;i<this.set.length;i++) {
|
|
var anEntry = this.set[i];
|
|
|
|
if (this.sortedset.length == 0) {
|
|
// new value
|
|
anEntry["count"] = 1;
|
|
anEntry["ids"] = [ anEntry["id"]];
|
|
this.sortedset[this.sortedset.length] = anEntry;
|
|
} else {
|
|
// check if the entry must be added to an existing entry
|
|
var hashOfValueToInsert = hashFct(anEntry);
|
|
var found = false;
|
|
for (j=0;j<this.sortedset.length;j++) {
|
|
var existingVal = this.sortedset[j];
|
|
var hashOfExistingValue = hashFct(existingVal);
|
|
|
|
if (hashOfValueToInsert == hashOfExistingValue) {
|
|
existingVal["count"] = existingVal["count"] + 1;
|
|
// now add the id
|
|
var ids = existingVal["ids"];
|
|
ids[ids.length] = anEntry["id"];
|
|
found = true;
|
|
break;
|
|
}
|
|
}
|
|
if (!found) {
|
|
// new value
|
|
anEntry["count"] = 1;
|
|
anEntry["ids"] = [ anEntry["id"]];
|
|
this.sortedset[this.sortedset.length] = anEntry;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
this.outputList = function(outputFct) {
|
|
var txt = "";
|
|
for (var i=0;i<this.sortedset.length;i++) {
|
|
var anEntry = this.sortedset[i];
|
|
txt += outputFct(anEntry);
|
|
}
|
|
return txt;
|
|
}
|
|
|
|
this.getItemsOfRow = function(rowId) {
|
|
var anEntrySet = this.sortedset[rowId];
|
|
var ids = anEntrySet["ids"];
|
|
var items = [];
|
|
for (var j=0;j<ids.length;j++) {
|
|
var anId = ids[j];
|
|
for (var i=0;i<this.set.length;i++) {
|
|
var anEntry = this.set[i];
|
|
if (anEntry.id==anId) {
|
|
items[items.length] = anEntry;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
return items;
|
|
}
|
|
|
|
this.popSortedEntry = function(rowId) {
|
|
var anEntry = this.sortedset[rowId];
|
|
var ids = anEntry["ids"];
|
|
var id = ids.pop();
|
|
var aSetEntry = this.popSetEntry(id);
|
|
this.group();
|
|
return aSetEntry;
|
|
}
|
|
|
|
this.popSetEntry = function(id) {
|
|
for (var i=0;i<this.set.length;i++) {
|
|
var anEntry = this.set[i];
|
|
if (anEntry.id==id) {
|
|
this.set.splice(i,1);
|
|
return anEntry;
|
|
}
|
|
}
|
|
}
|
|
|
|
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 osroombtnsize = 0;
|
|
var ostablebtnsize = 0;
|
|
var osprodbtnsize = 0;
|
|
|
|
var neworders = [];
|
|
var groupedNewOrders = {
|
|
count: [],
|
|
joinedvals: [],
|
|
name: [],
|
|
prodids: [],
|
|
extras: [],
|
|
origidxs: [],
|
|
changedPrices: []
|
|
};
|
|
|
|
var levelOneType = 0; // first selectedtype under 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 idOfHigherType = 0;
|
|
|
|
var tableListActive = false;
|
|
|
|
var queueIdsOfTakeAway = [];
|
|
|
|
var lastSelectedProduct = "";
|
|
|
|
function toHtml(text) {
|
|
return (text.replace(/"/g, '"').replace(/</g, "<").replace(/>/g, ">"));
|
|
}
|
|
|
|
function setLanguage(language) {
|
|
lang = language;
|
|
|
|
$("#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]);
|
|
|
|
$("#change_unpaid_txt").html(W_UNPAID[lang]);
|
|
$("#change_undelivered_txt").html(W_UNDELIVERED[lang]);
|
|
$("#moveprods").html(W_MOVE_PRODS[lang]);
|
|
|
|
var searchField = '';
|
|
if (prominentsearch == 0) {
|
|
searchField += '<div id=searchResult></div><div><input type="text" id="searchField" value="" data-mini="true" placeholder="' + W_SEARCH[lang] + '" />';
|
|
} else {
|
|
searchField += '<div><input type="text" id="searchField" value="" data-mini="true" placeholder="' + W_SEARCH[lang] + '" autofocus /><div id=searchResult></div>';
|
|
}
|
|
searchField += '</div>';
|
|
|
|
var commentField = '<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(searchField);
|
|
} else {
|
|
$("#searchposition-prominent").html(searchField);
|
|
}
|
|
|
|
var html = commentField;
|
|
|
|
if ((workflowconfig == 0) || (workflowconfig == 1)) {
|
|
html += '<a data-role="button" data-theme="e" class="osbigbtn" id="sendorder_btn">' + W_SEND_ORDERS[lang] + '</a>';
|
|
}
|
|
|
|
if ((workflowconfig == 0) || (workflowconfig == 2)) {
|
|
html += '<a data-role="button" data-theme="e" class="osbigbtn" id="workprint_btn">' + W_WORK_TICKET[lang] + '</a>';
|
|
}
|
|
|
|
html += '<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(html);
|
|
|
|
$("#waiterui").trigger("create");
|
|
|
|
// for new orders dialog
|
|
var actCommentField = '<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(actCommentField);
|
|
|
|
if (rightchangeprice == 1) {
|
|
var txt = '<input type="text" id="act-changepricefield" value="" data-mini="true" placeholder="' + W_CHANGE_PRICE[lang] + '" />';
|
|
$("#actchangepricesection").html(txt);
|
|
|
|
var discounttxt = '<div class="ui-grid-c">';
|
|
discounttxt += '<div class="ui-block-a" style="width:30%"><a href="#" data-role="button" data-theme="c" id="discount50">50%</a></div>';
|
|
discounttxt += '<div class="ui-block-b" style="width:30%"><a href="#" data-role="button" data-theme="c" id="discount25">25%</a></div>';
|
|
discounttxt += '<div class="ui-block-c" style="width:30%"><a href="#" data-role="button" data-theme="c" id="discount10">10%</a></div>';
|
|
discounttxt += '</div>';
|
|
$("#actdiscount").html(discounttxt);
|
|
}
|
|
|
|
$("#actionneworderconfirm").html(W_ACT_CHANGE[lang]);
|
|
$("#actionnewordercancel").html(W_CANCEL[lang]);
|
|
|
|
$("#select-comment").off("click").on("click", function (e) {
|
|
e.stopImmediatePropagation();
|
|
e.preventDefault();
|
|
var selectedComment = $("#select-comment").find(":selected").val();
|
|
$("#optionfield").val(selectedComment);
|
|
});
|
|
|
|
$("#act-select-comment").off("click").on("click", function (e) {
|
|
e.stopImmediatePropagation();
|
|
e.preventDefault();
|
|
var selectedComment = $("#act-select-comment").find(":selected").val();
|
|
$("#act-optionfield").val(selectedComment);
|
|
});
|
|
|
|
|
|
$("#discard_new_orders_no").off("click").on("click", function (e) {
|
|
e.stopImmediatePropagation();
|
|
e.preventDefault();
|
|
parent.history.back();
|
|
});
|
|
|
|
$("#discard_new_orders_no").off("click").on("click", function (e) {
|
|
e.stopImmediatePropagation();
|
|
e.preventDefault();
|
|
parent.history.back();
|
|
});
|
|
|
|
$("#discard_new_orders_yes").off("click").on("click", function (e) {
|
|
e.stopImmediatePropagation();
|
|
e.preventDefault();
|
|
neworders = [];
|
|
gotoOtherPage($('#discardnewordersdlg').data("link"));
|
|
});
|
|
|
|
$("#prodbackbtn").off("click").on("click", function (e) {
|
|
if (neworders.length != 0) {
|
|
e.stopImmediatePropagation();
|
|
e.preventDefault();
|
|
|
|
hideMenuProd();
|
|
$("#discardnewordersdlg").data("link","back_table");
|
|
$.mobile.changePage("#discardnewordersdlg");
|
|
} else {
|
|
parent.history.back();
|
|
}
|
|
});
|
|
|
|
$("#searchField").off("keyup").on("keyup", function (e) {
|
|
generateSearchResults();
|
|
});
|
|
}
|
|
|
|
function generateSearchResults() {
|
|
var search = $("#searchField").val().trim().toLowerCase();
|
|
|
|
if (search.length < 3) {
|
|
$("#searchResult").html("");
|
|
} else {
|
|
var size = getProdSizeClass();
|
|
var html = '<ul data-role="listview" id="search-list" data-divider-theme="a" data-inset="true">';
|
|
html += '<li data-role="list-divider" data-theme="b" data-role="heading">' + W_SEARCHRESULTS[lang] + '</li>';
|
|
|
|
var prodtypes = $("#typprodpage").data("types_prods");
|
|
$.each(prodtypes.prods,function(i,aProd) {
|
|
var longName = aProd.longname;
|
|
if (longName.toLowerCase().indexOf(search) >= 0) {
|
|
html += '<li data-theme="c" data-icon="false"><a href="#" id="sr_' + aProd.id + '" class="searchresult ' + size + '">' + toHtml(longName);
|
|
html += createSearchProdInfoTxt(aProd.id);
|
|
html += '</a></li>';
|
|
}
|
|
});
|
|
|
|
html += '</ul>';
|
|
$("#searchResult").html(html);
|
|
$("#searchResult").trigger("create");
|
|
|
|
|
|
$(".srinfo").off("click").on("click", function (e) {
|
|
e.stopImmediatePropagation();
|
|
e.preventDefault();
|
|
|
|
var prodid = this.id.split("_")[1];
|
|
var aProd = getProdEntry(prodid);
|
|
var price = aProd.price;
|
|
alert(W_PRICE[lang] + ": " + price + " " + currency);
|
|
});
|
|
|
|
$(".srplus").off("click").on("click", function (e) {
|
|
e.stopImmediatePropagation();
|
|
e.preventDefault();
|
|
var prodId = this.id.split("_")[1];
|
|
var count = getSearchProdCount(prodId);
|
|
$("#srprodcount_" + prodId).html(count+1);
|
|
});
|
|
|
|
$(".srminus").off("click").on("click", function (e) {
|
|
e.stopImmediatePropagation();
|
|
e.preventDefault();
|
|
var prodId = this.id.split("_")[1];
|
|
var count = getSearchProdCount(prodId);
|
|
if (count == 2) {
|
|
$("#srprodcount_" + prodId).html("");
|
|
selectedProdCount = 1;
|
|
} else if (count > 2) {
|
|
$("#srprodcount_" + prodId).html(count-1);
|
|
}
|
|
});
|
|
|
|
$(".searchresult").off("click").on("click", function (e) {
|
|
e.stopImmediatePropagation();
|
|
e.preventDefault();
|
|
var prodid = this.id.split("_")[1];
|
|
selectedProdCount = getSearchProdCount(prodid);
|
|
$("#searchField").val("");
|
|
generateSearchResults();
|
|
levelOneType = 0;
|
|
handleClickOnProd(prodid);
|
|
});
|
|
}
|
|
}
|
|
|
|
function fillGenCommentsList(comments) {
|
|
if (comments.status != "OK") {
|
|
alert("Fehler " + comments.code + ": " + comments.msg);
|
|
return;
|
|
}
|
|
var options = '<option value=""></option>';
|
|
var genComments = comments.msg;
|
|
var i=0;
|
|
for (i=0;i<genComments.length;i++) {
|
|
var aComment = genComments[i].comment;
|
|
aComment = toHtml(aComment);
|
|
options += '<option value="' + aComment + '">' + aComment + '</option>';
|
|
}
|
|
htmlComments = options;
|
|
predefinedComments = options;
|
|
|
|
$("#select-comment").html(options);
|
|
$('#select-comment').selectmenu('refresh');
|
|
}
|
|
|
|
function initializeMainMenu(moduleEntries,menuid,user,version,forward) {
|
|
$("#" + user).html(" " + moduleEntries.user);
|
|
$("#" + version).html(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 class="modulebutton" href="' + link + '" target="_top">' + name + '</a></li>';
|
|
}
|
|
});
|
|
$(menuid).empty().append(li).promise().done(function () {
|
|
refreshList(menuid);
|
|
});
|
|
if (menuid == "#modulemenu-room") {
|
|
var waitermsg = moduleEntries.waitermessage;
|
|
if (waitermsg != "") {
|
|
$("#waitermessage").show();
|
|
var msgHeader = '<li data-role="list-divider" data-theme="b" data-role="heading">' + W_MSG[lang] + '</li>';
|
|
var liMsg = '<li data-theme="d">' + waitermsg + '</li>';
|
|
$("#waitermessage").html(msgHeader + liMsg);
|
|
refreshList("#waitermessage");
|
|
} else {
|
|
$("#waitermessage").hide();
|
|
}
|
|
};
|
|
$(".modulebutton").off("click").on("click", function (e) {
|
|
var view = $(this).attr("href");
|
|
doJsonAjax("POST","php/contenthandler.php?module=admin&command=setLastModuleOfUser",
|
|
{ view: view}, null, "Problem Benutzerdatenpflege");
|
|
});
|
|
}
|
|
|
|
function refreshList(selector) {
|
|
if ( $(selector).hasClass('ui-listview')) {
|
|
$(selector).listview('refresh');
|
|
} else {
|
|
$(selector).trigger('create');
|
|
}
|
|
}
|
|
|
|
function gotoOtherPage(linkid) {
|
|
var linkParts = linkid.split("_");
|
|
if (linkParts[0] == "menu") {
|
|
doJsonAjax("POST","php/contenthandler.php?module=admin&command=setLastModuleOfUser",
|
|
{ view: linkParts[1]}, null, null);
|
|
setTimeout(function(){document.location.href = linkParts[1]},250); // not logged in
|
|
} else if (linkParts[0] == "back") {
|
|
$("#discardnewordersdlg").dialog( "close" );
|
|
parent.history.back();
|
|
}
|
|
}
|
|
|
|
function moduleForward(linkid) {
|
|
if (neworders.length == 0) {
|
|
gotoOtherPage(linkid);
|
|
} else {
|
|
hideMenuProd();
|
|
$("#discardnewordersdlg").data("link",linkid);
|
|
$.mobile.changePage("#discardnewordersdlg");
|
|
}
|
|
}
|
|
|
|
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" );
|
|
$("#menuswitch").off("click").on("click", function (e) {
|
|
e.stopImmediatePropagation();
|
|
e.preventDefault();
|
|
$( "#modulepanel-room" ).panel( "open" );;
|
|
});
|
|
}
|
|
|
|
function hideMenuTable() {
|
|
$( "#modulepanel-table" ).panel( "close" );
|
|
$("#menuswitchtable").off("click").on("click", function (e) {
|
|
e.stopImmediatePropagation();
|
|
e.preventDefault();
|
|
$( "#modulepanel-table" ).panel( "open" );;
|
|
});
|
|
}
|
|
|
|
function hideMenuProd() {
|
|
$( "#modulepanel-prod" ).panel( "close" );
|
|
$("#menuswitchprod").off("click").on("click", function (e) {
|
|
e.stopImmediatePropagation();
|
|
e.preventDefault();
|
|
$( "#modulepanel-prod" ).panel( "open" );;
|
|
});
|
|
}
|
|
|
|
function addProductToQueueNoGuiUpdate(productid,option,extras,changedPrice) {
|
|
var prodprop = getProdProperties(productid);
|
|
var prodname = prodprop.name;
|
|
var prodprice = prodprop.price;
|
|
var entry = {
|
|
name: prodname,
|
|
option: option,
|
|
extras: extras,
|
|
prodid: productid,
|
|
price: prodprice,
|
|
changedPrice : changedPrice
|
|
};
|
|
|
|
for (var i=0;i<selectedProdCount;i++) {
|
|
neworders[neworders.length] = entry;
|
|
}
|
|
selectedProdCount = 1;
|
|
}
|
|
|
|
function addProductToQueue(productid,extras,changedPrice) {
|
|
var option=$('#optionfield').val();
|
|
$('#optionfield').val("");
|
|
|
|
$("#select-comment").html(htmlComments);
|
|
$('#select-comment').selectmenu('refresh');
|
|
|
|
var prodprop = getProdProperties(productid);
|
|
var prodname = prodprop.name;
|
|
lastSelectedProduct = prodname;
|
|
$("#lastselectedprod").html(lastSelectedProdToStr());
|
|
var prodprice = prodprop.price;
|
|
var entry = {
|
|
name: prodname,
|
|
option: option,
|
|
prodid: productid,
|
|
price: prodprice,
|
|
extras: extras,
|
|
changedPrice: changedPrice
|
|
};
|
|
|
|
for (var i=0;i<selectedProdCount;i++) {
|
|
neworders[neworders.length] = entry;
|
|
}
|
|
selectedProdCount = 1;
|
|
|
|
updateNewOrdersGui();
|
|
}
|
|
|
|
function updateNewOrdersList() {
|
|
var i=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 li = "<li data-role=\"list-divider\" data-theme=\"b\" data-role=\"heading\">" + W_NEW_ORDER[lang] + "</li>";
|
|
|
|
var grouplength = groupedNewOrders.count.length; // because of vertical structure...
|
|
for (i=0;i<grouplength;i++) {
|
|
var lname = toHtml(groupedNewOrders.name[i]);
|
|
var optiontext = groupedNewOrders.option[i];
|
|
var count = groupedNewOrders.count[i];
|
|
if (count > 1) {
|
|
lname = "<span style='font-size: 23px;'>" + count.toString() + "x</span> " + lname;
|
|
}
|
|
var prodid = groupedNewOrders.prodids[i];
|
|
if (optiontext != '') {
|
|
optiontext = "<p>" + toHtml(optiontext) + "</p>";
|
|
}
|
|
var changedPrice = groupedNewOrders.changedPrices[i];
|
|
var extrastxt = "";
|
|
var extras = groupedNewOrders.extras[i];
|
|
if ((extras != null ) && (extras != "")) {
|
|
extrastxt = "<span style='font-size: 14px;'><i>" + extras + "</i></span>";
|
|
}
|
|
|
|
if (changedPrice != "NO") {
|
|
changedPrice = changedPrice.replace(".",decpoint);
|
|
li += '<li data-theme="c" data-icon="arrow-d"><a href="#" id="new_' + prodid + '" class="neworder_el ' + getProdSizeClass() + '">' + lname + optiontext + extrastxt + ' (' + changedPrice + ')' + '</a></li>';
|
|
}
|
|
else {
|
|
li += '<li data-theme="c" data-icon="arrow-d"><a href="#" id="new_' + prodid + '" class="neworder_el ' + getProdSizeClass() + '">' + lname + optiontext + extrastxt + '</a></li>';
|
|
}
|
|
}
|
|
$("#neworders").html(li);
|
|
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 (e) {
|
|
e.stopImmediatePropagation();
|
|
e.preventDefault();
|
|
|
|
var index = $("#neworders li").index($(this).closest("li")) - 1;
|
|
|
|
var selectedEntry = {
|
|
count: groupedNewOrders.count[index],
|
|
name: groupedNewOrders.name[index],
|
|
price: groupedNewOrders.price[index],
|
|
option: groupedNewOrders.option[index],
|
|
extras: groupedNewOrders.extras[index],
|
|
prodid: groupedNewOrders.prodids[index],
|
|
origidxs: groupedNewOrders.origidxs[index],
|
|
changedPrices: groupedNewOrders.changedPrices[index]
|
|
};
|
|
|
|
$("#actiononneworderel").data("entry",selectedEntry);
|
|
$("#actiononneworderel").data("newcount",selectedEntry.count);
|
|
$("#actiononneworderel").data("groupedListIndex",index);
|
|
$("#act-optionfield").val(selectedEntry.option);
|
|
actionSelOnNewOrderElem();
|
|
});
|
|
}
|
|
|
|
function sendNewOrders(doPrint,paydesktype,fct) {
|
|
var roominfo = $("#typprodpage").data("table-info");
|
|
var tableid = roominfo[1];
|
|
|
|
if (neworders.length != 0) {
|
|
var data = {
|
|
tableid: tableid,
|
|
prods: neworders,
|
|
print: (doPrint ? 1:0),
|
|
payprinttype: paydesktype
|
|
};
|
|
$("#typprodpage").data("neworders",[]);
|
|
if (paydesktype == "s") {
|
|
doJsonAjax("POST","php/contenthandler.php?module=queue&command=addProductListToQueue",data,fct,"Fehler bei Produktversand");
|
|
} else {
|
|
doJsonAjax("POST","php/contenthandler.php?module=queue&command=addProductListToQueue",data,fillPrintAreaAndPrint,"Fehler bei Produktversand");
|
|
}
|
|
} else {
|
|
if (doPrint && notDeliveredProdsAvailable) {
|
|
}
|
|
}
|
|
}
|
|
|
|
function reloadPage() {
|
|
tableListActive = false;
|
|
setTimeout(function(){document.location.href = "waiter.html"},250);
|
|
}
|
|
|
|
function gotoTablePage() {
|
|
$.mobile.changePage("#tables-page");
|
|
}
|
|
|
|
// removeProductFromQueue
|
|
function removeProductFromQueue(queueid,isPaid,isCooking,isReady) {
|
|
$.ajax({ type: "POST",
|
|
dataType: "json",
|
|
url: "php/contenthandler.php?module=queue&command=removeProductFromQueue",
|
|
data : { queueid: queueid,
|
|
isPaid: isPaid,
|
|
isCooking : isCooking,
|
|
isReady: isReady },
|
|
async: false,
|
|
success : function(text) {
|
|
if (text.status != "OK") {
|
|
alert (W_REMOVE_ERROR[lang]);
|
|
}
|
|
var roominfo = $("#typprodpage").data("table-info");
|
|
var tableid = roominfo[1];
|
|
var urlProdOfTableNotDelivered = "php/contenthandler.php?module=queue&command=getJsonLongNamesOfProdsForTableNotDelivered&" + "tableid=" + tableid;
|
|
fillNotDeliveredProductsOfATable(urlProdOfTableNotDelivered);
|
|
},
|
|
error: function( text ) {
|
|
alert( "Sorry, Fehler bei Produktentfernung!" );
|
|
}
|
|
});
|
|
}
|
|
|
|
function getWaiterSettings() {
|
|
doJsonAjax("GET", "php/contenthandler.php?module=admin&command=getWaiterSettings", null, insertWaiterSettings, "Fehler Konfigurationsdaten");
|
|
}
|
|
|
|
function insertWaiterSettings(settings) {
|
|
var isUserLoggedIn = settings.isUserLoggedIn;
|
|
if (isUserLoggedIn != 1) {
|
|
setTimeout(function(){document.location.href = "index.html"},250);
|
|
} else {
|
|
var config = settings.config;
|
|
workflowconfig = config.workflowconfig;
|
|
decpoint = config.decpoint;
|
|
currency = config.currency;
|
|
rightchangeprice = settings.rightchangeprice;
|
|
supplyright = settings.supplyright;
|
|
keeptypelevel = settings.keeptypelevel;
|
|
applyExtraBtnPos = settings.extrasapplybtnpos;
|
|
prominentsearch = config.prominentsearch;
|
|
setLanguage(settings.userlanguage);
|
|
|
|
if (rightchangeprice == 1) {
|
|
$("#changepricesection").show();
|
|
} else {
|
|
$("#changepricesection").hide();
|
|
}
|
|
if ((config.cancelunpaidcode != null) && (config.cancelunpaidcode != "")) {
|
|
cancelunpaidcode = config.cancelunpaidcode;
|
|
} else {
|
|
cancelunpaidcode = '';
|
|
}
|
|
|
|
osroombtnsize = settings.buttonsizes.roombtnsize;
|
|
ostablebtnsize = settings.buttonsizes.tablebtnsize;
|
|
osprodbtnsize = settings.buttonsizes.prodbtnsize;
|
|
|
|
initializeMainMenu(settings.jsonMenuItemsAndVersion,"#modulemenu-room","loggedinuser1","versioninfo1",false);
|
|
initializeMainMenu(settings.jsonMenuItemsAndVersion,"#modulemenu-table","loggedinuser2","versioninfo2",false);
|
|
initializeMainMenu(settings.jsonMenuItemsAndVersion,"#modulemenu-prod","loggedinuser3","versioninfo3",true);
|
|
|
|
doJsonAjax("GET", "php/contenthandler.php?module=products&command=getAllGeneralComments", null, fillGenCommentsList, "Fehler Bemerkungsdatensatz");
|
|
|
|
getTableMapPreferences();
|
|
|
|
neworders = [];
|
|
updateNewOrdersGui();
|
|
|
|
initializeEverything();
|
|
}
|
|
}
|
|
|
|
$(document).on("pageinit", "#info-page", function () {
|
|
fetchTypeProdsFromServer();
|
|
getWaiterSettings();
|
|
fetchMenuInInterval(60);
|
|
intervalFetchRoomTableInfoFromServer(10);
|
|
});
|
|
|
|
function intervalFetchRoomTableInfoFromServer(seconds) {
|
|
var fetchTimer = setInterval(function() {
|
|
if (tableListActive) {
|
|
doJsonAjaxAsync("GET","php/contenthandler.php?module=products&command=getAllTypesAndAvailProds",null,updateTableViewIfListStillOpen);
|
|
}
|
|
}, seconds * 1000);
|
|
}
|
|
|
|
function updateTableViewIfListStillOpen() {
|
|
$.getJSON("php/contenthandler.php?module=roomtables&command=showAllRooms",function(roominfo) {
|
|
if (tableListActive) {
|
|
insertTableList(roominfo);
|
|
}
|
|
});
|
|
}
|
|
|
|
function fetchMenuInInterval (seconds) {
|
|
var fetchTimer = setInterval(function() {
|
|
fetchTypeProdsFromServer();
|
|
}, seconds * 1000);
|
|
}
|
|
|
|
function getTableMapPreferences() {
|
|
doJsonAjax("GET","php/tablemap.php?command=getTableMapPreferences",null,insertTMInfo,"Keine TM-Information");
|
|
}
|
|
|
|
function insertTMInfo(jsonTminfo) {
|
|
tminfo = jsonTminfo;
|
|
}
|
|
|
|
function updateTableList() {
|
|
$.getJSON("php/contenthandler.php?module=roomtables&command=showAllRooms",function(roominfo) {
|
|
insertTableList(roominfo);
|
|
});
|
|
}
|
|
|
|
function insertTableList(roominfo) {
|
|
var roomtableinfo = roominfo.roomstables;
|
|
$("#tables-page").data("allroomtables",roomtableinfo);
|
|
|
|
var noOfRooms = roomtableinfo.length;
|
|
var allRooms = roomtableinfo; // default: rooms
|
|
|
|
if (noOfRooms == 1) {
|
|
$("#info-page").data("type","t");
|
|
$("#tables-page").data("roomdetail", roomtableinfo[0]);
|
|
nextPage = "typprodpage";
|
|
} else {
|
|
$("#info-page").data("type","r");
|
|
$("#roomtableheader").html(W_ROOMS[lang]);
|
|
|
|
var roomdetail = allRooms[currentRoomIndex];
|
|
$("#tables-page").data("roomdetail", roomdetail);
|
|
}
|
|
|
|
displayTablesListOrMap("#tables-list");
|
|
}
|
|
|
|
function initializeEverything() {
|
|
lastSelectedProduct = "";
|
|
$(".modules").off("click").on("click", function (e) {
|
|
e.stopImmediatePropagation();
|
|
e.preventDefault();
|
|
moduleForward(this.id);
|
|
});
|
|
|
|
hideMenuRoom();
|
|
|
|
$.getJSON("php/contenthandler.php?module=roomtables&command=showAllRooms",function(roominfo) {
|
|
|
|
queueIdsOfTakeAway = roominfo.takeawayReadyQueueIds;
|
|
var roomtableinfo = roominfo.roomstables;
|
|
$("#tables-page").data("allroomtables",roomtableinfo);
|
|
|
|
var noOfRooms = roomtableinfo.length;
|
|
var allRooms = roomtableinfo; // default: rooms
|
|
|
|
if (noOfRooms == 1) {
|
|
$("#info-page").data("type","t");
|
|
$("#tables-page").data("roomdetail", roomtableinfo[0]);
|
|
nextPage = "tables-page";
|
|
currentRoomIndex = 0; // of no interest
|
|
$.mobile.changePage("#tables-page");
|
|
$("#tableselbackbtn").hide();
|
|
} else {
|
|
$("#info-page").data("type","r");
|
|
$("#roomtableheader").html(W_ROOMS[lang]);
|
|
|
|
var li = "";
|
|
//container for $li to be added
|
|
var sizeclass = "";
|
|
if (osroombtnsize == 1) {
|
|
sizeclass = "osroom-1";
|
|
} else if (osroombtnsize == 2) {
|
|
sizeclass = "osroom-2";
|
|
}
|
|
$.each(allRooms, function (i, name) {
|
|
li += '<li data-theme="f"><a href="#" id="' + i + '" class="info-go ' + sizeclass + '">' + name.name + '</a></li>';
|
|
});
|
|
li += '<li data-theme="e"><a href="#" class="togoorder ' + sizeclass + '">' + W_TOGO[lang];
|
|
var price = roominfo.takeawayprice;
|
|
var priceTxt = price.replace(".", decpoint) + " " + currency;
|
|
if (price != 0.00) {
|
|
li += ' (' + W_TO_PAY[lang] + ': ' + priceTxt + ')';
|
|
}
|
|
|
|
li += createServeInfo(null,roominfo.takeawayprodcount,roominfo.takeawayprodready);
|
|
li += '</a></li>';
|
|
$("#room-list").append(li).promise().done(function () {
|
|
bindTogoOrdering();
|
|
bindServeClick();
|
|
$(this).off("click").on("click", "a", function (e) {
|
|
e.stopImmediatePropagation();
|
|
e.preventDefault();
|
|
|
|
var roomdetail = allRooms[this.id];
|
|
currentRoomIndex = this.id;
|
|
$("#tables-page").data("roomdetail", roomdetail);
|
|
nextPage = "tables-page";
|
|
$.mobile.changePage("#tables-page");
|
|
});
|
|
|
|
//refresh list to enhance its styling.
|
|
refreshList(this);
|
|
});
|
|
}
|
|
});
|
|
};
|
|
|
|
function shallDisplayRoom(roomid) {
|
|
for (var i=0;i<tminfo.length;i++) {
|
|
if (tminfo[i].roomid == roomid) {
|
|
return {show:tminfo[i].displaymap == 1 ? true : false,pos:tminfo[i].tablepositions};
|
|
}
|
|
}
|
|
return {show:false};
|
|
}
|
|
|
|
function handleClickInTablemap(data) {
|
|
forwardDisplayToProductView.call(this,data.roomid,data.tableid,data.tablename);
|
|
}
|
|
|
|
// Now we prepare the second page (tables) for display
|
|
$(document).on("pagebeforeshow", "#tables-page", function () {
|
|
lastSelectedProduct = "";
|
|
tableListActive = true;
|
|
if (nextPage == "") {
|
|
reloadPage();
|
|
}
|
|
hideMenuTable();
|
|
checkForLogIn();
|
|
|
|
$("#tableselbackbtn").off("click").on("click", function (e) {
|
|
e.stopImmediatePropagation();
|
|
e.preventDefault();
|
|
tableListActive = false;
|
|
$.mobile.changePage("#info-page");
|
|
});
|
|
|
|
updateTableList();
|
|
|
|
});
|
|
|
|
$(document).on("pagebeforeshow", "#changetablewhatdialog", function () {
|
|
var fromTableId = $("#changetablewhatdialog").data("fromtableid");
|
|
doJsonAjax("GET","php/contenthandler.php?module=queue&command=getProdsForTableChange",{ tableId: fromTableId },insertProductsToChangeTableDlg,"Tischartikel");
|
|
});
|
|
|
|
function insertProductsToChangeTableDlg(jsonContent) {
|
|
if (jsonContent.status != "OK") {
|
|
alert("Fehler");
|
|
return;
|
|
}
|
|
|
|
$("#changetablewhatdialog").data("unpaid",jsonContent.unpaid);
|
|
$("#changetablewhatdialog").data("undelivered",jsonContent.undeliveredunpaid);
|
|
|
|
$("#changetablewhatdialog").data("show_unpaid",1);
|
|
$("#changetablewhatdialog").data("show_undelivered",1);
|
|
|
|
updateChangeTableDialog();
|
|
}
|
|
|
|
function updateChangeTableDialog() {
|
|
var txtUnpaid = createTextAreaForChangeTable($("#changetablewhatdialog").data("unpaid"));
|
|
var txtUndelivered = createTextAreaForChangeTable($("#changetablewhatdialog").data("undelivered"));
|
|
|
|
var show_unpaid = $("#changetablewhatdialog").data("show_unpaid");
|
|
var show_undelivered = $("#changetablewhatdialog").data("show_undelivered");
|
|
if (show_unpaid == 1) {
|
|
$('#change_unpaid').buttonMarkup({ icon: "check" });
|
|
} else {
|
|
$('#change_unpaid').buttonMarkup({ icon: "delete" });
|
|
}
|
|
if (show_undelivered == 1) {
|
|
$('#change_undelivered').buttonMarkup({ icon: "check" });
|
|
} else {
|
|
$('#change_undelivered').buttonMarkup({ icon: "delete" });
|
|
}
|
|
|
|
var txt = "";
|
|
if (show_unpaid) {
|
|
txt += W_UNPAID[lang] + ":<br>" + txtUnpaid + "<br><br>";
|
|
}
|
|
|
|
if (show_undelivered) {
|
|
txt += W_UNDELIVERED[lang] + ":<br>" + txtUndelivered;
|
|
}
|
|
|
|
$("#changetablecontent").html(txt);
|
|
|
|
$("#change_unpaid").off("click").on("click", function (e) {
|
|
e.stopImmediatePropagation();
|
|
e.preventDefault();
|
|
$("#changetablewhatdialog").data("show_unpaid",1-show_unpaid);
|
|
updateChangeTableDialog();
|
|
});
|
|
$("#change_undelivered").off("click").on("click", function (e) {
|
|
e.stopImmediatePropagation();
|
|
e.preventDefault();
|
|
$("#changetablewhatdialog").data("show_undelivered",1-show_undelivered);
|
|
updateChangeTableDialog();
|
|
});
|
|
|
|
$("#moveprods").off("click").on("click", function (e) {
|
|
e.stopImmediatePropagation();
|
|
e.preventDefault();
|
|
|
|
var show_unpaid = $("#changetablewhatdialog").data("show_unpaid");
|
|
var show_undelivered = $("#changetablewhatdialog").data("show_undelivered");
|
|
|
|
var entries = [];
|
|
if (show_unpaid == 1) {
|
|
var unpaids = $("#changetablewhatdialog").data("unpaid");
|
|
for (var i=0;i<unpaids.length;i++) {
|
|
entries[entries.length] = unpaids[i].queueids;
|
|
}
|
|
}
|
|
if (show_undelivered == 1) {
|
|
var undelivs = $("#changetablewhatdialog").data("undelivered");
|
|
for (var j=0;j<undelivs.length;j++) {
|
|
entries[entries.length] = undelivs[j].queueids;
|
|
}
|
|
}
|
|
if (entries.length == 0) {
|
|
alert(W_NO_PRODS_SELECTED[lang]);
|
|
} else {
|
|
var entryCommaTxt = entries.join();
|
|
|
|
var fromTableId = $("#changetablewhatdialog").data("fromtableid");
|
|
var toTableId = $("#changetablewhatdialog").data("totableid");
|
|
var data = {
|
|
fromTableId : fromTableId,
|
|
toTableId : toTableId,
|
|
queueids : entryCommaTxt
|
|
};
|
|
doJsonAjax("POST","php/contenthandler.php?module=queue&command=changeTable",data, resultOfChangeTable, "Fehler Tischwechsel");
|
|
}
|
|
});
|
|
}
|
|
|
|
function createTextAreaForChangeTable(theList) {
|
|
var txt = "<textarea class='changetableprodlist'>";
|
|
for (var i=0;i<theList.length;i++) {
|
|
var entry = theList[i];
|
|
txt += entry.mycount + "x " + entry.productname + "\n";
|
|
}
|
|
txt += "</textarea>";
|
|
return txt;
|
|
}
|
|
|
|
function displayTablesListOrMap(listToFill) {
|
|
var roomdetail = $("#tables-page").data("roomdetail");
|
|
|
|
if ($("#info-page").data("type") == "t") {
|
|
$("#tableselbackbtn").hide();
|
|
} else {
|
|
$("#tableselbackbtn").show();
|
|
}
|
|
|
|
var roomid = roomdetail["id"];
|
|
var tables = roomdetail["tables"];
|
|
var displaymap = shallDisplayRoom(roomid);
|
|
var roomOrTables = $("#info-page").data("type");
|
|
if (displaymap.show) {
|
|
$(listToFill).hide();
|
|
|
|
d = new Date();
|
|
$("#mapimgpart").attr("src", "php/tablemap.php?command=getTableMapImgAsPng&showBubbles=0&roomid=" + roomid + "&"+d.getTime());
|
|
$("#tablemapcontent").show();
|
|
|
|
var tablemap = new Tablemap(roomid,null,"");
|
|
//tablemap.bindingForSelection("#mapimgpart",handleClickInTablemap.bind(this),displaymap.pos,roomid);
|
|
var overlay = tablemap.createOverlay("#mapimgpart", displaymap.pos,W_TO_PAY[lang],decpoint,currency,tables,ostablebtnsize);
|
|
$("#tableoverlay").html(overlay);
|
|
tablemap.bindingForOverlaySelection(handleClickInTablemap.bind(this),roomid,tables);
|
|
if (roomOrTables == 't') {
|
|
var li = '<li data-theme="d"><a href="#" class="togoorder ' + sizeclass + '">' + W_TOGO[lang] + '</a></li></ul>';
|
|
$("#tables-list-togo").html(li);
|
|
$("#togoarea").show();
|
|
refreshList("#tables-list-togo");
|
|
bindTogoOrdering();
|
|
bindServeClick();
|
|
}
|
|
} else {
|
|
$(listToFill).show();
|
|
$("#togoarea").hide();
|
|
$("#tablemapcontent").hide();
|
|
|
|
var li = '<li data-role=\"list-divider\" data-theme=\"b\" data-role=\"heading\">' + W_TABLES[lang] + '</li>'; // init
|
|
var sizeclass = "";
|
|
if (ostablebtnsize == 1) {
|
|
sizeclass = "ostable-1";
|
|
} else if (ostablebtnsize == 2) {
|
|
sizeclass = "ostable-2";
|
|
}
|
|
$.each(tables, function( index, value ) {
|
|
var price = value.pricesum;
|
|
var priceTxt = price.replace(".", decpoint) + " " + currency;
|
|
var prodcount = value.prodcount;
|
|
var prodready = value.prodready;
|
|
var readyQueueIds = value.readyQueueIds;
|
|
if (price != 0.00) {
|
|
li += '<li data-theme="e" data-icon="false"><a href="#" id="' + index + '" class="info-go tbusy ' + sizeclass + '">' + value.name + ' (' + W_TO_PAY[lang] + ': ' + priceTxt + ')' + createServeInfo(value.id,prodcount,prodready) + '</a></li>';
|
|
} else {
|
|
li += '<li data-theme="e" data-icon="false"><a href="#" id="' + index + '" class="info-go tempty ' + sizeclass + '">' + value.name + createServeInfo(value.id,prodcount,prodready) + '</a></li>';
|
|
}
|
|
});
|
|
if (roomOrTables == 't') {
|
|
li += '<li data-theme="f" data-icon="false"><a href="#" class="togoorder ' + sizeclass + '">' + W_TOGO[lang] + '</a></li>';
|
|
}
|
|
//append list to ul
|
|
$(listToFill).empty().append(li).promise().done(function () {
|
|
bindTogoOrdering();
|
|
bindServeClick();
|
|
$(this).off("click").on("click", ".info-go", function (e) {
|
|
e.stopImmediatePropagation();
|
|
e.preventDefault();
|
|
var myTables = roomdetail;
|
|
var tableid = tables[this.id]["id"];
|
|
var tablename = tables[this.id]["name"];
|
|
forwardDisplayToProductView.call(this,roomid,tableid,tablename);
|
|
});
|
|
|
|
//refresh list to enhance its styling.
|
|
refreshList(this);
|
|
});
|
|
}
|
|
}
|
|
|
|
function bindServeClick() {
|
|
$(".prodreadyicon").off("click").on("click", function (e) {
|
|
e.stopImmediatePropagation();
|
|
e.preventDefault();
|
|
var tableid = this.id.split("_")[1];
|
|
var queueIds = queueIdsOfTakeAway;
|
|
if ((tableid != null) && (tableid != "n")) {
|
|
var roomdetail = $("#tables-page").data("roomdetail");
|
|
var tables = roomdetail["tables"];
|
|
for (var i=0;i<tables.length;i++) {
|
|
var aTable = tables[i];
|
|
if (aTable.id == tableid) {
|
|
queueIds = aTable.readyQueueIds;
|
|
}
|
|
}
|
|
}
|
|
|
|
if (queueIds.length > 0) {
|
|
var queueIdStr = queueIds.join();
|
|
doJsonAjax("POST","php/contenthandler.php?module=queue&command=declareMultipleProductsDelivered",{ queueids: queueIdStr },updateAfterDelivery,"Bereitstellung");
|
|
}
|
|
});
|
|
}
|
|
|
|
function updateAfterDelivery(jsonContent) {
|
|
if (tableListActive) {
|
|
updateTableList();
|
|
} else {
|
|
reloadPage();
|
|
}
|
|
}
|
|
|
|
function bindTogoOrdering() {
|
|
$(".togoorder").off("click").on("click", function (e) {
|
|
e.stopImmediatePropagation();
|
|
e.preventDefault();
|
|
forwardDisplayToProductView.call(this,0,0,W_TOGO[lang]);
|
|
});
|
|
}
|
|
|
|
function forwardDisplayToProductView(roomid,tableid,tablename) {
|
|
neworders = [];
|
|
updateNewOrdersGui();
|
|
|
|
var roomtable_array= new Array(roomid,tableid,tablename);
|
|
$("#typprodpage").data("table-info", roomtable_array);
|
|
|
|
nextPage = "typprodpage";
|
|
$.mobile.changePage("#typprodpage");
|
|
neworders = [];
|
|
updateNewOrdersGui();
|
|
}
|
|
|
|
function attachAndDisplayFirstRefTypes(jsonTypesAndProds) {
|
|
$("#typprodpage").data("types_prods",jsonTypesAndProds);
|
|
}
|
|
|
|
function listOfExtras(prodid) {
|
|
var size = getProdSizeClass();
|
|
var li = "<li data-role=\"list-divider\" data-theme=\"b\" data-role=\"heading\">" + W_EXTRAS[lang] +"</li>";
|
|
if (applyExtraBtnPos != 1) {
|
|
li += '<li data-theme="c"><a href="#" id="extra_atop_' + prodid + '" class="extrasel ' + size + '">' + W_APPLY[lang] + '</a></li>';
|
|
}
|
|
for (var i=0;i<w_allextras.length;i++) {
|
|
var anExtra = w_allextras[i];
|
|
var extraid=anExtra.extraid;
|
|
var extraname = anExtra.name;
|
|
var dt = "d";
|
|
var di = "delete";
|
|
if (w_extras.indexOf(extraid) >= 0) {
|
|
dt = "f";
|
|
di = "check";
|
|
}
|
|
li += '<li data-theme="' + dt + '" data-icon="' + di + '"><a href="#" id="extra_' + extraid + '_' + prodid + '" class="extrasel ' + size + '">' + toHtml(extraname) + '</a></li>';
|
|
}
|
|
if (applyExtraBtnPos != 2) {
|
|
li += '<li data-theme="c"><a href="#" id="extra_abottom_' + prodid + '" class="extrasel ' + size + '">' + W_APPLY[lang] + '</a></li>';
|
|
}
|
|
li += createHigherLine(size);
|
|
return li;
|
|
}
|
|
|
|
function bindExtrasSel() {
|
|
$(".extrasel").off("click").on("click", function (e) {
|
|
e.stopImmediatePropagation();
|
|
e.preventDefault();
|
|
var ids = this.id.split("_");
|
|
var extraid = ids[1];
|
|
var prodid = ids[2];
|
|
if ((extraid == "abottom") || (extraid == "atop")) {
|
|
var aProd = getProdEntry(prodid);
|
|
var allAvailExtrasOfProd = aProd.extras;
|
|
var assignedExtras = [];
|
|
for (var i=0;i<allAvailExtrasOfProd.length;i++) {
|
|
var anExtra = allAvailExtrasOfProd[i];
|
|
var extraid=anExtra.extraid;
|
|
var extraname = anExtra.name;
|
|
|
|
if (w_extras.indexOf(extraid) >= 0) {
|
|
assignedExtras[assignedExtras.length] = {id:extraid,name:extraname};
|
|
}
|
|
}
|
|
extrasMenuOpen = false;
|
|
addProductToNewOrdersList(prodid,assignedExtras);
|
|
} else {
|
|
//var li_id = "extra_" + extraid + "_" + prodid;
|
|
|
|
// w_extras
|
|
if (w_extras.indexOf(extraid) >= 0) {
|
|
w_extras.splice(w_extras.indexOf(extraid),1);
|
|
} else {
|
|
w_extras[w_extras.length] = extraid;
|
|
}
|
|
var li = listOfExtras(prodid);
|
|
$("#typeproducts-list").html(li);
|
|
refreshList("#typeproducts-list");
|
|
extrasMenuOpen = true;
|
|
bindExtrasSel();
|
|
bindHigherButtons();
|
|
}
|
|
});
|
|
}
|
|
|
|
function lastSelectedProdToStr() {
|
|
return " (" + W_LAST_SELECTED[lang] + ": " + lastSelectedProduct + ")";
|
|
}
|
|
|
|
function listOfTypesProds(ref) {
|
|
var li = "<li data-role=\"list-divider\" data-theme=\"b\" data-role=\"heading\" >" + W_SELECTION[lang] + "<span id=lastselectedprod>";
|
|
if (lastSelectedProduct != "") {
|
|
li += lastSelectedProdToStr();
|
|
}
|
|
li += "</span></li>";
|
|
|
|
var prodtypes = $("#typprodpage").data("types_prods");
|
|
var size = getProdSizeClass();
|
|
$.each(prodtypes.types,function(i,aType) {
|
|
if (parseInt(aType.ref) == ref) {
|
|
li += '<li data-theme="d"><a href="#" id="t_' + aType.id + '" class="' + size + '">' + toHtml(aType.name) + '</a></li>';
|
|
}
|
|
});
|
|
$.each(prodtypes.prods,function(i,aProd) {
|
|
if (parseInt(aProd.ref) == ref) {
|
|
li += '<li data-theme="c" data-icon="false"><a href="#" id="p_' + aProd.id + '" class="' + size + '">' + toHtml(aProd.name);
|
|
li += createProdInfoTxt(aProd.id);
|
|
li += "</a></li>";
|
|
}
|
|
});
|
|
if (ref != 0) {
|
|
li += createHigherLine(size);
|
|
}
|
|
return li;
|
|
}
|
|
|
|
|
|
function createHigherLine(size) {
|
|
var txt = '<li data-theme="f" data-icon="false">';
|
|
txt += '<div class="ui-grid-a">';
|
|
txt += '<div class="ui-block-a typetop"><img src="img/top.png" /></div>';
|
|
txt += '<div class="ui-block-b typehigher"><img src="img/higher.png" /></div>';
|
|
txt += '</div>';
|
|
txt += '</li>';
|
|
return txt;
|
|
}
|
|
|
|
function createProdInfoTxt(prodid) {
|
|
var txt = "<span class='prodcount' id=prodcount_" + prodid + " style='text-align:center;'></span>";
|
|
txt += "<div class='prodinfo' id=pinfo_" + prodid + "><img src='img/i.png' /></div>";
|
|
txt += "<div class='prodplus' id=pplus_" + prodid + "><img src='img/plus.png' /></div>";
|
|
txt += "<div class='prodminus' id=pminus_" + prodid + "><img src='img/minus.png' /></div>";
|
|
return txt;
|
|
}
|
|
function createSearchProdInfoTxt(prodid) {
|
|
var txt = "<span class='srprodcount' id=srprodcount_" + prodid + " style='text-align:center;'></span>";
|
|
txt += "<div class='srinfo' id=srinfo_" + prodid + "><img src='img/i.png' /></div>";
|
|
txt += "<div class='srplus' id=srplus_" + prodid + "><img src='img/plus.png' /></div>";
|
|
txt += "<div class='srminus' id=srminus_" + prodid + "><img src='img/minus.png' /></div>";
|
|
return txt;
|
|
}
|
|
|
|
function createServeInfo(tableid,prodcount,prodready) {
|
|
if (supplyright == 0) {
|
|
return '';
|
|
}
|
|
if (tableid==null) {
|
|
tableid = "n";
|
|
}
|
|
if (prodready > 0) {
|
|
var txt = "<span class='prodreadycount' style='text-align:center;'>" + prodready + "(" + prodcount + ")</span>";
|
|
if (prodready >= prodcount) {
|
|
txt += "<div class='prodreadyicon' id='prodreadyicon_" + tableid + "'><img src='img/servecheck.png' /></div>";
|
|
} else {
|
|
txt += "<div class='prodreadyicon' id='prodreadyicon_" + tableid + "'><img src='img/serve.png' /></div>";
|
|
}
|
|
return txt;
|
|
} else {
|
|
return '';
|
|
}
|
|
}
|
|
|
|
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 getProdProperties(prodid) {
|
|
var aProd = getProdEntry(prodid);
|
|
if (aProd != null) {
|
|
return {name:aProd.longname,price:aProd.price};
|
|
} else {
|
|
return "FEHLER!";
|
|
}
|
|
}
|
|
|
|
function fillFavArea() {
|
|
var html = '<ul data-role="listview" id="favorites-list" data-divider-theme="a" data-inset="true">';
|
|
html += '<li data-role="list-divider" data-theme="b" data-role="heading">' + W_FAVS[lang] + '</li>';
|
|
|
|
var prodtypes = $("#typprodpage").data("types_prods");
|
|
var size = getProdSizeClass();
|
|
|
|
var favFound = false;
|
|
$.each(prodtypes.prods,function(i,aProd) {
|
|
if (parseInt(aProd.favorite) == 1) {
|
|
favFound = true;
|
|
html += '<li data-theme="c" data-icon="false"><a href="#" id="p_' + aProd.id + '" class="fav ' + size + '">' + toHtml(aProd.longname);
|
|
html += createProdInfoTxt(aProd.id);
|
|
html += '</a></li>';
|
|
}
|
|
});
|
|
|
|
html += '</ul>';
|
|
if (favFound) {
|
|
$("#favarea").html(html);
|
|
$("#favarea").trigger("create");
|
|
} else {
|
|
$("#favarea").html("");
|
|
$("#favarea").trigger("create");
|
|
}
|
|
}
|
|
|
|
function bindFavEvent() {
|
|
$(".fav").off("click").on("click", function (e) {
|
|
e.stopImmediatePropagation();
|
|
e.preventDefault();
|
|
levelOneType = 0;
|
|
var prodid = this.id.split("_")[1];
|
|
selectedProdCount = getProdCount(prodid);
|
|
handleClickOnProd(prodid);
|
|
});
|
|
}
|
|
|
|
|
|
function displayTypesProds(ref,extras) {
|
|
window.scrollTo(0,0);
|
|
if (ref==0) {
|
|
fillFavArea();
|
|
bindFavEvent();
|
|
} else {
|
|
$("#favarea").html("");
|
|
}
|
|
if (extras == null) {
|
|
idOfHigherType = ref;
|
|
var li = listOfTypesProds(parseInt(ref));
|
|
} else {
|
|
var li = listOfExtras(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') {
|
|
if (ref == 0) {
|
|
levelOneType = idParts[1];
|
|
ref = idParts[1];
|
|
}
|
|
extrasMenuOpen = false;
|
|
displayTypesProds(idParts[1],null);
|
|
} else {
|
|
var prodid = idParts[1];
|
|
selectedProdCount = getProdCount(prodid);
|
|
handleClickOnProd(prodid);
|
|
}
|
|
});
|
|
bindHigherButtons();
|
|
});
|
|
|
|
$(".prodinfo").off("click").on("click", function (e) {
|
|
e.stopImmediatePropagation();
|
|
e.preventDefault();
|
|
|
|
var prodid = this.id.split("_")[1];
|
|
var aProd = getProdEntry(prodid);
|
|
var price = aProd.price;
|
|
alert(W_PRICE[lang] + ": " + price + " " + currency);
|
|
});
|
|
|
|
$(".prodplus").off("click").on("click", function (e) {
|
|
e.stopImmediatePropagation();
|
|
e.preventDefault();
|
|
var prodId = this.id.split("_")[1];
|
|
var count = getProdCount(prodId);
|
|
$("#prodcount_" + prodId).html(count+1);
|
|
});
|
|
|
|
$(".prodminus").off("click").on("click", function (e) {
|
|
e.stopImmediatePropagation();
|
|
e.preventDefault();
|
|
var prodId = this.id.split("_")[1];
|
|
var count = getProdCount(prodId);
|
|
if (count == 2) {
|
|
$("#prodcount_" + prodId).html("");
|
|
selectedProdCount = 1;
|
|
} else if (count > 2) {
|
|
$("#prodcount_" + prodId).html(count-1);
|
|
}
|
|
});
|
|
}
|
|
|
|
function bindHigherButtons() {
|
|
$(".typehigher").off("click").on("click", function (e) {
|
|
e.stopImmediatePropagation();
|
|
e.preventDefault();
|
|
|
|
var prodtypes = $("#typprodpage").data("types_prods");
|
|
var thetypes = prodtypes.types;
|
|
var higherType = 0;
|
|
if (!extrasMenuOpen) {
|
|
for (var i=0;i<thetypes.length;i++) {
|
|
var aType = thetypes[i];
|
|
if (aType.id == idOfHigherType) {
|
|
higherType = aType.ref;
|
|
break;
|
|
}
|
|
}
|
|
} else {
|
|
higherType = idOfHigherType;
|
|
}
|
|
|
|
displayTypesProds(higherType,null);
|
|
});
|
|
$(".typetop").off("click").on("click", function (e) {
|
|
e.stopImmediatePropagation();
|
|
e.preventDefault();
|
|
displayTypesProds(0,null);
|
|
});
|
|
}
|
|
|
|
|
|
function getProdCount(prodId) {
|
|
var count = 1;
|
|
var countStr = $("#prodcount_" + prodId).html();
|
|
if (countStr != "") {
|
|
count = parseInt(countStr);
|
|
}
|
|
return count;
|
|
}
|
|
function getSearchProdCount(prodId) {
|
|
var count = 1;
|
|
var countStr = $("#srprodcount_" + prodId).html();
|
|
if (countStr != "") {
|
|
count = parseInt(countStr);
|
|
}
|
|
return count;
|
|
}
|
|
|
|
function handleClickOnProd(prodid) {
|
|
var aProd = getProdEntry(prodid);
|
|
var extras = aProd.extras;
|
|
if ((extras != null) && (extras.length > 0)) {
|
|
w_extras = [];
|
|
w_allextras = extras;
|
|
extrasMenuOpen = true;
|
|
idOfHigherType = aProd.ref;
|
|
|
|
displayTypesProds(prodid,extras);
|
|
bindExtrasSel();
|
|
} else {
|
|
addProductToNewOrdersList(prodid,null);
|
|
}
|
|
}
|
|
|
|
function addProductToNewOrdersList(prodid,extras) {
|
|
|
|
var roominfo = $("#typprodpage").data("table-info");
|
|
var tableid = roominfo[1];
|
|
addProductToQueue(prodid,extras,"NO");
|
|
|
|
var audioFile = getProdAudio(parseInt(prodid));
|
|
if (audioFile != "") {
|
|
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').load();
|
|
document.getElementById('audiofile').volume=vol;
|
|
document.getElementById('audiofile').play();
|
|
}
|
|
|
|
var urlProdOfTableNotDelivered = "php/contenthandler.php?module=queue&command=getJsonLongNamesOfProdsForTableNotDelivered&tableid=" + tableid;
|
|
fillNotDeliveredProductsOfATable(urlProdOfTableNotDelivered);
|
|
|
|
if (keeptypelevel == 0) {
|
|
displayTypesProds(levelOneType,null);
|
|
}
|
|
refreshList("#typeproducts-list");
|
|
}
|
|
|
|
function fetchTypeProdsFromServer() {
|
|
doJsonAjaxAsync("GET","php/contenthandler.php?module=products&command=getAllTypesAndAvailProds",null,attachAndDisplayFirstRefTypes);
|
|
}
|
|
|
|
|
|
var waitProdTimer = null;
|
|
|
|
function fillTypeProdList(ref) {
|
|
var typprod = $("#typprodpage").data("types_prods");
|
|
if (typprod != undefined) {
|
|
displayTypesProds(ref,null);
|
|
} else {
|
|
waitProdTimer = setInterval(function() {
|
|
var typprod2 = $("#typprodpage").data("types_prods");
|
|
if (typprod2 != undefined) {
|
|
clearInterval(waitProdTimer);
|
|
displayTypesProds(ref,null);
|
|
}
|
|
}, 200);
|
|
}
|
|
}
|
|
|
|
|
|
function fillTypeProdList_(ref) {
|
|
displayTypesProds(ref,null);
|
|
}
|
|
|
|
function createTxtAssignedProd(p) {
|
|
var optiontext = "";
|
|
if (p.option != '') {
|
|
optiontext = " (" + toHtml(p.option) + ")";
|
|
}
|
|
|
|
var status = "";
|
|
if (p.isready == '1') {
|
|
status += " ☞";
|
|
}
|
|
if (p.isCooking == '1') {
|
|
status += " ♨";
|
|
}
|
|
if (p.isPaid == '1') {
|
|
status += " ☑";
|
|
}
|
|
|
|
return toHtml(p.longname) + optiontext + status + "<br>" + createExtraParagraph(p.extras);
|
|
}
|
|
|
|
|
|
function createListElOfAssignedProd(aProd) {
|
|
var count = "";
|
|
if("count" in aProd) {
|
|
if (aProd["count"] > 1) {
|
|
count = aProd["count"] + "x ";
|
|
}
|
|
}
|
|
if (aProd.isready == '0') {
|
|
return '<li data-theme="c" data-icon="delete" class="notdelprod"><a href="#" >' + count + createTxtAssignedProd(aProd) + '</a></li>';
|
|
} else {
|
|
return '<li data-theme="f" data-icon="delete" class="notdelprod"><a href="#" >' + count + createTxtAssignedProd(aProd) + '</a></li>';
|
|
}
|
|
}
|
|
|
|
function fillAssignedProdList(assignedProds) {
|
|
if (assignedProds.length > 0) {
|
|
notDeliveredProdsAvailable = true;
|
|
} else {
|
|
notDeliveredProdsAvailable = false;
|
|
}
|
|
|
|
$("#cancelcodefield").val("");
|
|
if (cancelunpaidcode != "") {
|
|
if (assignedProds.length > 0) {
|
|
$("#cancelcodearea").show();
|
|
} else {
|
|
$("#cancelcodearea").hide();
|
|
}
|
|
} else {
|
|
$("#cancelcodearea").hide();
|
|
}
|
|
|
|
var assignedProdsGrouping = new Grouping(assignedProds,createTxtAssignedProd);
|
|
assignedProdsGrouping.group();
|
|
|
|
var listContent = "<li data-role=\"list-divider\" data-theme=\"b\" data-role=\"heading\" id='undeliveredheader'>" + W_KIT_BAR[lang] + "</li>";
|
|
listContent += assignedProdsGrouping.outputList(createListElOfAssignedProd);
|
|
$("#orderedprod-list-0").html(listContent);
|
|
refreshList("#orderedprod-list-0");
|
|
|
|
$("#undeliveredheader").off("click").on("click", function (e) {
|
|
e.stopImmediatePropagation();
|
|
e.preventDefault();
|
|
alert(W_UNDELIV_INFO[lang]);
|
|
});
|
|
|
|
bindingOfAssignedProds(assignedProdsGrouping);
|
|
}
|
|
|
|
function bindingOfAssignedProds(assignedProdsGrouping) {
|
|
$(".notdelprod").off("click").on("click", "a", function (e) {
|
|
e.stopImmediatePropagation();
|
|
e.preventDefault();
|
|
|
|
if (cancelunpaidcode != "") {
|
|
if ($("#cancelcodefield").val() != cancelunpaidcode) {
|
|
alert(W_WRONG_PIN[lang]);
|
|
return;
|
|
}
|
|
}
|
|
|
|
var listItem = $(this).closest("li");
|
|
var rowIndex = $( "#orderedprod-list-0 li" ).index(listItem) - 1;
|
|
var rowEntries = assignedProdsGrouping.getItemsOfRow(rowIndex);
|
|
var anEntry = rowEntries[0];
|
|
var queueid = anEntry.id;
|
|
|
|
var isReady = anEntry.isready;
|
|
var isPaid = anEntry.isPaid;
|
|
var isCooking = anEntry.isCooking;
|
|
|
|
if ((isPaid == "1") && (isReady=="1")) {
|
|
var dialogText = "Entfernen?";
|
|
var this_elem = this;
|
|
areYouSure("Produkt wurde schon zubereitet und bezahlt", dialogText, "Ja", function() {
|
|
removeProductFromQueue(queueid,isPaid,isCooking,isReady);
|
|
});
|
|
} else if (isReady=="1") {
|
|
var dialogText = "Entfernen?";
|
|
var this_elem = this;
|
|
areYouSure("Produkt wurde schon zubereitet.", dialogText, "Ja", function() {
|
|
removeProductFromQueue(queueid,isPaid,isCooking,isReady);
|
|
});
|
|
} else if (isPaid == "1") {
|
|
var dialogText = "Entfernen?";
|
|
var this_elem = this;
|
|
areYouSure("Produkt wurde schon bezahlt.", dialogText, "Ja", function() {
|
|
removeProductFromQueue(queueid,isPaid,isCooking,isReady);
|
|
});
|
|
} else if (isCooking == "1") {
|
|
var dialogText = "Entfernen?";
|
|
var this_elem = this;
|
|
areYouSure("Produkt wird soeben zubereitet.", dialogText, "Ja", function() {
|
|
removeProductFromQueue(queueid,isPaid,isCooking,isReady);
|
|
});
|
|
} else {
|
|
removeProductFromQueue(queueid,isPaid,isCooking,isReady);
|
|
}
|
|
});
|
|
|
|
}
|
|
|
|
function fillNotDeliveredProductsOfATable(urlProdOfTableNotDelivered) {
|
|
doJsonAjaxAsync("GET", urlProdOfTableNotDelivered, null, fillAssignedProdList);
|
|
}
|
|
|
|
function fillOrderVolume(volume) {
|
|
$("#typprodpage").data("ordervolume",volume);
|
|
}
|
|
|
|
function checkForLogIn() {
|
|
doJsonAjax("GET","php/contenthandler.php?module=admin&command=isUserAlreadyLoggedIn",null,handleTestForLoggedIn,null);
|
|
}
|
|
function handleTestForLoggedIn(answer) {
|
|
if (answer != "YES") {
|
|
setTimeout(function(){document.location.href = "index.html"},250);
|
|
}
|
|
}
|
|
|
|
//Now we prepare the product page (level 0) for display
|
|
$(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("");
|
|
|
|
//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;
|
|
|
|
fillNotDeliveredProductsOfATable(urlProdOfTableNotDelivered);
|
|
|
|
$("#workprint_btn").data("tableid",tableid);
|
|
$("#gopaydesk_btn").data("tableid",tableid);
|
|
$("#workprint_btn").data("tablename",tablename);
|
|
bindPrintButton();
|
|
bindGoPayDeskButton();
|
|
bindChangetableButton();
|
|
bindSendNewOrdersButton();
|
|
|
|
// "Paydesk-button" enable/disable
|
|
getUserHasRightForPaydesk();
|
|
});
|
|
|
|
function bindSendNewOrdersButton() {
|
|
$("#sendorder_btn").off("click").on("click", function (e) {
|
|
e.stopImmediatePropagation();
|
|
e.preventDefault();
|
|
lastSelectedProduct = "";
|
|
if (extrasMenuOpen) {
|
|
alert(W_OPEN_PANEL[lang]);
|
|
} else {
|
|
sendNewOrders(false,"s",gotoTablePage);
|
|
}
|
|
});
|
|
}
|
|
|
|
function bindPrintButton() {
|
|
$("#workprint_btn").off("click").on("click", function(e) {
|
|
e.stopImmediatePropagation();
|
|
e.preventDefault();
|
|
lastSelectedProduct = "";
|
|
if (extrasMenuOpen) {
|
|
alert(W_OPEN_PANEL[lang]);
|
|
} else {
|
|
|
|
if (neworders.length > 0) {
|
|
var payPrintType = $("#workprintarea").data("payPrintType");
|
|
sendNewOrders(true,payPrintType,gotoTablePage);
|
|
} else {
|
|
alert(W_NO_ORDERS[lang]);
|
|
}
|
|
}
|
|
});
|
|
}
|
|
|
|
function bindGoPayDeskButton() {
|
|
$("#gopaydesk_btn").off("click").on("click", function(e) {
|
|
e.stopImmediatePropagation();
|
|
e.preventDefault();
|
|
lastSelectedProduct = "";
|
|
|
|
if (neworders.length > 0) {
|
|
sendNewOrders(false,"s",goToPayDesk);
|
|
} else if (notDeliveredProdsAvailable) {
|
|
goToPayDesk();
|
|
} else {
|
|
alert(W_NO_ORDERS[lang]);
|
|
}
|
|
});
|
|
}
|
|
|
|
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 handleClickInChangeTablemap(data) {
|
|
$("#changetablewhatdialog").data("totableid", data.tableid);
|
|
$.mobile.changePage("#changetablewhatdialog");
|
|
}
|
|
|
|
function displayTableDialog(roomid, tableinfo, initialChange) {
|
|
$("#header_tchange").html("Tischauswahl");
|
|
|
|
var displaymap = shallDisplayRoom(roomid);
|
|
if (displaymap.show) {
|
|
$("#roomOrTableList").hide();
|
|
|
|
$("#tablemapcontentchangetable").show();
|
|
d = new Date();
|
|
$("#mapimgpartchangetable").attr(
|
|
"src",
|
|
"php/tablemap.php?command=getTableMapImgAsPng&roomid="
|
|
+ roomid + "&" + d.getTime());
|
|
|
|
var tablemap = new Tablemap(roomid, null, "");
|
|
tablemap.bindingForSelection("#mapimgpartchangetable",
|
|
handleClickInChangeTablemap.bind(this), displaymap.pos,
|
|
roomid);
|
|
if (initialChange) {
|
|
$.mobile.changePage("#tablechangedialog");
|
|
}
|
|
$("#changetablebackbtn").off("click").on("click", function(e) {
|
|
$("#tablemapcontentchangetable").hide();
|
|
$("#roomOrTableList").show();
|
|
});
|
|
} else {
|
|
$("#roomOrTableList").show();
|
|
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 resultOfChangeTable(jsonResult) {
|
|
if (jsonResult.status != "OK") {
|
|
alert("Fehler "
|
|
+ jsonResult.code
|
|
+ ": "
|
|
+ jsonResult.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(e) {
|
|
e.stopImmediatePropagation();
|
|
e.preventDefault();
|
|
|
|
var allRoomTables = $("#tables-page").data(
|
|
"allroomtables");
|
|
var noOfRooms = allRoomTables.length;
|
|
|
|
if (noOfRooms == 1) {
|
|
displayTableDialog(allRoomTables[0].id,
|
|
allRoomTables[0].tables, true);
|
|
} else {
|
|
$("#header_tchange").html("Raumauswahl");
|
|
var li = createRoomOrTableList(allRoomTables,
|
|
W_ROOMS[lang]);
|
|
$("#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].id,
|
|
allRoomTables[roomid].tables,
|
|
false);
|
|
});
|
|
});
|
|
}
|
|
|
|
});
|
|
}
|
|
|
|
function createHtmlOfKind(workItems, kind, printer) {
|
|
var text = "";
|
|
for (var i=0;i<workItems.length;i++) {
|
|
var item = workItems[i];
|
|
var longname = item.longname;
|
|
var option = item.anoption;
|
|
var extrastxt = createExtraParagraph(item.extras);
|
|
if ((kind == item.kind) && (printer == item.printer)) {
|
|
text += longname + "<br><i>" + option + "</i><br>" + extrastxt
|
|
+ "<br><br>";
|
|
}
|
|
}
|
|
return text;
|
|
}
|
|
|
|
function createExtraParagraph(extras) {
|
|
if ((extras == null) || (extras == "")) {
|
|
return "";
|
|
}
|
|
var extratxt = "";
|
|
for (var j = 0; j < extras.length; j++) {
|
|
extratxt += "+ " + toHtml(extras[j]) + "<br>";
|
|
}
|
|
return extratxt;
|
|
}
|
|
|
|
function arrayContainsKind(workItems, kind, printer) {
|
|
var result = false;
|
|
for (var i = 0; i < workItems.length; i++) {
|
|
var item = workItems[i];
|
|
if ((kind == item.kind) && (printer == item.printer)) {
|
|
result = true;
|
|
}
|
|
}
|
|
return result;
|
|
}
|
|
|
|
function fillPrintAreaAndPrint(jsonContent) {
|
|
updateNotDeliveredList();
|
|
var currentTime = new Date();
|
|
var hours = "0" + currentTime.getHours();
|
|
var minutes = "0" + currentTime.getMinutes();
|
|
hours = hours.substr(-2); // 2 digits - leading 0
|
|
minutes = minutes.substr(-2);
|
|
|
|
var timeStamp = "<i>Erstellung: " + hours + ":" + minutes + "</i>";
|
|
|
|
if (jsonContent.status == "OK") {
|
|
var printdata = jsonContent.msg;
|
|
|
|
var payPrintType = $("#workprintarea").data("payPrintType");
|
|
var totalHtml = "";
|
|
|
|
var tableToServe = $("#workprint_btn").data("tablename");
|
|
if (arrayContainsKind(printdata, 0, 1)) {
|
|
var foodHeaderLine = "<h1>Speisen für " + tableToServe
|
|
+ " (Printer 1)</h1><br>";
|
|
var foodText = foodHeaderLine + "<br>" + timeStamp + "<br><br>"
|
|
+ createHtmlOfKind(printdata, 0, 1) + "<br><br>";
|
|
|
|
totalHtml += foodText + "<br>";
|
|
|
|
}
|
|
if (arrayContainsKind(printdata, 0, 2)) {
|
|
var foodHeaderLine = "<h1>Speisen für " + tableToServe
|
|
+ " (Printer 2)</h1><br>";
|
|
var foodText = foodHeaderLine + "<br>" + timeStamp + "<br><br>"
|
|
+ createHtmlOfKind(printdata, 0, 2) + "<br><br>";
|
|
|
|
totalHtml += foodText + "<br>";
|
|
}
|
|
if (arrayContainsKind(printdata, 1, 1)) {
|
|
var drinkHeaderLine = "<h1>Getränke für " + tableToServe
|
|
+ " (Printer 1)</h1><br>";
|
|
var drinkText = drinkHeaderLine + "<br>" + timeStamp
|
|
+ "<br><br>" + createHtmlOfKind(printdata, 1, 1)
|
|
+ "<br><br>";
|
|
|
|
totalHtml += drinkText + "<br>";
|
|
}
|
|
if (arrayContainsKind(printdata, 1, 2)) {
|
|
var drinkHeaderLine = "<h1>Getränke für " + tableToServe
|
|
+ " (Printer 2)</h1><br>";
|
|
var drinkText = drinkHeaderLine + "<br>" + timeStamp
|
|
+ "<br><br>" + createHtmlOfKind(printdata, 1, 2)
|
|
+ "<br><br>";
|
|
|
|
totalHtml += drinkText + "<br>";
|
|
}
|
|
|
|
$("#workprintarea").html(totalHtml);
|
|
window.print();
|
|
setTimeout(function(){document.location.href = "waiter.html"},250);
|
|
|
|
} else {
|
|
alert("Druckdaten konnten nicht angefordert werden");
|
|
}
|
|
}
|
|
|
|
function printJob(header, table, timestamp, prods, theType, thePrinter) {
|
|
var data = {
|
|
header : header,
|
|
table : table,
|
|
timestamp : timestamp,
|
|
prods : prods,
|
|
type : theType,
|
|
printer : thePrinter
|
|
};
|
|
doJsonAjax(
|
|
"POST",
|
|
"php/contenthandler.php?module=printqueue&command=queueWorkPrintJob",
|
|
data, 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);
|
|
}
|
|
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(xhr, status, error) {
|
|
if (errorMsg != null) {
|
|
var errorMsgTxt = errorMsg + ", Status: " + status
|
|
+ ", Error:" + error + ", Msg: " + xhr.responseText
|
|
+ " (" + url + ")";
|
|
alert("Kommunikationsfehler zum Server: " + errorMsgTxt);
|
|
}
|
|
}
|
|
});
|
|
}
|
|
|
|
function doJsonAjaxAsync(getOrPost, url, data, functionToCallIfSuccess) {
|
|
$.ajax({
|
|
type : getOrPost,
|
|
url : url,
|
|
dataType : "json",
|
|
data : data,
|
|
async : true,
|
|
success : function(jsonContent) {
|
|
if (functionToCallIfSuccess != null) {
|
|
functionToCallIfSuccess(jsonContent);
|
|
}
|
|
},
|
|
error : function(xhr, status, error) {
|
|
}
|
|
});
|
|
}
|
|
|
|
function areYouSure(text1, text2, button, callback) {
|
|
$("#sure .sure-1").text(text1);
|
|
$("#sure .sure-2").text(text2);
|
|
$("#sure .sure-do").text(button).off("click.sure").on("click.sure",
|
|
function() {
|
|
callback();
|
|
});
|
|
$(this).off("click.sure");
|
|
$.mobile.changePage("#sure");
|
|
}
|
|
|
|
function changePriceInActPanel(newprice) {
|
|
if (rightchangeprice) {
|
|
$("#act-changepricefield").val(
|
|
newprice.toFixed(2).replace(".", decpoint));
|
|
}
|
|
}
|
|
|
|
function actionSelOnNewOrderElem() {
|
|
var entry = $("#actiononneworderel").data("entry");
|
|
var count = $("#actiononneworderel").data("newcount");
|
|
|
|
$("#act_count").html(count);
|
|
$("#act_name").html(entry.name);
|
|
if (entry.option != "") {
|
|
$("#act_option").html(" (" + entry.option + ")");
|
|
}
|
|
if (rightchangeprice) {
|
|
if (entry.changedPrices != "NO") {
|
|
$("#act-changepricefield").val(entry.changedPrices);
|
|
}
|
|
}
|
|
|
|
$("#act-select-comment").html(predefinedComments);
|
|
$.mobile.changePage("#actiononneworderel");
|
|
$('#act-select-comment').selectmenu('refresh');
|
|
|
|
// start binding
|
|
$("#actminusone").off("click").on(
|
|
"click",
|
|
function(e) {
|
|
e.stopImmediatePropagation();
|
|
e.preventDefault();
|
|
reduceOneNewOrderItem();
|
|
actionSelOnNewOrderElem($("#actiononneworderel").data(
|
|
"entry"), $("#actiononneworderel").data(
|
|
"groupedListIndex"));
|
|
});
|
|
|
|
$("#actplusone").off("click").on(
|
|
"click",
|
|
function(e) {
|
|
e.stopImmediatePropagation();
|
|
e.preventDefault();
|
|
increaseOneNewOrderItem();
|
|
actionSelOnNewOrderElem($("#actiononneworderel").data(
|
|
"entry"), $("#actiononneworderel").data(
|
|
"groupedListIndex"));
|
|
});
|
|
|
|
$("#actdel").off("click").on(
|
|
"click",
|
|
function(e) {
|
|
delOneNewOrderItem();
|
|
actionSelOnNewOrderElem($("#actiononneworderel").data(
|
|
"entry"), $("#actiononneworderel").data(
|
|
"groupedListIndex"));
|
|
actionNewOrderConfirm();
|
|
});
|
|
|
|
$("#actionneworderconfirm").off("click").on("click", function(e) {
|
|
e.stopImmediatePropagation();
|
|
e.preventDefault();
|
|
$("#actiononneworderel").dialog("close");
|
|
actionNewOrderConfirm();
|
|
});
|
|
|
|
$("#actionnewordercancel").off("click").on("click", function(e) {
|
|
binding_neworderelem();
|
|
});
|
|
|
|
$("#discount50").off("click").on("click", function(e) {
|
|
e.stopImmediatePropagation();
|
|
e.preventDefault();
|
|
var origPrice = entry.price;
|
|
changePriceInActPanel(origPrice / 2);
|
|
});
|
|
$("#discount25").off("click").on("click", function(e) {
|
|
e.stopImmediatePropagation();
|
|
e.preventDefault();
|
|
var origPrice = entry.price;
|
|
changePriceInActPanel(origPrice - origPrice / 4);
|
|
});
|
|
$("#discount10").off("click").on("click", function(e) {
|
|
e.stopImmediatePropagation();
|
|
e.preventDefault();
|
|
var origPrice = entry.price;
|
|
changePriceInActPanel(origPrice - origPrice / 10);
|
|
});
|
|
}
|
|
|
|
function actionNewOrderConfirm() {
|
|
// which entry was modified?
|
|
var groupEntry = $("#actiononneworderel").data("entry");
|
|
|
|
// now care for option
|
|
var option = $("#act-optionfield").val();
|
|
|
|
if (rightchangeprice == 1) {
|
|
changedPrice = $("#act-changepricefield").val().trim();
|
|
changedPrice = changedPrice.replace(",", ".");
|
|
if (changedPrice == "") {
|
|
changedPrice = "NO";
|
|
} else {
|
|
if (!$.isNumeric(changedPrice)) {
|
|
alert(W_WRONG_FORMAT[lang]);
|
|
return;
|
|
} else {
|
|
$("#act-changepricefield").val("");
|
|
}
|
|
}
|
|
} else {
|
|
changedPrice = "NO";
|
|
}
|
|
|
|
var allIdx = groupEntry.origidxs;
|
|
for (i = 0; i < allIdx.length; i++) {
|
|
var idx = allIdx[i];
|
|
neworders[idx].option = option;
|
|
neworders[idx].changedPrice = changedPrice;
|
|
}
|
|
$("#act-optionfield").val("");
|
|
|
|
var oldcount = groupEntry.count;
|
|
var newcount = $("#actiononneworderel").data("newcount");
|
|
var diff = newcount - oldcount;
|
|
|
|
if (diff < 0) {
|
|
// less entries
|
|
var entriesToRemove = 0 - diff; // now again positiv
|
|
var allIdx = groupEntry.origidxs;
|
|
var i = 0;
|
|
for (i = 0; i < entriesToRemove; i++) {
|
|
var anIdxToRemove = allIdx.pop();
|
|
neworders.splice(anIdxToRemove, 1);
|
|
}
|
|
}
|
|
|
|
if (diff > 0) {
|
|
// more entries - duplicate an entry
|
|
var allIdx = groupEntry.origidxs;
|
|
var sampleIdx = allIdx[0]; // take for copy
|
|
var prodid = neworders[sampleIdx].prodid;
|
|
var changedPrice = neworders[sampleIdx].changedPrice;
|
|
var option = neworders[sampleIdx].option;
|
|
var extras = neworders[sampleIdx].extras;
|
|
for (i = 0; i < diff; i++) {
|
|
addProductToQueueNoGuiUpdate(prodid, option, extras,
|
|
changedPrice);
|
|
}
|
|
}
|
|
|
|
updateNewOrdersGui();
|
|
}
|
|
|
|
function updateNewOrdersGui() {
|
|
groupedNewOrders = group(neworders);
|
|
updateNewOrdersList();
|
|
}
|
|
|
|
function reduceOneNewOrderItem() {
|
|
var count = $("#actiononneworderel").data("newcount");
|
|
if (count > 0) {
|
|
$("#actiononneworderel").data("newcount", count - 1);
|
|
}
|
|
}
|
|
|
|
function delOneNewOrderItem() {
|
|
$("#actiononneworderel").data("newcount", 0);
|
|
}
|
|
|
|
function increaseOneNewOrderItem() {
|
|
var entry = $("#actiononneworderel").data("entry");
|
|
var count = $("#actiononneworderel").data("newcount");
|
|
|
|
$("#actiononneworderel").data("newcount", count + 1);
|
|
}
|
|
|
|
function group(theSet) {
|
|
// create 2d array
|
|
var counts = [];
|
|
var joinedvals = [];
|
|
var name = [];
|
|
var price = []; // not used for grouping
|
|
var option = [];
|
|
var extras = [];
|
|
var prodids = [];
|
|
var origidxs = [];
|
|
var changedPrices = [];
|
|
|
|
var grouped = {
|
|
count : counts,
|
|
joinedvals : joinedvals,
|
|
name : name,
|
|
price : price,
|
|
option : option,
|
|
extras : extras,
|
|
prodids : prodids,
|
|
origidxs : origidxs,
|
|
changedPrices : changedPrices
|
|
};
|
|
|
|
var i = 0;
|
|
for (i = 0; i < theSet.length; i++) {
|
|
var anEntry = theSet[i];
|
|
var name = anEntry.name;
|
|
var price = anEntry.price;
|
|
var option = anEntry.option;
|
|
var prodid = anEntry.prodid;
|
|
var changedPrice = anEntry.changedPrice;
|
|
|
|
var extra = anEntry.extras;
|
|
var extrastxt = "";
|
|
// Generate extras name composition
|
|
if (extra != null) {
|
|
for (var j = 0; j < extra.length; j++) {
|
|
extrastxt += "<p>+ " + toHtml(extra[j].name) + "</p>";
|
|
}
|
|
}
|
|
|
|
var joinedNeedle = name + "-" + option + "-" + extrastxt;
|
|
if (changedPrice != "NO") {
|
|
joinedNeedle = name + "-" + option + "-" + extrastxt
|
|
+ changedPrice;
|
|
}
|
|
var index = grouped.joinedvals.indexOf(joinedNeedle);
|
|
if (index >= 0) {
|
|
// element is already in group
|
|
grouped.count[index] = grouped.count[index] + 1;
|
|
//var idsarr = grouped.ids[index];
|
|
//idsarr[idsarr.length] = id;
|
|
idxarr = grouped.origidxs[index]
|
|
idxarr[idxarr.length] = i;
|
|
grouped.origidxs[index] = idxarr; // append
|
|
} else {
|
|
// new element to be inserted in grouped
|
|
var gLength = grouped.count.length;
|
|
grouped.count[gLength] = 1;
|
|
grouped.joinedvals[gLength] = joinedNeedle;
|
|
grouped.name[gLength] = name;
|
|
grouped.price[gLength] = price;
|
|
grouped.option[gLength] = option;
|
|
grouped.extras[gLength] = extrastxt;
|
|
grouped.prodids[gLength] = prodid;
|
|
grouped.changedPrices[gLength] = changedPrice;
|
|
grouped.origidxs[gLength] = [ i ];
|
|
}
|
|
}
|
|
return grouped;
|
|
}
|
|
</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></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</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"> </a>
|
|
<h1><span id="tableselection">Tischauswahl</span></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"> </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>
|
|
|
|
<!-- 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>
|
|
<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">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="change_unpaid"><span id="change_unpaid_txt">Unbezahlt</span></a>
|
|
<a href="#" data-role="button" data-theme="b" data-icon="check" id="change_undelivered"><span id="change_undelivered_txt">Unserviert</span></a>
|
|
</div>
|
|
<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> |