Skip to content

Commit

Permalink
more csp enabled cucumber fixes (#4904)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
  • Loading branch information
2 people authored and bbodine1 committed Jan 16, 2025
1 parent a02e6af commit d7b3b66
Show file tree
Hide file tree
Showing 27 changed files with 219 additions and 155 deletions.
9 changes: 6 additions & 3 deletions app/assets/javascripts/employee_role.js
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand All @@ -116,4 +120,3 @@ var EmployeeRole = ( function( window, undefined ) {
disableTerminateSubmit : disableTerminateSubmit,
};
})( window );

2 changes: 1 addition & 1 deletion app/assets/javascripts/exchanges/hbx_profiles.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
});
Expand Down
4 changes: 4 additions & 0 deletions app/assets/javascripts/families.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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")
Expand All @@ -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
Expand All @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@
<p>Are you sure you want to <b>Send/Upload</b> this message?</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary btn-confirmation">Confirm</button>
<button type="button" class="btn btn-primary btn-confirmation send-secure-msg-confirm">Confirm</button>
<button type="button" class="btn btn-default pull-left" data-dismiss="modal">Cancel</button>
</div>
</div>
Expand Down
94 changes: 92 additions & 2 deletions app/views/exchanges/hbx_profiles/new_benefit_application.js.erb
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,99 @@ if ( $('tr.child-row:visible').length > 0 ) {
}

if ( !($parent_row.next().hasClass('child-row'))) {
$parent_row.after('<tr class="child-row"><td colspan="100"><%= j render "new_benefit_application"%></td></tr>');
$parent_row.after('<tr class="child-row"><td colspan="100"><%= j render "new_benefit_application"%></td></tr>').ready(initNewBAForm());
$("li>a:contains('Collapse Form')").eq(containing_row.index()).removeClass('disabled');
$('.dropdown.pull-right').removeClass('open');
}

applyJQDatePickers();
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"]);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,4 @@
<div class="col-md-4 col-sm-4 col-xs-6 form-group form-group-lg no-pd">
<%= 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'))} %><br>
</div>

<script>
$(function() {
$( "#doc_date_field" ).datepicker({
dateFormat: 'mm/dd/yy'
});
});
</script>
<% end %>
Original file line number Diff line number Diff line change
Expand Up @@ -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'
});
});
}
5 changes: 0 additions & 5 deletions app/views/insured/families/_effective_on_kind_fields.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,6 @@
<div style='margin: 0 auto;max-width:250px;'>
<%= 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} *" %>
</div>
<script type="text/javascript">
if (!disableSelectric) {
$('select').selectric();
}
</script>
<% end %>
<% else %>
<%= hidden_field_tag 'effective_on_kind', @qle.effective_on_kinds.first %>
Expand Down
4 changes: 3 additions & 1 deletion app/views/insured/families/_qle_detail.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
<div class="spec_reasons">
</div>
<div class="text-center <%= pundit_class Family,:updateable? %>">
<%= 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 } %>
<br/>
<br/>
</div>
Expand All @@ -130,4 +130,6 @@
$(document).on('turbolinks:load', function () {
QLE.initialize();
});

$(document).on('keydown', '#sep_continue', function(event) { handleButtonKeyDown(event, 'sep_continue') })
</script>
4 changes: 2 additions & 2 deletions app/views/insured/families/_terminate_confirmation.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
<%= hidden_field_tag 'hbx_enrollment_id', enrollment.id %>
<%= hidden_field_tag "terminate_date_#{enrollment.hbx_id}" %>
<div class="modal-body">
<%= 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}"} } %>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal"><%= l10n('.close') %></button>
<%= submit_tag l10n('.submit'), onclick: "fetchDate('#{enrollment.hbx_id}')", class: 'btn btn-primary terminate_reason_submit', disabled: true %>
<%= submit_tag l10n('.submit'), class: 'btn btn-primary terminate_reason_submit', data: {enrollment_id: "#{enrollment.hbx_id}"}, disabled: true %>
</div>
<% end %>
</div>
Expand Down
8 changes: 7 additions & 1 deletion app/views/insured/families/check_qle_date.js.erb
Original file line number Diff line number Diff line change
Expand Up @@ -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 %>
Expand All @@ -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();
}
}
6 changes: 4 additions & 2 deletions app/views/people/landing_pages/_personal.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -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) %>
Expand Down Expand Up @@ -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 %>

<section class="mb-4">
<% if @person.is_consumer_role_active? %>
<div id="consumer_fields_sets ">
Expand Down Expand Up @@ -198,6 +198,7 @@
</div>
<% end %>
<br />

<% if @person.is_consumer_role_active? %>
<div id="consumer_fields_sets">
<%= render 'shared/consumer_fields', f: f %><br>
Expand Down Expand Up @@ -267,6 +268,7 @@
$(document).ready(function() {
$.inputMasks();
});
init_tribe_fields()
</script>
<% end %>

Expand Down
Loading

0 comments on commit d7b3b66

Please sign in to comment.