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

29 lines
1 KiB
Text
Raw Normal View History

// Handle more advanced DOM update after AJAX database manipulation.
// See publish/subscribe design pattern in /doc.
(function() {
2013-06-26 15:16:52 +02:00
// update entry in stock_article table
$('#stock_articles_for_adding tr').removeClass('success');
var stock_article_for_adding = $(
'<%= j(render(:partial => 'stock_article_for_adding', :locals => {:article => @stock_article, :delivery => @delivery})) %>'
).addClass('success');
2013-06-26 19:57:38 +02:00
$('#stock_article_<%= @stock_article.id %>').replaceWith(stock_article_for_adding);
2013-06-26 15:16:52 +02:00
updateSort('#stock_articles_for_adding');
2013-06-26 19:57:38 +02:00
mark_article_for_delivery(<%= @stock_article.id %>);
2013-06-26 15:16:52 +02:00
// update entry in stock_changes table
$('#stock_changes tr').removeClass('success');
var stock_change_entry = $('#stock_change_stock_article_<%= @stock_article.id %>');
$('.stock_article_name', stock_change_entry).text('<%= j(@stock_article.name) %>');
$('.unit', stock_change_entry).text('<%= j(@stock_article.unit) %>');
stock_change_entry.addClass('success');
updateSort('#stock_changes');
})();