Don't show terms of service unless required

This commit is contained in:
Matt-Yorkley
2022-01-12 22:11:31 +00:00
parent 18cdf98aa1
commit f8efff9a4e
2 changed files with 12 additions and 7 deletions

View File

@@ -16,6 +16,10 @@ module TermsAndConditionsHelper
end
end
def any_terms_required?(distributor)
TermsOfService.required?(distributor)
end
def platform_terms_required?
TermsOfService.platform_terms_required?
end

View File

@@ -71,15 +71,16 @@
= render 'spree/orders/summary', order: @order
%div.checkout-substep.medium-6
%div.checkout-input
= f.check_box :accept_terms, { id: "accept_terms", name: "accept_terms", "checked": "#{all_terms_and_conditions_already_accepted?}" }, 1, nil
= f.label :accept_terms, t('split_checkout.step3.terms_and_conditions.message_html', terms_and_conditions_link: link_to( t("split_checkout.step3.terms_and_conditions.link_text"), @order.distributor.terms_and_conditions.url, target: '_blank'), tos_link: link_to_platform_terms), { for: "accept_terms" }
- if any_terms_required?(@order.distributor)
%div.checkout-substep.medium-6
%div.checkout-input
= f.check_box :accept_terms, { id: "accept_terms", name: "accept_terms", "checked": "#{all_terms_and_conditions_already_accepted?}" }, 1, nil
= f.label :accept_terms, t('split_checkout.step3.terms_and_conditions.message_html', terms_and_conditions_link: link_to( t("split_checkout.step3.terms_and_conditions.link_text"), @order.distributor.terms_and_conditions.url, target: '_blank'), tos_link: link_to_platform_terms), { for: "accept_terms" }
= f.error_message_on :terms_and_conditions, standalone: true
= f.error_message_on :terms_and_conditions, standalone: true
%div.checkout-input
= t("split_checkout.step3.agree")
%div.checkout-input
= t("split_checkout.step3.agree")
%div.checkout-submit.medium-6
= f.submit t("split_checkout.step3.submit"), name: "confirm_order", class: "button primary", disabled: @terms_and_conditions_accepted == false || @platform_tos_accepted == false