TakePOS Auto Order improvements
This commit is contained in:
parent
e55d9ed3b8
commit
b93a3ceb29
@ -79,3 +79,31 @@ button.phonebutton {
|
||||
height:90%;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
button.publicphonebutton {
|
||||
display: inline-block;
|
||||
position: relative;
|
||||
padding: 0;
|
||||
line-height: normal;
|
||||
cursor: pointer;
|
||||
vertical-align: middle;
|
||||
text-align: center;
|
||||
overflow: visible; /* removes extra width in IE */
|
||||
width:33%;
|
||||
height:90%;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
button.publicphonebutton2 {
|
||||
display: inline-block;
|
||||
position: relative;
|
||||
padding: 0;
|
||||
line-height: normal;
|
||||
cursor: pointer;
|
||||
vertical-align: middle;
|
||||
text-align: center;
|
||||
overflow: visible; /* removes extra width in IE */
|
||||
width:33%;
|
||||
font-weight: bold;
|
||||
padding: 8px 16px;
|
||||
}
|
||||
|
||||
@ -29,5 +29,8 @@ require '../../core/modules/barcode/doc/tcpdfbarcode.modules.php';
|
||||
|
||||
$key = GETPOST('key');
|
||||
|
||||
$module = new modTcpdfbarcode($db);
|
||||
$result = $module->buildBarCode("http://www.takepos.com", 'QRCODE', 'Y');
|
||||
$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($db);
|
||||
$result = $module->buildBarCode($urlwithroot."/takepos/auto_order.php?key=".dol_encode($key), 'QRCODE', 'Y');
|
||||
|
||||
@ -32,7 +32,7 @@ if (!defined('NOREQUIREMENU')) { define('NOREQUIREMENU', '1'); }
|
||||
if (!defined('NOREQUIREHTML')) { define('NOREQUIREHTML', '1'); }
|
||||
if (!defined('NOREQUIREAJAX')) { define('NOREQUIREAJAX', '1'); }
|
||||
|
||||
require '../main.inc.php';
|
||||
if (!defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')) require '../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';
|
||||
@ -47,16 +47,11 @@ $idproduct = GETPOST('idproduct', 'int');
|
||||
$place = (GETPOST('place', 'aZ09') ? GETPOST('place', 'aZ09') : 0); // $place is id of table for Bar or Restaurant
|
||||
$placeid = 0; // $placeid is ID of invoice
|
||||
|
||||
if ($_SESSION["publicterminal"]) {
|
||||
$_SESSION["takeposterminal"] = 1; // Use Terminal 1 for public customers
|
||||
}
|
||||
elseif (empty($user->rights->takepos->run)) {
|
||||
if (empty($user->rights->takepos->run) && !defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (($conf->global->TAKEPOS_PHONE_BASIC_LAYOUT == 1 && $conf->browser->layout == 'phone') || $_SESSION["publicterminal"])
|
||||
if (($conf->global->TAKEPOS_PHONE_BASIC_LAYOUT == 1 && $conf->browser->layout == 'phone') || defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE'))
|
||||
{
|
||||
// DIRECT LINK TO THIS PAGE FROM MOBILE AND NO TERMINAL SELECTED
|
||||
if ($_SESSION["takeposterminal"] == "")
|
||||
@ -629,6 +624,12 @@ $(document).ready(function() {
|
||||
if (selectedline==this.id) return; // If is already selected
|
||||
else selectedline=this.id;
|
||||
selectedtext=$('#'+selectedline).find("td:first").html();
|
||||
<?php
|
||||
if (defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')){
|
||||
print '$("#phonediv1").load("auto_order.php?action=editline&placeid="+placeid+"&selectedline="+selectedline, function() {
|
||||
});';
|
||||
}
|
||||
?>
|
||||
});
|
||||
|
||||
/* Autoselect the line */
|
||||
@ -913,7 +914,7 @@ if ($_SESSION["basiclayout"] == 1)
|
||||
$htmlforlines .= '" onclick="AddProduct(\''.$place.'\', '.$row->id.')">';
|
||||
$htmlforlines .= '<td class="left">';
|
||||
$htmlforlines .= $row->label;
|
||||
$htmlforlines .= '</td>';
|
||||
$htmlforlines .= '<div class="right">'.price($row->price_ttc, 1, $langs, 1, -1, -1, $conf->currency).'</div>';
|
||||
$htmlforlines .= '</tr>'."\n";
|
||||
}
|
||||
$htmlforlines .= '</table>';
|
||||
@ -990,6 +991,7 @@ if ($placeid > 0)
|
||||
}
|
||||
$htmlforlines .= '" id="'.$line->id.'">';
|
||||
$htmlforlines .= '<td class="left">';
|
||||
if ($_SESSION["basiclayout"] == 1) $htmlforlines .= $line->qty." x ";
|
||||
//if ($line->product_label) $htmlforlines.= '<b>'.$line->product_label.'</b>';
|
||||
if (isset($line->product_type))
|
||||
{
|
||||
|
||||
@ -31,7 +31,7 @@ if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1');
|
||||
if (!defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1');
|
||||
if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1');
|
||||
|
||||
if (!defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')) require '../main.inc.php';
|
||||
if (!defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE') && isset($_GET['key'])) require '../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||
@ -45,6 +45,7 @@ if (defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')) {
|
||||
else $place = (GETPOST('place', 'aZ09') ? GETPOST('place', 'aZ09') : 0); // $place is id of table for Ba or Restaurant
|
||||
$action = GETPOST('action', 'alpha');
|
||||
$setterminal = GETPOST('setterminal', 'int');
|
||||
$idproduct = GETPOST('idproduct', 'int');
|
||||
|
||||
if ($setterminal > 0)
|
||||
{
|
||||
@ -53,14 +54,10 @@ if ($setterminal > 0)
|
||||
|
||||
$langs->loadLangs(array("bills", "orders", "commercial", "cashdesk", "receiptprinter"));
|
||||
|
||||
if (defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')) {
|
||||
$_SESSION["takeposterminal"] = 1; // Use Terminal 1 for public customers
|
||||
}
|
||||
elseif (empty($user->rights->takepos->run)) {
|
||||
if (empty($user->rights->takepos->run) && !defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
@ -75,7 +72,42 @@ $head = '<meta name="apple-mobile-web-app-title" content="TakePOS"/>
|
||||
top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss);
|
||||
|
||||
?>
|
||||
<link rel="stylesheet" href="css/phone.css">
|
||||
<link rel="stylesheet" href="../css/phone.css">
|
||||
<?php
|
||||
if ($action=="productinfo"){
|
||||
$prod = new Product($db);
|
||||
$prod->fetch($idproduct);
|
||||
print "<b>".$prod->label."</b><br>";
|
||||
print '<img class="imgwrapper" width="60%" src="../genimg/index.php?query=pro&id='.$idproduct.'">';
|
||||
print "<br>".$prod->description;
|
||||
print "<br><b>".price($prod->price_ttc, 1, $langs, 1, -1, -1, $conf->currency)."</b>";
|
||||
print '<br>';
|
||||
print '<button type="button" class="publicphonebutton2" onclick="AddProductConfirm(place, '.$idproduct.');">'.$langs->trans('Add').'</button>';
|
||||
}
|
||||
elseif ($action=="editline"){
|
||||
$placeid = GETPOST('placeid', 'int');
|
||||
$selectedline = GETPOST('selectedline', 'int');
|
||||
$invoice = new Facture($db);
|
||||
$invoice->fetch($placeid);
|
||||
foreach ($invoice->lines as $line)
|
||||
{
|
||||
if ($line->id == $selectedline)
|
||||
{
|
||||
$prod = new Product($db);
|
||||
$prod->fetch($line->fk_product);
|
||||
print "<b>".$prod->label."</b><br>";
|
||||
print '<img class="imgwrapper" width="60%" src="genimg/index.php?query=pro&id='.$line->fk_product.'">';
|
||||
print "<br>".$prod->description;
|
||||
print "<br><b>".price($prod->price_ttc, 1, $langs, 1, -1, -1, $conf->currency)."</b>";
|
||||
print '<br>';
|
||||
print '<button type="button" class="publicphonebutton2" onclick="SetQty(place, '.$selectedline.', '.($line->qty-1).');">-</button>';
|
||||
print '<button type="button" class="publicphonebutton2" onclick="SetQty(place, '.$selectedline.', '.($line->qty+1).');">+</button>';
|
||||
print '<button type="button" class="publicphonebutton2" onclick="SetNote(place, '.$selectedline.');">'.$langs->trans('Note').'</button>';
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
?>
|
||||
<script language="javascript">
|
||||
<?php
|
||||
$categorie = new Categorie($db);
|
||||
@ -131,33 +163,96 @@ var editnumber="";
|
||||
|
||||
$( document ).ready(function() {
|
||||
console.log("Refresh");
|
||||
$("#phonediv1").load("invoice.php?mobilepage=places", function() {
|
||||
});
|
||||
$("#phonediv2").load("invoice.php?mobilepage=invoice&place="+place, function() {
|
||||
});
|
||||
LoadPlace(place);
|
||||
});
|
||||
|
||||
function LoadPlace(placeid){
|
||||
place=placeid;
|
||||
$("#phonediv2").load("invoice.php?mobilepage=invoice&place="+place, function() {
|
||||
});
|
||||
<?php
|
||||
if (defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')){
|
||||
echo '$("#phonediv2").load("auto_order.php?mobilepage=invoice&place="+place, function() {
|
||||
});';
|
||||
}
|
||||
else{
|
||||
echo '$("#phonediv2").load("invoice.php?mobilepage=invoice&place="+place, function() {
|
||||
});';
|
||||
}
|
||||
?>
|
||||
LoadCats();
|
||||
}
|
||||
|
||||
function AddProduct(placeid, productid){
|
||||
place=placeid;
|
||||
$("#phonediv2").load("invoice.php?mobilepage=invoice&action=addline&place="+place+"&idproduct="+productid, function() {
|
||||
<?php
|
||||
// If is a public terminal first show product information
|
||||
if (defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')){
|
||||
print 'place=placeid;
|
||||
$("#phonediv1").load("auto_order.php?action=productinfo&place="+place+"&idproduct="+productid, function() {
|
||||
});';
|
||||
}
|
||||
else{
|
||||
print 'AddProductConfirm(placeid, productid);';
|
||||
}
|
||||
?>
|
||||
}
|
||||
|
||||
function AddProductConfirm(placeid, productid){
|
||||
place=placeid;
|
||||
<?php
|
||||
if (defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')){
|
||||
echo '$("#phonediv2").load("auto_order.php?mobilepage=invoice&action=addline&place="+place+"&idproduct="+productid, function() {
|
||||
});';
|
||||
}
|
||||
else{
|
||||
echo '$("#phonediv2").load("invoice.php?mobilepage=invoice&action=addline&place="+place+"&idproduct="+productid, function() {
|
||||
});';
|
||||
}
|
||||
?>
|
||||
}
|
||||
|
||||
function SetQty(place, selectedline, qty){
|
||||
if (qty==0){
|
||||
$("#phonediv2").load("auto_order.php?mobilepage=invoice&action=deleteline&place="+place+"&idline="+selectedline, function() {
|
||||
});
|
||||
}
|
||||
else{
|
||||
$("#phonediv2").load("auto_order.php?mobilepage=invoice&action=updateqty&place="+place+"&idline="+selectedline+"&number="+qty, function() {
|
||||
});
|
||||
}
|
||||
LoadCats();
|
||||
}
|
||||
|
||||
function SetNote(place, selectedline){
|
||||
var note = prompt("<?php $langs->trans('Note'); ?>", "Harry Potter");
|
||||
$("#phonediv2").load("auto_order.php?mobilepage=invoice&action=updateqty&place="+place+"&idline="+selectedline+"&number="+qty, function() {
|
||||
});
|
||||
LoadCats();
|
||||
}
|
||||
|
||||
function LoadCats(){
|
||||
$("#phonediv1").load("invoice.php?mobilepage=cats&place="+place, function() {
|
||||
});
|
||||
<?php
|
||||
if (defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')){
|
||||
echo '$("#phonediv1").load("auto_order.php?mobilepage=cats&place="+place, function() {
|
||||
});';
|
||||
}
|
||||
else{
|
||||
echo '$("#phonediv1").load("invoice.php?mobilepage=cats&place="+place, function() {
|
||||
});';
|
||||
}
|
||||
?>
|
||||
}
|
||||
|
||||
function LoadProducts(idcat){
|
||||
$("#phonediv1").load("invoice.php?mobilepage=products&catid="+idcat+"&place="+place, function() {
|
||||
});
|
||||
|
||||
<?php
|
||||
if (defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')){
|
||||
echo '$("#phonediv1").load("auto_order.php?mobilepage=products&catid="+idcat+"&place="+place, function() {
|
||||
});';
|
||||
}
|
||||
else{
|
||||
echo '$("#phonediv1").load("invoice.php?mobilepage=products&catid="+idcat+"&place="+place, function() {
|
||||
});';
|
||||
}
|
||||
?>
|
||||
}
|
||||
|
||||
function LoadPlacesList(){
|
||||
@ -167,8 +262,16 @@ function LoadPlacesList(){
|
||||
|
||||
function TakeposPrintingOrder(){
|
||||
console.log("TakeposPrintingOrder");
|
||||
$("#phonediv2").load("invoice.php?action=order&place="+place, function() {
|
||||
});
|
||||
<?php
|
||||
if (defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')){
|
||||
echo '$("#phonediv2").load("auto_order.php?action=order&place="+place, function() {
|
||||
});';
|
||||
}
|
||||
else{
|
||||
echo '$("#phonediv2").load("invoice.php?action=order&place="+place, function() {
|
||||
});';
|
||||
}
|
||||
?>
|
||||
}
|
||||
|
||||
function Exit(){
|
||||
@ -192,11 +295,17 @@ if ($conf->global->TAKEPOS_NUM_TERMINALS != "1" && $_SESSION["takeposterminal"]
|
||||
<div class="container">
|
||||
<div class="phonebuttonsrow">
|
||||
<?php
|
||||
if (!$_SESSION["publicterminal"]) print '<button type="button" class="phonebutton" onclick="LoadPlacesList();">'.strtoupper(substr($langs->trans('Floors'), 0, 3)).'</button>';
|
||||
print '<button type="button" class="phonebutton" onclick="LoadCats();">'.strtoupper(substr($langs->trans('Categories'), 0, 3)).'</button>';
|
||||
print '<button type="button" class="phonebutton" onclick="TakeposPrintingOrder();">'.strtoupper(substr($langs->trans('Order'), 0, 3)).'</button>';
|
||||
print '<button type="button" class="phonebutton" onclick="Exit();">'.strtoupper(substr($langs->trans('Logout'), 0, 3)).'</button>';
|
||||
if ($_SESSION["publicterminal"]) print '<button type="button" class="phonebutton" onclick="CheckPlease();">'.strtoupper(substr($langs->trans('Payment'), 0, 3)).'</button>';
|
||||
if (!defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')){
|
||||
print '<button type="button" class="phonebutton" onclick="LoadPlacesList();">'.strtoupper(substr($langs->trans('Floors'), 0, 3)).'</button>';
|
||||
print '<button type="button" class="phonebutton" onclick="LoadCats();">'.strtoupper(substr($langs->trans('Categories'), 0, 3)).'</button>';
|
||||
print '<button type="button" class="phonebutton" onclick="TakeposPrintingOrder();">'.strtoupper(substr($langs->trans('Order'), 0, 3)).'</button>';
|
||||
print '<button type="button" class="phonebutton" onclick="Exit();">'.strtoupper(substr($langs->trans('Logout'), 0, 3)).'</button>';
|
||||
}
|
||||
else{
|
||||
print '<button type="button" class="publicphonebutton" onclick="LoadCats();">'.strtoupper(substr($langs->trans('Categories'), 0, 5)).'</button>';
|
||||
print '<button type="button" class="publicphonebutton" onclick="TakeposPrintingOrder();">'.strtoupper(substr($langs->trans('Order'), 0, 5)).'</button>';
|
||||
print '<button type="button" class="publicphonebutton" onclick="CheckPlease();">'.strtoupper(substr($langs->trans('Payment'), 0, 5)).'</button>';
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<div class="row1">
|
||||
@ -208,6 +317,7 @@ if ($conf->global->TAKEPOS_NUM_TERMINALS != "1" && $_SESSION["takeposterminal"]
|
||||
</div>
|
||||
</body>
|
||||
<?php
|
||||
}
|
||||
|
||||
llxFooter();
|
||||
|
||||
|
||||
@ -26,8 +26,11 @@ if (!defined('NOIPCHECK')) define('NOIPCHECK', '1'); // Do not check IP defin
|
||||
|
||||
require '../../main.inc.php';
|
||||
|
||||
if (!$conf->global->TAKEPOS_AUTO_ORDER) accessforbidden(); // If Auto Order is disabled never allow NO LOGIN access
|
||||
|
||||
$_SESSION["basiclayout"] = 1;
|
||||
$_SESSION["publicterminal"] = true; // Is a public customer
|
||||
$_SESSION["takeposterminal"] = 1;
|
||||
|
||||
define('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE', 1);
|
||||
include '../phone.php';
|
||||
if (GETPOSTISSET("mobilepage")) require '../invoice.php';
|
||||
else require '../phone.php';
|
||||
|
||||
Loading…
Reference in New Issue
Block a user