Sha256: 1c3337d130c76ff8e99fd7ca1018d50826120129c1468187f32e89038757dd38

Contents?: true

Size: 871 Bytes

Versions: 34

Compression:

Stored size: 871 Bytes

Contents

module Workarea
  module Storefront
    class InventoryStatusViewModel < ApplicationViewModel
      def message
        return '' if model.nil?
        if purchasable?(Workarea.config.low_inventory_threshold) &&
          !backordered?
          ::I18n.t('workarea.storefront.products.in_stock')
        elsif purchasable? && !backordered?
          ::I18n.t(
            'workarea.storefront.products.few_left',
            quantity: available_to_sell
          )
        elsif backordered? && backordered_until.present?
          ::I18n.t(
            'workarea.storefront.products.ships_on',
            date: backordered_until.to_date.to_s(:short)
          )
        elsif backordered?
          ::I18n.t('workarea.storefront.products.backordered')
        else
          ::I18n.t('workarea.storefront.products.out_of_stock')
        end
      end
    end
  end
end

Version data entries

34 entries across 34 versions & 1 rubygems

Version Path
workarea-storefront-3.4.45 app/view_models/workarea/storefront/inventory_status_view_model.rb
workarea-storefront-3.4.44 app/view_models/workarea/storefront/inventory_status_view_model.rb
workarea-storefront-3.4.43 app/view_models/workarea/storefront/inventory_status_view_model.rb
workarea-storefront-3.4.42 app/view_models/workarea/storefront/inventory_status_view_model.rb
workarea-storefront-3.4.41 app/view_models/workarea/storefront/inventory_status_view_model.rb
workarea-storefront-3.4.40 app/view_models/workarea/storefront/inventory_status_view_model.rb
workarea-storefront-3.4.39 app/view_models/workarea/storefront/inventory_status_view_model.rb
workarea-storefront-3.4.38 app/view_models/workarea/storefront/inventory_status_view_model.rb
workarea-storefront-3.4.37 app/view_models/workarea/storefront/inventory_status_view_model.rb
workarea-storefront-3.4.36 app/view_models/workarea/storefront/inventory_status_view_model.rb
workarea-storefront-3.4.35 app/view_models/workarea/storefront/inventory_status_view_model.rb
workarea-storefront-3.4.34 app/view_models/workarea/storefront/inventory_status_view_model.rb
workarea-storefront-3.4.33 app/view_models/workarea/storefront/inventory_status_view_model.rb
workarea-storefront-3.4.32 app/view_models/workarea/storefront/inventory_status_view_model.rb
workarea-storefront-3.4.31 app/view_models/workarea/storefront/inventory_status_view_model.rb
workarea-storefront-3.4.30 app/view_models/workarea/storefront/inventory_status_view_model.rb
workarea-storefront-3.4.29 app/view_models/workarea/storefront/inventory_status_view_model.rb
workarea-storefront-3.4.28 app/view_models/workarea/storefront/inventory_status_view_model.rb
workarea-storefront-3.4.27 app/view_models/workarea/storefront/inventory_status_view_model.rb
workarea-storefront-3.4.26 app/view_models/workarea/storefront/inventory_status_view_model.rb