Skip to content

Commit

Permalink
Merge pull request #307 from gaepdit/267-modify-existing-entities-to-…
Browse files Browse the repository at this point in the history
…accommodate-new-data-fields-from-access-db

267 modify existing entities to accommodate new data fields
  • Loading branch information
tom-karasch authored Dec 7, 2023
2 parents 7885cbc + 1897a7d commit 86a7f8f
Show file tree
Hide file tree
Showing 8 changed files with 205 additions and 88 deletions.
3 changes: 3 additions & 0 deletions FMS.Domain/Dto/Facility/FacilityCreateDto.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ public class FacilityCreateDto
[Display(Name = "VRP Referral")]
public bool VRPReferral { get; set; }

[Display(Name = "Has E-Records")]
public bool HasERecord { get; set; }

public void TrimAll()
{
FacilityNumber = FacilityNumber?.Trim();
Expand Down
41 changes: 39 additions & 2 deletions FMS.Domain/Dto/Facility/FacilityDetailDto.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,16 @@ public FacilityDetailDto(Facility facility)
State = facility.State;
PostalCode = facility.PostalCode;
Latitude = facility.Latitude;
Longitude = facility.Longitude;
Longitude = facility.Longitude;
HSInumber = facility.HSInumber;
NonHSILetterDate = facility.NonHSILetterDate;
Comments = facility.Comments;
PreRQSMcleanup = facility.PreRQSMcleanup;
ImageChecked = facility.ImageChecked;
DeferredOnSiteScoring = facility.DeferredOnSiteScoring;
AdditionalDataRequested = facility.AdditionalDataRequested;
VRPReferral = facility.VRPReferral;
HasERecord = facility.HasERecord;
IsRetained = facility.IsRetained;
Cabinets = new List<string>();
RetentionRecords = facility.RetentionRecords?
Expand Down Expand Up @@ -92,7 +101,35 @@ public FacilityDetailDto(Facility facility)

[Display(Name = "Longitude")]
[DisplayFormat(DataFormatString = "{0:F6}")]
public decimal Longitude { get; }
public decimal Longitude { get; }

// The following properties only apply to Release Notifications
[Display(Name = "HSI Number")]
public string HSInumber { get; set; }

[Display(Name = "Non-HSI Letter Date")]
public DateOnly NonHSILetterDate { get; set; }

[Display(Name = "Comments")]
public string Comments { get; set; }

[Display(Name = "Pre-RQSM Cleanup")]
public bool PreRQSMcleanup { get; set; }

[Display(Name = "Image Checked")]
public bool ImageChecked { get; set; }

[Display(Name = "Deferred OnSite Scoring")]
public bool DeferredOnSiteScoring { get; set; }

[Display(Name = "Additional Data Requested")]
public bool AdditionalDataRequested { get; set; }

[Display(Name = "VRP Referral")]
public bool VRPReferral { get; set; }

[Display(Name = "Has Electronic Records")]
public bool HasERecord { get; set; }

[Display(Name = "Is Retained Onsite")]
public bool IsRetained { get; }
Expand Down
5 changes: 5 additions & 0 deletions FMS.Domain/Dto/Facility/FacilitySummaryDto.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public FacilitySummaryDto(Facility facility)
State = facility.State;
PostalCode = facility.PostalCode;
IsRetained = facility.IsRetained;
HasERecord = facility.HasERecord;
Cabinets = new List<string>();
RetentionRecords = facility.RetentionRecords?
.Select(e => new RetentionRecordSummaryDto(e)).ToList()
Expand Down Expand Up @@ -59,6 +60,10 @@ public FacilitySummaryDto(Facility facility)
[Display(Name = "Is Retained Onsite")]
public bool IsRetained { get; }

// Defines if electronic records are availble on Sharepoint
[Display(Name = "Has E-Records")]
public bool HasERecord { get; }

[Display(Name = "Cabinets")]
public List<string> Cabinets { get; set; }

Expand Down
7 changes: 5 additions & 2 deletions FMS.Domain/Entities/Facility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ public Facility(FacilityCreateDto newFacility)
PostalCode = newFacility.PostalCode;
Latitude = newFacility.Latitude ?? 0;
Longitude = newFacility.Longitude ?? 0;
// The following properties only apply to Release Notifications
HSInumber = newFacility.HSInumber;
NonHSILetterDate = newFacility.NonHSILetterDate;
Comments = newFacility.Comments;
Expand All @@ -36,6 +37,7 @@ public Facility(FacilityCreateDto newFacility)
DeferredOnSiteScoring = newFacility.DeferredOnSiteScoring;
AdditionalDataRequested = newFacility.AdditionalDataRequested;
VRPReferral = newFacility.VRPReferral;
HasERecord = newFacility.HasERecord;
}

