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,5 +1,5 @@
|
|||
module DeliveriesHelper
|
||||
|
||||
|
||||
def link_to_invoice(delivery)
|
||||
if delivery.invoice
|
||||
link_to number_to_currency(delivery.invoice.amount), [:finance, delivery.invoice],
|
||||
|
|
@ -9,17 +9,20 @@ module DeliveriesHelper
|
|||
class: 'btn btn-mini'
|
||||
end
|
||||
end
|
||||
|
||||
def stock_articles_for_select(supplier)
|
||||
supplier.stock_articles.undeleted.reorder('articles.name ASC').map {|a| ["#{a.name} (#{number_to_currency a.price}/#{a.unit})", a.id] }
|
||||
|
||||
def articles_for_select2(supplier)
|
||||
supplier.articles.undeleted.reorder('articles.name ASC').map {|a| {:id => a.id, :text => "#{a.name} (#{number_to_currency a.price}/#{a.unit})"} }
|
||||
end
|
||||
|
||||
def articles_for_select(supplier)
|
||||
supplier.articles.undeleted.reorder('articles.name ASC').map {|a| ["#{a.name} (#{number_to_currency a.price}/#{a.unit})", a.id] }.unshift(['', nil])
|
||||
end
|
||||
|
||||
|
||||
def stock_articles_for_table(supplier)
|
||||
supplier.stock_articles.undeleted.reorder('articles.name COLLATE NOCASE ASC')
|
||||
end
|
||||
|
||||
|
||||
def stock_change_remove_link(stock_change_form)
|
||||
return link_to t('.remove_article'), "#", :class => 'remove_new_stock_change btn btn-small' if stock_change_form.object.new_record?
|
||||
output = stock_change_form.hidden_field :_destroy
|
||||
output += link_to t('.remove_article'), "#", :class => 'destroy_stock_change btn btn-small'
|
||||
return output.html_safe
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue