Skip to content

Commit

Permalink
Separate Funding details and add clarifications
Browse files Browse the repository at this point in the history
  • Loading branch information
javier-npq committed Jul 18, 2023
1 parent 4f2c98f commit 51eb00c
Show file tree
Hide file tree
Showing 6 changed files with 208 additions and 0 deletions.
71 changes: 71 additions & 0 deletions app/helpers/funding_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
module FundingHelper
FUNDED_ELIGIBILITY_RESULT = :funded

NO_INSTITUTION = :no_institution
INELIGIBLE_ESTABLISHMENT_TYPE = :ineligible_establishment_type
INELIGIBLE_INSTITUTION_TYPE = :ineligible_institution_type
PREVIOUSLY_FUNDED = :previously_funded

# EHCO
NOT_NEW_HEADTEACHER_REQUESTING_EHCO = :not_new_headteacher_requesting_ehco

# School
SCHOOL_OUTSIDE_CATCHMENT = :school_outside_catchment

# Early Years
EARLY_YEARS_OUTSIDE_CATCHMENT = :early_years_outside_catchment
NOT_ON_EARLY_YEARS_REGISTER = :not_on_early_years_register
EARLY_YEARS_INVALID_NPQ = :early_years_invalid_npq

# Lead Mentor
NOT_LEAD_MENTOR_COURSE = :not_lead_mentor_course

NOT_IN_ENGLAND = :not_in_england

def scholarship_funding_eligibility(application)
funding_eligibility = funding_eligibility_calculator(application)
# return funding_eligibility.funding_eligiblity_status_code

if funding_eligibility.funded?
I18n.t("funding_details.scholarship_eligibility")
elsif funding_eligibility.funding_eligiblity_status_code == PREVIOUSLY_FUNDED
I18n.t("funding_details.previously_funded")
elsif [NOT_IN_ENGLAND, EARLY_YEARS_OUTSIDE_CATCHMENT, SCHOOL_OUTSIDE_CATCHMENT].include?(funding_eligibility.funding_eligiblity_status_code)
I18n.t("funding_details.inside_catchment")
elsif [INELIGIBLE_INSTITUTION_TYPE].include?(funding_eligibility.funding_eligiblity_status_code)
I18n.t("funding_details.ineligible_setting")
elsif funding_eligibility.funding_eligiblity_status_code == INELIGIBLE_ESTABLISHMENT_TYPE
I18n.t("funding_details.ineligible_establishment")
elsif scholarship_eligibility_in_review(application)
I18n.t("funding_details.in_review")
end
end

def scholarship_eligibility_in_review(application)
application.work_setting == "other" && application.employment_type != "lead_mentor_for_accredited_itt_provider"
end

def targeted_support_funding(application)
I18n.t("funding_details.targeted_funding_eligibility", funding_amount: funding_amount(application))
end

private

def funding_eligibility_calculator(application)
Services::FundingEligibility.new(
course: application.course,
institution:application.raw_application_data["institution_identifier"],
approved_itt_provider: application.itt_provider,
lead_mentor: application.lead_mentor,
inside_catchment: application.teacher_catchment == "england",
new_headteacher: application.headteacher_status,
trn: application.raw_application_data["trn"],
get_an_identity_id: current_user.get_an_identity_id,
)
end


def funding_amount(application)
application.targeted_delivery_funding_eligibility && application.tsf_primary_plus_eligibility ? 800 : 200
end
end
69 changes: 69 additions & 0 deletions app/views/accounts/_funding_details.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
<%#
<%= govuk_summary_card(title: "Funding details") do |card|
if application.targeted_delivery_funding_eligibility
card.with_summary_list(rows: [
{
key: { text: "Scholarship funding" },
value: { text: scholarship_funding_eligibility(application) }
},
{
key: { text: "Targeted support funding" },
value: { text: targeted_support_funding(application) }
},
])
else
card.with_summary_list(rows: [
{
key: { text: "Scholarship funding" },
value: { text: scholarship_funding_eligibility(application) }
}
])
end
end %>
<% def scholarship_funding_row(application) %>
<tr>
<td>Scholarship funding</td>
<td>
<% unless scholarship_eligibility_in_review(application) %>
<div class="status <%= application.eligible_for_funding ? 'eligible' : 'not-eligible' %>">
<%= application.eligible_for_funding ? 'ELIGIBLE' : 'NOT ELIGIBLE' %>
</div>
<% end %>
<div class="<%= scholarship_eligibility_in_review(application) ? 'in-review' : 'description' %>">
<%= scholarship_funding_eligibility(application) %>
</div>
</td>
</tr>
<% end %>


