diff --git a/pages/pos.php b/pages/pos.php
index ff71667..c769034 100644
--- a/pages/pos.php
+++ b/pages/pos.php
@@ -13,7 +13,7 @@ if (isset($_GET['switch']) || !isset($_SESSION['register']) || !$database->has('
require_once __DIR__ . "/../lib/chooseregister.php";
} else {
$register = $database->get('registers', ['registerid (id)', 'registername (name)'], ['registerid' => $_SESSION['register']]);
- $griditems = $binstack->select('items', ['itemid (id)', 'name', 'price', 'code1', 'code2'], ['AND' => ['price[!]' => null, 'price[!]' => 0]]);
+ $showgridbydefault = $binstack->count('items', ['AND' => ['price[!]' => null, 'price[!]' => 0]]) <= GRID_BY_DEFAULT_MAX_ITEMS;
?>
@@ -156,6 +156,9 @@ if (isset($_GET['switch']) || !isset($_SESSION['register']) || !$database->has('
+
\ No newline at end of file
diff --git a/settings.template.php b/settings.template.php
index 3868736..d17f4e0 100644
--- a/settings.template.php
+++ b/settings.template.php
@@ -29,6 +29,9 @@ define("BINSTACK_DB_CHARSET", "utf8");
// Name of the app.
define("SITE_TITLE", "NickelBox");
+// If there are this many or fewer items,
+// load the POS grid view automatically
+define("GRID_BY_DEFAULT_MAX_ITEMS", 20);
// URL of the AccountHub API endpoint
define("PORTAL_API", "http://localhost/accounthub/api.php");
diff --git a/static/js/pos_gridview.js b/static/js/pos_gridview.js
index ddab68c..c14d557 100644
--- a/static/js/pos_gridview.js
+++ b/static/js/pos_gridview.js
@@ -50,4 +50,10 @@ $("#gridviewbtn").click(function () {
$("#gridview").removeClass("d-none");
loadGridView();
}
-});
\ No newline at end of file
+});
+
+if (showgridbydefault) {
+ $("#gridview").addClass("d-flex");
+ $("#gridview").removeClass("d-none");
+ loadGridView();
+}
\ No newline at end of file