new-site/site/public/order/dot-compliance/index.html
justin 72f692007e Fix per-item discount: re-query checkboxes dynamically
checkboxes were captured at page load before state services rendered.
Now uses getCheckboxes() to re-query each time + delegated change
listener for dynamically added checkboxes.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-05-29 15:09:52 -05:00

582 lines
33 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="DOT/FMCSA motor carrier compliance services. MCS-150 updates, BOC-3 filing, UCR registration, operating authority, and more.">
<title>DOT Compliance Services — Motor Carrier Filings | Performance West Inc.</title>
<link rel="icon" type="image/svg+xml" href="/favicon.svg">
<script>
window.__PW_API = (function() {
var h = window.location.hostname;
if (h === "localhost" || h === "127.0.0.1") return "http://" + h + ":3001";
if (h === "dev.performancewest.net") return "https://api.dev.performancewest.net";
return "https://api.performancewest.net";
})();
</script>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">
<script defer src="https://analytics.performancewest.net/script.js" data-website-id="55250014-ee15-44ac-a1f6-81dabad3fe0f"></script>
<link rel="stylesheet" href="/_astro/about.DhmoKVOS.css">
<style>
.svc-card{transition:all 0.15s}
.svc-card:has(input:checked){border-color:#f97316;background:#fff7ed}
</style>
</head>
<body class="min-h-screen flex flex-col bg-gray-50">
<!-- Minimal nav for order page -->
<nav class="border-b border-gray-200 bg-white">
<div class="max-w-4xl mx-auto px-4 py-4 flex items-center justify-between">
<a href="/"><img src="/images/logo.png" alt="Performance West" class="h-12"></a>
<a href="/tools/dot-compliance-check" class="text-sm text-orange-600 font-medium hover:text-orange-800">← Back to DOT Compliance Check</a>
</div>
</nav>
<main class="flex-1">
<section class="bg-pw-950 py-10">
<div class="max-w-4xl mx-auto px-4 text-center">
<h1 class="text-2xl sm:text-3xl font-bold text-white mb-2">DOT / FMCSA Compliance Services</h1>
<p class="text-gray-300 text-sm">Select the filings you need. We handle the paperwork so you can focus on driving.</p>
</div>
</section>
<section class="py-8">
<div class="max-w-3xl mx-auto px-4">
<!-- Entity info bar -->
<div id="pw-entity-bar" class="bg-white border border-gray-200 rounded-lg p-4 mb-6 flex items-center gap-3" hidden>
<svg class="w-5 h-5 text-orange-500 shrink-0" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path stroke-linecap="round" stroke-linejoin="round" d="M8.25 18.75a1.5 1.5 0 01-3 0m3 0a1.5 1.5 0 00-3 0m3 0h6m-9 0H3.375a1.125 1.125 0 01-1.125-1.125V14.25m17.25 4.5a1.5 1.5 0 01-3 0m3 0a1.5 1.5 0 00-3 0m3 0h1.125c.621 0 1.129-.504 1.09-1.124a17.902 17.902 0 00-3.213-9.193 2.056 2.056 0 00-1.58-.86H14.25M16.5 18.75h-2.25m0-11.177v-.958c0-.568-.422-1.048-.987-1.106a48.554 48.554 0 00-10.026 0 1.106 1.106 0 00-.987 1.106v7.635m12-6.677v6.677m0 4.5v-4.5m0 0h-12"/></svg>
<div>
<span id="pw-entity-name" class="font-semibold text-gray-900"></span>
<span id="pw-entity-dot" class="font-mono text-sm text-gray-500 ml-2"></span>
</div>
</div>
<!-- Service selection -->
<div id="pw-svc-list" class="space-y-3">
<h3 class="text-xs font-bold text-orange-600 uppercase tracking-wider mt-4 mb-2">Core Filings</h3>
<label class="svc-card block rounded-xl border-2 border-gray-200 bg-white p-4 cursor-pointer hover:border-orange-300">
<div class="flex items-start gap-3">
<input type="checkbox" data-slug="mcs150-update" data-price="6900" class="mt-1 accent-orange-500">
<div class="flex-1">
<div class="flex items-center justify-between">
<span class="font-semibold text-gray-900">MCS-150 Biennial Update</span>
<span class="text-sm font-bold text-orange-600">$69</span>
</div>
<p class="text-xs text-gray-500 mt-1">Required every 2 years. Failure to update results in USDOT deactivation + fines up to $1,000/day.</p>
</div>
</div>
</label>
<label class="svc-card block rounded-xl border-2 border-gray-200 bg-white p-4 cursor-pointer hover:border-orange-300">
<div class="flex items-start gap-3">
<input type="checkbox" data-slug="boc3-filing" data-price="8900" class="mt-1 accent-orange-500">
<div class="flex-1">
<div class="flex items-center justify-between">
<span class="font-semibold text-gray-900">BOC-3 Process Agent Filing</span>
<span class="text-sm font-bold text-orange-600">$89</span>
</div>
<p class="text-xs text-gray-500 mt-1">Designates a process agent in all 48 states + DC. Required for all for-hire carriers, brokers, freight forwarders.</p>
</div>
</div>
</label>
<label class="svc-card block rounded-xl border-2 border-gray-200 bg-white p-4 cursor-pointer hover:border-orange-300">
<div class="flex items-start gap-3">
<input type="checkbox" data-slug="ucr-registration" data-price="6900" data-govfee="4600" class="mt-1 accent-orange-500">
<div class="flex-1">
<div class="flex items-center justify-between">
<span class="font-semibold text-gray-900">UCR Annual Registration</span>
<span class="text-sm font-bold text-orange-600">$69 <span class="text-xs font-normal text-gray-400">+ gov fee from $46</span></span>
</div>
<p class="text-xs text-gray-500 mt-1">Annual requirement for interstate carriers. Gov fee based on fleet size ($59$7,511). Failure = out-of-service at roadside.</p>
</div>
</div>
</label>
<h3 class="text-xs font-bold text-orange-600 uppercase tracking-wider mt-6 mb-2">New Authority</h3>
<label class="svc-card block rounded-xl border-2 border-gray-200 bg-white p-4 cursor-pointer hover:border-orange-300">
<div class="flex items-start gap-3">
<input type="checkbox" data-slug="dot-registration" data-price="8900" class="mt-1 accent-orange-500">
<div class="flex-1">
<div class="flex items-center justify-between">
<span class="font-semibold text-gray-900">New USDOT Number</span>
<span class="text-sm font-bold text-orange-600">$89</span>
</div>
<p class="text-xs text-gray-500 mt-1">Register a new USDOT number for your motor carrier, broker, or freight forwarder operation.</p>
</div>
</div>
</label>
<label class="svc-card block rounded-xl border-2 border-gray-200 bg-white p-4 cursor-pointer hover:border-orange-300">
<div class="flex items-start gap-3">
<input type="checkbox" data-slug="mc-authority" data-price="34900" data-govfee="30000" class="mt-1 accent-orange-500">
<div class="flex-1">
<div class="flex items-center justify-between">
<span class="font-semibold text-gray-900">MC Operating Authority</span>
<span class="text-sm font-bold text-orange-600">$349 <span class="text-xs font-normal text-gray-400">+ $300 FMCSA fee</span></span>
</div>
<p class="text-xs text-gray-500 mt-1">Apply for common or contract authority to operate as a for-hire carrier.</p>
</div>
</div>
</label>
<h3 class="text-xs font-bold text-orange-600 uppercase tracking-wider mt-6 mb-2">Safety & Compliance</h3>
<label class="svc-card block rounded-xl border-2 border-gray-200 bg-white p-4 cursor-pointer hover:border-orange-300">
<div class="flex items-start gap-3">
<input type="checkbox" data-slug="dot-drug-alcohol" data-price="14900" class="mt-1 accent-orange-500">
<div class="flex-1">
<div class="flex items-center justify-between">
<span class="font-semibold text-gray-900">DOT Drug & Alcohol Program</span>
<span class="text-sm font-bold text-orange-600">$149/yr</span>
</div>
<p class="text-xs text-gray-500 mt-1">Consortium enrollment, written policy, DER designation. Required for all carriers with CDL drivers.</p>
</div>
</div>
</label>
<label class="svc-card block rounded-xl border-2 border-gray-200 bg-white p-4 cursor-pointer hover:border-orange-300">
<div class="flex items-start gap-3">
<input type="checkbox" data-slug="dot-audit-prep" data-price="39900" class="mt-1 accent-orange-500">
<div class="flex-1">
<div class="flex items-center justify-between">
<span class="font-semibold text-gray-900">New Entrant Safety Audit Prep</span>
<span class="text-sm font-bold text-orange-600">$399</span>
</div>
<p class="text-xs text-gray-500 mt-1">Prepare for your 18-month FMCSA safety audit. Includes mock audit, DQ files, maintenance program, and compliance binder.</p>
</div>
</div>
</label>
<h3 class="text-xs font-bold text-orange-600 uppercase tracking-wider mt-6 mb-2">Bundle & Save</h3>
<label class="svc-card block rounded-xl border-2 border-orange-200 bg-orange-50 p-4 cursor-pointer hover:border-orange-400">
<div class="flex items-start gap-3">
<input type="checkbox" data-slug="dot-full-compliance" data-price="39900" data-bundle="mcs150-update,boc3-filing,ucr-registration,dot-drug-alcohol,dot-audit-prep" class="mt-1 accent-orange-500">
<div class="flex-1">
<div class="flex items-center justify-between">
<span class="font-semibold text-gray-900">DOT Full Compliance Bundle</span>
<span class="text-sm font-bold text-orange-600">$399 <span class="text-xs font-normal text-green-600 ml-1">Save $376</span></span>
</div>
<p class="text-xs text-gray-500 mt-1">MCS-150 + BOC-3 + UCR + Drug & Alcohol Program + Safety Audit Prep — everything you need. Best value.</p>
</div>
</div>
</label>
<div id="pw-state-services" style="display:none">
<h3 style="font-size:11px;font-weight:700;color:#ea580c;text-transform:uppercase;letter-spacing:0.05em;margin:24px 0 8px">State Compliance</h3>
<label class="svc-card block rounded-xl border-2 border-gray-200 bg-white p-4 cursor-pointer hover:border-orange-300" data-state-svc="irp">
<div class="flex items-start gap-3">
<input type="checkbox" data-slug="irp-registration" data-price="19900" class="mt-1 accent-orange-500">
<div class="flex-1">
<div class="flex items-center justify-between">
<span class="font-semibold text-gray-900">IRP Registration Assistance</span>
<span class="text-sm font-bold text-orange-600">$199</span>
</div>
<p class="text-xs text-gray-500 mt-1">International Registration Plan — apportioned vehicle registration for interstate carriers. Filed through your base state.</p>
</div>
</div>
</label>
<label class="svc-card block rounded-xl border-2 border-gray-200 bg-white p-4 cursor-pointer hover:border-orange-300" data-state-svc="ifta">
<div class="flex items-start gap-3">
<input type="checkbox" data-slug="ifta-application" data-price="14900" class="mt-1 accent-orange-500">
<div class="flex-1">
<div class="flex items-center justify-between">
<span class="font-semibold text-gray-900">IFTA Application + Decals</span>
<span class="text-sm font-bold text-orange-600">$149</span>
</div>
<p class="text-xs text-gray-500 mt-1">International Fuel Tax Agreement — get your IFTA license and decals for interstate fuel tax reporting.</p>
</div>
</div>
</label>
<label class="svc-card block rounded-xl border-2 border-gray-200 bg-white p-4 cursor-pointer hover:border-orange-300" data-state-svc="ca-mcp">
<div class="flex items-start gap-3">
<input type="checkbox" data-slug="ca-mcp-carb" data-price="34900" class="mt-1 accent-orange-500">
<div class="flex-1">
<div class="flex items-center justify-between">
<span class="font-semibold text-gray-900">California MCP + CARB Compliance</span>
<span class="text-sm font-bold text-orange-600">$349</span>
</div>
<p class="text-xs text-gray-500 mt-1">Motor Carrier Permit (MCP) + CARB Truck & Bus Rule compliance. Required for all carriers operating in California.</p>
</div>
</div>
</label>
<label class="svc-card block rounded-xl border-2 border-gray-200 bg-white p-4 cursor-pointer hover:border-orange-300" data-state-svc="weight-tax-or">
<div class="flex items-start gap-3">
<input type="checkbox" data-slug="or-weight-mile-tax" data-price="19900" class="mt-1 accent-orange-500">
<div class="flex-1">
<div class="flex items-center justify-between">
<span class="font-semibold text-gray-900">Oregon Weight-Mile Tax Setup</span>
<span class="text-sm font-bold text-orange-600">$199</span>
</div>
<p class="text-xs text-gray-500 mt-1">Account setup and first filing for Oregon's Weight-Mile Tax. Required for vehicles over 26,001 lbs.</p>
</div>
</div>
</label>
<label class="svc-card block rounded-xl border-2 border-gray-200 bg-white p-4 cursor-pointer hover:border-orange-300" data-state-svc="weight-tax-ny">
<div class="flex items-start gap-3">
<input type="checkbox" data-slug="ny-hut-registration" data-price="19900" class="mt-1 accent-orange-500">
<div class="flex-1">
<div class="flex items-center justify-between">
<span class="font-semibold text-gray-900">NY Highway Use Tax (HUT)</span>
<span class="text-sm font-bold text-orange-600">$199</span>
</div>
<p class="text-xs text-gray-500 mt-1">Registration and first filing for New York's Highway Use Tax. Required for vehicles over 18,000 lbs.</p>
</div>
</div>
</label>
<label class="svc-card block rounded-xl border-2 border-gray-200 bg-white p-4 cursor-pointer hover:border-orange-300" data-state-svc="weight-tax-ky">
<div class="flex items-start gap-3">
<input type="checkbox" data-slug="ky-kyu-registration" data-price="19900" class="mt-1 accent-orange-500">
<div class="flex-1">
<div class="flex items-center justify-between">
<span class="font-semibold text-gray-900">KY Weight-Distance Tax (KYU)</span>
<span class="text-sm font-bold text-orange-600">$199</span>
</div>
<p class="text-xs text-gray-500 mt-1">KYU number and account setup for Kentucky's Weight-Distance Tax. Required for vehicles over 59,999 lbs.</p>
</div>
</div>
</label>
<label class="svc-card block rounded-xl border-2 border-gray-200 bg-white p-4 cursor-pointer hover:border-orange-300" data-state-svc="weight-tax-nm">
<div class="flex items-start gap-3">
<input type="checkbox" data-slug="nm-weight-distance" data-price="19900" class="mt-1 accent-orange-500">
<div class="flex-1">
<div class="flex items-center justify-between">
<span class="font-semibold text-gray-900">NM Weight-Distance Tax</span>
<span class="text-sm font-bold text-orange-600">$199</span>
</div>
<p class="text-xs text-gray-500 mt-1">E-permit and account setup for New Mexico's Weight-Distance Tax. Required for vehicles over 26,001 lbs.</p>
</div>
</div>
</label>
<label class="svc-card block rounded-xl border-2 border-gray-200 bg-white p-4 cursor-pointer hover:border-orange-300" data-state-svc="weight-tax-ct">
<div class="flex items-start gap-3">
<input type="checkbox" data-slug="ct-highway-use-fee" data-price="19900" class="mt-1 accent-orange-500">
<div class="flex-1">
<div class="flex items-center justify-between">
<span class="font-semibold text-gray-900">CT Highway Use Fee</span>
<span class="text-sm font-bold text-orange-600">$199</span>
</div>
<p class="text-xs text-gray-500 mt-1">Registration and first filing for Connecticut's Highway Use Fee. Required for vehicles over 26,000 lbs.</p>
</div>
</div>
</label>
<label class="svc-card block rounded-xl border-2 border-gray-200 bg-white p-4 cursor-pointer hover:border-orange-300" data-state-svc="intrastate">
<div class="flex items-start gap-3">
<input type="checkbox" data-slug="intrastate-authority" data-price="24900" class="mt-1 accent-orange-500">
<div class="flex-1">
<div class="flex items-center justify-between">
<span class="font-semibold text-gray-900">Intrastate Operating Authority</span>
<span class="text-sm font-bold text-orange-600">$249</span>
</div>
<p class="text-xs text-gray-500 mt-1">State-level operating authority (Certificate of Authority / CPCN) for for-hire intrastate carriers.</p>
</div>
</div>
</label>
<label class="svc-card block rounded-xl border-2 border-orange-200 bg-orange-50 p-4 cursor-pointer hover:border-orange-400" data-state-svc="bundle">
<div class="flex items-start gap-3">
<input type="checkbox" data-slug="state-trucking-bundle" data-price="49900" data-bundle="irp-registration,ifta-application,or-weight-mile-tax,ny-hut-registration,ky-kyu-registration,nm-weight-distance,ct-highway-use-fee,intrastate-authority" class="mt-1 accent-orange-500">
<div class="flex-1">
<div class="flex items-center justify-between">
<span class="font-semibold text-gray-900">State Compliance Bundle</span>
<span class="text-sm font-bold text-orange-600">$499 <span class="text-xs font-normal text-green-600 ml-1">Save vs. individual</span></span>
</div>
<p class="text-xs text-gray-500 mt-1">IRP + IFTA + weight-distance tax + state permits — everything your state requires. We identify and file all obligations.</p>
</div>
</div>
</label>
</div>
</div>
<!-- Insurance referral (shown if carrier has insurance issue and didn't submit on checker page) -->
<div id="pw-ins-referral" class="mt-4" hidden>
<div style="background:#eff6ff;border:2px solid #93c5fd;border-radius:12px;padding:16px">
<label style="display:flex;align-items:flex-start;gap:12px;cursor:pointer">
<input type="checkbox" id="ins-referral-check" checked style="margin-top:4px;width:18px;height:18px;accent-color:#2563eb">
<div>
<span style="font-weight:700;color:#1e3a5f;font-size:14px">Also get a free trucking insurance quote</span>
<p style="font-size:12px;color:#1d4ed8;margin-top:4px">We noticed your FMCSA insurance filing has a gap. Check this box and we'll connect you with a licensed trucking insurance agent — no extra charge, no obligation.</p>
</div>
</label>
</div>
</div>
<!-- Total + checkout -->
<div id="pw-total-section" class="mt-6 bg-white border border-gray-200 rounded-xl p-6 shadow-sm" hidden>
<div id="pw-total-rows"></div>
<div class="mt-4 pt-4 border-t border-gray-200">
<form id="pw-batch-form" class="space-y-4">
<div class="grid sm:grid-cols-2 gap-3">
<div>
<label class="block text-xs font-medium text-gray-600 mb-1">Your first and last name</label>
<input type="text" id="pw-name" required placeholder="e.g. John Smith" class="w-full px-3 py-2 text-sm border border-gray-300 rounded-lg outline-none">
</div>
<div>
<label class="block text-xs font-medium text-gray-600 mb-1">Email</label>
<input type="email" id="pw-email" required placeholder="john@company.com" class="w-full px-3 py-2 text-sm border border-gray-300 rounded-lg outline-none">
</div>
<div>
<label class="block text-xs font-medium text-gray-600 mb-1">Phone</label>
<input type="tel" id="pw-phone" placeholder="(555) 123-4567" class="w-full px-3 py-2 text-sm border border-gray-300 rounded-lg outline-none">
</div>
<div>
<label class="block text-xs font-medium text-gray-600 mb-1">Referral code</label>
<input type="text" id="pw-promo" placeholder="Optional" class="w-full px-3 py-2 text-sm border border-gray-300 rounded-lg outline-none uppercase">
</div>
</div>
<div id="pw-payment-section">
<h4 class="text-sm font-semibold text-gray-900 mb-2">Payment Method</h4>
<div class="grid grid-cols-2 gap-2">
<label class="flex items-center gap-2 p-3 rounded-lg border border-gray-200 cursor-pointer hover:border-orange-300 has-[:checked]:border-orange-500 has-[:checked]:bg-orange-50"><input type="radio" name="pw_pay" value="card" checked><span class="text-sm">Card</span></label>
<label class="flex items-center gap-2 p-3 rounded-lg border border-gray-200 cursor-pointer hover:border-orange-300 has-[:checked]:border-orange-500 has-[:checked]:bg-orange-50"><input type="radio" name="pw_pay" value="ach"><span class="text-sm">ACH</span></label>
</div>
</div>
<label class="flex items-start gap-2 p-3 rounded-lg border border-gray-200 text-xs text-gray-600"><input type="checkbox" id="pw-engage" required class="mt-0.5"><span>I authorize Performance West to prepare and file on my behalf. <a href="/terms" target="_blank" class="text-orange-600 underline">Terms</a></span></label>
<button type="submit" id="pw-submit" style="width:100%;padding:12px;border-radius:8px;background:#f97316;color:#fff;font-weight:700;font-size:16px;border:none;cursor:pointer;box-shadow:0 4px 14px rgba(249,115,22,0.4)">Continue to Secure Payment →</button>
<p id="pw-err" class="text-sm text-red-700 mt-1" hidden></p>
</form>
</div>
</div>
<!-- Help -->
<div class="mt-6 text-center">
<p class="text-sm text-gray-500">Questions? <a href="mailto:info@performancewest.net" class="text-orange-600 underline">info@performancewest.net</a> or call <strong>(888) 411-0383</strong></p>
</div>
</div>
</section>
</main>
<footer class="border-t border-gray-200 bg-white py-6">
<div class="max-w-4xl mx-auto px-4 text-center text-xs text-gray-400">
<p>Performance West Inc. · 525 Randall Ave Ste 100-1195, Cheyenne, WY 82001 · <a href="https://performancewest.net" class="text-gray-500">performancewest.net</a></p>
<p class="mt-1">Performance West is a regulatory compliance consulting firm, not a law firm. This does not constitute legal advice.</p>
</div>
</footer>
<script>
var API = window.__PW_API || "https://api.performancewest.net";
var params = new URLSearchParams(window.location.search);
var dot = params.get("dot") || "";
var emailFromUrl = params.get("email") || "";
var promoFromUrl = params.get("code") || params.get("promo") || "";
function usd(cents) { return "$" + (cents / 100).toLocaleString("en-US", {minimumFractionDigits: 2}); }
// Show insurance referral if ?ins=1 from checker page
var showInsReferral = params.get("ins") === "1";
if (showInsReferral) {
document.getElementById("pw-ins-referral").hidden = false;
}
// Pre-fill entity info
if (dot) {
fetch(API + "/api/v1/dot/lookup?dot=" + dot).then(function(r) { return r.json(); }).then(function(d) {
if (d.legal_name) {
document.getElementById("pw-entity-name").textContent = d.legal_name;
document.getElementById("pw-entity-dot").textContent = "DOT# " + dot;
document.getElementById("pw-entity-bar").hidden = false;
}
// Also show insurance referral if carrier has insurance issues
if (!showInsReferral && d.checks) {
var hasInsIssue = d.checks.some(function(c) { return c.id && c.id.indexOf("insurance") === 0 && c.status === "red"; });
if (hasInsIssue) {
document.getElementById("pw-ins-referral").hidden = false;
}
}
}).catch(function() {});
}
if (emailFromUrl) { var e = document.getElementById("pw-email"); if (e) e.value = emailFromUrl; }
if (promoFromUrl) { var p = document.getElementById("pw-promo"); if (p) { p.value = promoFromUrl.toUpperCase(); p.readOnly = true; p.style.background = "#fff7ed"; p.style.borderColor = "#f97316"; } }
// Show state compliance services section — always visible so users can add them
var stateSection = document.getElementById("pw-state-services");
if (stateSection) stateSection.style.display = "block";
// If ?state=XX, highlight relevant state services
var stateParam = (params.get("state") || "").toUpperCase();
if (stateParam && dot) {
fetch(API + "/api/v1/dot/state-requirements?base_state=" + stateParam).then(function(r) { return r.json(); }).then(function(d) {
if (d.recommended_services) {
d.recommended_services.forEach(function(svc) {
var cb = document.querySelector('input[data-slug="' + svc.slug + '"]');
if (cb) { cb.checked = true; cb.dispatchEvent(new Event("change", { bubbles: true })); }
});
}
}).catch(function() {});
}
// Bundle logic: checking a bundle unchecks its individual components
document.querySelectorAll("input[data-bundle]").forEach(function(bundleCb) {
bundleCb.addEventListener("change", function() {
if (!bundleCb.checked) return;
var components = (bundleCb.dataset.bundle || "").split(",");
components.forEach(function(slug) {
var cb = document.querySelector('input[data-slug="' + slug + '"]');
if (cb && cb.checked) { cb.checked = false; }
});
});
});
// Reverse: checking an individual component unchecks the bundle if all components are now selected individually
// (optional — skip for simplicity, the bundle is always a better deal)
// Checkbox change → update total
var totalSection = document.getElementById("pw-total-section");
var totalRows = document.getElementById("pw-total-rows");
// Non-discountable slugs (passthrough costs)
var nonDiscountable = {"dot-drug-alcohol": true, "boc3-filing": true, "mc-authority": true};
// Re-query checkboxes each time (state services added dynamically)
function getCheckboxes() { return document.querySelectorAll("input[data-slug]"); }
// Cached discount info
var activeDiscount = null;
function fetchDiscount() {
var code = (document.getElementById("pw-promo").value || "").trim().toUpperCase();
if (!code) { activeDiscount = null; updateTotal(); return; }
fetch(API + "/api/v1/discount/" + encodeURIComponent(code)).then(function(r) { return r.json(); }).then(function(d) {
if (d.valid) { activeDiscount = d; } else { activeDiscount = null; }
updateTotal();
}).catch(function() { activeDiscount = null; updateTotal(); });
}
// Fetch on load if promo field has any value
var promoField = document.getElementById("pw-promo");
if (promoField.value.trim()) { setTimeout(fetchDiscount, 300); }
// Fetch on blur and input of promo field
promoField.addEventListener("blur", fetchDiscount);
promoField.addEventListener("input", function() { clearTimeout(promoField._debounce); promoField._debounce = setTimeout(fetchDiscount, 600); });
function updateTotal() {
var selected = [];
var svcTotal = 0;
var govTotal = 0;
var discountable = 0;
getCheckboxes().forEach(function(cb) {
if (cb.checked) {
var price = parseInt(cb.dataset.price) || 0;
var gov = parseInt(cb.dataset.govfee) || 0;
svcTotal += price;
govTotal += gov;
if (!nonDiscountable[cb.dataset.slug]) { discountable += price; }
selected.push(cb.dataset.slug);
}
});
if (selected.length === 0) { totalSection.hidden = true; return; }
totalSection.hidden = false;
var discountAmt = 0;
if (activeDiscount && activeDiscount.discount_type === "percent") {
discountAmt = Math.round(discountable * activeDiscount.discount_value / 100);
} else if (activeDiscount && activeDiscount.discount_type === "flat") {
discountAmt = Math.min(activeDiscount.discount_value * 100, discountable);
}
// Build itemized list
var html = '';
getCheckboxes().forEach(function(cb) {
if (!cb.checked) return;
var price = parseInt(cb.dataset.price) || 0;
var gov = parseInt(cb.dataset.govfee) || 0;
var slug = cb.dataset.slug;
var label = cb.closest("label");
var name = label ? (label.querySelector(".font-semibold.text-gray-900") || {}).textContent || slug : slug;
var canDiscount = !nonDiscountable[slug] && activeDiscount;
var itemDiscount = 0;
if (canDiscount && activeDiscount.discount_type === "percent") {
itemDiscount = Math.round(price * activeDiscount.discount_value / 100);
}
html += '<div class="flex justify-between text-sm mb-1"><span>' + name + '</span>';
if (itemDiscount > 0) {
html += '<span>' + usd(price) + ' <span style="color:#059669;font-size:12px;font-weight:600">-' + usd(itemDiscount) + '</span></span>';
} else {
html += '<span>' + usd(price) + '</span>';
}
html += '</div>';
if (gov > 0) html += '<div class="flex justify-between text-xs text-gray-400 mb-1 pl-2"><span>Gov fee</span><span>' + usd(gov) + '</span></div>';
});
if (govTotal > 0) html += '<div class="flex justify-between text-sm text-gray-500 mb-1 border-t border-gray-100 pt-1 mt-1"><span>Government fees</span><span>' + usd(govTotal) + '</span></div>';
if (discountAmt > 0) {
html += '<div class="flex justify-between text-sm text-green-600 font-semibold mb-1"><span>' + activeDiscount.code + ' (' + activeDiscount.discount_value + '% off)</span><span>-' + usd(discountAmt) + '</span></div>';
}
var finalTotal = svcTotal + govTotal - discountAmt;
html += '<div class="flex justify-between font-bold text-lg border-t border-gray-300 pt-2 mt-2"><span>Total</span><span>' + usd(finalTotal) + '</span></div>';
if (discountAmt > 0) { html += '<div class="text-xs text-green-600 text-right mt-1">You save ' + usd(discountAmt) + '!</div>'; }
totalRows.innerHTML = html;
}
getCheckboxes().forEach(function(cb) { cb.addEventListener("change", updateTotal); });
// Also listen for changes on dynamically shown state services
document.addEventListener("change", function(e) { if (e.target.matches && e.target.matches("input[data-slug]")) updateTotal(); });
// Pre-check services from URL
var preSelect = (params.get("services") || "").split(",").filter(Boolean);
preSelect.forEach(function(slug) {
var cb = document.querySelector('input[data-slug="' + slug + '"]');
if (cb) cb.checked = true;
});
if (preSelect.length) updateTotal();
// Submit
document.getElementById("pw-batch-form").addEventListener("submit", function(e) {
e.preventDefault();
var selected = [];
getCheckboxes().forEach(function(cb) { if (cb.checked) selected.push(cb.dataset.slug); });
if (selected.length === 0) { alert("Please select at least one service."); return; }
if (!document.getElementById("pw-engage").checked) { alert("Please accept the authorization terms."); return; }
var btn = document.getElementById("pw-submit");
btn.disabled = true; btn.textContent = "Creating order...";
var errEl = document.getElementById("pw-err"); errEl.hidden = true;
var body = {
services: selected,
customer_name: document.getElementById("pw-name").value.trim(),
customer_email: document.getElementById("pw-email").value.trim(),
customer_phone: document.getElementById("pw-phone").value.trim() || undefined,
discount_code: document.getElementById("pw-promo").value.trim() || undefined,
intake_data: {
dot_number: dot,
source: "dot-compliance-remediation",
insurance_referral_requested: document.getElementById("ins-referral-check")?.checked || false,
},
engagement_accepted: true
};
fetch(API + "/api/v1/compliance-orders/batch", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(body) })
.then(function(r) { return r.json().then(function(d) { if (!r.ok) throw new Error(d.error || "Order failed"); return d; }); })
.then(function(d) {
var payMethod = document.querySelector("input[name=pw_pay]:checked").value;
return fetch(API + "/api/v1/checkout/create-session", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ order_id: d.batch_id, order_type: "compliance_batch", payment_method: payMethod }) });
})
.then(function(r) { return r.json(); })
.then(function(d) {
if (d.checkout_url) window.location.href = d.checkout_url;
else throw new Error("No checkout URL returned");
})
.catch(function(err) {
errEl.textContent = err.message; errEl.hidden = false;
btn.disabled = false; btn.textContent = "Continue to Secure Payment →";
});
});
</script>
</body>
</html>