Skip to content

Commit

Permalink
Csp cucumber fixes 3 (#4922)
Browse files Browse the repository at this point in the history
* benefit application warning modal cucumber fix

* broker employers cucumber fixes

* fix disabled button check

* general agency staff cucumber fixes

* broker search cucumber fixes

* job income cucumber fixes

* ee waive cucumber fixes

* update disabled button css selector

* new plan year cucumber fixes

* plan year filter cucumber fixes

* fix admin paper cucumber step

* extend oe cucumber fixes

* rubocop fix

* actual rubocop fix

* update radio input checked selector
  • Loading branch information
RyanEddyIC authored and bbodine1 committed Jan 23, 2025
1 parent 5586c9c commit 7d9f7d7
Show file tree
Hide file tree
Showing 40 changed files with 283 additions and 237 deletions.
11 changes: 5 additions & 6 deletions app/assets/javascripts/group_selection.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,12 @@ $(document).on('change', '#market_kind_coverall', function() {
});

function setGroupSelectionHandlers(){

var employers = $("[id^=census_employee_]");
hideAllErrors();

if ($("#employer-selection .n-radio-group .n-radio-row").length) {

var checked_er = $("#employer-selection .n-radio-group .n-radio-row input[checked^= 'checked']:enabled");
var checked_er = $("#employer-selection .n-radio-group .n-radio-row input:checked:enabled");

if (checked_er.length) {
var employer_id = checked_er.val();
Expand Down Expand Up @@ -158,9 +157,9 @@ function errorsForChangeInEmployer(element) {
}

function errorsForChangeInCoverageKind(employer_id){
$('#coverage_kind_health').on('change', function() {
$(document).on('change', '#coverage_kind_health', function() {
hideAllErrors();
if ($("#employer-selection .n-radio-group .n-radio-row input[checked^= 'checked']:enabled").length) {
if ($("#employer-selection .n-radio-group .n-radio-row input:checked:enabled").length) {

$(".health_errors_" + employer_id ).show();
disableShopHealthIneligible(employer_id);
Expand All @@ -173,9 +172,9 @@ function errorsForChangeInCoverageKind(employer_id){
}
});

$('#coverage_kind_dental').on('change', function() {
$(document).on('change', '#coverage_kind_dental', function() {
hideAllErrors();
if ($("#employer-selection .n-radio-group .n-radio-row input[checked^= 'checked']:enabled").length) {
if ($("#employer-selection .n-radio-group .n-radio-row input:checked:enabled").length) {

$(".dental_errors_" + employer_id ).show();
disableShopDentalIneligible(employer_id);
Expand Down
4 changes: 4 additions & 0 deletions app/assets/javascripts/plan_shopping.js.erb
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,10 @@ $(document).on("click", ".reference_plan_info h4 span", function() {
$(this).parents(".reference_plan_info").find('.content').toggle();
});

$(document).on('click', '.waive-disable-selectric-btn', function() {
disableSelectricInModal()
})

function disableSelectricInModal() {
$('#waive_confirm').on('shown.bs.modal', function (e) {
$('select#waiver_reason_selection_dropdown').selectric('destroy');
Expand Down
7 changes: 7 additions & 0 deletions app/assets/javascripts/ui-components/sidebars/plan_filters.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ function filterPlanNetwork(element) {
processValues(element);
}

$(document).on('change', '.plan-carrier-selection-filter.v1-filter', function() { filterPlanCarriers(this) })

function filterPlanCarriers(element) {
filterParams.selectedCarrier = element.value;
}
Expand Down Expand Up @@ -115,6 +117,11 @@ function clearAll() {
filterParams.deductibleToAmountValue = '';
}

$(document).on('click', '.apply-filters-btn', function(e) {
e.preventDefault()
filterResults()
})

// Gets the filtered Results
function filterResults() {
filterResultsSelections(filterParams);
Expand Down
11 changes: 2 additions & 9 deletions app/views/exchanges/hbx_profiles/_edit_open_enrollment.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -40,22 +40,15 @@
<div class="row">
<div class="col-sm-12">
<div class="form-group pull-right">
<%= submit_tag l10n("hbx_profiles.extend_oe"), class: "btn btn-primary #{pundit_class HbxProfile, :can_extend_open_enrollment? }" %>
<%= submit_tag l10n("hbx_profiles.extend_oe"), class: "btn btn-primary #{pundit_class HbxProfile, :can_extend_open_enrollment? }" %>
<button type="button" class="btn btn-default" id="reviewClose">Cancel</button>
</div>
</div>
</div>
<% end %>
</div>
</div>
</div>
</div>
</div>
</div>
</div>


<script>
$(".uidatepicker").datepicker({minDate: "<%= @benefit_application.open_enrollment_date_bounds[:min] %>", maxDate: "<%= @benefit_application.open_enrollment_date_bounds[:max] %>", changeMonth: true, changeYear: true, yearRange: (new Date).getFullYear() + ":" + (new Date).getFullYear()+1 });

$(".uidatepicker").datepicker( "option", "dateFormat", "mm/dd/yy" );
</script>
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
br
.row
.pull-right[style="margin-right:20px"]
i.fas.fa-times.fa-2x.admin-fa-times#closeBAForm[onclick="closeRow(this)"]
i.fas.fa-times.fa-2x.admin-fa-times#closeBAForm
.row
.col-md-4
label[for="effectiveStartDate" style="font-weight:bold"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<th><%= l10n("hbx_profiles.application_status")%></th>
<th><%= l10n("hbx_profiles.submitted_at")%></th>
<th><%= l10n("hbx_profiles.last_updated_at")%></th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
Expand All @@ -39,15 +39,3 @@

<div class="edit_open_enrollment_form"></div>
</div>

<script type="text/javascript" charset="utf-8">
initializeDataTables();
jQuery('.buttons-csv').hide()
jQuery('.buttons-excel').hide()
function printDoc(id){
var window_obj=window.open();
window_obj.document.write($('#print_'+id).html());
window_obj.print();
window_obj.close();
}
</script>
10 changes: 8 additions & 2 deletions app/views/exchanges/hbx_profiles/edit_open_enrollment.js.erb
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
$('.edit_open_enrollment_form').html("<%= escape_javascript(render "edit_open_enrollment") %>");
$('.edit_open_enrollment_form').html("<%= escape_javascript(render "edit_open_enrollment") %>").ready(initEditOE());

$('#reviewClose').click(function() {
$('.edit_open_enrollment_form').hide();
event.preventDefault();
$('tr.child-row:visible').remove();
$('#extendable_applications_table').hide();
});
});

function initEditOE() {
$(".uidatepicker").datepicker({minDate: "<%= @benefit_application.open_enrollment_date_bounds[:min] %>", maxDate: "<%= @benefit_application.open_enrollment_date_bounds[:max] %>", changeMonth: true, changeYear: true, yearRange: (new Date).getFullYear() + ":" + (new Date).getFullYear()+1 });

$(".uidatepicker").datepicker( "option", "dateFormat", "mm/dd/yy" );
}
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ function initNewBAForm() {
}
}

$(document).on('click', '#closeBAForm', function() {
closeRow(this)
})

function closeRow(element) {
element.closest('tr').remove();
}
Expand Down
16 changes: 14 additions & 2 deletions app/views/exchanges/hbx_profiles/oe_extendable_applications.js.erb
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,21 @@ 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 "oe_extendable_applications"%></td></tr>');
$parent_row.after('<tr class="child-row"><td colspan="100"><%= j render "oe_extendable_applications"%></td></tr>').ready(initExtendOE());
$("li>a:contains('Collapse Form')").eq(containing_row.index()).removeClass('disabled');
$('.dropdown.pull-right').removeClass('open');
}

applyJQDatePickers();
applyJQDatePickers();

function initExtendOE() {
initializeDataTables();
jQuery('.buttons-csv').hide()
jQuery('.buttons-excel').hide()
function printDoc(id){
var window_obj=window.open();
window_obj.document.write($('#print_'+id).html());
window_obj.print();
window_obj.close();
}
}
2 changes: 1 addition & 1 deletion app/views/shared/_signup_progress.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
CONTINUE
- if step ==5

= link_to 'Waive Coverage', '#', data: {toggle: "modal", target: "#waive_confirm"}, class: 'btn btn-waive btn-default', onclick:'disableSelectricInModal()' if @hbx_enrollment && @hbx_enrollment.employee_role.present?
= link_to 'Waive Coverage', '#', data: {toggle: "modal", target: "#waive_confirm"}, class: 'btn btn-waive btn-default waive-disable-selectric-btn' if @hbx_enrollment && @hbx_enrollment.employee_role.present?
- elsif step == 6
= link_to purchase_or_confirm, main_app.checkout_insured_plan_shopping_path(@enrollment.id, :plan_id => @plan.id, market_kind: @market_kind, coverage_kind: @coverage_kind), :class => 'btn btn-lg btn-primary btn-block', id: 'btn-continue', :method => :post, :disabled => disable_purchase?(!@enrollable, @enrollment)
= link_to 'Waive Coverage', '#', data: {toggle: "modal", target: "#waive_confirm"}, class: 'btn-waive btn btn-round btn-default' if @enrollment && @enrollment.employee_role.present?
Expand Down
6 changes: 3 additions & 3 deletions app/views/ui-components/v1/filters/_plan_filters.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
<legend><%= render partial:"shared/glossary", locals: {key: "filter_by_carrier", term: l10n("carrier"), question_mark: true } %></legend>

<% issuer_names = (@market_kind == 'shop' || @market_kind == 'fehb') ? @carrier_names : @carriers %>
<%= select_tag :carrier, options_for_select(issuer_names), class: "plan-carrier-selection-filter w-100", include_blank: "All", onchange:"filterPlanCarriers(this)" %>
<%= select_tag :carrier, options_for_select(issuer_names), class: "plan-carrier-selection-filter w-100 v1-filter", include_blank: "All" %>
</fieldset>
</div>
</div>
Expand Down Expand Up @@ -322,7 +322,7 @@
<div class="checkbox-filter-wrapper" style="border-bottom:0;">
<% if @market_kind == 'shop' || @market_kind == 'fehb' %>
<div class="form-inline search-apply-wrapper mt-1">
<a class="btn btn-primary mz" href="javascript:void(0)" onclick="filterResults()" title="Apply all filters"><%= l10n("apply") %></a>
<a class="btn btn-primary mz apply-filters-btn" href="#" title="Apply all filters"><%= l10n("apply") %></a>
<a id="reset-btn" class="btn btn-default" onclick="resetAllFilters()"><%= l10n("reset") %></a>
</div>
<% else %>
Expand Down Expand Up @@ -509,7 +509,7 @@
<li>
<div class="filter-input-block">
<% issuer_names = (@market_kind == 'shop' || @market_kind == 'fehb') ? @carrier_names : @carriers %>
<%= select_tag :carrier, options_for_select(issuer_names), class: "plan-carrier-selection-filter form-control", include_blank: "All", onchange:"filterPlanCarriers(this)" %>
<%= select_tag :carrier, options_for_select(issuer_names), class: "plan-carrier-selection-filter form-control v1-filter", include_blank: "All" %>
</div>
</li>
</ul>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ fieldset

.col-md-4.mb-2
label for="inputDOB" #{l10n('date_of_birth')} *
= f.text_field :dob, placeholder: 'MM/DD/YYYY', required: 'true', id: 'inputStaffDOB', class:'form-control', onblur:'validDob(this)'
= f.text_field :dob, placeholder: 'MM/DD/YYYY', required: 'true', id: 'inputStaffDOB', class:'form-control'
.invalid-feedback

= l10n("invalid_dob")
Expand All @@ -29,21 +29,3 @@ fieldset
.invalid-feedback

= l10n("invalid_email")


javascript:
var cleave = new Cleave('#inputDOB', {
date: true,
datePattern: ['m', 'd', 'Y']
});
function validDob(element) {
if (element.value && element.value.length < 10) {
swal({
title: "Invalid DOB Format",
text: "DOB must be entered as MM/DD/YYYY",
icon: "warning"
}),
element.value = ''
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ fieldset

.col-md-4.mb-2
label for="inputDOB" #{l10n('date_of_birth')} *
= f.text_field :dob, placeholder: 'MM/DD/YYYY', required: 'true', id: 'inputStaffDOB', class:'form-control', onblur:'validDob(this)'
= f.text_field :dob, placeholder: 'MM/DD/YYYY', required: 'true', id: 'inputStaffDOB', class:'form-control'
.invalid-feedback

= l10n("invalid_dob")
Expand All @@ -29,21 +29,3 @@ fieldset
.invalid-feedback

= l10n("invalid_email")


javascript:
var cleave = new Cleave('#inputDOB', {
date: true,
datePattern: ['m', 'd', 'Y']
});
function validDob(element) {
if (element.value && element.value.length < 10) {
swal({
title: "Invalid DOB Format",
text: "DOB must be entered as MM/DD/YYYY",
icon: "warning"
}),
element.value = ''
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,13 @@ $(document).on('change', "#benefit_application_start_on", function() {
jQuery.inputMasks = () => {
$(".phone_number").mask("(999) 999-9999");
};
$.inputMasks();
$.inputMasks();

jQuery.ajaxSetup( {
converters: {
"text script": function( text ) {
jQuery.globalEval( text, {nonce: $("meta[name='csp-nonce']").prop('content')} );
return text;
}
}
} );
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
$(document).on('click', '.select-broker-agency', function(e) {
e.preventDefault()
selectBrokereAgency(this);
})

$(document).on('click', '.ba-search-btn', function(e) {
e.preventDefault()
brokerSearch();
return false
})

function brokerSearch() {
var broker_agency_search = document.getElementById('staff_agency_search').value
var broker_registration_page = document.getElementById('staff_is_broker_registration_page').value
document.getElementById('broker-staff-btn').disabled = true;
if (broker_agency_search != undefined) {
$.ajax({
url: '/benefit_sponsors/profiles/broker_agencies/broker_agency_staff_roles/search_broker_agency.js',
type: "GET",
data: {'q': broker_agency_search, "broker_registration_page": broker_registration_page},
success: function() {
if ($('.table-responsive').length) {
$('.broker-agency-submit').removeClass('hidden');
}
}
});
};

}

function selectBrokereAgency(element) {
var result = document.querySelectorAll('.result');
result.forEach(function (result) {
var element = result.querySelectorAll('.staff-select-broker')
element.forEach(function (ele) {
ele.classList.remove("agency-selected");
})
});
document.getElementById('staff_profile_id').value = element.dataset.broker_agency_profile_id;
element.closest(".staff-select-broker").classList.add('agency-selected')
document.getElementById('broker-staff-btn').disabled = false;
}
Loading

0 comments on commit 7d9f7d7

Please sign in to comment.