Automatically show picker grid conditionally based on number of items
This commit is contained in:
parent
34127ef5e4
commit
9ec33b06fe
@ -13,7 +13,7 @@ if (isset($_GET['switch']) || !isset($_SESSION['register']) || !$database->has('
|
|||||||
require_once __DIR__ . "/../lib/chooseregister.php";
|
require_once __DIR__ . "/../lib/chooseregister.php";
|
||||||
} else {
|
} else {
|
||||||
$register = $database->get('registers', ['registerid (id)', 'registername (name)'], ['registerid' => $_SESSION['register']]);
|
$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;
|
||||||
?>
|
?>
|
||||||
<div class="modal fade" tabindex="-1" role="dialog" id="receiptmodal">
|
<div class="modal fade" tabindex="-1" role="dialog" id="receiptmodal">
|
||||||
<div class="modal-dialog" role="document">
|
<div class="modal-dialog" role="document">
|
||||||
@ -156,6 +156,9 @@ if (isset($_GET['switch']) || !isset($_SESSION['register']) || !$database->has('
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<script nonce="<?php echo $SECURE_NONCE; ?>">
|
||||||
|
var showgridbydefault = <?php echo $showgridbydefault === true ? "true" : "false" ?>;
|
||||||
|
</script>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
?>
|
?>
|
@ -29,6 +29,9 @@ define("BINSTACK_DB_CHARSET", "utf8");
|
|||||||
// Name of the app.
|
// Name of the app.
|
||||||
define("SITE_TITLE", "NickelBox");
|
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
|
// URL of the AccountHub API endpoint
|
||||||
define("PORTAL_API", "http://localhost/accounthub/api.php");
|
define("PORTAL_API", "http://localhost/accounthub/api.php");
|
||||||
|
@ -50,4 +50,10 @@ $("#gridviewbtn").click(function () {
|
|||||||
$("#gridview").removeClass("d-none");
|
$("#gridview").removeClass("d-none");
|
||||||
loadGridView();
|
loadGridView();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (showgridbydefault) {
|
||||||
|
$("#gridview").addClass("d-flex");
|
||||||
|
$("#gridview").removeClass("d-none");
|
||||||
|
loadGridView();
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user