foodsoft/app/views/deliveries/add_stock_change.js.erb
2013-10-09 10:43:41 +02:00

22 lines
743 B
Text

(function(w) {
if(!is_article_available_for_delivery(<%= @stock_change.stock_article.id %>)) {
return false;
}
$('#stock_changes tr').removeClass('success');
var quantity = w.prompt('<%= j(t('.how_many_units', :unit => @stock_change.stock_article.unit, :name => @stock_change.stock_article.name)) %>');
if(null === quantity) {
return false;
}
var stock_change = $(
'<%= j(render(:partial => 'stock_change', :locals => {:stock_change => @stock_change})) %>'
).addClass('success');
$('input.stock-change-quantity', stock_change).val(quantity);
$('#stock_changes').append(stock_change);
mark_article_for_delivery(<%= @stock_change.stock_article.id %>);
updateSort('#stock_changes');
})(window);