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.
Files changed (195) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +15 -0
  3. data/Gemfile +1 -1
  4. data/MIGRATING.md +1 -1
  5. data/README.md +22 -16
  6. data/app/assets/config/solidus_friendly_promotions/manifest.js +7 -1
  7. data/app/controllers/solidus_friendly_promotions/admin/benefits_controller.rb +85 -0
  8. data/app/controllers/solidus_friendly_promotions/admin/conditions_controller.rb +69 -0
  9. data/app/controllers/solidus_friendly_promotions/admin/promotions_controller.rb +3 -3
  10. data/app/decorators/models/solidus_friendly_promotions/adjustment_decorator.rb +4 -4
  11. data/app/decorators/models/solidus_friendly_promotions/line_item_decorator.rb +2 -2
  12. data/app/decorators/models/solidus_friendly_promotions/order_decorator.rb +6 -6
  13. data/app/helpers/solidus_friendly_promotions/admin/benefits_helper.rb +19 -0
  14. data/app/helpers/solidus_friendly_promotions/admin/conditions_helper.rb +12 -0
  15. data/app/javascript/solidus_friendly_promotions/controllers/product_option_values_controller.js +1 -1
  16. data/app/javascript/solidus_friendly_promotions/web_components/number_with_currency.js +35 -0
  17. data/app/javascript/solidus_friendly_promotions/{jquery → web_components}/option_value_picker.js +8 -0
  18. data/app/javascript/solidus_friendly_promotions/web_components/product_picker.js +7 -0
  19. data/app/javascript/solidus_friendly_promotions/web_components/select_two.js +11 -0
  20. data/app/javascript/solidus_friendly_promotions/web_components/taxon_picker.js +7 -0
  21. data/app/javascript/solidus_friendly_promotions/web_components/user_picker.js +7 -0
  22. data/app/javascript/solidus_friendly_promotions/web_components/variant_picker.js +7 -0
  23. data/app/javascript/solidus_friendly_promotions.js +7 -11
  24. data/app/models/concerns/solidus_friendly_promotions/{actions/order_level_action.rb → benefits/order_benefit.rb} +2 -2
  25. data/app/models/concerns/solidus_friendly_promotions/{rules/line_item_applicable_order_rule.rb → conditions/line_item_applicable_order_condition.rb} +2 -2
  26. data/app/models/concerns/solidus_friendly_promotions/{rules/line_item_level_rule.rb → conditions/line_item_level_condition.rb} +2 -2
  27. data/app/models/concerns/solidus_friendly_promotions/{rules/order_level_rule.rb → conditions/order_level_condition.rb} +2 -2
  28. data/app/models/concerns/solidus_friendly_promotions/{rules/shipment_level_rule.rb → conditions/shipment_level_condition.rb} +2 -2
  29. data/app/models/solidus_friendly_promotions/{promotion_action.rb → benefit.rb} +48 -11
  30. data/app/models/solidus_friendly_promotions/{actions → benefits}/adjust_line_item.rb +6 -2
  31. data/app/models/solidus_friendly_promotions/{actions → benefits}/adjust_line_item_quantity_groups.rb +3 -3
  32. data/app/models/solidus_friendly_promotions/{actions → benefits}/adjust_shipment.rb +6 -2
  33. data/app/models/solidus_friendly_promotions/{actions → benefits}/create_discounted_item.rb +6 -7
  34. data/app/models/solidus_friendly_promotions/calculators/distributed_amount.rb +1 -1
  35. data/app/models/solidus_friendly_promotions/calculators/tiered_flat_rate.rb +1 -1
  36. data/app/models/solidus_friendly_promotions/calculators/tiered_percent.rb +1 -1
  37. data/app/models/solidus_friendly_promotions/calculators/tiered_percent_on_eligible_item_quantity.rb +4 -2
  38. data/app/models/solidus_friendly_promotions/{promotion_rule.rb → condition.rb} +13 -7
  39. data/app/models/solidus_friendly_promotions/condition_product.rb +8 -0
  40. data/app/models/solidus_friendly_promotions/condition_store.rb +8 -0
  41. data/app/models/solidus_friendly_promotions/condition_taxon.rb +8 -0
  42. data/app/models/solidus_friendly_promotions/{promotion_rules_user.rb → condition_user.rb} +2 -2
  43. data/app/models/solidus_friendly_promotions/{rules → conditions}/discounted_item_total.rb +3 -3
  44. data/app/models/solidus_friendly_promotions/{rules → conditions}/first_order.rb +3 -3
  45. data/app/models/solidus_friendly_promotions/{rules → conditions}/first_repeat_purchase_since.rb +3 -3
  46. data/app/models/solidus_friendly_promotions/{rules → conditions}/item_total.rb +5 -5
  47. data/app/models/solidus_friendly_promotions/{rules → conditions}/line_item_option_value.rb +3 -3
  48. data/app/models/solidus_friendly_promotions/{rules → conditions}/line_item_product.rb +8 -8
  49. data/app/models/solidus_friendly_promotions/{rules → conditions}/line_item_taxon.rb +8 -8
  50. data/app/models/solidus_friendly_promotions/{rules → conditions}/minimum_quantity.rb +8 -8
  51. data/app/models/solidus_friendly_promotions/{rules → conditions}/nth_order.rb +5 -5
  52. data/app/models/solidus_friendly_promotions/{rules → conditions}/one_use_per_user.rb +3 -3
  53. data/app/models/solidus_friendly_promotions/{rules → conditions}/option_value.rb +3 -3
  54. data/app/models/solidus_friendly_promotions/{rules → conditions}/product.rb +9 -9
  55. data/app/models/solidus_friendly_promotions/{rules → conditions}/shipping_method.rb +3 -3
  56. data/app/models/solidus_friendly_promotions/{rules → conditions}/store.rb +6 -6
  57. data/app/models/solidus_friendly_promotions/{rules → conditions}/taxon.rb +12 -12
  58. data/app/models/solidus_friendly_promotions/{rules → conditions}/user.rb +7 -7
  59. data/app/models/solidus_friendly_promotions/{rules → conditions}/user_logged_in.rb +3 -3
  60. data/app/models/solidus_friendly_promotions/{rules → conditions}/user_role.rb +3 -3
  61. data/app/models/solidus_friendly_promotions/eligibility_result.rb +1 -1
  62. data/app/models/solidus_friendly_promotions/eligibility_results.rb +7 -7
  63. data/app/models/solidus_friendly_promotions/friendly_promotion_adjuster/discount_order.rb +28 -29
  64. data/app/models/solidus_friendly_promotions/friendly_promotion_adjuster/load_promotions.rb +10 -11
  65. data/app/models/solidus_friendly_promotions/friendly_promotion_adjuster/persist_discounted_order.rb +2 -2
  66. data/app/models/solidus_friendly_promotions/order_promotion.rb +1 -1
  67. data/app/models/solidus_friendly_promotions/permission_sets/friendly_promotion_management.rb +1 -1
  68. data/app/models/solidus_friendly_promotions/promotion.rb +14 -43
  69. data/app/models/solidus_friendly_promotions/promotion_advertiser.rb +10 -0
  70. data/app/models/solidus_friendly_promotions/promotion_code.rb +1 -1
  71. data/app/models/solidus_friendly_promotions/shipping_rate_discount.rb +1 -1
  72. data/app/views/solidus_friendly_promotions/admin/benefit_fields/_adjust_line_item.html.erb +6 -0
  73. data/app/views/solidus_friendly_promotions/admin/{promotion_actions/actions → benefit_fields}/_adjust_line_item_quantity_groups.html.erb +4 -4
  74. data/app/views/solidus_friendly_promotions/admin/benefit_fields/_adjust_shipment.html.erb +6 -0
  75. data/app/views/solidus_friendly_promotions/admin/benefit_fields/_calculator_fields.erb +11 -0
  76. data/app/views/solidus_friendly_promotions/admin/{promotion_actions/actions → benefit_fields}/_create_discounted_item.html.erb +8 -6
  77. data/app/views/solidus_friendly_promotions/admin/benefits/_benefit.html.erb +50 -0
  78. data/app/views/solidus_friendly_promotions/admin/benefits/_calculator_select.html.erb +16 -0
  79. data/app/views/solidus_friendly_promotions/admin/benefits/_form.html.erb +3 -0
  80. data/app/views/solidus_friendly_promotions/admin/benefits/_new_benefit.html.erb +33 -0
  81. data/app/views/solidus_friendly_promotions/admin/benefits/_type_select.html.erb +16 -0
  82. data/app/views/solidus_friendly_promotions/admin/benefits/edit.html.erb +19 -0
  83. data/app/views/solidus_friendly_promotions/admin/benefits/new.html.erb +1 -0
  84. data/app/views/solidus_friendly_promotions/admin/{promotion_actions/calculators → calculator_fields}/_default_fields.html.erb +1 -1
  85. data/app/views/solidus_friendly_promotions/admin/{promotion_actions/calculators → calculator_fields}/distributed_amount/_fields.html.erb +3 -3
  86. data/app/views/solidus_friendly_promotions/admin/calculator_fields/flat_rate/_fields.html.erb +6 -0
  87. data/app/views/solidus_friendly_promotions/admin/calculator_fields/flexi_rate/_fields.html.erb +24 -0
  88. data/app/views/solidus_friendly_promotions/admin/calculator_fields/percent/_fields.html.erb +6 -0
  89. data/app/views/solidus_friendly_promotions/admin/calculator_fields/tiered_flat_rate/_fields.html.erb +32 -0
  90. data/app/views/solidus_friendly_promotions/admin/{promotion_actions/calculators → calculator_fields}/tiered_flat_rate/_tier_fields.html.erb +7 -8
  91. data/app/views/solidus_friendly_promotions/admin/calculator_fields/tiered_percent/_fields.html.erb +47 -0
  92. data/app/views/solidus_friendly_promotions/admin/{promotion_actions/calculators → calculator_fields}/tiered_percent/_tier_fields.html.erb +8 -7
  93. data/app/views/solidus_friendly_promotions/admin/{promotion_actions/calculators → calculator_fields}/tiered_percent_on_eligible_item_quantity/_fields.html.erb +11 -9
  94. data/app/views/solidus_friendly_promotions/admin/calculator_fields/tiered_percent_on_eligible_item_quantity/_tier_fields.html.erb +35 -0
  95. data/app/views/solidus_friendly_promotions/admin/condition_fields/_first_order.html.erb +3 -0
  96. data/app/views/solidus_friendly_promotions/admin/condition_fields/_first_repeat_purchase_since.html.erb +7 -0
  97. data/app/views/solidus_friendly_promotions/admin/condition_fields/_item_total.html.erb +15 -0
  98. data/app/views/solidus_friendly_promotions/admin/condition_fields/_line_item_option_value.html.erb +25 -0
  99. data/app/views/solidus_friendly_promotions/admin/{promotion_rules/rules → condition_fields}/_line_item_product.html.erb +7 -7
  100. data/app/views/solidus_friendly_promotions/admin/condition_fields/_line_item_taxon.html.erb +17 -0
  101. data/app/views/solidus_friendly_promotions/admin/condition_fields/_minimum_quantity.html.erb +5 -0
  102. data/app/views/solidus_friendly_promotions/admin/condition_fields/_nth_order.html.erb +15 -0
  103. data/app/views/solidus_friendly_promotions/admin/condition_fields/_one_use_per_user.html.erb +3 -0
  104. data/app/views/solidus_friendly_promotions/admin/{promotion_rules/rules → condition_fields}/_option_value.html.erb +10 -10
  105. data/app/views/solidus_friendly_promotions/admin/condition_fields/_product.html.erb +28 -0
  106. data/app/views/solidus_friendly_promotions/admin/{promotion_rules/rules → condition_fields}/_shipping_method.html.erb +3 -3
  107. data/app/views/solidus_friendly_promotions/admin/condition_fields/_store.html.erb +9 -0
  108. data/app/views/solidus_friendly_promotions/admin/condition_fields/_taxon.html.erb +28 -0
  109. data/app/views/solidus_friendly_promotions/admin/condition_fields/_user.html.erb +7 -0
  110. data/app/views/solidus_friendly_promotions/admin/condition_fields/_user_logged_in.html.erb +3 -0
  111. data/app/views/solidus_friendly_promotions/admin/condition_fields/_user_role.html.erb +15 -0
  112. data/app/views/solidus_friendly_promotions/admin/condition_fields/line_item_option_value/_option_value_fields.html.erb +21 -0
  113. data/app/views/solidus_friendly_promotions/admin/conditions/_condition.html.erb +26 -0
  114. data/app/views/solidus_friendly_promotions/admin/conditions/_new_condition.html.erb +26 -0
  115. data/app/views/solidus_friendly_promotions/admin/conditions/_type_select.html.erb +20 -0
  116. data/app/views/solidus_friendly_promotions/admin/conditions/new.html.erb +1 -0
  117. data/app/views/solidus_friendly_promotions/admin/promotion_code_batches/_form_fields.html.erb +5 -5
  118. data/app/views/solidus_friendly_promotions/admin/promotions/_form.html.erb +4 -4
  119. data/app/views/solidus_friendly_promotions/admin/promotions/_table_filter.html.erb +6 -6
  120. data/app/views/solidus_friendly_promotions/admin/promotions/edit.html.erb +7 -41
  121. data/app/views/solidus_friendly_promotions/admin/shared/_number_with_currency.html.erb +20 -0
  122. data/app/views/solidus_friendly_promotions/admin/shared/preference_fields/_boolean.html.erb +14 -0
  123. data/app/views/solidus_friendly_promotions/admin/shared/preference_fields/_decimal.html.erb +12 -0
  124. data/app/views/solidus_friendly_promotions/admin/shared/preference_fields/_encrypted_string.html.erb +12 -0
  125. data/app/views/solidus_friendly_promotions/admin/shared/preference_fields/_integer.html.erb +12 -0
  126. data/app/views/solidus_friendly_promotions/admin/shared/preference_fields/_password.html.erb +12 -0
  127. data/app/views/solidus_friendly_promotions/admin/shared/preference_fields/_string.html.erb +12 -0
  128. data/app/views/solidus_friendly_promotions/admin/shared/preference_fields/_text.html.erb +12 -0
  129. data/bin/sandbox +3 -3
  130. data/config/importmap.rb +2 -0
  131. data/config/locales/en.yml +128 -94
  132. data/config/routes.rb +3 -2
  133. data/db/migrate/20231011120928_add_db_comments_to_friendly_promotion_rules_taxons.rb +2 -2
  134. data/db/migrate/20231011142040_add_db_comments_to_friendly_promotion_rules_users.rb +1 -1
  135. data/db/migrate/20231011190222_add_db_comments_to_friendly_promotion_actions.rb +1 -1
  136. data/db/migrate/20240409093831_add_action_reference_to_rules.rb +34 -0
  137. data/db/migrate/20240506142650_remove_promotion_rules_promotion_id.rb +5 -0
  138. data/db/migrate/20240508080834_rename_promotion_rules_to_conditions.rb +19 -0
  139. data/db/migrate/20240508131514_rename_friendly_promotion_actions_to_friendly_benefits.rb +19 -0
  140. data/db/migrate/20240612113608_update_column_comments_for_benefits.rb +31 -0
  141. data/db/migrate/20240612114132_update_column_comments_for_conditions.rb +30 -0
  142. data/db/migrate/20240612115209_update_column_comments_for_condition_stores.rb +23 -0
  143. data/db/migrate/20240612115749_update_column_comments_for_condition_products.rb +22 -0
  144. data/db/migrate/20240612120411_update_column_comments_for_condition_taxons.rb +24 -0
  145. data/db/migrate/20240612121049_update_column_comments_for_condition_users.rb +23 -0
  146. data/lib/generators/solidus_friendly_promotions/install/templates/initializer.rb +30 -30
  147. data/lib/solidus_friendly_promotions/configuration.rb +11 -3
  148. data/lib/solidus_friendly_promotions/migrate_adjustments.rb +11 -11
  149. data/lib/solidus_friendly_promotions/promotion_map.rb +17 -17
  150. data/lib/solidus_friendly_promotions/promotion_migrator.rb +16 -16
  151. data/lib/solidus_friendly_promotions/testing_support/factories/friendly_promotion_factory.rb +8 -34
  152. data/lib/solidus_friendly_promotions/testing_support/factories/friendly_shipping_rate_discount_factory.rb +2 -2
  153. data/lib/solidus_friendly_promotions/version.rb +1 -1
  154. data/lib/tasks/solidus_friendly_promotions/migrate_adjustments.rake +2 -2
  155. data/solidus_friendly_promotions.gemspec +2 -2
  156. metadata +114 -86
  157. data/.rubocop_todo.yml +0 -157
  158. data/app/controllers/solidus_friendly_promotions/admin/promotion_actions_controller.rb +0 -103
  159. data/app/controllers/solidus_friendly_promotions/admin/promotion_rules_controller.rb +0 -105
  160. data/app/helpers/solidus_friendly_promotions/admin/promotion_actions_helper.rb +0 -23
  161. data/app/helpers/solidus_friendly_promotions/admin/promotion_rules_helper.rb +0 -25
  162. data/app/models/solidus_friendly_promotions/products_promotion_rule.rb +0 -8
  163. data/app/models/solidus_friendly_promotions/promotion_rules_store.rb +0 -8
  164. data/app/models/solidus_friendly_promotions/promotion_rules_taxon.rb +0 -8
  165. data/app/views/solidus_friendly_promotions/admin/promotion_actions/_calculator_select.html.erb +0 -16
  166. data/app/views/solidus_friendly_promotions/admin/promotion_actions/_form.html.erb +0 -3
  167. data/app/views/solidus_friendly_promotions/admin/promotion_actions/_promotion_action.html.erb +0 -29
  168. data/app/views/solidus_friendly_promotions/admin/promotion_actions/_type_select.html.erb +0 -14
  169. data/app/views/solidus_friendly_promotions/admin/promotion_actions/actions/_adjust_line_item.html.erb +0 -6
  170. data/app/views/solidus_friendly_promotions/admin/promotion_actions/actions/_adjust_shipment.html.erb +0 -6
  171. data/app/views/solidus_friendly_promotions/admin/promotion_actions/actions/_calculator_fields.erb +0 -9
  172. data/app/views/solidus_friendly_promotions/admin/promotion_actions/calculators/flat_rate/_fields.html.erb +0 -6
  173. data/app/views/solidus_friendly_promotions/admin/promotion_actions/calculators/tiered_flat_rate/_fields.html.erb +0 -34
  174. data/app/views/solidus_friendly_promotions/admin/promotion_actions/calculators/tiered_percent/_fields.html.erb +0 -34
  175. data/app/views/solidus_friendly_promotions/admin/promotion_actions/calculators/tiered_percent_on_eligible_item_quantity/_tier_fields.html.erb +0 -27
  176. data/app/views/solidus_friendly_promotions/admin/promotion_actions/edit.html.erb +0 -23
  177. data/app/views/solidus_friendly_promotions/admin/promotion_actions/new.html.erb +0 -26
  178. data/app/views/solidus_friendly_promotions/admin/promotion_rules/_promotion_rule.html.erb +0 -22
  179. data/app/views/solidus_friendly_promotions/admin/promotion_rules/_type_select.html.erb +0 -20
  180. data/app/views/solidus_friendly_promotions/admin/promotion_rules/new.html.erb +0 -24
  181. data/app/views/solidus_friendly_promotions/admin/promotion_rules/rules/_first_order.html.erb +0 -3
  182. data/app/views/solidus_friendly_promotions/admin/promotion_rules/rules/_first_repeat_purchase_since.html.erb +0 -6
  183. data/app/views/solidus_friendly_promotions/admin/promotion_rules/rules/_item_total.html.erb +0 -17
  184. data/app/views/solidus_friendly_promotions/admin/promotion_rules/rules/_line_item_option_value.html.erb +0 -25
  185. data/app/views/solidus_friendly_promotions/admin/promotion_rules/rules/_line_item_taxon.html.erb +0 -17
  186. data/app/views/solidus_friendly_promotions/admin/promotion_rules/rules/_minimum_quantity.html.erb +0 -5
  187. data/app/views/solidus_friendly_promotions/admin/promotion_rules/rules/_nth_order.html.erb +0 -15
  188. data/app/views/solidus_friendly_promotions/admin/promotion_rules/rules/_one_use_per_user.html.erb +0 -3
  189. data/app/views/solidus_friendly_promotions/admin/promotion_rules/rules/_product.html.erb +0 -44
  190. data/app/views/solidus_friendly_promotions/admin/promotion_rules/rules/_store.html.erb +0 -9
  191. data/app/views/solidus_friendly_promotions/admin/promotion_rules/rules/_taxon.html.erb +0 -44
  192. data/app/views/solidus_friendly_promotions/admin/promotion_rules/rules/_user.html.erb +0 -7
  193. data/app/views/solidus_friendly_promotions/admin/promotion_rules/rules/_user_logged_in.html.erb +0 -3
  194. data/app/views/solidus_friendly_promotions/admin/promotion_rules/rules/_user_role.html.erb +0 -15
  195. 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,3 +0,0 @@
1
- <p>
2
- <%= promotion_rule.class.human_attribute_name(:description) %>
3
- </p>
@@ -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>