// Existing ID for Facility May be used by Programs - System Generated, but not a Guid
Expand Down Expand Up @@ -96,11 +98,10 @@ public Facility(FacilityCreateDto newFacility)

public bool IsRetained { get; set; } = true;

// The following properties only apply to Release Notifications
[StringLength(5)]
public string HSInumber { get; set; }

[NotMapped]
[Column(TypeName = "DateOnly")]
public DateOnly NonHSILetterDate { get; set; }

[StringLength(200)]
Expand All @@ -116,6 +117,8 @@ public Facility(FacilityCreateDto newFacility)

public bool VRPReferral { get; set; } = true;

public bool HasERecord { get; set; } = true;


// List of retention records for this Facility
public ICollection<RetentionRecord> RetentionRecords { get; set; }
Expand Down
4 changes: 2 additions & 2 deletions FMS.Infrastructure/Repositories/FacilityRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ public Task<Guid> CreateFacilityAsync(FacilityCreateDto newFacility)
}

if (string.IsNullOrWhiteSpace(newFacility.FileLabel) &&
Data.Counties.All(e => e.Id != newFacility.CountyId))
Data.Counties.TrueForAll(e => e.Id != newFacility.CountyId))
{
throw new ArgumentException($"County ID {newFacility.CountyId} does not exist.");
}
Expand Down Expand Up @@ -240,7 +240,7 @@ public Task UpdateFacilityAsync(Guid id, FacilityEditDto facilityUpdates)
}

if (string.IsNullOrWhiteSpace(facilityUpdates.FileLabel) &&
Data.Counties.All(e => e.Id != facilityUpdates.CountyId))
Data.Counties.TrueForAll(e => e.Id != facilityUpdates.CountyId))
{
throw new ArgumentException($"County ID {facilityUpdates.CountyId} does not exist.");
}
Expand Down
229 changes: 148 additions & 81 deletions FMS/Pages/Facilities/Details.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -31,86 +31,153 @@
<hr />
<partial name="_AlertPartial" for="Message" />

