foodsoft/app/views/deliveries/add_stock_change.js.erb

23 lines
743 B
Text
Raw Normal View History

2013-06-26 15:16:52 +02:00
(function(w) {
if(!is_article_available_for_delivery(<%= @stock_change.stock_article.id %>)) {
2013-06-26 15:16:52 +02:00
return false;
}
$('#stock_changes tr').removeClass('success');
2013-09-25 23:06:53 +02:00
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;
}
2013-06-26 15:16:52 +02:00
var stock_change = $(
'<%= j(render(:partial => 'stock_change', :locals => {:stock_change => @stock_change})) %>'
).addClass('success');
2013-09-25 23:06:53 +02:00
$('input.stock-change-quantity', stock_change).val(quantity);
2013-06-26 15:16:52 +02:00
$('#stock_changes').append(stock_change);
mark_article_for_delivery(<%= @stock_change.stock_article.id %>);
2013-06-26 15:16:52 +02:00
updateSort('#stock_changes');
2013-06-26 15:16:52 +02:00
})(window);