From a74d7c1a59a4700bda7feb705f611dc314e25919 Mon Sep 17 00:00:00 2001 From: Quinten Steenhuis Date: Fri, 9 Oct 2026 18:03:29 -0400 Subject: [PATCH 1/3] Defer existing-case details until court lookup and confirmation --- .../efile/static/js/extraction-review.js | 52 +++- .../templates/efile/extraction_review.html | 230 +++++++++--------- .../efile/tests/test_case_confirmation.py | 57 +++++ .../tests/test_filing_path_navigation.py | 4 +- efile_app/efile/views/extraction_review.py | 73 +++--- 5 files changed, 263 insertions(+), 153 deletions(-) diff --git a/efile_app/efile/static/js/extraction-review.js b/efile_app/efile/static/js/extraction-review.js index a596e93b..e212d9c5 100644 --- a/efile_app/efile/static/js/extraction-review.js +++ b/efile_app/efile/static/js/extraction-review.js @@ -5,6 +5,10 @@ const context = JSON.parse(contextEl.textContent); const guesses = context.guesses || {}; + + function isExisting() { + return form.querySelector('input[name="existing_case"]:checked')?.value === "existing"; + } const errorBox = document.getElementById("extraction-review-error"); const acknowledgement = document.getElementById("reviewed_extraction"); const acknowledgementError = document.getElementById("reviewed-extraction-error"); @@ -53,7 +57,9 @@ const availability = window.filingAvailability.mount({ form, notice: document.getElementById("filing-availability-notice"), - selection: () => ({ + selection: () => isExisting() ? ({ + jurisdiction: context.jurisdiction + }) : ({ jurisdiction: context.jurisdiction, court: fields.court.select.value, case_category_name: apiUtils.selectedOptionText(fields.case_category.select), @@ -580,7 +586,7 @@ form.querySelectorAll('input[name="existing_case"]').forEach((radio) => { radio.addEventListener("change", () => { if (applyingSearch) return; - if (fields.court.select.value) loadList("case_category"); + if (!isExisting() && fields.court.select.value) loadList("case_category"); }); }); @@ -658,7 +664,18 @@ function updateDocketNumberVisibility() { const existingCase = form.querySelector('input[name="existing_case"]:checked')?.value; - docketField.hidden = existingCase !== "existing"; + docketField.hidden = true; + const existing = existingCase === "existing"; + const details = document.getElementById("new-case-details"); + details.hidden = existing; + details.disabled = existing; + const parties = document.getElementById("review-parties"); + if (parties) { + parties.hidden = existing; + parties.disabled = existing; + } + document.getElementById("existing-case-next").hidden = !existing; + availability.check(); } form.querySelectorAll('input[name="existing_case"]').forEach((radio) => { @@ -694,6 +711,7 @@ } form.addEventListener("submit", (event) => { + if (isExisting()) return; if (blockUnfinished(event)) return; const isNew = form.querySelector('input[name="existing_case"]:checked')?.value === "new"; const missingCase = isNew && (!fields.court.select.value || !fields.case_category.select.value || !fields.case_type.select.value); @@ -775,13 +793,25 @@ // The guard blocks until a check runs. A guided selector with no court // chosen yet fires no change, so check once the courts are in place. - loadCourts().finally(() => { - availability.check(); - window.filingCodeSearch?.mount({ - jurisdiction: context.jurisdiction, - existingCase: existingCaseWire, - applyPath: applySearchPath, - zipShortcuts: context.zip_shortcuts || [], + let newCaseStarted = false; + + function startNewCase() { + if (isExisting()) { + availability.check(); + return; + } + if (newCaseStarted) return; + newCaseStarted = true; + loadCourts().finally(() => { + availability.check(); + window.filingCodeSearch?.mount({ + jurisdiction: context.jurisdiction, + existingCase: existingCaseWire, + applyPath: applySearchPath, + zipShortcuts: context.zip_shortcuts || [], + }); }); - }); + } + form.querySelectorAll('input[name="existing_case"]').forEach(radio => radio.addEventListener("change", startNewCase)); + startNewCase(); })(); \ No newline at end of file diff --git a/efile_app/efile/templates/efile/extraction_review.html b/efile_app/efile/templates/efile/extraction_review.html index 92dda9c0..df6fb0ba 100644 --- a/efile_app/efile/templates/efile/extraction_review.html +++ b/efile_app/efile/templates/efile/extraction_review.html @@ -141,7 +141,9 @@

{% translate "Confirm information" %}

view reads back stay index-aligned. {% endcomment %} {% if show_party_editor %} -
+
{% translate "People named in your document" %}

{% if party_rows %} @@ -385,9 +387,7 @@

{% translate "Questions about your filing" %}

asked for at all: a new case has none until the court opens it, and an existing case's title comes from the court once it is found. {% endcomment %} -
+
- {% include "efile/components/filing_code_search.html" %} -
-
- {{ court_label }} -