Skip to content
Snippets Groups Projects
Commit 5b6ad905 authored by Benjamin Bertrand's avatar Benjamin Bertrand
Browse files

Auto set the focus to ICS id and serial number

Allow to use a scanner configured as keyboard to register items
via the web UI.
1. The attributes should be selected manually
2. Focus set manually on ICS id
3. Scan an ICS id -> prefix removed and focus set to serial number
4. Scan serial number
5. Click on submit
6. Focus set automatically on ICS id
7. Repeat from 3
parent e8406638
No related branches found
No related tags found
No related merge requests found
$(document).ready(function() {
// Focus to ICS id when loading the page
$("#ics_id").focus();
// remove 'CSE:ics_id:' prefix from ICS id
// allow to scan a label
$("#ics_id").keyup(function(event) {
var value = $(this).val();
if( value.length == 17 ) {
$(this).val(value.replace('CSE:ics_id:', ''));
// Change the focus to the serial number
$("#serial_number").focus();
}
});
$("#clear").click(function() {
// clear all select fields
$("select").val('');
});
});
...@@ -32,20 +32,6 @@ $(document).ready(function() { ...@@ -32,20 +32,6 @@ $(document).ready(function() {
$(this).html(converter.makeHtml(raw)); $(this).html(converter.makeHtml(raw));
}); });
// remove 'CSE:ics_id:' prefix from ICS id
// allow to scan a label
$("#ics_id").keyup(function(event) {
var value = $(this).val();
if( value.length == 17 ) {
$(this).val(value.replace('CSE:ics_id:', ''));
}
});
$("#clear").click(function() {
// clear all select fields
$("select").val('');
});
var items_table = $("#items_table").DataTable({ var items_table = $("#items_table").DataTable({
"ajax": { "ajax": {
"url": $SCRIPT_ROOT + "/inventory/_retrieve_items" "url": $SCRIPT_ROOT + "/inventory/_retrieve_items"
......
...@@ -23,3 +23,7 @@ ...@@ -23,3 +23,7 @@
</div> </div>
</form> </form>
{%- endblock %} {%- endblock %}
{% block csentry_scripts %}
<script src="{{ url_for('static', filename='js/create_item.js') }}"></script>
{% endblock %}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment