forked from Business/BinStack
Add item search box on dashboard (close #6)
This commit is contained in:
parent
ae4511cad7
commit
40def2bf70
@ -89,5 +89,6 @@ define("STRINGS", [
|
||||
"show all items" => "Show all items",
|
||||
"missing name" => "You need to enter a name.",
|
||||
"use the dropdowns" => "Whoops, you need to use the category and location autocomplete boxes.",
|
||||
"make categories and locations" => "Please create at least one category and location before adding an item."
|
||||
"make categories and locations" => "Please create at least one category and location before adding an item.",
|
||||
"search" => "Search"
|
||||
]);
|
@ -4,7 +4,30 @@ require_once __DIR__ . '/../required.php';
|
||||
redirectifnotloggedin();
|
||||
?>
|
||||
<div class="row">
|
||||
<div class="col-xs-12 col-sm-6 col-md-4">
|
||||
<div class="col-xs-12 col-sm-6 col-sm-offset-3 col-lg-4 col-lg-offset-4">
|
||||
<form action="app.php" method="get">
|
||||
<input type="hidden" name="page" value="items" />
|
||||
<div class="input-group">
|
||||
<input type="text" class="form-control" name="q" id="quicklookup_box" placeholder="<?php lang("search"); ?>"/>
|
||||
<div class="input-group-btn">
|
||||
<?php
|
||||
if ($_SESSION['mobile']) {
|
||||
?>
|
||||
<span class="btn btn-default" onclick="scancode('#quicklookup_box');">
|
||||
<i class="fa fa-barcode fa-fw"></i>
|
||||
</span>
|
||||
<?php } ?>
|
||||
<button type="submit" class="btn btn-primary">
|
||||
<i class="fa fa-search fa-fw"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<br />
|
||||
<div class="row">
|
||||
<div class="col-xs-12 col-sm-6 col-md-4 col-md-offset-2">
|
||||
<div class="panel panel-blue-grey">
|
||||
<div class="panel-heading"><div class="panel-title"><?php lang("total items") ?></div></div>
|
||||
<div class="panel-body">
|
||||
|
@ -11,7 +11,8 @@ redirectifnotloggedin();
|
||||
<?php if ($_GET['filter'] == 'stock') { ?>
|
||||
<script nonce="<?php echo $SECURE_NONCE; ?>">var filter = "stock";</script>
|
||||
<div class="alert alert-blue-grey"><i class="fa fa-filter fa-fw"></i> <?php lang("only showing understocked"); ?> <a href="app.php?page=items" class="btn btn-sm btn-blue-grey"><?php lang("show all items"); ?></a></div>
|
||||
<?php } else {
|
||||
<?php
|
||||
} else {
|
||||
echo "<script nonce=\"$SECURE_NONCE\">var filter = null;</script>\n";
|
||||
}
|
||||
?>
|
||||
@ -31,50 +32,6 @@ redirectifnotloggedin();
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php /*
|
||||
$items = $database->select('items', [
|
||||
'[>]categories' => ['catid' => 'catid'],
|
||||
'[>]locations' => ['locid' => 'locid']
|
||||
], [
|
||||
'itemid',
|
||||
'name',
|
||||
'catname',
|
||||
'locname',
|
||||
'loccode',
|
||||
'code1',
|
||||
'code2',
|
||||
'qty',
|
||||
'want',
|
||||
'userid'
|
||||
], ["LIMIT" => 100]);
|
||||
$usercache = [];
|
||||
foreach ($items as $item) {
|
||||
if (is_null($item['userid'])) {
|
||||
$user = "";
|
||||
} else {
|
||||
if (!isset($usercache[$item['userid']])) {
|
||||
$usercache[$item['userid']] = getUserByID($item['userid']);
|
||||
}
|
||||
$user = $usercache[$item['userid']]['name'];
|
||||
}
|
||||
?>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>
|
||||
<a class="btn btn-blue btn-xs" href="app.php?page=edititem&id=<?php echo $item['itemid']; ?>"><i class="fa fa-pencil-square-o"></i> <?php lang("edit"); ?></a>
|
||||
</td>
|
||||
<td><?php echo $item['name']; ?></td>
|
||||
<td><?php echo $item['catname']; ?></td>
|
||||
<td><?php echo $item['locname'] . " (" . $item['loccode'] . ")"; ?></td>
|
||||
<td><?php echo $item['code1']; ?></td>
|
||||
<td><?php echo $item['code2']; ?></td>
|
||||
<td><?php echo $item['qty']; ?></td>
|
||||
<td><?php echo $item['want']; ?></td>
|
||||
<td><?php echo $user; ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
} */
|
||||
?>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
@ -91,3 +48,16 @@ redirectifnotloggedin();
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
<?php
|
||||
if (!is_empty($VARS['q'])) {
|
||||
?>
|
||||
<script nonce="<?php echo $SECURE_NONCE; ?>">
|
||||
var search_preload_content = "<?php echo $VARS['q']; ?>";
|
||||
</script>
|
||||
<?php
|
||||
} else {
|
||||
?>
|
||||
<script nonce="<?php echo $SECURE_NONCE; ?>">
|
||||
var search_preload_content = false;
|
||||
</script>
|
||||
<?php } ?>
|
||||
|
@ -62,3 +62,12 @@ var itemtable = $('#itemtable').DataTable({
|
||||
});
|
||||
|
||||
$('#itemtable_filter').append("<span class=\"btn btn-default btn-sm mobile-app-show mobile-app-display\" onclick=\"scancode('#itemtable_filter label input');\"><i class=\"fa fa-barcode fa-fw\"></i></span>");
|
||||
|
||||
$(document).ready(function () {
|
||||
if (search_preload_content !== false) {
|
||||
var searchInput = $("#itemtable_filter label input");
|
||||
$(searchInput).val(search_preload_content);
|
||||
$(searchInput).trigger("input");
|
||||
$(searchInput).trigger("change");
|
||||
}
|
||||
});
|
Loading…
x
Reference in New Issue
Block a user