From 34ae9549fb3740bc830322f2e282d5dd32d491c0 Mon Sep 17 00:00:00 2001 From: Ryan Wold Date: Thu, 20 Jul 2023 19:23:56 -0700 Subject: [PATCH 1/3] start a11_v2 form logic * update select tag --- .../admin/service_providers/_form.html.erb | 6 ++- app/views/submissions/new.html.erb | 47 +++++++++++++++++++ 2 files changed, 52 insertions(+), 1 deletion(-) diff --git a/app/views/admin/service_providers/_form.html.erb b/app/views/admin/service_providers/_form.html.erb index e9c06e9a3..a4a4ab3e3 100644 --- a/app/views/admin/service_providers/_form.html.erb +++ b/app/views/admin/service_providers/_form.html.erb @@ -62,7 +62,11 @@
<%= form.label :portfolio_manager_email, "Portfolio Manager (Service Manager permissions)", class: "usa-label" %> - <%= select_tag :portfolio_manager_email, options_for_select(User.service_managers.order(:email).map { |user| [user.email, user.email] }), prompt: "Select a user", id: "add-user-id", style: "display: inline-block; margin-right: 1em;", class: "usa-select" %> + <%= form.select :portfolio_manager_email, + options_for_select(User.service_managers.order(:email).map { |user| [user.email, user.email] }, selected: service_provider.portfolio_manager_email ), + { prompt: "Select a user" }, + style: "display: inline-block; margin-right: 1em;", + class: "usa-select" %>
diff --git a/app/views/submissions/new.html.erb b/app/views/submissions/new.html.erb index 1d468ae3e..197058fc2 100644 --- a/app/views/submissions/new.html.erb +++ b/app/views/submissions/new.html.erb @@ -17,3 +17,50 @@
<% end %>
+ +<% if @form.kind == "a11_v2" %> + +<% end %> \ No newline at end of file From 90e44bafea1149ce535469d47fda9972df39624c Mon Sep 17 00:00:00 2001 From: Ryan Wold Date: Thu, 20 Jul 2023 20:11:37 -0700 Subject: [PATCH 2/3] update the a11 v2 seeds --- db/seeds/forms/a11_v2.rb | 34 ++++++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/db/seeds/forms/a11_v2.rb b/db/seeds/forms/a11_v2.rb index e506ca34c..6c7889422 100644 --- a/db/seeds/forms/a11_v2.rb +++ b/db/seeds/forms/a11_v2.rb @@ -21,12 +21,21 @@ def self.a11_v2 question_01 = Question.create!({ form: a11_v2_form, form_section: (a11_v2_form.form_sections.first), - text: "Please rate your experience", - question_type: "star_radio_buttons", + text: "Based on my experience Example Agency's Service, I trust Example Agency to deliver on their mission for the American public.", + question_type: "radio_buttons", position: 1, answer_field: :answer_01, is_required: true }) + [["👍", 1], ["👎", 0]].each_with_index do |value, i| + QuestionOption.create!({ + question: question_01, + text: value[0], + value: value[1], + position: i + 1 + }) + end + question_02 = Question.create!({ form: a11_v2_form, form_section: (a11_v2_form.form_sections.first), @@ -47,10 +56,27 @@ def self.a11_v2 question_03 = Question.create!({ form: a11_v2_form, form_section: (a11_v2_form.form_sections.first), - text: "Additional Comments", - question_type: "textarea", + text: "What went well?", + question_type: "checkbox", position: 3, answer_field: :answer_03, + is_required: true + }) + ["1 down", "2 down", "3 down", "4 down"].each_with_index do |value, i| + QuestionOption.create!({ + question: question_03, + text: value.to_s, + value: value, + position: i + 1 + }) + end + question_03 = Question.create!({ + form: a11_v2_form, + form_section: (a11_v2_form.form_sections.first), + text: "Additional Comments", + question_type: "textarea", + position: 4, + answer_field: :answer_04, }) a11_v2_form From 500ff6711c02c4c0c3418217cc12dcae28080437 Mon Sep 17 00:00:00 2001 From: Ryan Wold Date: Wed, 26 Jul 2023 10:10:39 -0700 Subject: [PATCH 3/3] add contact_center to Service object --- app/controllers/admin/services_controller.rb | 1 + app/serializers/service_serializer.rb | 1 + app/views/admin/services/_form.html.erb | 9 +++++++++ app/views/admin/services/show.html.erb | 16 +++++++++++++--- ...230726162206_add_contact_center_to_service.rb | 5 +++++ db/schema.rb | 3 ++- spec/features/admin/services_spec.rb | 2 ++ 7 files changed, 33 insertions(+), 4 deletions(-) create mode 100644 db/migrate/20230726162206_add_contact_center_to_service.rb diff --git a/app/controllers/admin/services_controller.rb b/app/controllers/admin/services_controller.rb index aeb1acae2..456baeaaa 100644 --- a/app/controllers/admin/services_controller.rb +++ b/app/controllers/admin/services_controller.rb @@ -259,6 +259,7 @@ def service_params :estimated_annual_volume_of_customers, :hisp, :justification_text, + :contact_center, :name, :non_digital_explanation, diff --git a/app/serializers/service_serializer.rb b/app/serializers/service_serializer.rb index 8a309b41c..963b22e42 100644 --- a/app/serializers/service_serializer.rb +++ b/app/serializers/service_serializer.rb @@ -11,6 +11,7 @@ class ServiceSerializer < ActiveModel::Serializer :service_provider_name, :service_provider_slug, :justification_text, + :contact_center, :kind, :transactional, :notes, diff --git a/app/views/admin/services/_form.html.erb b/app/views/admin/services/_form.html.erb index c555ab059..9982195ec 100644 --- a/app/views/admin/services/_form.html.erb +++ b/app/views/admin/services/_form.html.erb @@ -42,6 +42,15 @@ <%= form.text_area :description, class: "usa-textarea" %> +
+
+ Contact Center? +
+ <%= form.check_box :contact_center, class: "usa-checkbox__input" %> + <%= form.label :contact_center, "Contact Center?", class: "usa-checkbox__label" %> +
+
+
<%= form.label :multi_agency_service, "Does the public have to perform steps or tasks with multiple agencies for this service?", class: "usa-label" %> Does the public have to perform steps or tasks with multiple agencies for this service? diff --git a/app/views/admin/services/show.html.erb b/app/views/admin/services/show.html.erb index ce8084394..cec15c0e9 100644 --- a/app/views/admin/services/show.html.erb +++ b/app/views/admin/services/show.html.erb @@ -51,7 +51,7 @@

Office
- <%= @service.office %> + <%= @service.office.present? ? @service.office : "---" %>

Service Provider @@ -66,16 +66,20 @@

Description
- <%= @service.description? ? to_markdown(@service.description) : "empty" %> + <%= @service.description? ? to_markdown(@service.description) : "---" %>

Service type
+ <% if @service.kind %> <% @service.kind.each do |i| %> <%= i %> -
+
<% end if @service.kind.present? %> + <% else %> + --- + <% end %>

@@ -85,6 +89,12 @@
<%= @service.hisp? ? "✅" : "❌" %>

+
+ Contact center? +

+ <%= @service.contact_center? ? "✅" : "❌" %> +

+
Transactional service?

diff --git a/db/migrate/20230726162206_add_contact_center_to_service.rb b/db/migrate/20230726162206_add_contact_center_to_service.rb new file mode 100644 index 000000000..8513955ed --- /dev/null +++ b/db/migrate/20230726162206_add_contact_center_to_service.rb @@ -0,0 +1,5 @@ +class AddContactCenterToService < ActiveRecord::Migration[7.0] + def change + add_column "services", :contact_center, :boolean, default: false + end +end diff --git a/db/schema.rb b/db/schema.rb index ef9f6699f..03ff89f5a 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[7.0].define(version: 2023_06_08_231430) do +ActiveRecord::Schema[7.0].define(version: 2023_07_26_162206) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -626,6 +626,7 @@ t.integer "bureau_id" t.string "office" t.boolean "designated_for_improvement_a11_280", default: false + t.boolean "contact_center", default: false t.index ["organization_id"], name: "index_services_on_organization_id" end diff --git a/spec/features/admin/services_spec.rb b/spec/features/admin/services_spec.rb index 72c853901..c18236a74 100644 --- a/spec/features/admin/services_spec.rb +++ b/spec/features/admin/services_spec.rb @@ -42,6 +42,7 @@ select(organization.name, from: 'service[organization_id]') fill_in :service_name, with: 'New Service Name' fill_in :service_description, with: "Lots of text\n\n#### Heading\n\n* 1\n* 2\n* 3" + find("[for=service_contact_center]").click find("label[for='service_hisp']").click select(service_provider.name, from: 'service[service_provider_id]') @@ -55,6 +56,7 @@ # renders markdown expect(page).to have_css('h4', text: 'Heading') expect(page).to have_css('ul li', text: '2') + expect(find(".contact-center")).to have_content('✅') end end end