Skip to content
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

Case File Details page #212

Merged
merged 13 commits into from
Dec 19, 2024
12 changes: 6 additions & 6 deletions docs/Data-entities/Enforcement-ERD.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,19 @@ erDiagram
string facilityId FK
}

ENF["Enforcement Case"] {
ENF["Case File"] {
int Id PK
string facilityId FK
}

CTE["Enforcement Comment"] {
CTE["Case File Comment"] {
Guid Id PK
int enforcementCaseId FK
int caseFileId FK
}

ACT["Enforcement Action †"] {
Guid Id PK
int enforcementCaseId FK
int caseFileId FK
}

POL["Pollutants & Air Programs ‡"]
Expand Down Expand Up @@ -93,9 +93,9 @@ erDiagram

Columns from the `SSCP_AUDITEDENFORCEMENT` table:

| Column | Type | Migrate | Case | Action | Review |
| Column | Type | Migrate | Case File | Enforcement Action | Action Review |
|----------------------------|---------------|:-------:|-------------------------|-----------------------------|-------------------|
| STRENFORCEMENTNUMBER | numeric(10) | ✓ | Id | EnforcementCase | |
| STRENFORCEMENTNUMBER | numeric(10) | ✓ | Id | CaseFile | |
| STRTRACKINGNUMBER | numeric(10) | ✗ | | | |
| STRAIRSNUMBER | varchar(12) | ✓ | FacilityId | | |
| STRENFORCEMENTFINALIZED | varchar(5) | ✓ | IsClosed, Status | | |
Expand Down
34 changes: 17 additions & 17 deletions docs/Site-map.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,32 +61,32 @@ These pages are only available to logged-in staff.

### Enforcement

* `/Compliance/Enforcement` Enforcement search form.
* `/Compliance/Enforcement/Details/{enforcementId}` Enforcement details.
* `/Enforcement` Enforcement search form.
* `/Enforcement/Details/{enforcementId}` Case File details.

#### Enforcement Case Initiation
#### Case File Initiation

* `/Compliance/Enforcement/Add/{facilityId}` Start new enforcement case for the specified facility.
* `/Compliance/Enforcement/Add/{facilityId}/{entryId}` Start new enforcement case for the specified work entry.
* `/Enforcement/Add?{facilityId}` Start new case file for the specified facility.
* `/Enforcement/Add?{entryId}` Start new case file for the specified compliance entry.

#### Enforcement Case Workflow
#### Case File Workflow

* `/Compliance/Enforcement/Edit/{enforcementId}` Edit enforcement details.
* `/Compliance/Enforcement/[Close|Reopen]/{enforcementId}` Close/reopen an enforcement case.
* `/Compliance/Enforcement/Link/{enforcementId}` Link an enforcement case to a compliance event.
* `/Compliance/Enforcement/[Delete|Restore]/{enforcementId}` Delete/restore an enforcement case.
* `/Enforcement/Edit/{enforcementId}` Edit details.
* `/Enforcement/[Close|Reopen]/{enforcementId}` Close/reopen a case file.
* `/Enforcement/Link/{enforcementId}` Link a case file to a compliance event.
* `/Enforcement/[Delete|Restore]/{enforcementId}` Delete/restore a case file.

#### Enforcement Action Workflow

* `/Compliance/Enforcement/Details/{enforcementId}/Action/{actionId}` View enforcement action details.
* `/Compliance/Enforcement/Details/{enforcementId}/Action/Add` Add an enforcement action to an enforcement case.
* `/Compliance/Enforcement/Details/{enforcementId}/Action/Add/{actionId}` Add an enforcement action linked from another
* `/Enforcement/Details/{enforcementId}/Action/{actionId}` View enforcement action details.
* `/Enforcement/Details/{enforcementId}/Action/Add` Add an enforcement action to a case file.
* `/Enforcement/Details/{enforcementId}/Action/Add/{actionId}` Add an enforcement action linked from another
enforcement action.
* `/Compliance/Enforcement/Details/{enforcementId}/Action/Edit/{actionId}` Edit an enforcement action details.
* `/Compliance/Enforcement/Details/{enforcementId}/Action/RequestReview/{actionId}` Request review for an enforcement action.
* `/Compliance/Enforcement/Details/{enforcementId}/Action/[Approve/Return]/{actionId}` Approve or return an enforcement
* `/Enforcement/Details/{enforcementId}/Action/Edit/{actionId}` Edit an enforcement action details.
* `/Enforcement/Details/{enforcementId}/Action/RequestReview/{actionId}` Request review for an enforcement action.
* `/Enforcement/Details/{enforcementId}/Action/[Approve/Return]/{actionId}` Approve or return an enforcement
action review.
* `/Compliance/Enforcement/Details/{enforcementId}/Action/Issue/{actionId}` Issue (and close) an enforcement action.
* `/Enforcement/Details/{enforcementId}/Action/Issue/{actionId}` Issue (and close) an enforcement action.

## User Account

Expand Down
26 changes: 13 additions & 13 deletions docs/Workflows/Enforcement-workflow.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
# Enforcement Workflow

## Enforcement Case
## Case File

* A new Enforcement Case can be entered from a Facility or Compliance Event.
* An Enforcement Case can be linked to multiple Compliance Events.
* The Enforcement Case can be edited while open.
* Closing/finalizing an Enforcement Case disables all editing.
* Reopening an Enforcement Case enables all editing.
* A new Case File can be entered from a Facility or Compliance Event.
* A Case File can be linked to multiple Compliance Events.
* The Case File can be edited while open.
* Closing/finalizing a Case File disables all editing.
* Reopening a Case File enables all editing.
* Comments can be added and edited.
* A Comment can be deleted *(not shown in diagram)*.
* An Enforcement Case can be deleted *(not shown)*.
* A Case File can be deleted *(not shown)*.

## Enforcement Action

* An Enforcement Action can be added to an open Enforcement Case.
* An Enforcement Action can be edited while the Enforcement Case is open.
* An Enforcement Action can be added to an open Case File.
* An Enforcement Action can be edited while the Case File is open.
* An Enforcement Action can be closed as unsent.
* Issuing an Enforcement Action closes it and disables all editing (including deleting).
* Comments can be added and edited.
Expand All @@ -29,11 +29,11 @@
## Data Exchange

* When an Informal or Formal Enforcement Action (EA) exists and a Compliance Event is linked, the Data Exchange is
enabled for the Enforcement Case *(not shown)*.
enabled for the Case File *(not shown)*.

| Item | ICIS-Air Data Type | Pathway Activity * |
|-------------------------------|:---------------------:|:---------------------------------:|
| Enforcement Case | Case File | |
| Case File | Case File | |
| Compliance Event | Compliance Monitoring | Discovery |
| Notice of Violation | Informal EA | Notification |
| No Further Action Letter | | Addressing & Resolving |
Expand All @@ -45,7 +45,7 @@
| Administrative Order Resolved | | Resolving |

<small>
* Indicates Pathway Activities tracked for each Enforcement Case.
* Indicates Pathway Activities tracked for each Case File.
</small>

## Flow Chart
Expand All @@ -54,7 +54,7 @@
flowchart
EVT{{Compliance Event}}
FAC{{Facility}}
ENF{{"`**Enforcement Case**`"}}
ENF{{"`**Case File**`"}}
CTE{{Enforcement Comment}}
ACT{{"`**Enforcement Action**`"}}
REV{{"Enforcement Action Review"}}
Expand Down
4 changes: 0 additions & 4 deletions src/AppServices/AppServices.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,6 @@
<ProjectReference Include="..\Domain\Domain.csproj"/>
</ItemGroup>

<ItemGroup>
<Folder Include="Enforcement\"/>
</ItemGroup>

<ItemGroup>
<Compile Update="Compliance\WorkEntries\WorkEntryService.Mapping.cs">
<DependentUpon>WorkEntryService.cs</DependentUpon>
Expand Down
13 changes: 13 additions & 0 deletions src/AppServices/AutoMapper/AutoMapperProfile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,16 @@
using AirWeb.AppServices.Compliance.WorkEntries.Reports;
using AirWeb.AppServices.Compliance.WorkEntries.SourceTestReviews;
using AirWeb.AppServices.Compliance.WorkEntries.WorkEntryDto.Query;
using AirWeb.AppServices.Enforcement.Query;
using AirWeb.AppServices.NamedEntities.NotificationTypes;
using AirWeb.AppServices.NamedEntities.Offices;
using AirWeb.AppServices.Staff.Dto;
using AirWeb.Domain.Comments;
using AirWeb.Domain.ComplianceEntities.Fces;
using AirWeb.Domain.ComplianceEntities.WorkEntries;
using AirWeb.Domain.EnforcementEntities.ActionProperties;
using AirWeb.Domain.EnforcementEntities.Actions;
using AirWeb.Domain.EnforcementEntities.Cases;
using AirWeb.Domain.Identity;
using AirWeb.Domain.NamedEntities.NotificationTypes;
using AirWeb.Domain.NamedEntities.Offices;
Expand All @@ -38,6 +42,7 @@ public AutoMapperProfile()
RmpInspections();
SourceTestReviews();
SearchResults();
Enforcement();
}

private void WorkEntries()
Expand Down Expand Up @@ -147,4 +152,12 @@ private void SearchResults()
CreateMap<Fce, FceSearchResultDto>()
.ForMember(dto => dto.FacilityName, expression => expression.Ignore());
}

