From 8ad7eed41743531c35c3b7113332c3d264218d4a Mon Sep 17 00:00:00 2001 From: Alkesh Vaghmaria Date: Thu, 26 Sep 2024 14:53:43 +0100 Subject: [PATCH] EY practitioner enter home address --- .../early_years_payment/practitioner.rb | 3 ++- .../practitioner/slug_sequence.rb | 1 + app/views/claims/_address_fields.html.erb | 26 ++++++++++++++++++ app/views/claims/address.html.erb | 27 +------------------ .../claims/email_address.html.erb | 1 + .../claims/enter_home_address.html.erb | 20 +++++++++++++- .../practitioner/happy_path_spec.rb | 9 +++++++ 7 files changed, 59 insertions(+), 28 deletions(-) create mode 100644 app/views/claims/_address_fields.html.erb create mode 100644 app/views/early_years_payment/practitioner/claims/email_address.html.erb diff --git a/app/models/journeys/early_years_payment/practitioner.rb b/app/models/journeys/early_years_payment/practitioner.rb index ba53f0bb9f..12323a0564 100644 --- a/app/models/journeys/early_years_payment/practitioner.rb +++ b/app/models/journeys/early_years_payment/practitioner.rb @@ -10,7 +10,8 @@ module Practitioner POLICIES = [Policies::EarlyYearsPayments] FORMS = { "claims" => { - "find-reference" => FindReferenceForm + "find-reference" => FindReferenceForm, + "enter-home-address" => AddressForm } } end diff --git a/app/models/journeys/early_years_payment/practitioner/slug_sequence.rb b/app/models/journeys/early_years_payment/practitioner/slug_sequence.rb index 3ff06fdeda..2f098d9368 100644 --- a/app/models/journeys/early_years_payment/practitioner/slug_sequence.rb +++ b/app/models/journeys/early_years_payment/practitioner/slug_sequence.rb @@ -8,6 +8,7 @@ class SlugSequence how-we-use-your-information personal-details enter-home-address + email-address ].freeze def self.start_page_url diff --git a/app/views/claims/_address_fields.html.erb b/app/views/claims/_address_fields.html.erb new file mode 100644 index 0000000000..51ee733d00 --- /dev/null +++ b/app/views/claims/_address_fields.html.erb @@ -0,0 +1,26 @@ +<%= f.govuk_text_field :address_line_1, + autocomplete: "address-line1", + label: { + text: "#{t('forms.address.answers.address_line_1')}#{ t('forms.address.answers.address_line_1_visually_hidden')}".html_safe + } %> + +<%= f.govuk_text_field :address_line_2, + autocomplete: "address-line2", + label: { + text: "#{t('forms.address.answers.address_line_2')}#{ t('forms.address.answers.address_line_2_visually_hidden')}".html_safe + } %> + +<%= f.govuk_text_field :address_line_3, + width: "two-thirds", + autocomplete: "address-level2", + label: { text: t("forms.address.answers.address_line_3") } %> + +<%= f.govuk_text_field :address_line_4, + width: "two-thirds", + autocomplete: "off", + label: { text: t("forms.address.answers.address_line_4") } %> + +<%= f.govuk_text_field :postcode, + width: 10, + autocomplete: "postal-code", + label: { text: t("forms.address.answers.postcode") } %> diff --git a/app/views/claims/address.html.erb b/app/views/claims/address.html.erb index 2c475d3e10..6a2c7f5c29 100644 --- a/app/views/claims/address.html.erb +++ b/app/views/claims/address.html.erb @@ -14,32 +14,7 @@ text: t("questions.personal_details"), size: "xl" } do %> - <%= f.govuk_text_field :address_line_1, - autocomplete: "address-line1", - label: { - text: "#{t('forms.address.answers.address_line_1')}#{ t('forms.address.answers.address_line_1_visually_hidden')}".html_safe - } %> - - <%= f.govuk_text_field :address_line_2, - autocomplete: "address-line2", - label: { - text: "#{t('forms.address.answers.address_line_2')}#{ t('forms.address.answers.address_line_2_visually_hidden')}".html_safe - } %> - - <%= f.govuk_text_field :address_line_3, - width: "two-thirds", - autocomplete: "address-level2", - label: { text: t("forms.address.answers.address_line_3") } %> - - <%= f.govuk_text_field :address_line_4, - width: "two-thirds", - autocomplete: "off", - label: { text: t("forms.address.answers.address_line_4") } %> - - <%= f.govuk_text_field :postcode, - width: 10, - autocomplete: "postal-code", - label: { text: t("forms.address.answers.postcode") } %> + <%= render "address_fields", f: f %> <% end %> <%= f.govuk_submit "Continue" %> diff --git a/app/views/early_years_payment/practitioner/claims/email_address.html.erb b/app/views/early_years_payment/practitioner/claims/email_address.html.erb new file mode 100644 index 0000000000..ddd00ddeb2 --- /dev/null +++ b/app/views/early_years_payment/practitioner/claims/email_address.html.erb @@ -0,0 +1 @@ +

email address page goes here

diff --git a/app/views/early_years_payment/practitioner/claims/enter_home_address.html.erb b/app/views/early_years_payment/practitioner/claims/enter_home_address.html.erb index c44cd22b03..ee0f2446ac 100644 --- a/app/views/early_years_payment/practitioner/claims/enter_home_address.html.erb +++ b/app/views/early_years_payment/practitioner/claims/enter_home_address.html.erb @@ -1 +1,19 @@ -

enter home address page goes here

+<% content_for(:page_title, page_title(t("forms.address.questions.your_address"), journey: current_journey_routing_name, show_error: @form.errors.any?)) %> + +
+
+ <%= form_for @form, url: claim_path(current_journey_routing_name), builder: GOVUKDesignSystemFormBuilder::FormBuilder do |f| %> + <%= f.govuk_error_summary %> + + <%= f.govuk_fieldset legend: { + text: t("forms.address.questions.your_address"), + tag: "h1", + size: "l" + } do %> + <%= render "address_fields", f: f %> + <% end %> + + <%= f.govuk_submit "Continue" %> + <% end %> +
+
diff --git a/spec/features/early_years_payment/practitioner/happy_path_spec.rb b/spec/features/early_years_payment/practitioner/happy_path_spec.rb index fcb336aba7..217c9a9208 100644 --- a/spec/features/early_years_payment/practitioner/happy_path_spec.rb +++ b/spec/features/early_years_payment/practitioner/happy_path_spec.rb @@ -25,5 +25,14 @@ fill_in "Year", with: "1988" fill_in "National Insurance number", with: "PX321499A" click_on "Continue" + + expect(page.title).to have_text("What is your address?") + expect(page).to have_content("What is your address?") + fill_in "House number or name", with: "57" + fill_in "Building and street", with: "Walthamstow Drive" + fill_in "Town or city", with: "Derby" + fill_in "County", with: "City of Derby" + fill_in "Postcode", with: "DE22 4BS" + click_on "Continue" end end