Add "quick lookup" for mobile Products page
only if enabled, otherwise just shows the normal grid
This commit is contained in:
parent
21740ea2fd
commit
950af8b5e0
7 changed files with 68 additions and 18 deletions
|
@ -42,7 +42,7 @@ $(document).on('autocompleteitemselected', function(event, uuid) {
|
|||
var field = $(event.target);
|
||||
if (field.hasClass('quick-row')) {
|
||||
var form = field.parents('form:first');
|
||||
form.find('[name="quick_row_entry"]').val(uuid);
|
||||
form.find('[name="quick_entry"]').val(uuid);
|
||||
form.submit();
|
||||
}
|
||||
});
|
||||
|
@ -151,16 +151,16 @@ $(document).on('keypress', function(event) {
|
|||
});
|
||||
|
||||
|
||||
// handle various keypress events for quick row forms
|
||||
// handle various keypress events for quick entry forms
|
||||
$(document).on('keypress', function(event) {
|
||||
var quick_row = $('.ui-page-active #quick_row_entry');
|
||||
if (quick_row.length) {
|
||||
var quick_entry = $('.ui-page-active #quick_entry');
|
||||
if (quick_entry.length) {
|
||||
|
||||
// if user hits enter with quick row input focused, submit form
|
||||
if (quick_row.is(':focus')) {
|
||||
if (quick_entry.is(':focus')) {
|
||||
if (event.which == 13) { // ENTER
|
||||
if (quick_row.val()) {
|
||||
var form = quick_row.parents('form:first');
|
||||
if (quick_entry.val()) {
|
||||
var form = quick_entry.parents('form:first');
|
||||
form.submit();
|
||||
return false;
|
||||
}
|
||||
|
@ -169,11 +169,11 @@ $(document).on('keypress', function(event) {
|
|||
} else { // quick row input not focused
|
||||
|
||||
// mimic keyboard wedge if we're so instructed
|
||||
if (quick_row.data('wedge')) {
|
||||
if (quick_entry.data('wedge')) {
|
||||
|
||||
if (event.which >= 48 && event.which <= 57) { // numeric (qwerty)
|
||||
if (!event.altKey && !event.ctrlKey && !event.metaKey) {
|
||||
quick_row.val(quick_row.val() + event.key);
|
||||
quick_entry.val(quick_entry.val() + event.key);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -183,8 +183,8 @@ $(document).on('keypress', function(event) {
|
|||
|
||||
} else if (event.which == 13) { // ENTER
|
||||
// submit form when ENTER is received via keyboard "wedge"
|
||||
if (quick_row.val()) {
|
||||
var form = quick_row.parents('form:first');
|
||||
if (quick_entry.val()) {
|
||||
var form = quick_entry.parents('form:first');
|
||||
form.submit();
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue