-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[LUPEYALPHA-763] EY Declaration of consent page #3048
Merged
AbigailMcP
merged 2 commits into
master
from
LUPEYALPHA-763-ey-declaration-of-employee-consent
Aug 2, 2024
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
23 changes: 23 additions & 0 deletions
23
app/forms/journeys/early_years_payment/provider/claim_submission_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,23 @@ | ||
module Journeys | ||
module EarlyYearsPayment | ||
module Provider | ||
class ClaimSubmissionForm < ::ClaimSubmissionBaseForm | ||
private | ||
|
||
def main_eligibility | ||
@main_eligibility ||= Policies::EarlyYearsPayment::Eligibility.new | ||
end | ||
|
||
def calculate_award_amount(eligibility) | ||
# NOOP | ||
# This is just for compatibility with the AdditionalPaymentsForTeaching | ||
# claim submission form. | ||
end | ||
|
||
def generate_policy_options_provided | ||
[] | ||
end | ||
end | ||
end | ||
end | ||
end |
19 changes: 19 additions & 0 deletions
19
app/forms/journeys/early_years_payment/provider/consent_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,19 @@ | ||
module Journeys | ||
module EarlyYearsPayment | ||
module Provider | ||
class ConsentForm < Form | ||
attribute :consent_given, :boolean | ||
|
||
validates :consent_given, | ||
presence: {message: i18n_error_message(:presence)} | ||
|
||
def save | ||
return false if invalid? | ||
|
||
journey_session.answers.assign_attributes(consent_given:) | ||
journey_session.save! | ||
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
49 changes: 49 additions & 0 deletions
49
app/views/early_years_payment/provider/claims/consent.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,49 @@ | ||
<% content_for(:page_title, page_title(@form.t(:question), journey: current_journey_routing_name, show_error: @form.errors.any?)) %> | ||
|
||
<div class="govuk-grid-row"> | ||
<div class="govuk-grid-column-two-thirds"> | ||
<%= form_with model: @form, url: claim_path(current_journey_routing_name), method: :patch, builder: GOVUKDesignSystemFormBuilder::FormBuilder, html: { novalidate: false } do |f| %> | ||
|
||
<%= f.govuk_check_boxes_fieldset :consent_given, multiple: false, legend: { text: @form.t(:question), tag: "h1", size: "l" }, hint: -> do %> | ||
<p class="govuk-body"> | ||
You need to confirm that you’ve got consent from your employee before | ||
you can continue with a claim. | ||
</p> | ||
|
||
<p class="govuk-body"> | ||
By continuing you’re confirming that you’ve: | ||
</p> | ||
|
||
<%= govuk_list [ | ||
"obtained written consent from your employee to share their personal information (full name, start date, email address)", | ||
"provided your employee with a privacy notice that explains what information will be collected, why it is being collected and who it will be shared with" | ||
], type: :bullet %> | ||
|
||
<p class="govuk-body"> | ||
You do not need to send us the consent forms, but you should keep them | ||
for your records. | ||
</p> | ||
|
||
<p class="govuk-body"> | ||
If you have any questions, or need further guidance, contact our support | ||
team at | ||
<%= govuk_link_to t("early_years_payment_provider.feedback_email"), "mailto:#{t("early_years_payment_provider.feedback_email")}", no_visited_state: true %>. | ||
</p> | ||
|
||
<div class="govuk-warning-text"> | ||
<span class="govuk-warning-text__icon" aria-hidden="true">!</span> | ||
<strong class="govuk-warning-text__text"> | ||
<span class="govuk-visually-hidden">Warning</span> | ||
By ticking this box, you confirm that you have obtained consent from | ||
your employee. | ||
</strong> | ||
</div> | ||
<% end do %> | ||
|
||
<%= f.govuk_check_box :consent_given, 1, 0, multiple: false, link_errors: true, label: { text: @form.t(:option) } %> | ||
<% end %> | ||
|
||
<%= f.govuk_submit %> | ||
<% end %> | ||
</div> | ||
</div> |
Empty file.
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 |
---|---|---|
|
@@ -1072,6 +1072,14 @@ en: | |
landing_page: | ||
title: Claim an early years financial incentive payment | ||
feedback_email: "[email protected]" | ||
forms: | ||
consent: | ||
question: Declaration of Employee Consent | ||
option: | ||
I confirm that I have obtained consent from my employee and have provided them with the relevant privacy | ||
notice. | ||
errors: | ||
presence: You must be able to confirm this information to continue | ||
activerecord: | ||
errors: | ||
models: | ||
|
5 changes: 5 additions & 0 deletions
5
spec/factories/journeys/early_years_payment/provider/session.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,5 @@ | ||
FactoryBot.define do | ||
factory :early_years_payment_provider_session, class: "Journeys::EarlyYearsPayment::Provider::Session" do | ||
journey { Journeys::EarlyYearsPayment::Provider::ROUTING_NAME } | ||
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
39 changes: 39 additions & 0 deletions
39
spec/forms/journeys/early_years_payment/provider/consent_form_spec.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,39 @@ | ||
require "rails_helper" | ||
|
||
RSpec.describe Journeys::EarlyYearsPayment::Provider::ConsentForm, type: :model do | ||
let(:journey) { Journeys::EarlyYearsPayment::Provider } | ||
let(:journey_session) { create(:early_years_payment_provider_session) } | ||
let(:consent_given) { nil } | ||
|
||
let(:params) do | ||
ActionController::Parameters.new( | ||
claim: { | ||
consent_given: | ||
} | ||
) | ||
end | ||
|
||
subject do | ||
described_class.new(journey_session:, journey:, params:) | ||
end | ||
|
||
describe "validations" do | ||
it do | ||
is_expected.not_to( | ||
allow_value(consent_given) | ||
.for(:consent_given) | ||
.with_message("You must be able to confirm this information to continue") | ||
) | ||
end | ||
end | ||
|
||
describe "#save" do | ||
let(:consent_given) { true } | ||
|
||
it "updates the journey session" do | ||
expect { expect(subject.save).to be(true) }.to( | ||
change { journey_session.reload.answers.consent_given }.to(true) | ||
) | ||
end | ||
end | ||
end |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should remove this description as we're now using
calculate_award_amount
for IRP claims too - obv not a blocker!