<div class="container">
<dl class="row">
<dt class="col-sm-3">
@Html.DisplayNameFor(model => model.FacilityDetail.Name)
</dt>
<dd class="col-sm-9">
@Html.DisplayFor(model => model.FacilityDetail.Name, "StringOrNone")
</dd>
<dt class="col-sm-3">
@Html.DisplayNameFor(model => model.FacilityDetail.FileLabel)
</dt>
<dd class="col-sm-9">
<a asp-page="/Files/Details" asp-route-id="@Model.FacilityDetail.FileLabel" class="btn btn-outline-info btn-sm">
@Html.DisplayFor(model => model.FacilityDetail.FileLabel)
</a>
</dd>
<dt class="col-sm-3">
@Html.DisplayNameFor(model => model.FacilityDetail.Cabinets)
</dt>
<dd class="col-sm-9">
@Html.DisplayFor(model => model.FacilityDetail.Cabinets, "Cabinets", new {Model.FacilityDetail.IsRetained})
</dd>
<dt class="col-sm-3">
@Html.DisplayNameFor(model => model.FacilityDetail.FacilityStatus)
</dt>
<dd class="col-sm-9">
@Html.DisplayFor(model => model.FacilityDetail.FacilityStatus.Status, "StringOrNone")
</dd>
<dt class="col-sm-3">
@Html.DisplayNameFor(model => model.FacilityDetail.FacilityType)
</dt>
<dd class="col-sm-9">
@Html.DisplayFor(model => model.FacilityDetail.FacilityType.Name, "FacilityTypeIcon")
@Html.DisplayFor(model => model.FacilityDetail.FacilityType.Description, "StringOrNone")
</dd>
<dt class="col-sm-3">
@Html.DisplayNameFor(model => model.FacilityDetail.BudgetCode)
</dt>
<dd class="col-sm-9">
@Html.DisplayFor(model => model.FacilityDetail.BudgetCode.Name, "StringOrNone")
</dd>
<dt class="col-sm-3">
@Html.DisplayNameFor(model => model.FacilityDetail.OrganizationalUnit)
</dt>
<dd class="col-sm-9">
@Html.DisplayFor(model => model.FacilityDetail.OrganizationalUnit.Name, "StringOrNone")
</dd>
<dt class="col-sm-3">
@Html.DisplayNameFor(model => model.FacilityDetail.ComplianceOfficer)
</dt>
<dd class="col-sm-9">
@Html.DisplayFor(model => model.FacilityDetail.ComplianceOfficer.Name, "StringOrNotAssigned")
</dd>
<dt class="col-sm-3">
@Html.DisplayNameFor(model => model.FacilityDetail.Location)
</dt>
<dd class="col-sm-9">
@Html.DisplayFor(model => model.FacilityDetail.Location, "StringOrNone")
</dd>
<dt class="col-sm-3">Address</dt>
<dd class="col-sm-9">
@Html.DisplayFor(model => model.FacilityDetail.Address)<br />
@Html.DisplayFor(model => model.FacilityDetail.City),
@Html.DisplayFor(model => model.FacilityDetail.State)
@Html.DisplayFor(model => model.FacilityDetail.PostalCode)
</dd>
<dt class="col-sm-3">
@Html.DisplayNameFor(model => model.FacilityDetail.County)
</dt>
<dd class="col-sm-9">
@Html.DisplayFor(model => model.FacilityDetail.County.Name, "StringOrNone")
</dd>
<dt class="col-sm-3">
@Html.DisplayNameFor(model => model.FacilityDetail.Latitude)/@Html.DisplayNameFor(model => model.FacilityDetail.Longitude)
</dt>
<dd class="col-sm-9">
@Html.DisplayFor(model => model.FacilityDetail.Latitude),
@Html.DisplayFor(model => model.FacilityDetail.Longitude)
</dd>
</dl>
<div class="container-fluid">
<div class="parent-container d-lg-inline-flex">
<div class="container bg-light-subtle p-3 m-1 rounded-3">
<dl class="row">
<dt class="col-sm-5">
@Html.DisplayNameFor(model => model.FacilityDetail.Name)
</dt>
<dd class="col-sm-7">
@Html.DisplayFor(model => model.FacilityDetail.Name, "StringOrNone")
</dd>
<dt class="col-sm-5">
@Html.DisplayNameFor(model => model.FacilityDetail.FileLabel)
</dt>
<dd class="col-sm-7">
<a asp-page="/Files/Details" asp-route-id="@Model.FacilityDetail.FileLabel" class="btn btn-outline-info btn-sm">
@Html.DisplayFor(model => model.FacilityDetail.FileLabel)
</a>
</dd>
<dt class="col-sm-5">
@Html.DisplayNameFor(model => model.FacilityDetail.Cabinets)
</dt>
<dd class="col-sm-7">
@Html.DisplayFor(model => model.FacilityDetail.Cabinets, "Cabinets", new { Model.FacilityDetail.IsRetained })
</dd>
<dt class="col-sm-5">
@Html.DisplayNameFor(model => model.FacilityDetail.FacilityStatus)
</dt>
<dd class="col-sm-7">
@Html.DisplayFor(model => model.FacilityDetail.FacilityStatus.Status, "StringOrNone")
</dd>
<dt class="col-sm-5">
@Html.DisplayNameFor(model => model.FacilityDetail.FacilityType)
</dt>
<dd class="col-sm-7">
@Html.DisplayFor(model => model.FacilityDetail.FacilityType.Name, "FacilityTypeIcon")
@Html.DisplayFor(model => model.FacilityDetail.FacilityType.Description, "StringOrNone")
</dd>
<dt class="col-sm-5">
@Html.DisplayNameFor(model => model.FacilityDetail.BudgetCode)
</dt>
<dd class="col-sm-7">
@Html.DisplayFor(model => model.FacilityDetail.BudgetCode.Name, "StringOrNone")
</dd>
<dt class="col-sm-5">
@Html.DisplayNameFor(model => model.FacilityDetail.OrganizationalUnit)
</dt>
<dd class="col-sm-7">
@Html.DisplayFor(model => model.FacilityDetail.OrganizationalUnit.Name, "StringOrNone")
</dd>
<dt class="col-sm-5">
@Html.DisplayNameFor(model => model.FacilityDetail.ComplianceOfficer)
</dt>
<dd class="col-sm-7">
@Html.DisplayFor(model => model.FacilityDetail.ComplianceOfficer.Name, "StringOrNotAssigned")
</dd>
<dt class="col-sm-5">
@Html.DisplayNameFor(model => model.FacilityDetail.Location)
</dt>
<dd class="col-sm-7">
@Html.DisplayFor(model => model.FacilityDetail.Location, "StringOrNone")
</dd>
<dt class="col-sm-5">Address</dt>
<dd class="col-sm-7">
@Html.DisplayFor(model => model.FacilityDetail.Address)<br />
@Html.DisplayFor(model => model.FacilityDetail.City),
@Html.DisplayFor(model => model.FacilityDetail.State)
@Html.DisplayFor(model => model.FacilityDetail.PostalCode)
</dd>
<dt class="col-sm-5">
@Html.DisplayNameFor(model => model.FacilityDetail.County)
</dt>
<dd class="col-sm-7">
@Html.DisplayFor(model => model.FacilityDetail.County.Name, "StringOrNone")
</dd>
<dt class="col-sm-5">
@Html.DisplayNameFor(model => model.FacilityDetail.Latitude)/@Html.DisplayNameFor(model => model.FacilityDetail.Longitude)
</dt>
<dd class="col-sm-7">
@Html.DisplayFor(model => model.FacilityDetail.Latitude),
@Html.DisplayFor(model => model.FacilityDetail.Longitude)
</dd>
</dl>
</div>

