Add error when barcode not found

This commit is contained in:
benji 2015-10-27 16:52:06 +01:00
parent 62075f9cb1
commit 9c9511b95e

View file

@ -50,11 +50,16 @@ ready = function() {
$("#from_barcode_form").submit(function(event) {
event.preventDefault();
barcode = $(this).find("input[type=number]").val();
$("#from_barcode_form")[0].reset();
$.ajax({
url: "/tap/barcodes/" + barcode,
url: "/barcodes/" + barcode,
success: function(data) {
increment_product(data["id"]);
$("#from_barcode_form")[0].reset();
if (data != null) {
increment_product(data["id"]);
$("#from_barcode_form")[0].reset();
} else {
alert("Barcode '" + barcode + "' was not found in the database system.");
}
},
dataMethod: "json"
}).fail(function() {