private void Enforcement()
{
CreateMap<CaseFile, CaseFileViewDto>()
.ForMember(dto => dto.FacilityName, expression => expression.Ignore());
CreateMap<EnforcementAction, EnforcementActionViewDto>();
CreateMap<EnforcementActionReview, ReviewDto>();
}
}
2 changes: 1 addition & 1 deletion src/AppServices/Compliance/Fces/FceCreateDto.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@ public FceCreateDto(FacilityId facilityId, string userId)
[DataType(DataType.MultilineText)]
[StringLength(7000)]
[Display(Name = "Notes")]
public string? Notes { get; init; } = string.Empty;
public string? Notes { get; init; }
}
2 changes: 1 addition & 1 deletion src/AppServices/Compliance/Fces/FceSummaryDto.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ public record FceSummaryDto : IDeletable
{
public int Id { get; init; }

public string FacilityId { get; init; } = default!;
public string FacilityId { get; init; } = null!;
public string? FacilityName { get; set; }

[Display(Name = "FCE Year")]
Expand Down
4 changes: 2 additions & 2 deletions src/AppServices/Compliance/Fces/FceViewDto.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public record FceViewDto : IHasOwnerAndDeletable
{
public int Id { get; init; }

public string FacilityId { get; init; } = default!;
public string FacilityId { get; init; } = null!;
public string? FacilityName { get; set; }

[Display(Name = "FCE Year")]
Expand All @@ -25,7 +25,7 @@ public record FceViewDto : IHasOwnerAndDeletable
[Display(Name = "With on-site inspection")]
public bool OnsiteInspection { get; init; }

public string Notes { get; init; } = string.Empty;
public string Notes { get; init; } = null!;

[UsedImplicitly]
public List<CommentViewDto> Comments { get; } = [];
Expand Down
4 changes: 2 additions & 2 deletions src/AppServices/Compliance/Search/FceExportDto.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public FceExportDto(Fce fce)
FacilityId = fce.FacilityId;
Year = fce.Year;
ReviewedBy = fce.ReviewedBy?.SortableFullName;
DateCompleted = fce.CompletedDate;
CompletedDate = fce.CompletedDate;
Notes = fce.Notes;
Deleted = fce.IsDeleted ? "Deleted" : "No";
}
Expand All @@ -33,7 +33,7 @@ public FceExportDto(Fce fce)
public string? ReviewedBy { get; init; }

[XLColumn(Header = "Date Completed")]
public DateOnly? DateCompleted { get; init; }
public DateOnly? CompletedDate { get; init; }

[XLColumn(Header = "Notes")]
public string? Notes { get; init; }
Expand Down
6 changes: 3 additions & 3 deletions src/AppServices/Compliance/Search/WorkEntryExportDto.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public WorkEntryExportDto(WorkEntry workEntry)
EventDateName = workEntry.EventDateName;
ResponsibleStaff = workEntry.ResponsibleStaff?.SortableFullName;
Closed = workEntry.IsClosed ? "Closed" : "Open";
DateClosed = workEntry.ClosedDate;
ClosedDate = workEntry.ClosedDate;
Notes = workEntry.Notes;
Deleted = workEntry.IsDeleted ? "Deleted" : "No";
}
Expand All @@ -37,7 +37,7 @@ public WorkEntryExportDto(WorkEntry workEntry)
public DateOnly EventDate { get; init; }

