4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
# File 'app/view_models/workarea/storefront/inventory_status_view_model.rb', line 4
def message
return '' if model.nil?
if inventory.available?
::I18n.t('workarea.storefront.products.in_stock')
elsif inventory.low_inventory?
::I18n.t(
'workarea.storefront.products.few_left',
quantity: available_to_sell
)
elsif inventory.backordered? && backordered_until.present?
::I18n.t(
'workarea.storefront.products.ships_on',
date: backordered_until.to_date.to_s(:short)
)
elsif inventory.backordered?
::I18n.t('workarea.storefront.products.backordered')
elsif inventory.out_of_stock?
::I18n.t('workarea.storefront.products.out_of_stock')
end
end
|