<% columns = @preview_form.responses.map(&:question).any?(&:matrix?) ? 9 : 6 %>

<%= translated_attribute questionnaire.title %>

<%= decidim_sanitize_translated questionnaire.description %>
<%= decidim_form_for(@preview_form, url: "", method: :post, authenticity_token: !defined?(skip_authenticity_token), html: { class: "form form-defaults answer-questionnaire" }, data: { "safe-path" => "" }) do |form| %> <%= invisible_captcha %> <% answer_idx = 0 %> <% cleaned_answer_idx = 0 %> <% @preview_form.responses_by_step.each_with_index do |step_answers, step_index| %>
" data-toggler=".hide">
<% if @preview_form.total_steps > 1 %>

<%= t(".current_step", step: step_index + 1) %> <%= t(".of_total_steps", total_steps: @preview_form.total_steps) %>

<% end %> <% step_answers.each do |answer| %>
<%= fields_for "questionnaire[responses][#{answer_idx}]", answer do |answer_form| %> <%= render( "decidim/forms/questionnaires/answer", answer_form:, answer:, answer_idx:, cleaned_answer_idx:, disabled: false ) %> <% end %>
<% if !answer.question.separator? %> <% cleaned_answer_idx += 1 %> <% end %> <% answer_idx += 1 %> <% end %> <% if step_index + 1 == @preview_form.total_steps %>
<%= form.check_box :tos_agreement, label: t(".tos_agreement"), id: "questionnaire_tos_agreement", disabled: false %>
<%= decidim_sanitize_translated questionnaire.tos %>
<% end %>
<%= cell( "decidim/forms/step_navigation", step_index, total_steps: @preview_form.total_steps, button_disabled: true, form: ) %>
<% end %> <% end %>
<%= append_stylesheet_pack_tag "decidim_templates" %>