ordersprinter/webapp/supplydesk.html

296 lines
9.2 KiB
HTML
Raw Normal View History

2020-11-19 22:44:19 +01:00
<html>
<head>
<title>Ansicht Bereitstellung</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
2020-11-19 22:47:44 +01:00
<meta http-equiv="content-type" content="text/html; charset=utf-8">
2020-11-19 22:48:24 +01:00
<meta name="author" content="Stefan Pichel">
2020-11-19 22:44:19 +01:00
2020-11-19 22:55:09 +01:00
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.1.12">
2020-11-19 22:44:19 +01:00
<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>
2020-11-19 22:47:44 +01:00
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!");
}
}
2020-11-19 22:44:19 +01:00
// refreshing the content
$(document).ready(function() {
var refreshId = setInterval(function() {
getAndDisplayAllEntries();
2020-11-19 22:47:44 +01:00
}, 10000);
2020-11-19 22:44:19 +01:00
$.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) {
2020-11-19 22:47:44 +01:00
doAjax("POST","php/contenthandler.php?module=queue&command=declareMultipleProductsDelivered", { queueids: queueids }, null, "Fehler");
2020-11-19 22:44:19 +01:00
}
function declareProductNOTBeDelivered(queueid) {
doAjaxNonJsonNonCall("POST","php/contenthandler.php?module=queue&command=declareProductNotBeDelivered",{ queueid: queueid});
}
2020-11-19 22:47:44 +01:00
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};
}
2020-11-19 22:44:19 +01:00
function listOfTable(table) {
var tableid = table.tableid;
2020-11-19 22:47:44 +01:00
var tablename = S_TABLE[lang] + table.tableheadline;
2020-11-19 22:44:19 +01:00
var theme = 'd';
2020-11-19 22:47:44 +01:00
var tablestatus = S_INCOMPLETE[lang];
2020-11-19 22:44:19 +01:00
if (table.tablestatus == 'complete') {
2020-11-19 22:47:44 +01:00
tablestatus = S_COMPLETE[lang];
2020-11-19 22:44:19 +01:00
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>';
2020-11-19 22:47:44 +01:00
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>';
}
2020-11-19 22:44:19 +01:00
2020-11-19 22:47:44 +01:00
var itemsForTable = table.prodsOfTable;
2020-11-19 22:44:19 +01:00
$.each(itemsForTable, function (i, entry) {
var option = '';
2020-11-19 22:47:44 +01:00
var extratxt = createExtraParagraph(entry.extras);
2020-11-19 22:44:19 +01:00
if (entry.option != '') {
2020-11-19 22:47:44 +01:00
option = '<p>' + toHtml(entry.option) + '</p>';
2020-11-19 22:44:19 +01:00
}
2020-11-19 22:47:44 +01:00
aList += '<li data-theme="c" data-icon="check" class="preparedlistitem" + id="' + entry.id + '"><a href="#">' + toHtml(entry.longname) + extratxt + option + '</a></li>';
2020-11-19 22:44:19 +01:00
});
aList += '</ul>';
2020-11-19 22:47:44 +01:00
aList += '<p><div><img id="mapimgpart_' + tableid + '" style="width:100%;display:none;" src=img/empty-room.png /></div></p>';
2020-11-19 22:44:19 +01:00
return aList;
}
function fillTableWithPreparedProds(entriesToCook) {
var aList = '';
$.each(entriesToCook, function (i, table) {
aList += listOfTable(table);
});
$("#prodstodeliver").html(aList);
$("#prodstodeliver").trigger("create");
2020-11-19 22:47:44 +01:00
$(".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();
});
2020-11-19 22:44:19 +01:00
$.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">';
2020-11-19 22:47:44 +01:00
theList += '<li data-role="list-divider" data-theme="b" data-role="heading" data-icon="check">' + S_PROVIDED[lang] + '</li>';
2020-11-19 22:44:19 +01:00
$.each(cookedEntries, function (i, queueentry) {
2020-11-19 22:47:44 +01:00
var prodname = toHtml(queueentry.longname);
2020-11-19 22:44:19 +01:00
var queue_entry_id = queueentry.id;
var tablename = queueentry.tablename;
2020-11-19 22:47:44 +01:00
var extratxt = createExtraParagraph(queueentry.extras);
theList += '<li data-theme="e" data-icon="arrow-u" id="' + queue_entry_id + '" class="deliveredlistitem"><a href="#">' + prodname + extratxt;
2020-11-19 22:44:19 +01:00
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();
}
2020-11-19 22:47:44 +01:00
2020-11-19 22:44:19 +01:00
$(document).on("pageinit", "#supplydesk-page", function () {
2020-11-19 22:47:44 +01:00
getTableMapPreferences();
getGeneralConfigItems();
});
function initializeEverything() {
2020-11-19 22:44:19 +01:00
initializeMainMenu("#modulemenu");
hideMenu();
getAndDisplayAllEntries();
2020-11-19 22:47:44 +01:00
}
2020-11-19 22:44:19 +01:00
</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">
2020-11-19 22:47:44 +01:00
<h1><span id="supplyheadline">Bereitstellung</span></h1>
2020-11-19 22:44:19 +01:00
<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>