2009-01-18 17:42:51 +01:00
|
|
|
module StockitHelper
|
2012-10-29 18:28:17 +01:00
|
|
|
def stock_article_classes(article)
|
|
|
|
class_names = []
|
2023-05-12 13:01:12 +02:00
|
|
|
class_names << 'unavailable' if article.quantity_available <= 0
|
|
|
|
class_names.join(' ')
|
2012-10-29 18:28:17 +01:00
|
|
|
end
|
2013-07-13 09:34:19 +02:00
|
|
|
|
|
|
|
def link_to_stock_change_reason(stock_change)
|
2020-08-01 20:11:25 +02:00
|
|
|
if stock_change.delivery
|
2013-12-06 22:53:59 +01:00
|
|
|
link_to Delivery.model_name.human, supplier_delivery_path(stock_change.delivery.supplier, stock_change.delivery)
|
2020-08-01 20:11:25 +02:00
|
|
|
elsif stock_change.order
|
2013-12-06 22:53:59 +01:00
|
|
|
link_to Order.model_name.human, order_path(stock_change.order)
|
2020-08-01 20:11:25 +02:00
|
|
|
elsif stock_change.stock_taking
|
2013-12-06 22:53:59 +01:00
|
|
|
link_to StockTaking.model_name.human, stock_taking_path(stock_change.stock_taking)
|
2013-07-13 09:34:19 +02:00
|
|
|
end
|
|
|
|
end
|
2020-08-01 20:11:25 +02:00
|
|
|
|
2013-12-07 11:20:03 +01:00
|
|
|
def stock_article_price_hint(stock_article)
|
|
|
|
t('simple_form.hints.stock_article.edit_stock_article.price',
|
2023-05-12 13:01:12 +02:00
|
|
|
stock_article_copy_link: link_to(t('stockit.form.copy_stock_article'),
|
|
|
|
stock_article_copy_path(stock_article),
|
|
|
|
remote: true))
|
2013-12-07 11:20:03 +01:00
|
|
|
end
|
2009-01-18 17:42:51 +01:00
|
|
|
end
|