@if (Model.FacilityDetail.FacilityType.Name == "RN")
{
<div class="container bg-light-subtle p-3 m-1 rounded-3">
<H2>Release Notification Information</H2>
<dl class="row">
<dt class="col-sm-5">
@Html.DisplayNameFor(model => model.FacilityDetail.HSInumber)
</dt>
<dd class="col-sm-7">
@Html.DisplayFor(model => model.FacilityDetail.HSInumber, "StringOrNone")
</dd>
<dt class="col-sm-5">
@Html.DisplayNameFor(model => model.FacilityDetail.NonHSILetterDate)
</dt>
<dd class="col-sm-7">
@Html.DisplayFor(model => model.FacilityDetail.NonHSILetterDate, "MM/dd/yyyy")
</dd>
<dt class="col-sm-5">
@Html.DisplayNameFor(model => model.FacilityDetail.Comments)
</dt>
<dd class="col-sm-7">
@Html.DisplayFor(model => model.FacilityDetail.Comments, "StringOrNone")
</dd>
<dt class="col-sm-5">
@Html.DisplayNameFor(model => model.FacilityDetail.PreRQSMcleanup)
</dt>
<dd class="col-sm-7">
@Html.DisplayFor(model => model.FacilityDetail.PreRQSMcleanup)
</dd>
<dt class="col-sm-5">
@Html.DisplayNameFor(model => model.FacilityDetail.ImageChecked)
</dt>
<dd class="col-sm-7">
@Html.DisplayFor(model => model.FacilityDetail.ImageChecked)
</dd>
<dt class="col-sm-5">
@Html.DisplayNameFor(model => model.FacilityDetail.HasERecord)
</dt>
<dd class="col-sm-7">
@Html.DisplayFor(model => model.FacilityDetail.HasERecord)
</dd>
<dt class="col-sm-5">
@Html.DisplayNameFor(model => model.FacilityDetail.DeferredOnSiteScoring)
</dt>
<dd class="col-sm-7">
@Html.DisplayFor(model => model.FacilityDetail.DeferredOnSiteScoring)
</dd>
<dt class="col-sm-5">
@Html.DisplayNameFor(model => model.FacilityDetail.AdditionalDataRequested)
</dt>
<dd class="col-sm-7">
@Html.DisplayFor(model => model.FacilityDetail.AdditionalDataRequested)
</dd>
<dt class="col-sm-5">
@Html.DisplayNameFor(model => model.FacilityDetail.VRPReferral)
</dt>
<dd class="col-sm-7">
@Html.DisplayFor(model => model.FacilityDetail.VRPReferral)
</dd>
</dl>
</div>
}
</div>

<h2 id="retention-records">Retention Records</h2>
@if (Model.FacilityDetail.RetentionRecords.Count > 0)
Expand All @@ -133,7 +200,7 @@
<tbody>
@foreach (var r in Model.FacilityDetail.RetentionRecords)
{
<tr class="@(r.Id == Model.HighlightRecord ? "table-warning" : "") @(!r.Active ? "text-muted" : "") ">
<tr class ="@(r.Id == Model.HighlightRecord ? "table-warning" : "") @(!r.Active ? "text-muted" : "") ">
<td>@r.StartYear&nbsp;&ndash;&nbsp;@r.EndYear</td>
<td>@r.BoxNumber</td>
<td>@r.ConsignmentNumber</td>
Expand Down
2 changes: 2 additions & 0 deletions FMS/Pages/Facilities/Index.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@
</a>
</th>
<th scope="col" class="text-center">Type</th>
<th scope="col">Online</th>
<th scope="col">Records</th>
</tr>
</thead>
Expand All @@ -225,6 +226,7 @@
@Html.DisplayFor(m => item.PostalCode)
</td>
<td class="text-center">@Html.DisplayFor(m => item.FacilityType.Name, "FacilityTypeIcon")</td>
<td>@Html.DisplayFor(m => item.HasERecord)</td>
<td>
<em class="font-weight-medium">Cabinets:</em><br />
@Html.DisplayFor(m => item.Cabinets, "Cabinets", new {item.IsRetained})
Expand Down
Loading

0 comments on commit 86a7f8f

Please sign in to comment.