Sha256: 3d8016772968c058e8895b9a6d19ec4efccc3da175e6c047b8399865ee6b87e8

Contents?: true

Size: 1.06 KB

Versions: 28

Compression:

Stored size: 1.06 KB

Contents

module Workarea
  module Admin
    module Discounts
      class ShippingViewModel < DiscountViewModel
        def shipping_service_options
          @shipping_service_options ||= Shipping::Service.all.map { |m| [m.name] }
        end

        def condition_options
          [
            [
              t('workarea.admin.pricing_discounts.options.for_everyone'),
              nil
            ],
            [
              t('workarea.admin.pricing_discounts.options.when_order_total'),
              'order_total'
            ],
            [
              t('workarea.admin.pricing_discounts.options.when_user_is_tagged'),
              'user_tag'
            ],
            [
              t('workarea.admin.pricing_discounts.options.when_in_segment'),
              'segments'
            ]
          ]
        end

        def selected_condition_option
          if order_total?
            'order_total'
          elsif user_tag?
            'user_tag'
          elsif active_segment_ids.present?
            'segments'
          end
        end
      end
    end
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
workarea-admin-3.5.6 app/view_models/workarea/admin/discounts/shipping_view_model.rb
workarea-admin-3.5.5 app/view_models/workarea/admin/discounts/shipping_view_model.rb
workarea-admin-3.5.4 app/view_models/workarea/admin/discounts/shipping_view_model.rb
workarea-admin-3.5.3 app/view_models/workarea/admin/discounts/shipping_view_model.rb
workarea-admin-3.5.2 app/view_models/workarea/admin/discounts/shipping_view_model.rb
workarea-admin-3.5.1 app/view_models/workarea/admin/discounts/shipping_view_model.rb
workarea-admin-3.5.0 app/view_models/workarea/admin/discounts/shipping_view_model.rb
workarea-admin-3.5.0.beta.1 app/view_models/workarea/admin/discounts/shipping_view_model.rb