mcs150: census-prefilled intake-completion flow + completeness gate
Closes the data gap for orders that bypass the full intake (e.g. the DOT compliance-remediation pipeline) and for all MCS-150 variants: - Worker intake-completeness gate (mcs150_update): before filling, check the customer-required operational fields the FMCSA census cannot supply (operation classification, cargo, CURRENT annual mileage, email; plus signer/address for new-registration/reactivation, and states-of-operation for 150B hazmat). If missing, email the customer a census-pre-filled intake link and hold the order at fulfillment_status='awaiting_intake' with an admin todo, instead of fabricating a blank filing. The existing intake PUT endpoint already re-dispatches the worker on submit, so filing auto-resumes. - Intake wizard (Wizard.astro): when resuming ?order=CO-xxx for a DOT/MCS order, seed still-empty fields from the FMCSA census (name/address/fleet/interstate) so the customer only confirms the operational details. - /api/v1/dot/census now also returns total_drivers + a normalized carrier_operation_code for the prefill. - MCS150Step.astro extended to collect every field the filler needs across all variants: mailing address, cdl_drivers, primary_vehicle_type, reason_for_filing, usdot_revoked, cell/fax, hazmat-safety-permit block (needs_hmsp, operating states, security plan), and intermodal-equipment provider counts; all prefill from intake_data. verify_mcs150_variants.py covers 150/150B/150C end-to-end (ALL PASS).
This commit is contained in:
parent
38739e023c
commit
a3aeedd716
4 changed files with 439 additions and 2 deletions
|
|
@ -420,6 +420,40 @@ const STEP_LABELS: Record<string, string> = {
|
|||
state.entity = { ...state.entity, frn: intake.frn };
|
||||
}
|
||||
}
|
||||
|
||||
// For DOT/MCS-150 orders, seed any still-empty fields from the
|
||||
// carrier's current FMCSA census so the customer only has to fill
|
||||
// the operational details FMCSA cannot give us (operation class,
|
||||
// cargo, current mileage, email). Customer-entered values always win.
|
||||
const dotForCensus = (state.intake_data.dot_number as string) || "";
|
||||
const slug = (order.service_slug as string) || "";
|
||||
const isDotOrder = /^(mcs150|usdot|dot-|mc-)/.test(slug) || /mcs150|usdot-reactivation|dot-registration|dot-full/.test(slug);
|
||||
if (dotForCensus && isDotOrder) {
|
||||
try {
|
||||
const cr = await fetch(`${API}/api/v1/dot/census?dot=${dotForCensus.replace(/\D/g, "")}`);
|
||||
if (cr.ok) {
|
||||
const c = await cr.json();
|
||||
const d = state.intake_data;
|
||||
const seed = (k: string, v: any) => { if (v && !d[k]) d[k] = v; };
|
||||
seed("legal_name", c.legal_name);
|
||||
seed("dba_name", c.dba_name);
|
||||
seed("address_street", c.phy_street);
|
||||
seed("address_city", c.phy_city);
|
||||
seed("address_state", c.phy_state);
|
||||
seed("address_zip", c.phy_zip);
|
||||
seed("phone", c.telephone);
|
||||
seed("power_units", c.power_units != null ? String(c.power_units) : "");
|
||||
seed("drivers", c.total_drivers != null ? String(c.total_drivers) : "");
|
||||
// Interstate/intrastate from the census operation code.
|
||||
if (!d.interstate_intrastate && c.carrier_operation_code) {
|
||||
const code = String(c.carrier_operation_code).toUpperCase();
|
||||
d.interstate_intrastate = code === "A" ? "interstate"
|
||||
: code === "B" ? "intrastate_hazmat"
|
||||
: code === "C" ? "intrastate_non_hazmat" : d.interstate_intrastate;
|
||||
}
|
||||
}
|
||||
} catch { /* census seed is best-effort */ }
|
||||
}
|
||||
saveState(state);
|
||||
}
|
||||
} catch {}
|
||||
|
|
|
|||
|
|
@ -83,11 +83,91 @@
|
|||
</label>
|
||||
</div>
|
||||
|
||||
<div class="pw-row">
|
||||
<div class="pw-row-3">
|
||||
<label class="pw-field">
|
||||
<span>Phone <em>*</em></span>
|
||||
<input type="tel" id="mcs-phone" required placeholder="(555) 123-4567" />
|
||||
</label>
|
||||
<label class="pw-field">
|
||||
<span>Cell Phone</span>
|
||||
<input type="tel" id="mcs-cell-phone" placeholder="(555) 123-4567" />
|
||||
</label>
|
||||
<label class="pw-field">
|
||||
<span>Fax</span>
|
||||
<input type="tel" id="mcs-fax" placeholder="(555) 123-4567" />
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<h3>Mailing Address</h3>
|
||||
|
||||
<div class="pw-row">
|
||||
<label class="pw-field">
|
||||
<span>Mailing Address</span>
|
||||
<select id="mcs-mailing-same">
|
||||
<option value="same">Same as principal address</option>
|
||||
<option value="different">Different (enter below)</option>
|
||||
</select>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div id="mcs-mailing-fields" hidden>
|
||||
<div class="pw-row">
|
||||
<label class="pw-field">
|
||||
<span>Mailing Street Address</span>
|
||||
<input type="text" id="mcs-mailing-street" placeholder="123 Main St" />
|
||||
</label>
|
||||
</div>
|
||||
<div class="pw-row-3">
|
||||
<label class="pw-field">
|
||||
<span>City</span>
|
||||
<input type="text" id="mcs-mailing-city" />
|
||||
</label>
|
||||
<label class="pw-field">
|
||||
<span>State</span>
|
||||
<select id="mcs-mailing-state">
|
||||
<option value="">--</option>
|
||||
<option value="AL">AL</option><option value="AK">AK</option><option value="AZ">AZ</option><option value="AR">AR</option>
|
||||
<option value="CA">CA</option><option value="CO">CO</option><option value="CT">CT</option><option value="DE">DE</option>
|
||||
<option value="FL">FL</option><option value="GA">GA</option><option value="HI">HI</option><option value="ID">ID</option>
|
||||
<option value="IL">IL</option><option value="IN">IN</option><option value="IA">IA</option><option value="KS">KS</option>
|
||||
<option value="KY">KY</option><option value="LA">LA</option><option value="ME">ME</option><option value="MD">MD</option>
|
||||
<option value="MA">MA</option><option value="MI">MI</option><option value="MN">MN</option><option value="MS">MS</option>
|
||||
<option value="MO">MO</option><option value="MT">MT</option><option value="NE">NE</option><option value="NV">NV</option>
|
||||
<option value="NH">NH</option><option value="NJ">NJ</option><option value="NM">NM</option><option value="NY">NY</option>
|
||||
<option value="NC">NC</option><option value="ND">ND</option><option value="OH">OH</option><option value="OK">OK</option>
|
||||
<option value="OR">OR</option><option value="PA">PA</option><option value="RI">RI</option><option value="SC">SC</option>
|
||||
<option value="SD">SD</option><option value="TN">TN</option><option value="TX">TX</option><option value="UT">UT</option>
|
||||
<option value="VT">VT</option><option value="VA">VA</option><option value="WA">WA</option><option value="WV">WV</option>
|
||||
<option value="WI">WI</option><option value="WY">WY</option><option value="DC">DC</option>
|
||||
</select>
|
||||
</label>
|
||||
<label class="pw-field">
|
||||
<span>ZIP</span>
|
||||
<input type="text" id="mcs-mailing-zip" maxlength="10" placeholder="12345" />
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h3>Filing Details</h3>
|
||||
|
||||
<div class="pw-row-2">
|
||||
<label class="pw-field">
|
||||
<span>Reason for Filing</span>
|
||||
<select id="mcs-reason">
|
||||
<option value="biennial_update" selected>Biennial Update or Changes</option>
|
||||
<option value="new_application">New Application</option>
|
||||
<option value="reapplication">Reapplication (after revocation)</option>
|
||||
<option value="reactivate">Reactivate</option>
|
||||
<option value="out_of_business">Out of Business Notification</option>
|
||||
</select>
|
||||
</label>
|
||||
<label class="pw-field">
|
||||
<span>Is your USDOT registration currently revoked by FMCSA?</span>
|
||||
<select id="mcs-revoked">
|
||||
<option value="no">No</option>
|
||||
<option value="yes">Yes</option>
|
||||
</select>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<h3>Entity & Operations</h3>
|
||||
|
|
@ -158,6 +238,25 @@
|
|||
</label>
|
||||
</div>
|
||||
|
||||
<div class="pw-row-2">
|
||||
<label class="pw-field">
|
||||
<span>Drivers with CDL</span>
|
||||
<input type="number" id="mcs-cdl-drivers" min="0" placeholder="e.g. 4" />
|
||||
</label>
|
||||
<label class="pw-field">
|
||||
<span>Primary Vehicle Type</span>
|
||||
<select id="mcs-vehicle-type">
|
||||
<option value="straight" selected>Straight Trucks</option>
|
||||
<option value="tractor">Truck Tractors</option>
|
||||
<option value="trailer">Trailers</option>
|
||||
<option value="motorcoach">Motorcoach</option>
|
||||
<option value="school_bus_9_15">School Bus (9-15)</option>
|
||||
<option value="van_9_15">Passenger Van (9-15)</option>
|
||||
<option value="limo_9_15">Limousine (9-15)</option>
|
||||
</select>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<h3>Cargo Types (check all that apply)</h3>
|
||||
|
||||
<div class="pw-cargo-grid">
|
||||
|
|
@ -192,6 +291,73 @@
|
|||
<label><input type="checkbox" id="mcs-cargo-other" /> Other</label>
|
||||
</div>
|
||||
|
||||
<div id="mcs-hmsp-fields" hidden>
|
||||
<h3>Hazmat Safety Permit (HM-232)</h3>
|
||||
<p class="pw-field-help">These fields only apply to carriers transporting hazardous materials that require a Hazardous Materials Safety Permit (HMSP). If that does not apply to you, leave this section blank.</p>
|
||||
|
||||
<div class="pw-row">
|
||||
<label class="pw-checkbox-row">
|
||||
<input type="checkbox" id="mcs-needs-hmsp" />
|
||||
<span>I transport hazmat requiring a Safety Permit (HM-232)</span>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="pw-row">
|
||||
<label class="pw-field">
|
||||
<span>Do you have a hazmat security plan?</span>
|
||||
<select id="mcs-hmsp-security">
|
||||
<option value="no">No</option>
|
||||
<option value="yes">Yes</option>
|
||||
</select>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="pw-row">
|
||||
<span class="pw-field-label">States of Operation (check all that apply)</span>
|
||||
<div class="pw-state-grid">
|
||||
<label><input type="checkbox" id="mcs-opstate-AL" value="AL" /> AL</label><label><input type="checkbox" id="mcs-opstate-AK" value="AK" /> AK</label><label><input type="checkbox" id="mcs-opstate-AZ" value="AZ" /> AZ</label><label><input type="checkbox" id="mcs-opstate-AR" value="AR" /> AR</label>
|
||||
<label><input type="checkbox" id="mcs-opstate-CA" value="CA" /> CA</label><label><input type="checkbox" id="mcs-opstate-CO" value="CO" /> CO</label><label><input type="checkbox" id="mcs-opstate-CT" value="CT" /> CT</label><label><input type="checkbox" id="mcs-opstate-DE" value="DE" /> DE</label>
|
||||
<label><input type="checkbox" id="mcs-opstate-FL" value="FL" /> FL</label><label><input type="checkbox" id="mcs-opstate-GA" value="GA" /> GA</label><label><input type="checkbox" id="mcs-opstate-HI" value="HI" /> HI</label><label><input type="checkbox" id="mcs-opstate-ID" value="ID" /> ID</label>
|
||||
<label><input type="checkbox" id="mcs-opstate-IL" value="IL" /> IL</label><label><input type="checkbox" id="mcs-opstate-IN" value="IN" /> IN</label><label><input type="checkbox" id="mcs-opstate-IA" value="IA" /> IA</label><label><input type="checkbox" id="mcs-opstate-KS" value="KS" /> KS</label>
|
||||
<label><input type="checkbox" id="mcs-opstate-KY" value="KY" /> KY</label><label><input type="checkbox" id="mcs-opstate-LA" value="LA" /> LA</label><label><input type="checkbox" id="mcs-opstate-ME" value="ME" /> ME</label><label><input type="checkbox" id="mcs-opstate-MD" value="MD" /> MD</label>
|
||||
<label><input type="checkbox" id="mcs-opstate-MA" value="MA" /> MA</label><label><input type="checkbox" id="mcs-opstate-MI" value="MI" /> MI</label><label><input type="checkbox" id="mcs-opstate-MN" value="MN" /> MN</label><label><input type="checkbox" id="mcs-opstate-MS" value="MS" /> MS</label>
|
||||
<label><input type="checkbox" id="mcs-opstate-MO" value="MO" /> MO</label><label><input type="checkbox" id="mcs-opstate-MT" value="MT" /> MT</label><label><input type="checkbox" id="mcs-opstate-NE" value="NE" /> NE</label><label><input type="checkbox" id="mcs-opstate-NV" value="NV" /> NV</label>
|
||||
<label><input type="checkbox" id="mcs-opstate-NH" value="NH" /> NH</label><label><input type="checkbox" id="mcs-opstate-NJ" value="NJ" /> NJ</label><label><input type="checkbox" id="mcs-opstate-NM" value="NM" /> NM</label><label><input type="checkbox" id="mcs-opstate-NY" value="NY" /> NY</label>
|
||||
<label><input type="checkbox" id="mcs-opstate-NC" value="NC" /> NC</label><label><input type="checkbox" id="mcs-opstate-ND" value="ND" /> ND</label><label><input type="checkbox" id="mcs-opstate-OH" value="OH" /> OH</label><label><input type="checkbox" id="mcs-opstate-OK" value="OK" /> OK</label>
|
||||
<label><input type="checkbox" id="mcs-opstate-OR" value="OR" /> OR</label><label><input type="checkbox" id="mcs-opstate-PA" value="PA" /> PA</label><label><input type="checkbox" id="mcs-opstate-RI" value="RI" /> RI</label><label><input type="checkbox" id="mcs-opstate-SC" value="SC" /> SC</label>
|
||||
<label><input type="checkbox" id="mcs-opstate-SD" value="SD" /> SD</label><label><input type="checkbox" id="mcs-opstate-TN" value="TN" /> TN</label><label><input type="checkbox" id="mcs-opstate-TX" value="TX" /> TX</label><label><input type="checkbox" id="mcs-opstate-UT" value="UT" /> UT</label>
|
||||
<label><input type="checkbox" id="mcs-opstate-VT" value="VT" /> VT</label><label><input type="checkbox" id="mcs-opstate-VA" value="VA" /> VA</label><label><input type="checkbox" id="mcs-opstate-WA" value="WA" /> WA</label><label><input type="checkbox" id="mcs-opstate-WV" value="WV" /> WV</label>
|
||||
<label><input type="checkbox" id="mcs-opstate-WI" value="WI" /> WI</label><label><input type="checkbox" id="mcs-opstate-WY" value="WY" /> WY</label><label><input type="checkbox" id="mcs-opstate-DC" value="DC" /> DC</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h3>Intermodal Equipment Provider</h3>
|
||||
|
||||
<div class="pw-row">
|
||||
<label class="pw-checkbox-row">
|
||||
<input type="checkbox" id="mcs-is-iep" />
|
||||
<span>We are an Intermodal Equipment Provider (IEP)</span>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div id="mcs-iep-fields" hidden>
|
||||
<div class="pw-row-3">
|
||||
<label class="pw-field">
|
||||
<span>Owned intermodal equipment</span>
|
||||
<input type="number" id="mcs-iep-owned" min="0" placeholder="0" />
|
||||
</label>
|
||||
<label class="pw-field">
|
||||
<span>Leased intermodal equipment</span>
|
||||
<input type="number" id="mcs-iep-leased" min="0" placeholder="0" />
|
||||
</label>
|
||||
<label class="pw-field">
|
||||
<span>Serviced intermodal equipment</span>
|
||||
<input type="number" id="mcs-iep-serviced" min="0" placeholder="0" />
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h3>Authorized Signer</h3>
|
||||
|
||||
<div class="pw-row-2">
|
||||
|
|
@ -244,6 +410,11 @@
|
|||
.pw-field input:focus, .pw-field select:focus { outline: none; border-color: #f97316; box-shadow: 0 0 0 2px rgba(249,115,22,0.2); }
|
||||
.pw-cargo-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0.3rem 1rem; font-size: 0.85rem; color: #374151; }
|
||||
.pw-cargo-grid label { display: flex; align-items: center; gap: 0.4rem; cursor: pointer; }
|
||||
.pw-checkbox-row { display: flex; align-items: center; gap: 0.5rem; cursor: pointer; font-size: 0.85rem; color: #374151; }
|
||||
.pw-checkbox-row input { width: 16px; height: 16px; }
|
||||
.pw-field-label { display: block; font-size: 0.8rem; font-weight: 600; color: #374151; margin-bottom: 0.4rem; }
|
||||
.pw-state-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 0.3rem 0.6rem; font-size: 0.8rem; color: #374151; max-height: 180px; overflow-y: auto; border: 1px solid #e2e8f0; border-radius: 6px; padding: 0.5rem; background: #fff; }
|
||||
.pw-state-grid label { display: flex; align-items: center; gap: 0.3rem; cursor: pointer; }
|
||||
.pw-err { color: #b91c1c; margin-top: 0.75rem; font-size: 0.9rem; background: #fee2e2; padding: 0.5rem 0.75rem; border-radius: 6px; }
|
||||
.pw-security-notice { display: flex; gap: 8px; align-items: flex-start; background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 8px; padding: 10px 14px; margin-bottom: 1rem; font-size: 12px; color: #1e40af; line-height: 1.5; }
|
||||
.pw-field-help { font-size: 0.8rem; color: #64748b; margin: 0 0 0.5rem; }
|
||||
|
|
@ -256,6 +427,7 @@
|
|||
@media (max-width: 640px) {
|
||||
.pw-row-2, .pw-row-3 { grid-template-columns: 1fr; }
|
||||
.pw-cargo-grid { grid-template-columns: 1fr 1fr; }
|
||||
.pw-state-grid { grid-template-columns: repeat(5, 1fr); }
|
||||
}
|
||||
</style>
|
||||
|
||||
|
|
@ -285,11 +457,51 @@
|
|||
"mcs-signer-name": d.signer_name || "",
|
||||
"mcs-signer-title": d.signer_title || "",
|
||||
"mcs-ein": d.ein || "",
|
||||
"mcs-reason": d.reason_for_filing || "biennial_update",
|
||||
"mcs-cdl-drivers": d.cdl_drivers || "",
|
||||
"mcs-vehicle-type": d.primary_vehicle_type || "straight",
|
||||
"mcs-revoked": d.usdot_revoked || "no",
|
||||
"mcs-cell-phone": d.cell_phone || "",
|
||||
"mcs-fax": d.fax || "",
|
||||
"mcs-mailing-street": d.mailing_street || "",
|
||||
"mcs-mailing-city": d.mailing_city || "",
|
||||
"mcs-mailing-state": d.mailing_state || "",
|
||||
"mcs-mailing-zip": d.mailing_zip || "",
|
||||
"mcs-hmsp-security": d.hmsp_security_plan || "no",
|
||||
"mcs-iep-owned": d.iep_owned || "",
|
||||
"mcs-iep-leased": d.iep_leased || "",
|
||||
"mcs-iep-serviced": d.iep_serviced || "",
|
||||
};
|
||||
for (const [id, val] of Object.entries(fields)) {
|
||||
const el = document.getElementById(id) as HTMLInputElement | HTMLSelectElement;
|
||||
if (el && val) el.value = val;
|
||||
}
|
||||
|
||||
// Prefill mailing-address toggle: show fields when a different mailing address is on file
|
||||
const hasMailing = !!(d.mailing_street || d.mailing_city || d.mailing_state || d.mailing_zip);
|
||||
const mailingSame = document.getElementById("mcs-mailing-same") as HTMLSelectElement | null;
|
||||
const mailingFields = document.getElementById("mcs-mailing-fields") as HTMLDivElement | null;
|
||||
if (mailingSame) mailingSame.value = hasMailing ? "different" : "same";
|
||||
if (mailingFields) mailingFields.hidden = !hasMailing;
|
||||
|
||||
// Prefill HMSP section
|
||||
const needsHmsp = document.getElementById("mcs-needs-hmsp") as HTMLInputElement | null;
|
||||
if (needsHmsp) needsHmsp.checked = !!d.needs_hmsp;
|
||||
if (Array.isArray(d.operating_states)) {
|
||||
d.operating_states.forEach((code: string) => {
|
||||
const cb = document.getElementById("mcs-opstate-" + code) as HTMLInputElement | null;
|
||||
if (cb) cb.checked = true;
|
||||
});
|
||||
}
|
||||
// Reveal HMSP fields if hazmat == yes
|
||||
const hmspFields = document.getElementById("mcs-hmsp-fields") as HTMLDivElement | null;
|
||||
if (hmspFields) hmspFields.hidden = (d.hazmat || "") !== "yes";
|
||||
|
||||
// Prefill IEP section
|
||||
const isIep = document.getElementById("mcs-is-iep") as HTMLInputElement | null;
|
||||
const iepFields = document.getElementById("mcs-iep-fields") as HTMLDivElement | null;
|
||||
if (isIep) isIep.checked = !!d.is_intermodal_equipment_provider;
|
||||
if (iepFields) iepFields.hidden = !d.is_intermodal_equipment_provider;
|
||||
});
|
||||
|
||||
// Save to PWIntake on step-next
|
||||
|
|
@ -323,8 +535,16 @@
|
|||
});
|
||||
|
||||
const val = (id: string) => (document.getElementById(id) as HTMLInputElement)?.value?.trim() || "";
|
||||
const checked = (id: string) => !!(document.getElementById(id) as HTMLInputElement)?.checked;
|
||||
|
||||
// Collect operating states (2-letter codes) from checked checkboxes
|
||||
const operatingStates: string[] = [];
|
||||
document.querySelectorAll<HTMLInputElement>("[id^='mcs-opstate-']").forEach(cb => {
|
||||
if (cb.checked) operatingStates.push(cb.value);
|
||||
});
|
||||
|
||||
const state = PW.get();
|
||||
const intake = {
|
||||
const intake: Record<string, any> = {
|
||||
...state.intake_data,
|
||||
legal_name: val("mcs-legal-name"),
|
||||
dba_name: val("mcs-dba"),
|
||||
|
|
@ -335,19 +555,47 @@
|
|||
address_state: val("mcs-state"),
|
||||
address_zip: val("mcs-zip"),
|
||||
phone: val("mcs-phone"),
|
||||
cell_phone: val("mcs-cell-phone"),
|
||||
fax: val("mcs-fax"),
|
||||
entity_type: val("mcs-entity-type"),
|
||||
carrier_operation: val("mcs-carrier-op"),
|
||||
interstate_intrastate: val("mcs-interstate"),
|
||||
hazmat: val("mcs-hazmat"),
|
||||
reason_for_filing: val("mcs-reason"),
|
||||
usdot_revoked: val("mcs-revoked"),
|
||||
power_units: val("mcs-power-units"),
|
||||
drivers: val("mcs-drivers"),
|
||||
cdl_drivers: val("mcs-cdl-drivers"),
|
||||
primary_vehicle_type: val("mcs-vehicle-type"),
|
||||
annual_miles: val("mcs-miles"),
|
||||
cargo_types: cargoTypes,
|
||||
signer_name: val("mcs-signer-name"),
|
||||
signer_title: val("mcs-signer-title"),
|
||||
ein: val("mcs-ein"),
|
||||
needs_hmsp: checked("mcs-needs-hmsp"),
|
||||
operating_states: operatingStates,
|
||||
hmsp_security_plan: val("mcs-hmsp-security"),
|
||||
is_intermodal_equipment_provider: checked("mcs-is-iep"),
|
||||
iep_owned: val("mcs-iep-owned"),
|
||||
iep_leased: val("mcs-iep-leased"),
|
||||
iep_serviced: val("mcs-iep-serviced"),
|
||||
photo_id_uploaded: !!(window as any).__mcs150PhotoId,
|
||||
};
|
||||
|
||||
// Mailing address: only include when "different" is selected, otherwise omit
|
||||
// (so the filler treats it as same-as-principal).
|
||||
if (val("mcs-mailing-same") === "different") {
|
||||
intake.mailing_street = val("mcs-mailing-street");
|
||||
intake.mailing_city = val("mcs-mailing-city");
|
||||
intake.mailing_state = val("mcs-mailing-state");
|
||||
intake.mailing_zip = val("mcs-mailing-zip");
|
||||
} else {
|
||||
delete intake.mailing_street;
|
||||
delete intake.mailing_city;
|
||||
delete intake.mailing_state;
|
||||
delete intake.mailing_zip;
|
||||
}
|
||||
|
||||
PW.set({ ...state, intake_data: intake });
|
||||
});
|
||||
|
||||
|
|
@ -382,4 +630,25 @@
|
|||
if (idPreview) idPreview.hidden = true;
|
||||
if (idBtn) idBtn.style.display = "flex";
|
||||
});
|
||||
|
||||
// Toggle: mailing address fields shown only when "different" is selected
|
||||
const mailingSameSel = document.getElementById("mcs-mailing-same") as HTMLSelectElement | null;
|
||||
const mailingFieldsDiv = document.getElementById("mcs-mailing-fields") as HTMLDivElement | null;
|
||||
mailingSameSel?.addEventListener("change", () => {
|
||||
if (mailingFieldsDiv) mailingFieldsDiv.hidden = mailingSameSel.value !== "different";
|
||||
});
|
||||
|
||||
// Toggle: hazmat safety permit fields shown only when hazmat == "yes"
|
||||
const hazmatSel = document.getElementById("mcs-hazmat") as HTMLSelectElement | null;
|
||||
const hmspFieldsDiv = document.getElementById("mcs-hmsp-fields") as HTMLDivElement | null;
|
||||
hazmatSel?.addEventListener("change", () => {
|
||||
if (hmspFieldsDiv) hmspFieldsDiv.hidden = hazmatSel.value !== "yes";
|
||||
});
|
||||
|
||||
// Toggle: intermodal equipment provider fields shown only when checkbox is checked
|
||||
const iepCheckbox = document.getElementById("mcs-is-iep") as HTMLInputElement | null;
|
||||
const iepFieldsDiv = document.getElementById("mcs-iep-fields") as HTMLDivElement | null;
|
||||
iepCheckbox?.addEventListener("change", () => {
|
||||
if (iepFieldsDiv) iepFieldsDiv.hidden = !iepCheckbox.checked;
|
||||
});
|
||||
</script>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue