From 5f49586f122f92b7156ecfe1f104afba11a5f258 Mon Sep 17 00:00:00 2001 From: "jove@bisquerra.com" Date: Sun, 31 May 2020 02:17:33 +0200 Subject: [PATCH 1/2] TakePOS customer menu QR --- htdocs/langs/en_US/cashdesk.lang | 4 +- htdocs/takepos/admin/bar.php | 27 +++++- htdocs/takepos/genimg/qr.php | 13 ++- htdocs/takepos/public/css/style.css | 144 ++++++++++++++++++++++++++++ htdocs/takepos/public/js/script.js | 1 + htdocs/takepos/public/menu.php | 117 ++++++++++++++++++++++ 6 files changed, 299 insertions(+), 7 deletions(-) create mode 100644 htdocs/takepos/public/css/style.css create mode 100644 htdocs/takepos/public/js/script.js create mode 100644 htdocs/takepos/public/menu.php diff --git a/htdocs/langs/en_US/cashdesk.lang b/htdocs/langs/en_US/cashdesk.lang index 52c2004c1c7..8d1f50007ea 100644 --- a/htdocs/langs/en_US/cashdesk.lang +++ b/htdocs/langs/en_US/cashdesk.lang @@ -107,4 +107,6 @@ OrderPrinterToUse=Order printer to use MainTemplateToUse=Main template to use OrderTemplateToUse=Order template to use BarRestaurant=Bar Restaurant -AutoOrder=Customer auto order \ No newline at end of file +AutoOrder=Customer auto order +RestaurantMenu=Menu +CustomerMenu=Customer menu \ No newline at end of file diff --git a/htdocs/takepos/admin/bar.php b/htdocs/takepos/admin/bar.php index 81eaf319295..0f47990cb4a 100644 --- a/htdocs/takepos/admin/bar.php +++ b/htdocs/takepos/admin/bar.php @@ -127,11 +127,17 @@ if ($conf->global->TAKEPOS_SUPPLEMENTS) } print ''; -print $langs->trans("AutoOrder"); +print 'QR - '.$langs->trans("AutoOrder"); print ''; print ajax_constantonoff("TAKEPOS_AUTO_ORDER", array(), $conf->entity, 0, 0, 1, 0); print ''; +print ''; +print 'QR - '.$langs->trans("CustomerMenu"); +print ''; +print ajax_constantonoff("TAKEPOS_QR_MENU", array(), $conf->entity, 0, 0, 1, 0); +print ''; + print ''; @@ -155,13 +161,30 @@ if ($conf->global->TAKEPOS_AUTO_ORDER) print ''; print "".$urlwithroot."/takepos/public/auto_order.php?key=".dol_encode($row['rowid']).""; print ''; - print ""; + print ""; print ''; } print ''; } +if ($conf->global->TAKEPOS_QR_MENU) +{ + $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root)); + $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file + print '
'; + print ''; + print ''; + print ''; + print "\n"; + print ''; + print '
'.$langs->trans("URL").''.$langs->trans("QR").'
'; + print "".$urlwithroot."/takepos/public/menu.php"; + print ''; + print ""; + print '
'; +} + print ''; print '
'; diff --git a/htdocs/takepos/genimg/qr.php b/htdocs/takepos/genimg/qr.php index 3aca3b22ebf..452eb7023e2 100644 --- a/htdocs/takepos/genimg/qr.php +++ b/htdocs/takepos/genimg/qr.php @@ -27,10 +27,15 @@ if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); require '../../main.inc.php'; // Load $user and permissions require '../../core/modules/barcode/doc/tcpdfbarcode.modules.php'; -$key = GETPOST('key'); - $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root)); $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file -$module = new modTcpdfbarcode(); -$result = $module->buildBarCode($urlwithroot."/takepos/public/auto_order.php?key=".dol_encode($key), 'QRCODE', 'Y'); +if (GETPOSTISSET("key")) { + $key = GETPOST('key'); + $module = new modTcpdfbarcode(); + $result = $module->buildBarCode($urlwithroot."/takepos/public/auto_order.php?key=".$key, 'QRCODE', 'Y'); +} +else { + $module = new modTcpdfbarcode(); + $result = $module->buildBarCode($urlwithroot."/takepos/public/menu.php", 'QRCODE', 'Y'); +} diff --git a/htdocs/takepos/public/css/style.css b/htdocs/takepos/public/css/style.css new file mode 100644 index 00000000000..418945cf5f5 --- /dev/null +++ b/htdocs/takepos/public/css/style.css @@ -0,0 +1,144 @@ +/* -- footer -- */ +html { + position: relative; + min-height: 100%; +} +body { + margin-bottom: 60px; + font-family: 'Khand', sans-serif; +} +.footer { + position: absolute; + bottom: 0; + width: 100%; + height: 60px; + background-color: #f5f5f5; +} +.container .text-muted { + margin: 20px 0; +} +.footer > .container { + padding-right: 15px; + padding-left: 15px; +} +/* -- -- */ +h3 { + display:inline-block; + font-size: 32px; + line-height: 36px; + position: relative; + margin-top:28px; + margin-bottom:15px; +} +h3:before{ + left: -40px; + height: 0; + height:1px; +} +h3:before, h3:after { + content: ""; + position: absolute; + bottom: 10px; + height: 1px; + width: 40px; + margin: 0 -15px; + background-color: #533834; +} +h3:after{ + right: -40px; +} +h5 { + font-size: 16px; + line-height: 22px; + margin: 0 0 15px; + font-weight: 400; +} +.item { + position: relative; + overflow: hidden; + margin-bottom:20px; +} +.item h4, .price { + z-index: 0; + position: relative; + background-color: #fff; + right: 0; + position: absolute; +} +.item .price { + padding-left: 8px; +} +.item h4, .item p { + display: block; + clear: both; + color: #533834; +} +.item p { + clear: both; + color: #938372; + margin-left:10px; +} +.dots { + background-image: linear-gradient(to right,rgba(56,47,47,.5) 33%,rgba(0,0,0,0) 0%); + background-position: bottom; + background-size: 3px 1px; + background-repeat: repeat-x; + height: 1px; + width: 100%; + position: absolute; + top: 22px; +} +/* Dots in IE */ +@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) { + .dots { + background: transparent url('/img/dot.gif') repeat-x bottom left; + } +} +.badge { + display: inline-block; + padding: 0 10px; + background: #d2c82a; + font-size: 12px; + font-weight: 300; + line-height: 26px; + color: #fff; + text-align: center; + vertical-align: middle; + text-transform: uppercase; + border: 1px solid rgba(0,0,0,.05); + letter-spacing: 1px; + border-radius: 3px; + margin: -5px 5px 0 0; +} +.note { + padding: 0 6px; + min-width: 23px; + background: rgba(0,0,0,0); + border: 1px solid #382f2f; + color: #382f2f; + box-sizing: border-box; + border-radius: 500px; + line-height: 21px; +} +.veggie { + color:#82b440; + border-color:#82b440; +} +.spicy { + color:#ec4e00; + border-color:#ec4e00; +} +.price { + position: absolute; + font-size:22px; + font-weight:400; + right: 0; +} +.item h4 { + display: inline-block; + padding-right: 8px; + max-width: 80%; + text-transform: capitalize; + margin-bottom:4px; + position: relative; +} \ No newline at end of file diff --git a/htdocs/takepos/public/js/script.js b/htdocs/takepos/public/js/script.js new file mode 100644 index 00000000000..c3c8817354f --- /dev/null +++ b/htdocs/takepos/public/js/script.js @@ -0,0 +1 @@ +$(document).foundation(); \ No newline at end of file diff --git a/htdocs/takepos/public/menu.php b/htdocs/takepos/public/menu.php new file mode 100644 index 00000000000..c15df6d1b9c --- /dev/null +++ b/htdocs/takepos/public/menu.php @@ -0,0 +1,117 @@ + + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file htdocs/takepos/public/menu.php + * \ingroup takepos + * \brief Public menu for customers + */ + +if (!defined("NOLOGIN")) define("NOLOGIN", '1'); // If this page is public (can be called outside logged session) +if (!defined('NOIPCHECK')) define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip + +require '../../main.inc.php'; + +require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; + +if (!$conf->global->TAKEPOS_QR_MENU) accessforbidden(); // If Restaurant Menu is disabled never allow NO LOGIN access +?> + + + + + <?php echo $mysoc->name; ?> + + + + + + + +
+ +
+
+
+

name; ?>

+
+
+ + + + + + + From 3ddce9f0dfe50b4fd620d353af458f0d0f8238fc Mon Sep 17 00:00:00 2001 From: andreubisquerra Date: Sun, 31 May 2020 02:34:46 +0200 Subject: [PATCH 2/2] Fix travis --- htdocs/takepos/public/menu.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/takepos/public/menu.php b/htdocs/takepos/public/menu.php index c15df6d1b9c..c051ae4d673 100644 --- a/htdocs/takepos/public/menu.php +++ b/htdocs/takepos/public/menu.php @@ -83,7 +83,7 @@ foreach ($maincategories as $cat){

'.$cat['label'].'

'; - + $object = new Categorie($db); $result = $object->fetch($cat['id']); $prods = $object->getObjectsInCateg("product", 0, 0, 0, $conf->global->TAKEPOS_SORTPRODUCTFIELD, 'ASC'); @@ -93,12 +93,12 @@ foreach ($maincategories as $cat){

'.$pro->label.'

- '.price($pro->price_ttc,1).' + '.price($pro->price_ttc, 1).'
'; } print ''; -} +} ?>