<commit_before>= f.simple_fields_for method, (address || f.object.send(method) || f.object.addresses.build(:category => method.to_s.gsub('_address', ''))), (EffectiveAddresses.simple_form_options || {}) do |fa|
  - uuid = fa.object_id
  - method = method.to_sym
  - shipping_address_same_as_billing = (fa.object.category == 'shipping') && (f.object.try(:shipping_address_same_as_billing?) || false)

  - if ((f.object.errors.include?(method) && !f.object.errors.include?(:addresses)) rescue false)
    - fa.object.errors.add(:address1, f.object.errors[method].first)

  - if fa.object.category == 'shipping' && f.object.respond_to?(:shipping_address_same_as_billing?)
    = fa.input :shipping_address_same_as_billing,
      as: :boolean,
      label: 'My shipping address is the same as my billing address',
      required: false,
      input_html: { checked: shipping_address_same_as_billing }

  - field_order.each do |field|

    - case field
      - when :full_name
        - if use_full_name || fa.object.errors.include?(:full_name)
          = fa.input :full_name,
            required: required,
            disabled: shipping_address_same_as_billing,
            wrapper_html: { style: ('display: none;' if shipping_address_same_as_billing) }

      - when :address1
        = fa.input :address1,
          required: required,
          disabled: shipping_address_same_as_billing,
          wrapper_html: { style: ('display: none;' if shipping_address_same_as_billing) }

      - when :address2
        = fa.input :address2,
          required: false,
          disabled: shipping_address_same_as_billing,
          wrapper_html: { style: ('display: none;' if shipping_address_same_as_billing) }

      - when :city
        = fa.input :city,
          required: required,
          input_html: { 'data-effective-address-city' => uuid },
          disabled: shipping_address_same_as_billing,
          wrapper_html: { style: ('display: none;' if shipping_address_same_as_billing) }

      - when :country_code
        = fa.input :country_code,
          as: (defined?(EffectiveFormInputs) ? :effective_select : :select),
          required: required,
          collection: region_options_for_simple_form_select(),
          input_html: {'data-effective-address-country' => uuid},
          disabled: shipping_address_same_as_billing,
          wrapper_html: { style: ('display: none;' if shipping_address_same_as_billing) }

      - when :state_code
        - if fa.object.try(:country_code).present?
          = fa.input :state_code,
            as: (defined?(EffectiveFormInputs) ? :effective_select : :select),
            required: required,
            collection: region_options_for_simple_form_select(Carmen::Country.coded(fa.object.country_code).subregions),
            prompt: 'Please choose',
            input_html: {'data-effective-address-state' => uuid},
            input_js: { placeholder: 'Please choose' },
            disabled: shipping_address_same_as_billing,
            wrapper_html: { style: ('display: none;' if shipping_address_same_as_billing) }
        - else
          = fa.input :state_code,
            as: (defined?(EffectiveFormInputs) ? :effective_select : :select),
            required: required,
            collection: [],
            prompt: 'Please choose a country first',
            input_html: { 'data-effective-address-state' => uuid },
            input_js: { placeholder: 'Please choose a country first' },
            disabled: true,
            wrapper_html: { style: ('display: none;' if shipping_address_same_as_billing) }

      - when :postal_code
        = fa.input :postal_code,
          required: required,
          input_html: { 'data-effective-address-postal-code' => uuid },
          disabled: shipping_address_same_as_billing,
          wrapper_html: { style: ('display: none;' if shipping_address_same_as_billing) }
<commit_msg>Put 'my shipping address same as billing' on bottom<commit_after>= f.simple_fields_for method, (address || f.object.send(method) || f.object.addresses.build(:category => method.to_s.gsub('_address', ''))), (EffectiveAddresses.simple_form_options || {}) do |fa|
  - uuid = fa.object_id
  - method = method.to_sym
  - shipping_address_same_as_billing = (fa.object.category == 'shipping') && (f.object.try(:shipping_address_same_as_billing?) || false)

  - if ((f.object.errors.include?(method) && !f.object.errors.include?(:addresses)) rescue false)
    - fa.object.errors.add(:address1, f.object.errors[method].first)

  - field_order.each do |field|

    - case field
      - when :full_name
        - if use_full_name || fa.object.errors.include?(:full_name)
          = fa.input :full_name,
            required: required,
            disabled: shipping_address_same_as_billing,
            wrapper_html: { style: ('display: none;' if shipping_address_same_as_billing) }

      - when :address1
        = fa.input :address1,
          required: required,
          disabled: shipping_address_same_as_billing,
          wrapper_html: { style: ('display: none;' if shipping_address_same_as_billing) }

      - when :address2
        = fa.input :address2,
          required: false,
          disabled: shipping_address_same_as_billing,
          wrapper_html: { style: ('display: none;' if shipping_address_same_as_billing) }

      - when :city
        = fa.input :city,
          required: required,
          input_html: { 'data-effective-address-city' => uuid },
          disabled: shipping_address_same_as_billing,
          wrapper_html: { style: ('display: none;' if shipping_address_same_as_billing) }

      - when :country_code
        = fa.input :country_code,
          as: (defined?(EffectiveFormInputs) ? :effective_select : :select),
          required: required,
          collection: region_options_for_simple_form_select(),
          input_html: {'data-effective-address-country' => uuid},
          disabled: shipping_address_same_as_billing,
          wrapper_html: { style: ('display: none;' if shipping_address_same_as_billing) }

      - when :state_code
        - if fa.object.try(:country_code).present?
          = fa.input :state_code,
            as: (defined?(EffectiveFormInputs) ? :effective_select : :select),
            required: required,
            collection: region_options_for_simple_form_select(Carmen::Country.coded(fa.object.country_code).subregions),
            prompt: 'Please choose',
            input_html: {'data-effective-address-state' => uuid},
            input_js: { placeholder: 'Please choose' },
            disabled: shipping_address_same_as_billing,
            wrapper_html: { style: ('display: none;' if shipping_address_same_as_billing) }
        - else
          = fa.input :state_code,
            as: (defined?(EffectiveFormInputs) ? :effective_select : :select),
            required: required,
            collection: [],
            prompt: 'Please choose a country first',
            input_html: { 'data-effective-address-state' => uuid },
            input_js: { placeholder: 'Please choose a country first' },
            disabled: true,
            wrapper_html: { style: ('display: none;' if shipping_address_same_as_billing) }

      - when :postal_code
        = fa.input :postal_code,
          required: required,
          input_html: { 'data-effective-address-postal-code' => uuid },
          disabled: shipping_address_same_as_billing,
          wrapper_html: { style: ('display: none;' if shipping_address_same_as_billing) }

  - if fa.object.category == 'shipping' && f.object.respond_to?(:shipping_address_same_as_billing?)
    = fa.input :shipping_address_same_as_billing,
      as: :boolean,
      label: 'My shipping address is the same as my billing address',
      required: false,
      input_html: { checked: shipping_address_same_as_billing }

{'fraction_non_alphanumeric': 0.1153355447818321, 'fraction_numerical': 0.0012758356723653994, 'mean_word_length': 2.852088452088452, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5396369', 'n_tokens_mistral': 2332, 'n_tokens_neox': 2332, 'n_words': 454}