Skip to content

Commit

Permalink
Merge pull request #2040 from unboxed/review-cil
Browse files Browse the repository at this point in the history
Move CIL review to new layout
  • Loading branch information
benjamineskola authored Nov 21, 2024
2 parents 5913898 + 0a91644 commit 55c9b91
Show file tree
Hide file tree
Showing 8 changed files with 83 additions and 169 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,6 @@
module PlanningApplications
module Review
class CilLiabilityController < BaseController
def edit
respond_to do |format|
format.html
end
end

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

def update
@previous_decision = @planning_application.cil_liable
if @planning_application.update(cil_liability_params)
Expand All @@ -28,7 +16,7 @@ def update
private

def cil_liability_params
params.require(:planning_application).permit([:cil_liable])
params.permit(planning_application: [:cil_liable]).fetch(:planning_application, {})
end

def record_audit_for_cil_liability!
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
<%= form_with model: [@planning_application],
<%= form_with model: @planning_application,
url: planning_application_review_cil_liability_url(@planning_application),
class: "govuk-!-margin-top-7" do |form| %>
<%= form.govuk_error_summary %>

<%= render "planning_applications/review/cil_liability/audit_trail" %>

<%= form.govuk_radio_buttons_fieldset(
:cil_liability,
legend: {text: "Is the application liable for CIL?", size: "s"}
Expand All @@ -23,6 +25,5 @@
data: {module: "govuk-button"},
disabled: local_assigns.fetch(:disabled, false)
) %>
<%= govuk_button_link_to "Back", planning_application_review_tasks_path(@planning_application), secondary: true %>
</div>
<% end %>
31 changes: 0 additions & 31 deletions app/views/planning_applications/review/cil_liability/edit.html.erb

This file was deleted.

51 changes: 0 additions & 51 deletions app/views/planning_applications/review/cil_liability/show.html.erb

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
<h2 class="app-task-list__section govuk-!-margin-top-8">
Review assessment
</h2>
<ul class="app-task-list__items" id="review-assessment-section">
<li class="app-task-list__item">
<span class="app-task-list__task-name">
<%= govuk_link_to "Check Community Infrastructure Levy (CIL)", planning_application_review_cil_liability_path(@planning_application) %>
</span>
<div class="govuk-task-list__status app-task-list__task-tag">
<%= render(
StatusTags::BaseComponent.new(
status: (@planning_application.audits.review_cil_liability.any? ? :complete : :not_started)
)
) %>
</div>
</li>
</ul>
<%= bops_task_accordion(id: "review-assessment") do |accordion| %>
<% accordion.with_heading(text: "Review assessment") %>
<% accordion.with_section(id: "check-cil", expanded: false) do |section| %>
<%= section.with_heading(text: "Check Community Infrastructure Levy (CIL)") %>
<%= section.with_status do %>
<%= render(
StatusTags::BaseComponent.new(
status: (@planning_application.audits.review_cil_liability.any? ? :complete : :not_started)
)
) %>
<% end %>
<%= section.with_footer do %>
<%= render(partial: "planning_applications/review/cil_liability/form") %>
<% end %>
<% end %>
<% end %>
2 changes: 1 addition & 1 deletion config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@

resources :tasks, only: :index

resource :cil_liability, only: %i[edit update show], controller: :cil_liability
resource :cil_liability, only: %i[update], controller: :cil_liability

resources :committee_decisions, only: %i[edit show update] do
resources :notifications do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,25 +31,25 @@
it "the reviewer can mark it as not needing confirmation" do
visit "planning_applications/#{planning_application.id}/review/tasks"

expect(page).to have_list_item_for(
"Check Community Infrastructure Levy (CIL)",
with: "Not started"
)
within "#check-cil" do
expect(page).to have_content "Not started"
end

click_link "Check Community Infrastructure Levy (CIL)"
click_button "Check Community Infrastructure Levy (CIL)"

expect(page).to have_content "The validation officer did not confirm whether the application is liable for CIL."

click_button "Save and mark as complete"
within "#check-cil" do
click_button "Save and mark as complete"
end

expect(page).to have_content "Review of CIL liability successfully updated"

expect(page).to have_list_item_for(
"Check Community Infrastructure Levy (CIL)",
with: "Completed"
)
within "#check-cil" do
expect(page).to have_content "Completed"
end

click_link "Check Community Infrastructure Levy (CIL)"
click_button "Check Community Infrastructure Levy (CIL)"

expect(page).to have_content "The validation officer had not confirmed whether the application was liable"
expect(page).to have_content "Reviewer marked application as not needing confirmation for CIL liability"
Expand All @@ -58,29 +58,27 @@
it "the reviewer can update it" do
visit "planning_applications/#{planning_application.id}/review/tasks"

expect(page).to have_list_item_for(
"Check Community Infrastructure Levy (CIL)",
with: "Not started"
)
within "#check-cil" do
expect(page).to have_content "Not started"
end

