Class: Workarea::Admin::Discounts::CategoryViewModel

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

Instance Method Summary collapse

Methods included from Categories

#categories

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



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

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_item_quantity'),
      'item_quantity'
    ],
    [
      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



32
33
34
35
36
37
38
39
40
41
42
# File 'app/view_models/workarea/admin/discounts/category_view_model.rb', line 32

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