Skip to content

Commit

Permalink
Merge pull request #3181 from DFE-Digital/LUPEYALPHA-991/view-full-claim
Browse files Browse the repository at this point in the history
LUPEYALPHA 991/view full claim
  • Loading branch information
rjlynch authored Sep 18, 2024
2 parents 043d43e + ff94991 commit 16a4daf
Show file tree
Hide file tree
Showing 15 changed files with 929 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ def save
end

def contract_type
if claim.eligibility.fixed_contract?
if claim.eligibility.long_term_employed?
:fixed_contract
else
:variable_contract
Expand Down
2 changes: 1 addition & 1 deletion app/helpers/admin/claims_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def personal_data_removed_text

def admin_personal_details(claim)
[
[translate("admin.teacher_reference_number"), claim.eligibility.teacher_reference_number],
[translate("admin.teacher_reference_number"), claim.eligibility.teacher_reference_number.presence || "Not provided"],
[translate("govuk_verify_fields.full_name").capitalize, claim.personal_data_removed? ? personal_data_removed_text : claim.full_name],
[translate("govuk_verify_fields.date_of_birth").capitalize, claim.personal_data_removed? ? personal_data_removed_text : l(claim.date_of_birth, format: :day_month_year)],
[translate("admin.national_insurance_number"), claim.personal_data_removed? ? personal_data_removed_text : claim.national_insurance_number],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def courses
end.flatten
end

def fixed_contract?
def long_term_employed?
case contract_type
when "permanent"
true
Expand All @@ -59,6 +59,10 @@ def fixed_contract?
end
end

def permanent_contract?
contract_type == "permanent"
end

def verified?
verification.present?
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ module Policies
module FurtherEducationPayments
class EligibilityAdminAnswersPresenter
include Admin::PresenterMethods
include ActionView::Helpers::NumberHelper

attr_reader :eligibility

Expand All @@ -15,6 +16,74 @@ def answers
end
end

def provider_details
[
teaching_responsibilities,
fe_provider
]
end

def employment_contract
[
contract_type,
taught_at_least_one_term,
fixed_term_full_year,
teaching_hours_per_week,
teaching_hours_per_week_next_term
].compact
end

def academic_year_claimant_started_teaching
[
[
question(:further_education_teaching_start_year),
"September #{eligibility.further_education_teaching_start_year.to_i} " \
"to August #{eligibility.further_education_teaching_start_year.to_i + 1}"
]
]
end

def subjects_taught
[
subjects
] + courses
end

def teaching_hours
[
hours_teaching_eligible_subjects,
half_teaching_hours
]
end

def teaching_qualification
[
[
question(:teaching_qualification),
selected_option(
:teaching_qualification,
eligibility.teaching_qualification
)
]
]
end

def performance_and_disciplinary_measures
[
disciplinary_measures,
performance_measures
]
end

def policy_options_provided
[
[
I18n.t("further_education_payments.policy_short_name"),
number_to_currency(eligibility.award_amount, precision: 0)
]
]
end

private

def current_school
Expand All @@ -23,6 +92,171 @@ def current_school
display_school(eligibility.current_school)
]
end

def teaching_responsibilities
[
question(:teaching_responsibilities),
display_boolean(eligibility.teaching_responsibilities)
]
end

def fe_provider
[
question(:further_education_provision_search),
eligibility.school.name
]
end

def contract_type
[
question(:contract_type, school_name: eligibility.school.name),
contract_type_answer
]
end

def taught_at_least_one_term
return nil if eligibility.long_term_employed?

[
question(
:taught_at_least_one_term,
school_name: eligibility.school.name
),
selected_option(
:taught_at_least_one_term,
eligibility.taught_at_least_one_term,
school_name: eligibility.school.name
)
]
end

def fixed_term_full_year
return nil unless eligibility.contract_type == "fixed_term"

[
question(
:fixed_term_contract,
academic_year: eligibility.claim.academic_year.to_s(:long)
),
selected_option(
:fixed_term_contract,
eligibility.fixed_term_full_year,
current_academic_year: eligibility.claim.academic_year.to_s(:long)
)
]
end

def teaching_hours_per_week
[
question(
:teaching_hours_per_week,
school_name: eligibility.school.name
),
selected_option(
:teaching_hours_per_week,
eligibility.teaching_hours_per_week
)
]
end

def teaching_hours_per_week_next_term
return nil if eligibility.permanent_contract?

[
question(
:teaching_hours_per_week_next_term,
school_name: eligibility.school.name
),
selected_option(
:teaching_hours_per_week_next_term,
eligibility.teaching_hours_per_week_next_term,
school_name: eligibility.school.name
)
]
end

def subjects
[
question(:subjects_taught),
eligibility.subjects_taught.map { |subject| selected_option(:subjects_taught, subject) }
]
end

def courses
eligibility.subjects_taught.map do |subject|
[
I18n.t(
[
"further_education_payments",
"forms",
"#{subject}_courses",
"question_check_your_answers"
].join(".")
),
course_descriptions_for_subject(subject)
]
end
end

def course_descriptions_for_subject(subject)
eligibility.courses
.select { |course| course.subject == subject }
.map(&:description)
.map(&:html_safe)
end

def hours_teaching_eligible_subjects
[
question(:hours_teaching_eligible_subjects),
display_boolean(eligibility.hours_teaching_eligible_subjects)
]
end

def half_teaching_hours
[
question(:half_teaching_hours),
display_boolean(eligibility.half_teaching_hours)
]
end

def performance_measures
[
question("poor_performance.questions.performance"),
display_boolean(eligibility.subject_to_formal_performance_action)
]
end

def disciplinary_measures
[
question("poor_performance.questions.disciplinary"),
display_boolean(eligibility.subject_to_disciplinary_action)
]
end

def question(attr, **)
I18n.t("further_education_payments.forms.#{attr}.question", **)
end

def selected_option(attr, value, **)
I18n.t("further_education_payments.forms.#{attr}.options.#{value}", **)
end

def contract_type_answer
case eligibility.contract_type
when "permanent"
"Permanent contract (including full-time and part-time contracts)"
when "variable_hours"
"Variable hours contract (This includes zero hours contracts)"
when "fixed_term"
"Fixed term contract"
else
raise "Unknown contract type: #{eligibility.contract_type}"
end
end

def display_boolean(value)
value ? "Yes" : "No"
end
end
end
end
2 changes: 1 addition & 1 deletion app/views/admin/claims/_answers.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
</dt>

<dd class="govuk-summary-list__value">
<%= answer %>
<%= safe_join(Array.wrap(answer), tag.br + tag.br) %>
</dd>
</div>
<% end %>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds">
<%= render "admin/claims/answer_section", {heading: "Personal details", answers: admin_personal_details(@claim)} %>

<%= render "admin/claims/answer_section", {heading: "Eligibility details", answers: admin_eligibility_answers(@claim)} %>

<% if @claim.policy_options_provided.present? %>
<%= render "admin/claims/answer_section", {heading: "Policy options provided", answers: admin_policy_options_provided(@claim)} %>
<% end %>

<%= render "admin/claims/answer_section", {heading: "Student loan details", answers: admin_student_loan_details(@claim)} %>

<%= render "admin/claims/answer_section", {heading: "Submission details", answers: admin_submission_details(@claim)} %>

<%= render("claims_with_matching_details", {matching_claims: @matching_claims, claim: @claim, show_caption: true}) if @matching_claims.any? %>

<% if @decision.persisted? %>
<%= render "admin/claims/answer_section", {heading: "Claim decision details", answers: admin_decision_details(@decision)} %>
<% end %>
</div>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds">
<%= render "admin/claims/answer_section", {heading: "Personal details", answers: admin_personal_details(@claim)} %>

<%= render "admin/claims/answer_section", {heading: "Eligibility details", answers: admin_eligibility_answers(@claim)} %>

<%= render "admin/claims/answer_section", {heading: "Student loan details", answers: admin_student_loan_details(@claim)} %>

<%= render "admin/claims/answer_section", {heading: "Submission details", answers: admin_submission_details(@claim)} %>

<%= render("claims_with_matching_details", {matching_claims: @matching_claims, claim: @claim, show_caption: true}) if @matching_claims.any? %>

<% if @decision.persisted? %>
<%= render "admin/claims/answer_section", {heading: "Claim decision details", answers: admin_decision_details(@decision)} %>
<% end %>
</div>
</div>
Loading

0 comments on commit 16a4daf

Please sign in to comment.