solidus_friendly_promotions 1.0.1 → 1.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +15 -0
- data/Gemfile +1 -1
- data/MIGRATING.md +1 -1
- data/README.md +22 -16
- data/app/assets/config/solidus_friendly_promotions/manifest.js +7 -1
- data/app/controllers/solidus_friendly_promotions/admin/benefits_controller.rb +85 -0
- data/app/controllers/solidus_friendly_promotions/admin/conditions_controller.rb +69 -0
- data/app/controllers/solidus_friendly_promotions/admin/promotions_controller.rb +3 -3
- data/app/decorators/models/solidus_friendly_promotions/adjustment_decorator.rb +4 -4
- data/app/decorators/models/solidus_friendly_promotions/line_item_decorator.rb +2 -2
- data/app/decorators/models/solidus_friendly_promotions/order_decorator.rb +6 -6
- data/app/helpers/solidus_friendly_promotions/admin/benefits_helper.rb +19 -0
- data/app/helpers/solidus_friendly_promotions/admin/conditions_helper.rb +12 -0
- data/app/javascript/solidus_friendly_promotions/controllers/product_option_values_controller.js +1 -1
- data/app/javascript/solidus_friendly_promotions/web_components/number_with_currency.js +35 -0
- data/app/javascript/solidus_friendly_promotions/{jquery → web_components}/option_value_picker.js +8 -0
- data/app/javascript/solidus_friendly_promotions/web_components/product_picker.js +7 -0
- data/app/javascript/solidus_friendly_promotions/web_components/select_two.js +11 -0
- data/app/javascript/solidus_friendly_promotions/web_components/taxon_picker.js +7 -0
- data/app/javascript/solidus_friendly_promotions/web_components/user_picker.js +7 -0
- data/app/javascript/solidus_friendly_promotions/web_components/variant_picker.js +7 -0
- data/app/javascript/solidus_friendly_promotions.js +7 -11
- data/app/models/concerns/solidus_friendly_promotions/{actions/order_level_action.rb → benefits/order_benefit.rb} +2 -2
- data/app/models/concerns/solidus_friendly_promotions/{rules/line_item_applicable_order_rule.rb → conditions/line_item_applicable_order_condition.rb} +2 -2
- data/app/models/concerns/solidus_friendly_promotions/{rules/line_item_level_rule.rb → conditions/line_item_level_condition.rb} +2 -2
- data/app/models/concerns/solidus_friendly_promotions/{rules/order_level_rule.rb → conditions/order_level_condition.rb} +2 -2
- data/app/models/concerns/solidus_friendly_promotions/{rules/shipment_level_rule.rb → conditions/shipment_level_condition.rb} +2 -2
- data/app/models/solidus_friendly_promotions/{promotion_action.rb → benefit.rb} +48 -11
- data/app/models/solidus_friendly_promotions/{actions → benefits}/adjust_line_item.rb +6 -2
- data/app/models/solidus_friendly_promotions/{actions → benefits}/adjust_line_item_quantity_groups.rb +3 -3
- data/app/models/solidus_friendly_promotions/{actions → benefits}/adjust_shipment.rb +6 -2
- data/app/models/solidus_friendly_promotions/{actions → benefits}/create_discounted_item.rb +6 -7
- data/app/models/solidus_friendly_promotions/calculators/distributed_amount.rb +1 -1
- data/app/models/solidus_friendly_promotions/calculators/tiered_flat_rate.rb +1 -1
- data/app/models/solidus_friendly_promotions/calculators/tiered_percent.rb +1 -1
- data/app/models/solidus_friendly_promotions/calculators/tiered_percent_on_eligible_item_quantity.rb +4 -2
- data/app/models/solidus_friendly_promotions/{promotion_rule.rb → condition.rb} +13 -7
- data/app/models/solidus_friendly_promotions/condition_product.rb +8 -0
- data/app/models/solidus_friendly_promotions/condition_store.rb +8 -0
- data/app/models/solidus_friendly_promotions/condition_taxon.rb +8 -0
- data/app/models/solidus_friendly_promotions/{promotion_rules_user.rb → condition_user.rb} +2 -2
- data/app/models/solidus_friendly_promotions/{rules → conditions}/discounted_item_total.rb +3 -3
- data/app/models/solidus_friendly_promotions/{rules → conditions}/first_order.rb +3 -3
- data/app/models/solidus_friendly_promotions/{rules → conditions}/first_repeat_purchase_since.rb +3 -3
- data/app/models/solidus_friendly_promotions/{rules → conditions}/item_total.rb +5 -5
- data/app/models/solidus_friendly_promotions/{rules → conditions}/line_item_option_value.rb +3 -3
- data/app/models/solidus_friendly_promotions/{rules → conditions}/line_item_product.rb +8 -8
- data/app/models/solidus_friendly_promotions/{rules → conditions}/line_item_taxon.rb +8 -8
- data/app/models/solidus_friendly_promotions/{rules → conditions}/minimum_quantity.rb +8 -8
- data/app/models/solidus_friendly_promotions/{rules → conditions}/nth_order.rb +5 -5
- data/app/models/solidus_friendly_promotions/{rules → conditions}/one_use_per_user.rb +3 -3
- data/app/models/solidus_friendly_promotions/{rules → conditions}/option_value.rb +3 -3
- data/app/models/solidus_friendly_promotions/{rules → conditions}/product.rb +9 -9
- data/app/models/solidus_friendly_promotions/{rules → conditions}/shipping_method.rb +3 -3
- data/app/models/solidus_friendly_promotions/{rules → conditions}/store.rb +6 -6
- data/app/models/solidus_friendly_promotions/{rules → conditions}/taxon.rb +12 -12
- data/app/models/solidus_friendly_promotions/{rules → conditions}/user.rb +7 -7
- data/app/models/solidus_friendly_promotions/{rules → conditions}/user_logged_in.rb +3 -3
- data/app/models/solidus_friendly_promotions/{rules → conditions}/user_role.rb +3 -3
- data/app/models/solidus_friendly_promotions/eligibility_result.rb +1 -1
- data/app/models/solidus_friendly_promotions/eligibility_results.rb +7 -7
- data/app/models/solidus_friendly_promotions/friendly_promotion_adjuster/discount_order.rb +28 -29
- data/app/models/solidus_friendly_promotions/friendly_promotion_adjuster/load_promotions.rb +10 -11
- data/app/models/solidus_friendly_promotions/friendly_promotion_adjuster/persist_discounted_order.rb +2 -2
- data/app/models/solidus_friendly_promotions/order_promotion.rb +1 -1
- data/app/models/solidus_friendly_promotions/permission_sets/friendly_promotion_management.rb +1 -1
- data/app/models/solidus_friendly_promotions/promotion.rb +14 -43
- data/app/models/solidus_friendly_promotions/promotion_advertiser.rb +10 -0
- data/app/models/solidus_friendly_promotions/promotion_code.rb +1 -1
- data/app/models/solidus_friendly_promotions/shipping_rate_discount.rb +1 -1
- data/app/views/solidus_friendly_promotions/admin/benefit_fields/_adjust_line_item.html.erb +6 -0
- data/app/views/solidus_friendly_promotions/admin/{promotion_actions/actions → benefit_fields}/_adjust_line_item_quantity_groups.html.erb +4 -4
- data/app/views/solidus_friendly_promotions/admin/benefit_fields/_adjust_shipment.html.erb +6 -0
- data/app/views/solidus_friendly_promotions/admin/benefit_fields/_calculator_fields.erb +11 -0
- data/app/views/solidus_friendly_promotions/admin/{promotion_actions/actions → benefit_fields}/_create_discounted_item.html.erb +8 -6
- data/app/views/solidus_friendly_promotions/admin/benefits/_benefit.html.erb +50 -0
- data/app/views/solidus_friendly_promotions/admin/benefits/_calculator_select.html.erb +16 -0
- data/app/views/solidus_friendly_promotions/admin/benefits/_form.html.erb +3 -0
- data/app/views/solidus_friendly_promotions/admin/benefits/_new_benefit.html.erb +33 -0
- data/app/views/solidus_friendly_promotions/admin/benefits/_type_select.html.erb +16 -0
- data/app/views/solidus_friendly_promotions/admin/benefits/edit.html.erb +19 -0
- data/app/views/solidus_friendly_promotions/admin/benefits/new.html.erb +1 -0
- data/app/views/solidus_friendly_promotions/admin/{promotion_actions/calculators → calculator_fields}/_default_fields.html.erb +1 -1
- data/app/views/solidus_friendly_promotions/admin/{promotion_actions/calculators → calculator_fields}/distributed_amount/_fields.html.erb +3 -3
- data/app/views/solidus_friendly_promotions/admin/calculator_fields/flat_rate/_fields.html.erb +6 -0
- data/app/views/solidus_friendly_promotions/admin/calculator_fields/flexi_rate/_fields.html.erb +24 -0
- data/app/views/solidus_friendly_promotions/admin/calculator_fields/percent/_fields.html.erb +6 -0
- data/app/views/solidus_friendly_promotions/admin/calculator_fields/tiered_flat_rate/_fields.html.erb +32 -0
- data/app/views/solidus_friendly_promotions/admin/{promotion_actions/calculators → calculator_fields}/tiered_flat_rate/_tier_fields.html.erb +7 -8
- data/app/views/solidus_friendly_promotions/admin/calculator_fields/tiered_percent/_fields.html.erb +47 -0
- data/app/views/solidus_friendly_promotions/admin/{promotion_actions/calculators → calculator_fields}/tiered_percent/_tier_fields.html.erb +8 -7
- data/app/views/solidus_friendly_promotions/admin/{promotion_actions/calculators → calculator_fields}/tiered_percent_on_eligible_item_quantity/_fields.html.erb +11 -9
- data/app/views/solidus_friendly_promotions/admin/calculator_fields/tiered_percent_on_eligible_item_quantity/_tier_fields.html.erb +35 -0
- data/app/views/solidus_friendly_promotions/admin/condition_fields/_first_order.html.erb +3 -0
- data/app/views/solidus_friendly_promotions/admin/condition_fields/_first_repeat_purchase_since.html.erb +7 -0
- data/app/views/solidus_friendly_promotions/admin/condition_fields/_item_total.html.erb +15 -0
- data/app/views/solidus_friendly_promotions/admin/condition_fields/_line_item_option_value.html.erb +25 -0
- data/app/views/solidus_friendly_promotions/admin/{promotion_rules/rules → condition_fields}/_line_item_product.html.erb +7 -7
- data/app/views/solidus_friendly_promotions/admin/condition_fields/_line_item_taxon.html.erb +17 -0
- data/app/views/solidus_friendly_promotions/admin/condition_fields/_minimum_quantity.html.erb +5 -0
- data/app/views/solidus_friendly_promotions/admin/condition_fields/_nth_order.html.erb +15 -0
- data/app/views/solidus_friendly_promotions/admin/condition_fields/_one_use_per_user.html.erb +3 -0
- data/app/views/solidus_friendly_promotions/admin/{promotion_rules/rules → condition_fields}/_option_value.html.erb +10 -10
- data/app/views/solidus_friendly_promotions/admin/condition_fields/_product.html.erb +28 -0
- data/app/views/solidus_friendly_promotions/admin/{promotion_rules/rules → condition_fields}/_shipping_method.html.erb +3 -3
- data/app/views/solidus_friendly_promotions/admin/condition_fields/_store.html.erb +9 -0
- data/app/views/solidus_friendly_promotions/admin/condition_fields/_taxon.html.erb +28 -0
- data/app/views/solidus_friendly_promotions/admin/condition_fields/_user.html.erb +7 -0
- data/app/views/solidus_friendly_promotions/admin/condition_fields/_user_logged_in.html.erb +3 -0
- data/app/views/solidus_friendly_promotions/admin/condition_fields/_user_role.html.erb +15 -0
- data/app/views/solidus_friendly_promotions/admin/condition_fields/line_item_option_value/_option_value_fields.html.erb +21 -0
- data/app/views/solidus_friendly_promotions/admin/conditions/_condition.html.erb +26 -0
- data/app/views/solidus_friendly_promotions/admin/conditions/_new_condition.html.erb +26 -0
- data/app/views/solidus_friendly_promotions/admin/conditions/_type_select.html.erb +20 -0
- data/app/views/solidus_friendly_promotions/admin/conditions/new.html.erb +1 -0
- data/app/views/solidus_friendly_promotions/admin/promotion_code_batches/_form_fields.html.erb +5 -5
- data/app/views/solidus_friendly_promotions/admin/promotions/_form.html.erb +4 -4
- data/app/views/solidus_friendly_promotions/admin/promotions/_table_filter.html.erb +6 -6
- data/app/views/solidus_friendly_promotions/admin/promotions/edit.html.erb +7 -41
- data/app/views/solidus_friendly_promotions/admin/shared/_number_with_currency.html.erb +20 -0
- data/app/views/solidus_friendly_promotions/admin/shared/preference_fields/_boolean.html.erb +14 -0
- data/app/views/solidus_friendly_promotions/admin/shared/preference_fields/_decimal.html.erb +12 -0
- data/app/views/solidus_friendly_promotions/admin/shared/preference_fields/_encrypted_string.html.erb +12 -0
- data/app/views/solidus_friendly_promotions/admin/shared/preference_fields/_integer.html.erb +12 -0
- data/app/views/solidus_friendly_promotions/admin/shared/preference_fields/_password.html.erb +12 -0
- data/app/views/solidus_friendly_promotions/admin/shared/preference_fields/_string.html.erb +12 -0
- data/app/views/solidus_friendly_promotions/admin/shared/preference_fields/_text.html.erb +12 -0
- data/bin/sandbox +3 -3
- data/config/importmap.rb +2 -0
- data/config/locales/en.yml +128 -94
- data/config/routes.rb +3 -2
- data/db/migrate/20231011120928_add_db_comments_to_friendly_promotion_rules_taxons.rb +2 -2
- data/db/migrate/20231011142040_add_db_comments_to_friendly_promotion_rules_users.rb +1 -1
- data/db/migrate/20231011190222_add_db_comments_to_friendly_promotion_actions.rb +1 -1
- data/db/migrate/20240409093831_add_action_reference_to_rules.rb +34 -0
- data/db/migrate/20240506142650_remove_promotion_rules_promotion_id.rb +5 -0
- data/db/migrate/20240508080834_rename_promotion_rules_to_conditions.rb +19 -0
- data/db/migrate/20240508131514_rename_friendly_promotion_actions_to_friendly_benefits.rb +19 -0
- data/db/migrate/20240612113608_update_column_comments_for_benefits.rb +31 -0
- data/db/migrate/20240612114132_update_column_comments_for_conditions.rb +30 -0
- data/db/migrate/20240612115209_update_column_comments_for_condition_stores.rb +23 -0
- data/db/migrate/20240612115749_update_column_comments_for_condition_products.rb +22 -0
- data/db/migrate/20240612120411_update_column_comments_for_condition_taxons.rb +24 -0
- data/db/migrate/20240612121049_update_column_comments_for_condition_users.rb +23 -0
- data/lib/generators/solidus_friendly_promotions/install/templates/initializer.rb +30 -30
- data/lib/solidus_friendly_promotions/configuration.rb +11 -3
- data/lib/solidus_friendly_promotions/migrate_adjustments.rb +11 -11
- data/lib/solidus_friendly_promotions/promotion_map.rb +17 -17
- data/lib/solidus_friendly_promotions/promotion_migrator.rb +16 -16
- data/lib/solidus_friendly_promotions/testing_support/factories/friendly_promotion_factory.rb +8 -34
- data/lib/solidus_friendly_promotions/testing_support/factories/friendly_shipping_rate_discount_factory.rb +2 -2
- data/lib/solidus_friendly_promotions/version.rb +1 -1
- data/lib/tasks/solidus_friendly_promotions/migrate_adjustments.rake +2 -2
- data/solidus_friendly_promotions.gemspec +2 -2
- metadata +114 -86
- data/.rubocop_todo.yml +0 -157
- data/app/controllers/solidus_friendly_promotions/admin/promotion_actions_controller.rb +0 -103
- data/app/controllers/solidus_friendly_promotions/admin/promotion_rules_controller.rb +0 -105
- data/app/helpers/solidus_friendly_promotions/admin/promotion_actions_helper.rb +0 -23
- data/app/helpers/solidus_friendly_promotions/admin/promotion_rules_helper.rb +0 -25
- data/app/models/solidus_friendly_promotions/products_promotion_rule.rb +0 -8
- data/app/models/solidus_friendly_promotions/promotion_rules_store.rb +0 -8
- data/app/models/solidus_friendly_promotions/promotion_rules_taxon.rb +0 -8
- data/app/views/solidus_friendly_promotions/admin/promotion_actions/_calculator_select.html.erb +0 -16
- data/app/views/solidus_friendly_promotions/admin/promotion_actions/_form.html.erb +0 -3
- data/app/views/solidus_friendly_promotions/admin/promotion_actions/_promotion_action.html.erb +0 -29
- data/app/views/solidus_friendly_promotions/admin/promotion_actions/_type_select.html.erb +0 -14
- data/app/views/solidus_friendly_promotions/admin/promotion_actions/actions/_adjust_line_item.html.erb +0 -6
- data/app/views/solidus_friendly_promotions/admin/promotion_actions/actions/_adjust_shipment.html.erb +0 -6
- data/app/views/solidus_friendly_promotions/admin/promotion_actions/actions/_calculator_fields.erb +0 -9
- data/app/views/solidus_friendly_promotions/admin/promotion_actions/calculators/flat_rate/_fields.html.erb +0 -6
- data/app/views/solidus_friendly_promotions/admin/promotion_actions/calculators/tiered_flat_rate/_fields.html.erb +0 -34
- data/app/views/solidus_friendly_promotions/admin/promotion_actions/calculators/tiered_percent/_fields.html.erb +0 -34
- data/app/views/solidus_friendly_promotions/admin/promotion_actions/calculators/tiered_percent_on_eligible_item_quantity/_tier_fields.html.erb +0 -27
- data/app/views/solidus_friendly_promotions/admin/promotion_actions/edit.html.erb +0 -23
- data/app/views/solidus_friendly_promotions/admin/promotion_actions/new.html.erb +0 -26
- data/app/views/solidus_friendly_promotions/admin/promotion_rules/_promotion_rule.html.erb +0 -22
- data/app/views/solidus_friendly_promotions/admin/promotion_rules/_type_select.html.erb +0 -20
- data/app/views/solidus_friendly_promotions/admin/promotion_rules/new.html.erb +0 -24
- data/app/views/solidus_friendly_promotions/admin/promotion_rules/rules/_first_order.html.erb +0 -3
- data/app/views/solidus_friendly_promotions/admin/promotion_rules/rules/_first_repeat_purchase_since.html.erb +0 -6
- data/app/views/solidus_friendly_promotions/admin/promotion_rules/rules/_item_total.html.erb +0 -17
- data/app/views/solidus_friendly_promotions/admin/promotion_rules/rules/_line_item_option_value.html.erb +0 -25
- data/app/views/solidus_friendly_promotions/admin/promotion_rules/rules/_line_item_taxon.html.erb +0 -17
- data/app/views/solidus_friendly_promotions/admin/promotion_rules/rules/_minimum_quantity.html.erb +0 -5
- data/app/views/solidus_friendly_promotions/admin/promotion_rules/rules/_nth_order.html.erb +0 -15
- data/app/views/solidus_friendly_promotions/admin/promotion_rules/rules/_one_use_per_user.html.erb +0 -3
- data/app/views/solidus_friendly_promotions/admin/promotion_rules/rules/_product.html.erb +0 -44
- data/app/views/solidus_friendly_promotions/admin/promotion_rules/rules/_store.html.erb +0 -9
- data/app/views/solidus_friendly_promotions/admin/promotion_rules/rules/_taxon.html.erb +0 -44
- data/app/views/solidus_friendly_promotions/admin/promotion_rules/rules/_user.html.erb +0 -7
- data/app/views/solidus_friendly_promotions/admin/promotion_rules/rules/_user_logged_in.html.erb +0 -3
- data/app/views/solidus_friendly_promotions/admin/promotion_rules/rules/_user_role.html.erb +0 -15
- data/app/views/solidus_friendly_promotions/admin/promotion_rules/rules/line_item_option_value/_option_value_fields.html.erb +0 -17
@@ -1,44 +0,0 @@
|
|
1
|
-
<% context = local_assigns[:context] || :order %>
|
2
|
-
|
3
|
-
<% if context == :order %>
|
4
|
-
<p>
|
5
|
-
<%= promotion_rule.class.human_attribute_name(:description) %>
|
6
|
-
</p>
|
7
|
-
<%= fields_for param_prefix, promotion_rule do |form| %>
|
8
|
-
<div class="field products_rule_products">
|
9
|
-
<%= form.label :product_ids_string, t('solidus_friendly_promotions.product_rule.choose_products') %>
|
10
|
-
<%= form.hidden_field :product_ids_string, value: promotion_rule.product_ids.join(","), class: "product_picker fullwidth" %>
|
11
|
-
</div>
|
12
|
-
|
13
|
-
<div class="field">
|
14
|
-
<%
|
15
|
-
match_policy_options = options_for_select(
|
16
|
-
SolidusFriendlyPromotions::Rules::Product::MATCH_POLICIES.map { |s| [t("solidus_friendly_promotions.product_rule.match_#{s}"),s] },
|
17
|
-
promotion_rule.preferred_match_policy
|
18
|
-
)
|
19
|
-
%>
|
20
|
-
<% select = form.select :preferred_match_policy, match_policy_options %>
|
21
|
-
<%= form.label :preferred_match_policy, t('solidus_friendly_promotions.product_rule.label', select: select).html_safe %>
|
22
|
-
</label>
|
23
|
-
</div>
|
24
|
-
|
25
|
-
<div class="field">
|
26
|
-
<%= form.label :preferred_line_item_applicable do %>
|
27
|
-
<%= form.check_box :preferred_line_item_applicable %>
|
28
|
-
<%= promotion_rule.class.human_attribute_name(:preferred_line_item_applicable) %>
|
29
|
-
<% end %>
|
30
|
-
</div>
|
31
|
-
<% end %>
|
32
|
-
<% else %>
|
33
|
-
<p>
|
34
|
-
<% match_policy_translation_key = promotion_rule.preferred_match_policy == "none" ? :exclude : :include %>
|
35
|
-
<%= t(match_policy_translation_key, scope: [:solidus_friendly_promotions, :promotion_rules, :line_item_product, :match_policies]) %>
|
36
|
-
</p>
|
37
|
-
<ul>
|
38
|
-
<% promotion_rule.products.each do |product| %>
|
39
|
-
<li>
|
40
|
-
<%= product.name %>
|
41
|
-
</li>
|
42
|
-
<% end %>
|
43
|
-
</ul>
|
44
|
-
<% end %>
|
@@ -1,9 +0,0 @@
|
|
1
|
-
<p>
|
2
|
-
<%= promotion_rule.class.human_attribute_name(:description) %>
|
3
|
-
</p>
|
4
|
-
<div class="field">
|
5
|
-
<label><%= t("solidus_friendly_promotions.store_rule.choose_stores" ) %></label>
|
6
|
-
<%= select_tag "#{param_prefix}[store_ids][]",
|
7
|
-
options_from_collection_for_select(Spree::Store.all, :id, :name, promotion_rule.store_ids),
|
8
|
-
multiple: true, class: "select2 fullwidth" %>
|
9
|
-
</div>
|
@@ -1,44 +0,0 @@
|
|
1
|
-
<% context = local_assigns[:context] || :order %>
|
2
|
-
|
3
|
-
<% if context == :order %>
|
4
|
-
<p>
|
5
|
-
<%= promotion_rule.class.human_attribute_name(:description) %>
|
6
|
-
</p>
|
7
|
-
<%= fields_for param_prefix, promotion_rule do |form| %>
|
8
|
-
<div class="field taxons_rule_taxons">
|
9
|
-
<%= form.label :taxon_ids_string, t('solidus_friendly_promotions.taxon_rule.choose_taxons') %>
|
10
|
-
<%= form.hidden_field :taxon_ids_string, value: promotion_rule.taxon_ids.join(","), class: "taxon_picker fullwidth" %>
|
11
|
-
</div>
|
12
|
-
|
13
|
-
<div class="field">
|
14
|
-
<%
|
15
|
-
match_policy_options = options_for_select(
|
16
|
-
SolidusFriendlyPromotions::Rules::Taxon::MATCH_POLICIES.map { |s| [t("solidus_friendly_promotions.taxon_rule.match_#{s}"),s] },
|
17
|
-
promotion_rule.preferred_match_policy
|
18
|
-
)
|
19
|
-
%>
|
20
|
-
<% select = form.select :preferred_match_policy, match_policy_options %>
|
21
|
-
<%= form.label :preferred_match_policy, t('solidus_friendly_promotions.taxon_rule.label', select: select).html_safe %>
|
22
|
-
</label>
|
23
|
-
</div>
|
24
|
-
|
25
|
-
<div class="field">
|
26
|
-
<%= form.label :preferred_line_item_applicable do %>
|
27
|
-
<%= form.check_box :preferred_line_item_applicable %>
|
28
|
-
<%= promotion_rule.class.human_attribute_name(:preferred_line_item_applicable) %>
|
29
|
-
<% end %>
|
30
|
-
</div>
|
31
|
-
<% end %>
|
32
|
-
<% else %>
|
33
|
-
<p>
|
34
|
-
<% match_policy_translation_key = promotion_rule.preferred_match_policy == "none" ? :exclude : :include %>
|
35
|
-
<%= t(match_policy_translation_key, scope: [:solidus_friendly_promotions, :promotion_rules, :line_item_taxon, :match_policies]) %>
|
36
|
-
</p>
|
37
|
-
<ul>
|
38
|
-
<% promotion_rule.taxons.each do |taxon| %>
|
39
|
-
<li>
|
40
|
-
<%= taxon.name %>
|
41
|
-
</li>
|
42
|
-
<% end %>
|
43
|
-
</ul>
|
44
|
-
<% end %>
|
@@ -1,7 +0,0 @@
|
|
1
|
-
<p>
|
2
|
-
<%= promotion_rule.class.human_attribute_name(:description) %>
|
3
|
-
</p>
|
4
|
-
<div class="field">
|
5
|
-
<label><%= t('solidus_friendly_promotions.user_rule.choose_users') %></label><br>
|
6
|
-
<input type='hidden' name='<%= param_prefix %>[user_ids_string]' class='user_picker fullwidth' value='<%= promotion_rule.user_ids.join(",") %>'>
|
7
|
-
</div>
|
@@ -1,15 +0,0 @@
|
|
1
|
-
<p>
|
2
|
-
<%= promotion_rule.class.human_attribute_name(:description) %>
|
3
|
-
</p>
|
4
|
-
<div class="form-group">
|
5
|
-
<%= label_tag "#{param_prefix}_preferred_role_ids", t('solidus_friendly_promotions.user_role_rule.choose_roles') %>
|
6
|
-
<%= select_tag "#{param_prefix}[preferred_role_ids]",
|
7
|
-
options_from_collection_for_select(
|
8
|
-
Spree::Role.all, :id, :name, promotion_rule.preferred_role_ids
|
9
|
-
), class: 'select2 fullwidth', multiple: true %>
|
10
|
-
</div>
|
11
|
-
<div class="form-group">
|
12
|
-
<label>
|
13
|
-
<%= t('solidus_friendly_promotions.user_role_rule.label', select: select_tag("#{param_prefix}[preferred_match_policy]", options_for_select(SolidusFriendlyPromotions::Rules::UserRole::MATCH_POLICIES.map{ |s| [t("solidus_friendly_promotions.user_role_rule.match_#{s}"),s] }, promotion_rule.preferred_match_policy), { class: 'custom-select'})).html_safe %>
|
14
|
-
</label>
|
15
|
-
</div>
|
@@ -1,17 +0,0 @@
|
|
1
|
-
<div class="fullwidth promo-rule-option-value">
|
2
|
-
<div class="row">
|
3
|
-
<div class="col-6">
|
4
|
-
<input
|
5
|
-
class="product-select fullwidth"
|
6
|
-
data-action="select2Change->product-option-values#propagate_product_id_to_value_input"
|
7
|
-
type="hidden"
|
8
|
-
value="<%= product_option_values[0] %>"
|
9
|
-
>
|
10
|
-
</div>
|
11
|
-
<div class="col-5">
|
12
|
-
<input class="option-values-select fullwidth" name="<%= form.object_name %>[preferred_eligible_values][<%= product_option_values[0] %>]" type="hidden" value="<%= product_option_values[1].join(",") %>">
|
13
|
-
</div>
|
14
|
-
</div>
|
15
|
-
<a class="fa fa-trash remove" data-action="click->product-option-values#remove_row"></a>
|
16
|
-
<div class="clear"></div>
|
17
|
-
</div>
|