-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtestcarrier
1 lines (1 loc) · 124 KB
/
testcarrier
1
javascript: navigator.clipboard.readText().then((clipboardString) => { const jsonObject = JSON.parse(clipboardString); function getFormattedDate(date) { let year = date.getFullYear().toString().padStart(4, '0'); let month = (1 + date.getMonth()).toString().padStart(2, '0'); let day = date.getDate().toString().padStart(2, '0'); return month + '/' + day + '/' + year; }; function input_refresh(tgt_el_id, val) { tgt_elg = document.getElementById(tgt_el_id); tgt_elg.dispatchEvent(new Event('focusin')); tgt_elg.value = val; tgt_elg.dispatchEvent(new Event('input')); tgt_elg.dispatchEvent(new Event('change')); tgt_elg.dispatchEvent(new Event('blur')); tgt_elg.dispatchEvent(new Event('focusout')); }; function input_refresh_el(tgt_elg, val) { tgt_elg.dispatchEvent(new Event('focusin')); tgt_elg.value = val; tgt_elg.dispatchEvent(new Event('input')); tgt_elg.dispatchEvent(new Event('change')); tgt_elg.dispatchEvent(new Event('blur')); tgt_elg.dispatchEvent(new Event('focusout')); } function focus_input(tgt_el_id, val) { if (typeof tgt_el_id === 'string') { tgt_elg = document.getElementById(tgt_el_id); } else if (tgt_el_id instanceof Element) { tgt_elg = tgt_el_id } tgt_elg.dispatchEvent(new Event('focus')); tgt_elg.value = val; tgt_elg.dispatchEvent(new Event('change')); tgt_elg.dispatchEvent(new Event('keydown')); tgt_elg.dispatchEvent(new Event('keyup')); tgt_elg.dispatchEvent(new Event('blur')); }; function get_short_state(stateName) { const stateNameToAbbreviation = { 'Alabama': 'AL', 'Alaska': 'AK', 'Arizona': 'AZ', 'Arkansas': 'AR', 'California': 'CA', 'Colorado': 'CO', 'Connecticut': 'CT', 'Delaware': 'DE', 'Florida': 'FL', 'Georgia': 'GA', 'Hawaii': 'HI', 'Idaho': 'ID', 'Illinois': 'IL', 'Indiana': 'IN', 'Iowa': 'IA', 'Kansas': 'KS', 'Kentucky': 'KY', 'Louisiana': 'LA', 'Maine': 'ME', 'Maryland': 'MD', 'Massachusetts': 'MA', 'Michigan': 'MI', 'Minnesota': 'MN', 'Mississippi': 'MS', 'Missouri': 'MO', 'Montana': 'MT', 'Nebraska': 'NE', 'Nevada': 'NV', 'New Hampshire': 'NH', 'New Jersey': 'NJ', 'New Mexico': 'NM', 'New York': 'NY', 'North Carolina': 'NC', 'North Dakota': 'ND', 'Ohio': 'OH', 'Oklahoma': 'OK', 'Oregon': 'OR', 'Pennsylvania': 'PA', 'Rhode Island': 'RI', 'South Carolina': 'SC', 'South Dakota': 'SD', 'Tennessee': 'TN', 'Texas': 'TX', 'Utah': 'UT', 'Vermont': 'VT', 'Virginia': 'VA', 'Washington': 'WA', 'West Virginia': 'WV', 'Wisconsin': 'WI', 'Wyoming': 'WY' }; const abbreviation = stateNameToAbbreviation[stateName]; if (abbreviation) { return abbreviation; } else { return stateName; } }; function get_full_state(statename) { const abbreviationToStateName = { 'AL': 'Alabama', 'AK': 'Alaska', 'AZ': 'Arizona', 'AR': 'Arkansas', 'CA': 'California', 'CO': 'Colorado', 'CT': 'Connecticut', 'DE': 'Delaware', 'FL': 'Florida', 'GA': 'Georgia', 'HI': 'Hawaii', 'ID': 'Idaho', 'IL': 'Illinois', 'IN': 'Indiana', 'IA': 'Iowa', 'KS': 'Kansas', 'KY': 'Kentucky', 'LA': 'Louisiana', 'ME': 'Maine', 'MD': 'Maryland', 'MA': 'Massachusetts', 'MI': 'Michigan', 'MN': 'Minnesota', 'MS': 'Mississippi', 'MO': 'Missouri', 'MT': 'Montana', 'NE': 'Nebraska', 'NV': 'Nevada', 'NH': 'New Hampshire', 'NJ': 'New Jersey', 'NM': 'New Mexico', 'NY': 'New York', 'NC': 'North Carolina', 'ND': 'North Dakota', 'OH': 'Ohio', 'OK': 'Oklahoma', 'OR': 'Oregon', 'PA': 'Pennsylvania', 'RI': 'Rhode Island', 'SC': 'South Carolina', 'SD': 'South Dakota', 'TN': 'Tennessee', 'TX': 'Texas', 'UT': 'Utah', 'VT': 'Vermont', 'VA': 'Virginia', 'WA': 'Washington', 'WV': 'West Virginia', 'WI': 'Wisconsin', 'WY': 'Wyoming' }; const abbreviation = abbreviationToStateName[statename]; if (abbreviation) { return abbreviation; } else { return statename; } }if (document.domain == "employer.anthem.com") { function delay(n) { return new Promise(function(resolve) { setTimeout(resolve, n * 50); }); }; if (document.body.textContent.includes("Enter the ID Number of the employee you'd like to add (typically a Social Security Number). Or, enter a custom Member ID.")) { var enrollapp = document.getElementsByTagName('app-new-enrollment')[0]; var alldivTags = enrollapp.getElementsByTagName("div"); for (i = 0; i < alldivTags.length; i++) if (alldivTags[i].textContent.trim() == 'ID Number, Member ID, or SSN') { input_refresh_el(alldivTags[i].querySelector('input[name="id"]'), jsonObject.ee_BASIC_info.SSN.replace(/[^\d]+/g, '')); break; } var allbtTags = enrollapp.getElementsByTagName("button"); for (i = 0; i < allbtTags.length; i++) if (allbtTags[i].getAttribute('type') == 'submit') { allbtTags[i].click(); break; } }; if (document.querySelector('[name="signDate"]') != null) { const dic = { "FIRST_NAME": "firstName", "MIDDLE_NAME": "mi", "LAST_NAME": "lastName", "DOB": "dob", "DATE_OF_HIRE": "hired", "ELIG_DATE": "signDate", "SSN": "ssn", "ADD1": "address1", "ADD2": "address2", "ADDSTATE": "state", "ADDCITY": "city", "ADDZIP": "zipCode", "HOMEPHONE": "phone", "PERSONAL_EMAIL": "email", }; for (var keyv in dic) { var itemv = dic[keyv]; if (itemv != '') { var el = document.querySelector('[name="' + itemv + '"]'); if (el != null) { if (keyv == "DOB" || keyv == "DOH" || keyv == "ELIG_DATE") { g_doh = new Date(jsonObject.ee_BASIC_info[keyv]); input_refresh_el(el, getFormattedDate(g_doh)); } else if (keyv == 'SSN' || keyv == 'HOMEPHONE') { input_refresh_el(el, jsonObject.ee_BASIC_info[keyv].replace(/[^\d]+/g, '')); } else { input_refresh_el(el, jsonObject.ee_BASIC_info[keyv]); }; }; }; }; var sex_v = jsonObject.ee_BASIC_info['GENDER']; if (sex_v == 'F' || sex_v == 'Female') { var sex_s = 'female'; } else if (sex_v == 'M' || sex_v == 'Male') { var sex_s = 'male'; }; input_refresh_el(document.querySelector('[name="gen"]'), sex_s); }; if (document.getElementsByTagName('app-dependent-info').length == 1) { var dept_ct = 0; var enter_i = 0; function add_dept() { var enrollapp = document.getElementsByTagName('app-new-enrollment')[0]; var allPageTags = enrollapp.getElementsByTagName("a"); for (i = 0; i < allPageTags.length; i++) { if (allPageTags[i].textContent.trim() == 'Add a Dependent' || allPageTags[i].textContent.trim() == 'Add Another Dependent') { allPageTags[i].click(); break; } }; }; if (jsonObject.ee_DEPT_info.Spouse.FIRST_NAME != "") { dept_ct = dept_ct + 1; }; if (jsonObject.ee_DEPT_info.Child.FIRST_NAME != "") { dept_ct = dept_ct + jsonObject.ee_DEPT_info.Child.FIRST_NAME.split('|').length; }; if (dept_ct > 0) { var dept_i = 0; anthem_dept_dic = { "FIRST_NAME": "First Name", "MIDDLE_NAME": "Middle Initial", "LAST_NAME": "Last Name", "DOB": "Date of Birth", "SSN": "Social Security Number", }; function get_dept_el() { const spouse_elementList = []; var allPageTags = document.getElementsByTagName("legend"); for (i = 0; i < allPageTags.length; i++) { if (allPageTags[i].textContent.trim() == 'Dependents') { var alli = allPageTags[i].parentElement.children; for (o = 1; o < alli.length; o++) { if (alli[o].getAttribute('class') == 'ng-star-inserted') { spouse_elementList.push(alli[o]) } } break; } }; return spouse_elementList } function get_input_el(indx, nm) { var el = get_dept_el()[indx]; var alldivTags = el.getElementsByTagName("label"); for (i = 0; i < alldivTags.length; i++) if (alldivTags[i].textContent.trim() == nm) { var res_el = alldivTags[i].parentElement.querySelector('input'); break; }; return (res_el) } function delay(n) { return new Promise(function(resolve) { setTimeout(resolve, n * 50); }); } async function add_dept_func() { for (dept_add_i = 0; dept_add_i < dept_ct; dept_add_i++) { add_dept(); } await delay(1); if (jsonObject.ee_DEPT_info.Spouse.FIRST_NAME != "" && jsonObject.ee_DEPT_info.Spouse.is_entered == "") { var sp_e = get_dept_el()[dept_i]; for (var key in anthem_dept_dic) { var itemv = anthem_dept_dic[key]; var tgt_elv = get_input_el(dept_i, itemv); if (tgt_elv != null) { if (key == "DOB") { g_doh = new Date(jsonObject.ee_DEPT_info.Spouse[key]); input_refresh_el(tgt_elv, getFormattedDate(g_doh)); } else if (key == 'SSN' || key == 'HOMEPHONE') { input_refresh_el(tgt_elv, jsonObject.ee_DEPT_info.Spouse[key].replace(/[^\d]+/g, '')); } else { input_refresh_el(tgt_elv, jsonObject.ee_DEPT_info.Spouse[key]); }; }; }; var rel = jsonObject.ee_DEPT_info.Spouse.RELATION; var optionValue = rel ? rel : "Spouse"; input_refresh_el(sp_e.querySelector('#relSelect'), optionValue); var sex_v = jsonObject.ee_DEPT_info.Spouse['GENDER']; if (sex_v == 'F' || sex_v == 'Female') { var sex_s = 'female'; } else if (sex_v == 'M' || sex_v == 'Male') { var sex_s = 'male'; }; input_refresh_el(sp_e.querySelector('#depGender'), sex_s); dept_i++; } if (jsonObject.ee_DEPT_info.Child.FIRST_NAME != "") { if (jsonObject.ee_DEPT_info.Child.FIRST_NAME.includes('|') == false) { if (jsonObject.ee_DEPT_info.Child.is_entered != "T") { var child_e = get_dept_el()[dept_i]; for (var key in anthem_dept_dic) { var itemv = anthem_dept_dic[key]; var tgt_elv = get_input_el(dept_i, itemv); if (tgt_elv != null) { if (key == "DOB") { g_doh = new Date(jsonObject.ee_DEPT_info.Child[key]); input_refresh_el(tgt_elv, getFormattedDate(g_doh)); } else if (key == 'SSN' || key == 'HOMEPHONE') { input_refresh_el(tgt_elv, jsonObject.ee_BASIC_info[key].replace(/[^\d]+/g, '')); } else { input_refresh_el(tgt_elv, jsonObject.ee_DEPT_info.Child[key]); }; }; }; var sex_v = jsonObject.ee_DEPT_info.Child['GENDER']; if (sex_v == 'F' || sex_v == 'Female') { var sex_s = 'female'; } else if (sex_v == 'M' || sex_v == 'Male') { var sex_s = 'male'; }; input_refresh_el(child_e.querySelector('#depGender'), sex_s); var rel = jsonObject.ee_DEPT_info.Child.RELATION; var optionValue = rel ? rel : "Child"; input_refresh_el(child_e.querySelector('#relSelect'), optionValue); jsonObject.ee_DEPT_info.Child.is_entered = "T"; dept_i++; } } else { var child_ct = jsonObject.ee_DEPT_info.Child.FIRST_NAME.split("|").length; for (var x = 0; x < child_ct; x++) { var child_e = get_dept_el()[dept_i]; for (var key in anthem_dept_dic) { var itemv = anthem_dept_dic[key]; var tgt_elv = get_input_el(dept_i, itemv);; if (tgt_elv) { if (key == "DOB") { g_doh = new Date(jsonObject.ee_DEPT_info.Child[key].split("|")[x]); input_refresh_el(tgt_elv, getFormattedDate(g_doh)); } else if (key == 'SSN') { input_refresh_el(tgt_elv, jsonObject.ee_DEPT_info.Child[key].split("|")[x].replace(/[^\d]+/g, '')); } else { input_refresh_el(tgt_elv, jsonObject.ee_DEPT_info.Child[key].split("|")[x]); }; }; }; var sex_v = jsonObject.ee_DEPT_info.Child['GENDER'].split("|")[x]; if (sex_v == 'F' || sex_v == 'Female') { var sex_s = 'female'; } else if (sex_v == 'M' || sex_v == 'Male') { var sex_s = 'male'; }; input_refresh_el(child_e.querySelector('#depGender'), sex_s); var rel = jsonObject.ee_DEPT_info.Child['RELATION'].split("|")[x]; var optionValue = rel ? rel : "Child"; input_refresh_el(child_e.querySelector('#relSelect'), optionValue); if (x == 0) { jsonObject.ee_DEPT_info.Child.is_entered = "T" } else { jsonObject.ee_DEPT_info.Child.is_entered = jsonObject.ee_DEPT_info.Child.is_entered + "|" + "T"; } dept_i++; } }; }; }; add_dept_func(); }; } };if (document.domain.includes("bcbstx.com")) { var frameObj = document.getElementsByName('Web Page')[0]; function input_refresh_bcbstx(tgt_el_name, val) { tgt_elg = frameObj.contentWindow.document.getElementsByName(tgt_el_name)[0]; tgt_elg.dispatchEvent(new Event('focusin')); tgt_elg.value = val; tgt_elg.dispatchEvent(new Event('input')); tgt_elg.dispatchEvent(new Event('change')); tgt_elg.dispatchEvent(new Event('blur')); tgt_elg.dispatchEvent(new Event('focusout')); }; function input_Date() { return { DOB: ['dobMonth', 'dobDay', 'dobYear'], HireDate: ['hrDtmm', 'hrDtdd', 'hrDtyyyy'] } } function getDateinfo(date_String) { var targetDate = new Date(date_String); return [(targetDate.getMonth() + 1).toString().padStart(2, '0'), targetDate.getDate().toString().padStart(2, '0'), targetDate.getFullYear().toString().padStart(4, '0')] } function getSSN(ssn_String) { var targetSSN = ssn_String.replace(/-/g, ''); return [targetSSN.substring(0, 3), targetSSN.substring(3, 5), targetSSN.substring(5, 9)] } function getPhone(phone_String) { var targetPhone = phone_String.replace(/\D/g, ''); return [targetPhone.substring(0, 3), targetPhone.substring(3, 6), targetPhone.substring(6, 10)] } function input_dependent(i, Relation_var, bln_needindex, index) { var idx = index; const dic = { "FIRST_NAME": "fname_dep" + i, "LAST_NAME": "lname_dep" + i, "MIDDLE_NAME": "mi_dep" + i, "RELATION": "relCd_dep" + i, "GENDER": "gender_dep" + i }; for (var ky in dic) { var items = dic[ky]; if (bln_needindex == false) { value_jsonObject = jsonObject.ee_DEPT_info[Relation_var][ky]; } else { value_jsonObject = jsonObject.ee_DEPT_info[Relation_var][ky].split('|')[idx]; }; if (value_jsonObject != '' && value_jsonObject != undefined) { if (ky == 'GENDER') { var gender_value = value_jsonObject; if (gender_value == 'F' || gender_value == 'Female') { input_refresh_bcbstx(items, 'F'); } else if (gender_value == 'M' || gender_value == 'Male') { input_refresh_bcbstx(items, 'M'); } } else if (ky == "RELATION" && value_jsonObject != "") { if (value_jsonObject.includes('Ex')) { input_refresh_bcbstx(items, 'XSP'); } else if (value_jsonObject.includes('Spouse') || value_jsonObject == 'Domestic Partner') { input_refresh_bcbstx(items, 'SPS'); } else if (value_jsonObject.includes('Child')) { input_refresh_bcbstx(items, 'DEP'); } } else { input_refresh_bcbstx(items, value_jsonObject); } } } } function dep_dob_ssn_info() { return { DOB: ['dobmm_dep' + i, 'dobdd_dep' + i, 'dobyyyy_dep' + i], SSN: ['ssn13_dep' + i, 'ssn45_dep' + i, 'ssn69_dep' + i] } } if (frameObj.contentWindow.document.getElementsByName('effDtmm')[0]) { const dic = { "FIRST_NAME": "firstName", "MIDDLE_NAME": "middleInitial", "LAST_NAME": "lastName", "GENDER": "gendCd", "ADD1": "usStreetOne", "ADDSTATE": "usStCd", "ADDCITY": "usCityName", "ADDSTATE": "usStCd", "ADDZIP": "usZipCode", "PERSONAL_EMAIL": "emailAddr", "WORK_EMAIL": "emailAddr" }; for (var keyb in dic) { var itemb = dic[keyb]; if (itemb != '') { if (jsonObject.ee_BASIC_info[keyb] != '') { if (keyb == 'GENDER') { var gender_value = jsonObject.ee_BASIC_info[keyb]; if (gender_value == 'F' || gender_value == 'Female') { input_refresh_bcbstx(itemb, 'F'); } else if (gender_value == 'M' || gender_value == 'Male') { input_refresh_bcbstx(itemb, 'M'); }; } else if (keyb == 'ADDSTATE') { input_refresh_bcbstx(itemb, get_short_state(jsonObject.ee_BASIC_info[keyb])); } else { input_refresh_bcbstx(itemb, jsonObject.ee_BASIC_info[keyb]); } } } } var inDate = input_Date(); for (var keym in inDate) { if (keym == 'HireDate') { var dateString = jsonObject.ee_BASIC_info.DATE_OF_HIRE; } else { var dateString = jsonObject.ee_BASIC_info[keym]; } for (var i = 0; i < inDate[keym].length; i++) { input_refresh_bcbstx(inDate[keym][i], getDateinfo(dateString)[i]); } } var ssn = jsonObject.ee_BASIC_info['SSN']; var ssn_subName = ["ssnFirst", "ssnMiddle", "ssnLast"]; if (ssn != '') { for (var n = 0; n < ssn_subName.length; n++) { input_refresh_bcbstx(ssn_subName[n], getSSN(ssn)[n]); } } var maritalStatus = jsonObject.ee_BASIC_info['MARITAL_STATUS']; if (maritalStatus != '') { if (maritalStatus == 'S' || maritalStatus == 'Single') { input_refresh_bcbstx('marStCd', 'S'); } else if (maritalStatus == 'M' || maritalStatus == 'Married') { input_refresh_bcbstx('marStCd', 'M'); } else if (maritalStatus == 'D' || maritalStatus == 'Divorced') { input_refresh_bcbstx('marStCd', 'D'); } else if (maritalStatus == 'W' || maritalStatus == 'Widowed') { input_refresh_bcbstx('marStCd', 'W'); } } var homephone = jsonObject.ee_BASIC_info['HOMEPHONE']; var homephone_Name = ["homePhone123", "homePhone456", "homePhone7890"]; if (homephone != '') { for (var m = 0; m < homephone_Name.length; m++) { input_refresh_bcbstx(homephone_Name[m], getPhone(homephone)[m]); } } } if (frameObj.contentWindow.document.getElementsByName('fname_dep1')[0]) { var i = 0; if (jsonObject.ee_DEPT_info.Spouse.FIRST_NAME != "" && jsonObject.ee_DEPT_info.Spouse.is_entered == "") { i = ++i; input_dependent(i, 'Spouse', false, 0); for (var kyx in dep_dob_ssn_info()) { var stringInfo = jsonObject.ee_DEPT_info.Spouse[kyx]; for (var j = 0; j < dep_dob_ssn_info()[kyx].length; j++) { if (kyx == 'DOB') { input_refresh_bcbstx(dep_dob_ssn_info()[kyx][j], getDateinfo(stringInfo)[j]); } else { input_refresh_bcbstx(dep_dob_ssn_info()[kyx][j], getSSN(stringInfo)[j]); } } } jsonObject.ee_DEPT_info.Spouse.is_entered = "T"; } if (jsonObject.ee_DEPT_info.Child['FIRST_NAME'] != '') { if (jsonObject.ee_DEPT_info.Child.FIRST_NAME.includes('|') == false) { if (jsonObject.ee_DEPT_info.Child.is_entered != "T") { i = ++i; input_dependent(i, 'Child', false, 0); for (var kyn in dep_dob_ssn_info()) { var cstringInfo = jsonObject.ee_DEPT_info.Child[kyn]; for (var j = 0; j < dep_dob_ssn_info()[kyn].length; j++) { if (kyn == 'DOB') { input_refresh_bcbstx(dep_dob_ssn_info()[kyn][j], getDateinfo(cstringInfo)[j]); } else { input_refresh_bcbstx(dep_dob_ssn_info()[kyn][j], getSSN(cstringInfo)[j]); } } } jsonObject.ee_DEPT_info.Child.is_entered = "T"; } } else { child_ct = jsonObject.ee_DEPT_info.Child.FIRST_NAME.split("|").length; for (var x = 0; x < child_ct; x++) { i = ++i; if (5 < i < child_ct) { if (frameObj.contentWindow.document.getElementsByName('fname_dep' + i)[0] == null) { const links = frameObj.contentWindow.document.getElementsByTagName("a"); for (let i = 0; i < links.length; i++) { if (links[i].href === "javascript:submitAdd(document.depAddInfo)") { links[i].click(); break; } } } } input_dependent(i, 'Child', true, x); for (var kyn in dep_dob_ssn_info()) { var cstringInfo = jsonObject.ee_DEPT_info.Child[kyn].split('|')[x]; for (var j = 0; j < dep_dob_ssn_info()[kyn].length; j++) { if (kyn == 'DOB') { input_refresh_bcbstx(dep_dob_ssn_info()[kyn][j], getDateinfo(cstringInfo)[j]); } else { input_refresh_bcbstx(dep_dob_ssn_info()[kyn][j], getSSN(cstringInfo)[j]); } } } if (i <= 2) { jsonObject.ee_DEPT_info.Child.is_entered = "T" } else { jsonObject.ee_DEPT_info.Child.is_entered = jsonObject.ee_DEPT_info.Child.is_entered + "|" + "T"; } } } } } };if (document.domain == "cignaforemployers.cigna.com") { if (document.querySelector("#ctl00_Master_Authorized_Wizard_ctl01_MemberLookup1_txtSsn") != null) { input_refresh_el(document.querySelector("#ctl00_Master_Authorized_Wizard_ctl01_MemberLookup1_txtSsn"), jsonObject.ee_BASIC_info['SSN']); document.querySelector("#ctl00_Master_Authorized_Wizard_ctl01_cmdFindMember").click(); } if (document.getElementById("ctl00_Master_Authorized_Wizard_ctl01_ddlReasonForEnrollment") != null) { const dic = { "FIRST_NAME": "ctl00_Master_Authorized_Wizard_ctl01_FirstName", "LAST_NAME": "ctl00_Master_Authorized_Wizard_ctl01_LastName", "ADD1": "ctl00_Master_Authorized_Wizard_ctl01_HomeAddress", "ADD2": "ctl00_Master_Authorized_Wizard_ctl01_HomeAddress2", "ADDCITY": "ctl00_Master_Authorized_Wizard_ctl01_HomeCity", "ADDZIP": "ctl00_Master_Authorized_Wizard_ctl01_HomeZip", "HOMEPHONE": "ctl00_Master_Authorized_Wizard_ctl01_HomePh", "WORKPHONE": "ctl00_Master_Authorized_Wizard_ctl01_WorkPh", "PERSONAL_EMAIL": "ctl00_Master_Authorized_Wizard_ctl01_EmailAddress" }; for (var keyv in dic) { var itemv = dic[keyv]; if (keyv == "HOMEPHONE" || keyv == "WORKPHONE") { if (jsonObject.ee_BASIC_info[keyv] != '') { var tel = jsonObject.ee_BASIC_info[keyv]; tel = tel.replace(/[^\d,.]+/g, ''); tel = `${tel.slice(0, 3)}-${tel.slice(3, 6)}-${tel.slice(6)}`; input_refresh(itemv, tel); } } else { input_refresh(itemv, jsonObject.ee_BASIC_info[keyv]); }; }; var eligdate = jsonObject.ee_BASIC_info['ELIG_DATE']; if (eligdate != '') { var eligdate_dateObj = new Date(eligdate); input_refresh_el(document.getElementById('ctl00_Master_Authorized_Wizard_ctl01_RequestedEffectiveDateActive_Out_RequestedEffectiveDateActive_MoSel'), eligdate_dateObj.getMonth() + 1); input_refresh_el(document.getElementById('ctl00_Master_Authorized_Wizard_ctl01_RequestedEffectiveDateActive_Out_RequestedEffectiveDateActive_DySel'), eligdate_dateObj.getDate()); input_refresh_el(document.getElementById('ctl00_Master_Authorized_Wizard_ctl01_RequestedEffectiveDateActive_Out_RequestedEffectiveDateActive_YrSel'), eligdate_dateObj.getFullYear()); }; var dob = jsonObject.ee_BASIC_info['DOB']; if (dob != '') { var dob_dateObj = new Date(dob); input_refresh_el(document.getElementById('ctl00_Master_Authorized_Wizard_ctl01_BirthDate_Out_BirthDate_MoSel'), dob_dateObj.getMonth() + 1); input_refresh_el(document.getElementById('ctl00_Master_Authorized_Wizard_ctl01_BirthDate_Out_BirthDate_DySel'), dob_dateObj.getDate()); input_refresh_el(document.getElementById('ctl00_Master_Authorized_Wizard_ctl01_BirthDate_Out_BirthDate_YrSel'), dob_dateObj.getFullYear()); }; var doh = jsonObject.ee_BASIC_info['DATE_OF_HIRE']; if (doh != '') { var doh_dateObj = new Date(doh); input_refresh_el(document.getElementById('ctl00_Master_Authorized_Wizard_ctl01_HireDate_Out_HireDate_MoSel'), doh_dateObj.getMonth() + 1); input_refresh_el(document.getElementById('ctl00_Master_Authorized_Wizard_ctl01_HireDate_Out_HireDate_DySel'), doh_dateObj.getDate()); input_refresh_el(document.getElementById('ctl00_Master_Authorized_Wizard_ctl01_HireDate_Out_HireDate_YrSel'), doh_dateObj.getFullYear()); }; var sex_v = jsonObject.ee_BASIC_info['GENDER']; if (sex_v == 'F' || sex_v == 'Female') { sex_v = 'F'; } else if (sex_v == 'M' || sex_v == 'Male') { sex_v = 'M'; }; input_refresh_el(document.getElementById('ctl00_Master_Authorized_Wizard_ctl01_Gender'), sex_v); var SP_NAME = jsonObject.ee_DEPT_info.Spouse['FIRST_NAME']; if (SP_NAME == '') { MARITAL_STATUS = 'U'; } else if (SP_NAME != '') { MARITAL_STATUS = 'M'; }; input_refresh_el(document.getElementById('ctl00_Master_Authorized_Wizard_ctl01_MaritalStatus'), MARITAL_STATUS); var state_v = get_short_state(jsonObject.ee_BASIC_info['ADDSTATE']); if (state_v) { input_refresh('ctl00_Master_Authorized_Wizard_ctl01_HomeState', state_v); } }; if (document.getElementById("ctl00_Master_Authorized_Wizard_ctl01_lbSaveAndAddAontherBene") != null) { function input_sp(sp_obj, sp_type) { dept_dic = { "FIRST_NAME": "ctl00_Master_Authorized_Wizard_ctl01_FirstName", "LAST_NAME": "ctl00_Master_Authorized_Wizard_ctl01_LastName", }; op = { "CH": "Child", "CL": "Collateral Dependent", "DP": "Domestic Partner", "FS": "Former Spouse", "GC": "Grandchild", "HC": "Handicapped Child", "SP": "Spouse", "SC": "Step Child", "ST": "Student", "SS": "Surviving Spouse", }; for (var key in dept_dic) { var itemv = dept_dic[key]; var tgt_elv = document.getElementById(itemv); if (tgt_elv != null) { input_refresh_el(tgt_elv, sp_obj[key]); }; }; var dept_ssn=sp_obj["SSN"]; if (dept_ssn!= ''){ dept_ssn=dept_ssn.replace(/[^\d]+/g, ''); dept_ssn = dept_ssn.substring(0, 3) + '-' + dept_ssn.substring(3, 5) + '-' + dept_ssn.substring(5); input_refresh_el(document.getElementById('ctl00_Master_Authorized_Wizard_ctl01_DepSsn'),dept_ssn); }; var dob = sp_obj['DOB']; if (dob != '') { var dob_dateObj = new Date(dob); input_refresh_el(document.getElementById('ctl00_Master_Authorized_Wizard_ctl01_BirthDate_Out_BirthDate_MoSel'), dob_dateObj.getMonth() + 1); input_refresh_el(document.getElementById('ctl00_Master_Authorized_Wizard_ctl01_BirthDate_Out_BirthDate_DySel'), dob_dateObj.getDate()); input_refresh_el(document.getElementById('ctl00_Master_Authorized_Wizard_ctl01_BirthDate_Out_BirthDate_YrSel'), dob_dateObj.getFullYear()); }; var sex_v = sp_obj['GENDER']; if (sex_v == 'F' || sex_v == 'Female') { sex_v = 'F' } else if (sex_v == 'M' || sex_v == 'Male') { sex_v = 'M' }; input_refresh('ctl00_Master_Authorized_Wizard_ctl01_Gender', sex_v); const rel_el = 'ctl00_Master_Authorized_Wizard_ctl01_Relationship'; const rel = sp_obj['RELATION']; if (Object.values(op).includes(rel)) { rel_op = Object.keys(op).find(k => op[k] === rel); } else { rel_op = sp_type; } input_refresh('ctl00_Master_Authorized_Wizard_ctl01_Relationship', rel_op); }; if (jsonObject.ee_DEPT_info.Spouse.FIRST_NAME != "" && jsonObject.ee_DEPT_info.Spouse.is_entered == "") { input_sp(jsonObject.ee_DEPT_info.Spouse, "SP"); jsonObject.ee_DEPT_info.Spouse.is_entered = "T"; } else if (jsonObject.ee_DEPT_info.Child.FIRST_NAME != "") { if (jsonObject.ee_DEPT_info.Child.FIRST_NAME.includes('|') == false) { if (jsonObject.ee_DEPT_info.Child.is_entered != "T") { input_sp(jsonObject.ee_DEPT_info.Child, "CH"); jsonObject.ee_DEPT_info.Child.is_entered = "T"; } } else { child_ct = jsonObject.ee_DEPT_info.Child.FIRST_NAME.split("|").length; if (jsonObject.ee_DEPT_info.Child.is_entered == "") { child_entered_ct = 0 } else { child_entered_ct = jsonObject.ee_DEPT_info.Child.is_entered.split("|").length; }; dept_dic = { "FIRST_NAME": "ctl00_Master_Authorized_Wizard_ctl01_FirstName", "LAST_NAME": "ctl00_Master_Authorized_Wizard_ctl01_LastName", }; op = { "CH": "Child", "CL": "Collateral Dependent", "DP": "Domestic Partner", "FS": "Former Spouse", "GC": "Grandchild", "HC": "Handicapped Child", "SP": "Spouse", "SC": "Step Child", "ST": "Student", "SS": "Surviving Spouse", }; if (child_entered_ct <= child_ct) { for (var key in dept_dic) { var itemv = dept_dic[key]; var tgt_elv = document.getElementById(itemv); if (tgt_elv != null) { input_refresh_el(tgt_elv, jsonObject.ee_DEPT_info.Child[key].split("|")[child_entered_ct]); }; }; var depts_ssn=ee_DEPT_info.Child['SSN'].split("|")[child_entered_ct];; if (depts_ssn!= ''){ depts_ssn=depts_ssn.replace(/[^\d]+/g, ''); depts_ssn = depts_ssn.substring(0, 3) + '-' + depts_ssn.substring(3, 5) + '-' + depts_ssn.substring(5); input_refresh_el(document.getElementById('ctl00_Master_Authorized_Wizard_ctl01_DepSsn'),depts_ssn); }; var dob = jsonObject.ee_DEPT_info.Child['DOB'].split("|")[child_entered_ct]; if (dob != '') { var dob_dateObj = new Date(dob); input_refresh_el(document.getElementById('ctl00_Master_Authorized_Wizard_ctl01_BirthDate_Out_BirthDate_MoSel'), dob_dateObj.getMonth() + 1); input_refresh_el(document.getElementById('ctl00_Master_Authorized_Wizard_ctl01_BirthDate_Out_BirthDate_DySel'), dob_dateObj.getDate()); input_refresh_el(document.getElementById('ctl00_Master_Authorized_Wizard_ctl01_BirthDate_Out_BirthDate_YrSel'), dob_dateObj.getFullYear()); }; var sex_v = jsonObject.ee_DEPT_info.Child['GENDER'].split("|")[child_entered_ct]; if (sex_v == 'F' || sex_v == 'Female') { sex_v = 'F' } else if (sex_v == 'M' || sex_v == 'Male') { sex_v = 'M' }; input_refresh('ctl00_Master_Authorized_Wizard_ctl01_Gender', sex_v); const rel_el = 'ctl00_Master_Authorized_Wizard_ctl01_Relationship'; const rel = jsonObject.ee_DEPT_info.Child['RELATION'].split("|")[child_entered_ct]; if (Object.values(op).includes(rel)) { rel_op = Object.keys(op).find(k => op[k] === rel); } else { rel_op = 'CH'; } input_refresh('ctl00_Master_Authorized_Wizard_ctl01_Relationship', rel_op); if (child_entered_ct == 0) { jsonObject.ee_DEPT_info.Child.is_entered = "T"; } else { jsonObject.ee_DEPT_info.Child.is_entered = jsonObject.ee_DEPT_info.Child.is_entered + "|" + "T"; } } }; }; } };if (document.domain == 'secure.alliedadministrators.com') { if (document.querySelector("#val_radio_male") != null) { if (document.querySelector("#companyname").value == '') { const dic = { "FIRST_NAME": "First Name *", "MIDDLE_NAME": "MI", "LAST_NAME": "Last Name *", "SSN": "SSN *", "DOB": "Date Of Birth *", "DATE_OF_HIRE": "Hire Date *", "ADD1": "Address", "ADD2": "Address Line 2", "ADDCITY": "City", "ADDSTATE": "State", "HOMEPHONE": "Phone", }; var allPageTags = document.getElementsByTagName("label"); for (i = 0; i < allPageTags.length; i++) { for (var key in dic) { if (allPageTags[i].textContent.trim() == dic[key]) { if (key == 'DOB' || key == 'DATE_OF_HIRE') { v_dob = new Date(jsonObject.ee_BASIC_info[key]); input_refresh_el(allPageTags[i].nextElementSibling, getFormattedDate(v_dob)); } else if (key == 'ADDSTATE') { v_state = get_short_state(jsonObject.ee_BASIC_info[key]); input_refresh_el(allPageTags[i].nextElementSibling, get_short_state(v_state)); } else if (key == 'ADD1' || key == 'ADD2') { v_add = jsonObject.ee_BASIC_info[key]; input_refresh_el(allPageTags[i].nextElementSibling, v_add.replace(/[^\d]+/g, '')); } else if (key == 'MIDDLE_NAME') { if (jsonObject.ee_BASIC_info[key] != '') { v_mi = jsonObject.ee_BASIC_info[key][0]; input_refresh_el(allPageTags[i].nextElementSibling, v_mi) }; } else { input_refresh_el(allPageTags[i].nextElementSibling, jsonObject.ee_BASIC_info[key]); } } } }; var allinputs = document.getElementsByTagName("input"); for (i = 0; i < allinputs.length; i++) { for (var key in dic) { if (allinputs[i].getAttribute('ng-model') == "employee.Zip5") { input_refresh_el(allinputs[i], jsonObject.ee_BASIC_info.ADDZIP); break; } } }; var sex_v = jsonObject.ee_BASIC_info['GENDER']; if (sex_v == 'F' || sex_v == 'Female') { var tgt_elg = document.querySelector("#val_radio_female"); } else if (sex_v == 'M' || sex_v == 'Male') { var tgt_elg = document.querySelector("#val_radio_male"); }; tgt_elg.dispatchEvent(new Event('keydown')); tgt_elg.dispatchEvent(new Event('keypress')); tgt_elg.dispatchEvent(new Event('keyup')); tgt_elg.dispatchEvent(new Event('blur')); } const dept_dic = { "FIRST_NAME": "manage-dependents_manageDependents_0__dependent_name_firstname", "LAST_NAME": "manage-dependents_manageDependents_0__dependent_name_lastname", "DOB": "manage-dependents_manageDependents_0__dependent_birthDate", "SSN": "manage-dependents_manageDependents_0__dependent_id", }; var dept_i = 0; function delay(n) { return new Promise(function(resolve) { setTimeout(resolve, n * 50); }); } function add_new() { document.querySelector("#form_validation > div.ng-scope > div.uk-width-medium-10-10.uk-text-left > div > div > span").click() } function get_dept_el() { const spouse_elementList = []; var allels = document.getElementsByTagName("div"); for (i = 0; i < allels.length; i++) { if (allels[i].getAttribute('ng-repeat') == "depent in employee.dependent") { spouse_elementList.push(allels[i]); } }; return spouse_elementList } async function dept_enter() { if (jsonObject.ee_DEPT_info.Spouse.FIRST_NAME != "") { add_new(); await delay(1); var sex_v = jsonObject.ee_DEPT_info.Spouse.GENDER; if (sex_v == 'F' || sex_v == 'Female') { rel = 'W' } else if (sex_v == 'M' || sex_v == 'Male') { rel = 'H' }; var allinputs = get_dept_el()[dept_i].getElementsByTagName("input"); for (i = 0; i < allinputs.length; i++) { if (allinputs[i].getAttribute('ng-model') == " depent.RelationshipCode") { input_refresh_el(allinputs[i], rel); } if (allinputs[i].getAttribute('ng-model') == "depent.FirstName") { input_refresh_el(allinputs[i], jsonObject.ee_DEPT_info.Spouse.FIRST_NAME); } if (allinputs[i].getAttribute('ng-model') == "depent.Birthdate") { v_dob = new Date(jsonObject.ee_DEPT_info.Spouse.DOB); input_refresh_el(allinputs[i], getFormattedDate(v_dob)); } }; jsonObject.ee_DEPT_info.Spouse.is_entered = "T"; dept_i++; }; if (jsonObject.ee_DEPT_info.Child.FIRST_NAME != "") { if (jsonObject.ee_DEPT_info.Child.FIRST_NAME.includes('|') == false) { if (jsonObject.ee_DEPT_info.Child.is_entered != "T") { add_new(); await delay(1); var sex_v = jsonObject.ee_DEPT_info.Child.GENDER; if (sex_v == 'F' || sex_v == 'Female') { rel = 'W' } else if (sex_v == 'M' || sex_v == 'Male') { rel = 'H' }; var allinputs = get_dept_el()[dept_i].getElementsByTagName("input"); for (i = 0; i < allinputs.length; i++) { if (allinputs[i].getAttribute('ng-model') == " depent.RelationshipCode") { input_refresh_el(allinputs[i], rel); } if (allinputs[i].getAttribute('ng-model') == "depent.FirstName") { input_refresh_el(allinputs[i], jsonObject.ee_DEPT_info.Child.FIRST_NAME); } if (allinputs[i].getAttribute('ng-model') == "depent.Birthdate") { v_dob = new Date(jsonObject.ee_DEPT_info.Child.DOB); input_refresh_el(allinputs[i], getFormattedDate(v_dob)); } }; jsonObject.ee_DEPT_info.Child.is_entered = "T"; dept_i++; } } else { child_ct = jsonObject.ee_DEPT_info.Child.FIRST_NAME.split("|").length; for (var child_entered_ct = 0; child_entered_ct < child_ct; child_entered_ct++) { add_new(); await delay(1); var sex_v = jsonObject.ee_DEPT_info.Child['GENDER'].split("|")[child_entered_ct]; if (sex_v == 'F' || sex_v == 'Female') { rel = 'D' } else if (sex_v == 'M' || sex_v == 'Male') { rel = 'S' }; var allinputs = get_dept_el()[dept_i].getElementsByTagName("input"); for (i = 0; i < allinputs.length; i++) { if (allinputs[i].getAttribute('ng-model') == " depent.RelationshipCode") { input_refresh_el(allinputs[i], rel); } if (allinputs[i].getAttribute('ng-model') == "depent.FirstName") { input_refresh_el(allinputs[i], jsonObject.ee_DEPT_info.Child.FIRST_NAME.split("|")[child_entered_ct]); } if (allinputs[i].getAttribute('ng-model') == "depent.Birthdate") { v_dob = new Date(jsonObject.ee_DEPT_info.Child.DOB.split("|")[child_entered_ct]); input_refresh_el(allinputs[i], getFormattedDate(v_dob)); } }; if (child_entered_ct == 0) { jsonObject.ee_DEPT_info.Child.is_entered = "T"; } else { jsonObject.ee_DEPT_info.Child.is_entered = jsonObject.ee_DEPT_info.Child.is_entered + "|" + "T"; }; dept_i++ } }; }; }; dept_enter(); } }if (document.domain == 'eyemanage.eyemedvisioncare.com') { async function process() { function delay(n) { return new Promise(function(resolve) { setTimeout(resolve, n * 200); }); }; const dic_EEPart1 = { 'FIRST_NAME': 'firstName', 'LAST_NAME': 'lastName', 'DOB': 'dob', 'GENDER': 'gender', 'MIDDLE_NAME': 'middleInitial' }; const dic_EEPart2 = { 'ADD1': 'line1', 'ADD2': 'line2', 'ADDCITY': 'city', 'ADDCOUNTY': 'county', 'HOMEPHONE': 'phone', 'PERSONAL_EMAIL': 'email' }; const dic_dependent = { 'FIRST_NAME': 'firstName', 'LAST_NAME': 'lastName', 'DOB': 'dob', 'MIDDLE_NAME': 'middleInitial' }; if (document.getElementById('relationship') == null && document.getElementById('line1') == null) { if (jsonObject.ee_BASIC_info.DOB.includes(" ") == true) { var BirthDate = jsonObject.ee_BASIC_info.DOB.split(" ")[0]; } else { var BirthDate = jsonObject.ee_BASIC_info.DOB; }; console.log(BirthDate); for (var keyv in dic_EEPart1) { var itemv = dic_EEPart1[keyv]; var el = document.getElementById(itemv); switch (keyv) { case 'DOB': el.value = BirthDate; el.dispatchEvent(new Event("input")); break; case 'GENDER': if (jsonObject.ee_BASIC_info.GENDER == 'F' || jsonObject.ee_BASIC_info.GENDER == "Female") { el.value = 'F'; } else if (jsonObject.ee_BASIC_info.GENDER == 'M' || jsonObject.ee_BASIC_info.GENDER == "Male") { el.value = 'M'; }; el.dispatchEvent(new Event('change')); break; case 'MIDDLE_NAME': if (jsonObject.ee_BASIC_info.MIDDLE_NAME != '') { el.value = jsonObject.ee_BASIC_info.MIDDLE_NAME.charAt(0); el.dispatchEvent(new Event("input")); }; break; default: el.value = jsonObject.ee_BASIC_info[keyv]; el.dispatchEvent(new Event("input")); }; }; async function job_click() { var el = document.querySelector("#ssn"); var clickEvent = new Event('focus', { bubbles: true }); clickEvent.simulated = true; el.dispatchEvent(clickEvent); console.log(el); }; async function job() { var el = document.querySelector("#ssn"); console.log(el); console.log(jsonObject.ee_BASIC_info.SSN); el.value = jsonObject.ee_BASIC_info.SSN; el.dispatchEvent(new Event('input', { bubbles: true })); el.dispatchEvent(new Event('change', { bubbles: true })); el.dispatchEvent(new Event('blur', { bubbles: true })); }; async function start_job() { await job_click(); await job(); } start_job(); } else if (document.getElementById('relationship') == null && document.getElementById('line1') != null) { var el = document.getElementById('zip'); el.value = jsonObject.ee_BASIC_info.ADDZIP; el.dispatchEvent(new Event('input')); for (var keyv in dic_EEPart2) { var itemv = dic_EEPart2[keyv]; var el = document.getElementById(itemv); switch (keyv) { case 'HOMEPHONE': var phoneNumber = jsonObject.ee_BASIC_info.HOMEPHONE; if (/[^0-9]/.test(phoneNumber)) { phoneNumber = phoneNumber.replace(/\D/g, ""); }; el.value = phoneNumber; await delay(1); el.dispatchEvent(new Event("input")); break; default: console.log(jsonObject.ee_BASIC_info[keyv]); el.value = jsonObject.ee_BASIC_info[keyv]; await delay(1); el.dispatchEvent(new Event("input")); }; }; } else if (document.getElementById('relationship') != null) { if (jsonObject.ee_DEPT_info.Spouse.FIRST_NAME != "" && jsonObject.ee_DEPT_info.Spouse.is_entered == "") { if (jsonObject.ee_DEPT_info.Spouse.DOB.includes(" ") == true) { var BirthDate = jsonObject.ee_DEPT_info.Spouse.DOB.split(" ")[0]; } else { var BirthDate = jsonObject.ee_DEPT_info.Spouse.DOB; }; for (var keyv in dic_dependent) { var itemv = dic_dependent[keyv]; var el = document.getElementById(itemv); switch (keyv) { case 'DOB': el.value = BirthDate; el.dispatchEvent(new Event("input")); break; case 'MIDDLE_NAME': if (jsonObject.ee_DEPT_info.Spouse.MIDDLE_NAME != '') { el.value = jsonObject.ee_DEPT_info.Spouse.MIDDLE_NAME.charAt(0); el.dispatchEvent(new Event("input")); }; break; default: console.log(jsonObject.ee_DEPT_info.Spouse[keyv]); el.value = jsonObject.ee_DEPT_info.Spouse[keyv]; el.dispatchEvent(new Event("input")); }; }; var el = document.getElementById('relationship'); if (jsonObject.ee_DEPT_info.Spouse.RELATION == 'Spouse') { if (jsonObject.ee_DEPT_info.Spouse.GENDER == 'F' || jsonObject.ee_DEPT_info.Spouse.GENDER == 'Female') { el.value = 'W'; el.dispatchEvent(new Event('change')); } else if (jsonObject.ee_DEPT_info.Spouse.GENDER == 'M' || jsonObject.ee_DEPT_info.Spouse.GENDER == 'Male') { el.value = 'H'; el.dispatchEvent(new Event('change')); } else { el.value = 'p'; el.dispatchEvent(new Event('change')); var el = document.getElementById('gender'); if (jsonObject.ee_DEPT_info.Spouse.GENDER == 'M' || jsonObject.ee_DEPT_info.Spouse.GENDER == 'Male') { el.value = 'M'; el.dispatchEvent(new Event('change')); } else if (jsonObject.ee_DEPT_info.Spouse.GENDER == 'F' || jsonObject.ee_DEPT_info.Spouse.GENDER == 'Female') { el.value = 'F'; el.dispatchEvent(new Event('change')); }; }; }; async function job_click() { var el = document.querySelector("#ssn"); var clickEvent = new Event('focus', { bubbles: true }); clickEvent.simulated = true; el.dispatchEvent(clickEvent); console.log(el); }; async function job() { var el = document.querySelector("#ssn"); console.log(el); console.log(jsonObject.ee_DEPT_info.Spouse.SSN); el.value = jsonObject.ee_DEPT_info.Spouse.SSN; el.dispatchEvent(new Event('input', { bubbles: true })); el.dispatchEvent(new Event('change', { bubbles: true })); el.dispatchEvent(new Event('blur', { bubbles: true })); }; async function start_job() { await job_click(); await job(); }; start_job(); jsonObject.ee_DEPT_info.Spouse.is_entered = 'T'; } else if (jsonObject.ee_DEPT_info.Child.FIRST_NAME != '') { if (jsonObject.ee_DEPT_info.Child.FIRST_NAME.includes('|') == false) { if (jsonObject.ee_DEPT_info.Child.DOB.includes(" ") == true) { var BirthDate = jsonObject.ee_DEPT_info.Child.DOB.split(" ")[0]; } else { var BirthDate = jsonObject.ee_DEPT_info.Child.DOB; }; for (var keyv in dic_dependent) { var itemv = dic_dependent[keyv]; var el = document.getElementById(itemv); switch (keyv) { case 'DOB': el.value = BirthDate; el.dispatchEvent(new Event("input")); break; case 'MIDDLE_NAME': if (jsonObject.ee_DEPT_info.Child.MIDDLE_NAME != '') { el.value = jsonObject.ee_DEPT_info.Child.MIDDLE_NAME.charAt(0); el.dispatchEvent(new Event("input")); }; break; default: console.log(jsonObject.ee_DEPT_info.Spouse[keyv]); el.value = jsonObject.ee_DEPT_info.Spouse[keyv]; el.dispatchEvent(new Event("input")); }; }; var el = document.getElementById('relationship'); console.log(jsonObject.ee_DEPT_info.Child.GENDER); if (jsonObject.ee_DEPT_info.Child.GENDER == 'F' || jsonObject.ee_DEPT_info.Child.GENDER == 'Female') { el.value = 'D'; el.dispatchEvent(new Event('change')); } else if (jsonObject.ee_DEPT_info.Child.GENDER == 'M' || jsonObject.ee_DEPT_info.Child.GENDER == 'Male') { el.value = 'S'; el.dispatchEvent(new Event('change')); }; jsonObject.ee_DEPT_info.Child.is_entered = 'T'; } else { var child_ct = jsonObject.ee_DEPT_info.Child.FIRST_NAME.split('|').length; if (jsonObject.ee_DEPT_info.Child.is_entered == '') { var child_entered_ct = 0; } else { child_entered_ct = jsonObject.ee_DEPT_info.Child.is_entered.split('|').length; }; console.log(child_ct); console.log(child_entered_ct); console.log(jsonObject.ee_DEPT_info.Child.is_entered); if (child_entered_ct < child_ct) { console.log(jsonObject.ee_DEPT_info.Child.DOB); var BirthDate = jsonObject.ee_DEPT_info.Child.DOB.split("|")[child_entered_ct]; if (BirthDate.includes(" ") == true) { var BirthDate = BirthDate.split(" ")[0]; }; console.log(BirthDate); for (var keyv in dic_dependent) { var itemv = dic_dependent[keyv]; var el = document.getElementById(itemv); switch (keyv) { case 'DOB': el.value = BirthDate; el.dispatchEvent(new Event("input")); break; case 'MIDDLE_NAME': if (jsonObject.ee_DEPT_info.Child.MIDDLE_NAME.split("|")[child_entered_ct] != '') { el.value = el.value = jsonObject.ee_DEPT_info.Child.MIDDLE_NAME.split("|")[child_entered_ct].charAt(0); el.dispatchEvent(new Event("input")); }; break; default: console.log(jsonObject.ee_DEPT_info.Child[keyv].split("|")[child_entered_ct]); el.value = jsonObject.ee_DEPT_info.Child[keyv].split("|")[child_entered_ct]; el.dispatchEvent(new Event("input")); }; }; var el = document.getElementById('relationship'); console.log(jsonObject.ee_DEPT_info.Child.GENDER.split("|")[child_entered_ct]); if (jsonObject.ee_DEPT_info.Child.GENDER.split("|")[child_entered_ct] == 'F' || jsonObject.ee_DEPT_info.Child.GENDER.split("|")[child_entered_ct] == 'Female') { el.value = 'D'; el.dispatchEvent(new Event('change')); } else if (jsonObject.ee_DEPT_info.Child.GENDER.split("|")[child_entered_ct] == 'M' || jsonObject.ee_DEPT_info.Child.GENDER.split("|")[child_entered_ct] == 'Male') { el.value = 'S'; el.dispatchEvent(new Event('change')); }; async function job_click() { var el = document.querySelector("#ssn"); var clickEvent = new Event('focus', { bubbles: true }); clickEvent.simulated = true; el.dispatchEvent(clickEvent); console.log(el); }; async function job() { var el = document.querySelector("#ssn"); console.log(el); console.log(jsonObject.ee_DEPT_info.Child.SSN.split("|")[child_entered_ct]); el.value = jsonObject.ee_DEPT_info.Child.SSN.split("|")[child_entered_ct]; el.dispatchEvent(new Event('input', { bubbles: true })); el.dispatchEvent(new Event('change', { bubbles: true })); el.dispatchEvent(new Event('blur', { bubbles: true })); }; async function start_job() { await job_click(); await job(); }; start_job(); if (child_entered_ct == 0) { jsonObject.ee_DEPT_info.Child.is_entered = "T"; } else { jsonObject.ee_DEPT_info.Child.is_entered = jsonObject.ee_DEPT_info.Child.is_entered + "|" + "T"; }; console.log(jsonObject.ee_DEPT_info.Child.is_entered); }; }; }; }; }; async function start() { await process(); }; start(); };if (document.domain == "www.guardiananytime.com") { if (document.getElementById('member.gender') != null) { const dic = { "SSN": "member.memberID", "FIRST_NAME": "member.firstName", "MIDDLE_NAME": "member.middleName", "LAST_NAME": "member.lastName", "DOB": "member.dateBirth", "ADD1": "homeAddress.address1", "ADD2": "homeAddress.address2", "ADDZIP": "homeAddress.zipcode", "ADDCITY": "homeAddress.city", "WORKPHONE": "phoneNumber", "PERSONAL_EMAIL": "email", "WORK_EMAIL": "email", "HOUR_PER_WEEK": "hoursWorked1", "ANNUAL_SALARY": "salary2", "JOB_TITLE": "jobTitle", }; for (var keyg in dic) { var itemg = dic[keyg]; if (itemg != '' && document.getElementById(itemg) != null) { var tgt_elg = document.getElementById(itemg); tgt_elg.dispatchEvent(new Event('focusin')); if (itemg == "member.dateBirth") { g_doh = new Date(jsonObject.ee_BASIC_info[keyg]); tgt_elg.value = getFormattedDate(g_doh); } else if (itemg == "hoursWorked1") { if (jsonObject.ee_BASIC_info[keyg] == '') { tgt_elg.value = 40 } else { tgt_elg.value = jsonObject.ee_BASIC_info[keyg]; } } else { if (jsonObject.ee_BASIC_info[keyg] != "") { tgt_elg.value = jsonObject.ee_BASIC_info[keyg]; } }; tgt_elg.dispatchEvent(new Event('change')); tgt_elg.dispatchEvent(new Event('blur')); tgt_elg.dispatchEvent(new Event('focusout')); } }; var sex_g = jsonObject.ee_BASIC_info['GENDER']; if (sex_g == 'F' || sex_g == 'Female') { sex_g = 'F' } else if (sex_g == 'M' || sex_g == 'Male') { sex_g = 'M' }; input_refresh('member.gender', sex_g); if (jsonObject.ee_DEPT_info.Spouse.FIRST_NAME != "") { document.getElementById('lbl-radioMarried-yes').click() } else { document.getElementById('lbl-radioMarried-no').click() }; if (jsonObject.ee_DEPT_info.Child.FIRST_NAME != "") { document.getElementById('lblradioChildrens-yes').click() } else { document.getElementById('lblradioChildrens-no').click() }; if (jsonObject.ee_BASIC_info.PAY_PERIOD == 'H') { function input_HOURLY(datestring) { function input_refresh_el(tgt_elg, val) { tgt_elg.dispatchEvent(new Event('focusin')); tgt_elg.value = val; tgt_elg.dispatchEvent(new Event('input')); tgt_elg.dispatchEvent(new Event('change')); tgt_elg.dispatchEvent(new Event('blur')); tgt_elg.dispatchEvent(new Event('focusout')); } function delay(n) { return new Promise(function(resolve) { setTimeout(resolve, n * 5); }); } async function myAsyncFunction() { input_refresh_el(document.querySelector("#salaryPeriod"), "H"); await delay(1); input_refresh_el(document.querySelector("#salary1"), datestring.replace(/[^\d,.]+/g, '')); }; myAsyncFunction(); }; input_HOURLY(jsonObject.ee_BASIC_info.HOURLY_SALARY) } else { input_refresh('salary2', jsonObject.ee_BASIC_info.ANNUAL_SALARY.replace(/[^\d,.]+/g, '')); } input_refresh('phoneNumber', jsonObject.ee_BASIC_info.WORKPHONE.replace(/[^\d,.]+/g, '')); input_refresh('homeAddress.city', jsonObject.ee_BASIC_info.ADDCITY); function input_doh(doh_datestring) { var tgt_dt = new Date(doh_datestring); var formattedDate = tgt_dt.toDateString(); function delay(n) { return new Promise(function(resolve) { setTimeout(resolve, n * 5); }); }; async function myAsyncFunction(tgt_dt) { var el = document.getElementById('dateOfHire'); el.dispatchEvent(new Event('focus')); const tgt_year = tgt_dt.getFullYear(); const curr_year = new Date().getFullYear(); if (tgt_year !== curr_year) { if (tgt_year > curr_year) { var n_m = document.querySelectorAll('[aria-label="Next Month"]')[0]; for (let i = 0; i < 12 * (tgt_year - curr_year); i++) { await delay(1); n_m.click(); } } else if (tgt_year < curr_year) { var p_m = document.querySelectorAll('[aria-label="Previous Month"]')[0]; for (let i = 0; i < 12 * (curr_year - tgt_year); i++) { await delay(1); p_m.click(); } } }; if (new Date().getMonth() > tgt_dt.getMonth()) { const ind = new Date().getMonth() - tgt_dt.getMonth(); var p_m = document.querySelectorAll('[aria-label="Previous Month"]')[0]; for (i = 0; i < ind; i++) { await delay(1); p_m.click(); } } else if (new Date().getMonth() < tgt_dt.getMonth()) { const ind = tgt_dt.getMonth() - new Date().getMonth(); var n_m = document.querySelectorAll('[aria-label="Next Month"]')[0]; for (i = 0; i < ind; i++) { await delay(1); n_m.click(); } }; el.dispatchEvent(new Event('focusout')); document.querySelectorAll('[aria-label="' + formattedDate + '"]')[0].click(); }; myAsyncFunction(tgt_dt); }; if (jsonObject.ee_BASIC_info.DATE_OF_HIRE) { input_doh(jsonObject.ee_BASIC_info.DATE_OF_HIRE); }; }; if (document.getElementById("elections.Dental.selectedPlan") != null) { var allWaives = document.getElementsByTagName("span"); for (i = 0; i < allWaives.length; i++) { if (allWaives[i].textContent == 'Waived') { allWaives[i].click(); } } }; if (document.getElementById("dependents.spouse.memberID") != null) { sp_dic = { "SSN": "dependents.spouse.memberID", "FIRST_NAME": "dependents.spouse.firstName", "MIDDLE_NAME": "dependents.spouse.middleName", "LAST_NAME": "dependents.spouse.lastName", "WORKPHONE": "dependents.spouse.phone", "WORK_EMAIL": "dependents.spouse.email", "GENDER": "dependents.spouse.gender", }; if (jsonObject.ee_DEPT_info.Spouse.FIRST_NAME != "") { for (key in sp_dic) { if (jsonObject.ee_DEPT_info.Spouse[key] != "" && document.getElementById(sp_dic[key]) != null) { input_refresh(sp_dic[key], jsonObject.ee_DEPT_info.Spouse[key]); } }; var sp_gender = jsonObject.ee_DEPT_info.Spouse.GENDER; if (sp_gender == 'F' || sp_gender == 'Female') { input_refresh('dependents.spouse.relationship', 'W'); input_refresh('dependents.spouse.gender', 'F'); }; if (sp_gender == 'M' || sp_gender == 'Male') { input_refresh('dependents.spouse.relationship', 'H'); input_refresh('dependents.spouse.gender', 'M'); }; if (jsonObject.ee_DEPT_info.Spouse.DOB != '') { g_doh = new Date(jsonObject.ee_DEPT_info.Spouse.DOB); input_refresh('dependents.spouse.dateBirth', getFormattedDate(g_doh)); }; }; }; if (document.getElementById("dependents.children[0].firstName") != null && jsonObject.ee_DEPT_info.Child.FIRST_NAME != "") { var dept_ct = 0; function add_dept(ct) { for (o = 1; o < ct; o++) { var allPageTags = document.getElementsByTagName("button"); for (i = 0; i < allPageTags.length; i++) if (allPageTags[i].textContent == 'Add') { allPageTags[i].click(); break; } } }; if (jsonObject.ee_DEPT_info.Child.FIRST_NAME != "") { dept_ct = dept_ct + jsonObject.ee_DEPT_info.Child.FIRST_NAME.split('|').length }; if (dept_ct > 1) { add_dept(dept_ct) }; dep_dic = { "SSN": "dependents.children[0].memberID", "FIRST_NAME": "dependents.children[0].firstName", "MIDDLE_NAME": "dependents.children[0].middleName", "LAST_NAME": "dependents.children[0].lastName", "DOB": "dependents.children[0].dateBirth", "WORKPHONE": "dependents.children[0].phone", "WORK_EMAIL": "dependents.children[0].email", "GENDER": "dependents.children[0].gender", }; var c_i = 0; for (c_i = 0; c_i < dept_ct; c_i++) { for (key in dep_dic) { if (jsonObject.ee_DEPT_info.Child[key] != "" && document.getElementById(dep_dic[key].replace('0', c_i)) != null) { input_refresh(dep_dic[key].replace('0', c_i), jsonObject.ee_DEPT_info.Child[key].split('|')[c_i]); } }; var ch_gender = jsonObject.ee_DEPT_info.Child.GENDER.split('|')[c_i]; if ((ch_gender == 'F' || ch_gender == 'Female')) { input_refresh('dependents.children[' + c_i + '].relationship', 'D'); input_refresh('dependents.children[' + c_i + '].gender', 'F'); }; if (ch_gender == 'M' || ch_gender == 'Male') { input_refresh('dependents.children[' + c_i + '].relationship', 'S'); input_refresh('dependents.children[' + c_i + '].gender', 'M'); }; if (jsonObject.ee_DEPT_info.Child.DOB.split('|')[c_i] != '') { g_doh = new Date(jsonObject.ee_DEPT_info.Child.DOB.split('|')[c_i]); input_refresh('dependents.children[' + c_i + '].dateBirth', getFormattedDate(g_doh)); }; } }; if (document.getElementById("memberInfoDO.eventDate") != null) { const dic = { "SSN": "ssn", "DOH": "", "FIRST_NAME": "firstName", "MIDDLE_NAME": "middleInitial", "LAST_NAME": "lastName", "DOB": "dateOfBirth", "ADD1": "addressLine1", "ADD2": "addressLine2", "ADDCITY": "city", "ADDZIP": "zipCode", "WORK_EMAIL": "email", "HOUR_PER_WEEK": "hoursWorked", "ANNUAL_SALARY": "salarydollar", "JOB_TITLE": "jobTitle", }; for (var keyg in dic) { var itemg = dic[keyg]; if (itemg != '' && document.getElementById(itemg) != null) { var tgt_elg = document.getElementById(itemg); tgt_elg.dispatchEvent(new Event('focusin')); if (itemg == "dateOfBirth") { g_doh = new Date(jsonObject.ee_BASIC_info[keyg]); tgt_elg.value = getFormattedDate(g_doh); } else { tgt_elg.value = jsonObject.ee_BASIC_info[keyg]; }; tgt_elg.dispatchEvent(new Event('change')); tgt_elg.dispatchEvent(new Event('blur')); tgt_elg.dispatchEvent(new Event('focusout')); } }; var sex_g = jsonObject.ee_BASIC_info['GENDER']; if (sex_g == 'F' || sex_g == 'Female') { sex_g = 'Female' } else if (sex_g == 'M' || sex_g == 'Male') { sex_g = 'Male' }; input_refresh('gender', sex_g); } };if (document.domain.includes("employerview.thehartford.com")) { function delay(n) { return new Promise(function(resolve) { setTimeout(resolve, n * 50); }); }; function input_refresh_el(tgt_elg, val) { tgt_elg.dispatchEvent(new Event('focus')); tgt_elg.value = val; tgt_elg.dispatchEvent(new Event('change')); tgt_elg.dispatchEvent(new Event('blur')); }; if (document.querySelector('input[name="ssn1"]') != null) { const dic = { "ID": "employeeid", "FIRST_NAME": "firstname", "MIDDLE_NAME": "mi", "LAST_NAME": "lastname", "ADD1": "addressline1", "ADD2": "addressline2", "ADDCITY": "city", "ADDZIP": "zipcode", "JOB_TITLE": "occupation", "ADDSTATE": "statecode", "GENDER": "gender" }; for (var keyv in dic) { var itemv = dic[keyv]; var el = document.querySelector('input[name="' + itemv + '"]'); if (el != null) { input_refresh_el(el, jsonObject.ee_BASIC_info[keyv]); } } var state_el = document.querySelector('select[name="statecode"]'); input_refresh_el(state_el, get_short_state(jsonObject.ee_BASIC_info.ADDSTATE)); var GENDER_el = document.querySelector('select[name="gender"]'); var sex_v = jsonObject.ee_BASIC_info.GENDER; if (sex_v == 'F' || sex_v == 'Female') { var gd = "F"; } else if (sex_v == 'M' || sex_v == 'Male') { var gd = "M"; }; input_refresh_el(GENDER_el, gd); var ssn_main = jsonObject.ee_BASIC_info['SSN'].replace(/\D+/g, ""); var firstThree = ssn_main.substring(0, 3); var middleTwo = ssn_main.substring(3, 5); var lastFour = ssn_main.substring(5); var ssn_el = document.querySelector('input[name="ssn1"]'); input_refresh_el(ssn_el, firstThree); var ssn_el = document.querySelector('input[name="ssn2"]'); input_refresh_el(ssn_el, middleTwo); var ssn_el = document.querySelector('input[name="ssn3"]'); input_refresh_el(ssn_el, lastFour); let DOB_main = jsonObject.ee_BASIC_info['DOB']; let DOB_date = new Date(DOB_main); let DOB_day = String(DOB_date.getDate()).padStart(2, '0'); let DOB_month = String(DOB_date.getMonth() + 1).padStart(2, '0'); let DOB_year = DOB_date.getFullYear(); var dobm_el = document.querySelector('select[name="dobmonth"]'); var dobd_el = document.querySelector('select[name="dobday"]'); var doby_el = document.querySelector('input[name="dobyear"]'); input_refresh_el(dobm_el, DOB_month); input_refresh_el(dobd_el, DOB_day); input_refresh_el(doby_el, DOB_year); var smoker_el = document.querySelector('select[name="smoker"]'); input_refresh_el(smoker_el, 'U'); let maritalstatusMap = { "Married": "M", "Single": "S", "Divorced": "D", "Unknown": "U", }; let selectElement = document.querySelector('select[name="maritalstatus"]'); let status = jsonObject.ee_BASIC_info['MARITAL_STATUS']; if (maritalstatusMap[status]) { input_refresh_el(selectElement, maritalstatusMap[status]); } else { input_refresh_el(selectElement, "U"); } let DOH_main = jsonObject.ee_BASIC_info['DATE_OF_HIRE']; if (DOH_main != '') { let DOH_date = new Date(DOH_main); let DOH_day = String(DOH_date.getDate()).padStart(2, '0'); let DOH_month = String(DOH_date.getMonth() + 1).padStart(2, '0'); let DOH_year = DOH_date.getFullYear(); var dohm_el = document.querySelector('select[name="hiremonth"]'); var dohd_el = document.querySelector('select[name="hireday"]'); var dohy_el = document.querySelector('input[name="hireyear"]'); input_refresh_el(dohm_el, DOH_month); input_refresh_el(dohd_el, DOH_day); input_refresh_el(dohy_el, DOH_year); } let ELG_main = jsonObject.ee_BASIC_info['DATE_OF_HIRE']; if (ELG_main != '') { let ELG_date = new Date(ELG_main); let ELG_day = String(ELG_date.getDate()).padStart(2, '0'); let ELG_month = String(ELG_date.getMonth() + 1).padStart(2, '0'); let ELG_year = ELG_date.getFullYear(); var elgm_el = document.querySelector('select[name="enrollmentmonth"]'); var elgd_el = document.querySelector('select[name="enrollmentday"]'); var elgy_el = document.querySelector('input[name="enrollmentyear"]'); input_refresh_el(elgm_el, ELG_month); input_refresh_el(elgd_el, ELG_day); input_refresh_el(elgy_el, ELG_year); }; async function input_gender() { var salarymode = "-1"; let salarymodeElement = document.querySelector('select[name="salarymode"]'); if (jsonObject.ee_BASIC_info['ANNUAL_SALARY'] == '' && jsonObject.ee_BASIC_info['HOURLY_SALARY'] != '') { input_refresh_el(salarymodeElement, "4"); await delay(1); input_refresh_el(document.querySelector('input[name="salary"]'), jsonObject.ee_BASIC_info['HOURLY_SALARY']); input_refresh_el(document.querySelector('input[name="hoursworked"]'), jsonObject.ee_BASIC_info['HOUR_PER_WEEK']); } else if (jsonObject.ee_BASIC_info['ANNUAL_SALARY'] != '') { input_refresh_el(salarymodeElement, "1"); input_refresh_el(document.querySelector('input[name="salary"]'), jsonObject.ee_BASIC_info['ANNUAL_SALARY']); } }; input_gender(); } }if (document.domain.includes ("hp-mbr-admn")) { if (document.getElementById("yes") == null) { const dic = { "FIRST_NAME": "firstName", "MIDDLE_NAME": "middleNameControl", "LAST_NAME": "lastNameControl", "DOB": "dobid", "SSN": "ssnid", "ADD1": "addressInput", "ADDSTATE": "state", "ADDCITY": "city", "ADDZIP": "postal_code", "HOMEPHONE": "homePhone", "WORKPHONE": "workPhone", "PERSONAL_EMAIL": "emailid", }; for (var keyv in dic) { var itemv = dic[keyv]; if (itemv != '') { if (itemv == "dobid") { g_doh = new Date(jsonObject.ee_BASIC_info[keyv]); input_refresh(itemv, getFormattedDate(g_doh)); } else { input_refresh(itemv, jsonObject.ee_BASIC_info[keyv]); }; }; }; var state_v = get_short_state(jsonObject.ee_BASIC_info['ADDSTATE']); if (state_v) { input_refresh('state', state_v) }; var sex_v = jsonObject.ee_BASIC_info['GENDER']; if (sex_v == 'F' || sex_v == 'Female') { sex_v = 'Female' } else if (sex_v == 'M' || sex_v == 'Male') { sex_v = 'Male' }; var allPageTags = document.getElementById('accountRole_enrollAddFamily').getElementsByTagName("select"); for (i = 0; i < allPageTags.length; i++) { tgt_elg = allPageTags[i]; input_refresh_el(tgt_elg, sex_v); }; input_refresh('locality', jsonObject.ee_BASIC_info.ADD2); }; if (document.getElementById("yes") != null || document.getElementById("coverageDate") != null) { dept_dic = { "FIRST_NAME": "firstName", "MIDDLE_NAME": "middleNameControl", "LAST_NAME": "lastName", "DOB": "dobid", "SSN": "ssnid", }; if (jsonObject.ee_DEPT_info.Spouse.FIRST_NAME != "" && jsonObject.ee_DEPT_info.Spouse.is_entered == "") { for (var key in dept_dic) { var itemv = dept_dic[key]; var tgt_elv = document.getElementById(itemv).children[0]; if (tgt_elv != null) { if (itemv == "dobid") { g_doh = new Date(jsonObject.ee_DEPT_info.Spouse[key]); input_refresh_el(tgt_elv, getFormattedDate(g_doh)); } else { input_refresh_el(tgt_elv, jsonObject.ee_DEPT_info.Spouse[key]); }; }; }; var sex_v = jsonObject.ee_DEPT_info.Spouse['GENDER']; if (sex_v == 'F' || sex_v == 'Female') { sex_v = 'Female' } else if (sex_v == 'M' || sex_v == 'Male') { sex_v = 'Male' }; var allPageTags = document.getElementById('accountRole_enrollAddFamily').getElementsByTagName("select"); for (i = 0; i < allPageTags.length; i++) { tgt_elg = allPageTags[i]; input_refresh_el(tgt_elg, sex_v); }; var allselectTags = document.getElementsByTagName("select"); for (i = 0; i < allselectTags.length; i++) { if (allselectTags[i].name == 'accountRole') { const spouse_role = jsonObject.ee_DEPT_info.Spouse.RELATION; if (spouse_role == 'Domestic Partner') { input_refresh_el(allselectTags[i], 'Domestic Partner'); } else { input_refresh_el(allselectTags[i], 'Spouse'); }; } }; jsonObject.ee_DEPT_info.Spouse.is_entered = "T"; } else if (jsonObject.ee_DEPT_info.Child.FIRST_NAME != "") { var allselectTags = document.getElementsByTagName("select"); for (i = 0; i < allselectTags.length; i++) { if (allselectTags[i].name == 'accountRole') { input_refresh_el(allselectTags[i], 'Family Member'); } }; if (jsonObject.ee_DEPT_info.Child.FIRST_NAME.includes('|') == false) { if (jsonObject.ee_DEPT_info.Child.is_entered != "T") { for (var keyv in dept_dic) { var itemv = dept_dic[keyv]; if (itemv != '' && jsonObject.ee_DEPT_info.Child[keyv] != "") { var tgt_elv = document.getElementById(itemv).children[0]; if (tgt_elv != null) { if (itemv == "dobid") { g_doh = new Date(jsonObject.ee_DEPT_info.Child[keyv]); input_refresh_el(tgt_elv, getFormattedDate(g_doh)); } else { input_refresh_el(tgt_elv, jsonObject.ee_DEPT_info.Child[keyv]); }; }; }; }; var sex_v = jsonObject.ee_DEPT_info.Child['GENDER']; if (sex_v == 'F' || sex_v == 'Female') { sex_v = 'Female' } else if (sex_v == 'M' || sex_v == 'Male') { sex_v = 'Male' }; var allPageTags = document.getElementById('accountRole_enrollAddFamily').getElementsByTagName("select"); for (i = 0; i < allPageTags.length; i++) { tgt_elg = allPageTags[i]; input_refresh_el(tgt_elg, sex_v); } jsonObject.ee_DEPT_info.Child.is_entered = "T"; } } else { child_ct = jsonObject.ee_DEPT_info.Child.FIRST_NAME.split("|").length; if (jsonObject.ee_DEPT_info.Child.is_entered == "") { child_entered_ct = 0 } else { child_entered_ct = jsonObject.ee_DEPT_info.Child.is_entered.split("|").length; }; if (child_entered_ct <= child_ct) { for (var keyv in dept_dic) { var itemv = dept_dic[keyv]; if (itemv != '' && jsonObject.ee_DEPT_info.Child[keyv] != '') { var tgt_elv = document.getElementById(itemv).children[0]; if (tgt_elv != null) { if (itemv == "dobid") { g_doh = new Date(jsonObject.ee_DEPT_info.Child[keyv].split("|")[child_entered_ct]); input_refresh_el(tgt_elv, getFormattedDate(g_doh)); } else { input_refresh_el(tgt_elv, jsonObject.ee_DEPT_info.Child[keyv].split("|")[child_entered_ct]); }; }; }; }; var sex_v = jsonObject.ee_DEPT_info.Child['GENDER'].split("|")[child_entered_ct]; if (sex_v == 'F' || sex_v == 'Female') { sex_v = 'Female'; } else if (sex_v == 'M' || sex_v == 'Male') { sex_v = 'Male'; }; var allPageTags = document.getElementById('accountRole_enrollAddFamily').getElementsByTagName("select"); for (i = 0; i < allPageTags.length; i++) { tgt_elg = allPageTags[i]; input_refresh_el(tgt_elg, sex_v); }; if (child_entered_ct == 0) { jsonObject.ee_DEPT_info.Child.is_entered = "T" } else { jsonObject.ee_DEPT_info.Child.is_entered = jsonObject.ee_DEPT_info.Child.is_entered + "|" + "T"; } } }; }; } };if (document.domain == "www3.mutualofomaha.com") { function input_refresh(tgt_el_name, val) { tgt_elg = document.querySelector('[name="' + tgt_el_name + '"]'); if (!tgt_elg) { return; } var ev = new Event('input', { bubbles: true }); ev.simulated = true; tgt_elg.value = val; tgt_elg.dispatchEvent(ev); } function selectValueFromDropDown(SelectedValue, ele_name) { const dropdown = document.querySelector(`div[name="${ele_name}"]`); if (!dropdown) { return; } const options = dropdown.querySelectorAll('.item'); let fOption; for (let i = 0; i < options.length; i++) { if (options[i].textContent === SelectedValue) { fOption = options[i]; break; } } fOption.click(); } function getFormattedDate(date) { var dateO = new Date(date); let year = dateO.getFullYear(); let month = (1 + dateO.getMonth()).toString().padStart(2, '0'); let day = dateO.getDate().toString().padStart(2, '0'); return month + '/' + day + '/' + year; }; function input_dep(Relationship, Relationship2, idx) { for (var i = 1; i < 100; i++) { var testValue = document.getElementsByName(`newDependents.new${Relationship2}.new${Relationship}-${i}.demographic.firstName`); if (testValue.length > 0) { if (testValue[0].value == '') { const sdic = { "FIRST_NAME": "newDependents.new" + Relationship2 + ".new" + Relationship + "-" + i + ".demographic.firstName", "MIDDLE_NAME": "newDependents.new" + Relationship2 + ".new" + Relationship + "-" + i + ".demographic.middleName", "LAST_NAME": "newDependents.new" + Relationship2 + ".new" + Relationship + "-" + i + ".demographic.lastName", "DOB": "newDependents.new" + Relationship2 + ".new" + Relationship + "-" + i + ".demographic.birthDate", "GENDER": "newDependents.new" + Relationship2 + ".new" + Relationship + "-" + i + ".demographic.gender" }; for (var key in sdic) { if (typeof(idx) == 'string') { jsonValue = jsonObject.ee_DEPT_info[Relationship][key]; } else { jsonValue = jsonObject.ee_DEPT_info[Relationship][key].split('|')[idx]; } itemV = sdic[key]; if (jsonObject.ee_DEPT_info[Relationship][key] != '') { if (key == 'GENDER') { if (jsonValue == 'M' || jsonValue == 'Male') { selectValueFromDropDown('Male', itemV) } else { selectValueFromDropDown('Female', itemV) } } else if (key == 'DOB') { input_refresh(itemV, getFormattedDate(jsonValue)); } else { input_refresh(itemV, jsonValue); } } } break; } } } } const dic = { "SSN": "demographic.ssn", "FIRST_NAME": "demographic.firstName", "MIDDLE_NAME": "demographic.middleName", "LAST_NAME": "demographic.lastName", "GENDER": "demographic.gender", "DOB": "demographic.birthDate", "ANNUAL_SALARY": "salaries.Basic.amount", "HOURLY_SALARY": "salaries.Basic.amount", "ADD1": "demographic.address.street1", "ADD2": "demographic.address.street2", "ADDCITY": "demographic.address.city", "ADDCOUNTY": "demographic.address.country", "ADDSTATE": "demographic.address.state", "ADDZIP": "demographic.address.zip", "HOUR_PER_WEEK": "employment.hoursWorked", "JOB_TITLE": "employment.jobTitle" }; for (var key in dic) { itemV = dic[key]; if (jsonObject.ee_BASIC_info[key] != '') { if (key == 'GENDER') { var gValue = jsonObject.ee_BASIC_info[key]; if (gValue == 'M' || gValue == 'Male') { selectValueFromDropDown('Male', itemV) } else { selectValueFromDropDown('Female', itemV) } } else if (key == 'DOB') { var dobValue = jsonObject.ee_BASIC_info[key]; input_refresh(itemV, getFormattedDate(dobValue)); } else if (key == 'ANNUAL_SALARY') { input_refresh(itemV, jsonObject.ee_BASIC_info[key]); selectValueFromDropDown('Annual', 'salaries.Basic.frequency'); } else if (key == 'HOURLY_SALARY' && document.getElementsByName('salaries.Basic.amount')[0].value == '') { input_refresh(itemV, jsonObject.ee_BASIC_info[key]); selectValueFromDropDown('Hourly', 'salaries.Basic.frequency'); } else if (key == 'ADDCOUNTY') { var conntryvalue = jsonObject.ee_BASIC_info[key]; if (conntryvalue == 'US' || conntryvalue == 'United States') { selectValueFromDropDown('United States', itemV); } else { selectValueFromDropDown('Canada', itemV); } } else if (key == 'ADDSTATE') { var stateValue = jsonObject.ee_BASIC_info[key]; selectValueFromDropDown(get_full_state(stateValue), itemV); } else { input_refresh(itemV, jsonObject.ee_BASIC_info[key]); } } else if (jsonObject.ee_BASIC_info[key] == '' && key == "ADDCOUNTY") { selectValueFromDropDown('United States', itemV); } } if (jsonObject.ee_DEPT_info.Spouse.FIRST_NAME != '') { var h3Elements = document.getElementsByTagName('h3'); for (var i = 0; i < h3Elements.length; i++) { if (h3Elements[i].innerHTML === 'Spouse') { var addSpouseelement = document.querySelector('a.hand'); if (addSpouseelement != null && addSpouseelement.innerText == '+ Add Spouse') { addSpouseelement.click(); } input_dep('Spouse', 'Spouse', 'a'); } } jsonObject.ee_DEPT_info.Spouse.is_entered = "T"; } if (jsonObject.ee_DEPT_info.Child['FIRST_NAME'] != '') { var h3Elements = document.getElementsByTagName('h3'); for (var i = 0; i < h3Elements.length; i++) { if (h3Elements[i].innerHTML === 'Children') { if (jsonObject.ee_DEPT_info.Child.FIRST_NAME.includes('|') == false) { const childElements = document.getElementsByClassName('hand'); for (var j = 0; j < childElements.length; j++) { if (childElements[j] != null && childElements[j].innerText == '+ Add Child') { childElements[j].click(); break; } } input_dep('Child', 'Children', 'a'); jsonObject.ee_DEPT_info.Child.is_entered = "T"; } else { child_ct = jsonObject.ee_DEPT_info.Child.FIRST_NAME.split("|").length; for (var x = 0; x < child_ct; x++) { const childElements = document.getElementsByClassName('hand'); for (var j = 0; j < childElements.length; j++) { if (childElements[j] != null && childElements[j].innerText == '+ Add Child') { childElements[j].click(); break; } } input_dep('Child', 'Children', x); if (X = 0) { jsonObject.ee_DEPT_info.Child.is_entered = "T"; } else { jsonObject.ee_DEPT_info.Child.is_entered = jsonObject.ee_DEPT_info.Child.is_entered + "|" + "T"; } } } } } } }if (document.domain == "connect.meritain.com") { function input_refresh_meritain(tgt_el_id, val) { tgt_elg = document.getElementById(tgt_el_id); tgt_elg.dispatchEvent(new Event('focusin')); tgt_elg.value = val; tgt_elg.dispatchEvent(new Event('change')); tgt_elg.dispatchEvent(new Event('blur')); tgt_elg.dispatchEvent(new Event('focusout')); }; function getFormattedDate(date) { let year = date.getFullYear(); let month = (1 + date.getMonth()).toString().padStart(2, '0'); let day = date.getDate().toString().padStart(2, '0'); return month + '/' + day + '/' + year; }; function wait(delay) { return new Promise(resolve => setTimeout(resolve, delay)); } async function firstChild(i) { if (i != 0) { document.getElementById('addAnotherDependentBtn').click(); await wait(3000); } input_MeritainDept(i, 'Child', false, 's'); jsonObject.ee_DEPT_info.Child.is_entered = "T"; } async function myFunction(i) { const bnClickCount = i; child_ct = jsonObject.ee_DEPT_info.Child.FIRST_NAME.split("|").length; for (var x = 0; x < child_ct; x++) { if (0 < i && i < (child_ct + bnClickCount)) { document.getElementById('addAnotherDependentBtn').click(); await wait(3000); } input_MeritainDept(i, 'Child', true, x); if (x == 0) { jsonObject.ee_DEPT_info.Child.is_entered = "T"; } else { jsonObject.ee_DEPT_info.Child.is_entered = jsonObject.ee_DEPT_info.Child.is_entered + "|" + "T"; } i = ++i; } }; function input_MeritainDept(i, rela1, needIndex, idx) { const dic = { "FIRST_NAME": "dependentFirstName" + i, "MIDDLE_NAME": "dependentmiddleName" + i, "LAST_NAME": "dependentLastName" + i, "GENDER": "dependentGender" + i, "RELATION": "dependentrelationship" + i, "SSN": "dependentSSN" + i, "DOB": "dependentDateOfBirth" + i }; for (var key in dic) { item = dic[key]; if (needIndex == false) { jsonValue = jsonObject.ee_DEPT_info[rela1][key]; } else { jsonValue = jsonObject.ee_DEPT_info[rela1][key].split('|')[idx]; } if (jsonValue != '' && jsonValue != undefined) { if (key == 'DOB') { var dateString = jsonValue; var dateO = new Date(dateString); input_refresh_meritain(item, getFormattedDate(dateO)); } else if (key == 'GENDER') { var sex_g = jsonValue; if (sex_g == 'F' || sex_g == 'Female') { sex_g = '2'; } else if (sex_g == 'M' || sex_g == 'Male') { sex_g = '1'; }; document.getElementById(item).value = sex_g; } else if (key == 'RELATION') { var spouseLists = ["Ex-Spouse", "Ex-Domestic Partner", "Former Dependent", "Deceased Spouse", "Spouse-Ex", "Deceased Dependent"]; if (jsonValue == 'Spouse') { jsonValue = '1'; } else if (key == 'Child') { jsonValue = '2'; } else if (key == 'Child-Adopted') { jsonValue = '3'; } else if (key == 'Child-Step') { jsonValue = '4'; } else if (key == 'Child-Foster') { jsonValue = '5'; } else if (key == 'Child-Grandchild' || key == 'Child-Legal Guardian') { jsonValue = '6'; } else if (key == 'Domestic Partner') { jsonValue = '8'; } else if (key == 'Child-Domestic Partner') { jsonValue = '9'; } else if (spouseLists.includes(jsonValue)) { jsonValue = '11'; } input_refresh_meritain(item, jsonValue); } else { input_refresh_meritain(item, jsonValue); } } } }; if (document.querySelector('li a[title="Member Information"]').parentElement.className == 'active') { const dic = { "SSN": "memberSSN", "DATE_OF_HIRE": "memberDateOfHire", "FIRST_NAME": "memberFirstName", "MIDDLE_NAME": "memberMiddleName", "LAST_NAME": "memberLastName", "DOB": "memberDateOfBirth", "GENDER": "memberGender", "MARITAL_STATUS": "maritalSel", "ADD1": "memberAddress1", "ADD2": "memberAddress2", "ADDCITY": "memberCity", "ADDSTATE": "memberState", "ADDZIP": "memberZipCode", "PERSONAL_EMAIL": "emailInput", "WORK_EMAIL": "emailInput", "ANNUAL_SALARY": "annualSalSel", "HOMEPHONE": "memberPrimaryPhone", "WORKPHONE": "memberPrimaryPhone" }; for (var keyg in dic) { var itemg = dic[keyg]; if (jsonObject.ee_BASIC_info[keyg] != '') { if (keyg == 'DOH' || keyg == 'DOB') { var dateString = jsonObject.ee_BASIC_info[keyg]; var dateO = new Date(dateString); input_refresh_meritain(itemg, getFormattedDate(dateO)); } else if (keyg == 'GENDER') { var sex_g = jsonObject.ee_BASIC_info['GENDER']; if (sex_g == 'F' || sex_g == 'Female') { sex_g = '2'; } else if (sex_g == 'M' || sex_g == 'Male') { sex_g = '1'; }; input_refresh_meritain(itemg, sex_g); } else if (keyg.includes('EMAIL')) { if (document.getElementById('emailInput').value == '') { var wEmail = jsonObject.ee_BASIC_info['WORK_EMAIL']; if (wEmail != '') { input_refresh_meritain('emailInput', wEmail); } else { input_refresh_meritain('emailInput', jsonObject.ee_BASIC_info[keyg]); } } } else if (keyg.includes('PHONE')) { if (document.getElementById('memberPrimaryPhone').value == '') { var wPhone = jsonObject.ee_BASIC_info['WORKPHONE']; if (wEmail != '') { document.getElementById('memberPrimaryPhoneWork').click(); input_refresh_meritain('memberPrimaryPhone', wPhone); } else if (keyg == 'HOMEPHONE') { document.getElementById('memberPrimaryPhoneHome').click(); input_refresh_meritain('memberPrimaryPhone', jsonObject.ee_BASIC_info[keyg]); } } } else if (keyg == 'MARITAL_STATUS') { var maritalStatus = jsonObject.ee_BASIC_info['MARITAL_STATUS']; if (maritalStatus == 'Domestic Partner' || maritalStatus == 'Married') { maritalStatus = 'Married'; } else if (maritalStatus == 'Divorced' || maritalStatus == 'Former spouse - court ordered coverage') { maritalStatus = 'Divorced'; } else if (maritalStatus == 'Separated' || maritalStatus == 'Legally Separated') { maritalStatus = 'Separated'; } else if (maritalStatus == 'Single') { maritalStatus = 'Single'; } else if (maritalStatus == 'Widowed') { maritalStatus = 'Widowed'; } input_refresh_meritain(itemg, maritalStatus); } else if (keyg == 'ANNUAL_SALARY') { input_refresh_meritain(itemg, jsonObject.ee_BASIC_info[keyg].replace(/\$|,/g, "")) } else { input_refresh_meritain(itemg, jsonObject.ee_BASIC_info[keyg]); } } } } if (document.querySelector('li a[title="Dependent Information"]').parentElement.className == 'active') { var i = 0; if (jsonObject.ee_DEPT_info.Spouse.FIRST_NAME != '') { input_MeritainDept(i, 'Spouse', false, 's'); jsonObject.ee_DEPT_info.Spouse.is_entered = "T"; i = ++i; } if (jsonObject.ee_DEPT_info.Child['FIRST_NAME'] != '') { if (jsonObject.ee_DEPT_info.Child.FIRST_NAME.includes('|') == false) { firstChild(i); } else { myFunction(i); } } } }if (document.domain.includes('principal.com')) { function input_refresh_react(tgt_el_id, val) { var evs = ['input', 'change', 'blur', 'focusout']; tgt_elg = document.querySelector(tgt_el_id); if (!tgt_elg) { return; } var ev = new Event('focusin', { bubbles: true }); ev.simulated = true; tgt_elg.dispatchEvent(ev); tgt_elg.value = val; for (var i = 0; i < evs.length; i++) { var ev = new Event(evs[i], { bubbles: true }); ev.simulated = true; tgt_elg.dispatchEvent(ev); } }; function delay(n) { return new Promise(function(resolve) { setTimeout(resolve, n * 50); }); }; function reivse_date(dateString) { const date = new Date(dateString); const formattedDate = date.toLocaleDateString('en-US', { month: 'numeric', day: 'numeric', year: 'numeric' }); return (formattedDate); } if (document.body.innerText.includes("Reason For Addition")) { var firstn = jsonObject.ee_BASIC_info['FIRST_NAME']; var lastn = jsonObject.ee_BASIC_info['LAST_NAME']; async function myAsyncFunction(firstn, lastn) { check_status = await check_ee_status(firstn, lastn); if (check_status == '') { alert('Employee ' + firstn + ' ' + lastn + ' not found! Could process!'); } else { alert('Employee checked! Status is ' + check_status); } if (check_status != 'Active') { input_refresh_react('#reasonForAdditionDropDown', "newHire"); await delay(1); var wrk_h = jsonObject.ee_BASIC_info['HOUR_PER_WEEK']; input_refresh_react('#addMemberReasonPanelHoursWorked', wrk_h); document.querySelector("#addMemberReasonAcknowledge > input[type=checkbox]").click(); } } async function check_ee_status(first_name, last_name) { var currentURL = window.location.href; var regex = /(\d+)\/(\d+)/; var match = currentURL.match(regex); if (match) { var value1 = match[1]; var value2 = match[2]; var url = "https://advisors-groupbenefits.principal.com/GroupBenefitsEmployerUI/proxy/GroupBenefitsEmployer/api/members/" + value1 + "/" + value2; } else { throw new Error("Digits not found in the URL."); } var memberStatus = ''; try { const response = await fetch(url); if (!response.ok) { throw new Error('Network response was not ok.'); } const data = await response.json(); data.forEach(item => { if (item.firstName.toLowerCase() === first_name.toLowerCase() && item.lastName.toLowerCase() === last_name.toLowerCase()) { memberStatus = item.memberStatus; } }); return memberStatus; } catch (error) { return 'An error occurred while making the request: ' + error; } } myAsyncFunction(firstn, lastn); }; if (document.body.innerText.includes("New Member Demographics")) { const dic = { "FIRST_NAME": "firstName", "MIDDLE_NAME": "middleName", "LAST_NAME": "lastName", "DOB": "dateOfBirth", "HOMEPHONE": "phoneNumber", "ADD1": "address", "ADD2": "addressLine2", "ADDCITY": "city", "ADDZIP": "zip", "DATE_OF_HIRE": "date_input" }; for (var keyv in dic) { var itemv = dic[keyv]; if (itemv != '') { if (itemv == "dateOfBirth" || itemv == "date_input") { g_dob = new Date(jsonObject.ee_BASIC_info[keyv]); input_refresh_react('input#' + itemv, getFormattedDate(g_dob)); }else if (itemv == "address" || itemv == "addressLine2"){ input_refresh_react('#' + itemv, jsonObject.ee_BASIC_info[keyv].replace(/[^\w\s]/gi, '')); } else { input_refresh_react('#' + itemv, jsonObject.ee_BASIC_info[keyv]); }; }; }; var sex_v = jsonObject.ee_BASIC_info['GENDER']; if (sex_v == 'F' || sex_v == 'Female') { sex_v = 'FEMALE'; } else if (sex_v == 'M' || sex_v == 'Male') { sex_v = 'MALE'; }; input_refresh_react('#gender', sex_v); var pemail = jsonObject.ee_BASIC_info['PERSONAL_EMAIL']; var wemail = jsonObject.ee_BASIC_info['WORK_EMAIL']; var t_email = pemail || wemail || ''; input_refresh_react('#email', t_email); async function myAsyncFunction() { await input_job(); await input_wage(); } async function input_wage() { tgt_elg = document.querySelector('#wage'); if (tgt_elg) { var ear_mode = jsonObject.ee_BASIC_info['PAY_PERIOD']; var ANNUAL_SALARY = jsonObject.ee_BASIC_info['ANNUAL_SALARY']; var HOURLY_SALARY = jsonObject.ee_BASIC_info['HOURLY_SALARY']; if (ear_mode == '' || ear_mode == 'ANNUAL' || ANNUAL_SALARY != '') { input_refresh_react("#wage", ANNUAL_SALARY); input_refresh_react("#wageFrequency", 'YEAR'); console.log('YEAR', ANNUAL_SALARY); } else { input_refresh_react("#wageFrequency", 'HOUR'); input_refresh_react("#wage", HOURLY_SALARY); } } } async function input_job() { var evs = ['input', 'change', 'blur']; tgt_elg = document.querySelector('#jobClassifications'); if (tgt_elg.childElementCount > 1) { tgt_elg.selectedIndex = '1'; for (var i = 0; i < evs.length; i++) { var ev = new Event(evs[i], { bubbles: true }); ev.simulated = true; tgt_elg.dispatchEvent(ev); } await delay(1); } }; myAsyncFunction(); prin_dept_dic = { "FIRST_NAME": "dependentFirstName0", "LAST_NAME": "dependentLastName0", "DOB": "dependentDateOfBirth0", }; function get_rel(rel_variableValue) { c_re_dic = { "SPOUSE": "SPOUSE", "COMMON-LAW SPOUSE": "COMMON LAW SPOUSE", "CIVIL UNION PARTNER": "CIVIL UNION PARTNER", "DOMESTIC PARTNER": "DOMESTIC PARTNER", "STATE REGISTERED DOMESTIC PARTNER": "STATE REGISTERED DOMESTIC PARTNER", "RECIPROCAL BENEFICIARY": "RECIPROCAL BENEFICIARY", "CHILD": "CHILD", "FOSTER CHILD": "FOSTER CHILD", "GRAND CHILD": "GRAND CHILD", "DISABLED CHILD": "HANDICAPPED CHILD", "NON TRADITIONAL CHILD": "NON TRADITIONAL CHILD", }; const c_re_map = { "CHILD": ["child", "child-domestic partner"], "DOMESTIC PARTNER": ["domestic partner"], "SPOUSE": ["spouse"], "FOSTER CHILD": ["child-adopted", "child-foster", "child-step", "child-legal guardian"], "GRAND CHILD": ["child-grandchild"], }; let result = ''; for (const key in c_re_map) { if (c_re_map[key].includes(rel_variableValue.toLowerCase())) { result = key; break; } }; return (c_re_dic[result]); } var dep_i = 0; async function add_dep() { if (jsonObject.ee_DEPT_info.Spouse.FIRST_NAME != "") { document.querySelector("#addDependentButtonTop").click(); await delay(1); for (var key in prin_dept_dic) { var itemv = prin_dept_dic[key]; if (itemv != '') { if (key == "DOB") { g_doh = new Date(jsonObject.ee_DEPT_info.Spouse[key]); input_refresh_react('input#' + itemv.replace('0', dep_i), getFormattedDate(g_doh)); } else { input_refresh_react('#' + itemv.replace('0', dep_i), jsonObject.ee_DEPT_info.Spouse[key]); }; }; }; var sex_v = jsonObject.ee_DEPT_info.Spouse['GENDER']; if (sex_v == 'F' || sex_v == 'Female') { sex_v = 'FEMALE'; } else if (sex_v == 'M' || sex_v == 'Male') { sex_v = 'MALE'; }; const spouse_gender = 'dependentGender0'; input_refresh_react('#' + spouse_gender.replace('0', dep_i), sex_v); const spouse_rel = 'dependentRelationship0'; var sp_rel = jsonObject.ee_DEPT_info.Spouse['RELATION']; if (sp_rel == '') { sp_rel = 'SPOUSE'; }; const sp_rel_conv = get_rel(sp_rel); if (sp_rel_conv == '') { input_refresh_react('#' + spouse_rel.replace('0', dep_i), "SPOUSE"); } else { input_refresh_react('#' + spouse_rel.replace('0', dep_i), sp_rel_conv); } jsonObject.ee_DEPT_info.Spouse.is_entered = "T"; dep_i++; }; if (jsonObject.ee_DEPT_info.Child.FIRST_NAME != "") { if (jsonObject.ee_DEPT_info.Child.FIRST_NAME.includes('|') == false) { if (jsonObject.ee_DEPT_info.Child.is_entered != "T") { document.querySelector("#addDependentButtonTop").click(); await delay(1); for (var key in prin_dept_dic) { var itemv = prin_dept_dic[key]; if (itemv != '') { if (key == "DOB") { g_doh = new Date(jsonObject.ee_DEPT_info.Child[key]); input_refresh_react('input#' + itemv.replace('0', dep_i), getFormattedDate(g_doh)); } else { input_refresh_react('#' + itemv.replace('0', dep_i), jsonObject.ee_DEPT_info.Child[key]); }; }; }; var sex_v = jsonObject.ee_DEPT_info.Child['GENDER']; if (sex_v == 'F' || sex_v == 'Female') { sex_v = 'FEMALE'; } else if (sex_v == 'M' || sex_v == 'Male') { sex_v = 'MALE'; }; const spouse_gender = 'dependentGender0'; input_refresh_react('#' + spouse_gender.replace('0', dep_i), sex_v); const spouse_rel = 'dependentRelationship0'; var sp_rel = jsonObject.ee_DEPT_info.Child['RELATION']; if (sp_rel == '') { sp_rel = 'Child'; }; const sp_rel_conv = get_rel(sp_rel); if (sp_rel_conv == '') { input_refresh_react('#' + spouse_rel.replace('0', dep_i), "CHILD"); } else { input_refresh_react('#' + spouse_rel.replace('0', dep_i), sp_rel_conv); } jsonObject.ee_DEPT_info.Child.is_entered = "T"; dep_i++; } } else { child_ct = jsonObject.ee_DEPT_info.Child.FIRST_NAME.split("|").length; for (var child_entered_ct = 0; child_entered_ct < child_ct; child_entered_ct++) { document.querySelector("#addDependentButtonTop").click(); await delay(1); for (var key in prin_dept_dic) { var itemv = prin_dept_dic[key]; if (itemv != '') { if (key == "DOB") { g_doh = new Date(jsonObject.ee_DEPT_info.Child[key].split("|")[child_entered_ct]); input_refresh_react('input#' + itemv.replace('0', dep_i), getFormattedDate(g_doh)); } else { input_refresh_react('#' + itemv.replace('0', dep_i), jsonObject.ee_DEPT_info.Child[key].split("|")[child_entered_ct]); }; }; }; var sex_v = jsonObject.ee_DEPT_info.Child['GENDER'].split("|")[child_entered_ct]; if (sex_v == 'F' || sex_v == 'Female') { sex_v = 'FEMALE'; } else if (sex_v == 'M' || sex_v == 'Male') { sex_v = 'MALE'; }; const spouse_gender = 'dependentGender0'; input_refresh_react('#' + spouse_gender.replace('0', dep_i), sex_v); const spouse_rel = 'dependentRelationship0'; var sp_rel = jsonObject.ee_DEPT_info.Child['RELATION']; if (sp_rel == '') { sp_rel = 'Child' } else { sp_rel = sp_rel.split("|")[child_entered_ct]; }; const sp_rel_conv = get_rel(sp_rel); if (sp_rel_conv == '') { input_refresh_react('#' + spouse_rel.replace('0', dep_i), "CHILD"); } else { input_refresh_react('#' + spouse_rel.replace('0', dep_i), sp_rel_conv); } if (child_entered_ct == 0) { jsonObject.ee_DEPT_info.Child.is_entered = "T"; } else { jsonObject.ee_DEPT_info.Child.is_entered = jsonObject.ee_DEPT_info.Child.is_entered + "|" + "T"; }; dep_i++ } }; }; }; add_dep(); } };if (document.domain == "employereservices.optum.com") { function get_rel(rel_variableValue) { c_re_dic = { "Child": "CH", "Collateral dependent": "CD", "Disabled (Handicapped) Child": "HC", "Domestic Partner": "DP", "Other": "OT", "Sponsored Dependent": "SD", "Spouse": "SP", "Step Child": "SC", "Student": "ST", "Surviving Spouse": "SS" }; const c_re_map = { "Child": ["Child", "Child-Domestic Partner"], "Domestic Partner": ["Domestic Partner"], "Spouse": ["Spouse"], "Step Child": ["Child-Adopted", "Child-Foster", "Child-Step", "Child-Legal Guardian"], }; let result = ''; for (const key in c_re_map) { if (c_re_map[key].includes(rel_variableValue)) { result = key; break; } }; if (result == '') { result = 'Other' }; return(c_re_dic[result]); } if (document.getElementById('ff-iframe').contentWindow.document.getElementById('employeeInfo.demographicInfo.lastName') != null) { if (document.getElementById("employeeId") == null && document.getElementById('ff-iframe').contentWindow.document.getElementById('content-section-wrap-dependent') == null) { const dic = { "FIRST_NAME": "firstName", "MIDDLE_NAME": "middleInitial", "LAST_NAME": "employeeInfo.demographicInfo.lastName", "SSN": "employeeId", "DOB": "dateOfBirth", "DATE_OF_HIRE": "dateOfHire", "SSN": "ssn", "ADD1": "addressLineOne", "ADD2": "addressLineTwo", "ADDSTATE": "states", "ADDCITY": "addressCity", "ADDZIP": "empzip", "HOMEPHONE": "depphone", "WORKPHONE": "addressWorkPhone", "PERSONAL_EMAIL": "addressEmailAddress", "WORK_EMAIL": "addressEmailAddress", }; for (var keyv in dic) { var itemv = dic[keyv]; if (itemv != '') { var el = document.getElementById('ff-iframe').contentWindow.document.getElementById(itemv); if (el != null) { if (itemv == "dateOfBirth" || itemv == "dateOfHire") { g_doh = new Date(jsonObject.ee_BASIC_info[keyv]); input_refresh_el(el, getFormattedDate(g_doh)); } else if (itemv == "addressHomePhone" || itemv == "addressWorkPhone") { if (jsonObject.ee_BASIC_info[keyv]) { input_refresh_el(el, jsonObject.ee_BASIC_info[keyv].replace(/[^\d,.]+/g, '')) }; } else { if (jsonObject.ee_BASIC_info[keyv] != '') { input_refresh_el(el, jsonObject.ee_BASIC_info[keyv]); } }; }; }; }; var sex_v = jsonObject.ee_BASIC_info['GENDER']; if (sex_v == 'F' || sex_v == 'Female') { sex_v = 'F' } else if (sex_v == 'M' || sex_v == 'Male') { sex_v = 'M' }; input_refresh_el(document.getElementById('ff-iframe').contentWindow.document.getElementById('gender'), sex_v); var state_v = get_short_state(jsonObject.ee_BASIC_info['ADDSTATE']); if (state_v) { input_refresh_el(document.getElementById('ff-iframe').contentWindow.document.getElementById('states'), state_v); }; }; if (document.getElementById('ff-iframe').contentWindow.document.getElementById('content-section-wrap-dependent') != null) { dept_dic = { "FIRST_NAME": 'dependentBeans0.dependentInfo.demographicInfo.firstName', "MIDDLE_NAME": 'dependentBeans0.dependentInfo.demographicInfo.middleInitial', "LAST_NAME": 'dependentBeans0.dependentInfo.demographicInfo.lastName', "DOB": "depDateofBirth0", "SSN": "depSsn0", }; var dept_indx = 0; if (jsonObject.ee_DEPT_info.Spouse.FIRST_NAME != "") { for (var key in dept_dic) { var itemv = dept_dic[key]; var tgt_elv = document.getElementById('ff-iframe').contentWindow.document.getElementById(itemv.replace('0', dept_indx)); if (tgt_elv != null) { if (itemv == "depDateofBirth" + dept_indx) { g_doh = new Date(jsonObject.ee_DEPT_info.Spouse[key]); input_refresh_el(tgt_elv, getFormattedDate(g_doh)); } else { input_refresh_el(tgt_elv, jsonObject.ee_DEPT_info.Spouse[key]); }; }; }; var sex_v = jsonObject.ee_DEPT_info.Spouse['GENDER']; if (sex_v == 'F' || sex_v == 'Female') { sex_v = 'F' } else if (sex_v == 'M' || sex_v == 'Male') { sex_v = 'M' }; input_refresh_el(document.getElementById('ff-iframe').contentWindow.document.getElementById('depGender' + dept_indx), sex_v); const sp_rel = jsonObject.ee_DEPT_info.Spouse['RELATION']; if (sp_rel==''){ sp_rel='Spouse'}; const sp_rel_conv=get_rel(sp_rel); input_refresh_el(document.getElementById('ff-iframe').contentWindow.document.querySelector("#accordion-body-" + dept_indx).querySelector("#depRelationShip"), sp_rel_conv); jsonObject.ee_DEPT_info.Spouse.is_entered = "T"; dept_indx++; }; if (jsonObject.ee_DEPT_info.Child.FIRST_NAME != "") { if (jsonObject.ee_DEPT_info.Child.FIRST_NAME.includes('|') == false) { if (jsonObject.ee_DEPT_info.Child.is_entered != "T") { for (var keyv in dept_dic) { var itemv = dept_dic[keyv]; if (itemv != '' && jsonObject.ee_DEPT_info.Child[keyv] != "") { var tgt_elv = document.getElementById('ff-iframe').contentWindow.document.getElementById(itemv.replace('0', dept_indx)); if (tgt_elv != null) { if (itemv == "depDateofBirth" + dept_indx) { g_dohs = new Date(jsonObject.ee_DEPT_info.Child[keyv]); input_refresh_el(tgt_elv, getFormattedDate(g_dohs)); } else { input_refresh_el(tgt_elv, jsonObject.ee_DEPT_info.Child[keyv]); }; }; }; }; var sex_v = jsonObject.ee_DEPT_info.Child['GENDER']; if (sex_v == 'F' || sex_v == 'Female') { sex_v = 'F' } else if (sex_v == 'M' || sex_v == 'Male') { sex_v = 'M' }; input_refresh_el(document.getElementById('ff-iframe').contentWindow.document.getElementById('depGender' + dept_indx), sex_v); const sp_rel = jsonObject.ee_DEPT_info.Child['RELATION']; if (sp_rel==''){ sp_rel='Child'}; const sp_rel_conv=get_rel(sp_rel); input_refresh_el(document.getElementById('ff-iframe').contentWindow.document.querySelector("#accordion-body-" + dept_indx).querySelector("#depRelationShip"), sp_rel_conv); jsonObject.ee_DEPT_info.Child.is_entered = "T"; dept_indx++; } } else { child_ct = jsonObject.ee_DEPT_info.Child.FIRST_NAME.split("|").length; for (i = 0; i < child_ct + 1; i++) { for (var keyv in dept_dic) { var itemv = dept_dic[keyv]; if (itemv != '' && jsonObject.ee_DEPT_info.Child[keyv] != '') { var tgt_elv = document.getElementById('ff-iframe').contentWindow.document.getElementById(itemv.replace('0', dept_indx)); if (tgt_elv != null) { if (itemv == "depDateofBirth" + dept_indx) { g_dohcs = new Date(jsonObject.ee_DEPT_info.Child[keyv].split("|")[i]); input_refresh_el(tgt_elv, getFormattedDate(g_dohcs)); } else { input_refresh_el(tgt_elv, jsonObject.ee_DEPT_info.Child[keyv].split("|")[i]); }; }; }; }; var sex_v = jsonObject.ee_DEPT_info.Child['GENDER'].split("|")[i]; if (sex_v != null) { if (sex_v == 'F' || sex_v == 'Female') { sex_v = 'F' } else if (sex_v == 'M' || sex_v == 'Male') { sex_v = 'M' }; } if (document.getElementById('ff-iframe').contentWindow.document.getElementById('depGender' + dept_indx) != null) { input_refresh_el(document.getElementById('ff-iframe').contentWindow.document.getElementById('depGender' + dept_indx), sex_v); } if (document.getElementById('ff-iframe').contentWindow.document.querySelector("#accordion-body-" + dept_indx).querySelector("#depRelationShip") != null) { const sp_rel = jsonObject.ee_DEPT_info.Child['RELATION'].split("|")[i]; if (sp_rel==''){ sp_rel='Child'}; const sp_rel_conv=get_rel(sp_rel); input_refresh_el(document.getElementById('ff-iframe').contentWindow.document.querySelector("#accordion-body-" + dept_indx).querySelector("#depRelationShip"), sp_rel_conv); } dept_indx++; if (i == 0) { jsonObject.ee_DEPT_info.Child.is_entered = "T" } else { jsonObject.ee_DEPT_info.Child.is_entered = jsonObject.ee_DEPT_info.Child.is_entered + "|" + "T"; } } }; }; } } else { if (document.getElementById('ff-iframe').contentWindow.document.getElementById("employeeId") != null && document.getElementById('ff-iframe').contentWindow.document.getElementById('content-section-wrap-dependent') == null) { const dic = { "FIRST_NAME": "firstName", "MIDDLE_NAME": "middleInitial", "LAST_NAME": "lastName", "SSN": "employeeId", "DOB": "dateOfBirth", "DATE_OF_HIRE": "dateOfHire", "ADD1": "addressLineOne", "ADD2": "addressLineTwo", "ADDSTATE": "addressState", "ADDCITY": "addressCity", "ADDZIP": "addressZipCode", "HOMEPHONE": "addressHomePhone", "WORKPHONE": "addressWorkPhone", "PERSONAL_EMAIL": "addressEmailAddress", "WORK_EMAIL": "addressEmailAddress", }; var ss_id = jsonObject.ee_BASIC_info.SSN; var ss = document.getElementById('ff-iframe').contentWindow.document.getElementById('employeeId'); ss.dispatchEvent(new Event('focusin')); ss.value = ss_id; ss.dispatchEvent(new Event('change')); ss.dispatchEvent(new Event('blur')); for (var keyv in dic) { var itemv = dic[keyv]; if (itemv != '') { var el = document.getElementById('ff-iframe').contentWindow.document.getElementById(itemv); if (el != null) { if (itemv == "dateOfBirth" || itemv == "dateOfHire") { g_doh = new Date(jsonObject.ee_BASIC_info[keyv]); input_refresh_el(el, getFormattedDate(g_doh)); } else if (itemv == "addressHomePhone" || itemv == "addressWorkPhone") { if (jsonObject.ee_BASIC_info[keyv]) { input_refresh_el(el, jsonObject.ee_BASIC_info[keyv].replace(/[^\d,.]+/g, '')) }; } else { if (jsonObject.ee_BASIC_info[keyv] != '') { input_refresh_el(el, jsonObject.ee_BASIC_info[keyv]); } }; }; }; }; var sex_v = jsonObject.ee_BASIC_info['GENDER']; if (sex_v == 'F' || sex_v == 'Female') { sex_v = 'F' } else if (sex_v == 'M' || sex_v == 'Male') { sex_v = 'M' }; input_refresh_el(document.getElementById('ff-iframe').contentWindow.document.getElementById('gender'), sex_v); var state_v = get_short_state(jsonObject.ee_BASIC_info['ADDSTATE']); if (state_v) { input_refresh_el(document.getElementById('ff-iframe').contentWindow.document.getElementById('addressState'), state_v); }; }; if (document.getElementById('ff-iframe').contentWindow.document.getElementById('content-section-wrap-dependent') != null) { dept_dic = { "FIRST_NAME": "depFirstName", "MIDDLE_NAME": "depMiddleInitial", "LAST_NAME": "depLastName", "DOB": "depDateofBirth", "SSN": "depSsn", }; var dept_indx = 0; if (jsonObject.ee_DEPT_info.Spouse.FIRST_NAME != "") { for (var key in dept_dic) { var itemv = dept_dic[key]; var tgt_elv = document.getElementById('ff-iframe').contentWindow.document.getElementById(itemv + dept_indx); if (tgt_elv != null) { if (itemv == "depDateofBirth") { g_doh = new Date(jsonObject.ee_DEPT_info.Spouse[key]); input_refresh_el(tgt_elv, getFormattedDate(g_doh)); } else { input_refresh_el(tgt_elv, jsonObject.ee_DEPT_info.Spouse[key]); }; }; }; var sex_v = jsonObject.ee_DEPT_info.Spouse['GENDER']; if (sex_v == 'F' || sex_v == 'Female') { sex_v = 'F' } else if (sex_v == 'M' || sex_v == 'Male') { sex_v = 'M' }; input_refresh_el(document.getElementById('ff-iframe').contentWindow.document.getElementById('depGender' + dept_indx), sex_v); const sp_rel = jsonObject.ee_DEPT_info.Spouse['RELATION']; if (sp_rel==''){ sp_rel='Spouse'}; const sp_rel_conv=get_rel(sp_rel); input_refresh_el(document.getElementById('ff-iframe').contentWindow.document.getElementById('depRelationShip' + dept_indx), sp_rel_conv); jsonObject.ee_DEPT_info.Spouse.is_entered = "T"; dept_indx++; } if (jsonObject.ee_DEPT_info.Child.FIRST_NAME != "") { if (jsonObject.ee_DEPT_info.Child.FIRST_NAME.includes('|') == false) { if (jsonObject.ee_DEPT_info.Child.is_entered != "T") { for (var keyv in dept_dic) { var itemv = dept_dic[keyv]; if (itemv != '' && jsonObject.ee_DEPT_info.Child[keyv] != "") { var tgt_elv = document.getElementById('ff-iframe').contentWindow.document.getElementById(itemv + dept_indx); if (tgt_elv != null) { if (itemv == "depDateofBirth") { g_dohs = new Date(jsonObject.ee_DEPT_info.Child[keyv]); input_refresh_el(tgt_elv, getFormattedDate(g_dohs)); } else { input_refresh_el(tgt_elv, jsonObject.ee_DEPT_info.Child[keyv]); }; }; }; }; var sex_v = jsonObject.ee_DEPT_info.Child['GENDER']; if (sex_v == 'F' || sex_v == 'Female') { sex_v = 'F' } else if (sex_v == 'M' || sex_v == 'Male') { sex_v = 'M' }; input_refresh_el(document.getElementById('ff-iframe').contentWindow.document.getElementById('depGender' + dept_indx), sex_v); const sp_rel = jsonObject.ee_DEPT_info.Child['RELATION']; if (sp_rel==''){ sp_rel='Child'}; const sp_rel_conv=get_rel(sp_rel); input_refresh_el(document.getElementById('ff-iframe').contentWindow.document.getElementById('depRelationShip' + dept_indx), sp_rel_conv); jsonObject.ee_DEPT_info.Child.is_entered = "T"; dept_indx++; } } else { child_ct = jsonObject.ee_DEPT_info.Child.FIRST_NAME.split("|").length; for (i = 0; i < child_ct + 1; i++) { for (var keyv in dept_dic) { var itemv = dept_dic[keyv]; if (itemv != '' && jsonObject.ee_DEPT_info.Child[keyv] != '') { var tgt_elv = document.getElementById('ff-iframe').contentWindow.document.getElementById(itemv + dept_indx); if (tgt_elv != null) { if (itemv == "depDateofBirth") { g_dohcs = new Date(jsonObject.ee_DEPT_info.Child[keyv].split("|")[i]); input_refresh_el(tgt_elv, getFormattedDate(g_dohcs)); } else { input_refresh_el(tgt_elv, jsonObject.ee_DEPT_info.Child[keyv].split("|")[i]); }; }; }; }; var sex_v = jsonObject.ee_DEPT_info.Child['GENDER'].split("|")[i]; if (sex_v != null) { if (sex_v == 'F' || sex_v == 'Female') { sex_v = 'F' } else if (sex_v == 'M' || sex_v == 'Male') { sex_v = 'M' }; } if (document.getElementById('ff-iframe').contentWindow.document.getElementById('depGender' + dept_indx) != null) { input_refresh_el(document.getElementById('ff-iframe').contentWindow.document.getElementById('depGender' + dept_indx), sex_v); } if (document.getElementById('ff-iframe').contentWindow.document.getElementById('depRelationShip' + dept_indx) != null) { const sp_rel = jsonObject.ee_DEPT_info.Child['RELATION'].split("|")[i]; if (sp_rel==''){ sp_rel='Child'}; const sp_rel_conv=get_rel(sp_rel); input_refresh_el(document.getElementById('ff-iframe').contentWindow.document.getElementById('depRelationShip' + dept_indx), sp_rel_conv); } dept_indx++; if (i == 0) { jsonObject.ee_DEPT_info.Child.is_entered = "T" } else { jsonObject.ee_DEPT_info.Child.is_entered = jsonObject.ee_DEPT_info.Child.is_entered + "|" + "T"; } } }; }; }; } };if (document.domain.includes("uhcservices.com")) { function delay(n) { return new Promise(function(resolve) { setTimeout(resolve, n * 50); }); }; function input_refresh_el(tgt_elg, val) { tgt_elg.dispatchEvent(new Event('focus')); tgt_elg.value = val; tgt_elg.dispatchEvent(new Event('change')); tgt_elg.dispatchEvent(new Event('blur')); }; if (document.querySelector("#ctl00_ContentBlock_Main_txtSocialSecurityNo") != null) { input_refresh_el(document.querySelector("#ctl00_ContentBlock_Main_txtSocialSecurityNo"), jsonObject.ee_BASIC_info.SSN); let EE_ssn = jsonObject.ee_BASIC_info.SSN; if (EE_ssn != '') { EE_ssn = EE_ssn.replace(/[^\d]+/g, ''); EE_ssn = EE_ssn.substring(0, 3) + '-' + EE_ssn.substring(3, 5) + '-' + EE_ssn.substring(5); input_refresh_el(document.getElementById('ctl00_ContentBlock_Main_txtSocialSecurityNo'), EE_ssn); }; }; if (document.querySelector('#ctl00_ContentBlock_Main_ucBeneficiaryForm_txtQualEventDate') != null) { const dic = { "TERM_DATE": "ctl00_ContentBlock_Main_ucBeneficiaryForm_txtQualEventDate", "ID": "ctl00_ContentBlock_Main_ucBeneficiaryForm_txtEmployeeID", "FIRST_NAME": "ctl00_ContentBlock_Main_ucBeneficiaryForm_txtFirstName", "MIDDLE_NAME": "ctl00_ContentBlock_Main_ucBeneficiaryForm_txtMiddleInitial", "LAST_NAME": "ctl00_ContentBlock_Main_ucBeneficiaryForm_txtLastName", "ADD1": "ctl00_ContentBlock_Main_ucBeneficiaryForm_txtStreetAddress", "ADD2": "ctl00_ContentBlock_Main_ucBeneficiaryForm_txtStreetAddress2", "ADDCITY": "ctl00_ContentBlock_Main_ucBeneficiaryForm_txtCity", "ADDZIP": "ctl00_ContentBlock_Main_ucBeneficiaryForm_txtZip", "DOB": "ctl00_ContentBlock_Main_ucBeneficiaryForm_txtDOB", "PERSONAL_EMAIL": "ctl00_ContentBlock_Main_ucBeneficiaryForm_txtEmail", "HOMEPHONE": "ctl00_ContentBlock_Main_ucBeneficiaryForm_txtPhone", "ADDSTATE": "ctl00_ContentBlock_Main_ucBeneficiaryForm_cboStateProvince" }; for (var keyv in dic) { var itemv = dic[keyv]; var el = document.getElementById(itemv); if (el != null) { if (keyv == 'ADDSTATE') { input_refresh_el(el, get_short_state(jsonObject.ee_BASIC_info[keyv])); } else { input_refresh_el(el, jsonObject.ee_BASIC_info[keyv]); } } } var sex_v = jsonObject.ee_BASIC_info.GENDER; if (sex_v == 'F' || sex_v == 'Female') { document.querySelector("#ctl00_ContentBlock_Main_ucBeneficiaryForm_rlstGender_1").click() } else if (sex_v == 'M' || sex_v == 'Male') { document.querySelector("#ctl00_ContentBlock_Main_ucBeneficiaryForm_rlstGender_0").click() }; } if (document.getElementById("ctl00_ContentBlock_Main_ucDependentEdit_txtDependentSSN") != null) { function input_sp(sp_obj, sp_type) { dept_dic = { "SSN": "ctl00_ContentBlock_Main_ucDependentEdit_txtDependentSSN", "FIRST_NAME": "ctl00_ContentBlock_Main_ucDependentEdit_txtMiddleInitial", "MIDDLE_NAME": "ctl00_ContentBlock_Main_ucDependentEdit_txtLastName", "LAST_NAME": "ctl00_ContentBlock_Main_ucDependentEdit_txtStreetAddress", "DOB": "ctl00_ContentBlock_Main_ucDependentEdit_txtEmail", "PERSONAL_EMAIL": "ctl00_ContentBlock_Main_ucDependentEdit_txtPhone" }; op = { "CHD": "Child", "DAU": "Daughter", "DOM": "Domestic Partner", "OTH": "Other", "SON": "Son", "SPO": "Spouse", "STU": "Student", }; for (var key in dept_dic) { var itemv = dept_dic[key]; var tgt_elv = document.getElementById(itemv); if (tgt_elv != null) { input_refresh_el(tgt_elv, sp_obj[key]); }; }; var sex_v = sp_obj['GENDER']; if (sex_v == 'F' || sex_v == 'Female') { document.querySelector("#ctl00_ContentBlock_Main_ucDependentEdit_rlstGender_1").click(); } else if (sex_v == 'M' || sex_v == 'Male') { document.querySelector("#ctl00_ContentBlock_Main_ucDependentEdit_rlstGender_0").click(); }; const rel_el = document.querySelector("#ctl00_ContentBlock_Main_ucDependentEdit_cboRelationshipCode"); const rel = sp_obj['RELATION']; if (Object.values(op).includes(rel)) { rel_op = Object.keys(op).find(k => op[k] === rel); } else { rel_op = sp_type; } input_refresh_el(rel_el, rel_op); }; if (jsonObject.ee_DEPT_info.Spouse.FIRST_NAME != "" && jsonObject.ee_DEPT_info.Spouse.is_entered == "") { input_sp(jsonObject.ee_DEPT_info.Spouse, "SP"); jsonObject.ee_DEPT_info.Spouse.is_entered = "T"; } else if (jsonObject.ee_DEPT_info.Child.FIRST_NAME != "") { if (jsonObject.ee_DEPT_info.Child.FIRST_NAME.includes('|') == false) { if (jsonObject.ee_DEPT_info.Child.is_entered != "T") { input_sp(jsonObject.ee_DEPT_info.Child, "CH"); jsonObject.ee_DEPT_info.Child.is_entered = "T"; } } else { child_ct = jsonObject.ee_DEPT_info.Child.FIRST_NAME.split("|").length; if (jsonObject.ee_DEPT_info.Child.is_entered == "") { child_entered_ct = 0 } else { child_entered_ct = jsonObject.ee_DEPT_info.Child.is_entered.split("|").length; }; if (child_entered_ct <= child_ct) { dept_dic = { "SSN": "ctl00_ContentBlock_Main_ucDependentEdit_txtDependentSSN", "FIRST_NAME": "ctl00_ContentBlock_Main_ucDependentEdit_txtFirstName", "MIDDLE_NAME": "ctl00_ContentBlock_Main_ucDependentEdit_txtMiddleInitial", "LAST_NAME": "ctl00_ContentBlock_Main_ucDependentEdit_txtLastName", "DOB": "ctl00_ContentBlock_Main_ucDependentEdit_txtDOB", }; op = { "CHD": "Child", "DAU": "Daughter", "DOM": "Domestic Partner", "OTH": "Other", "SON": "Son", "SPo": "Spouse", "STU": "Student", }; for (var key in dept_dic) { var itemv = dept_dic[key]; var tgt_elv = document.getElementById(itemv); if (tgt_elv != null) { input_refresh_el(tgt_elv, jsonObject.ee_DEPT_info.Child[key].split("|")[child_entered_ct]); }; }; var sex_v = jsonObject.ee_DEPT_info.Child['GENDER'].split("|")[child_entered_ct]; if (sex_v == 'F' || sex_v == 'Female') { document.querySelector("#ctl00_ContentBlock_Main_ucDependentEdit_rlstGender_1").click(); } else if (sex_v == 'M' || sex_v == 'Male') { document.querySelector("#ctl00_ContentBlock_Main_ucDependentEdit_rlstGender_0").click(); }; const rel_el = document.querySelector("#ctl00_ContentBlock_Main_ucDependentEdit_cboRelationshipCode"); const rel = jsonObject.ee_DEPT_info.Child['RELATION'].split("|")[child_entered_ct]; if (Object.values(op).includes(rel)) { rel_op = Object.keys(op).find(k => op[k] === rel); } else { rel_op = "CHD"; } input_refresh_el(rel_el, rel_op); if (child_entered_ct == 0) { jsonObject.ee_DEPT_info.Child.is_entered = "T"; } else { jsonObject.ee_DEPT_info.Child.is_entered = jsonObject.ee_DEPT_info.Child.is_entered + "|" + "T"; } } }; }; } }if (document.domain == 'services.unum.com') { const s_name = { "MyMemberDemographicData_txtN_FST": "FIRST_NAME", "MyMemberDemographicData_txtN_MID": "MIDDLE_NAME", "MyMemberDemographicData_txtN_LST": "LAST_NAME" }; const s_bsinfo = { "MyMemberDemographicData_txtI_MBR": "SSN", "MyMemberDemographicData_txtD_BTH": "DOB", "MyMemberDemographicData_ddC_GDR": "GENDER" }; const s_emptype = { "MyMemberAdditionType_txtD_HRE_EMY": "DATE_OF_HIRE" }; const s_Add = { "MyAddressInfoControl_txtS_LIN_FST": "ADD1", "MyAddressInfoControl_txtS_LIN_SEC": "ADD2", "MyAddressInfoControl_txtN_CTY": "ADDCITY", "MyAddressInfoControl_txtC_PSA": "ADDZIP", "MyAddressInfoControl_ddC_JRD": "ADDSTATE" }; const s_dept = { "MyMemberDependentInfo_DependentDetail_N_FST_DEP": "FIRST_NAME", "MyMemberDependentInfo_DependentDetail_N_MID_DEP": "MIDDLE_NAME", "MyMemberDependentInfo_DependentDetail_N_LST_DEP": "LAST_NAME", "MyMemberDependentInfo_DependentDetail_D_BTH_DEP": "DOB", "MyMemberDependentInfo_DependentDetail_ddlGender": "GENDER", "MyMemberDependentInfo_DependentDetail_D_EFF_CHG": "ELIG_DATE", }; const s_earn = { "MyMemberSalary_txtSalaryAmount": "ANNUAL_SALARY", "MyMemberSalary_txtSalaryAmount": "ANNUAL_SALARY" }; const section_list = { 'Name': s_name, 'Basic Information': s_bsinfo, 'Employment Date': s_emptype, 'Address': s_Add, 'Earnings': s_earn }; var allPageTags = document.getElementsByTagName("strong"); for (var i = 0; i < allPageTags.length; i++) { var section_name = allPageTags[i].textContent.trim(); if (section_name in section_list) { var inputs = allPageTags[i].parentElement.nextElementSibling.querySelectorAll("input"); for (var o = 0; o < inputs.length; o++) { for (let key in section_list[section_name]) { if (section_list[section_name][key] == 'ADDSTATE') { var ADDSTATE_v = jsonObject.ee_BASIC_info['ADDSTATE']; input_refresh(key, get_short_state(ADDSTATE_v)); } else if (section_list[section_name][key] == 'GENDER') { var sex_v = jsonObject.ee_BASIC_info['GENDER']; if (sex_v == 'F' || sex_v == 'Female') { sex_v = 'F' } else if (sex_v == 'M' || sex_v == 'Male') { sex_v = 'M' }; input_refresh(key, sex_v); } else { input_refresh(key, jsonObject.ee_BASIC_info[section_list[section_name][key]]); } } break } } else if (section_name == 'Dental Dependents') { var inputs = allPageTags[i].parentElement.nextElementSibling.querySelectorAll("input"); if (inputs.length > 1) { function input_sp(inputs, obj) { for (let key in s_dept) { if (s_dept[key] == 'GENDER') { var sex_v = obj['GENDER']; if (sex_v == 'F' || sex_v == 'Female') { sex_v = 'F' } else if (sex_v == 'M' || sex_v == 'Male') { sex_v = 'M' }; input_refresh(key, sex_v); } else if (s_dept[key] == 'ELIG_DATE') { var elg_v = jsonObject.ee_BASIC_info['ELIG_DATE']; input_refresh(key, get_short_state(elg_v)); } else { input_refresh(key, obj[s_dept[key]]); } } if (obj['GENDER'] == "T") { document.getElementById('MyMemberDependentInfo_DependentDetail_C_DEP_DSB').click(); } } if (jsonObject.ee_DEPT_info.Spouse.FIRST_NAME != "" && jsonObject.ee_DEPT_info.Spouse.is_entered == "") { input_sp(inputs, jsonObject.ee_DEPT_info.Spouse); input_refresh('MyMemberDependentInfo_DependentDetail_ddlRelationship', 'SP'); jsonObject.ee_DEPT_info.Spouse.is_entered = "T"; } else if (jsonObject.ee_DEPT_info.Child.FIRST_NAME != "") { if (jsonObject.ee_DEPT_info.Child.FIRST_NAME.includes('|') == false) { if (jsonObject.ee_DEPT_info.Child.is_entered != "T") { input_sp(inputs, jsonObject.ee_DEPT_info.Child); var sex_v = jsonObject.ee_DEPT_info.Child['GENDER']; if (sex_v == 'F' || sex_v == 'Female') { input_refresh('MyMemberDependentInfo_DependentDetail_ddlRelationship', 'D'); } else if (sex_v == 'M' || sex_v == 'Male') { input_refresh('MyMemberDependentInfo_DependentDetail_ddlRelationship', 'S'); }; jsonObject.ee_DEPT_info.Child.is_entered = "T"; } } else { child_ct = jsonObject.ee_DEPT_info.Child.FIRST_NAME.split("|").length; if (jsonObject.ee_DEPT_info.Child.is_entered == "") { child_entered_ct = 0 } else { child_entered_ct = jsonObject.ee_DEPT_info.Child.is_entered.split("|").length; }; if (child_entered_ct <= child_ct) { for (let key in s_dept) { if (s_dept[key] == 'GENDER') { var sex_v = jsonObject.ee_DEPT_info.Child['GENDER'].split("|")[child_entered_ct]; var rel = '-1'; if (sex_v == 'F' || sex_v == 'Female') { rel = "D"; sex_v = 'F'; } else if (sex_v == 'M' || sex_v == 'Male') { rel = "S"; sex_v = 'M'; }; input_refresh('MyMemberDependentInfo_DependentDetail_ddlRelationship', rel); input_refresh(key, sex_v); } else if (s_dept[key] == 'ELIG_DATE') { var elg_v = jsonObject.ee_BASIC_info['ELIG_DATE']; input_refresh(key, get_short_state(elg_v)); } else { input_refresh(key, jsonObject.ee_DEPT_info.Child[s_dept[key]].split("|")[child_entered_ct]); } } if (jsonObject.ee_DEPT_info.Child['IF_DISABLED'].split("|")[child_entered_ct] == "T") { document.getElementById('MyMemberDependentInfo_DependentDetail_C_DEP_DSB').click(); } if (child_entered_ct == 0) { jsonObject.ee_DEPT_info.Child.is_entered = "T"; } else { jsonObject.ee_DEPT_info.Child.is_entered = jsonObject.ee_DEPT_info.Child.is_entered + "|" + "T"; } } } } } } else if (section_name == 'Earnings') { var ear_mode = jsonObject.ee_BASIC_info['PAY_PERIOD']; var ANNUAL_SALARY = jsonObject.ee_BASIC_info['ANNUAL_SALARY']; if (ear_mode == 'ANNUAL' || ANNUAL_SALARY != '') { input_refresh('MyMemberSalary_txtSalaryAmount', ANNUAL_SALARY); } else { if (jsonObject.ee_BASIC_info.HOUR_PER_WEEK!=''){ ann_salary = jsonObject.ee_BASIC_info.HOURLY_SALARY * jsonObject.ee_BASIC_info.HOUR_PER_WEEK * 52; }else{ ann_salary = jsonObject.ee_BASIC_info.HOURLY_SALARY * 40 * 52; }; input_refresh('MyMemberSalary_txtSalaryAmount', ann_salary); } } } }if (document.domain == "visionbenefits.vsp.com") { if (document.getElementById("emailWork") != null) { const dic = { "FIRST_NAME": "firstname", "LAST_NAME": "lastname", "PERSONAL_EMAIL": "emailHome", "WORK_EMAIL": "emailWork", "ADD1": "street", "ADDCITY": "city", "ADD2": "street2", "ADDZIP": "zip", "HOMEPHONE": "phone", "ADDSTATE": "state", }; for (var keyv in dic) { var itemv = dic[keyv]; if (itemv != '') { var tgt_elv = document.getElementById(itemv); tgt_elv.dispatchEvent(new Event('focusin')); tgt_elv.value = jsonObject.ee_BASIC_info[keyv]; tgt_elv.dispatchEvent(new Event('change')); tgt_elv.dispatchEvent(new Event('blur')); tgt_elv.dispatchEvent(new Event('focusout')); }; }; var dob = jsonObject.ee_BASIC_info['DOB']; if (dob != '') { var dob_dateObj = new Date(dob); document.getElementById('birthDate_month').value = dob_dateObj.getMonth(); document.getElementById('birthDate_day').value = dob_dateObj.getDate(); document.getElementById('birthDate_year').value = dob_dateObj.getFullYear(); }; var doe = jsonObject.ee_BASIC_info['ELIG_DATE']; if (doe != '') { var doe_dateObj = new Date(doe); document.getElementById('effDate_month').value = doe_dateObj.getMonth(); document.getElementById('effDate_day').value = doe_dateObj.getDate(); document.getElementById('effDate_year').value = doe_dateObj.getFullYear(); }; var sex_v = jsonObject.ee_BASIC_info['GENDER']; if (sex_v == 'F' || sex_v == 'Female') { sex_v = 'FEMALE' } else if (sex_v == 'M' || sex_v == 'Male') { sex_v = 'MALE' }; document.getElementById('sex').value = sex_v; var state_v = get_short_state(jsonObject.ee_BASIC_info['ADDSTATE']); if (state_v) { input_refresh('state', state_v) }; }; if (document.getElementById("manage-dependents_manageDependents_0__action") != null) { const dept_dic = { "FIRST_NAME": "manage-dependents_manageDependents_0__dependent_name_firstname", "LAST_NAME": "manage-dependents_manageDependents_0__dependent_name_lastname", "DOB": "manage-dependents_manageDependents_0__dependent_birthDate", "SSN": "manage-dependents_manageDependents_0__dependent_id", }; var vsp_dep_i = 0; function delay(n) { return new Promise(function(resolve) { setTimeout(resolve, n * 50); }); } async function vsp_dept_enter() { if (jsonObject.ee_DEPT_info.Spouse.FIRST_NAME != "") { const sp_act_k = 'manage-dependents_manageDependents_0__action'; input_refresh(sp_act_k.replace('0', vsp_dep_i), 'ADD'); await delay(1); for (var key in dept_dic) { var itemv = dept_dic[key]; if (itemv != '') { if (key == "SSN") { var tgt_elv = document.getElementById(itemv.replace('0', vsp_dep_i)); input_refresh_el(tgt_elv, jsonObject.ee_DEPT_info.Spouse[key].replace(/[^\d]+/g, '')); } else { var tgt_elv = document.getElementById(itemv.replace('0', vsp_dep_i)); input_refresh_el(tgt_elv, jsonObject.ee_DEPT_info.Spouse[key]); }; }; }; var sex_v = jsonObject.ee_DEPT_info.Spouse['GENDER']; if (sex_v == 'F' || sex_v == 'Female') { sex_v = 'FEMALE' } else if (sex_v == 'M' || sex_v == 'Male') { sex_v = 'MALE' }; const spouse_gender = 'manage-dependents_manageDependents_0__dependent_gender'; input_refresh(spouse_gender.replace('0', vsp_dep_i), sex_v); const spouse_rel = 'manage-dependents_manageDependents_0__dependent_relationship'; input_refresh(spouse_rel.replace('0', vsp_dep_i), 'SPOUSE'); const spouse_eff = 'manage-dependents_manageDependents_0__effectiveDate_value'; input_refresh(spouse_eff.replace('0', vsp_dep_i), jsonObject.ee_BASIC_info['ELIG_DATE']); jsonObject.ee_DEPT_info.Spouse.is_entered = "T"; vsp_dep_i++; }; if (jsonObject.ee_DEPT_info.Child.FIRST_NAME != "") { if (jsonObject.ee_DEPT_info.Child.FIRST_NAME.includes('|') == false) { if (jsonObject.ee_DEPT_info.Child.is_entered != "T") { const ch_act_k = 'manage-dependents_manageDependents_0__action'; input_refresh(ch_act_k.replace('0', vsp_dep_i), 'ADD'); await delay(1); for (var keyv in dept_dic) { var itemv = dept_dic[keyv]; if (itemv != '' && jsonObject.ee_DEPT_info.Child[keyv] != "") { if (keyv == "SSN") { var tgt_elv = document.getElementById(itemv.replace('0', vsp_dep_i)); input_refresh_el(tgt_elv, jsonObject.ee_DEPT_info.Child[keyv].replace(/[^\d]+/g, '')); } else { var tgt_elv = document.getElementById(itemv.replace('0', vsp_dep_i)); input_refresh_el(tgt_elv, jsonObject.ee_DEPT_info.Child[keyv]); }; }; }; var sex_v = jsonObject.ee_DEPT_info.Child['GENDER']; if (sex_v == 'F' || sex_v == 'Female') { sex_v = 'FEMALE' } else if (sex_v == 'M' || sex_v == 'Male') { sex_v = 'MALE' }; const ch_gender = 'manage-dependents_manageDependents_0__dependent_gender'; input_refresh(ch_gender.replace('0', vsp_dep_i), sex_v); const ch_rel = 'manage-dependents_manageDependents_0__dependent_relationship'; input_refresh(ch_rel.replace('0', vsp_dep_i), 'CHILD'); const ch_eff = 'manage-dependents_manageDependents_0__effectiveDate_value'; input_refresh(ch_eff.replace('0', vsp_dep_i), jsonObject.ee_BASIC_info['ELIG_DATE']); jsonObject.ee_DEPT_info.Child.is_entered = "T"; vsp_dep_i++; } } else { child_ct = jsonObject.ee_DEPT_info.Child.FIRST_NAME.split("|").length; for (var child_entered_ct = 0; child_entered_ct < child_ct; child_entered_ct++) { const chm_act_k = 'manage-dependents_manageDependents_0__action'; input_refresh(chm_act_k.replace('0', vsp_dep_i), 'ADD'); await delay(1); for (var keyv in dept_dic) { var itemv = dept_dic[keyv]; if (itemv != '' && jsonObject.ee_DEPT_info.Child[keyv] != '') { if (keyv == "SSN") { var tgt_elv = document.getElementById(itemv.replace('0', vsp_dep_i)); input_refresh_el(tgt_elv, jsonObject.ee_DEPT_info.Child[keyv].split("|")[child_entered_ct].replace(/[^\d]+/g, '')); } else { var tgt_elv = document.getElementById(itemv.replace('0', vsp_dep_i)); input_refresh_el(tgt_elv, jsonObject.ee_DEPT_info.Child[keyv].split("|")[child_entered_ct]); }; }; }; var sex_v = jsonObject.ee_DEPT_info.Child['GENDER'].split("|")[child_entered_ct]; if (sex_v == 'F' || sex_v == 'Female') { sex_v = 'FEMALE' } else if (sex_v == 'M' || sex_v == 'Male') { sex_v = 'MALE' }; const chm_gender = 'manage-dependents_manageDependents_0__dependent_gender'; input_refresh(chm_gender.replace('0', vsp_dep_i), sex_v); const chm_rel = 'manage-dependents_manageDependents_0__dependent_relationship'; input_refresh(chm_rel.replace('0', vsp_dep_i), 'CHILD'); const chm_eff = 'manage-dependents_manageDependents_0__effectiveDate_value'; input_refresh(chm_eff.replace('0', vsp_dep_i), jsonObject.ee_BASIC_info['ELIG_DATE']); if (child_entered_ct == 0) { jsonObject.ee_DEPT_info.Child.is_entered = "T"; } else { jsonObject.ee_DEPT_info.Child.is_entered = jsonObject.ee_DEPT_info.Child.is_entered + "|" + "T"; }; vsp_dep_i++ } }; }; }; vsp_dept_enter(); } };if (document.domain == "cobrapoint.benaissance.com") { function delay(n) { return new Promise(function(resolve) { setTimeout(resolve, n * 50); }); }; function input_refresh_el(tgt_elg, val) { tgt_elg.dispatchEvent(new Event('focus')); tgt_elg.value = val; tgt_elg.dispatchEvent(new Event('input')); tgt_elg.dispatchEvent(new Event('blur')); }; if (document.querySelector("#ddlDivisions") != null) { const dic = { "FIRST_NAME": "txtFirstName", "MIDDLE_NAME": "txtMiddleInitial", "LAST_NAME": "txtLastName", "DOB": "txtDateOfBirth", "SSN": "txtSSN", "HOMEPHONE": "txtPhone1", "WORKPHONE": "txtPhone2", "PERSONAL_EMAIL": "txtEmail", "ADD1": "txtAddress1", "ADD2": "txtAddress2", "ADDCITY": "txtCity", "ADDSTATE": "txtState", "ADDZIP": "txtZipcode" }; for (var keyv in dic) { var itemv = dic[keyv]; if (itemv != '') { var el = document.querySelector('#' + itemv); if (el != null) { if (keyv == "DOB") { g_doh = new Date(jsonObject.ee_BASIC_info[keyv]); input_refresh_el(el, getFormattedDate(g_doh)); } else if (keyv == 'SSN' || keyv == 'HOMEPHONE'|| keyv == 'WORKPHONE') { input_refresh_el(el, jsonObject.ee_BASIC_info[keyv].replace(/[^\d]+/g, '')); } else if (keyv == 'ADDSTATE') { input_refresh_el(el, get_short_state(jsonObject.ee_BASIC_info[keyv])); } else { input_refresh_el(el, jsonObject.ee_BASIC_info[keyv]); }; }; }; }; async function input_gender(){ var sex_v = jsonObject.ee_BASIC_info['GENDER']; document.getElementById('ddlGender').click(); await delay(1); if (sex_v == 'F' || sex_v == 'Female') { var gd = "Female"; } else if (sex_v == 'M' || sex_v == 'Male') { var gd = "Male"; }; var genderOption = [...document.querySelectorAll('mat-option')].find(option => option.textContent.trim() == gd); genderOption && genderOption.click(); }; input_gender(); }; };if (document.domain == 'netsecure.infinisource.com') { if (document.getElementById("content_New_submitASPxCallbackPanel_qeEditor_qeASPxCallbackPanel_qeASPxFormLayout_firstName_I") != null) { const dic = { "FIRST_NAME": "content_New_submitASPxCallbackPanel_qeEditor_qeASPxCallbackPanel_qeASPxFormLayout_firstName_I", "LAST_NAME": "content_New_submitASPxCallbackPanel_qeEditor_qeASPxCallbackPanel_qeASPxFormLayout_lastName_I", "DOB": "content_New_submitASPxCallbackPanel_qeEditor_qeASPxCallbackPanel_qeASPxFormLayout_dob_I", "TERM_DATE": "content_New_submitASPxCallbackPanel_qeEditor_qeASPxCallbackPanel_qeASPxFormLayout_eventDate_I", "SSN": "content_New_submitASPxCallbackPanel_qeEditor_qeASPxCallbackPanel_qeASPxFormLayout_ssn_I", "ADD1": "content_New_submitASPxCallbackPanel_qbASPxCallbackPanel_qbTabControl_tabControlASPxCallbackPanel_TabPageUID0_qbProcessASPxCallbackPanel_qbASPxFormLayout_address1_I", "ADD2": "content_New_submitASPxCallbackPanel_qbASPxCallbackPanel_qbTabControl_tabControlASPxCallbackPanel_TabPageUID0_qbProcessASPxCallbackPanel_qbASPxFormLayout_address2_It", "ADDSTATE": "content_New_submitASPxCallbackPanel_qbASPxCallbackPanel_qbTabControl_tabControlASPxCallbackPanel_TabPageUID0_qbProcessASPxCallbackPanel_qbASPxFormLayout_states_I", "ADDCITY": "content_New_submitASPxCallbackPanel_qbASPxCallbackPanel_qbTabControl_tabControlASPxCallbackPanel_TabPageUID0_qbProcessASPxCallbackPanel_qbASPxFormLayout_city_I", "ADDZIP": "content_New_submitASPxCallbackPanel_qbASPxCallbackPanel_qbTabControl_tabControlASPxCallbackPanel_TabPageUID0_qbProcessASPxCallbackPanel_qbASPxFormLayout_zipCode_I", "HOMEPHONE": "content_New_submitASPxCallbackPanel_qbASPxCallbackPanel_qbTabControl_tabControlASPxCallbackPanel_TabPageUID0_qbProcessASPxCallbackPanel_qbASPxFormLayout_phone_I", "PERSONAL_EMAIL": "content_New_submitASPxCallbackPanel_qbASPxCallbackPanel_qbTabControl_tabControlASPxCallbackPanel_TabPageUID0_qbProcessASPxCallbackPanel_qbASPxFormLayout_email_I", }; for (var keyv in dic) { if (jsonObject.ee_BASIC_info[keyv] != '') { var itemv = dic[keyv]; if (itemv != '') { var el = document.getElementById(itemv); if (el != null) { if (keyv == "DOB" || keyv == "DATE_OF_HIRE" || keyv == "ELIG_DATE") { g_doh = new Date(jsonObject.ee_BASIC_info[keyv]); focus_input(el, getFormattedDate(g_doh)); } else if (keyv == 'SSN') { var ssnnum = jsonObject.ee_BASIC_info[keyv].replace(/[^\d]+/g, ''); focus_input(el, ssnnum.substr(0, 3) + '-' + ssnnum.substr(3, 2) + '-' + ssnnum.substr(5, 4)); } else if (keyv == 'ADDSTATE') { var full_state = get_full_state(jsonObject.ee_BASIC_info[keyv]); focus_input(el, full_state); } else if (keyv == 'ID') { var e_id = jsonObject.ee_BASIC_info[keyv].replace(/[^\d]+/g, ''); focus_input(el, e_id); } else if (keyv == 'HOMEPHONE') { var pnum = jsonObject.ee_BASIC_info[keyv].replace(/[^\d]+/g, ''); focus_input(el, pnum.substr(0, 3) + '-' + pnum.substr(3, 3) + '-' + pnum.substr(6, 4)); } else { focus_input(el, jsonObject.ee_BASIC_info[keyv]); }; }; }; }; } var sex_v = jsonObject.ee_BASIC_info['GENDER']; if (sex_v == 'F' || sex_v == 'Female') { var sex_s = 'FEMALE'; } else if (sex_v == 'M' || sex_v == 'Male') { var sex_s = 'MALE'; }; focus_input('content_New_submitASPxCallbackPanel_qbASPxCallbackPanel_qbTabControl_tabControlASPxCallbackPanel_TabPageUID0_qbProcessASPxCallbackPanel_qbASPxFormLayout_genderEdit_I', sex_s); focus_input('content_New_submitASPxCallbackPanel_qeEditor_qeASPxCallbackPanel_qeASPxFormLayout_events_I', 'Termination of Employment'); }; function delay(n) { return new Promise(function(resolve) { setTimeout(resolve, n * 300); }); }; async function add_dept() { async function myAsyncFunction() { document.querySelector("#content_New_submitASPxCallbackPanel_qbASPxCallbackPanel_qbTabControl_tabControlASPxCallbackPanel_actionButtonsMenu_DXI0_T").click(); await delay(5); }; myAsyncFunction(); }; async function entry_dept() { await delay(2); var dept_indx = 1; dept_dic = { "FIRST_NAME": "content_New_submitASPxCallbackPanel_qbASPxCallbackPanel_qbTabControl_tabControlASPxCallbackPanel_TabPageUIDdept_indx_qbProcessASPxCallbackPanel_qbASPxFormLayout_qbFirstName_I", "LAST_NAME": "content_New_submitASPxCallbackPanel_qbASPxCallbackPanel_qbTabControl_tabControlASPxCallbackPanel_TabPageUIDdept_indx_qbProcessASPxCallbackPanel_qbASPxFormLayout_qbLastName_I", "DOB": "content_New_submitASPxCallbackPanel_qbASPxCallbackPanel_qbTabControl_tabControlASPxCallbackPanel_TabPageUIDdept_indx_qbProcessASPxCallbackPanel_qbASPxFormLayout_dob_I", "SSN": "content_New_submitASPxCallbackPanel_qbASPxCallbackPanel_qbTabControl_tabControlASPxCallbackPanel_TabPageUIDdept_indx_qbProcessASPxCallbackPanel_qbASPxFormLayout_ssn_I" }; console.log('now start entry dept ' + dept_indx); if (jsonObject.ee_DEPT_info.Spouse.FIRST_NAME != "" && jsonObject.ee_DEPT_info.Spouse.is_entered == "") { await add_dept(); await delay(8); for (key in dept_dic) { var el_id = dept_dic[key].replace('dept_indx', dept_indx); if (jsonObject.ee_DEPT_info.Spouse[key] != "" && document.getElementById(el_id) != null) { if (key == "DOB") { g_doh = new Date(jsonObject.ee_DEPT_info.Spouse[key]); focus_input(document.getElementById(el_id), getFormattedDate(g_doh)); } else if (key == 'SSN') { var ssnnum = jsonObject.ee_DEPT_info.Spouse[key].replace(/[^\d]+/g, ''); focus_input(document.getElementById(el_id), ssnnum.substr(0, 3) + '-' + ssnnum.substr(3, 2) + '-' + ssnnum.substr(5, 4)); } else { focus_input(document.getElementById(el_id), jsonObject.ee_DEPT_info.Spouse[key]); }; } }; var sex_v = jsonObject.ee_DEPT_info.Spouse.GENDER; if (sex_v == 'F' || sex_v == 'Female') { var sex_s = 'FEMALE'; } else if (sex_v == 'M' || sex_v == 'Male') { var sex_s = 'MALE'; }; focus_input("content_New_submitASPxCallbackPanel_qbASPxCallbackPanel_qbTabControl_tabControlASPxCallbackPanel_TabPageUID" + dept_indx + "_qbProcessASPxCallbackPanel_qbASPxFormLayout_genderEdit_I", sex_s); focus_input("content_New_submitASPxCallbackPanel_qbASPxCallbackPanel_qbTabControl_tabControlASPxCallbackPanel_TabPageUID" + dept_indx + "_qbProcessASPxCallbackPanel_qbASPxFormLayout_relationship_I", 'Spouse'); jsonObject.ee_DEPT_info.Spouse.is_entered = "T"; dept_indx++; }; if (jsonObject.ee_DEPT_info.Child.FIRST_NAME != "" && jsonObject.ee_DEPT_info.Child.is_entered == "") { if (jsonObject.ee_DEPT_info.Child.FIRST_NAME.includes('|') == false) { if (jsonObject.ee_DEPT_info.Child.is_entered != "T") { await add_dept(); await delay(5); for (key in dept_dic) { var el_id = dept_dic[key].replace('dept_indx', dept_indx); if (jsonObject.ee_DEPT_info.Child[key] != "" && document.getElementById(el_id) != null) { if (key == "DOB") { g_doh = new Date(jsonObject.ee_DEPT_info.Child[key]); focus_input(document.getElementById(el_id), getFormattedDate(g_doh)); } else if (key == 'SSN') { var ssnnum = jsonObject.ee_DEPT_info.Child[key].replace(/[^\d]+/g, ''); focus_input(document.getElementById(el_id), ssnnum.substr(0, 3) + '-' + ssnnum.substr(3, 2) + '-' + ssnnum.substr(5, 4)); } else { focus_input(document.getElementById(el_id), jsonObject.ee_DEPT_info.Child[key]); }; } }; var sex_v = jsonObject.ee_DEPT_info.Child.GENDER; if (sex_v == 'F' || sex_v == 'Female') { var sex_s = 'FEMALE'; } else if (sex_v == 'M' || sex_v == 'Male') { var sex_s = 'MALE'; }; focus_input("content_New_submitASPxCallbackPanel_qbASPxCallbackPanel_qbTabControl_tabControlASPxCallbackPanel_TabPageUID" + dept_indx + "_qbProcessASPxCallbackPanel_qbASPxFormLayout_genderEdit_I", sex_s); focus_input("content_New_submitASPxCallbackPanel_qbASPxCallbackPanel_qbTabControl_tabControlASPxCallbackPanel_TabPageUID" + dept_indx + "_qbProcessASPxCallbackPanel_qbASPxFormLayout_relationship_I", 'Dependent'); jsonObject.ee_DEPT_info.Child.is_entered = "T"; dep_i++; } } else { child_ct = jsonObject.ee_DEPT_info.Child.FIRST_NAME.split("|").length; for (var child_entered_ct = 0; child_entered_ct < child_ct; child_entered_ct++) { await add_dept(); await delay(5); for (key in dept_dic) { var el_id = dept_dic[key].replace('dept_indx', dept_indx); if (jsonObject.ee_DEPT_info.Child[key] != "" && document.getElementById(el_id) != null) { if (key == "DOB") { g_doh = new Date(jsonObject.ee_DEPT_info.Child[key].split("|")[child_entered_ct]); focus_input(document.getElementById(el_id), getFormattedDate(g_doh)); } else if (key == 'SSN') { var ssnnum = jsonObject.ee_DEPT_info.Child[key].split("|")[child_entered_ct].replace(/[^\d]+/g, ''); focus_input(document.getElementById(el_id), ssnnum.substr(0, 3) + '-' + ssnnum.substr(3, 2) + '-' + ssnnum.substr(5, 4)); } else { focus_input(document.getElementById(el_id), jsonObject.ee_DEPT_info.Child[key].split("|")[child_entered_ct]); }; } }; var sex_v = jsonObject.ee_DEPT_info.Child.GENDER.split("|")[child_entered_ct]; if (sex_v == 'F' || sex_v == 'Female') { var sex_s = 'FEMALE'; } else if (sex_v == 'M' || sex_v == 'Male') { var sex_s = 'MALE'; }; focus_input("content_New_submitASPxCallbackPanel_qbASPxCallbackPanel_qbTabControl_tabControlASPxCallbackPanel_TabPageUID" + dept_indx + "_qbProcessASPxCallbackPanel_qbASPxFormLayout_genderEdit_I", sex_s); focus_input("content_New_submitASPxCallbackPanel_qbASPxCallbackPanel_qbTabControl_tabControlASPxCallbackPanel_TabPageUID" + dept_indx + "_qbProcessASPxCallbackPanel_qbASPxFormLayout_relationship_I", 'Dependent'); if (child_entered_ct == 0) { jsonObject.ee_DEPT_info.Child.is_entered = "T"; } else { jsonObject.ee_DEPT_info.Child.is_entered = jsonObject.ee_DEPT_info.Child.is_entered + "|" + "T"; }; dept_indx++ } }; }; } entry_dept(); };let newClipboardString = JSON.stringify(jsonObject); navigator.clipboard.writeText(newClipboardString); });