From d7b3b667fc018db8a3083ae3ce09f12e2a89f9db Mon Sep 17 00:00:00 2001
From: Ryan Eddy <44847768+RyanEddyIC@users.noreply.github.com>
Date: Tue, 14 Jan 2025 20:36:47 -0500
Subject: [PATCH] more csp enabled cucumber fixes (#4904)
* create plan year cucumbers
* remove html_safe
* benefit application form cucumber fixes
* add missing comma
* fix check for disabled button
* qle cucumber fixes
* add save_btn pom
* fix disabled link cucumber step
* term sep type cucumber fixes
* immigration expiration cucumber fix
* fix send secure msg ajax trigger
* more fixes
* tribe field cucumber fix
* remove conditional for doc date field init
---------
Co-authored-by: kristinmerbach <78749008+kristinmerbach@users.noreply.github.com>
---
app/assets/javascripts/employee_role.js | 9 +-
.../javascripts/exchanges/hbx_profiles.js | 2 +-
app/assets/javascripts/families.js | 4 +
.../_new_benefit_application.html.slim | 86 +----------------
.../hbx_profiles/_new_secure_message.html.erb | 2 +-
.../new_benefit_application.js.erb | 94 ++++++++++++++++++-
.../docs_shared/_expiration_date.html.erb | 8 --
.../immigration_document_options.js.erb | 10 +-
.../_effective_on_kind_fields.html.erb | 5 -
.../insured/families/_qle_detail.html.erb | 4 +-
.../families/_terminate_confirmation.html.erb | 4 +-
.../insured/families/check_qle_date.js.erb | 8 +-
.../people/landing_pages/_personal.html.erb | 6 +-
.../inboxes/_individual_message.html.erb | 9 +-
.../v1/cards/_metal_level_select.html.slim | 41 ++++----
.../v1/cards/_sponsor_contributions.html.slim | 11 ++-
.../benefit_applications/_form.html.slim | 4 +-
.../benefit_applications/new.html.slim | 7 +-
.../benefit_applications/new.js.erb | 12 ++-
.../_benefit_application_fields.html.slim | 21 +++--
.../benefit_packages/_form.html.slim | 6 +-
.../prior_py_ivl_admin_sep_steps.rb | 3 +-
.../add_plan_year_for_employer.feature | 4 +-
.../view_eligibility_steps.rb | 2 +-
.../household_info_continue_button_steps.rb | 2 +-
features/step_definitions/individual_steps.rb | 4 +-
.../registration/ee_family_information.rb | 6 +-
27 files changed, 219 insertions(+), 155 deletions(-)
diff --git a/app/assets/javascripts/employee_role.js b/app/assets/javascripts/employee_role.js
index 02fd31c1c80..554a3231b32 100644
--- a/app/assets/javascripts/employee_role.js
+++ b/app/assets/javascripts/employee_role.js
@@ -101,10 +101,14 @@ $(function () {
});
});
+$(document).on('selectric-change', "#terminate-reason-select", function() {
+ EmployeeRole.disableTerminateSubmit($(this).data('enrollment-id'))
+})
+
var EmployeeRole = ( function( window, undefined ) {
function disableTerminateSubmit(hbx_id) {
- var target = $('#terminate_confirm_' + hbx_id);
- var terminate_reason = target.find('select.interaction-choice-control-terminate-reason').val();
+ var target = $("#terminate_confirm_" + hbx_id);
+ var terminate_reason = target.find('#terminate-reason-select').val();
if(terminate_reason == undefined || terminate_reason == ""){
target.find('.terminate_reason_submit').attr("disabled",true);
}else{
@@ -116,4 +120,3 @@ var EmployeeRole = ( function( window, undefined ) {
disableTerminateSubmit : disableTerminateSubmit,
};
})( window );
-
diff --git a/app/assets/javascripts/exchanges/hbx_profiles.js b/app/assets/javascripts/exchanges/hbx_profiles.js
index ac6cd509b00..ed64986e8d7 100644
--- a/app/assets/javascripts/exchanges/hbx_profiles.js
+++ b/app/assets/javascripts/exchanges/hbx_profiles.js
@@ -76,7 +76,7 @@ function confirmSecureMsg(event){
});
}
-$(document).on('click', '.btn-confirmation', function() {
+$(document).on('click', '.btn-confirmation.send-secure-msg-confirm', function() {
confirmSecureMsg(event);
return false;
});
diff --git a/app/assets/javascripts/families.js b/app/assets/javascripts/families.js
index d886adbb4b8..81b12be5ad2 100644
--- a/app/assets/javascripts/families.js
+++ b/app/assets/javascripts/families.js
@@ -65,6 +65,10 @@ function enableTransition() {
}
+ $(document).on('click', '.terminate_reason_submit', function() {
+ fetchDate($(this).data('enrollment-id'))
+ })
+
function fetchDate(id){
var date = document.getElementById(id).value;
document.getElementById(`terminate_date_${id}`).value = date;
diff --git a/app/views/exchanges/hbx_profiles/_new_benefit_application.html.slim b/app/views/exchanges/hbx_profiles/_new_benefit_application.html.slim
index 67218bc3601..bdd20e7e2af 100644
--- a/app/views/exchanges/hbx_profiles/_new_benefit_application.html.slim
+++ b/app/views/exchanges/hbx_profiles/_new_benefit_application.html.slim
@@ -1,5 +1,6 @@
= form_tag create_benefit_application_exchanges_hbx_profiles_path(benefit_sponsorship_id: @ba_form.benefit_sponsorship_id),class:'admin-plan-year-form', id: 'admin-create-ba', :method => :post, :remote => true do
= hidden_field_tag :employer_actions_id, params["employer_actions_id"]
+ = hidden_field_tag :start_on_options_json, @ba_form.start_on_options.to_json
br
.row
@@ -11,7 +12,7 @@
= l10n("hbx_profiles.effective_start_date")
br
.input-group
- = select_tag :start_on, options_for_select(@ba_form.start_on_options.keys), {:prompt => "SELECT START ON", class:'form-control floatlabel benefit-application-start-date', onchange:"selectedDate(this); validateInputs()", id:'baStartDate'}
+ = select_tag :start_on, options_for_select(@ba_form.start_on_options.keys), {:prompt => "SELECT START ON", class:'form-control floatlabel benefit-application-start-date', id:'baStartDate'}
.col-md-4
label[for="effectiveEndDate" style="font-weight:bold"]
= l10n("hbx_profiles.effective_end_date")
@@ -24,7 +25,7 @@
label[for="fullTimeEmployees" style="font-weight:bold"]
= l10n("hbx_profiles.full_time_employees")
br
- = text_field_tag :fte_count, nil, class:'form-control', id:'fteCount', onchange: "enableDisableSubmit()", onblur: "checkifValid(this)"
+ = text_field_tag :fte_count, nil, class:'form-control', id:'fteCount'
.required-item.hidden
= l10n("hbx_profiles.provide_fte_count")
br
@@ -51,87 +52,6 @@
button#adminCreatePyButton.pull-right.btn.btn-primary.disabled type="submit" data-disable-with=l10n("please_wait")
| Submit
-javascript:
- $( function() {
- $("#open_enrollment_start_on").datepicker();
- $("#open_enrollment_end_on").datepicker();
- $("#binder_due_date").datepicker();
- } );
-
- function selectedDate(element) {
- if (element && element.value) {
- assignBenefitApplicationDates(element.value)
- document.getElementById('open_enrollment_start_on').classList.remove('blocking');
- document.getElementById('open_enrollment_end_on').classList.remove('blocking');
- } else {
- resetInputOptions()
- }
- enableDisableSubmit()
- }
-
- function checkifValid(element) {
- input = element.closest('input');
- label = element.closest('.col-md-4').getElementsByTagName('label')[0];
- feedback = element.nextSibling;
- if (!element.value) {
- label.setAttribute("class", "required-feedback");
- input.setAttribute("class", "required-input");
- feedback.classList.remove('hidden');
- } else {
- feedback.classList.add('hidden');
- label.classList.remove('required-feedback');
- input.classList.remove('required-input');
- }
- }
-
- function validateInputs() {
- inputs = document.getElementsByClassName('admin-plan-year-form')[0].querySelectorAll('input');
- for (input of inputs) {
- if (input.id === 'open_enrollment_start_on' || input.id === 'open_enrollment_end_on') {
- checkifValid(input);
- }
- }
- }
-
- function closeRow(element) {
- element.closest('tr').remove();
- }
-
- var employeeCounts = {
- fte: Number
- }
-
- function enableDisableSubmit() {
- var start_on = document.getElementById('baStartDate');
- var end_on = document.getElementById('end_on');
- var oe_start_on = document.getElementById('open_enrollment_start_on');
- var oe_end_on = document.getElementById('open_enrollment_end_on');
- var fte_count = document.getElementById('fteCount');
-
- if (fte_count) {
- employeeCounts.fte = fte_count.value
- }
-
- if ((employeeCounts.fte >= 1) && start_on.value && end_on.value && oe_start_on.value && oe_end_on.value) {
- document.getElementById('adminCreatePyButton').classList.remove('disabled');
- } else {
- document.getElementById('adminCreatePyButton').classList.add('disabled')
- }
- }
-
- function resetInputOptions() {
- document.querySelector('input#end_on').value = '';
- document.querySelector("input#open_enrollment_start_on").value = '';
- document.querySelector("input#open_enrollment_end_on").value = '';
- }
-
- function assignBenefitApplicationDates(targetDate) {
- var date = JSON.parse('#{@ba_form.start_on_options.to_json.html_safe}');
- document.querySelector('input#end_on').value = getFormattedDate(date[targetDate]["benefit_application_end_on"]);
- document.querySelector("input#open_enrollment_start_on").value = getFormattedDate(date[targetDate]["open_enrollment_start_on"]);
- document.querySelector("input#open_enrollment_end_on").value = getFormattedDate(date[targetDate]["open_enrollment_end_on"]);
- }
-
css:
.required-feedback {
color: #dc3545;
diff --git a/app/views/exchanges/hbx_profiles/_new_secure_message.html.erb b/app/views/exchanges/hbx_profiles/_new_secure_message.html.erb
index 9242c53d92d..d9c85ec88d4 100644
--- a/app/views/exchanges/hbx_profiles/_new_secure_message.html.erb
+++ b/app/views/exchanges/hbx_profiles/_new_secure_message.html.erb
@@ -114,7 +114,7 @@
Are you sure you want to Send/Upload this message?
diff --git a/app/views/exchanges/hbx_profiles/new_benefit_application.js.erb b/app/views/exchanges/hbx_profiles/new_benefit_application.js.erb
index 7d221257a28..c27b6b5efd0 100644
--- a/app/views/exchanges/hbx_profiles/new_benefit_application.js.erb
+++ b/app/views/exchanges/hbx_profiles/new_benefit_application.js.erb
@@ -7,9 +7,99 @@ if ( $('tr.child-row:visible').length > 0 ) {
}
if ( !($parent_row.next().hasClass('child-row'))) {
- $parent_row.after('<%= j render "new_benefit_application"%> |
');
+ $parent_row.after('<%= j render "new_benefit_application"%> |
').ready(initNewBAForm());
$("li>a:contains('Collapse Form')").eq(containing_row.index()).removeClass('disabled');
$('.dropdown.pull-right').removeClass('open');
}
-applyJQDatePickers();
\ No newline at end of file
+applyJQDatePickers();
+
+function initNewBAForm() {
+ $(document).on('change', '#baStartDate', function() {
+ selectedDate(this);
+ validateInputs()
+ })
+
+ $(document).on('change', '#fteCount', function() {enableDisableSubmit()})
+ $(document).on('blur', '#fteCount', function() {checkifValid(this)})
+
+ $( function() {
+ $("#open_enrollment_start_on").datepicker();
+ $("#open_enrollment_end_on").datepicker();
+ $("#binder_due_date").datepicker();
+ } );
+
+ function selectedDate(element) {
+ if (element && element.value) {
+ assignBenefitApplicationDates(element.value)
+ document.getElementById('open_enrollment_start_on').classList.remove('blocking');
+ document.getElementById('open_enrollment_end_on').classList.remove('blocking');
+ } else {
+ resetInputOptions()
+ }
+ enableDisableSubmit()
+ }
+
+ function checkifValid(element) {
+ input = element.closest('input');
+ label = element.closest('.col-md-4').getElementsByTagName('label')[0];
+ feedback = element.nextSibling;
+ if (!element.value) {
+ label.setAttribute("class", "required-feedback");
+ input.setAttribute("class", "required-input");
+ feedback.classList.remove('hidden');
+ } else {
+ feedback.classList.add('hidden');
+ label.classList.remove('required-feedback');
+ input.classList.remove('required-input');
+ }
+ }
+
+ function validateInputs() {
+ inputs = document.getElementsByClassName('admin-plan-year-form')[0].querySelectorAll('input');
+ for (input of inputs) {
+ if (input.id === 'open_enrollment_start_on' || input.id === 'open_enrollment_end_on') {
+ checkifValid(input);
+ }
+ }
+ }
+
+ function closeRow(element) {
+ element.closest('tr').remove();
+ }
+
+ function enableDisableSubmit() {
+ var employeeCounts = {
+ fte: Number
+ }
+ var start_on = document.getElementById('baStartDate');
+ var end_on = document.getElementById('end_on');
+ var oe_start_on = document.getElementById('open_enrollment_start_on');
+ var oe_end_on = document.getElementById('open_enrollment_end_on');
+ var fte_count = document.getElementById('fteCount');
+
+ if (fte_count) {
+ employeeCounts.fte = fte_count.value
+ }
+
+ if ((employeeCounts.fte >= 1) && start_on.value && end_on.value && oe_start_on.value && oe_end_on.value) {
+ document.getElementById('adminCreatePyButton').classList.remove('disabled');
+ } else {
+ document.getElementById('adminCreatePyButton').classList.add('disabled')
+ }
+ }
+
+ function resetInputOptions() {
+ document.querySelector('input#end_on').value = '';
+ document.querySelector("input#open_enrollment_start_on").value = '';
+ document.querySelector("input#open_enrollment_end_on").value = '';
+ }
+
+ function assignBenefitApplicationDates(targetDate) {
+ // var date = JSON.parse('#{@ba_form.start_on_options.to_json.html_safe}');
+ var date = JSON.parse($('#start_on_options_json').attr('value'))
+ document.querySelector('input#end_on').value = getFormattedDate(date[targetDate]["benefit_application_end_on"]);
+ document.querySelector("input#open_enrollment_start_on").value = getFormattedDate(date[targetDate]["open_enrollment_start_on"]);
+ document.querySelector("input#open_enrollment_end_on").value = getFormattedDate(date[targetDate]["open_enrollment_end_on"]);
+ }
+}
diff --git a/app/views/insured/consumer_roles/docs_shared/_expiration_date.html.erb b/app/views/insured/consumer_roles/docs_shared/_expiration_date.html.erb
index 9c664fb9fdb..7dc55760d1e 100644
--- a/app/views/insured/consumer_roles/docs_shared/_expiration_date.html.erb
+++ b/app/views/insured/consumer_roles/docs_shared/_expiration_date.html.erb
@@ -7,12 +7,4 @@
<%= v.text_field :expiration_date, {id: "doc_date_field", class: "#{!FinancialAssistanceRegistry.feature_enabled?(:optional_document_fields) ? "required" : "" } date-field doc_fields", placeholder: l10n("insured.consumer_roles.docs_shared.expiration_date", name: name), value: (v.object.expiration_date.blank? ? '' : v.object.expiration_date.strftime('%m/%d/%Y'))} %>
-
-
<% end %>
diff --git a/app/views/insured/consumer_roles/immigration_document_options.js.erb b/app/views/insured/consumer_roles/immigration_document_options.js.erb
index 015b4b132ce..2829b2bf7c5 100644
--- a/app/views/insured/consumer_roles/immigration_document_options.js.erb
+++ b/app/views/insured/consumer_roles/immigration_document_options.js.erb
@@ -37,10 +37,18 @@
<% url = @target.is_a?(Person) ? {} : employee_dependent_submission_options_for(@target) %>
'<%= form_for @target, url do |f| %>'
'<%= f.fields_for find_consumer_role_for_fields(f.object) do |c| %>'
- $(".vlp_doc_area").html("<%= escape_javascript(render partial: partial_target, locals: {c: c}) %>")
+ $(".vlp_doc_area").html("<%= escape_javascript(render partial: partial_target, locals: {c: c}) %>").ready(initExpirationDateField())
'<% end %>'
<% if EnrollRegistry[:enroll_app].setting(:verifiable_immigration_statuses).item %>
$(".vlp_doc_area").append("<%= escape_javascript(render partial: 'immigration_statuses', locals: {c: f}) %>")
<% end %>
'<% end %>'
<% end %>
+
+function initExpirationDateField() {
+ $(function() {
+ $( "#doc_date_field" ).datepicker({
+ dateFormat: 'mm/dd/yy'
+ });
+ });
+}
diff --git a/app/views/insured/families/_effective_on_kind_fields.html.erb b/app/views/insured/families/_effective_on_kind_fields.html.erb
index 1da3f0422b6..6ebe6c8a671 100644
--- a/app/views/insured/families/_effective_on_kind_fields.html.erb
+++ b/app/views/insured/families/_effective_on_kind_fields.html.erb
@@ -9,11 +9,6 @@
<%= select_tag 'effective_on_kind', options_for_select(generate_options_for_effective_on_kinds(@qle, @qle_event_date)), include_blank: "#{l10n('.select_effective_date').to_s.upcase} *" %>
-
<% end %>
<% else %>
<%= hidden_field_tag 'effective_on_kind', @qle.effective_on_kinds.first %>
diff --git a/app/views/insured/families/_qle_detail.html.erb b/app/views/insured/families/_qle_detail.html.erb
index 8b208d2ce67..da7fba4b1eb 100644
--- a/app/views/insured/families/_qle_detail.html.erb
+++ b/app/views/insured/families/_qle_detail.html.erb
@@ -104,7 +104,7 @@
- <%= submit_tag l10n('.continue'), id: 'sep_continue', class: 'btn btn-primary', data: { disable_with: false }, onkeydown: "handleButtonKeyDown(event, 'sep_continue')" %>
+ <%= submit_tag l10n('.continue'), id: 'sep_continue', class: 'btn btn-primary', data: { disable_with: false } %>
@@ -130,4 +130,6 @@
$(document).on('turbolinks:load', function () {
QLE.initialize();
});
+
+$(document).on('keydown', '#sep_continue', function(event) { handleButtonKeyDown(event, 'sep_continue') })
diff --git a/app/views/insured/families/_terminate_confirmation.html.erb b/app/views/insured/families/_terminate_confirmation.html.erb
index bdd86d438f6..9ef249fd521 100644
--- a/app/views/insured/families/_terminate_confirmation.html.erb
+++ b/app/views/insured/families/_terminate_confirmation.html.erb
@@ -11,11 +11,11 @@
<%= hidden_field_tag 'hbx_enrollment_id', enrollment.id %>
<%= hidden_field_tag "terminate_date_#{enrollment.hbx_id}" %>
- <%= select_tag "terminate_reason", options_for_select(HbxEnrollment::WAIVER_REASONS), {include_blank: l10n("insured.please_select_terminate_reason"), onchange: "EmployeeRole.disableTerminateSubmit('#{enrollment.id}')"} %>
+ <%= select_tag "terminate_reason", options_for_select(HbxEnrollment::WAIVER_REASONS), {id: "terminate-reason-select", include_blank: l10n("insured.please_select_terminate_reason"), data: {enrollment_id: "#{enrollment.id}"} } %>
<% end %>
diff --git a/app/views/insured/families/check_qle_date.js.erb b/app/views/insured/families/check_qle_date.js.erb
index a2e45b692d9..c3e7c051d41 100644
--- a/app/views/insured/families/check_qle_date.js.erb
+++ b/app/views/insured/families/check_qle_date.js.erb
@@ -20,7 +20,7 @@ $('#qle-details .initial-info').addClass('hidden');
var mecNotice = "<%= l10n('insured.qle_detail.error_text_middle_of_month', immediate_month_date: @qle_date.beginning_of_month, following_month_date: (@qle_date + 1.month).beginning_of_month, contact_center_phone_number: contact_center_phone_number, call_date: @qle_date.beginning_of_month - 1.day) %>";
toggleSuccess(mecNotice);
<% elsif @qle.present? %>
- $(".effective_on_kinds").html("<%= escape_javascript(render 'effective_on_kind_fields') %>");
+ $(".effective_on_kinds").html("<%= escape_javascript(render 'effective_on_kind_fields') %>").ready(initEffectiveOnKindFields());
<% if @qle.effective_on_kinds.count > 1 %>
$('#qle_success_submit').attr('disabled', 'disabled');
<% end %>
@@ -35,3 +35,9 @@ $('#qle-details .initial-info').addClass('hidden');
var errorNoticeAction = "<%= l10n('insured.qle_detail.error_text_future_date', contact_center_name: raw(contact_center_name), contact_center_phone_number: EnrollRegistry[:enroll_app].setting(:health_benefit_exchange_authority_phone_number)&.item) %>";
toggleSuccess(errorNoticeAction);
<% end %>
+
+function initEffectiveOnKindFields() {
+ if (!disableSelectric) {
+ $('select').selectric();
+ }
+}
diff --git a/app/views/people/landing_pages/_personal.html.erb b/app/views/people/landing_pages/_personal.html.erb
index 019ad4c398b..c12e3a89456 100644
--- a/app/views/people/landing_pages/_personal.html.erb
+++ b/app/views/people/landing_pages/_personal.html.erb
@@ -38,7 +38,7 @@
<%= f.label :ssn, l10n("social_security") %>
<% if EnrollRegistry.feature_enabled?(:mask_ssn_ui_fields) %>
<%= render partial: 'shared/person/ssn/consumer_ssn_field',
- locals: { f: f, presenter: organize_ssn_params(f.object) }
+ locals: { f: f, presenter: organize_ssn_params(f.object) }
%>
<% else %>
<% if EnrollRegistry.feature_enabled?(:ssn_ui_validation) %>
@@ -72,7 +72,7 @@
<% if current_user.does_not_have_any_staff_role? && !current_user.has_insured_role? %>
<%= render 'shared/age_off_excluded', f: f %>
<% end %>
-
+
<% if @person.is_consumer_role_active? %>
@@ -198,6 +198,7 @@
<% end %>
+
<% if @person.is_consumer_role_active? %>
<%= render 'shared/consumer_fields', f: f %>
@@ -267,6 +268,7 @@
$(document).ready(function() {
$.inputMasks();
});
+ init_tribe_fields()
<% end %>
diff --git a/app/views/shared/inboxes/_individual_message.html.erb b/app/views/shared/inboxes/_individual_message.html.erb
index ac29efdd7f2..47ed857eb9f 100644
--- a/app/views/shared/inboxes/_individual_message.html.erb
+++ b/app/views/shared/inboxes/_individual_message.html.erb
@@ -26,7 +26,7 @@
<% else %>
-
+
<%= message.try(:from) if @folder == 'Inbox' %>
<%= message.try(:to) if @folder == 'Sent'%>
@@ -48,6 +48,13 @@
|
<% end %>