The costs listed are estimates of your monthly premium payments based on the information you've provided to this point. A real rate will be provided upon carrier approval.
`;
document.getElementById("termLengthLookup").value = `${document.getElementById('termLength').value}`;
document.getElementById("faceAmountLookup").value = `${document.getElementById('faceAmount').value}`;
let rerunQuoteButton = document.getElementById("rerunQuoteButton");
let quoteLoadAnimation = document.getElementById("quoteLoadAnimation");
rerunQuoteButton.addEventListener('click', function () {
document.getElementById('termLength').value = document.getElementById('termLengthLookup').value;
document.getElementById('faceAmount').value = document.getElementById('faceAmountLookup').value;
returnToPreviousQuestion(questionSequence.indexOf('quoteOptions'));
//quoteOptionsBody.classList.add("hidden");
//quoteLoadAnimation.classList.remove("hidden");
//quoteLoadAnimation.classList.remove('fade');
runQuote();
//displayQuotes(lookup, quotes);
});
const quoteCardGallery = document.getElementById("quoteCardGallery");
// Create a feature label card
const featureLabelContainer = document.createElement("div");
featureLabelContainer.classList.add("sticky", "left-0", "z-10");
const featureLabelCard = document.createElement("div");
featureLabelCard.classList.add("quote-card", "min-w-24", "mt-2");
featureLabelContainer.appendChild(featureLabelCard);
const priorityList = document.getElementById('priorityList');
let selectedPriorities = Array.from(priorityList.querySelectorAll('.priority-button.selected')).map(button => button.textContent.trim());
const defaultPriorities = ["Payments pause if you become disabled", "Additional coverage for children", "Return of premium if you outlive your policy"];
while (selectedPriorities.length < 3) {
const defaultPriority = defaultPriorities.find(priority => !selectedPriorities.includes(priority));
if (defaultPriority) {
selectedPriorities.push(defaultPriority);
} else {
break;
}
}
const featureLabels = ["Cost", ...selectedPriorities.map(priority => priorityToRider[priority].tag)];
featureLabelCard.innerHTML = `
Company
${featureLabels.map((label, index) => `
${label}${riderTooltipMap[label]}
`).join('')}
`;
const features = ["Cost", ...selectedPriorities.map(priority => priorityToRider[priority].tag)];
const rows = [];
const addedCompprodcodes = new Set();
quotes.forEach((quote, index) => {
if (addedCompprodcodes.has(quote.Compulife_product.trim())) {
return; // Skip this quote if its compprodcode is already added
}
addedCompprodcodes.add(quote.Compulife_product.trim());
const trimmedProductName = quote.Compulife_product.trim();
let productName = trimmedProductName;
for (const [keyword, alias] of Object.entries(productAliases)) {
if (trimmedProductName.includes(keyword)) {
productName = alias;
break;
}
}
const compCode = quote.Compulife_compprodcode.substring(0, 4);
const logoURL = companyLogoURLs[compCode];
const cost = `$${quote.Compulife_premiumM}/mo`;
const healthCategory = quote.Compulife_healthcat;
const companyName = quote.Compulife_company;
// Create singleQuoteCard for each quote
const singleQuoteCard = document.createElement("div");
singleQuoteCard.classList.add("quote-card", "min-w-32", "mt-2", "bg-white", "shadow-lg", "border-gray-200", "border-2", "flex", "flex-col", "rounded-3xl");
if (index === 0) {
quoteCardGallery.appendChild(featureLabelContainer);
}
if (index >= 3) {
singleQuoteCard.classList.add("hidden");
}
const availableRiders = compprodcodeToRiders[quote.Compulife_compprodcode] || [];
singleQuoteCard.innerHTML = `