-
Notifications
You must be signed in to change notification settings - Fork 0
Add existing case confirmation flow #146
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
nonprofittechy
wants to merge
2
commits into
workflow/filing-path-upload
from
workflow/case-confirmation
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| from django.db import migrations, models | ||
|
|
||
|
|
||
| class Migration(migrations.Migration): | ||
| dependencies = [("efile", "0003_branch_aware_workflow")] | ||
|
|
||
| operations = [ | ||
| migrations.AddField( | ||
| model_name="filingdraft", | ||
| name="case_title", | ||
| field=models.CharField(blank=True, max_length=500), | ||
| ), | ||
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,86 @@ | ||
| (function() { | ||
| const form = document.getElementById("case-lookup-form"); | ||
| if (!form) return; | ||
|
|
||
| const courtSelect = document.getElementById("court"); | ||
| const caseNumber = document.getElementById("case-number"); | ||
| const state = document.getElementById("lookup-state"); | ||
| const errorBox = document.getElementById("lookup-error"); | ||
| const submitButton = document.getElementById("find-case-button"); | ||
| const guessedCourt = JSON.parse(document.getElementById("guessed-court").textContent || '""'); | ||
| const selectedCourtCode = JSON.parse(document.getElementById("selected-court-code").textContent || '""'); | ||
|
|
||
| async function loadCourts() { | ||
| try { | ||
| const response = await apiUtils.fetchJSON("/api/dropdowns/courts/", "GET", { | ||
| jurisdiction: apiUtils.getCurrentJurisdiction(), | ||
| guessed_court: guessedCourt, | ||
| }); | ||
| if (!response.success) throw new Error(response.error || "Could not load courts."); | ||
| courtSelect.innerHTML = '<option value="">Choose a court</option>'; | ||
| response.data.forEach((court) => { | ||
| const option = document.createElement("option"); | ||
| option.value = court.value; | ||
| option.textContent = court.text; | ||
| if (court.value === selectedCourtCode || (!selectedCourtCode && (court.selected || court.default))) { | ||
| option.selected = true; | ||
| } | ||
| courtSelect.appendChild(option); | ||
| }); | ||
| } catch (error) { | ||
| courtSelect.innerHTML = '<option value="">Courts could not be loaded</option>'; | ||
| errorBox.textContent = error.message; | ||
| errorBox.hidden = false; | ||
| } | ||
| } | ||
|
|
||
| form.addEventListener("submit", async (event) => { | ||
| event.preventDefault(); | ||
| errorBox.hidden = true; | ||
| state.hidden = false; | ||
| submitButton.disabled = true; | ||
|
|
||
| try { | ||
| const jurisdiction = apiUtils.getCurrentJurisdiction(); | ||
| const lookup = await apiUtils.fetchJSON("/api/suffolk/lookup-case/", "GET", { | ||
| court: courtSelect.value, | ||
| caseNumber: caseNumber.value.trim(), | ||
| jurisdiction, | ||
| }); | ||
| if (!lookup.success || !lookup.caseInfo?.caseTrackingID) { | ||
| throw new Error(lookup.error || "We could not find a matching case. Check the court and case number."); | ||
| } | ||
|
|
||
| const selectedCourt = courtSelect.selectedOptions[0]; | ||
| const caseInfo = lookup.caseInfo; | ||
| const saveResponse = await fetch(window.location.href, { | ||
| method: "POST", | ||
| headers: { | ||
| "Content-Type": "application/json", | ||
| "X-CSRFToken": apiUtils.getCSRFToken(), | ||
| }, | ||
| body: JSON.stringify({ | ||
| court: courtSelect.value, | ||
| court_name: selectedCourt?.textContent?.replace(" (Recommended)", "") || "", | ||
| case_tracking_id: caseInfo.caseTrackingID, | ||
| case_docket_id: caseInfo.caseDocketID || caseNumber.value.trim(), | ||
| case_title: caseInfo.caseTitle || "", | ||
| case_category_code: caseInfo.caseCategoryCode || "", | ||
| case_category_name: caseInfo.caseCategoryName || "", | ||
| case_type_code: caseInfo.caseTypeCode || "", | ||
| case_type_name: caseInfo.caseTypeName || "", | ||
| }), | ||
| }); | ||
| const saved = await saveResponse.json(); | ||
| if (!saveResponse.ok || !saved.success) throw new Error(saved.error || "Could not save the case."); | ||
| window.location.href = saved.redirect_url; | ||
| } catch (error) { | ||
| errorBox.textContent = error.message; | ||
| errorBox.hidden = false; | ||
| state.hidden = true; | ||
| submitButton.disabled = false; | ||
| } | ||
| }); | ||
|
|
||
| loadCourts(); | ||
| })(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,83 @@ | ||
| {% extends "efile/workflow_base.html" %} | ||
| {% load i18n %} | ||
| {% block title %} | ||
| {% translate "Confirm your court case" %} | ||
| {% endblock title %} | ||
| {% block workflow_content %} | ||
| <section class="workflow-card workflow-card--narrow"> | ||
| <div class="workflow-eyebrow">{% translate "Confirm case" %}</div> | ||
| <div class="found-heading"> | ||
| <span class="found-heading__icon"><i class="fa-solid fa-check"></i></span> | ||
| <div> | ||
| <h1>{% translate "Is this your court case?" %}</h1> | ||
| <p class="workflow-lede">{% translate "Check the details before adding this filing to the case." %}</p> | ||
| </div> | ||
| </div> | ||
| <dl class="case-summary"> | ||
| <div class="case-summary__primary"> | ||
| <dt>{% translate "Case name" %}</dt> | ||
| <dd> | ||
| {% if case.case_title %} | ||
| {{ case.case_title }} | ||
| {% else %} | ||
| {% translate "Case title not available" %} | ||
| {% endif %} | ||
| </dd> | ||
| </div> | ||
| <div> | ||
| <dt>{% translate "Case number" %}</dt> | ||
| <dd> | ||
| {{ case.docket_number }} | ||
| </dd> | ||
| </div> | ||
| <div> | ||
| <dt>{% translate "Court" %}</dt> | ||
| <dd> | ||
| {{ case.court_name|default:case.court_code }} | ||
| </dd> | ||
| </div> | ||
| <div> | ||
| <dt>{% translate "Case category" %}</dt> | ||
| <dd> | ||
| {% if case.case_category_name %} | ||
| {{ case.case_category_name }} | ||
| {% elif case.case_category_code %} | ||
| {{ case.case_category_code }} | ||
| {% else %} | ||
| {% translate "Not available" %} | ||
| {% endif %} | ||
| </dd> | ||
| </div> | ||
|
Copilot marked this conversation as resolved.
|
||
| <div> | ||
| <dt>{% translate "Case type" %}</dt> | ||
| <dd> | ||
| {% if case.case_type_name %} | ||
| {{ case.case_type_name }} | ||
| {% elif case.case_type_code %} | ||
| {{ case.case_type_code }} | ||
| {% else %} | ||
| {% translate "Not available" %} | ||
| {% endif %} | ||
| </dd> | ||
| </div> | ||
| </dl> | ||
| <form method="post"> | ||
| {% csrf_token %} | ||
| <div class="confirmation-question"> | ||
| <strong>{% translate "Does this match your case?" %}</strong> | ||
| <p>{% translate "Choosing Yes will attach your documents to this case." %}</p> | ||
| </div> | ||
| <div class="workflow-actions workflow-actions--confirmation"> | ||
| <button class="btn btn-outline-secondary" | ||
| type="submit" | ||
| name="confirmed" | ||
| value="no"> | ||
| <i class="fa-solid fa-arrow-left"></i> {% translate "No, search again" %} | ||
| </button> | ||
| <button class="btn btn-primary" type="submit" name="confirmed" value="yes"> | ||
| {% translate "Yes, this is my case" %} <i class="fa-solid fa-arrow-right"></i> | ||
| </button> | ||
| </div> | ||
| </form> | ||
| </section> | ||
| {% endblock workflow_content %} | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.