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

21 lines
816 B
Text
Raw Normal View History

if(!is_article_unavailable_for_delivery(<%= @stock_change.stock_article.id %>)) {
<%# would be easier to return in the opposite case, but how? %>
mark_article_unavailable_for_delivery(<%= @stock_change.stock_article.id %>);
(function(w) {
$('#stock_changes tr').removeClass('success');
var stock_change = $(
'<%= j(render(:partial => 'stock_change', :locals => {:stock_change => @stock_change})) %>'
).addClass('success');
$('#stock_changes').append(stock_change);
updateSort('#stock_changes');
var quantity = w.prompt('<%= j(t('.how_many_units', :unit => @stock_change.stock_article.unit, :name => @stock_change.stock_article.name)) %>'); <%# how to properly escape here? %>
$('input.stock-change-quantity', stock_change).val(quantity);
})(window);
}