diff --git a/Gemfile.lock b/Gemfile.lock
index 8dd993d79..24dcf86b9 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -356,7 +356,7 @@ GEM
public_suffix (5.0.3)
puma (6.4.0)
nio4r (~> 2.0)
- racc (1.7.1)
+ racc (1.7.2)
rack (2.2.8)
rack-cors (2.0.1)
rack (>= 2.0.0)
diff --git a/app/controllers/admin/cx_collection_details_controller.rb b/app/controllers/admin/cx_collection_details_controller.rb
index 95debf307..8a66f4e5b 100644
--- a/app/controllers/admin/cx_collection_details_controller.rb
+++ b/app/controllers/admin/cx_collection_details_controller.rb
@@ -1,5 +1,6 @@
class Admin::CxCollectionDetailsController < AdminController
before_action :set_cx_collection_detail, only: %i[ show edit update destroy ]
+ before_action :set_cx_collections, only: %i[ new edit ]
def index
@cx_collection_details = CxCollectionDetail.all
@@ -56,6 +57,14 @@ def set_cx_collection_detail
@cx_collection_detail = CxCollectionDetail.find(params[:id])
end
+ def set_cx_collections
+ if service_manager_permissions?
+ @cx_collections = CxCollection.all.includes(:organization)
+ else
+ @cx_collections = current_user.organization.cx_collections
+ end
+ end
+
def cx_collection_detail_params
params.require(:cx_collection_detail).permit(:cx_collection_id, :service_id, :transaction_point, :channel, :service_stage_id, :volume_of_customers, :volume_of_customers_provided_survey_opportunity, :volume_of_respondents, :omb_control_number, :federal_register_url, :reflection_text, :survey_type, :survey_title, :trust_question_text)
end
diff --git a/app/models/organization.rb b/app/models/organization.rb
index f277fd030..0a08b31e2 100644
--- a/app/models/organization.rb
+++ b/app/models/organization.rb
@@ -8,6 +8,7 @@ class Organization < ApplicationRecord
has_many :services
has_many :websites
has_many :collections
+ has_many :cx_collections
has_many :cscrm_data_collections
has_many :cscrm_data_collections2, class_name: "CscrmDataCollection2"
has_many :goals
diff --git a/app/views/admin/cscrm_data_collections/_form.html.erb b/app/views/admin/cscrm_data_collections/_form.html.erb
index 27bb48986..5617ba857 100644
--- a/app/views/admin/cscrm_data_collections/_form.html.erb
+++ b/app/views/admin/cscrm_data_collections/_form.html.erb
@@ -43,7 +43,7 @@
<%= form.label :quarter, class: "usa-label" %>
- <%= form.text_field :quarter, class: "usa-input", required: true %>
+ <%= form.number_field :quarter, class: "usa-input", required: true, min: 1, max: 4 %>
diff --git a/app/views/admin/cscrm_data_collections2/_form.html.erb b/app/views/admin/cscrm_data_collections2/_form.html.erb
index 6b0ae5c5d..6f70490a1 100644
--- a/app/views/admin/cscrm_data_collections2/_form.html.erb
+++ b/app/views/admin/cscrm_data_collections2/_form.html.erb
@@ -53,7 +53,7 @@
<%= form.label :quarter, class: "usa-label" %>
- <%= form.text_field :quarter, class: "usa-input", required: true %>
+ <%= form.number_field :quarter, class: "usa-input", required: true, min: 1, max: 4 %>
diff --git a/app/views/admin/cx_collection_details/_form.html.erb b/app/views/admin/cx_collection_details/_form.html.erb
index 3b73e2f5b..bd25ed744 100644
--- a/app/views/admin/cx_collection_details/_form.html.erb
+++ b/app/views/admin/cx_collection_details/_form.html.erb
@@ -15,7 +15,7 @@
<%= form.label :cx_collection_id, class: "usa-label" %>
<%= form.hidden_field :cx_collection_id, class: "usa-input", value: cx_collection_detail.cx_collection_id %>
<%= form.select :cx_collection_id,
- CxCollection.all.map { |collection| ["#{collection.name} - #{collection.organization.name}", collection.id]},
+ cx_collections.map { |collection| ["#{collection.name} - #{collection.organization.name}", collection.id]},
{ include_blank: true },
class: "usa-select" %>
@@ -53,7 +53,7 @@
<%= form.label :survey_type, class: "usa-label" %>
- <%= form.select :survey_type, [:seven_questions, :yes_no_buttons],
+ <%= form.select :survey_type, [["A-11 7 driver questions", :seven_questions], ["A-11 Yes/no thumbs buttons", :yes_no_buttons] ],
{ include_blank: true },
{ class: "usa-select" } %>
@@ -75,7 +75,7 @@
<%= form.label :federal_register_url, class: "usa-label" %>
- <%= form.number_field :federal_register_url, class: "usa-input" %>
+ <%= form.text_field :federal_register_url, class: "usa-input" %>
diff --git a/app/views/admin/cx_collection_details/edit.html.erb b/app/views/admin/cx_collection_details/edit.html.erb
index 527168549..256da82e4 100644
--- a/app/views/admin/cx_collection_details/edit.html.erb
+++ b/app/views/admin/cx_collection_details/edit.html.erb
@@ -9,7 +9,9 @@
<% end %>
-<%= render "form", cx_collection_detail: @cx_collection_detail %>
+<%= render "form",
+ cx_collection_detail: @cx_collection_detail,
+ cx_collections: @cx_collections %>
diff --git a/app/views/admin/cx_collection_details/new.html.erb b/app/views/admin/cx_collection_details/new.html.erb
index 3cdde43f5..0866da321 100644
--- a/app/views/admin/cx_collection_details/new.html.erb
+++ b/app/views/admin/cx_collection_details/new.html.erb
@@ -8,10 +8,9 @@
<% end %>
-<%= render "form", cx_collection_detail: @cx_collection_detail %>
+<%= render "form",
+ cx_collection_detail: @cx_collection_detail,
+ cx_collections: @cx_collections %>
-
-
- <%= link_to "Back to cx collection details", admin_cx_collection_details_path %>
-
+
\ No newline at end of file
diff --git a/app/views/admin/cx_collections/_form.html.erb b/app/views/admin/cx_collections/_form.html.erb
index e35191578..784a6b1e7 100644
--- a/app/views/admin/cx_collections/_form.html.erb
+++ b/app/views/admin/cx_collections/_form.html.erb
@@ -14,7 +14,7 @@
<% if performance_manager_permissions? %>
<%= form.label :user_id, class: "usa-label" %>
- <%= form.select :user_id, options_for_select(User.all.collect { |u| [u.email, u.id] }, cx_collection.user_id), { prompt: "Which User?", include_blank: true }, { class: "usa-select" } %>
+ <%= form.select :user_id, options_for_select(User.all.collect { |u| [u.email, u.id] }, cx_collection.user_id || current_user.id), { prompt: "Which User?", include_blank: true }, { class: "usa-select" } %>
<% else %>
<%= form.hidden_field :user_id, value: current_user.id %>
@@ -36,12 +36,7 @@
<%= form.label :service_provider_id, "HISP Service Provider", class: "usa-label" %>
- <%= form.select :service_provider_id, ServiceProvider.all.map { |h| ["#{h.organization.abbreviation} - #{h.organization.name} - #{h.name}", h.id] }, { include_blank: true }, { class: "usa-select", required: true } %>
-
-
-
- <%= form.label :service_id, "Service", class: "usa-label" %>
- <%= form.select :service_id, Service.all.map { |h| ["#{h.organization.abbreviation} - #{h.organization.name} - #{h.name}", h.id] }, { include_blank: true }, { class: "usa-select", required: true } %>
+ <%= form.select :service_provider_id, ServiceProvider.all.includes(:organization).map { |h| ["#{h.organization.abbreviation} - #{h.organization.name} - #{h.name}", h.id] }, { include_blank: true }, { class: "usa-select", required: true } %>
@@ -51,7 +46,7 @@
<%= form.label :quarter, class: "usa-label" %>
- <%= form.text_field :quarter, class: "usa-input", required: true %>
+ <%= form.number_field :quarter, class: "usa-input", required: true, min: 1, max: 4 %>
\ No newline at end of file
diff --git a/db/migrate/20231102184253_change_federal_register_url.rb b/db/migrate/20231102184253_change_federal_register_url.rb
new file mode 100644
index 000000000..e16f9df95
--- /dev/null
+++ b/db/migrate/20231102184253_change_federal_register_url.rb
@@ -0,0 +1,5 @@
+class ChangeFederalRegisterUrl < ActiveRecord::Migration[7.1]
+ def change
+ change_column :cx_collection_details, :federal_register_url, :string
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 55188491b..695ed061b 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.1].define(version: 2023_10_30_231924) do
+ActiveRecord::Schema[7.1].define(version: 2023_11_02_184253) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@@ -197,7 +197,7 @@
t.integer "volume_of_customers_provided_survey_opportunity"
t.integer "volume_of_respondents"
t.string "omb_control_number"
- t.integer "federal_register_url"
+ t.string "federal_register_url"
t.text "reflection_text"
t.text "survey_type"
t.text "survey_title"