validate quantity when printing labels
This commit is contained in:
parent
6212932f74
commit
9a8c647b25
|
@ -40,16 +40,25 @@
|
||||||
$(function() {
|
$(function() {
|
||||||
$('div.grid.Product a.print-label').live('click', function() {
|
$('div.grid.Product a.print-label').live('click', function() {
|
||||||
var quantity = $('#label-quantity').val();
|
var quantity = $('#label-quantity').val();
|
||||||
// TODO: Validate quantity as integer etc.
|
if (isNaN(quantity)) {
|
||||||
$.ajax({
|
alert("You must provide a valid label quantity.");
|
||||||
url: '${url('products.print_label')}',
|
$('#label-quantity').select();
|
||||||
data: {
|
$('#label-quantity').focus();
|
||||||
'uuid': get_uuid(this),
|
} else {
|
||||||
'profile': $('#label-profile').val(),
|
$.ajax({
|
||||||
'quantity': quantity,
|
url: '${url('products.print_label')}',
|
||||||
},
|
data: {
|
||||||
});
|
'uuid': get_uuid(this),
|
||||||
alert("Label has been printed.");
|
'profile': $('#label-profile').val(),
|
||||||
|
'quantity': quantity,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
if (quantity == '1') {
|
||||||
|
alert("1 label has been printed.");
|
||||||
|
} else {
|
||||||
|
alert(quantity + " labels have been printed.");
|
||||||
|
}
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue