fix(mcs150): point intake email to per-slug wizard (not sales page) + add Trailers field
The MCS-150 intake-completion email linked customers to /order/dot-compliance, which is the sales/checkout page -- it ignores ?order= and asks the customer to re-pick services and pay again, so they 'cannot enter any data' (Paul Wilson's report). Link to the per-service intake wizard /order/<slug>?order=... instead, which loads the paid order, pre-fills from the FMCSA census, and drops payment. Also add a Trailers field to the DOT intake fleet section and wire it through to the MCS-150 PDF Q26 trailer row, so carriers can update trucks AND trailers.
This commit is contained in:
parent
674979c928
commit
35f204c2b8
3 changed files with 21 additions and 4 deletions
|
|
@ -319,6 +319,11 @@ def fill_mcs150(intake: dict, order_number: str = "") -> str:
|
||||||
intake.get("primary_vehicle_type", "straight"), "straight")
|
intake.get("primary_vehicle_type", "straight"), "straight")
|
||||||
if power_units not in (None, ""):
|
if power_units not in (None, ""):
|
||||||
field_updates[f"{prefix}Own"] = str(power_units)
|
field_updates[f"{prefix}Own"] = str(power_units)
|
||||||
|
# Simple intake also collects a flat trailer count (no owned/leased
|
||||||
|
# breakdown). Default trailers to the Owned column of the trailer row.
|
||||||
|
trailers = intake.get("trailers", "")
|
||||||
|
if trailers not in (None, "", 0, "0"):
|
||||||
|
field_updates["trailerOwn"] = str(trailers)
|
||||||
|
|
||||||
# Non-CMV count, if provided.
|
# Non-CMV count, if provided.
|
||||||
if intake.get("non_cmv_vehicles") not in (None, ""):
|
if intake.get("non_cmv_vehicles") not in (None, ""):
|
||||||
|
|
|
||||||
|
|
@ -200,7 +200,7 @@ class MCS150UpdateHandler:
|
||||||
missing = self._missing_intake_fields(slug, intake)
|
missing = self._missing_intake_fields(slug, intake)
|
||||||
if missing and not client_approved and not admin_approved:
|
if missing and not client_approved and not admin_approved:
|
||||||
self._request_intake_completion(
|
self._request_intake_completion(
|
||||||
order_number, entity_name, customer_email, dot_number, missing)
|
order_number, entity_name, customer_email, dot_number, missing, slug)
|
||||||
LOG.info("[%s] Held for customer intake completion; missing=%s",
|
LOG.info("[%s] Held for customer intake completion; missing=%s",
|
||||||
order_number, missing)
|
order_number, missing)
|
||||||
return []
|
return []
|
||||||
|
|
@ -222,7 +222,7 @@ class MCS150UpdateHandler:
|
||||||
self._persist_intake(order_number, intake)
|
self._persist_intake(order_number, intake)
|
||||||
self._set_fulfillment_status(order_number, "awaiting_intake")
|
self._set_fulfillment_status(order_number, "awaiting_intake")
|
||||||
self._request_intake_completion(
|
self._request_intake_completion(
|
||||||
order_number, entity_name, customer_email, dot_number, missing)
|
order_number, entity_name, customer_email, dot_number, missing, slug)
|
||||||
LOG.info("[%s] Admin-assisted %s held for intake; missing=%s",
|
LOG.info("[%s] Admin-assisted %s held for intake; missing=%s",
|
||||||
order_number, slug, missing)
|
order_number, slug, missing)
|
||||||
return []
|
return []
|
||||||
|
|
@ -521,11 +521,17 @@ class MCS150UpdateHandler:
|
||||||
return missing
|
return missing
|
||||||
|
|
||||||
def _request_intake_completion(self, order_number, entity_name,
|
def _request_intake_completion(self, order_number, entity_name,
|
||||||
customer_email, dot_number, missing):
|
customer_email, dot_number, missing, slug=None):
|
||||||
"""Email the customer a census-pre-filled intake link and create a
|
"""Email the customer a census-pre-filled intake link and create a
|
||||||
low-priority admin todo noting we're waiting on intake completion."""
|
low-priority admin todo noting we're waiting on intake completion."""
|
||||||
domain = os.environ.get("PUBLIC_SITE_URL", "https://performancewest.net").rstrip("/")
|
domain = os.environ.get("PUBLIC_SITE_URL", "https://performancewest.net").rstrip("/")
|
||||||
intake_url = f"{domain}/order/dot-compliance?order={order_number}"
|
# Link to the per-service intake WIZARD (/order/<slug>?order=...), which
|
||||||
|
# loads the existing paid order, pre-fills it from the FMCSA census, and
|
||||||
|
# drops the payment step. Do NOT link to /order/dot-compliance -- that is
|
||||||
|
# the sales/checkout page; it ignores ?order= and asks the customer to
|
||||||
|
# re-select services and pay again (they can't "enter any data" there).
|
||||||
|
intake_slug = slug or self.SERVICE_SLUG
|
||||||
|
intake_url = f"{domain}/order/{intake_slug}?order={order_number}"
|
||||||
|
|
||||||
# Customer email (no paper/mail mechanics; public form names are fine).
|
# Customer email (no paper/mail mechanics; public form names are fine).
|
||||||
try:
|
try:
|
||||||
|
|
|
||||||
|
|
@ -102,8 +102,12 @@
|
||||||
<div class="pw-row-3">
|
<div class="pw-row-3">
|
||||||
<label class="pw-field"><span>Power Units (trucks) <em>*</em></span>
|
<label class="pw-field"><span>Power Units (trucks) <em>*</em></span>
|
||||||
<input type="number" id="dot-power-units" required min="0" placeholder="e.g. 5" /></label>
|
<input type="number" id="dot-power-units" required min="0" placeholder="e.g. 5" /></label>
|
||||||
|
<label class="pw-field"><span>Trailers</span>
|
||||||
|
<input type="number" id="dot-trailers" min="0" placeholder="e.g. 2" /></label>
|
||||||
<label class="pw-field"><span>Drivers <em>*</em></span>
|
<label class="pw-field"><span>Drivers <em>*</em></span>
|
||||||
<input type="number" id="dot-drivers" required min="0" placeholder="e.g. 6" /></label>
|
<input type="number" id="dot-drivers" required min="0" placeholder="e.g. 6" /></label>
|
||||||
|
</div>
|
||||||
|
<div class="pw-row-2">
|
||||||
<label class="pw-field"><span>Annual Miles</span>
|
<label class="pw-field"><span>Annual Miles</span>
|
||||||
<input type="number" id="dot-miles" min="0" placeholder="e.g. 250000" /></label>
|
<input type="number" id="dot-miles" min="0" placeholder="e.g. 250000" /></label>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -441,6 +445,7 @@
|
||||||
"dot-entity-type": d.entity_type || "", "dot-carrier-op": d.carrier_operation || "",
|
"dot-entity-type": d.entity_type || "", "dot-carrier-op": d.carrier_operation || "",
|
||||||
"dot-interstate": d.interstate_intrastate || "", "dot-hazmat": d.hazmat || "",
|
"dot-interstate": d.interstate_intrastate || "", "dot-hazmat": d.hazmat || "",
|
||||||
"dot-power-units": d.power_units || "", "dot-drivers": d.drivers || "",
|
"dot-power-units": d.power_units || "", "dot-drivers": d.drivers || "",
|
||||||
|
"dot-trailers": d.trailers || "",
|
||||||
"dot-miles": d.annual_miles || "", "dot-signer-name": d.signer_name || "",
|
"dot-miles": d.annual_miles || "", "dot-signer-name": d.signer_name || "",
|
||||||
"dot-signer-title": d.signer_title || "", "dot-cdl-drivers": d.cdl_drivers || "",
|
"dot-signer-title": d.signer_title || "", "dot-cdl-drivers": d.cdl_drivers || "",
|
||||||
"dot-owner-ops": d.owner_operators || "0", "dot-der-name": d.der_name || "",
|
"dot-owner-ops": d.owner_operators || "0", "dot-der-name": d.der_name || "",
|
||||||
|
|
@ -508,6 +513,7 @@
|
||||||
entity_type: val("dot-entity-type"), carrier_operation: val("dot-carrier-op"),
|
entity_type: val("dot-entity-type"), carrier_operation: val("dot-carrier-op"),
|
||||||
interstate_intrastate: val("dot-interstate"), hazmat: val("dot-hazmat"),
|
interstate_intrastate: val("dot-interstate"), hazmat: val("dot-hazmat"),
|
||||||
power_units: val("dot-power-units"), drivers: val("dot-drivers"),
|
power_units: val("dot-power-units"), drivers: val("dot-drivers"),
|
||||||
|
trailers: val("dot-trailers"),
|
||||||
annual_miles: val("dot-miles"), cargo_types: cargoTypes,
|
annual_miles: val("dot-miles"), cargo_types: cargoTypes,
|
||||||
signer_name: val("dot-signer-name"), signer_title: val("dot-signer-title"),
|
signer_name: val("dot-signer-name"), signer_title: val("dot-signer-title"),
|
||||||
fleet_size_bracket: val("dot-ucr-bracket"), base_state: val("dot-ucr-state"),
|
fleet_size_bracket: val("dot-ucr-bracket"), base_state: val("dot-ucr-state"),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue