-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#4434 Added logic to allow users to remove in progress reports from s…
…ubmission list
- Loading branch information
Showing
9 changed files
with
306 additions
and
0 deletions.
There are no files selected for viewing
125 changes: 125 additions & 0 deletions
125
backend/audit/migrations/0015_alter_singleauditchecklist_submission_status_and_more.py
This file contains 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,125 @@ | ||
# Generated by Django 5.1.2 on 2024-12-17 16:56 | ||
|
||
import django.contrib.postgres.fields | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("audit", "0014_alter_sacvalidationwaiver_waiver_types"), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name="singleauditchecklist", | ||
name="submission_status", | ||
field=models.CharField( | ||
choices=[ | ||
("in_progress", "In Progress"), | ||
("flagged_for_removal", "Flagged for Removal"), | ||
("ready_for_certification", "Ready for Certification"), | ||
("auditor_certified", "Auditor Certified"), | ||
("auditee_certified", "Auditee Certified"), | ||
("certified", "Certified"), | ||
("submitted", "Submitted"), | ||
("disseminated", "Disseminated"), | ||
], | ||
default="in_progress", | ||
), | ||
), | ||
migrations.AlterField( | ||
model_name="singleauditchecklist", | ||
name="transition_name", | ||
field=django.contrib.postgres.fields.ArrayField( | ||
base_field=models.CharField( | ||
choices=[ | ||
("in_progress", "In Progress"), | ||
("flagged_for_removal", "Flagged for Removal"), | ||
("ready_for_certification", "Ready for Certification"), | ||
("auditor_certified", "Auditor Certified"), | ||
("auditee_certified", "Auditee Certified"), | ||
("certified", "Certified"), | ||
("submitted", "Submitted"), | ||
("disseminated", "Disseminated"), | ||
], | ||
max_length=40, | ||
), | ||
blank=True, | ||
default=list, | ||
null=True, | ||
size=None, | ||
), | ||
), | ||
migrations.AlterField( | ||
model_name="submissionevent", | ||
name="event", | ||
field=models.CharField( | ||
choices=[ | ||
("access-granted", "Access granted"), | ||
("additional-eins-updated", "Additional EINs updated"), | ||
("additional-eins-deleted", "Additional EINs deleted"), | ||
("additional-ueis-updated", "Additional UEIs updated"), | ||
("additional-ueis-deleted", "Additional UEIs deleted"), | ||
("audit-information-updated", "Audit information updated"), | ||
("audit-report-pdf-updated", "Audit report PDF updated"), | ||
( | ||
"auditee-certification-completed", | ||
"Auditee certification completed", | ||
), | ||
( | ||
"auditor-certification-completed", | ||
"Auditor certification completed", | ||
), | ||
( | ||
"corrective-action-plan-updated", | ||
"Corrective action plan updated", | ||
), | ||
( | ||
"corrective-action-plan-deleted", | ||
"Corrective action plan deleted", | ||
), | ||
("created", "Created"), | ||
("federal-awards-updated", "Federal awards updated"), | ||
( | ||
"federal-awards-audit-findings-updated", | ||
"Federal awards audit findings updated", | ||
), | ||
( | ||
"federal-awards-audit-findings-deleted", | ||
"Federal awards audit findings deleted", | ||
), | ||
( | ||
"federal-awards-audit-findings-text-updated", | ||
"Federal awards audit findings text updated", | ||
), | ||
( | ||
"federal-awards-audit-findings-text-deleted", | ||
"Federal awards audit findings text deleted", | ||
), | ||
( | ||
"findings-uniform-guidance-updated", | ||
"Findings uniform guidance updated", | ||
), | ||
( | ||
"findings-uniform-guidance-deleted", | ||
"Findings uniform guidance deleted", | ||
), | ||
("general-information-updated", "General information updated"), | ||
("locked-for-certification", "Locked for certification"), | ||
("unlocked-after-certification", "Unlocked after certification"), | ||
("notes-to-sefa-updated", "Notes to SEFA updated"), | ||
("secondary-auditors-updated", "Secondary auditors updated"), | ||
("secondary-auditors-deleted", "Secondary auditors deleted"), | ||
("submitted", "Submitted to the FAC for processing"), | ||
("disseminated", "Copied to dissemination tables"), | ||
("tribal-consent-updated", "Tribal audit consent updated"), | ||
( | ||
"flagged-submission-for-removal", | ||
"Flagged submission for removal", | ||
), | ||
("cancel-removal-flag", "Cancel removal flag"), | ||
] | ||
), | ||
), | ||
] |
This file contains 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 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 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 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
29 changes: 29 additions & 0 deletions
29
backend/audit/templates/audit/remove-submission-in-progress.html
This file contains 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,29 @@ | ||
{% extends "base.html" %} | ||
{% load static %} | ||
{% load sprite_helper %} | ||
|
||
{% block content %} | ||
<div class="grid-container margin-y-8"> | ||
<h1 class="font-sans-xl">Confirm Report Removal</h1> | ||
<p class="text-base-darker margin-bottom-2">Are you sure you want to remove the following report?</p> | ||
|
||
<div class="usa-card"> | ||
<div class="usa-card__body"> | ||
<ul class="usa-list usa-list--unstyled"> | ||
<li><strong>Auditee UEI:</strong> {{ auditee_uei }}</li> | ||
<li><strong>Auditee Name:</strong> {{ auditee_name }}</li> | ||
<li><strong>Report ID:</strong> {{ report_id }}</li> | ||
<li><strong>Fiscal Period End Date:</strong> {{ fiscal_year_end_date }}</li> | ||
</ul> | ||
</div> | ||
</div> | ||
|
||
<form method="post" class="margin-top-6"> | ||
{% csrf_token %} | ||
<div class="usa-button-group"> | ||
<button type="submit" class="usa-button usa-button--danger">Remove Report</button> | ||
<a href="{% url 'audit:MySubmissions' %}" class="usa-button usa-button--unstyled text-bold">Return to Submissions</a> | ||
</div> | ||
</form> | ||
</div> | ||
{% endblock content %} |
This file contains 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 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 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,64 @@ | ||
import logging | ||
from django.shortcuts import redirect, render, reverse | ||
from django.views import generic | ||
from django.core.exceptions import PermissionDenied | ||
|
||
from audit.mixins import ( | ||
SingleAuditChecklistAccessRequiredMixin, | ||
) | ||
from audit.models import ( | ||
Access, | ||
SingleAuditChecklist, | ||
) | ||
from audit.views.views import verify_status | ||
from audit.models.models import STATUS | ||
from audit.models.viewflow import SingleAuditChecklistFlow | ||
|
||
logger = logging.getLogger(__name__) | ||
|
||
|
||
class RemoveSubmissionView(SingleAuditChecklistAccessRequiredMixin, generic.View): | ||
""" | ||
View for removing an audit. | ||
""" | ||
|
||
template = "audit/remove-submission-in-progress.html" | ||
|
||
@verify_status(STATUS.IN_PROGRESS) | ||
def get(self, request, *args, **kwargs): | ||
""" | ||
Show the audit to be removed and confirmation form. | ||
""" | ||
report_id = kwargs["report_id"] | ||
sac = SingleAuditChecklist.objects.get(report_id=report_id) | ||
|
||
if not Access.objects.filter( | ||
email=request.user.email, sac=sac, role="editor" | ||
).exists(): | ||
raise PermissionDenied("Only authorized auditors can remove audits.") | ||
|
||
context = { | ||
"auditee_uei": sac.general_information["auditee_uei"], | ||
"auditee_name": sac.general_information.get("auditee_name"), | ||
"report_id": sac.report_id, | ||
"fiscal_year_end_date": sac.general_information.get( | ||
"auditee_fiscal_period_end" | ||
), | ||
} | ||
|
||
return render(request, self.template, context) | ||
|
||
@verify_status(STATUS.IN_PROGRESS) | ||
def post(self, request, *args, **kwargs): | ||
""" | ||
Remove the audit and redirect to the audits list. | ||
""" | ||
report_id = kwargs["report_id"] | ||
sac = SingleAuditChecklist.objects.get(report_id=report_id) | ||
|
||
flow = SingleAuditChecklistFlow(sac) | ||
flow.transition_to_flagged_for_removal() | ||
sac.save() | ||
url = reverse("audit:MySubmissions") | ||
|
||
return redirect(url) |