Skip to content

Commit

Permalink
Replace employment details with select school
Browse files Browse the repository at this point in the history
In the original IRP journey the claimant had to manually enter their
school's address. We've replaced manual address entering with a school
select form. We still ask for the name of the head teacher as the GIAS
database doesn't contain head teacher information for all schools.
  • Loading branch information
rjlynch committed Jun 28, 2024
1 parent 2653b1a commit 4a12f1a
Show file tree
Hide file tree
Showing 24 changed files with 195 additions and 379 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
module Journeys
module GetATeacherRelocationPayment
class HeadteacherDetailsForm < Form
attribute :school_headteacher_name, :string

validates :school_headteacher_name,
presence: {
message: i18n_error_message(:school_headteacher_name)
}

def save
return false unless valid?

journey_session.answers.assign_attributes(
school_headteacher_name: school_headteacher_name
)

journey_session.save!
end
end
end
end
2 changes: 1 addition & 1 deletion app/models/journeys/get_a_teacher_relocation_payment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ module GetATeacherRelocationPayment
"entry-date" => EntryDateForm,
"nationality" => NationalityForm,
"passport-number" => PassportNumberForm,
"employment-details" => EmploymentDetailsForm
"headteacher-details" => HeadteacherDetailsForm
}
}
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,8 @@ def identity_answers

def employment_answers
[].tap do |a|
a << current_school
a << school_headteacher_name
a << school_name
a << school_address_line_1
a << school_address_line_2 if answers.school_address_line_2.present?
a << school_city
a << school_postcode
end
end

Expand Down Expand Up @@ -111,51 +107,19 @@ def passport_number
]
end

def school_headteacher_name
[
t("get_a_teacher_relocation_payment.forms.employment_details.questions.school_headteacher_name"),
answers.school_headteacher_name,
"employment-details"
]
end

def school_name
[
t("get_a_teacher_relocation_payment.forms.employment_details.questions.school_name"),
answers.school_name,
"employment-details"
]
end

def school_address_line_1
def current_school
[
t("get_a_teacher_relocation_payment.forms.employment_details.questions.school_address_line_1"),
answers.school_address_line_1,
"employment-details"
t("get_a_teacher_relocation_payment.forms.current_school.questions.current_school_search"),
answers.current_school.name,
"current-school"
]
end

def school_address_line_2
[
t("get_a_teacher_relocation_payment.forms.employment_details.questions.school_address_line_2"),
answers.school_address_line_2,
"employment-details"
]
end

def school_city
[
t("get_a_teacher_relocation_payment.forms.employment_details.questions.school_city"),
answers.school_city,
"employment-details"
]
end

def school_postcode
def school_headteacher_name
[
t("get_a_teacher_relocation_payment.forms.employment_details.questions.school_postcode"),
answers.school_postcode,
"employment-details"
t("get_a_teacher_relocation_payment.forms.headteacher_details.questions.school_headteacher_name"),
answers.school_headteacher_name,
"headteacher-details"
]
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,6 @@ class SessionAnswers < Journeys::SessionAnswers
attribute :nationality, :string
attribute :passport_number, :string
attribute :school_headteacher_name, :string
attribute :school_name, :string
attribute :school_address_line_1, :string
attribute :school_address_line_2, :string
attribute :school_city, :string
attribute :school_postcode, :string

def policy
Policies::InternationalRelocationPayments
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ class SlugSequence
PERSONAL_DETAILS_SLUGS = [
"nationality",
"passport-number",
"employment-details",
"current-school",
"headteacher-details",
"personal-details",
"postcode-search",
"select-home-address",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<%# NOOP %>
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<h1 class="govuk-label-wrapper">
<%= label_tag :school_search, question, class: "govuk-label govuk-label--l" %>
</h1>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<legend class="govuk-fieldset__legend govuk-fieldset__legend--l">
<h1 class="govuk-fieldset__heading">
<%= question %>
</h1>
</legend>

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<% content_for(
:page_title,
page_title(
t("get_a_teacher_relocation_payment.forms.headteacher_details.questions.school_headteacher_name"),
journey: current_journey_routing_name,
show_error: @form.errors.any?
)
) %>
<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds">
<%= form_for(
@form,
url: claim_path(current_journey_routing_name),
builder: GOVUKDesignSystemFormBuilder::FormBuilder
) do |f| %>
<%= f.govuk_error_summary %>

<%= f.govuk_text_field(
:school_headteacher_name,
label: {
text: t("get_a_teacher_relocation_payment.forms.headteacher_details.questions.school_headteacher_name"),
size: "l",
tag: "h1"
},
) %>

<%= f.govuk_submit %>
<% end %>
</div>
</div>
1 change: 1 addition & 0 deletions config/analytics.yml
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ shared:
- visa_type
- date_of_entry
- nationality
- current_school_id
:schools:
- id
- urn
Expand Down
5 changes: 0 additions & 5 deletions config/analytics_blocklist.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,6 @@
:international_relocation_payments_eligibilities:
- passport_number
- school_headteacher_name
- school_name
- school_address_line_1
- school_address_line_2
- school_city
- school_postcode
:levelling_up_premium_payments_eligibilities:
- teacher_reference_number
:early_career_payments_eligibilities:
Expand Down
17 changes: 5 additions & 12 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -752,22 +752,15 @@ en:
errors:
presence: "Enter your passport number"
invalid: "Invalid passport number"
employment_details:
title: "Employment information"
school_address_legend: "Enter the school address"
current_school:
questions:
current_school_search: "Which school are you currently employed to teach at?"
current_school_results: "Which school are you currently employed to teach at?"
headteacher_details:
questions:
school_headteacher_name: "Enter the name of the headteacher of the school where you are employed as a teacher"
school_name: "Enter the name of the school"
school_address_line_1: "Address line 1"
school_address_line_2: "Address line 2"
school_city: "Town or city"
school_postcode: "Postcode"
errors:
school_headteacher_name: "Enter the headteacher's name"
school_name: "Enter the school name"
school_address_line_1: "Enter your school's address"
school_city: "Enter your school's city"
school_postcode: "Enter a valid postcode (for example, BN1 1AA)"

check_your_answers:
part_one:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
class DropEligibilityColumnsFromInternationalRelocationPayments < ActiveRecord::Migration[7.0]
def change
remove_column :international_relocation_payments_eligibilities, :school_name
remove_column :international_relocation_payments_eligibilities, :school_address_line_1
remove_column :international_relocation_payments_eligibilities, :school_address_line_2
remove_column :international_relocation_payments_eligibilities, :school_city
remove_column :international_relocation_payments_eligibilities, :school_postcode
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
class AddCurrentSchoolIdToInternationalRelocationPaymentsEligibilities < ActiveRecord::Migration[7.0]
def change
add_reference :international_relocation_payments_eligibilities,
:current_school,
type: :uuid,
foreign_key: {to_table: :schools},
index: {
name: "index_irb_eligibilities_on_current_school_id"
}
end
end
Loading

0 comments on commit 4a12f1a

Please sign in to comment.