<table class="funding-details">
<col style="width:31%">
<col style="width:69%">
<thead>
<tr>
<th>Funding details</th>
<th></th>
</tr>
</thead>
<tbody>
<% if application.targeted_delivery_funding_eligibility %>
<% scholarship_funding_row(application) %>
<tr>
<td>Targeted support funding</td>
<td>
<div class="status eligible">Eligible</div>
<div class="description">
<%= targeted_support_funding(application) %>
</div>
</td>
</tr>
<% else %>
<% scholarship_funding_row(application) %>
<% end %>
</tbody>
</table>

1 change: 1 addition & 0 deletions app/views/accounts/user_registrations/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@
<%= render "accounts/work_details", application: @application %>
<%= render "accounts/course_details", application: @application %>
<%= render "accounts/provider_details", application: @application %>
<%= render "accounts/funding_details", application: @application %>
1 change: 1 addition & 0 deletions app/webpacker/styles/application.scss
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ $govuk-image-url-function: frontend-image-url;
@import "contents-list";
@import "subnav";
@import "big-number";
@import "funding_details";

h1.govuk-fieldset__heading {
margin-bottom: 10px;
Expand Down
58 changes: 58 additions & 0 deletions app/webpacker/styles/funding_details.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
.funding-details {
width: 100%;
font-family: "GDS Transport", arial, sans-serif;
border: 1px solid #B1B4B6;
border-collapse: collapse;
}
tr {
border: 1px solid #B1B4B6;
border-width: 1px 0;
}
tr:first-child {
border-top: none;
}
tr:last-child {
border-bottom: none;
}
.funding-details th {
background-color: #F3F2F1;
}

.funding-details th,
.funding-details td {
padding: 20px;
padding-right: 20px;
text-align: left;
font-size: 1.1875rem;
font-weight: 700;
}

.status {
display: inline-block;
padding: 3px 10px;
font-size: 1.1875rem;
font-weight: normal;
margin-top: 20px;
}

.eligible {
background-color: #CCE2D8;
color: #076137;
}

.not-eligible {
background-color: #F1CFC9;
color: #992F20;
}

.description {
margin-top: 5px;
font-size: 15px;
font-weight: normal;
}

.in-review{
font-size: 1.1875rem;
margin-top: 5px;
font-weight: normal;
}
8 changes: 8 additions & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,14 @@ en:
"npq-early-years-leadership": "Early years leadership"
"npq-leading-literacy": "Leading literacy"

funding_details:
scholarship_eligibility: "This means that you will not have to pay for the course fees."
previously_funded: "You have already been allocated scholarship funding for the leading teaching NPQ.\n This means that you would need to pay for the course another way."
inside_catchment: "You're not eligible for scholarship funding because you do not work in England.\nThis means that you would need to pay for the course another way."
ineligible_setting: "You're not eligible for scholarship funding because you do not work in one of the eligible settings, such as state-funded schools.\n\n This means that you would need to pay for the course another way."
ineligible_establishment: "You're not eligible for schools funding because you or your employer is not registered on the Ofsted Early Years Register or with a registered Childminder Agency.\n\nThis means that you would need to pay for the course another way."
in_review: "Contact your provider to check if you're eligible for scholarship funding, if you have not done so already."
targeted_funding_eligibility: "Your workplace will receive £%{funding_amount} to support you to do this NPQ."
helpers:
title:
registration_wizard:
Expand Down

0 comments on commit 51eb00c

Please sign in to comment.