-
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 pull request #3111 from DFE-Digital/LUPEYALPHA-771-check-your-a…
…nswers [LUPEYALPHA-771] check your answers
- Loading branch information
Showing
32 changed files
with
502 additions
and
17 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
module ClaimSubmission | ||
extend ActiveSupport::Concern | ||
|
||
def create_and_save_claim_form | ||
@form = journey::ClaimSubmissionForm.new(journey_session: journey_session) | ||
|
||
if @form.save | ||
session[:submitted_claim_id] = @form.claim.id | ||
clear_claim_session | ||
redirect_to claim_confirmation_path | ||
else | ||
render "claims/check_your_answers" | ||
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
20 changes: 20 additions & 0 deletions
20
app/forms/journeys/early_years_payment/provider/authenticated/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,20 @@ | ||
module Journeys | ||
module EarlyYearsPayment | ||
module Provider | ||
module Authenticated | ||
class CheckYourAnswersForm < Form | ||
attribute :provider_contact_name | ||
|
||
validates :provider_contact_name, presence: {message: i18n_error_message(:valid)} | ||
|
||
def save | ||
return false if invalid? | ||
|
||
journey_session.answers.assign_attributes(provider_contact_name:) | ||
journey_session.save! | ||
end | ||
end | ||
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
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
81 changes: 81 additions & 0 deletions
81
app/models/journeys/early_years_payment/provider/authenticated/answers_presenter.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,81 @@ | ||
module Journeys | ||
module EarlyYearsPayment | ||
module Provider | ||
module Authenticated | ||
class AnswersPresenter < BaseAnswersPresenter | ||
include ActionView::Helpers::TranslationHelper | ||
|
||
def claim_answers | ||
[].tap do |a| | ||
a << nursery | ||
a << paye_reference | ||
a << employee_name | ||
a << start_date | ||
a << child_facing_confirmation_given | ||
a << returner | ||
a << employee_email_address | ||
end | ||
end | ||
|
||
private | ||
|
||
def nursery | ||
[ | ||
"Employee’s workplace", | ||
EligibleEyProvider.find_by(urn: answers.nursery_urn).nursery_name, | ||
"current-nursery" | ||
] | ||
end | ||
|
||
def paye_reference | ||
[ | ||
"Employer’s PAYE reference number", | ||
answers.paye_reference, | ||
"paye-reference" | ||
] | ||
end | ||
|
||
def employee_name | ||
[ | ||
"Employee’s name", | ||
[answers.first_name, answers.surname].join(" "), | ||
"claimant-name" | ||
] | ||
end | ||
|
||
def start_date | ||
[ | ||
"Employee’s start date", | ||
answers.start_date.to_fs(:long_date), | ||
"start-date" | ||
] | ||
end | ||
|
||
def child_facing_confirmation_given | ||
[ | ||
"Confirmation that employee spends most of their time in their job working directly with children", | ||
(answers.child_facing_confirmation_given ? "Yes" : "No"), | ||
"child-facing" | ||
] | ||
end | ||
|
||
def returner | ||
[ | ||
"Confirmation that employee worked in an early years setting 6 months before the start date", | ||
(answers.first_job_within_6_months ? "Yes" : "No"), | ||
"returner" | ||
] | ||
end | ||
|
||
def employee_email_address | ||
[ | ||
"Employee’s email address", | ||
answers.practitioner_email_address, | ||
"employee-email" | ||
] | ||
end | ||
end | ||
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
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,32 @@ | ||
<% content_for( | ||
:page_title, | ||
page_title( | ||
t("early_years_payment_provider_authenticated.check_your_answers.title"), | ||
journey: current_journey_routing_name, | ||
show_error: @form.errors.any? | ||
) | ||
) %> | ||
|
||
<div class="govuk-grid-row"> | ||
<div class="govuk-grid-column-two-thirds"> | ||
<% if @form.errors.any? %> | ||
<%= render("shared/error_summary", instance: @form, errored_field_id_overrides: {"provider_contact_name":"claim-provider-contact-name-field-error"}) %> | ||
<% end %> | ||
<h1 class="govuk-heading-xl"> | ||
<%= t("early_years_payment_provider_authenticated.check_your_answers.title") %> | ||
</h1> | ||
|
||
<%= render partial: "claims/check_your_answers_section", locals: {heading: nil, answers: journey.answers_for_claim(@form.journey_session).claim_answers} %> | ||
<%= form_with model: @form, url: claim_path(current_journey_routing_name), method: :patch, builder: GOVUKDesignSystemFormBuilder::FormBuilder do |form| %> | ||
<h2 class="govuk-heading-m"><%= t("early_years_payment_provider_authenticated.check_your_answers.heading_send_application") %></h2> | ||
|
||
<p class="govuk-body"><%= t("early_years_payment_provider_authenticated.check_your_answers.statement") %></p> | ||
|
||
<%= form.govuk_text_field :provider_contact_name, label: { text: "Your full name" }, spellcheck: "false" %> | ||
|
||
<div class="govuk-form-group"> | ||
<%= form.submit t("early_years_payment_provider_authenticated.check_your_answers.btn_text"), class: "govuk-button" %> | ||
</div> | ||
<% end %> | ||
</div> | ||
</div> |
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
37 changes: 37 additions & 0 deletions
37
app/views/early_years_payment/provider/authenticated/submissions/show.html.erb
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 @@ | ||
<% content_for(:page_title, page_title("Claim submitted", journey: current_journey_routing_name)) %> | ||
|
||
<div class="govuk-grid-row"> | ||
<div class="govuk-grid-column-two-thirds"> | ||
|
||
<div class="govuk-panel govuk-panel--confirmation"> | ||
<h1 class="govuk-panel__title" id="submitted-title">Claim submitted</h1> | ||
|
||
<div class="govuk-panel__body"> | ||
Your claim reference<br> | ||
<strong><%= submitted_claim.reference %></strong> | ||
</div> | ||
</div> | ||
|
||
<h2 class="govuk-heading-m"> | ||
You’ve successfully submitted a claim for an early years financial | ||
incentive payment on behalf of <%= submitted_claim.first_name %> <%= submitted_claim.surname %>. | ||
</h2> | ||
|
||
<p class="govuk-body"> | ||
We’ve sent a confirmation email to <%= submitted_claim.email_address %>. | ||
</p> | ||
|
||
<h2 class="govuk-heading-m">What happens next</h2> | ||
|
||
<p class="govuk-body"> | ||
We’ll send an email to your employee asking for them to provide some | ||
further information. We’ll also ask them to provide their payment details. | ||
</p> | ||
|
||
<p class="govuk-body"> | ||
For more information, read more about the | ||
<%= govuk_link_to("early years financial incentive", "#") %>. | ||
</p> | ||
</div> | ||
</div> | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
class AddAnswerFieldsToClaims < ActiveRecord::Migration[7.0] | ||
def change | ||
add_column :claims, :paye_reference, :string | ||
add_column :claims, :practitioner_email_address, :string | ||
add_column :claims, :provider_contact_name, :string | ||
end | ||
end |
8 changes: 8 additions & 0 deletions
8
db/migrate/20240821110027_add_answer_fields_to_ey_eligibilities.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,8 @@ | ||
class AddAnswerFieldsToEyEligibilities < ActiveRecord::Migration[7.0] | ||
def change | ||
add_column :early_years_payment_eligibilities, :nursery_urn, :string | ||
add_column :early_years_payment_eligibilities, :start_date, :date | ||
add_column :early_years_payment_eligibilities, :child_facing_confirmation_given, :boolean | ||
add_column :early_years_payment_eligibilities, :first_job_within_6_months, :boolean | ||
end | ||
end |
Oops, something went wrong.