Linearize and clean up delivery form
This commit is contained in:
parent
bf32e72414
commit
dd70b84ef0
16 changed files with 170 additions and 155 deletions
|
|
@ -1,20 +1,24 @@
|
|||
if(!is_article_unavailable_for_delivery(<%= @stock_change.stock_article.id %>)) {
|
||||
<%# would be easier to return in the opposite case, but how? %>
|
||||
(function(w) {
|
||||
if(is_article_unavailable_for_delivery(<%= @stock_change.stock_article.id %>)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
}
|
||||
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? %>
|
||||
if(null === quantity) {
|
||||
unmark_article_unavailable_for_delivery(<%= @stock_change.stock_article.id %>); // think wisely before changing this: What about double clicks on "deliver" button?
|
||||
return false;
|
||||
}
|
||||
|
||||
$('#stock_changes tr').removeClass('success');
|
||||
|
||||
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);
|
||||
updateSort('#stock_changes');
|
||||
})(window);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue