Class: Workarea::Admin::Discounts::FreeGiftViewModel

Inherits:
Workarea::Admin::DiscountViewModel show all
Includes:
Categories, Products
Defined in:
app/view_models/workarea/admin/discounts/free_gift_view_model.rb

Instance Method Summary collapse

Methods included from Categories

#categories

Methods included from Products

#products

Methods inherited from Workarea::Admin::DiscountViewModel

#amount_type_options, #application_options, #code_list_options, #compatible_discounts, #excluded_categories, #excluded_products, #insights, #max_applications_options, #order_total_operator_options, #promo_code_options, #rules_summary, #selected_application_option, #selected_promo_code_option, #slug, #timeline, #workflow_params, wrap

Methods included from CommentableViewModel

#comment_count, #comments, #has_comments?, #new_comments_for?, #subscribed_users

Instance Method Details

#condition_optionsObject



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'app/view_models/workarea/admin/discounts/free_gift_view_model.rb', line 8

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

#selected_condition_optionObject



29
30
31
32
33
34
35
36
37
# File 'app/view_models/workarea/admin/discounts/free_gift_view_model.rb', line 29

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