Skip to content

Commit

Permalink
Move heads of terms review into new layout
Browse files Browse the repository at this point in the history
  • Loading branch information
benjamineskola committed Nov 22, 2024
1 parent 490765b commit bf26dae
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 131 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,6 @@
module PlanningApplications
module Review
class HeadsOfTermsController < BaseController
def show
respond_to do |format|
format.html
end
end

def edit
respond_to do |format|
format.html
end
end

def update
respond_to do |format|
format.html do
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<%= form_with model: @planning_application.heads_of_term,
url: planning_application_review_heads_of_term_path(@planning_application),
class: "govuk-!-margin-top-7" do |form| %>
url: planning_application_review_heads_of_terms_path(@planning_application) do |form| %>
<%= form.govuk_error_summary %>
<% if current_review = heads_of_term.current_review %>
Expand All @@ -9,44 +8,23 @@
<%= review_form.govuk_radio_button(
:action, :accepted,
checked: current_review.accepted?,
label: {text: "Accept"},
disabled: !editable
label: {text: "Accept"}
) %>
<%= review_form.govuk_radio_button(
:action, :edited_and_accepted,
checked: current_review.edited_and_accepted?,
label: {text: "Edit to accept", id: "edit-to-accept"},
hint: {text: "You can only edit minor changes such as spelling errors which have no effect on the content of the accepted terms. Further changes need to be done by case officers."},
disabled: !editable
) do %>
<%= form.govuk_check_boxes_fieldset :heads_of_term, multiple: false, legend: {text: "Heads of terms"} do %>
<%= form.fields_for :terms, heads_of_term.terms do |fields| %>
<%= fields.govuk_check_box :true, false, multiple: false, label: {text: fields.object.title}, checked: fields.object.checked?, class: "term", link_errors: true, disabled: !editable do %>
<%= fields.hidden_field :id %>
<%= fields.govuk_text_field :title, label: {text: "Enter a title"}, disabled: !editable %>
<%= fields.govuk_text_area :text, label: {text: "Enter detail"}, disabled: !editable %>
<% end %>
<% end %>
<% end %>
<% end %>
<%= review_form.govuk_radio_button(
:action, :rejected,
checked: current_review.rejected?,
label: {text: "Return to officer with comment"},
disabled: !editable
label: {text: "Return to officer with comment"}
) do %>
<%= review_form.govuk_text_area(
:comment, value: current_review.comment,
rows: 6, label: {text: "Comment"},
disabled: !editable
rows: 6, label: {text: "Comment"}
) %>
<% end %>
<% end %>
<% end %>
<% if review_complete? %>
<% if @planning_application.review_complete? %>
<div class="govuk-grid-row govuk-!-margin-bottom-7">
<div class="govuk-grid-column-full">
<p class="govuk-body govuk">
Expand All @@ -59,12 +37,6 @@
<% end %>

<div class="govuk-button-group">
<% if editable %>
<%= form.submit "Save and mark as complete", class: "govuk-button", data: {module: "govuk-button"} %>
<%= form.submit "Save and come back later", class: "govuk-button govuk-button--secondary", data: {module: "govuk-button"} %>
<% else %>
<%= govuk_link_to "Edit recommendation", edit_planning_application_review_heads_of_term_path(@planning_application), class: "govuk-body" %>
<% end %>
<%= back_link %>
<%= form.submit "Save and mark as complete", class: "govuk-button", data: {module: "govuk-button"} %>
</div>
<% end %>

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,28 +1,56 @@
<%= bops_task_accordion(id: "review-conditions-section") do |accordion| %>
<% accordion.with_heading(text: "Review conditions") %>
<% if @planning_application.review_heads_of_terms? %>
<% accordion.with_section(id: "check-heads-of-terms", expanded: false) do |section| %>
<%= section.with_heading(text: "Check Heads of Terms") %>
<%= section.with_status do %>
<%= render(StatusTags::ReviewComponent.new(review_item: @planning_application.heads_of_term.current_review)) %>
<% end %>
<% section.with_block do %>
<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds">
<%= render "planning_applications/review/heads_of_terms/terms_summary" %>

<h3 class="govuk-heading-s">
Submitted recommendation
</h3>
<p class="govuk-body">
by <%= @planning_application.user&.name %>, <%= @planning_application.in_assessment_at.to_fs %>
</p>

<%= render(ReviewerCommentComponent.new(comment: @planning_application.heads_of_term.current_review)) %>
</div>
</div>
<% end %>
<%= section.with_footer do %>
<%= render(partial: "planning_applications/review/heads_of_terms/form",
locals: {heads_of_term: @planning_application.heads_of_term}) %>
<% end %>
<% end %>
<% end %>
<% if @planning_application.application_type.planning_conditions? %>
<% if @planning_application.condition_set&.current_review&.started? %>
<%= accordion.with_section(id: "review-conditions", expanded: @planning_application.condition_set.errors.any?) do |section| %>
<% section.with_heading(text: "Review conditions") %>
<%= accordion.with_section(id: "review-conditions", expanded: @planning_application.condition_set.errors.any?) do |section| %>
<% section.with_heading(text: "Review conditions") %>
<% section.with_status do %>
<%= render(
StatusTags::ReviewComponent.new(
review_item: @planning_application.condition_set.current_review,
updated: @planning_application.condition_set.current_review&.status == "updated"
)
) %>
<% end %>
<% section.with_status do %>
<%= render(
StatusTags::ReviewComponent.new(
review_item: @planning_application.condition_set.current_review,
updated: @planning_application.condition_set.current_review&.status == "updated"
)
) %>
<% end %>
<% section.with_block do %>
<%= render(partial: "planning_applications/review/conditions/conditions_table") %>
<% end %>
<% section.with_block do %>
<%= render(partial: "planning_applications/review/conditions/conditions_table") %>
<% end %>
<% section.with_footer do %>
<%= render(partial: "planning_applications/review/conditions/form") %>
<% end %>
<% section.with_footer do %>
<%= render(partial: "planning_applications/review/conditions/form") %>
<% end %>
<% end %>
<% end %>
<% end %>
<% end %>
Expand All @@ -45,13 +73,6 @@
)
) %>
<% end %>
<% if @planning_application.review_heads_of_terms? %>
<%= render(
TaskListItems::Reviewing::HeadsOfTermsComponent.new(
planning_application: @planning_application
)
) %>
<% end %>
<% if @planning_application.review_permitted_development_rights? %>
<%= render(
TaskListItems::Reviewing::PermittedDevelopmentRightComponent.new(
Expand Down
6 changes: 1 addition & 5 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -284,11 +284,7 @@
end
end

resources :heads_of_terms do
get :edit, on: :collection
get :show, on: :collection
patch :update, on: :collection
end
resource :heads_of_terms, only: %i[update]

resources :immunity_details, only: %i[edit update show]

Expand Down

0 comments on commit bf26dae

Please sign in to comment.