diff --git a/site/public/tools/dot-compliance-check/index.html b/site/public/tools/dot-compliance-check/index.html
index b16d83f..198b479 100644
--- a/site/public/tools/dot-compliance-check/index.html
+++ b/site/public/tools/dot-compliance-check/index.html
@@ -230,6 +230,28 @@ Send reset link
html += '';
});
+ // Insurance lead capture — auto-checked if insurance issue found
+ var hasInsuranceIssue = (data.checks || []).some(function(c) {
+ return c.id === "insurance" && c.status === "red";
+ });
+
+ if (hasInsuranceIssue) {
+ html += '
';
+ html += '
';
+ html += '
';
+ }
+
// CTA
var redCount = (s.red || 0);
if (redCount > 0) {
@@ -248,6 +270,70 @@ Send reset link
resultsEl.innerHTML = html;
resultsEl.classList.remove("hidden");
+
+ // Insurance lead checkbox toggle
+ var insCheck = document.getElementById("ins-lead-check");
+ var insForm = document.getElementById("ins-lead-form");
+ if (insCheck && insForm) {
+ insCheck.addEventListener("change", function() {
+ insForm.style.display = insCheck.checked ? "block" : "none";
+ });
+ }
+
+ // Insurance lead submit
+ var insBtn = document.getElementById("ins-lead-submit");
+ if (insBtn) {
+ insBtn.addEventListener("click", function() {
+ var name = document.getElementById("ins-lead-name").value.trim();
+ var email = document.getElementById("ins-lead-email").value.trim();
+ var phone = document.getElementById("ins-lead-phone").value.trim();
+ var statusEl = document.getElementById("ins-lead-status");
+ if (!email) { statusEl.textContent = "Please enter your email."; statusEl.className = "text-xs text-red-600"; statusEl.classList.remove("hidden"); return; }
+ insBtn.disabled = true;
+ insBtn.textContent = "Submitting...";
+
+ fetch(API + "/api/v1/tickets", {
+ method: "POST",
+ headers: { "Content-Type": "application/json" },
+ body: JSON.stringify({
+ category: "insurance_lead",
+ subject: "Insurance Lead — " + data.legal_name + " (DOT " + data.dot_number + ")",
+ message: [
+ "Insurance lead from DOT Compliance Checker.",
+ "",
+ "Carrier: " + data.legal_name,
+ "DOT#: " + data.dot_number,
+ "Location: " + (data.phy_city || "") + ", " + (data.phy_state || ""),
+ "Fleet: " + (data.fleet ? data.fleet.power_units + " trucks, " + data.fleet.drivers + " drivers" : "unknown"),
+ "Phone: " + (phone || data.telephone || "not provided"),
+ "",
+ "Insurance deficiency: " + ((data.checks || []).filter(function(c) { return c.id === "insurance"; })[0] || {}).detail,
+ "",
+ "Contact: " + name,
+ "Email: " + email,
+ "Phone: " + phone,
+ ].join("\n"),
+ email: email,
+ name: name,
+ })
+ }).then(function(r) {
+ if (r.ok) {
+ statusEl.textContent = "Submitted! We'll be in touch within 1 business day.";
+ statusEl.className = "text-xs text-green-700";
+ statusEl.classList.remove("hidden");
+ insBtn.textContent = "Submitted";
+ } else {
+ throw new Error("Failed");
+ }
+ }).catch(function() {
+ statusEl.textContent = "Something went wrong. Email info@performancewest.net instead.";
+ statusEl.className = "text-xs text-red-600";
+ statusEl.classList.remove("hidden");
+ insBtn.disabled = false;
+ insBtn.textContent = "Request Insurance Quote";
+ });
+ });
+ }
}
// Auto-fill from URL