Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

188804152 script src error on broker registration form #4958

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 46 additions & 3 deletions app/assets/javascripts/broker_role.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ $(document).on('turbolinks:load ajax:success', function () {
});

function brokerSearch() {

var broker_agency_search = document.getElementById(
'staff_agency_search'
).value;
Expand Down Expand Up @@ -114,10 +113,12 @@ function selectBrokereAgency(element) {
document.getElementById('broker-staff-btn').disabled = false;
}


/// components/benefit_sponsors/app/views/benefit_sponsors/profiles/registrations/new.html.erb
$(document).on('turbolinks:load ajax:success', function () {
validateForm();
checkDate();
checkKeyValue();
numKey();

$('#broker_agency_form').tabs({
activate: function (event, ui) {
Expand All @@ -131,6 +132,8 @@ $(document).on('turbolinks:load ajax:success', function () {
data: { profile_type: 'broker_agency_staff' },
success: function (data) {
$('#broker_agency_staff').html(data);
const dobInput = document.querySelector('#staff_dob');
checkDate();
indicateRequiredFields();
},
});
Expand Down Expand Up @@ -162,4 +165,44 @@ $(document).on('turbolinks:load ajax:success', function () {
}
},
});
});
});

function checkDate() {
const dobInput = document.querySelector(
'#staff_dob, #agency_staff_roles_attributes_0_dob'
);

if (dobInput) {
// Add event listeners
dobInput.addEventListener('blur', function () {
validDob(this);
});
}
}

function checkKeyValue() {
const npnInput = document.getElementById('inputNPN');

if (npnInput) {
npnInput.addEventListener('keypress', function (event) {
const isRegistryEnabled =
npnInput.dataset.enrollRegistryFeatureEnabled === 'true';

if (isRegistryEnabled) {
isAlphaNumeric(event);
} else {
isNumberKey(event);
}
});
}
}

function numKey() {
const phoneNum = $('[data-phone-number]');

if (phoneNum.data('phoneNumber') === true) {
phoneNum.on('keypress', function (event) {
isNumberKey(event);
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,7 @@
min: 110.years.ago,
max: 16.years.ago.beginning_of_month,
data: {input: "", invalid_dob_title: l10n('broker_agencies.invalid_dob_title'), invalid_dob_body: l10n('broker_agencies.invalid_dob_body'), invalid_dob_after: l10n("broker_agencies.invalid_dob_after", date: 16.years.ago.beginning_of_month.strftime('%m/%d/%Y')), invalid_dob_before: l10n("broker_agencies.invalid_dob_before", date: 110.years.ago.strftime('%m/%d/%Y'))},
required: true,
onblur: 'validDob(this)',
onkeydown: 'storeDateInput(event)'
required: true
%>
<div class="invalid-feedback">
<%= l10n("invalid_dob") %>
Expand All @@ -51,8 +49,8 @@
id: 'inputNPN',
class: 'form-control',
maxlength: '10',
onkeypress: EnrollRegistry.feature_enabled?(:allow_alphanumeric_npn) ? 'return isAlphaNumeric(event);' : 'return isNumberKey(event);',
disabled: npn_disabled
disabled: npn_disabled,
data: {enroll_registry_feature_enabled: EnrollRegistry.feature_enabled?(:allow_alphanumeric_npn) ? 'true' : 'false'}
%>
<div class="invalid-feedback">
<%= l10n('npn_error') %>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@
min: 110.years.ago,
max: 16.years.ago.beginning_of_month,
data: {input:"", invalid_dob_title: l10n('broker_agencies.invalid_dob_title'), invalid_dob_body: l10n('broker_agencies.invalid_dob_body'), invalid_dob_after: l10n("broker_agencies.invalid_dob_after", date: 16.years.ago.beginning_of_month.strftime('%m/%d/%Y')), invalid_dob_before: l10n("broker_agencies.invalid_dob_before", date: 110.years.ago.strftime('%m/%d/%Y'))},
required: true,
onblur: 'validDob(this)',
onkeydown: 'storeDateInput(event)'
required: true
%>
<div class="invalid-feedback">
<%= l10n("invalid_dob") %>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@
class: 'form-control phone_number',
minlength: '14',
maxlength: '14',
onkeypress: 'return isNumberKey(event)',
value: determine_phone_number(f.object),
data: { :"error-message" => phone_error }
data: { :"error-message" => phone_error, phone_number: true }
%>
<div class="invalid-feedback">
<%= phone_error %>
Expand Down
Loading