diff --git a/app/controllers/admin/submissions_controller.rb b/app/controllers/admin/submissions_controller.rb index 6cef38022..0bb14edc1 100644 --- a/app/controllers/admin/submissions_controller.rb +++ b/app/controllers/admin/submissions_controller.rb @@ -220,7 +220,7 @@ def set_submission end def status_params - params.require(:submission).permit(:aasm_state) + params.permit(:aasm_state) end def tag_params diff --git a/app/models/submission.rb b/app/models/submission.rb index 328ff7995..734dc3b74 100644 --- a/app/models/submission.rb +++ b/app/models/submission.rb @@ -31,7 +31,7 @@ class Submission < ApplicationRecord transitions from: [:acknowledged], to: :dispatched end event :respond do - transitions from: %i[dispatched archived], to: :responded + transitions from: %i[dispatched], to: :responded end event :archive do transitions to: :archived diff --git a/app/views/admin/cx_collections/_form.html.erb b/app/views/admin/cx_collections/_form.html.erb index 69ef31c66..7491e10a9 100644 --- a/app/views/admin/cx_collections/_form.html.erb +++ b/app/views/admin/cx_collections/_form.html.erb @@ -1,4 +1,4 @@ -<%= form_with(model: cx_collection, url: (cx_collection.persisted? ? admin_cx_collection_path(cx_collection) : admin_cx_collections_path), class: "usa-form", local: true, data: { turbo: false }) do |form| %> +<%= form_with(model: cx_collection, url: (cx_collection.persisted? ? admin_cx_collection_path(cx_collection) : admin_cx_collections_path), local: true, data: { turbo: false }) do |form| %> <%- if cx_collection.errors.any? %>

<%= pluralize(cx_collection.errors.count, "error") %> prohibited this cx_collection from being saved:

@@ -27,20 +27,24 @@
<%= form.label :service_provider_id, "HISP Service Provider", class: "usa-label" %> - <%= form.select :service_provider_id, ServiceProvider.active.includes(:organization).order("organizations.abbreviation", :name).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.active.includes(:organization).order("organizations.abbreviation", :name).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, { include_blank: true }, {}, { class: "usa-select", required: true } do %> - <% Service.hisp.includes(:organization).each do |h| %> - <%= content_tag :option, - "#{h.organization.abbreviation} - #{h.organization.name} - #{h.name}", value: h.id, - "data-service-provider-id" => h.service_provider_id, - selected: (h.id == cx_collection.service_id) - %> +
+ <%= form.select :service_id, { include_blank: true }, {}, { class: "usa-select", required: true } do %> + <% Service.hisp.includes(:organization).each do |h| %> + <%= content_tag :option, + "#{h.organization.abbreviation} - #{h.organization.name} - #{h.name}", value: h.id, + "data-service-provider-id" => h.service_provider_id, + selected: (h.id == cx_collection.service_id) + %> + <% end %> <% end %> - <% end %> +
diff --git a/app/views/admin/forms/_admin_options.html.erb b/app/views/admin/forms/_admin_options.html.erb index 3fd079621..0aaddfa11 100644 --- a/app/views/admin/forms/_admin_options.html.erb +++ b/app/views/admin/forms/_admin_options.html.erb @@ -26,7 +26,9 @@
<%= f.label :organization_id, "Organization", class: "usa-label" %> - <%= f.select :organization_id, options_for_select(organization_dropdown_options, selected: (@form.organization ? @form.organization.id : nil)), { prompt: "Select an Organization" }, { class: "usa-select" } %> +
+ <%= f.select :organization_id, options_for_select(organization_dropdown_options, selected: (@form.organization ? @form.organization.id : nil)), { prompt: "Select an Organization" }, { class: "usa-select" } %> +
diff --git a/app/views/admin/forms/new.html.erb b/app/views/admin/forms/new.html.erb index 94e3857f4..24291377d 100644 --- a/app/views/admin/forms/new.html.erb +++ b/app/views/admin/forms/new.html.erb @@ -64,9 +64,6 @@ Create a new form
-

- Create a new form from scratch. -

<%= render 'form', form: @form %>
@@ -76,16 +73,16 @@ Copy a form -

- Copy an existing form and give it a new name. -

<%- if @surveys.present? %> <%= form_tag(copy_id_admin_forms_path) do %> - <%= select_tag "id", options_from_collection_for_select(@surveys, "short_uuid", "name"), { - prompt: "Select a form", - class: "usa-select", - "aria-labelledby" => "copy-form-label" - } %> + +
+ <%= select_tag "id", options_from_collection_for_select(@surveys, "short_uuid", "name"), { + prompt: "Select a form", + class: "usa-select", + "aria-labelledby" => "copy-form-label" + } %> +

<%= submit_tag "Copy Form", class: "usa-button", disabled: true %>

diff --git a/app/views/admin/submissions/_status_form.html.erb b/app/views/admin/submissions/_status_form.html.erb index 5834194be..41b825843 100644 --- a/app/views/admin/submissions/_status_form.html.erb +++ b/app/views/admin/submissions/_status_form.html.erb @@ -1,39 +1,42 @@ -<%= form_with(model: submission, url: admin_form_submission_path(form, submission), local: true) do |f| %> - <%- if form.errors.any? %> -
-

<%= pluralize(form.errors.count, "error") %> prohibited this form from being saved:

+
+ Submission status + <%= link_to "https://github.com/GSA/touchpoints/wiki/Feedback-lifecyle", target: "_blank", rel: "noopener" do %> + + <% end %> + +

+ Every response begins with a "received" status. + You have the option to track additional states of a response by updating its status. +

- <% form.errors.full_messages.each do |message| %> -
-
-

Error

-

- <%= message %> -

+
    + <% @submission.aasm.states.each do |state| %> +
  1. +

    + "> + <%= state.name.capitalize %> + +
    +

    + <% unique_transitions = Set.new %> + <% @submission.aasm.events(permitted: true).each do |event| %> + <% if @submission.aasm_state == state.to_s %> + <% event.transitions.each do |transition| %> + <% if unique_transitions.add?(transition.to) && @submission.aasm_state != transition.to.to_s %> + <%= link_to event.to_s.capitalize, + admin_form_submission_path(form, @submission, aasm_state: transition.to), + method: :patch + %>  + <% end %> + <% end %> + <% end %> + <% end %>
    -
- <% end %> -
- <% end %> - -
-
-

- Every response begins with a "received" status. - You have the option to track - additional states of a response by updating its status. -

-
-
- <%= f.label :aasm_state, "Status", class: "usa-label" %> - <%= f.select :aasm_state, [:received, :acknowledged, :dispatched, :responded], {}, class: "usa-select" %> -
-
-
-
-
- <%= f.submit "Update status", class: "usa-button" %> -<% end %> +

+ + <% end %> + +