From 0eec2063f4bd2d382894a6048e29fa9273d87587 Mon Sep 17 00:00:00 2001 From: imtiazAhmd Date: Thu, 14 Nov 2024 08:30:09 +0000 Subject: [PATCH 01/14] Adds search filter functionality --- app/controllers/nsm/searches_controller.rb | 1 + app/forms/search_form.rb | 5 +++++ app/models/submission.rb | 4 ++++ app/views/shared/_search.html.erb | 9 +++++++++ config/locales/en.yml | 1 + config/locales/en/nsm/search.yml | 2 ++ 6 files changed, 22 insertions(+) diff --git a/app/controllers/nsm/searches_controller.rb b/app/controllers/nsm/searches_controller.rb index ee3bdc483..bd4058125 100644 --- a/app/controllers/nsm/searches_controller.rb +++ b/app/controllers/nsm/searches_controller.rb @@ -24,6 +24,7 @@ def search_params :updated_from, :updated_to, :status_with_assignment, + :high_value, :caseworker_id, :sort_by, :sort_direction diff --git a/app/forms/search_form.rb b/app/forms/search_form.rb index 39688c020..adffcb6be 100644 --- a/app/forms/search_form.rb +++ b/app/forms/search_form.rb @@ -13,6 +13,7 @@ class SearchForm < SearchResults attribute :status_with_assignment, :string attribute :caseworker_id, :string attribute :application_type, :string + attribute :high_value, :boolean validate :at_least_one_field_set validates :application_type, presence: true @@ -26,6 +27,10 @@ def caseworkers [show_all] + User.order(:last_name, :first_name).map { Option.new(_1.id, _1.display_name) } end + def claim_values + [show_all] + %i[high_value].map { Option.new(_1, I18n.t("search.claim_values.#{_1}")) } + end + def statuses [show_all] + %i[ not_assigned diff --git a/app/models/submission.rb b/app/models/submission.rb index 808763825..d4a19984a 100644 --- a/app/models/submission.rb +++ b/app/models/submission.rb @@ -37,6 +37,10 @@ def assigned_user @assigned_user ||= User.find_by(id: assigned_user_id) || assignments.first&.user end + def high_value + submission.data['cost_summary']['high_value'] + end + class << self def load_from_app_store(submission_id) data = AppStoreClient.new.get_submission(submission_id) diff --git a/app/views/shared/_search.html.erb b/app/views/shared/_search.html.erb index e531e2ea6..ddd34bee8 100644 --- a/app/views/shared/_search.html.erb +++ b/app/views/shared/_search.html.erb @@ -65,6 +65,15 @@
+
+
+ <%= f.govuk_collection_select :high_value, + @search_form.claim_values, + :value, + :label, + label: { text: t(".claim_value"), size: 's' } %> +
+
<%= f.govuk_collection_select :status_with_assignment, diff --git a/config/locales/en.yml b/config/locales/en.yml index 1b21d633a..a12fafedb 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -71,6 +71,7 @@ en: updated_filter_hint: Enter a start date, end date or both, for example, 17/5/2024 updated_from: Last updated from updated_to: Last updated to + claim_value: Claim value search_results: zero: There are no results that match the search criteria one: "%{count} Search result" diff --git a/config/locales/en/nsm/search.yml b/config/locales/en/nsm/search.yml index 115d0d13a..3af308bdb 100644 --- a/config/locales/en/nsm/search.yml +++ b/config/locales/en/nsm/search.yml @@ -13,6 +13,8 @@ en: rejected: Rejected expired: Expired unassigned: Unassigned + claim_values: + high_value: High value nsm: searches: show: From 019ed4efb79236d7b4b44abed8b95f424ba37d58 Mon Sep 17 00:00:00 2001 From: imtiazAhmd Date: Thu, 14 Nov 2024 14:52:21 +0000 Subject: [PATCH 02/14] Updates search view condition --- app/controllers/dashboards_controller.rb | 3 ++- app/views/shared/_search.html.erb | 18 ++++++++++-------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/app/controllers/dashboards_controller.rb b/app/controllers/dashboards_controller.rb index e027dbcf4..4e091b4a8 100644 --- a/app/controllers/dashboards_controller.rb +++ b/app/controllers/dashboards_controller.rb @@ -46,7 +46,8 @@ def search_params :caseworker_id, :sort_by, :sort_direction, - :application_type + :application_type, + :high_value ).merge(default_params) end diff --git a/app/views/shared/_search.html.erb b/app/views/shared/_search.html.erb index ddd34bee8..f2e3aeb01 100644 --- a/app/views/shared/_search.html.erb +++ b/app/views/shared/_search.html.erb @@ -65,15 +65,17 @@
-
-
- <%= f.govuk_collection_select :high_value, - @search_form.claim_values, - :value, - :label, - label: { text: t(".claim_value"), size: 's' } %> + <% if @search_form.application_type == 'crm7' %> +
+
+ <%= f.govuk_collection_select :high_value, + @search_form.claim_values, + :value, + :label, + label: { text: t(".claim_value"), size: 's' } %> +
-
+ <% end %>
<%= f.govuk_collection_select :status_with_assignment, From c9667b20388085e1413a6d6e6b289c906e8a3f28 Mon Sep 17 00:00:00 2001 From: ivanELEC Date: Thu, 14 Nov 2024 17:42:41 +0000 Subject: [PATCH 03/14] remove uneeded method --- app/models/submission.rb | 4 ---- 1 file changed, 4 deletions(-) diff --git a/app/models/submission.rb b/app/models/submission.rb index d4a19984a..808763825 100644 --- a/app/models/submission.rb +++ b/app/models/submission.rb @@ -37,10 +37,6 @@ def assigned_user @assigned_user ||= User.find_by(id: assigned_user_id) || assignments.first&.user end - def high_value - submission.data['cost_summary']['high_value'] - end - class << self def load_from_app_store(submission_id) data = AppStoreClient.new.get_submission(submission_id) From 95fe452effb42b43890fd72b7b33ccf811575be1 Mon Sep 17 00:00:00 2001 From: ivanELEC Date: Thu, 14 Nov 2024 17:47:36 +0000 Subject: [PATCH 04/14] temporarily change app store for testing --- helm_deploy/values-dev.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helm_deploy/values-dev.yaml b/helm_deploy/values-dev.yaml index da1916c74..b1f14ec4d 100644 --- a/helm_deploy/values-dev.yaml +++ b/helm_deploy/values-dev.yaml @@ -57,7 +57,7 @@ resources: variables: environment: development - appStoreUrl: https://main-nscc-store-dev.cloud-platform.service.justice.gov.uk + appStoreUrl: http://crm457-2154-add-hi.laa-crime-application-store-dev.svc.cluster.local enableSyncTriggerEndpoint: 'true' allowIndexing: 'false' From 59c65e8a2f0dfb864acfd82eb4fa8182f89cb47a Mon Sep 17 00:00:00 2001 From: ivanELEC Date: Thu, 14 Nov 2024 18:08:04 +0000 Subject: [PATCH 05/14] Revert "temporarily change app store for testing" This reverts commit 95fe452effb42b43890fd72b7b33ccf811575be1. --- helm_deploy/values-dev.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helm_deploy/values-dev.yaml b/helm_deploy/values-dev.yaml index b1f14ec4d..da1916c74 100644 --- a/helm_deploy/values-dev.yaml +++ b/helm_deploy/values-dev.yaml @@ -57,7 +57,7 @@ resources: variables: environment: development - appStoreUrl: http://crm457-2154-add-hi.laa-crime-application-store-dev.svc.cluster.local + appStoreUrl: https://main-nscc-store-dev.cloud-platform.service.justice.gov.uk enableSyncTriggerEndpoint: 'true' allowIndexing: 'false' From 96f27030126c37678b6ce62aac831134f3a4fef9 Mon Sep 17 00:00:00 2001 From: ivanELEC Date: Fri, 15 Nov 2024 09:51:04 +0000 Subject: [PATCH 06/14] Use safer logic for whether or not high value selection shows in search --- app/views/shared/_search.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/shared/_search.html.erb b/app/views/shared/_search.html.erb index f2e3aeb01..ea0ab2696 100644 --- a/app/views/shared/_search.html.erb +++ b/app/views/shared/_search.html.erb @@ -65,7 +65,7 @@
- <% if @search_form.application_type == 'crm7' %> + <% if choose_application_type || @search_form.application_type == 'crm7' %>
<%= f.govuk_collection_select :high_value, From d5c6f802af36f642d914ef453253f8c557f04fcc Mon Sep 17 00:00:00 2001 From: imtiazAhmd Date: Thu, 14 Nov 2024 08:30:09 +0000 Subject: [PATCH 07/14] Adds search filter functionality --- app/controllers/nsm/searches_controller.rb | 1 + app/forms/search_form.rb | 5 +++++ app/models/submission.rb | 4 ++++ app/views/shared/_search.html.erb | 9 +++++++++ config/locales/en.yml | 1 + config/locales/en/nsm/search.yml | 2 ++ 6 files changed, 22 insertions(+) diff --git a/app/controllers/nsm/searches_controller.rb b/app/controllers/nsm/searches_controller.rb index ee3bdc483..bd4058125 100644 --- a/app/controllers/nsm/searches_controller.rb +++ b/app/controllers/nsm/searches_controller.rb @@ -24,6 +24,7 @@ def search_params :updated_from, :updated_to, :status_with_assignment, + :high_value, :caseworker_id, :sort_by, :sort_direction diff --git a/app/forms/search_form.rb b/app/forms/search_form.rb index 39688c020..adffcb6be 100644 --- a/app/forms/search_form.rb +++ b/app/forms/search_form.rb @@ -13,6 +13,7 @@ class SearchForm < SearchResults attribute :status_with_assignment, :string attribute :caseworker_id, :string attribute :application_type, :string + attribute :high_value, :boolean validate :at_least_one_field_set validates :application_type, presence: true @@ -26,6 +27,10 @@ def caseworkers [show_all] + User.order(:last_name, :first_name).map { Option.new(_1.id, _1.display_name) } end + def claim_values + [show_all] + %i[high_value].map { Option.new(_1, I18n.t("search.claim_values.#{_1}")) } + end + def statuses [show_all] + %i[ not_assigned diff --git a/app/models/submission.rb b/app/models/submission.rb index 808763825..d4a19984a 100644 --- a/app/models/submission.rb +++ b/app/models/submission.rb @@ -37,6 +37,10 @@ def assigned_user @assigned_user ||= User.find_by(id: assigned_user_id) || assignments.first&.user end + def high_value + submission.data['cost_summary']['high_value'] + end + class << self def load_from_app_store(submission_id) data = AppStoreClient.new.get_submission(submission_id) diff --git a/app/views/shared/_search.html.erb b/app/views/shared/_search.html.erb index e531e2ea6..ddd34bee8 100644 --- a/app/views/shared/_search.html.erb +++ b/app/views/shared/_search.html.erb @@ -65,6 +65,15 @@
+
+
+ <%= f.govuk_collection_select :high_value, + @search_form.claim_values, + :value, + :label, + label: { text: t(".claim_value"), size: 's' } %> +
+
<%= f.govuk_collection_select :status_with_assignment, diff --git a/config/locales/en.yml b/config/locales/en.yml index 1b21d633a..a12fafedb 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -71,6 +71,7 @@ en: updated_filter_hint: Enter a start date, end date or both, for example, 17/5/2024 updated_from: Last updated from updated_to: Last updated to + claim_value: Claim value search_results: zero: There are no results that match the search criteria one: "%{count} Search result" diff --git a/config/locales/en/nsm/search.yml b/config/locales/en/nsm/search.yml index 115d0d13a..3af308bdb 100644 --- a/config/locales/en/nsm/search.yml +++ b/config/locales/en/nsm/search.yml @@ -13,6 +13,8 @@ en: rejected: Rejected expired: Expired unassigned: Unassigned + claim_values: + high_value: High value nsm: searches: show: From 425974258c34d5c8f86ebd40463a591de576e33a Mon Sep 17 00:00:00 2001 From: imtiazAhmd Date: Thu, 14 Nov 2024 14:52:21 +0000 Subject: [PATCH 08/14] Updates search view condition --- app/controllers/dashboards_controller.rb | 3 ++- app/views/shared/_search.html.erb | 18 ++++++++++-------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/app/controllers/dashboards_controller.rb b/app/controllers/dashboards_controller.rb index e027dbcf4..4e091b4a8 100644 --- a/app/controllers/dashboards_controller.rb +++ b/app/controllers/dashboards_controller.rb @@ -46,7 +46,8 @@ def search_params :caseworker_id, :sort_by, :sort_direction, - :application_type + :application_type, + :high_value ).merge(default_params) end diff --git a/app/views/shared/_search.html.erb b/app/views/shared/_search.html.erb index ddd34bee8..f2e3aeb01 100644 --- a/app/views/shared/_search.html.erb +++ b/app/views/shared/_search.html.erb @@ -65,15 +65,17 @@
-
-
- <%= f.govuk_collection_select :high_value, - @search_form.claim_values, - :value, - :label, - label: { text: t(".claim_value"), size: 's' } %> + <% if @search_form.application_type == 'crm7' %> +
+
+ <%= f.govuk_collection_select :high_value, + @search_form.claim_values, + :value, + :label, + label: { text: t(".claim_value"), size: 's' } %> +
-
+ <% end %>
<%= f.govuk_collection_select :status_with_assignment, From a3ea4e30d99ab6e632d47779abce5145070e151f Mon Sep 17 00:00:00 2001 From: ivanELEC Date: Thu, 14 Nov 2024 17:42:41 +0000 Subject: [PATCH 09/14] remove uneeded method --- app/models/submission.rb | 4 ---- 1 file changed, 4 deletions(-) diff --git a/app/models/submission.rb b/app/models/submission.rb index d4a19984a..808763825 100644 --- a/app/models/submission.rb +++ b/app/models/submission.rb @@ -37,10 +37,6 @@ def assigned_user @assigned_user ||= User.find_by(id: assigned_user_id) || assignments.first&.user end - def high_value - submission.data['cost_summary']['high_value'] - end - class << self def load_from_app_store(submission_id) data = AppStoreClient.new.get_submission(submission_id) From 554849ba4e858223c388178e278ddc731dd886cf Mon Sep 17 00:00:00 2001 From: ivanELEC Date: Thu, 14 Nov 2024 17:47:36 +0000 Subject: [PATCH 10/14] temporarily change app store for testing --- helm_deploy/values-dev.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helm_deploy/values-dev.yaml b/helm_deploy/values-dev.yaml index da1916c74..b1f14ec4d 100644 --- a/helm_deploy/values-dev.yaml +++ b/helm_deploy/values-dev.yaml @@ -57,7 +57,7 @@ resources: variables: environment: development - appStoreUrl: https://main-nscc-store-dev.cloud-platform.service.justice.gov.uk + appStoreUrl: http://crm457-2154-add-hi.laa-crime-application-store-dev.svc.cluster.local enableSyncTriggerEndpoint: 'true' allowIndexing: 'false' From 16463b2f154370d3dfa68bb3379b40db010a67f8 Mon Sep 17 00:00:00 2001 From: ivanELEC Date: Thu, 14 Nov 2024 18:08:04 +0000 Subject: [PATCH 11/14] Revert "temporarily change app store for testing" This reverts commit 95fe452effb42b43890fd72b7b33ccf811575be1. --- helm_deploy/values-dev.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helm_deploy/values-dev.yaml b/helm_deploy/values-dev.yaml index b1f14ec4d..da1916c74 100644 --- a/helm_deploy/values-dev.yaml +++ b/helm_deploy/values-dev.yaml @@ -57,7 +57,7 @@ resources: variables: environment: development - appStoreUrl: http://crm457-2154-add-hi.laa-crime-application-store-dev.svc.cluster.local + appStoreUrl: https://main-nscc-store-dev.cloud-platform.service.justice.gov.uk enableSyncTriggerEndpoint: 'true' allowIndexing: 'false' From 739e4b22d5d792a6db48c20601b67ae6ec95bed5 Mon Sep 17 00:00:00 2001 From: ivanELEC Date: Fri, 15 Nov 2024 09:51:04 +0000 Subject: [PATCH 12/14] Use safer logic for whether or not high value selection shows in search --- app/views/shared/_search.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/shared/_search.html.erb b/app/views/shared/_search.html.erb index f2e3aeb01..ea0ab2696 100644 --- a/app/views/shared/_search.html.erb +++ b/app/views/shared/_search.html.erb @@ -65,7 +65,7 @@
- <% if @search_form.application_type == 'crm7' %> + <% if choose_application_type || @search_form.application_type == 'crm7' %>
<%= f.govuk_collection_select :high_value, From 26e136280ed239ad352aa70812135b8e2da66517 Mon Sep 17 00:00:00 2001 From: ivanELEC Date: Thu, 21 Nov 2024 11:23:49 +0000 Subject: [PATCH 13/14] Temporarily use dev branch app store --- helm_deploy/values-dev.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helm_deploy/values-dev.yaml b/helm_deploy/values-dev.yaml index da1916c74..b1f14ec4d 100644 --- a/helm_deploy/values-dev.yaml +++ b/helm_deploy/values-dev.yaml @@ -57,7 +57,7 @@ resources: variables: environment: development - appStoreUrl: https://main-nscc-store-dev.cloud-platform.service.justice.gov.uk + appStoreUrl: http://crm457-2154-add-hi.laa-crime-application-store-dev.svc.cluster.local enableSyncTriggerEndpoint: 'true' allowIndexing: 'false' From 5bbd7d06d42197d0d23e6e9c4dffcc6d56e0b896 Mon Sep 17 00:00:00 2001 From: ivanELEC Date: Fri, 22 Nov 2024 11:53:01 +0000 Subject: [PATCH 14/14] update validation for one field set --- app/forms/search_form.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/forms/search_form.rb b/app/forms/search_form.rb index adffcb6be..99de36964 100644 --- a/app/forms/search_form.rb +++ b/app/forms/search_form.rb @@ -55,7 +55,7 @@ def at_least_one_field_set fields = [:query, :submitted_from, :submitted_to, :updated_from, :updated_to, :status_with_assignment, - :caseworker_id] + :caseworker_id, :high_value] field_set = fields.any? do |field| send(field).present?