click_link "Check Community Infrastructure Levy (CIL)"
click_button "Check Community Infrastructure Levy (CIL)"

expect(page).to have_content "The validation officer did not confirm whether the application is liable for CIL."

click_link "Change CIL liability"

choose "Yes"

click_button "Save and mark as complete"
within "#check-cil" do
click_button "Save and mark as complete"
end

expect(page).to have_content "Review of CIL liability successfully updated"

expect(page).to have_list_item_for(
"Check Community Infrastructure Levy (CIL)",
with: "Completed"
)
within "#check-cil" do
expect(page).to have_content "Completed"
end

click_link "Check Community Infrastructure Levy (CIL)"
click_button "Check Community Infrastructure Levy (CIL)"

expect(page).to have_content "The validation officer had not confirmed whether the application was liable"
expect(page).to have_content "Reviewer marked application as liable for CIL"
Expand All @@ -95,25 +93,25 @@
it "the reviewer can mark it as correct" do
visit "planning_applications/#{planning_application.id}/review/tasks"

expect(page).to have_list_item_for(
"Check Community Infrastructure Levy (CIL)",
with: "Not started"
)
within "#check-cil" do
expect(page).to have_content "Not started"
end

click_link "Check Community Infrastructure Levy (CIL)"
click_button "Check Community Infrastructure Levy (CIL)"

expect(page).to have_content "The validation officer marked this application as liable for CIL"

click_button "Save and mark as complete"
within "#check-cil" do
click_button "Save and mark as complete"
end

expect(page).to have_content "Review of CIL liability successfully updated"

expect(page).to have_list_item_for(
"Check Community Infrastructure Levy (CIL)",
with: "Completed"
)
within "#check-cil" do
expect(page).to have_content "Completed"
end

click_link "Check Community Infrastructure Levy (CIL)"
click_button "Check Community Infrastructure Levy (CIL)"

expect(page).to have_content "Previously marked as liable by validation officer"
expect(page).to have_content "Reviewer marked application as liable for CIL"
Expand All @@ -122,29 +120,27 @@
it "the reviewer can change it" do
visit "planning_applications/#{planning_application.id}/review/tasks"

expect(page).to have_list_item_for(
"Check Community Infrastructure Levy (CIL)",
with: "Not started"
)
within "#check-cil" do
expect(page).to have_content "Not started"
end

click_link "Check Community Infrastructure Levy (CIL)"
click_button "Check Community Infrastructure Levy (CIL)"

expect(page).to have_content "The validation officer marked this application as liable for CIL"

click_link "Change CIL liability"

choose "No"

click_button "Save and mark as complete"
within "#check-cil" do
click_button "Save and mark as complete"
end

expect(page).to have_content "Review of CIL liability successfully updated"

expect(page).to have_list_item_for(
"Check Community Infrastructure Levy (CIL)",
with: "Completed"
)
within "#check-cil" do
expect(page).to have_content "Completed"
end

click_link "Check Community Infrastructure Levy (CIL)"
click_button "Check Community Infrastructure Levy (CIL)"

expect(page).to have_content "Previously marked as liable by validation officer"
expect(page).to have_content "Reviewer marked application as not liable for CIL"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@
choose "Accept"
end

click_button "Save and mark as complete"
within "#check-neighbour-notifications" do
click_button "Save and mark as complete"
end

expect(page).to have_content("Review of neighbour responses successfully added")

Expand All @@ -80,7 +82,9 @@
fill_in "Explain why notifications are incomplete.", with: "Notify more people"
end

click_button "Save and mark as complete"
within "#check-neighbour-notifications" do
click_button "Save and mark as complete"
end

expect(page).to have_content("Review of neighbour responses successfully added")

Expand Down Expand Up @@ -139,7 +143,9 @@

click_button "Check neighbour notifications"

click_button "Save and mark as complete"
within "#check-neighbour-notifications" do
click_button "Save and mark as complete"
end

within(".govuk-notification-banner--alert") do
expect(page).to have_content("There is a problem")
Expand All @@ -155,7 +161,9 @@

choose "Return with comments"

click_button "Save and mark as complete"
within "#check-neighbour-notifications" do
click_button "Save and mark as complete"
end

within(".govuk-notification-banner--alert") do
expect(page).to have_content("There is a problem")
Expand All @@ -180,7 +188,9 @@
fill_in "Explain why notifications are incomplete", with: "People need to be consulted"
end

click_button "Save and mark as complete"
within "#check-neighbour-notifications" do
click_button "Save and mark as complete"
end

expect(page).to have_content("Review of neighbour responses successfully added")

Expand Down Expand Up @@ -213,7 +223,9 @@
choose "Accept"
end

click_button "Save and mark as complete"
within "#check-neighbour-notifications" do
click_button "Save and mark as complete"
end

expect(page).to have_content("Consultation expiry date must be in the past. You cannot mark this as complete until the consultation period is complete.")
end
Expand Down

0 comments on commit 55c9b91

Please sign in to comment.