ordersprinter/webapp/supplydesk.html

296 lines
9.3 KiB
HTML

<html>
<head>
<title>Ansicht Bereitstellung</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.10">
<link rel="stylesheet" href="php/3rdparty/orderstyle/orderstyle.min.css" />
<link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" />
<link rel="stylesheet" href="php/3rdparty/jquery.mobile-1.4.0.min.css" type="text/css" />
<script src="php/3rdparty/jquery-2.0.3.min.js"></script>
<script src="php/3rdparty/jquery.mobile-1.4.0.min.js"></script>
<script src="utilities.js"></script>
<style>
#tableWithPreparedProds,#tableWithDeliveredEntries,#headertableToCook
{
width:100%;
}
#tableWithPreparedProds tr:hover td {
background-color: #ffaaff;
}
#declareready,#declarenotcooked {
text-align:center;
vertical-align:middle;
}
#readybutton,#notreadybutton,#alldeliverbutton {
width:90%;
}
#optiontext
{
font-family:sans-serif;
font-size:10pt;
color:black;
}
#tableWithDeliveredEntries td {
background:#b4b4ec
}
.dividerline {
height: 10px;
}
</style>
</head>
<body>
<script>
var S_PROVIDED = ["Serviert (die letzten 10 Produkte)","Served (last 10 products)","Servido (últimos 10 productos)"];
var S_TABLE = ["Tisch: ","Table: ","Mesa: "];
var S_INCOMPLETE = ["unvollständig","incomplete","incompleto"];
var S_COMPLETE = ["komplett","complete","completo"];
var S_ALL = ["Alles","All","Todo"];
var S_PROVISION = ["Bereitstellung","Prepared Products","Productos preparados"];
var S_SHOW_POS = ["Zeige Positionen an/aus","Show position on/off","Mostrar posición si/no"];
var lang = 0;
function setLanguage(language) {
lang = language;
$("#supplyheadline").html(S_PROVISION[lang]);
}
function getGeneralConfigItems() {
doAjax("GET", "php/contenthandler.php?module=admin&command=getGeneralConfigItems", null, insertGeneralConfigItems, "Fehler Konfigurationsdaten");
}
function insertGeneralConfigItems(configResult) {
if (configResult.status == "OK") {
var values = configResult.msg;
setLanguage(values.userlanguage);
initializeEverything();
} else {
setTimeout(function(){document.location.href = "index.html"},250); // not logged in
//alert("Fehler beim Abruf der Konfigurationsdaten!");
}
}
// refreshing the content
$(document).ready(function() {
var refreshId = setInterval(function() {
getAndDisplayAllEntries();
}, 10000);
$.ajaxSetup({ cache: false });
});
function getPreparedProds() {
doAjax("GET","php/contenthandler.php?module=queue&command=getJsonAllPreparedProducts",null,fillTableWithPreparedProds,"Vorbereitete Produkte");
}
function getDeliveredEntries() {
doAjax("GET","php/contenthandler.php?module=queue&command=getJsonLastDeliveredProducts",null,filltableWithDeliveredEntries,"Bereitgestellte Produkte");
}
function declareProductBeDelivered(queueid) {
doAjaxNonJsonNonCall("POST","php/contenthandler.php?module=queue&command=declareProductBeDelivered",{ queueid: queueid});
}
function declareMultipleProductsDelivered(queueids) {
doAjax("POST","php/contenthandler.php?module=queue&command=declareMultipleProductsDelivered", { queueids: queueids }, null, "Fehler");
}
function declareProductNOTBeDelivered(queueid) {
doAjaxNonJsonNonCall("POST","php/contenthandler.php?module=queue&command=declareProductNotBeDelivered",{ queueid: queueid});
}
function getTableMapPreferences() {
doAjax("GET","php/tablemap.php?command=getTableMapPreferences",null,insertTMInfo,"Keine TM-Information");
}
function insertTMInfo(jsonTminfo) {
tminfo = jsonTminfo;
}
function shallDisplayMapForTable(tableid) {
for (var i=0;i<tminfo.length;i++) {
var aRoom = tminfo[i];
if (aRoom.displaymap == 1) {
var tablePos = aRoom.tablepositions;
for (j=0;j<tablePos.length;j++) {
var aTablePos = tablePos[j];
if (aTablePos.haspos == 1) {
if (aTablePos.id == tableid) {
return shallDisplayRoom(aRoom.roomid);
}
}
}
}
}
return {show:false};
}
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 listOfTable(table) {
var tableid = table.tableid;
var tablename = S_TABLE[lang] + table.tableheadline;
var theme = 'd';
var tablestatus = S_INCOMPLETE[lang];
if (table.tablestatus == 'complete') {
tablestatus = S_COMPLETE[lang];
theme = "e";
}
var aList = '<ul data-role="listview" id="' + tableid + '" data-divider-theme="a" data-inset="true">';
aList += '<li data-role="list-divider" data-theme="' + theme + '" data-role="heading" data-icon="check">' + tablename + ' (' + tablestatus + ')</li>';
aList += '<li data-theme="f" data-icon="check" id="table-' + tableid + '" class="preparedtable"><a href="#" ><h2>' + S_ALL[lang] + '</h2></A></LI>';
if (shallDisplayMapForTable(tableid).show) {
aList += '<li data-theme="d" data-icon="check" id="tableshowpos_' + tableid + '" class="showpos"><a href="#" ><h2>' + S_SHOW_POS[lang] + '</h2></A></LI>';
}
var itemsForTable = table.prodsOfTable;
$.each(itemsForTable, function (i, entry) {
var option = '';
var extratxt = createExtraParagraph(entry.extras);
if (entry.option != '') {
option = '<p>' + toHtml(entry.option) + '</p>';
}
aList += '<li data-theme="c" data-icon="check" class="preparedlistitem" + id="' + entry.id + '"><a href="#">' + toHtml(entry.longname) + extratxt + option + '</a></li>';
});
aList += '</ul>';
aList += '<p><div><img id="mapimgpart_' + tableid + '" style="width:100%;display:none;" src=img/empty-room.png /></div></p>';
return aList;
}
function fillTableWithPreparedProds(entriesToCook) {
var aList = '';
$.each(entriesToCook, function (i, table) {
aList += listOfTable(table);
});
$("#prodstodeliver").html(aList);
$("#prodstodeliver").trigger("create");
$(".showpos").off("click").on("click", function (e) {
var tableid = this.id.split("_")[1];
var tables = [ {id:tableid} ];
d = new Date();
$("#mapimgpart_" + tableid).attr("src", "php/tablemap.php?command=getTableMapImgAsPng&tableid=" + tableid + "&"+d.getTime());
$("#mapimgpart_" + tableid).toggle();
});
$.each(entriesToCook, function (i, table) {
$("#table-" + table.tableid).data("queueids", table.ids);
});
$(".preparedlistitem").off("click").on("click", function (e) {
declareProductBeDelivered($(this).attr("id"));
getAndDisplayAllEntries();
});
$(".preparedtable").off("click").on("click", function (e) {
var test = $(this).data("queueids");
declareMultipleProductsDelivered($(this).data("queueids"));
getAndDisplayAllEntries();
});
}
function filltableWithDeliveredEntries(cookedEntries) {
var theList = '<ul data-role="listview" id="deliveredProdsList" data-divider-theme="a" data-inset="true">';
theList += '<li data-role="list-divider" data-theme="b" data-role="heading" data-icon="check">' + S_PROVIDED[lang] + '</li>';
$.each(cookedEntries, function (i, queueentry) {
var prodname = toHtml(queueentry.longname);
var queue_entry_id = queueentry.id;
var tablename = queueentry.tablename;
var extratxt = createExtraParagraph(queueentry.extras);
theList += '<li data-theme="e" data-icon="arrow-u" id="' + queue_entry_id + '" class="deliveredlistitem"><a href="#">' + prodname + extratxt;
theList += '<p>' + tablename + ' - ' + queueentry.delivertime + '</p>';
theList += '</A></LI>';
});
theList += '</ul>';
$("#prodsalreadydelivered").html(theList);
$("#prodsalreadydelivered").trigger("create");
$(".deliveredlistitem").off("click").on("click", function (e) {
declareProductNOTBeDelivered($(this).attr("id"));
getAndDisplayAllEntries();
});
}
function getAndDisplayAllEntries ()
{
getPreparedProds();
getDeliveredEntries();
}
$(document).on("pageinit", "#supplydesk-page", function () {
getTableMapPreferences();
getGeneralConfigItems();
});
function initializeEverything() {
initializeMainMenu("#modulemenu");
hideMenu();
getAndDisplayAllEntries();
}
</script>
<!--first page -->
<div data-role="page" id="supplydesk-page">
<div data-role="panel" id="modulepanel" data-position="right" data-display="overlay">
<ul data-role="listview" id="modulemenu" 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="supplyheadline">Bereitstellung</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">
<div id="prodstodeliver"></div>
<hr>
<div id="prodsalreadydelivered"></div>
</div>
<div data-role="footer" data-theme="b" id="thefooterr">
<div class="ui-grid-a">
<div class="ui-block-a userinfo" id="loggedinuser"></div>
<div class="ui-block-b grid_right" id="versioninfo"></div>
</div><!-- /grid-a -->
</div> <!-- footer -->
</div>
</body>
</html>