[XLColumn(Header = "Event")]
public string EventDateName { get; init; } = string.Empty;
public string EventDateName { get; init; }

[XLColumn(Header = "Staff Responsible")]
public string? ResponsibleStaff { get; init; }
Expand All @@ -46,7 +46,7 @@ public WorkEntryExportDto(WorkEntry workEntry)
public string Closed { get; init; }

[XLColumn(Header = "Date Closed")]
public DateOnly? DateClosed { get; init; }
public DateOnly? ClosedDate { get; init; }

[XLColumn(Header = "Notes")]
public string? Notes { get; init; }
Expand Down
2 changes: 1 addition & 1 deletion src/AppServices/Compliance/Search/WorkEntrySearchDto.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public record WorkEntrySearchDto : IComplianceSearchDto

// == Staff ==

[Display(Name = "Responsible Staff")]
[Display(Name = "Staff Responsible")]
// Guid as string
public string? ResponsibleStaff { get; init; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public record AccCommandDto : WorkEntryCommandDto, IAccCommandDto
[DataType(DataType.Date)]
[DisplayFormat(DataFormatString = "{0:O}", ApplyFormatInEditMode = true)]
[Display(Name = "Date postmarked")]
public DateOnly Postmarked { get; init; } = DateOnly.FromDateTime(DateTime.Today);
public DateOnly PostmarkDate { get; init; } = DateOnly.FromDateTime(DateTime.Today);

[Display(Name = "Postmarked by deadline")]
public bool PostmarkedOnTime { get; init; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ public AccCommandValidator()
.WithMessage("The Received Date cannot be in the future.")
.Must(date => date.Year >= WorkEntry.EarliestWorkEntryYear)
.WithMessage($"The Received Date cannot be earlier than {WorkEntry.EarliestWorkEntryYear}.")
.Must((dto, date) => date >= dto.Postmarked)
.Must((dto, date) => date >= dto.PostmarkDate)
.WithMessage("The Received Date must be later than the Postmark Date.");

RuleFor(dto => dto.Postmarked)
RuleFor(dto => dto.PostmarkDate)
.Must(date => date <= today)
.WithMessage("The Postmark Date cannot be in the future.")
.Must(date => date.Year >= WorkEntry.EarliestWorkEntryYear)
Expand Down
2 changes: 1 addition & 1 deletion src/AppServices/Compliance/WorkEntries/Accs/AccViewDto.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public record AccViewDto : WorkEntryViewDto
public int AccReportingYear { get; init; }

[Display(Name = "Date postmarked")]
public DateOnly Postmarked { get; init; }
public DateOnly PostmarkDate { get; init; }

[Display(Name = "Postmarked by deadline")]
public bool PostmarkedOnTime { get; init; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ public interface IAccCommandDto
{
public DateOnly ReceivedDate { get; }
public int AccReportingYear { get; }
public DateOnly Postmarked { get; }
public DateOnly PostmarkDate { get; }
public bool PostmarkedOnTime { get; }
public bool SignedByRo { get; }
public bool OnCorrectForms { get; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ public record InspectionViewDto : WorkEntryViewDto
public InspectionReason? InspectionReason { get; init; }

[Display(Name = "Weather Conditions")]
public required string WeatherConditions { get; init; }
public string? WeatherConditions { get; init; }

[Display(Name = "Inspection Guides")]
public required string InspectionGuide { get; init; }
public string? InspectionGuide { get; init; }

[Display(Name = "Facility Operating")]
public bool FacilityOperating { get; init; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

public interface ISourceTestReviewCommandDto
{
public DateOnly ReceivedByCompliance { get; }
public DateOnly ReceivedByComplianceDate { get; }
public DateOnly? DueDate { get; }
public bool FollowupTaken { get; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public record SourceTestReviewCommandDto : WorkEntryCommandDto, ISourceTestRevie
[DataType(DataType.Date)]
[DisplayFormat(DataFormatString = "{0:O}", ApplyFormatInEditMode = true)]
[Display(Name = "Date Received By Compliance")]
public DateOnly ReceivedByCompliance { get; init; } = DateOnly.FromDateTime(DateTime.Today);
public DateOnly ReceivedByComplianceDate { get; init; } = DateOnly.FromDateTime(DateTime.Today);

[DataType(DataType.Date)]
[DisplayFormat(DataFormatString = "{0:O}", ApplyFormatInEditMode = true)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ public class SourceTestReviewCommandValidator : AbstractValidator<SourceTestRevi
{
public SourceTestReviewCommandValidator()
{
RuleFor(dto => dto.ReceivedByCompliance)
RuleFor(dto => dto.ReceivedByComplianceDate)
.Must(date => date <= DateOnly.FromDateTime(DateTime.Today))
.WithMessage("The Date Received By Compliance cannot be in the future.");

RuleFor(dto => dto.AcknowledgmentLetterDate)
.Must((dto, date) => date is null || date >= dto.ReceivedByCompliance)
.Must((dto, date) => date is null || date >= dto.ReceivedByComplianceDate)
.WithMessage("The Acknowledgment Letter Date cannot be earlier than the Date Received By Compliance.");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ public record SourceTestReviewViewDto : WorkEntryViewDto
public int ReferenceNumber { get; init; }

[Display(Name = "Date Received")]
public DateOnly ReceivedByCompliance { get; init; }
public DateOnly ReceivedByComplianceDate { get; init; }

[Display(Name = "Test Due Date")]
public DateOnly? DueDate { get; init; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ public record WorkEntryCommandDto : IWorkEntryCommandDto

[DataType(DataType.MultilineText)]
[StringLength(7000)]
public string? Notes { get; init; } = string.Empty;
public string? Notes { get; init; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ public record FeeYearSummaryDto

public decimal Balance { get; init; }

public string Status { get; init; } = string.Empty;
public string Status { get; init; } = null!;
}
Loading
Loading