diff --git a/app/controllers/support_interface/regions_controller.rb b/app/controllers/support_interface/regions_controller.rb index 3dbf23f6d2..af1015b3fd 100644 --- a/app/controllers/support_interface/regions_controller.rb +++ b/app/controllers/support_interface/regions_controller.rb @@ -32,10 +32,10 @@ def load_region def region_params params.require(:region).permit( - :application_form_skip_work_history, + :all_sections_necessary, + :work_history_section_to_omit, :other_information, :qualifications_information, - :reduced_evidence_accepted, :requires_preliminary_check, :sanction_check, :sanction_information, diff --git a/app/models/region.rb b/app/models/region.rb index bfe3e0d7e6..a05f9b2b64 100644 --- a/app/models/region.rb +++ b/app/models/region.rb @@ -86,4 +86,40 @@ def teaching_authority_present? teaching_authority_name.present? || teaching_authority_address.present? || teaching_authority_emails.present? || teaching_authority_websites.present? end + + def all_sections_necessary + !application_form_skip_work_history && !reduced_evidence_accepted + end + + def all_sections_necessary=(value) + application_form_skip_work_history_will_change! + reduced_evidence_accepted_will_change! + + if value + self.application_form_skip_work_history = false + self.reduced_evidence_accepted = false + end + end + + def work_history_section_to_omit + if application_form_skip_work_history + "whole_section" + elsif reduced_evidence_accepted + "contact_details" + end + end + + def work_history_section_to_omit=(value) + application_form_skip_work_history_will_change! + reduced_evidence_accepted_will_change! + + case value + when "whole_section" + self.application_form_skip_work_history = true + self.reduced_evidence_accepted = false + when "contact_details" + self.application_form_skip_work_history = false + self.reduced_evidence_accepted = true + end + end end diff --git a/app/views/support_interface/regions/edit.html.erb b/app/views/support_interface/regions/edit.html.erb index 1939e61461..beaf3a99b9 100644 --- a/app/views/support_interface/regions/edit.html.erb +++ b/app/views/support_interface/regions/edit.html.erb @@ -14,26 +14,22 @@ :label, legend: { text: "Will applications be subject to a preliminary check?" } %> - <%= f.govuk_fieldset legend: { text: "Application form changes" } do %> - <%= f.govuk_collection_radio_buttons :application_form_skip_work_history, - [ - OpenStruct.new(value: :true, label: "Yes"), - OpenStruct.new(value: :false, label: "No") - ], - :value, - :label, - legend: { text: "Remove work history?", size: "s" } %> + <%= f.govuk_radio_buttons_fieldset(:all_sections_necessary, legend: { size: 'm', text: 'Do applicants need to complete all sections of the application form?' }) do %> + <%= f.govuk_radio_button :all_sections_necessary, :true, label: { text: 'Yes' }, link_errors: true %> + <%= f.govuk_radio_button :all_sections_necessary, :false, label: { text: 'No' } do %> + <%= f.govuk_collection_select :work_history_section_to_omit, + [ + OpenStruct.new(id: "whole_section", name: "Work history (whole section)"), + OpenStruct.new(id: "contact_details", name: "Work history contact details (allows QTS to be awarded without any work references being provided) and allow applicant to choose any SELT provider to prove their English proficiency."), + ], + :id, + :name, + label: { text: "Which sections will be removed?", size: "s" } %> - <%= f.govuk_collection_radio_buttons :reduced_evidence_accepted, - [ - OpenStruct.new(value: :true, label: "Yes"), - OpenStruct.new(value: :false, label: "No") - ], - :value, - :label, - legend: { text: "Remove work history contact details and allow applicant to choose any SELT provider to prove their English proficiency?", size: "s" }, - hint: { text: "Allows QTS to be awarded without any work references being provided." } %> + <% end %> + <% end %> + <%= f.govuk_fieldset legend: { text: "Application form changes" } do %> <%= f.govuk_collection_radio_buttons :written_statement_optional, [ OpenStruct.new(value: :true, label: "Yes"), diff --git a/db/schema.rb b/db/schema.rb index 36c0ea9369..192685571a 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -84,9 +84,9 @@ t.bigint "english_language_provider_id" t.text "english_language_provider_reference", default: "", null: false t.datetime "awarded_at" - t.boolean "reduced_evidence_accepted", default: false, null: false t.boolean "teaching_authority_provides_written_statement", default: false, null: false t.boolean "written_statement_confirmation", default: false, null: false + t.boolean "reduced_evidence_accepted", default: false, null: false t.boolean "english_language_provider_other", default: false, null: false t.datetime "declined_at" t.boolean "waiting_on_professional_standing", default: false, null: false @@ -97,8 +97,8 @@ t.boolean "received_reference", default: false, null: false t.boolean "waiting_on_qualification", default: false, null: false t.boolean "received_qualification", default: false, null: false - t.boolean "written_statement_optional", default: false, null: false t.boolean "requires_preliminary_check", default: false, null: false + t.boolean "written_statement_optional", default: false, null: false t.boolean "overdue_further_information", default: false, null: false t.boolean "overdue_professional_standing", default: false, null: false t.boolean "overdue_qualification", default: false, null: false @@ -137,7 +137,7 @@ t.integer "age_range_min" t.integer "age_range_max" t.text "subjects", default: [], null: false, array: true - t.datetime "recommended_at", precision: nil + t.datetime "recommended_at" t.text "age_range_note", default: "", null: false t.text "subjects_note", default: "", null: false t.datetime "started_at" @@ -160,8 +160,8 @@ t.string "status_information", default: "", null: false t.string "sanction_information", default: "", null: false t.boolean "eligibility_enabled", default: true, null: false - t.boolean "eligibility_skip_questions", default: false, null: false t.text "qualifications_information", default: "", null: false + t.boolean "eligibility_skip_questions", default: false, null: false t.index ["code"], name: "index_countries_on_code", unique: true end @@ -270,7 +270,7 @@ t.text "location_note", default: "", null: false t.datetime "created_at", null: false t.datetime "updated_at", null: false - t.datetime "reviewed_at", precision: nil + t.datetime "reviewed_at" t.boolean "passed" t.string "failure_assessor_note", default: "", null: false t.boolean "ready_for_review", default: false, null: false @@ -285,7 +285,7 @@ t.text "location_note", default: "", null: false t.datetime "created_at", null: false t.datetime "updated_at", null: false - t.datetime "reviewed_at", precision: nil + t.datetime "reviewed_at" t.boolean "passed" t.string "failure_assessor_note", default: "", null: false t.index ["assessment_id"], name: "index_qualification_requests_on_assessment_id" @@ -321,7 +321,7 @@ t.datetime "created_at", null: false t.datetime "updated_at", null: false t.boolean "passed" - t.datetime "reviewed_at", precision: nil + t.datetime "reviewed_at" t.boolean "contact_response" t.string "contact_name", default: "", null: false t.string "contact_job", default: "", null: false @@ -358,12 +358,12 @@ t.string "status_information", default: "", null: false t.string "sanction_information", default: "", null: false t.boolean "teaching_authority_provides_written_statement", default: false, null: false - t.boolean "application_form_skip_work_history", default: false, null: false t.text "qualifications_information", default: "", null: false + t.boolean "application_form_skip_work_history", default: false, null: false t.boolean "reduced_evidence_accepted", default: false, null: false t.boolean "teaching_authority_requires_submission_email", default: false, null: false - t.boolean "written_statement_optional", default: false, null: false t.boolean "requires_preliminary_check", default: false, null: false + t.boolean "written_statement_optional", default: false, null: false t.index ["country_id", "name"], name: "index_regions_on_country_id_and_name", unique: true t.index ["country_id"], name: "index_regions_on_country_id" end @@ -420,9 +420,9 @@ t.datetime "created_at", null: false t.datetime "updated_at", null: false t.string "invitation_token" - t.datetime "invitation_created_at", precision: nil - t.datetime "invitation_sent_at", precision: nil - t.datetime "invitation_accepted_at", precision: nil + t.datetime "invitation_created_at" + t.datetime "invitation_sent_at" + t.datetime "invitation_accepted_at" t.integer "invitation_limit" t.string "invited_by_type" t.bigint "invited_by_id" @@ -449,8 +449,8 @@ t.datetime "created_at", null: false t.datetime "updated_at", null: false t.integer "sign_in_count", default: 0, null: false - t.datetime "current_sign_in_at", precision: nil - t.datetime "last_sign_in_at", precision: nil + t.datetime "current_sign_in_at" + t.datetime "last_sign_in_at" t.string "current_sign_in_ip" t.string "last_sign_in_ip" t.string "trn"