Merge pull request #14012 from andreubisquerra/master
TakePOS QR customer menu
This commit is contained in:
commit
33859bac2c
@ -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
|
||||
AutoOrder=Customer auto order
|
||||
RestaurantMenu=Menu
|
||||
CustomerMenu=Customer menu
|
||||
@ -127,11 +127,17 @@ if ($conf->global->TAKEPOS_SUPPLEMENTS)
|
||||
}
|
||||
|
||||
print '<tr class="oddeven value"><td>';
|
||||
print $langs->trans("AutoOrder");
|
||||
print 'QR - '.$langs->trans("AutoOrder");
|
||||
print '<td colspan="2">';
|
||||
print ajax_constantonoff("TAKEPOS_AUTO_ORDER", array(), $conf->entity, 0, 0, 1, 0);
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr class="oddeven value"><td>';
|
||||
print 'QR - '.$langs->trans("CustomerMenu");
|
||||
print '<td colspan="2">';
|
||||
print ajax_constantonoff("TAKEPOS_QR_MENU", array(), $conf->entity, 0, 0, 1, 0);
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
print '</table>';
|
||||
|
||||
@ -155,13 +161,30 @@ if ($conf->global->TAKEPOS_AUTO_ORDER)
|
||||
print '<td>';
|
||||
print "<a target='_blank' href='".$urlwithroot."/takepos/public/auto_order.php?key=".dol_encode($row['rowid'])."'>".$urlwithroot."/takepos/public/auto_order.php?key=".dol_encode($row['rowid'])."</a>";
|
||||
print '<td>';
|
||||
print "<img src='".DOL_URL_ROOT."/takepos/genimg/qr.php?id=".dol_encode($row['rowid'])."' height='42' width='42'>";
|
||||
print "<img src='".DOL_URL_ROOT."/takepos/genimg/qr.php?key=".dol_encode($row['rowid'])."' height='42' width='42'>";
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
}
|
||||
|
||||
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 '<br>';
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("URL").'</td><td>'.$langs->trans("QR").'</td>';
|
||||
print "</tr>\n";
|
||||
print '<tr class="oddeven value"><td>';
|
||||
print "<a target='_blank' href='".$urlwithroot."/takepos/public/menu.php'>".$urlwithroot."/takepos/public/menu.php</a>";
|
||||
print '<td>';
|
||||
print "<img src='".DOL_URL_ROOT."/takepos/genimg/qr.php' height='42' width='42'>";
|
||||
print '</td></tr>';
|
||||
print '</table>';
|
||||
}
|
||||
|
||||
print '</div>';
|
||||
|
||||
print '<br>';
|
||||
|
||||
@ -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');
|
||||
}
|
||||
|
||||
144
htdocs/takepos/public/css/style.css
Normal file
144
htdocs/takepos/public/css/style.css
Normal file
@ -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;
|
||||
}
|
||||
1
htdocs/takepos/public/js/script.js
Normal file
1
htdocs/takepos/public/js/script.js
Normal file
@ -0,0 +1 @@
|
||||
$(document).foundation();
|
||||
117
htdocs/takepos/public/menu.php
Normal file
117
htdocs/takepos/public/menu.php
Normal file
@ -0,0 +1,117 @@
|
||||
<?php
|
||||
/* Copyright (C) - 2020 Andreu Bisquerra Gaya <jove@bisquerra.com>
|
||||
*
|
||||
* 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 <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \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
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title><?php echo $mysoc->name; ?></title>
|
||||
<link rel='stylesheet' href='https://cdn.jsdelivr.net/npm/foundation-sites@6.6.3/dist/css/foundation.min.css'>
|
||||
<link rel='stylesheet' href='https://fonts.googleapis.com/css?family=Khand:400,300,500,600,700'><link rel="stylesheet" href="css/style.css">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
</head>
|
||||
<body>
|
||||
<!-- partial:index.partial.html -->
|
||||
<body>
|
||||
<div class="grid-container">
|
||||
<div class="grid-x grid-padding-x menu2">
|
||||
<div class="cell small-12">
|
||||
<h1><?php print $mysoc->name; ?> <small><?php print $langs->trans('RestaurantMenu'); ?></small></h1>
|
||||
|
||||
<?php
|
||||
$categorie = new Categorie($db);
|
||||
$categories = $categorie->get_full_arbo('product', (($conf->global->TAKEPOS_ROOT_CATEGORY_ID > 0) ? $conf->global->TAKEPOS_ROOT_CATEGORY_ID : 0), 1);
|
||||
$levelofrootcategory = 0;
|
||||
if ($conf->global->TAKEPOS_ROOT_CATEGORY_ID > 0)
|
||||
{
|
||||
foreach ($categories as $key => $categorycursor)
|
||||
{
|
||||
if ($categorycursor['id'] == $conf->global->TAKEPOS_ROOT_CATEGORY_ID)
|
||||
{
|
||||
$levelofrootcategory = $categorycursor['level'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
$levelofmaincategories = $levelofrootcategory + 1;
|
||||
|
||||
$maincategories = array();
|
||||
$subcategories = array();
|
||||
foreach ($categories as $key => $categorycursor)
|
||||
{
|
||||
if ($categorycursor['level'] == $levelofmaincategories)
|
||||
{
|
||||
$maincategories[$key] = $categorycursor;
|
||||
} else {
|
||||
$subcategories[$key] = $categorycursor;
|
||||
}
|
||||
}
|
||||
|
||||
$maincategories = dol_sort_array($maincategories, 'label');
|
||||
|
||||
foreach ($maincategories as $cat){
|
||||
print '<div class="text-center">
|
||||
<a id="'.$cat['id'].'"></a><h3>'.$cat['label'].'</h3>
|
||||
</div>
|
||||
<div class="grid-x grid-padding-x">';
|
||||
|
||||
$object = new Categorie($db);
|
||||
$result = $object->fetch($cat['id']);
|
||||
$prods = $object->getObjectsInCateg("product", 0, 0, 0, $conf->global->TAKEPOS_SORTPRODUCTFIELD, 'ASC');
|
||||
foreach ($prods as $pro){
|
||||
print '
|
||||
<div class="cell small-6 medium-4">
|
||||
<div class="item">
|
||||
<h4>'.$pro->label.'</h4>
|
||||
<span class="dots"></span>
|
||||
<span class="price">'.price($pro->price_ttc, 1).'</span>
|
||||
</div>
|
||||
</div>';
|
||||
}
|
||||
print '</div>';
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<footer class="footer">
|
||||
<div class="container">
|
||||
<p class="text-muted"><?php print $mysoc->name; ?></p>
|
||||
</div>
|
||||
</footer>
|
||||
</body>
|
||||
<!-- partial -->
|
||||
<script src='https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js'></script>
|
||||
<script src='https://cdn.jsdelivr.net/npm/foundation-sites@6.6.3/dist/js/foundation.min.js'></script><script src="js/script.js"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
Loading…
Reference in New Issue
Block a user