diff --git a/app/app/components/aggregate_data_point_component.rb b/app/app/components/aggregate_data_point_component.rb index c65ef8afd..7523b8ced 100644 --- a/app/app/components/aggregate_data_point_component.rb +++ b/app/app/components/aggregate_data_point_component.rb @@ -126,4 +126,11 @@ def client_full_name(full_name) value: full_name } end + + def ssn(ssn) + { + label: I18n.t("cbv.submits.show.pdf.caseworker.ssn"), + value: ssn + } + end end diff --git a/app/app/views/cbv/submits/show.pdf.erb b/app/app/views/cbv/submits/show.pdf.erb index 12d0dd3ed..b59bbacca 100644 --- a/app/app/views/cbv/submits/show.pdf.erb +++ b/app/app/views/cbv/submits/show.pdf.erb @@ -35,7 +35,7 @@ <% end %>

<%= t(".pdf.client.client_report_information") %>

-<% if is_caseworker %> +<% if @cbv_flow.cbv_applicant.applicant_attributes.present? %> 1<%= t(".pdf.caseworker.client_provided_information") %> <% end %> @@ -46,13 +46,16 @@ <% if current_agency?(:ma) && !is_caseworker %> <%= table.with_row(t(".pdf.client.agency_id_number"), @cbv_flow.cbv_applicant.agency_id_number) %> <% end %> - <% if is_caseworker %> - <% @cbv_flow.cbv_applicant.applicant_attributes.each do |item| %> - <% if @cbv_flow.cbv_applicant[item].present? %> + <% @cbv_flow.cbv_applicant.applicant_attributes.each do |item| %> + <% if @cbv_flow.cbv_applicant[item].present? %> + <% if item == :date_of_birth %> + <%= table.with_row(t("cbv.applicant_informations.#{@cbv_flow.client_agency_id}.fields.#{item}.super_one_html"), format_date(@cbv_flow.cbv_applicant[item])) %> + <% else %> <%= table.with_row(t("cbv.applicant_informations.#{@cbv_flow.client_agency_id}.fields.#{item}.super_one_html"), @cbv_flow.cbv_applicant[item]) %> <% end %> <% end %> - + <% end %> + <% if is_caseworker %> <% if current_agency?(:nyc) %> <%= table.with_row(t(".pdf.caseworker.client_id_number"), @cbv_flow.cbv_applicant.client_id_number) %> <%= table.with_row(t(".pdf.caseworker.case_number"), @cbv_flow.cbv_applicant.case_number) %> @@ -101,6 +104,7 @@ <% end %> <% if is_caseworker && summary[:has_identity_data] %> <%= table.with_data_point(:client_full_name, summary[:identity].full_name) %> + <%= table.with_data_point(:ssn, summary[:identity].ssn) %> <% end %> <% if summary[:has_employment_data] %> <% employment = summary[:employment] %> diff --git a/app/config/locales/en.yml b/app/config/locales/en.yml index 61d04d1de..a844c8a79 100644 --- a/app/config/locales/en.yml +++ b/app/config/locales/en.yml @@ -447,6 +447,7 @@ en: how_to_header: 'How to use this report:' pay_period: Pay period (%{pay_frequency}) snap_agency_id: SNAP Agency ID + ssn: SSN staff_beacon_id_wel_id: Staff BEACON ID (WELID) client: address: Employer address diff --git a/app/spec/controllers/cbv/submits_controller_spec.rb b/app/spec/controllers/cbv/submits_controller_spec.rb index 6ed771e47..e123c26d9 100644 --- a/app/spec/controllers/cbv/submits_controller_spec.rb +++ b/app/spec/controllers/cbv/submits_controller_spec.rb @@ -104,39 +104,84 @@ end end - context "when rendering for a caseworker" do - it "shows the right client information fields" do - get :show, format: :pdf, params: { - is_caseworker: "true" - } - - pdf = PDF::Reader.new(StringIO.new(response.body)) - pdf_text = "" - pdf.pages.each do |page| - pdf_text += page.text + context "with sandbox client agency" do + context "when rendering for a caseworker" do + it "shows the right client information fields" do + get :show, format: :pdf, params: { + is_caseworker: "true" + } + + pdf = PDF::Reader.new(StringIO.new(response.body)) + pdf_text = "" + pdf.pages.each do |page| + pdf_text += page.text + end + + expect(pdf_text).to include(I18n.t("cbv.applicant_informations.sandbox.fields.first_name.prompt")) + expect(pdf_text).to include(I18n.t("cbv.applicant_informations.sandbox.fields.middle_name.prompt")) + expect(pdf_text).to include(I18n.t("cbv.applicant_informations.sandbox.fields.last_name.prompt")) + expect(pdf_text).to include(I18n.t("cbv.applicant_informations.sandbox.fields.case_number.prompt")) + expect(pdf_text).to include(I18n.t("cbv.submits.show.pdf.caseworker.ssn")) end + end - expect(pdf_text).to include(I18n.t("cbv.applicant_informations.sandbox.fields.first_name.prompt")) - expect(pdf_text).to include(I18n.t("cbv.applicant_informations.sandbox.fields.middle_name.prompt")) - expect(pdf_text).to include(I18n.t("cbv.applicant_informations.sandbox.fields.last_name.prompt")) - expect(pdf_text).to include(I18n.t("cbv.applicant_informations.sandbox.fields.case_number.prompt")) + context "when rendering for a client" do + it "does not show the client information fields" do + get :show, format: :pdf + + pdf = PDF::Reader.new(StringIO.new(response.body)) + pdf_text = "" + pdf.pages.each do |page| + pdf_text += page.text + end + + expect(pdf_text).to include(I18n.t("cbv.applicant_informations.sandbox.fields.first_name.prompt")) + expect(pdf_text).to include(I18n.t("cbv.applicant_informations.sandbox.fields.middle_name.prompt")) + expect(pdf_text).to include(I18n.t("cbv.applicant_informations.sandbox.fields.last_name.prompt")) + expect(pdf_text).to include(I18n.t("cbv.applicant_informations.sandbox.fields.case_number.prompt")) + expect(pdf_text).not_to include(I18n.t("cbv.submits.show.pdf.caseworker.ssn")) + end end end - context "when rendering for a client" do - it "does not show the client information fields" do - get :show, format: :pdf - - pdf = PDF::Reader.new(StringIO.new(response.body)) - pdf_text = "" - pdf.pages.each do |page| - pdf_text += page.text + context "with la_ldh client agency" do + before do + cbv_flow.update!(client_agency_id: "la_ldh") + end + context "when rendering for a caseworker" do + it "shows the right client information fields" do + get :show, format: :pdf, params: { + is_caseworker: "true" + } + + pdf = PDF::Reader.new(StringIO.new(response.body)) + pdf_text = "" + pdf.pages.each do |page| + pdf_text += page.text + end + + expect(pdf_text).to include("Client-provided information") + expect(pdf_text).to include("Medicaid case number") + expect(pdf_text).to include("Date of birth") + expect(pdf_text).to include("SSN") end + end + + context "when rendering for a client" do + it "does not show the client information fields" do + get :show, format: :pdf - expect(pdf_text).not_to include(I18n.t("cbv.applicant_informations.sandbox.fields.first_name.prompt")) - expect(pdf_text).not_to include(I18n.t("cbv.applicant_informations.sandbox.fields.middle_name.prompt")) - expect(pdf_text).not_to include(I18n.t("cbv.applicant_informations.sandbox.fields.last_name.prompt")) - expect(pdf_text).not_to include(I18n.t("cbv.applicant_informations.sandbox.fields.case_number.prompt")) + pdf = PDF::Reader.new(StringIO.new(response.body)) + pdf_text = "" + pdf.pages.each do |page| + pdf_text += page.text + end + + expect(pdf_text).to include("Client-provided information") + expect(pdf_text).to include("Medicaid case number") + expect(pdf_text).to include("Date of birth") + expect(pdf_text).not_to include("SSN") + end end end end