Fix: separate insurance checks by type + inline styles for visibility

API: Split "Insurance Filing" into separate checks:
- Liability Insurance (BIPD) — BMC-91/91X
- Cargo Insurance — household goods
- Broker Bond / Trust Fund — BMC-84/85 ($75K minimum)
Each has its own clear label and specific remediation detail.

Frontend: Convert CTA box, insurance lead capture, and "looking good"
box from Tailwind classes to inline styles (Tailwind classes not in
Astro compiled CSS for static public/ files).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
justin 2026-05-28 23:47:29 -05:00
parent 8e6888ff6e
commit e8f453e14b
2 changed files with 50 additions and 31 deletions

View file

@ -140,24 +140,43 @@ router.get("/api/v1/dot/lookup", async (req, res) => {
const bondRequired = carrier.bondInsuranceRequired === "Y";
const bondOnFile = carrier.bondInsuranceOnFile !== null && carrier.bondInsuranceOnFile !== "0";
const issues: string[] = [];
if (bipdRequired && !bipdOnFile) issues.push("Liability (BIPD) insurance required but not on file");
if (cargoRequired && !cargoOnFile) issues.push("Cargo insurance required but not on file");
if (bondRequired && !bondOnFile) issues.push("Bond/trust fund required but not on file");
if (issues.length > 0) {
// Check each type separately for clearer reporting
if (bipdRequired) {
checks.push({
id: "insurance",
label: "Insurance Filing",
status: "red",
detail: issues.join(". ") + ". Operating without required insurance can result in immediate out-of-service order and operating authority revocation.",
id: "insurance_bipd",
label: "Liability Insurance (BIPD)",
status: bipdOnFile ? "green" : "red",
detail: bipdOnFile
? "Bodily injury and property damage liability insurance is on file with FMCSA."
: "Liability insurance (BIPD) is REQUIRED but not on file. You cannot legally operate without this coverage. Your insurer must file a BMC-91/91X with FMCSA.",
});
} else if (bipdRequired || cargoRequired) {
}
if (cargoRequired) {
checks.push({
id: "insurance_cargo",
label: "Cargo Insurance",
status: cargoOnFile ? "green" : "red",
detail: cargoOnFile
? "Cargo insurance is on file with FMCSA."
: "Cargo insurance is REQUIRED but not on file. Required for household goods carriers. Your insurer must file proof with FMCSA.",
});
}
if (bondRequired) {
checks.push({
id: "insurance_bond",
label: "Broker Bond / Trust Fund",
status: bondOnFile ? "green" : "red",
detail: bondOnFile
? "Broker surety bond or trust fund (BMC-84/85) is on file with FMCSA."
: "Broker surety bond or trust fund (BMC-84/85) is REQUIRED but not on file. Required for freight brokers and freight forwarders. Must be at least $75,000.",
});
}
if (!bipdRequired && !cargoRequired && !bondRequired && (bipdOnFile || cargoOnFile || bondOnFile)) {
checks.push({
id: "insurance",
label: "Insurance Filing",
label: "Insurance / Financial Responsibility",
status: "green",
detail: "Required insurance is on file with FMCSA.",
detail: "Insurance filings are on file with FMCSA.",
});
}
}

View file

@ -232,22 +232,22 @@ Send reset link
// Insurance lead capture — auto-checked if insurance issue found
var hasInsuranceIssue = (data.checks || []).some(function(c) {
return c.id === "insurance" && c.status === "red";
return (c.id === "insurance" || c.id === "insurance_bipd" || c.id === "insurance_cargo" || c.id === "insurance_bond") && c.status === "red";
});
if (hasInsuranceIssue) {
html += '<div class="bg-blue-50 border-2 border-blue-300 rounded-xl p-5 mt-2">';
html += '<label class="flex items-start gap-3 cursor-pointer">';
html += '<input type="checkbox" id="ins-lead-check" checked class="mt-1 accent-blue-600 w-5 h-5">';
html += '<div style="background:#eff6ff;border:2px solid #93c5fd;border-radius:12px;padding:20px;margin-top:8px">';
html += '<label style="display:flex;align-items:flex-start;gap:12px;cursor:pointer">';
html += '<input type="checkbox" id="ins-lead-check" checked style="margin-top:4px;width:20px;height:20px;accent-color:#2563eb">';
html += '<div>';
html += '<span class="font-bold text-blue-900 text-sm">Get a free trucking insurance quote</span>';
html += '<p class="text-xs text-blue-700 mt-1">Your FMCSA insurance filing shows a gap. We can connect you with a licensed trucking insurance agent to get you properly covered — no obligation.</p>';
html += '<span style="font-weight:700;color:#1e3a5f;font-size:14px">Get a free trucking insurance quote</span>';
html += '<p style="font-size:12px;color:#1d4ed8;margin-top:4px">Your FMCSA insurance filing shows a gap. We can connect you with a licensed trucking insurance agent to get you properly covered — no obligation.</p>';
html += '</div></label>';
html += '<div id="ins-lead-form" class="mt-3 ml-8 space-y-2">';
html += '<input type="text" id="ins-lead-name" placeholder="Your name" value="' + (data.legal_name || '') + '" class="w-full px-3 py-2 text-sm border border-blue-200 rounded-lg outline-none focus:border-blue-400">';
html += '<input type="email" id="ins-lead-email" placeholder="Email address" class="w-full px-3 py-2 text-sm border border-blue-200 rounded-lg outline-none focus:border-blue-400">';
html += '<input type="tel" id="ins-lead-phone" placeholder="Phone number" value="' + (data.telephone || '') + '" class="w-full px-3 py-2 text-sm border border-blue-200 rounded-lg outline-none focus:border-blue-400">';
html += '<button type="button" id="ins-lead-submit" class="px-6 py-2 bg-blue-600 text-white font-semibold rounded-lg text-sm hover:bg-blue-700">Request Insurance Quote</button>';
html += '<div id="ins-lead-form" style="margin-top:12px;margin-left:32px">';
html += '<input type="text" id="ins-lead-name" placeholder="Your name" value="' + (data.legal_name || '') + '" style="width:100%;padding:8px 12px;font-size:13px;border:1px solid #bfdbfe;border-radius:8px;outline:none;margin-bottom:8px">';
html += '<input type="email" id="ins-lead-email" placeholder="Email address" style="width:100%;padding:8px 12px;font-size:13px;border:1px solid #bfdbfe;border-radius:8px;outline:none;margin-bottom:8px">';
html += '<input type="tel" id="ins-lead-phone" placeholder="Phone number" value="' + (data.telephone || '') + '" style="width:100%;padding:8px 12px;font-size:13px;border:1px solid #bfdbfe;border-radius:8px;outline:none;margin-bottom:8px">';
html += '<button type="button" id="ins-lead-submit" style="padding:8px 24px;background:#2563eb;color:#fff;font-weight:600;border-radius:8px;font-size:13px;border:none;cursor:pointer">Request Insurance Quote</button>';
html += '<p id="ins-lead-status" class="text-xs hidden"></p>';
html += '</div></div>';
}
@ -255,16 +255,16 @@ Send reset link
// CTA
var redCount = (s.red || 0);
if (redCount > 0) {
html += '<div class="bg-gradient-to-br from-orange-50 to-orange-100 border-2 border-orange-400 rounded-xl p-6 text-center mt-2">';
html += '<h3 class="text-lg font-bold text-gray-900 mb-2">' + redCount + ' compliance issue' + (redCount > 1 ? 's' : '') + ' found</h3>';
html += '<p class="text-sm text-gray-600 mb-4">Performance West can help you resolve these issues. We handle the paperwork so you can focus on driving.</p>';
html += '<a href="/order/dot-compliance?dot=' + data.dot_number + '" class="inline-block px-8 py-3 bg-orange-500 text-white font-semibold rounded-lg hover:bg-orange-600 transition-colors shadow-md">Fix My DOT Filings &rarr;</a>';
html += '<div style="background:linear-gradient(135deg,#fff7ed,#ffedd5);border:2px solid #f97316;border-radius:12px;padding:24px;text-align:center;margin-top:8px">';
html += '<h3 style="font-size:18px;font-weight:700;color:#111827;margin-bottom:8px">' + redCount + ' compliance issue' + (redCount > 1 ? 's' : '') + ' found</h3>';
html += '<p style="font-size:14px;color:#4b5563;margin-bottom:16px">Performance West can help you resolve these issues. We handle the paperwork so you can focus on driving.</p>';
html += '<a href="/order/dot-compliance?dot=' + data.dot_number + '" style="display:inline-block;padding:12px 32px;background:#f97316;color:#fff;font-weight:700;border-radius:8px;text-decoration:none;font-size:15px;box-shadow:0 4px 12px rgba(249,115,22,0.3)">Fix My DOT Filings &rarr;</a>';
html += '<p class="text-xs text-gray-400 mt-3">Or call (888) 411-0383</p>';
html += '</div>';
} else {
html += '<div class="bg-green-50 border-2 border-green-300 rounded-xl p-6 text-center mt-2">';
html += '<h3 class="text-lg font-bold text-green-800 mb-1">Looking good!</h3>';
html += '<p class="text-sm text-gray-700">Your DOT filings appear current. No action needed at this time.</p>';
html += '<div style="background:#f0fdf4;border:2px solid #86efac;border-radius:12px;padding:24px;text-align:center;margin-top:8px">';
html += '<h3 style="font-size:18px;font-weight:700;color:#166534;margin-bottom:4px">Looking good!</h3>';
html += '<p style="font-size:14px;color:#374151">Your DOT filings appear current. No action needed at this time.</p>';
html += '</div>';
}