-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into CAPT-1703-prod-aks-migration
- Loading branch information
Showing
272 changed files
with
4,881 additions
and
1,509 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
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
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
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
21 changes: 0 additions & 21 deletions
21
app/forms/journeys/additional_payments_for_teaching/poor_performance_form.rb
This file was deleted.
Oops, something went wrong.
9 changes: 9 additions & 0 deletions
9
app/forms/journeys/further_education_payments/check_your_answers_form.rb
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,9 @@ | ||
module Journeys | ||
module FurtherEducationPayments | ||
class CheckYourAnswersForm < Form | ||
def save | ||
true | ||
end | ||
end | ||
end | ||
end |
36 changes: 36 additions & 0 deletions
36
app/forms/journeys/further_education_payments/contract_type_form.rb
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,36 @@ | ||
module Journeys | ||
module FurtherEducationPayments | ||
class ContractTypeForm < Form | ||
attribute :contract_type, :string | ||
|
||
validates :contract_type, | ||
inclusion: {in: ->(form) { form.radio_options.map(&:id) }, message: i18n_error_message(:inclusion)} | ||
|
||
def radio_options | ||
[ | ||
OpenStruct.new( | ||
id: "permanent", | ||
name: "Permanent contract", | ||
hint: "This includes full-time and part-time contracts" | ||
), | ||
OpenStruct.new( | ||
id: "fixed-term", | ||
name: "Fixed-term contract" | ||
), | ||
OpenStruct.new( | ||
id: "variable-hours", | ||
name: "Variable hours contract", | ||
hint: "This includes zero hours contract and hourly paid" | ||
) | ||
] | ||
end | ||
|
||
def save | ||
return if invalid? | ||
|
||
journey_session.answers.assign_attributes(contract_type:) | ||
journey_session.save! | ||
end | ||
end | ||
end | ||
end |
9 changes: 9 additions & 0 deletions
9
app/forms/journeys/further_education_payments/eligible_form.rb
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,9 @@ | ||
module Journeys | ||
module FurtherEducationPayments | ||
class EligibleForm < Form | ||
def save | ||
true | ||
end | ||
end | ||
end | ||
end |
37 changes: 37 additions & 0 deletions
37
app/forms/journeys/further_education_payments/further_education_teaching_start_year_form.rb
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,37 @@ | ||
module Journeys | ||
module FurtherEducationPayments | ||
class FurtherEducationTeachingStartYearForm < Form | ||
attribute :further_education_teaching_start_year, :string | ||
|
||
validates :further_education_teaching_start_year, | ||
presence: {message: i18n_error_message(:blank)} | ||
|
||
def radio_options | ||
years_before = -4 | ||
|
||
array = (years_before..0).map do |delta| | ||
academic_year = AcademicYear.current + delta | ||
OpenStruct.new( | ||
id: academic_year.start_year.to_s, | ||
name: "September #{academic_year.start_year} to August #{academic_year.end_year}" | ||
) | ||
end | ||
|
||
academic_year = AcademicYear.current + years_before | ||
array << OpenStruct.new( | ||
id: "pre-#{academic_year.start_year}", | ||
name: "I started before September #{academic_year.start_year}" | ||
) | ||
|
||
array | ||
end | ||
|
||
def save | ||
return false if invalid? | ||
|
||
journey_session.answers.assign_attributes(further_education_teaching_start_year:) | ||
journey_session.save! | ||
end | ||
end | ||
end | ||
end |
27 changes: 27 additions & 0 deletions
27
app/forms/journeys/further_education_payments/half_teaching_hours_form.rb
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,27 @@ | ||
module Journeys | ||
module FurtherEducationPayments | ||
class HalfTeachingHoursForm < Form | ||
attribute :half_teaching_hours, :boolean | ||
|
||
validates :half_teaching_hours, | ||
inclusion: { | ||
in: [true, false], | ||
message: i18n_error_message(:inclusion) | ||
} | ||
|
||
def radio_options | ||
[ | ||
OpenStruct.new(id: true, name: "Yes"), | ||
OpenStruct.new(id: false, name: "No") | ||
] | ||
end | ||
|
||
def save | ||
return false unless valid? | ||
|
||
journey_session.answers.assign_attributes(half_teaching_hours:) | ||
journey_session.save! | ||
end | ||
end | ||
end | ||
end |
9 changes: 9 additions & 0 deletions
9
app/forms/journeys/further_education_payments/ineligible_form.rb
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,9 @@ | ||
module Journeys | ||
module FurtherEducationPayments | ||
class IneligibleForm < Form | ||
def journey_eligibility_checker | ||
@journey_eligibility_checker ||= EligibilityChecker.new(journey_session:) | ||
end | ||
end | ||
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
41 changes: 41 additions & 0 deletions
41
app/forms/journeys/further_education_payments/subjects_taught_form.rb
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,41 @@ | ||
module Journeys | ||
module FurtherEducationPayments | ||
class SubjectsTaughtForm < Form | ||
include ActiveModel::Validations::Callbacks | ||
|
||
attribute :subjects_taught, default: [] | ||
|
||
before_validation :clean_subjects_taught | ||
|
||
validates :subjects_taught, | ||
presence: {message: i18n_error_message(:inclusion)}, | ||
inclusion: {in: ->(form) { form.checkbox_options.map(&:id) }, message: i18n_error_message(:inclusion)} | ||
|
||
def checkbox_options | ||
[ | ||
OpenStruct.new(id: "building-and-construction", name: "Building and construction"), | ||
OpenStruct.new(id: "chemistry", name: "Chemistry"), | ||
OpenStruct.new(id: "computing", name: "Computing, including digital and ICT"), | ||
OpenStruct.new(id: "early-years", name: "Early years"), | ||
OpenStruct.new(id: "engineering-and-manufacturing", name: "Engineering and manufacturing, including transport engineering and electronics"), | ||
OpenStruct.new(id: "mathematics", name: "Mathematics"), | ||
OpenStruct.new(id: "physics", name: "Physics"), | ||
OpenStruct.new(id: "none", name: "I do not teach any of these subjects") | ||
] | ||
end | ||
|
||
def save | ||
return false unless valid? | ||
|
||
journey_session.answers.assign_attributes(subjects_taught:) | ||
journey_session.save! | ||
end | ||
|
||
private | ||
|
||
def clean_subjects_taught | ||
subjects_taught.reject!(&:blank?) | ||
end | ||
end | ||
end | ||
end |
Oops, something went wrong.