Add quote request form to prior-year catch-up section

"Contact us" now opens an inline form that submits a ticket
to ERPNext via POST /api/v1/tickets with category "quote".
Pre-fills entity name, FRN, and overdue items from the check.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
justin 2026-04-27 07:50:17 -05:00
parent 7b9c9a48c0
commit a3028a3b51

View file

@ -119,7 +119,21 @@ import Base from "../../layouts/Base.astro";
<!-- Prior-year catch-up -->
<div id="prior-year" class="hidden bg-red-50 border border-red-200 rounded-xl p-5 text-sm text-red-800">
<p class="font-semibold mb-1">Prior-Year Catch-Up May Be Required</p>
<p>One or more filings appear overdue. In some cases prior-year filings must be completed before the current year can be filed. Contact us for a full assessment.</p>
<p>One or more filings appear overdue. In some cases prior-year filings must be completed before the current year can be filed.
<button type="button" id="btn-request-quote" style="color:#1e40af;text-decoration:underline;font-weight:600;background:none;border:none;cursor:pointer;padding:0;">Request a free assessment &rarr;</button>
</p>
<!-- Quote request form (hidden until clicked) -->
<div id="quote-form" class="hidden mt-4 bg-white border border-red-200 rounded-lg p-4">
<p class="text-xs text-gray-600 mb-3">We'll review your filings and send you a detailed assessment with pricing. No obligation.</p>
<div class="space-y-2">
<input id="quote-name" type="text" placeholder="Your name" class="w-full border border-gray-300 rounded px-3 py-2 text-sm focus:outline-none focus:ring-1 focus:ring-pw-500" />
<input id="quote-email" type="email" placeholder="Email address" class="w-full border border-gray-300 rounded px-3 py-2 text-sm focus:outline-none focus:ring-1 focus:ring-pw-500" />
<button type="button" id="btn-submit-quote" style="background:#1a2744;color:#fff;font-weight:600;padding:8px 20px;border-radius:6px;border:none;cursor:pointer;font-size:13px;width:100%;">
Request Assessment
</button>
</div>
<p id="quote-status" class="hidden mt-2 text-xs"></p>
</div>
</div>
<!-- CTA Section -->
@ -242,6 +256,77 @@ import Base from "../../layouts/Base.astro";
}
}
// --- Quote request form ---
document.getElementById("btn-request-quote")?.addEventListener("click", () => {
document.getElementById("quote-form")?.classList.remove("hidden");
});
document.getElementById("btn-submit-quote")?.addEventListener("click", async () => {
const name = (document.getElementById("quote-name") as HTMLInputElement).value.trim();
const email = (document.getElementById("quote-email") as HTMLInputElement).value.trim();
const statusEl = document.getElementById("quote-status")!;
const btn = document.getElementById("btn-submit-quote") as HTMLButtonElement;
if (!email || !email.includes("@")) {
statusEl.textContent = "Please enter a valid email address.";
statusEl.className = "mt-2 text-xs text-red-600";
statusEl.classList.remove("hidden");
return;
}
btn.disabled = true;
btn.textContent = "Submitting...";
// Build message from compliance check data
const entityName = document.getElementById("entity-name")?.textContent || "";
const frn = document.getElementById("entity-frn")?.textContent || "";
const redChecks = (lastData?.checks || [])
.filter((c: any) => c.status === "red")
.map((c: any) => `• ${c.label}: ${c.detail}`)
.join("\n");
const message = [
`Compliance assessment request from FCC Compliance Check tool.`,
``,
`Entity: ${entityName}`,
`FRN: ${frn}`,
``,
`Overdue items:`,
redChecks || "(none)",
``,
`Contact: ${name} <${email}>`,
].join("\n");
try {
const res = await fetch(`${API}/api/v1/tickets`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
category: "quote",
subject: `FCC Compliance Assessment — ${entityName || frn}`,
message,
email,
name: name || undefined,
page: window.location.href,
}),
});
if (res.ok) {
statusEl.textContent = "✓ Request submitted! We'll email you within 1 business day.";
statusEl.className = "mt-2 text-xs text-green-700";
btn.textContent = "Sent ✓";
} else {
throw new Error("Failed");
}
} catch {
statusEl.textContent = "Something went wrong. Email info@performancewest.net instead.";
statusEl.className = "mt-2 text-xs text-red-600";
btn.textContent = "Request Assessment";
btn.disabled = false;
}
statusEl.classList.remove("hidden");
});
// --- FRN compliance check ---
frnCheckBtn.addEventListener("click", runCheck);
frnInput.addEventListener("keydown", (e) => { if (e.key === "Enter") runCheck(); });