Skip to content

Commit

Permalink
Merge pull request #2179 from unboxed/assessment_report_immunity
Browse files Browse the repository at this point in the history
Improve immunity enforcement on assessment report
  • Loading branch information
EGiataganas authored Feb 26, 2025
2 parents 4900d23 + dec7cab commit 2914dca
Show file tree
Hide file tree
Showing 6 changed files with 81 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,9 @@
PlanningApplications::ImmunityDetailsAssessmentComponent.new(planning_application: planning_application, evidence_groups: immunity_detail.evidence_groups)
) %>
<p class="govuk-body"><strong>On the balance of probabilities, is the development immune from enforcement action?</strong></p>
<p class="govuk-body">
<strong><%= review_immunity_detail.decision %></strong><br>
<%= review_immunity_detail.decision_reason %>
</p>
<p class="govuk-body"><%= review_immunity_detail.summary %></p>
<p class="govuk-body">Decision: <%= review_immunity_detail.decision %></p>
<p class="govuk-body">Reason: <%= review_immunity_detail.decision_reason %></p>
<p class="govuk-body">Summary: <%= review_immunity_detail.summary %></p>
</section>
<% end %>
<% if permitted_development_right.persisted? %>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
<section class="govuk-!-margin-top-5 immunity-section">
<h3 class="govuk-heading-s">
<h3 class="govuk-heading-m">
Immunity from enforcement
</h3>

<%= render(PlanningApplications::ImmunityDetailsComponent.new(immunity_details: planning_application.immune_proposal_details)) %>

<h3 class="govuk-heading-s govuk-!-margin-top-5 govuk-!-margin-bottom-1">Consideration of evidence</h3>

<h3 class="govuk-heading-s govuk-!-margin-top-5 govuk-!-margin-bottom-1">Assessment summary — Evidence of immunity</h3>
<ul class="govuk-body immunity-details-sub-list">
<li><strong>Evidence cover:</strong>
Expand All @@ -21,19 +23,55 @@
</ul>

<div class="govuk-body">
<hr>
<% for evidence_group in evidence_groups %>
<div class="display-flex align-items-center">
<h3 class="govuk-heading-s">
<%= govuk_link_to sanitize("#{evidence_group.name} (#{evidence_group.documents.count})<br>#{evidence_group.date_range}"), new_planning_application_assessment_immunity_detail_path(planning_application) + "#accordion-default-heading-#{evidence_group.id}", no_underline: true %>
</h3>
<% if evidence_group.missing_evidence? %>
<div class="govuk-warning-text govuk-!-margin-left-6 govuk-!-margin-top-2">
<span class="govuk-warning-text__icon" aria-hidden="true">!</span>
<% evidence_groups.each do |evidence_group| %>
<div class="govuk-summary-card">
<div class="govuk-summary-card__title-wrapper">
<div class="display-flex align-items-center">
<h2 class="govuk-summary-card__title">
<%= "#{evidence_group.name} (#{evidence_group.documents.count})" %>
<br>
<%= evidence_group.date_range.to_s %>
</h2>
<% if evidence_group.missing_evidence? %>
<div class="govuk-warning-text govuk-!-margin-left-6 govuk-!-margin-top-2">
<span class="govuk-warning-text__icon" aria-hidden="true">!</span>
</div>
<% end %>
</div>
</div>
<% end %>
</div>
<hr>
<div class="govuk-summary-card__content">
<dl class="govuk-summary-list">
<% evidence_group.documents.each do |document| %>
<div class="govuk-summary-list__row">
<dt class="govuk-summary-list__key">
Document
</dt>
<dd class="govuk-summary-list__value">
<%= document.numbers %>
<%= helpers.link_to_document document.numbers, document %>
</dd>
</div>
<% end %>
</dl>
<p class="govuk-body govuk-!-margin-top-2">
<strong>Relevant dates: </strong> <%= evidence_group.date_range %>
</p>

<% if applicant_comment = evidence_group.applicant_comment %>
<%= bops_ticket_panel(colour: "grey", classes: %w[govuk-!-margin-bottom-2]) do |ticket| %>
<% ticket.with_body { applicant_comment } %>
<% ticket.with_footer { "By applicant" } %>
<% end %>
<% end %>

<% if comment = evidence_group.last_comment %>
<%= bops_ticket_panel(colour: "yellow", classes: %w[govuk-!-margin-bottom-2]) do |ticket| %>
<% ticket.with_body { comment.text } %>
<% ticket.with_footer { comment.information } %>
<% end %>
<% end %>
</div>
</div>
<% end %>
</div>
</section>
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ def initialize(planning_application:, evidence_groups:)
end

delegate :immunity_detail, to: :planning_application
delegate :bops_ticket_panel, to: :helpers

attr_reader :planning_application, :evidence_groups
end
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,23 @@
<h3 class="govuk-heading-s govuk-!-margin-bottom-1 govuk-!-margin-top-5">Applicant information</h3>
<ul class="govuk-body immunity-details-sub-list">
<% immunity_details.each do |proposal_detail| %>
<li>
<%= proposal_detail.question %>
<table class="govuk-table">
<caption class="govuk-table__caption govuk-table__caption--m">Applicant information</caption>
<thead class="govuk-table__head">
<tr class="govuk-table__row">
<th scope="col" class="govuk-table__header">Question</th>
<th scope="col" class="govuk-table__header">Applicant response</th>
</tr>
</thead>
<tbody class="govuk-table__body">
<% immunity_details.each do |proposal_detail| %>
<% proposal_detail.response_values.each do |response_value| %>
<strong>
<%= response_value.to_time.nil? ? response_value : response_value.to_time.to_fs(:day_month_year_slashes) %>
</strong>
<tr class="govuk-table__row">
<th scope="row" class="govuk-table__header">
<%= proposal_detail.question %>
</th>
<td class="govuk-table__cell">
<%= response_value.to_time.nil? ? response_value : response_value.to_time.to_fs(:day_month_year_slashes) %>
</td>
</tr>
<% end %>
</li>
<% end %>
</ul>
<% end %>
</tbody>
</table>
4 changes: 4 additions & 0 deletions app/presenters/evidence_group_presenter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ def date_range
end
end

def last_comment
@last_comment ||= persisted_comments.last
end

private

attr_reader :evidence_group
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def initialize(colour: nil, id: nil, classes: [], html_attributes: {})
end

def call
tag.div(**default_attributes) do
tag.div(**html_attributes) do
safe_join([body_wrapper, footer_wrapper].compact_blank)
end
end
Expand Down

0 comments on commit 2914dca

Please sign in to comment.