diff --git a/htdocs/takepos/css/pos.css b/htdocs/takepos/css/pos.css index 9993105e288..53593e61035 100644 --- a/htdocs/takepos/css/pos.css +++ b/htdocs/takepos/css/pos.css @@ -240,10 +240,21 @@ table.postablelines tr td { .colorgreen { color: green; } + +.centerinmiddle { + transform: translate(0,-50%); + position: relative; + top: 50%; +} +.trunc { + white-space: nowrap; + text-overflow: ellipsis; + overflow: hidden; +} + p.description_content{ padding:10px; margin:0px; - } @media screen and (min-width: 892px) { @@ -298,4 +309,13 @@ p.description_content{ .invoice{ font-size: 10px; } -} \ No newline at end of file +} + +@media screen and (max-width: 767px){ + div.wrapper { + width: 50%; + } + div.wrapper2 { + width: 25%; + } +} diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index e1e5e675198..89ea0776949 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -313,7 +313,7 @@ $form = new Form($db); diff --git a/htdocs/takepos/takepos.php b/htdocs/takepos/takepos.php index 0375fe09ead..fbfa8a6e975 100644 --- a/htdocs/takepos/takepos.php +++ b/htdocs/takepos/takepos.php @@ -47,8 +47,15 @@ $langs->loadLangs(array("bills","orders","commercial","cashdesk","receiptprinter $categorie = new Categorie($db); -$MAXCATEG = (empty($conf->global->TAKEPOS_NB_MAXCATEG)?16:$conf->global->TAKEPOS_NB_MAXCATEG); -$MAXPRODUCT = (empty($conf->global->TAKEPOS_NB_MAXPRODUCT)?32:$conf->global->TAKEPOS_NB_MAXPRODUCT);; +$maxcategbydefaultforthisdevice=16; +$maxproductbydefaultforthisdevice=32; +if ($conf->browser->layout == 'phone') +{ + $maxcategbydefaultforthisdevice=8; + $maxproductbydefaultforthisdevice=16; +} +$MAXCATEG = (empty($conf->global->TAKEPOS_NB_MAXCATEG)?$maxcategbydefaultforthisdevice:$conf->global->TAKEPOS_NB_MAXCATEG); +$MAXPRODUCT = (empty($conf->global->TAKEPOS_NB_MAXPRODUCT)?$maxproductbydefaultforthisdevice:$conf->global->TAKEPOS_NB_MAXPRODUCT);; /* @@ -118,16 +125,60 @@ var place=""; var editaction="qty"; var editnumber=""; +/* +var app = this; +app.hasKeyboard = false; +this.keyboardPress = function() { + app.hasKeyboard = true; + $(window).unbind("keyup", app.keyboardPress); + localStorage.hasKeyboard = true; + console.log("has keyboard!") +} +$(window).on("keyup", app.keyboardPress) +if(localStorage.hasKeyboard) { + app.hasKeyboard = true; + $(window).unbind("keyup", app.keyboardPress); + console.log("has keyboard from localStorage") +} +*/ + +function ClearSearch() { + console.log("ClearSearch"); + $("#search").val(''); + browser->layer == 'classic') { ?> + setFocusOnSearchField(); + +} + +// Set the focus on search field but only on desktop. On tablet or smartphone, we don't to avoid to have the keyboard open automatically +function setFocusOnSearchField() { + console.log("Call setFocusOnSearchField in page takepos.php"); + browser->layout == 'classic') { + ?> + if (app.hasKeyboard) + { + console.log("has keyboard from localStorage, so we can force focus on search field"); + $("#search").focus(); + } + +} + function PrintCategories(first) { console.log("PrintCategories"); for (i = 0; i < ; i++) { if (typeof (categories[parseInt(i)+parseInt(first)]) == "undefined") { + $("#catdivdesc"+i).hide(); $("#catdesc"+i).text(""); $("#catimg"+i).attr("src","genimg/empty.png"); $("#catwatermark"+i).hide(); continue; } + $("#catdivdesc"+i).show(); $("#catdesc"+i).text(categories[parseInt(i)+parseInt(first)]['label']); $("#catimg"+i).attr("src","genimg/index.php?query=cat&id="+categories[parseInt(i)+parseInt(first)]['rowid']); $("#catdiv"+i).data("rowid",categories[parseInt(i)+parseInt(first)]['rowid']); @@ -135,13 +186,6 @@ function PrintCategories(first) { } } -// Set the focus on search field but only on desktop. On tablet or smartphone, we don't to avoid to have the keyboard open automatically -function setFocusOnSearchField() { - browser->layout == 'classic') { ?> - $("#search").focus(); - -} - function MoreCategories(moreorless) { console.log("MoreCategories moreorless="+moreorless+" pagecategories="+pagecategories); if (moreorless=="more") { @@ -161,18 +205,20 @@ function MoreCategories(moreorless) { } for (i = 0; i < ; i++) { if (typeof (categories[i+( * pagecategories)]) == "undefined") { + $("#catdivdesc"+i).hide(); $("#catdesc"+i).text(""); $("#catimg"+i).attr("src","genimg/empty.png"); $("#catwatermark"+i).hide(); continue; } + $("#catdivdesc"+i).show(); $("#catdesc"+i).text(categories[i+( * pagecategories)]['label']); $("#catimg"+i).attr("src","genimg/index.php?query=cat&id="+categories[i+( * pagecategories)]['rowid']); $("#catdiv"+i).data("rowid",categories[i+( * pagecategories)]['rowid']); $("#catwatermark"+i).show(); } - setFocusOnSearchField(); + ClearSearch(); } function LoadProducts(position, issubcat=false) { @@ -189,6 +235,7 @@ function LoadProducts(position, issubcat=false) { jQuery.each(subcategories, function(i, val) { if (currentcat==val.fk_parent) { + $("#prodivdesc"+ishow).show(); $("#prodesc"+ishow).text(val.label); $("#proimg"+ishow).attr("src","genimg/index.php?query=cat&id="+val.rowid); $("#prodiv"+ishow).data("rowid",val.rowid); @@ -206,6 +253,7 @@ function LoadProducts(position, issubcat=false) { //console.log("ishow"+ishow+" idata="+idata); //console.log(data[idata]); if (typeof (data[idata]) == "undefined") { + $("#prodivdesc"+ishow).hide(); $("#prodesc"+ishow).text(""); $("#proimg"+ishow).attr("src","genimg/empty.png"); $("#prodiv"+ishow).data("rowid",""); @@ -213,6 +261,7 @@ function LoadProducts(position, issubcat=false) { ishow++; //Next product to show after print data product } else if ((data[idata]['status']) == "1") { // Only show products with status=1 (for sell) + $("#prodivdesc"+ishow).show(); $("#prodesc"+ishow).text(data[parseInt(idata)]['label']); $("#proimg"+ishow).attr("src","genimg/index.php?query=pro&id="+data[idata]['id']); $("#prodiv"+ishow).data("rowid",data[idata]['id']); @@ -225,7 +274,7 @@ function LoadProducts(position, issubcat=false) { } }); - setFocusOnSearchField(); + ClearSearch(); } function MoreProducts(moreorless) { @@ -255,6 +304,7 @@ function MoreProducts(moreorless) { while (ishow < maxproduct) { if (typeof (data[idata]) == "undefined") { + $("#prodivdesc"+ishow).hide(); $("#prodesc"+ishow).text(""); $("#proimg"+ishow).attr("src","genimg/empty.png"); $("#prodiv"+ishow).data("rowid",""); @@ -262,6 +312,7 @@ function MoreProducts(moreorless) { } else if ((data[idata]['status']) == "1") { //Only show products with status=1 (for sell) + $("#prodivdesc"+ishow).show(); $("#prodesc"+ishow).text(data[parseInt(idata)]['label']); $("#proimg"+ishow).attr("src","genimg/index.php?query=pro&id="+data[idata]['id']); $("#prodiv"+ishow).data("rowid",data[idata]['id']); @@ -273,7 +324,7 @@ function MoreProducts(moreorless) { } }); - setFocusOnSearchField(); + ClearSearch(); } function ClickProduct(position) { @@ -294,7 +345,7 @@ function ClickProduct(position) { }); } - setFocusOnSearchField(); + ClearSearch(); } function deleteline() { @@ -337,13 +388,6 @@ function Refresh() { }); } -function ClearSearch() { - console.log("ClearSearch"); - $("#search").val(''); - - setFocusOnSearchField(); -} - function Search2() { console.log("Search2"); pageproducts=0; @@ -399,7 +443,7 @@ function Edit(number) { $("#price").html("trans("Price"); ?>"); }); - setFocusOnSearchField(); + ClearSearch(); return; } else { @@ -415,7 +459,7 @@ function Edit(number) { $("#reduction").html("trans("ReductionShort"); ?>"); }); - setFocusOnSearchField(); + ClearSearch(); return; } else { @@ -549,15 +593,15 @@ if (count($maincategories)==0) { // User menu and external TakePOS modules $menus = array(); $r=0; -//$menus[$r++]=array('title'=>''.$langs->trans("SearchProduct"), 'action'=>'Search();'); -$menus[$r++]=array('title'=>''.$langs->trans("Customer"), 'action'=>'Customer();'); -$menus[$r++]=array('title'=>''.$langs->trans("FreeZone"), 'action'=>'FreeZone();'); -$menus[$r++]=array('title'=>''.$langs->trans("Payment"), 'action'=>'CloseBill();'); +//$menus[$r++]=array('title'=>'
';
+ echo '';
+ }
+ else
+ {
+ echo '
';
+ echo '';
+ }
+ else
+ {
+ echo '