Update phone.php for Auto Order
This commit is contained in:
parent
44273e0570
commit
56708e8c35
@ -39,10 +39,10 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
|
|||||||
|
|
||||||
if (defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')) {
|
if (defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')) {
|
||||||
// Decode place if it is an order from customer phone
|
// Decode place if it is an order from customer phone
|
||||||
$key = GETPOST('key');
|
$place = GETPOSTISSET("key") ? dol_decode(GETPOST('key')) : GETPOST('place', 'aZ09');
|
||||||
$place=dol_decode($key);
|
} else {
|
||||||
|
$place = (GETPOST('place', 'aZ09') ? GETPOST('place', 'aZ09') : 0); // $place is id of table for Ba or Restaurant
|
||||||
}
|
}
|
||||||
else $place = (GETPOST('place', 'aZ09') ? GETPOST('place', 'aZ09') : 0); // $place is id of table for Ba or Restaurant
|
|
||||||
$action = GETPOST('action', 'alpha');
|
$action = GETPOST('action', 'alpha');
|
||||||
$setterminal = GETPOST('setterminal', 'int');
|
$setterminal = GETPOST('setterminal', 'int');
|
||||||
$idproduct = GETPOST('idproduct', 'int');
|
$idproduct = GETPOST('idproduct', 'int');
|
||||||
@ -62,28 +62,54 @@ if (empty($user->rights->takepos->run) && !defined('INCLUDE_PHONEPAGE_FROM_PUBLI
|
|||||||
* View
|
* View
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Title
|
if ($action == "productinfo") {
|
||||||
$title = 'TakePOS - Dolibarr '.DOL_VERSION;
|
|
||||||
if (!empty($conf->global->MAIN_APPLICATION_TITLE)) $title = 'TakePOS - '.$conf->global->MAIN_APPLICATION_TITLE;
|
|
||||||
$head = '<meta name="apple-mobile-web-app-title" content="TakePOS"/>
|
|
||||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
|
||||||
<meta name="mobile-web-app-capable" content="yes">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>';
|
|
||||||
top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss);
|
|
||||||
|
|
||||||
print '<link rel="stylesheet" href="'.DOL_URL_ROOT.'/takepos/css/phone.css">';
|
|
||||||
|
|
||||||
if ($action=="productinfo"){
|
|
||||||
$prod = new Product($db);
|
$prod = new Product($db);
|
||||||
$prod->fetch($idproduct);
|
$prod->fetch($idproduct);
|
||||||
print "<b>".$prod->label."</b><br>";
|
print '<button type="button" class="publicphonebutton2 phoneblue total" onclick="AddProductConfirm(place, '.$idproduct.');">'.$langs->trans('Add').'</button>';
|
||||||
print '<img class="imgwrapper" width="60%" src="'.DOL_URL_ROOT.'/takepos/genimg/index.php?query=pro&id='.$idproduct.'">';
|
print "<br><b>".$prod->label."</b><br>";
|
||||||
|
print '<img class="imgwrapper" width="60%" src="'.DOL_URL_ROOT.'/takepos/public/auto_order.php?genimg=pro&query=pro&id='.$idproduct.'">';
|
||||||
print "<br>".$prod->description;
|
print "<br>".$prod->description;
|
||||||
print "<br><b>".price($prod->price_ttc, 1, $langs, 1, -1, -1, $conf->currency)."</b>";
|
print "<br><b>".price($prod->price_ttc, 1, $langs, 1, -1, -1, $conf->currency)."</b>";
|
||||||
print '<br>';
|
print '<br>';
|
||||||
print '<button type="button" class="publicphonebutton2" onclick="AddProductConfirm(place, '.$idproduct.');">'.$langs->trans('Add').'</button>';
|
} elseif ($action == "publicpreorder") {
|
||||||
|
print '<button type="button" class="publicphonebutton2 phoneblue total" onclick="TakeposPrintingOrder();">'.$langs->trans('Confirm').'</button>';
|
||||||
|
print "<br><br>";
|
||||||
|
print '<div class="comment">
|
||||||
|
<textarea class="textinput" placeholder="'.$langs->trans('Note').'"></textarea>
|
||||||
|
</div>';
|
||||||
|
print '<br>';
|
||||||
|
} elseif ($action == "publicpayment") {
|
||||||
|
$langs->loadLangs(array("orders"));
|
||||||
|
print '<h1>'.$langs->trans('StatusOrderDelivered').'</h1>';
|
||||||
|
print '<button type="button" class="publicphonebutton2 phoneblue total" onclick="CheckPlease();">'.$langs->trans('Payment').'</button>';
|
||||||
|
print '<br>';
|
||||||
}
|
}
|
||||||
elseif ($action=="editline"){
|
elseif ($action == "checkplease") {
|
||||||
|
if (GETPOSTISSET("payment")) {
|
||||||
|
print '<h1>'.$langs->trans('StatusOrderDelivered').'</h1>';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/class/dolreceiptprinter.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||||
|
$printer = new dolReceiptPrinter($db);
|
||||||
|
$printer->initPrinter($conf->global->{'TAKEPOS_PRINTER_TO_USE'.$_SESSION["takeposterminal"]});
|
||||||
|
$printer->printer->feed();
|
||||||
|
$printer->printer->feed();
|
||||||
|
$printer->printer->text($langs->trans('IM'));
|
||||||
|
$printer->printer->feed();
|
||||||
|
$printer->printer->text($langs->trans('Place').": ".$place);
|
||||||
|
$printer->printer->feed();
|
||||||
|
$printer->printer->text($langs->trans('Payment').": ".$langs->trans(GETPOST('payment', 'alpha')));
|
||||||
|
$printer->printer->feed();
|
||||||
|
$printer->printer->feed();
|
||||||
|
$printer->printer->feed();
|
||||||
|
$printer->printer->feed();
|
||||||
|
$printer->printer->feed();
|
||||||
|
$printer->close();
|
||||||
|
} else {
|
||||||
|
print '<button type="button" class="publicphonebutton2 phoneblue total" onclick="CheckPlease(\'Cash\');">'.$langs->trans('Cash').'</button>';
|
||||||
|
print '<button type="button" class="publicphonebutton2 phoneblue total" onclick="CheckPlease(\'CreditCard\');">'.$langs->trans('CreditCard').'</button>';
|
||||||
|
print '<br>';
|
||||||
|
}
|
||||||
|
} elseif ($action == "editline") {
|
||||||
$placeid = GETPOST('placeid', 'int');
|
$placeid = GETPOST('placeid', 'int');
|
||||||
$selectedline = GETPOST('selectedline', 'int');
|
$selectedline = GETPOST('selectedline', 'int');
|
||||||
$invoice = new Facture($db);
|
$invoice = new Facture($db);
|
||||||
@ -95,17 +121,25 @@ elseif ($action=="editline"){
|
|||||||
$prod = new Product($db);
|
$prod = new Product($db);
|
||||||
$prod->fetch($line->fk_product);
|
$prod->fetch($line->fk_product);
|
||||||
print "<b>".$prod->label."</b><br>";
|
print "<b>".$prod->label."</b><br>";
|
||||||
print '<img class="imgwrapper" width="60%" src="genimg/index.php?query=pro&id='.$line->fk_product.'">';
|
print '<img class="imgwrapper" width="60%" src="'.DOL_URL_ROOT.'/takepos/public/auto_order.php?genimg=pro&query=pro&id='.$line->fk_product.'">';
|
||||||
print "<br>".$prod->description;
|
print "<br>".$prod->description;
|
||||||
print "<br><b>".price($prod->price_ttc, 1, $langs, 1, -1, -1, $conf->currency)."</b>";
|
print "<br><b>".price($prod->price_ttc, 1, $langs, 1, -1, -1, $conf->currency)."</b>";
|
||||||
print '<br>';
|
print '<br>';
|
||||||
print '<button type="button" class="publicphonebutton2" onclick="SetQty(place, '.$selectedline.', '.($line->qty-1).');">-</button>';
|
print '<button type="button" class="publicphonebutton2 phonered width24" 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 phonegreen width24" onclick="SetQty(place, '.$selectedline.', '.($line->qty + 1).');">+</button>';
|
||||||
print '<button type="button" class="publicphonebutton2" onclick="SetNote(place, '.$selectedline.');">'.$langs->trans('Note').'</button>';
|
print '<button type="button" class="publicphonebutton2 phoneblue width24" onclick="SetNote(place, '.$selectedline.');">'.$langs->trans('Note').'</button>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else {
|
else {
|
||||||
|
// Title
|
||||||
|
$title = 'TakePOS - Dolibarr '.DOL_VERSION;
|
||||||
|
if (!empty($conf->global->MAIN_APPLICATION_TITLE)) $title = 'TakePOS - '.$conf->global->MAIN_APPLICATION_TITLE;
|
||||||
|
$head = '<meta name="apple-mobile-web-app-title" content="TakePOS"/>
|
||||||
|
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||||
|
<meta name="mobile-web-app-capable" content="yes">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>';
|
||||||
|
$arrayofcss = array('/takepos/css/phone.css');
|
||||||
|
top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss);
|
||||||
?>
|
?>
|
||||||
<script language="javascript">
|
<script language="javascript">
|
||||||
<?php
|
<?php
|
||||||
@ -194,6 +228,11 @@ function AddProduct(placeid, productid){
|
|||||||
?>
|
?>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function PublicPreOrder(){
|
||||||
|
$("#phonediv1").load("auto_order.php?action=publicpreorder&place="+place, function() {
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function AddProductConfirm(placeid, productid){
|
function AddProductConfirm(placeid, productid){
|
||||||
place=placeid;
|
place=placeid;
|
||||||
<?php
|
<?php
|
||||||
@ -209,6 +248,9 @@ function AddProductConfirm(placeid, productid){
|
|||||||
}
|
}
|
||||||
|
|
||||||
function SetQty(place, selectedline, qty){
|
function SetQty(place, selectedline, qty){
|
||||||
|
<?php
|
||||||
|
if (defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')) {
|
||||||
|
?>
|
||||||
if (qty==0){
|
if (qty==0){
|
||||||
$("#phonediv2").load("auto_order.php?mobilepage=invoice&action=deleteline&place="+place+"&idline="+selectedline, function() {
|
$("#phonediv2").load("auto_order.php?mobilepage=invoice&action=deleteline&place="+place+"&idline="+selectedline, function() {
|
||||||
});
|
});
|
||||||
@ -217,11 +259,26 @@ function SetQty(place, selectedline, qty){
|
|||||||
$("#phonediv2").load("auto_order.php?mobilepage=invoice&action=updateqty&place="+place+"&idline="+selectedline+"&number="+qty, function() {
|
$("#phonediv2").load("auto_order.php?mobilepage=invoice&action=updateqty&place="+place+"&idline="+selectedline+"&number="+qty, function() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
?>
|
||||||
|
if (qty==0){
|
||||||
|
$("#phonediv2").load("invoice.php?mobilepage=invoice&action=deleteline&place="+place+"&idline="+selectedline, function() {
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$("#phonediv2").load("invoice.php?mobilepage=invoice&action=updateqty&place="+place+"&idline="+selectedline+"&number="+qty, function() {
|
||||||
|
});
|
||||||
|
}
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
LoadCats();
|
LoadCats();
|
||||||
}
|
}
|
||||||
|
|
||||||
function SetNote(place, selectedline){
|
function SetNote(place, selectedline){
|
||||||
var note = prompt("<?php $langs->trans('Note'); ?>", "Harry Potter");
|
var note = prompt("<?php $langs->trans('Note'); ?>", "");
|
||||||
$("#phonediv2").load("auto_order.php?mobilepage=invoice&action=updateqty&place="+place+"&idline="+selectedline+"&number="+qty, function() {
|
$("#phonediv2").load("auto_order.php?mobilepage=invoice&action=updateqty&place="+place+"&idline="+selectedline+"&number="+qty, function() {
|
||||||
});
|
});
|
||||||
LoadCats();
|
LoadCats();
|
||||||
@ -262,11 +319,13 @@ function LoadPlacesList(){
|
|||||||
function TakeposPrintingOrder(){
|
function TakeposPrintingOrder(){
|
||||||
console.log("TakeposPrintingOrder");
|
console.log("TakeposPrintingOrder");
|
||||||
<?php
|
<?php
|
||||||
if (defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')){
|
if (defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')) {
|
||||||
echo '$("#phonediv2").load("auto_order.php?action=order&place="+place, function() {
|
echo '$("#phonediv2").load("auto_order.php?action=order&mobilepage=order&place="+place, function() {
|
||||||
|
});';
|
||||||
|
echo '$("#phonediv1").load("auto_order.php?action=publicpayment&place="+place, function() {
|
||||||
});';
|
});';
|
||||||
}
|
}
|
||||||
else{
|
else {
|
||||||
echo '$("#phonediv2").load("invoice.php?action=order&place="+place, function() {
|
echo '$("#phonediv2").load("invoice.php?action=order&place="+place, function() {
|
||||||
});';
|
});';
|
||||||
}
|
}
|
||||||
@ -277,17 +336,21 @@ function Exit(){
|
|||||||
window.location.href='../user/logout.php';
|
window.location.href='../user/logout.php';
|
||||||
}
|
}
|
||||||
|
|
||||||
function CheckPlease(){
|
function CheckPlease(payment){
|
||||||
console.log("Request the check to the waiter");
|
if (payment==undefined){
|
||||||
$.ajax({
|
$("#phonediv1").load("auto_order.php?action=checkplease&place="+place, function() {
|
||||||
type: "GET",
|
});
|
||||||
url: "<?php print dol_buildpath('/takepos/ajax/ajax.php', 1).'?action=thecheck&=place='.$place; ?>",
|
}
|
||||||
});
|
else{
|
||||||
|
console.log("Request the check to the waiter");
|
||||||
|
$("#phonediv1").load("auto_order.php?action=checkplease&place=<?php echo $place;?>&payment="+payment, function() {
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<body style="overflow: hidden; background-color:#D1D1D1;">
|
<body style="background-color:#D1D1D1;">
|
||||||
<?php
|
<?php
|
||||||
if ($conf->global->TAKEPOS_NUM_TERMINALS != "1" && $_SESSION["takeposterminal"] == "") print '<div class="dialog-info-takepos-terminal" id="dialog-info" title="TakePOS">'.$langs->trans('TerminalSelect').'</div>';
|
if ($conf->global->TAKEPOS_NUM_TERMINALS != "1" && $_SESSION["takeposterminal"] == "") print '<div class="dialog-info-takepos-terminal" id="dialog-info" title="TakePOS">'.$langs->trans('TerminalSelect').'</div>';
|
||||||
?>
|
?>
|
||||||
@ -300,19 +363,19 @@ function CheckPlease(){
|
|||||||
print '<button type="button" class="phonebutton" onclick="TakeposPrintingOrder();">'.strtoupper(substr($langs->trans('Order'), 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>';
|
print '<button type="button" class="phonebutton" onclick="Exit();">'.strtoupper(substr($langs->trans('Logout'), 0, 3)).'</button>';
|
||||||
}
|
}
|
||||||
else{
|
else {
|
||||||
print '<button type="button" class="publicphonebutton" onclick="LoadCats();">'.strtoupper(substr($langs->trans('Categories'), 0, 5)).'</button>';
|
print '<button type="button" class="publicphonebutton phoneblue" 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 phoneorange" onclick="PublicPreOrder();">'.strtoupper(substr($langs->trans('Order'), 0, 5)).'</button>';
|
||||||
print '<button type="button" class="publicphonebutton" onclick="CheckPlease();">'.strtoupper(substr($langs->trans('Payment'), 0, 5)).'</button>';
|
print '<button type="button" class="publicphonebutton phonegreen" onclick="CheckPlease();">'.strtoupper(substr($langs->trans('Payment'), 0, 5)).'</button>';
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
<div class="row1">
|
<div class="phonerow2">
|
||||||
<div id="phonediv1" class="phonediv1"></div>
|
|
||||||
</div>
|
|
||||||
<div class="row2">
|
|
||||||
<div id="phonediv2" class="phonediv2"></div>
|
<div id="phonediv2" class="phonediv2"></div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="phonerow1">
|
||||||
|
<div id="phonediv1" class="phonediv1"></div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
<?php
|
<?php
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user