<commit_before><% address_id = address_type.chars.first %>
<% country_id = address_type == 'billing' ? 'bcountry' : 'scountry' %>
<% ADDRESS_FIELDS.each do |field| %>
  <% if field == "country" %>

  <p class="field" id=<%="#{address_id}country" %>>
    <%= address_form.label :country_id, t(:country) %><span class="required">*</span><br />
    <span id=<%="#{address_id}country-selection" %>>
      <%= address_form.collection_select :country_id, available_countries, :id, :name, {}, {:class => 'required'} %>
    </span>

  </p>
  <% elsif field == "state" && Spree::Config[:address_requires_state] %>

    <p class="field" id=<%="#{address_id}state" %>>
      <% have_states = !address.country.states.empty? %>
      <%= address_form.label :state, t(:state) %><span class='required' id=<%="#{address_id}state-required"%>>*</span><br/>

      <% state_elements = [
         address_form.collection_select(:state_id, address.country.states,
                            :id, :name,
                            {:include_blank => true},
                            {:class => have_states ? 'required' : 'hidden',
                            :disabled => !have_states}) +
         address_form.text_field(:state_name,
                            :class => !have_states ? 'required' : 'hidden',
                            :disabled => have_states)
         ].join.gsub('"', "'").gsub("\n", "")
      %>
      <%= javascript_tag do -%>
        $('#<%="#{address_id}state" %>').append("<%== state_elements %>");
      <% end %>
    </p>
      <noscript>
        <%= address_form.text_field :state_name, :class => 'required' %>
      </noscript>

  <% else %>
    <% next if field == "company" && !Spree::Config[:company] %>
    <%= address_field(address_form, field.to_sym, address_name) %>
  <% end %>
<% end %>
<% if Spree::Config["alternative_#{address_name[0] == 'b' ? 'billing' : 'shipping'}_phone"] %>
  <%= address_field(address_form, :alternative_phone, address_name) %>
<% end %><commit_msg>Restore address form in the original concept<commit_after><% address_id = address_type.chars.first %>

<% ADDRESS_FIELDS.each do |field| %>
  <% if field == "country" %>
    <p class="field" id="<%= "#{address_id}country" %>">
      <%= address_form.label :country_id, Spree.t(:country) %><span class="required">*</span><br />
      <span id="<%= "#{address_id}country-selection" %>">
        <%= address_form.collection_select :country_id, available_countries, :id, :name, {}, {:class => 'required'} %>
      </span>
    </p>
  <% elsif field == "state" && Spree::Config[:address_requires_state] %>
    <%= address_field(address_form, :state, address_id) { address_state(address_form, address.country, address_id) } %>
  <% else %>
    <% next if field == "company" && !Spree::Config[:company] %>
    <% next if field == "alternative_#{address_id}_phone" && !Spree::Config["alternative_#{address_id}_phone"] %>
    <%= address_field(address_form, field.to_sym, address_id) %>
  <% end %>
<% end %>
{'fraction_non_alphanumeric': 0.20701168614357263, 'fraction_numerical': 0.000333889816360601, 'mean_word_length': 3.3294797687861273, 'pattern_counts': {'":': 0, '<': 66, '<?xml version=': 0, '>': 74, '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': '5987960', 'n_tokens_mistral': 1044, 'n_tokens_neox': 971, 'n_words': 165}