generated from DFE-Digital/govuk-rails-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Separate Funding details and add clarifications
- Loading branch information
1 parent
4f2c98f
commit 51eb00c
Showing
6 changed files
with
208 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters