From 8f03813aa9eda51aa29f1ef88f51e0a761808531 Mon Sep 17 00:00:00 2001 From: andreubisquerra Date: Wed, 16 Oct 2019 16:26:00 +0200 Subject: [PATCH] Phone layout and functional improvements --- htdocs/takepos/css/phone.css | 81 +++++++++++++++ htdocs/takepos/invoice.php | 48 ++++----- htdocs/takepos/phone.php | 190 +++++++++++++++++++++++++++++++++++ htdocs/takepos/takepos.php | 2 +- 4 files changed, 291 insertions(+), 30 deletions(-) create mode 100644 htdocs/takepos/css/phone.css create mode 100644 htdocs/takepos/phone.php diff --git a/htdocs/takepos/css/phone.css b/htdocs/takepos/css/phone.css new file mode 100644 index 00000000000..49d833ade17 --- /dev/null +++ b/htdocs/takepos/css/phone.css @@ -0,0 +1,81 @@ +html,body { + box-sizing: border-box; + padding:3px; + margin:0; + height:100%; + width:100%; +} + +.container{ + width: 100%; + height: 100%; + margin: 0 auto; + overflow: visible; + box-sizing: border-box; +} + +.phonerow1{ + margin: 0 auto; + width: 100%; + height: 40%; + min-height: 40%; +} + +.phonerow2{ + margin: 0 auto; + width: 100%; + height: 40%; +} + +.phonebuttonsrow{ + margin: 0 auto; + width: 100%; + height: 5%; +} + +.phonediv1{ + height:100%; + min-height: 100%; + width: 100%; + text-align: center; + box-sizing: border-box; + overflow: auto; + padding-top: 0; + padding-bottom: 10px; + padding-right: 5px; + padding-left: 5px; +} + +.phonediv2{ + height: 100%; + width: 100%; + box-sizing: border-box; + padding-top: 0; + padding-bottom: 10px; + padding-right: 5px; + padding-left: 5px; +} + +.phonediv3{ + height: 100%; + width: 100%; + box-sizing: border-box; + padding-top: 0; + padding-bottom: 10px; + padding-right: 5px; + padding-left: 5px; +} + +button.phonebutton { + 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:24%; + height:90%; + font-weight: bold; +} diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index 1511d3520a1..a2c92aa13e4 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -570,13 +570,19 @@ if ($conf->global->TAKEPOS_BAR_RESTAURANT) $label = $obj->label; $floor = $obj->floor; } - print $langs->trans('Place')." ".$label." - "; - print $langs->trans('Floor')." ".$floor." - "; + // In phone version only show when is invoice page + if ($mobilepage=="invoice" || $mobilepage=="") { + print $langs->trans('Place') . " " . $label . " - "; + print $langs->trans('Floor') . " " . $floor . " - "; + } +} +// In phone version only show when is invoice page +if ($mobilepage=="invoice" || $mobilepage=="") { + print $langs->trans('TotalTTC'); + print ' : ' . price($invoice->total_ttc, 1, '', 1, -1, -1, $conf->currency) . ''; + print '
' . $sectionwithinvoicelink; + print ''; } -print $langs->trans('TotalTTC'); -print ' : '.price($invoice->total_ttc, 1, '', 1, - 1, - 1, $conf->currency).''; -print '
'.$sectionwithinvoicelink; -print ''; if ($_SESSION["basiclayout"]!=1) { print '' . $langs->trans('ReductionShort') . ''; @@ -595,16 +601,14 @@ if ($_SESSION["basiclayout"]==1) $htmlforlines = ''; foreach ($categories as $row){ $htmlforlines.= ''; + $htmlforlines.= '" onclick="LoadProducts(' . $row['id'] . ');">'; $htmlforlines.= ''; $htmlforlines.= $row['label']; $htmlforlines.= ''; $htmlforlines.= ''."\n"; } $htmlforlines.= ''; - $htmlforlines.= '
'; - $htmlforlines.= ''.$langs->trans("Floors").''; - $htmlforlines.= '
'; + $htmlforlines.= ''; print $htmlforlines; } @@ -618,17 +622,13 @@ if ($_SESSION["basiclayout"]==1) $htmlforlines = ''; foreach ($prods as $row) { $htmlforlines.= ''; + $htmlforlines.= '" onclick="AddProduct(\'' . $place . '\', ' . $row->id . ')">'; $htmlforlines.= ''; $htmlforlines.= $row->label; $htmlforlines.= ''; $htmlforlines.= ''."\n"; } $htmlforlines.= ''; - $htmlforlines.= '
'; - $htmlforlines.= ''.$langs->trans("Categories").''; - $htmlforlines.= ''.$langs->trans("Floors").''; - $htmlforlines.= '
'; print $htmlforlines; } @@ -641,24 +641,22 @@ if ($_SESSION["basiclayout"]==1) while($row = $db->fetch_array($resql)){ $rows[] = $row; $htmlforlines.= ''; + $htmlforlines.= '" onclick="LoadPlace(\'' . $row['label'] . '\')">'; $htmlforlines.= ''; $htmlforlines.= $row['label']; $htmlforlines.= ''; $htmlforlines.= ''."\n"; } $htmlforlines.= ''; - $htmlforlines.= '
'; - $htmlforlines.= ''.$langs->trans("Categories").''; - $htmlforlines.= ''.$langs->trans("Floors").''; - $htmlforlines.= '
'; print $htmlforlines; } } if ($placeid > 0) { - if ($_SESSION["basiclayout"]==1 && $mobilepage!="invoice") return; + //In Phone basic layout hide some content depends situation + if ($_SESSION["basiclayout"]==1 && $mobilepage!="invoice" && $action!="order") return; + if (is_array($invoice->lines) && count($invoice->lines)) { $tmplines = array_reverse($invoice->lines); @@ -716,14 +714,6 @@ else { // No invoice generated yet print ''; -if ($_SESSION["basiclayout"]==1 && $mobilepage=="invoice") -{ - print '
'; - print ''.$langs->trans("Categories").''; - print ''.$langs->trans("Floors").''; - print '
'; -} - if ($invoice->socid != $conf->global->{'CASHDESK_ID_THIRDPARTY'.$_SESSION["takeposterminal"]}) { $soc = new Societe($db); diff --git a/htdocs/takepos/phone.php b/htdocs/takepos/phone.php new file mode 100644 index 00000000000..2bd21626f34 --- /dev/null +++ b/htdocs/takepos/phone.php @@ -0,0 +1,190 @@ + + * + * 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/phone.php + * \ingroup takepos + * \brief TakePOS Phone screen + */ + +//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Not disabled cause need to load personalized language +//if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); // Not disabled cause need to load personalized language +//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1'); +//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); +if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK', '1'); +if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); +if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); +if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1'); +if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); + +require '../main.inc.php'; // Load $user and permissions +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'; +require_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; + +$place = (GETPOST('place', 'int') > 0 ? GETPOST('place', 'int') : 0); // $place is id of table for Ba or Restaurant +$action = GETPOST('action', 'alpha'); +$setterminal = GETPOST('setterminal', 'int'); + +if ($setterminal>0) +{ + $_SESSION["takeposterminal"]=$setterminal; +} + +$langs->loadLangs(array("bills","orders","commercial","cashdesk","receiptprinter")); + +/* + * View + */ + +// Title +$title='TakePOS - Dolibarr '.DOL_VERSION; +if (! empty($conf->global->MAIN_APPLICATION_TITLE)) $title='TakePOS - '.$conf->global->MAIN_APPLICATION_TITLE; +$head=' + + +'; +top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss); + +?> + + + + +global->TAKEPOS_NUM_TERMINALS!="1" && $_SESSION["takeposterminal"]=="") print '
'.$langs->trans('TerminalSelect').'
'; +?> +
+
+ + + + +
+
+
+
+
+
+
+
+ +close(); diff --git a/htdocs/takepos/takepos.php b/htdocs/takepos/takepos.php index c49479c7ce1..7ff588b12c0 100644 --- a/htdocs/takepos/takepos.php +++ b/htdocs/takepos/takepos.php @@ -63,7 +63,7 @@ if ($conf->browser->layout == 'phone') if ($_SESSION["takeposterminal"]!="" && $conf->global->TAKEPOS_PHONE_BASIC_LAYOUT==1) { $_SESSION["basiclayout"]=1; - header("Location: invoice.php?mobilepage=invoice"); + header("Location: phone.php?mobilepage=invoice"); exit; } }