Files
Abigail-Immigration-AI-Project/assets/script.js
2026-06-16 23:41:10 -07:00

144 lines
5.8 KiB
JavaScript

const routes = {
extraordinaryTemporary: {
title: "O-1A Extraordinary Ability",
summary:
"Best for a high-achieving founder, researcher, engineer, artist, or operator who can prove sustained acclaim.",
score: 92,
steps: ["Collect acclaim evidence", "Map facts to O-1 criteria", "Draft petition letter and expert letters"]
},
extraordinaryGreen: {
title: "EB-1A or EB-2 NIW",
summary:
"Best when the client has strong accomplishments and wants a permanent path without relying only on an employer sponsor.",
score: 88,
steps: ["Run EB-1A vs NIW matrix", "Build national importance narrative", "Prepare recommendation letter prompts"]
},
companyTemporary: {
title: "H-1B / TN / E-3 / H-1B1",
summary:
"Best when an employer can sponsor a defined specialty role and the applicant has matching credentials.",
score: 84,
steps: ["Validate role and credentials", "Collect employer documents", "Prepare LCA and petition data"]
},
managerTemporary: {
title: "L-1A / L-1B",
summary:
"Best for multinational transfers involving executives, managers, or specialized knowledge employees.",
score: 86,
steps: ["Confirm qualifying relationship", "Map foreign and U.S. duties", "Collect org charts and payroll evidence"]
},
investmentTemporary: {
title: "E-2 Treaty Investor",
summary:
"Best for founders or investors from treaty countries who have made or are making a substantial U.S. investment.",
score: 82,
steps: ["Confirm treaty nationality", "Organize investment evidence", "Draft business and source-of-funds story"]
},
aos: {
title: "Adjustment of Status Bundle",
summary:
"Best when the applicant is ready to file I-485 with related work authorization and travel documents.",
score: 79,
steps: ["Confirm priority date and eligibility", "Collect civil documents", "Prepare I-485, I-765, and I-131 data"]
},
renewal: {
title: "Extension, Amendment, or Change of Employer",
summary:
"Best when the existing immigration category is still viable but facts have changed or status needs to continue.",
score: 81,
steps: ["Compare current approval to new facts", "Identify material changes", "Refresh employer and status evidence"]
}
};
const form = document.querySelector("#intakeForm");
const routeTitle = document.querySelector("#routeTitle");
const routeSummary = document.querySelector("#routeSummary");
const fitMeter = document.querySelector("#fitMeter");
const fitScore = document.querySelector("#fitScore");
const nextSteps = document.querySelector("#nextSteps");
const packetButton = document.querySelector("#generatePacket");
function formValue(name) {
return new FormData(form).get(name);
}
function pickRoute() {
const strength = formValue("strength");
const goal = formValue("goal");
if (goal === "aos") return routes.aos;
if (goal === "renewal") return routes.renewal;
if (strength === "extraordinary" && goal === "green") return routes.extraordinaryGreen;
if (strength === "extraordinary") return routes.extraordinaryTemporary;
if (strength === "manager") return routes.managerTemporary;
if (strength === "investment") return routes.investmentTemporary;
return routes.companyTemporary;
}
function renderRoute() {
const route = pickRoute();
routeTitle.textContent = route.title;
routeSummary.textContent = route.summary;
fitScore.textContent = `${route.score}%`;
fitMeter.style.width = `${route.score}%`;
nextSteps.innerHTML = route.steps.map((step) => `<div>${step}</div>`).join("");
packetButton.textContent = "Generate case packet";
}
form.addEventListener("change", renderRoute);
renderRoute();
packetButton.addEventListener("click", () => {
packetButton.textContent = "Packet drafted for attorney review";
});
const detailCopy = {
passport: {
title: "Passport and I-94",
body: "Abigail checks name consistency, expiration dates, status history, admission class, and travel gaps.",
output: "Identity table, status timeline, and form-ready biographic data."
},
resume: {
title: "Resume and biography",
body: "The platform extracts employers, titles, education, publications, products, patents, and leadership history.",
output: "Chronology, achievement taxonomy, and role-specific narrative bullets."
},
awards: {
title: "Awards, press, publications",
body: "Abigail extracts dates, publication names, award criteria, circulation, and relevance to the proposed role.",
output: "Evidence summary, exhibit labels, expert letter talking points, and petition narrative bullets."
},
letters: {
title: "Recommendation letter inputs",
body: "Clients provide recommender context once. The AI creates letter outlines tailored to each legal criterion.",
output: "Recommender brief, draft letter structure, and conflict checks across letters."
},
company: {
title: "Company registration and job details",
body: "HR uploads company facts, role data, reporting lines, wage details, and signatory information into a reusable vault.",
output: "Employer support letter draft, role summary, org chart notes, and petition fields."
}
};
const uploadButtons = document.querySelectorAll(".upload-item");
const uploadDetail = document.querySelector("#uploadDetail");
uploadButtons.forEach((button) => {
button.addEventListener("click", () => {
uploadButtons.forEach((item) => item.classList.remove("is-active"));
button.classList.add("is-active");
const detail = detailCopy[button.dataset.doc];
uploadDetail.innerHTML = `
<p class="panel-label">Selected document</p>
<h3>${detail.title}</h3>
<p>${detail.body}</p>
<div class="draft-box">
<strong>AI draft output</strong>
<p>${detail.output}</p>
</div>
`;
});
});
document.querySelector('[data-doc="awards"]').classList.add("is-active");