Slightly cleanup delivery form
This commit is contained in:
parent
92f560e189
commit
012327dd7c
2 changed files with 5 additions and 3 deletions
|
@ -1,4 +1,7 @@
|
||||||
- css_class = ( @delivery and @delivery.includes_article? article ) ? ( 'unavailable' ) : ( false )
|
- disable_delivery_action = ( @delivery and @delivery.includes_article? article )
|
||||||
|
- css_class = ( disable_delivery_action ) ? ( 'unavailable' ) : ( false )
|
||||||
|
- deliver_button_disabled = ( disable_delivery_action ) ? ( 'disabled' ) : ( false )
|
||||||
|
|
||||||
%tr{:id => "stock_article_#{article.id}", :class => css_class}
|
%tr{:id => "stock_article_#{article.id}", :class => css_class}
|
||||||
%td= article.name
|
%td= article.name
|
||||||
%td{:data => {:toggle => :tooltip, :title => render(:partial => 'shared/article_price_info', :locals => {:article => article})}}= number_to_currency article.price
|
%td{:data => {:toggle => :tooltip, :title => render(:partial => 'shared/article_price_info', :locals => {:article => article})}}= number_to_currency article.price
|
||||||
|
@ -7,5 +10,4 @@
|
||||||
%td
|
%td
|
||||||
= link_to t('.action_edit'), edit_stock_article_path(article), remote: true, class: 'btn btn-mini'
|
= link_to t('.action_edit'), edit_stock_article_path(article), remote: true, class: 'btn btn-mini'
|
||||||
= link_to t('.action_other_price'), stock_article_copy_path(article), remote: true, class: 'btn btn-mini'
|
= link_to t('.action_other_price'), stock_article_copy_path(article), remote: true, class: 'btn btn-mini'
|
||||||
- deliver_button_disabled = ( @delivery and @delivery.includes_article? article ) ? ( 'disabled' ) : ( false )
|
|
||||||
= link_to t('.action_add_to_delivery'), add_stock_change_supplier_deliveries_path(@supplier, :stock_article_id => article.id), :method => :post, remote: true, class: 'button-add-stock-change btn btn-mini btn-primary', disabled: deliver_button_disabled
|
= link_to t('.action_add_to_delivery'), add_stock_change_supplier_deliveries_path(@supplier, :stock_article_id => article.id), :method => :post, remote: true, class: 'button-add-stock-change btn btn-mini btn-primary', disabled: deliver_button_disabled
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
$('#stock_articles_for_adding tr').removeClass('success');
|
$('#stock_articles_for_adding tr').removeClass('success');
|
||||||
|
|
||||||
var stock_article_for_adding = $(
|
var stock_article_for_adding = $(
|
||||||
'<%= j(render(:partial => 'stock_article_for_adding', :locals => {:article => @stock_article, :delivery => @delivery})) %>'
|
'<%= j(render(:partial => 'stock_article_for_adding', :locals => {:article => @stock_article})) %>'
|
||||||
).addClass('success');
|
).addClass('success');
|
||||||
|
|
||||||
$('#stock_article_<%= @stock_article.id %>').replaceWith(stock_article_for_adding);
|
$('#stock_article_<%= @stock_article.id %>').replaceWith(stock_article_for_adding);
|
||||||
|
|
Loading…
Reference in a new issue