Add error when barcode not found
This commit is contained in:
parent
62075f9cb1
commit
9c9511b95e
1 changed files with 8 additions and 3 deletions
|
@ -50,11 +50,16 @@ ready = function() {
|
||||||
$("#from_barcode_form").submit(function(event) {
|
$("#from_barcode_form").submit(function(event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
barcode = $(this).find("input[type=number]").val();
|
barcode = $(this).find("input[type=number]").val();
|
||||||
|
$("#from_barcode_form")[0].reset();
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: "/tap/barcodes/" + barcode,
|
url: "/barcodes/" + barcode,
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
increment_product(data["id"]);
|
if (data != null) {
|
||||||
$("#from_barcode_form")[0].reset();
|
increment_product(data["id"]);
|
||||||
|
$("#from_barcode_form")[0].reset();
|
||||||
|
} else {
|
||||||
|
alert("Barcode '" + barcode + "' was not found in the database system.");
|
||||||
|
}
|
||||||
},
|
},
|
||||||
dataMethod: "json"
|
dataMethod: "json"
|
||||||
}).fail(function() {
|
}).fail(function() {
|
||||||
|
|
Loading…
Reference in a new issue