Submit social housing lettings and sales data (CORE)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

61 lines
2.6 KiB

<% content_for :head do %>
<meta name="turbo-cache-control" content="no-cache">
<% end %>
<% content_for :title, @page.header.present? ? @page.header : @page.questions.first().header.html_safe %>
<% content_for :before_content do %>
<%= govuk_back_link(
text: 'Back',
href: 'javascript:history.back()',
) %>
<% end %>
<div data-controller="govukfrontend"></div>
<%= turbo_frame_tag "case_log_form", target: "_top" do %>
<%= form_with model: @case_log, url: form_case_log_path(@case_log), method: "post" do |f| %>
<div class="govuk-grid-row">
<div class=<%= @page.questions[0].type == "interruption_screen" ? "govuk-grid-column-full-from-desktop" : "govuk-grid-column-two-thirds-from-desktop"%>>
<% remove_other_page_errors(@case_log, @page) %>
<%= f.govuk_error_summary %>
<% if @page.header.present? %>
<h1 class="govuk-heading-l">
<% if !@page.hide_subsection_label %>
<span class="govuk-caption-l"><%= @subsection.label %></span>
<% end %>
<%= @page.header %>
</h1>
<% end %>
<% if @page.description.present? %>
<p class="govuk-body govuk-body-m"><%= @page.description.html_safe %></p>
<% end %>
<% @page.non_conditional_questions.map do |question| %>
<div id=<%= question.id + "_div " %><%= display_question_key_div(@page, question) %> >
<% if question.read_only? %>
<hr class="govuk-section-break govuk-section-break--visible govuk-section-break--m">
<% end %>
<% if question.type == "interruption_screen" %>
<%= render partial: "form/#{question.type}_question", locals: { question: question, caption_text: @subsection.label, page_header: @page.header, case_log: @case_log, title_text: @page.title_text, informative_text: @page.informative_text, form: @form, f: f, conditional: false } %>
<% else %>
<%= render partial: "form/#{question.type}_question", locals: { question: question, caption_text: @subsection.label, page_header: @page.header, case_log: @case_log, f: f, conditional: false } %>
<% end %>
</div>
<% end %>
<%= f.hidden_field :page, value: @page.id %>
<% if @case_log.form.is_last_question?(@page, @subsection, @case_log) %>
<%= f.govuk_submit "Submit lettings log", accesskey: "s" %>
<%else %>
<% if !@page.id.include?("value_check") %>
<%= f.govuk_submit "Save and continue", accesskey: "s" %>
<% end %>
<%end %>
</div>
</div>
<% end %>
<% end %>