Add mobile barcode scan buttons

master
Skylar Ittner 7 years ago
parent 1864a54d24
commit 9e8cffa394

@ -24,32 +24,32 @@ $editing = false;
if (!is_empty($VARS['id'])) { if (!is_empty($VARS['id'])) {
if ($database->has('items', ['itemid' => $VARS['id']])) { if ($database->has('items', ['itemid' => $VARS['id']])) {
$editing = true; $editing = true;
$itemdata = $database->select( $itemdata = $database->select(
'items', [ 'items', [
'[>]categories' => [ '[>]categories' => [
'catid' => 'catid' 'catid' => 'catid'
], ],
'[>]locations' => [ '[>]locations' => [
'locid' => 'locid' 'locid' => 'locid'
] ]
], [ ], [
'name', 'name',
'code1', 'code1',
'code2', 'code2',
'text1', 'text1',
'text2', 'text2',
'text3', 'text3',
'items.catid', 'items.catid',
'catname', 'catname',
'items.locid', 'items.locid',
'locname', 'locname',
'loccode', 'loccode',
'qty', 'qty',
'userid' 'userid'
], [ ], [
'itemid' => $VARS['id'] 'itemid' => $VARS['id']
])[0]; ])[0];
} else { } else {
// item id is invalid, redirect to a page that won't cause an error when pressing Save // item id is invalid, redirect to a page that won't cause an error when pressing Save
header('Location: app.php?page=edititem'); header('Location: app.php?page=edititem');
@ -101,13 +101,23 @@ if (!is_empty($VARS['id'])) {
<div class="col-xs-12 col-md-6"> <div class="col-xs-12 col-md-6">
<div class="form-group"> <div class="form-group">
<label for="code1"><i class="fa fa-barcode"></i> <?php lang("code 1"); ?></label> <label for="code1"><i class="fa fa-barcode"></i> <?php lang("code 1"); ?></label>
<input type="text" class="form-control" id="code1" name="code1" placeholder="123456789" value="<?php echo htmlspecialchars($itemdata['code1']); ?>" /> <div class="input-group">
<input type="text" class="form-control" id="code1" name="code1" placeholder="123456789" value="<?php echo htmlspecialchars($itemdata['code1']); ?>" />
<span class="input-group-btn mobile-app-show">
<button type="button" class="btn btn-default" onclick="scancode('#code1'); return false;"><i class="fa fa-fw fa-barcode"></i></button>
</span>
</div>
</div> </div>
</div> </div>
<div class="col-xs-12 col-md-6"> <div class="col-xs-12 col-md-6">
<div class="form-group"> <div class="form-group">
<label for="code2"><i class="fa fa-qrcode"></i> <?php lang("code 2"); ?></label> <label for="code2"><i class="fa fa-qrcode"></i> <?php lang("code 2"); ?></label>
<input type="text" class="form-control" id="code2" name="code2" placeholder="qwerty123" value="<?php echo htmlspecialchars($itemdata['code2']); ?>" /> <div class="input-group">
<input type="text" style="width: available;" class="form-control" id="code2" name="code2" placeholder="qwerty123" value="<?php echo htmlspecialchars($itemdata['code2']); ?>" />
<span class="input-group-btn mobile-app-show">
<button type="button" class="btn btn-default" onclick="scancode('#code2'); return false;"><i class="fa fa-fw fa-barcode"></i></button>
</span>
</div>
</div> </div>
</div> </div>
</div> </div>

@ -70,4 +70,12 @@ to replace the rgba()s.
.navbar-header .navbar-brand img { .navbar-header .navbar-brand img {
display: none; display: none;
} }
}
.mobile-app-show {
visibility: hidden;
}
.mobile-app-display {
display: none;
} }

@ -1,4 +1,4 @@
$('#itemtable').DataTable({ var itemtable = $('#itemtable').DataTable({
responsive: { responsive: {
details: { details: {
display: $.fn.dataTable.Responsive.display.modal({ display: $.fn.dataTable.Responsive.display.modal({
@ -53,4 +53,6 @@ $('#itemtable').DataTable({
return JSON.stringify(json); return JSON.stringify(json);
} }
} }
}); });
$('#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>");
Loading…
Cancel
Save