Skip to content

Commit

Permalink
QA Screen changes to add external identifiers, and display informatio…
Browse files Browse the repository at this point in the history
…n in a much better format.
  • Loading branch information
carlsixsmith-moj authored and samgibsonmoj committed Sep 6, 2024
1 parent 8d473d4 commit caf48bb
Show file tree
Hide file tree
Showing 15 changed files with 491 additions and 535 deletions.
1 change: 0 additions & 1 deletion src/Application/Features/Participants/DTOs/ConsentDto.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ public Mapping()
.ForMember(c => c.DocumentId, options => options.MapFrom(source => source.Document!.Id))
.ForMember(c => c.FileName, options => options.MapFrom(source => source.Document!.Title))
.ForMember(c => c.ConsentDate, options => options.MapFrom(source => source.Lifetime.StartDate));

}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using Cfo.Cats.Domain.Entities.Participants;

namespace Cfo.Cats.Application.Features.Participants.DTOs;

public class ExternalIdentifierDto
{
public string Type {get; set;} = default!;
public string Value {get;set;} = default!;

private class Mapping : Profile
{
public Mapping()
{
CreateMap<ExternalIdentifier, ExternalIdentifierDto>(MemberList.None)
.ForMember(x => x.Value, o => o.MapFrom(s => s.Value))
.ForMember(x => x.Type, o => o.MapFrom(s => s.Type.Name));
}
}

}
11 changes: 9 additions & 2 deletions src/Application/Features/Participants/DTOs/ParticipantDto.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,12 @@ public class ParticipantDto

public ParticipantNoteDto[] Notes { get; set; } = [];

public ExternalIdentifierDto[] ExternalIdentifiers {get;set;} = [];

public string TenantId { get; set; } = default!;


public string SupportWorker { get;set; } = default!;

private class Mapping : Profile
{
public Mapping()
Expand All @@ -52,7 +56,10 @@ public Mapping()
options => options.MapFrom(source => source.RightToWorks.ToArray()))
.ForMember(target => target.Notes,
options => options.MapFrom(source => source.Notes.ToArray()))
.ForMember(target => target.TenantId, options => options.MapFrom(s => s.Owner!.TenantId));
.ForMember(target => target.TenantId, options => options.MapFrom(s => s.Owner!.TenantId))
.ForMember(target => target.ExternalIdentifiers, options => options.MapFrom(s => s.ExternalIdentifiers.ToArray()))
#nullable disable
.ForMember(target => target.SupportWorker, options => options.MapFrom(source => source.Owner.DisplayName));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ namespace Cfo.Cats.Application.Features.QualityAssurance.DTOs
#nullable disable
public class EnrolmentQaNoteDto
{
public required DateTime Created {get;set;}
public required string Message { get;set; }
public required string CreatedBy { get;set; }
public required DateTime Created {get; set;}
public required string Message { get; set; }
public required string CreatedBy { get; set; }
public required string TenantName { get; set; }

private class Mapper : Profile
{
Expand All @@ -21,7 +22,8 @@ public Mapper()
CreateMap<Note, EnrolmentQaNoteDto>()
.ForMember(target => target.CreatedBy, options => options.MapFrom(source=>source.CreatedByUser.DisplayName))
.ForMember(target => target.Message, options => options.MapFrom(source => source.Message))
.ForMember(target => target.Created, options => options.MapFrom(source => source.Created));
.ForMember(target => target.Created, options => options.MapFrom(source => source.Created))
.ForMember(target => target.TenantName, options => options.MapFrom(source => source.CreatedByUser.TenantName));
}


Expand Down
2 changes: 1 addition & 1 deletion src/Domain/Common/Enums/EnrolmentStatus.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public SubmittedToProvider()
: base("Submitted to Provider", 1) { }

protected override EnrolmentStatus[] GetAllowedTransitions()
=> [ArchivedStatus, PendingStatus, SubmittedToAuthorityStatus];
=> [ArchivedStatus, EnrolmentConfirmedStatus, SubmittedToAuthorityStatus];

public override bool StatusSupportsReassessment() => false;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
@using Cfo.Cats.Application.Features.Participants.DTOs
@using Cfo.Cats.Server.UI.Pages.Participants.Components
<MudGrid>
<MudItem xs="12">
<RagBar ParticipantId="@ParticipantDto.Id"/>
</MudItem>

@if (ParticipantDto.AssessmentJustification is not null)
{
<MudItem xs="12">
<MudText Typo="Typo.body1">Justification</MudText>
<MudText Typo="Typo.body2">
@ParticipantDto.AssessmentJustification
</MudText>
</MudItem>
}
<MudItem xs="12">
<CaseAssessment ParticipantId="@ParticipantDto.Id"/>
</MudItem>
</MudGrid>

@code {

[Parameter, EditorRequired]
public ParticipantDto ParticipantDto { get; set; } = default!;


}
44 changes: 44 additions & 0 deletions src/Server.UI/Pages/QA/Enrolments/Components/ConsentTabPanel.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
@using Cfo.Cats.Application.Features.Documents.Queries
@using Cfo.Cats.Application.Features.Participants.DTOs


<MudRadioGroup T="Guid" @bind-Value="_selectedDocument">

@foreach (var consent in ParticipantDto.Consents.OrderByDescending(c => c.ConsentDate))
{
<MudRadio T="Guid" Color="Color.Primary" Value="@consent.DocumentId!.Value">
@consent.FileName (@consent.ConsentDate.ToShortDateString())
</MudRadio>
}
</MudRadioGroup>

@if (_selectedDocument != Guid.Empty)
{
<DocumentDisplay DocumentId="_selectedDocument" />

}




@code {

private Guid _selectedDocument = Guid.Empty;

[Parameter] [EditorRequired]
public ParticipantDto ParticipantDto { get; set; } = default!;

protected override void OnInitialized()
{
if (_selectedDocument == Guid.Empty)
{
var latest = ParticipantDto.Consents.MaxBy(c => c.ConsentDate);
if (latest is not null)
{
_selectedDocument = latest.DocumentId.GetValueOrDefault();
}
}
}


}
68 changes: 68 additions & 0 deletions src/Server.UI/Pages/QA/Enrolments/Components/DocumentDisplay.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
@using Cfo.Cats.Application.Features.Documents.Queries
@inherits CatsComponentBase

<MudPaper Class="document-container">
@if (fileBase64 != null && extension!.Equals("pdf", StringComparison.CurrentCultureIgnoreCase))
{
<object data="data:application/pdf;base64,@fileBase64" type="application/pdf" class="full-size-object">
<p>PDF cannot be displayed.</p>
</object>
}
else if (IsFileRejected)
{
<MudText Typo="Typo.caption">
File cannot be displayed. Please contact support.
</MudText>
}
else
{
<MudText Typo="Typo.caption">
Please select a file to display
</MudText>
}
</MudPaper>

@code {

private string? fileBase64;
private string? extension;

private bool IsFileRejected { get; set; }

[Parameter]
public Guid DocumentId { get; set; }

private Guid _previous = Guid.Empty;

protected override async Task OnParametersSetAsync()
{
if (_previous != DocumentId)
{
var query = new GetDocumentById.Query
{
Id = DocumentId
};

var result = await GetNewMediator().Send(query);
if (result.Succeeded)
{
_previous = DocumentId;
IsFileRejected = false;
using (var memoryStream = new MemoryStream())
{
await result.Data!.FileStream.CopyToAsync(memoryStream);
var bytes = memoryStream.ToArray();
fileBase64 = Convert.ToBase64String(bytes);
}
extension = result.Data!.FileExtension;
}
else
{
IsFileRejected = true;
}
}
}



}
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
@using Cfo.Cats.Application.Features.Participants.DTOs
<MudForm>
<MudList T="string">
<MudListSubheader>
<ChildContent>
<MudText Typo="Typo.h5">Participant Confirmation</MudText>
</ChildContent>
</MudListSubheader>
<MudDivider />
@foreach (var item in Participant.ExternalIdentifiers)
{
<MudListItem>
<MudText Typo="Typo.body1">@item.Type</MudText>
<MudText Typo="Typo.body2">@item.Value</MudText>
</MudListItem>
}
<MudListItem>
<MudText Typo="Typo.body1">First Name</MudText>
<MudText Typo="Typo.body2">@Participant.FirstName</MudText>
</MudListItem>
<MudListItem>
<MudText Typo="Typo.body1">Last Name</MudText>
<MudText Typo="Typo.body2">@Participant.LastName</MudText>
</MudListItem>
<MudListItem>
<MudText Typo="Typo.body1">
Date Of Birth
</MudText>
<MudText Typo="Typo.body2">
@Participant.DateOfBirth
</MudText>

</MudListItem>
<MudListItem>
<MudText Typo="Typo.body1">Delivery Location</MudText>
<MudText Typo="Typo.body2">@Participant.EnrolmentLocation?.Name</MudText>
</MudListItem>
@if (Participant.EnrolmentLocationJustification is not null)
{
<MudListItem>
<MudText Typo="Typo.body1">System Location</MudText>
<MudText Typo="Typo.body2"> @Participant.CurrentLocation?.Name</MudText>
</MudListItem>
<MudListItem>
<MudText Typo="Typo.body1">Justification</MudText>
<MudText Typo="Typo.body2"> @Participant.EnrolmentLocationJustification</MudText>
</MudListItem>
}
<MudListSubheader>
<ChildContent>
<MudText Typo="Typo.h5">Staff Member Confirmation</MudText>
</ChildContent>
</MudListSubheader>
<MudDivider />
<MudListItem>
<MudText Typo="Typo.body1">Staff Member</MudText>
<MudText Typo="Typo.body2"> @Participant.SupportWorker</MudText>
</MudListItem>
<MudListItem>
<MudText Typo="Typo.body1">Consent Date</MudText>
<MudText Typo="Typo.body2">@Participant.Consents.Max(c => c.ConsentDate).ToShortDateString()</MudText>
</MudListItem>

</MudList>

</MudForm>

@code{

[Parameter, EditorRequired]
public ParticipantDto Participant { get; set; } = default!;

}
37 changes: 19 additions & 18 deletions src/Server.UI/Pages/QA/Enrolments/Components/QaNotes.razor
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@inherits CatsComponentBase
@inherits CatsComponentBase

@using System.Globalization
@using ActualLab.Fusion.Extensions
Expand All @@ -9,24 +9,25 @@

@if (_notes is { Length: > 0 })
{
<MudTable Items="_notes" Hover="true">
<HeaderContent>
<MudTh>Created By</MudTh>
<MudTh>Created Date</MudTh>
<MudTh>Message</MudTh>
</HeaderContent>
<RowTemplate>
<MudTd DataLabel="Cb">@context.CreatedBy</MudTd>
<MudTd DataLabel="Cd">
<MudTooltip Text="@context.Created.ToString(CultureInfo.InvariantCulture)">
@context.Created.Humanize()
<MudTimeline TimelineOrientation="TimelineOrientation.Vertical" TimelinePosition="TimelinePosition.Start">
@foreach (var note in _notes.OrderByDescending(n => n.Created))
{
<MudTimelineItem Size="Size.Medium" Color="Color.Success" Elevation="25">
<MudTooltip Text="@note.Created.ToLocalTime().ToString("ddd, dd MMM yyyy 'at' HH:mm")">
<MudCard Outlined="false" Elevation="25">
<MudCardContent>
<MudText Typo="Typo.body1">
@note.Message
</MudText>
<MudText Typo="Typo.caption">
@note.CreatedBy (@note.TenantName) @note.Created.Humanize()
</MudText>
</MudCardContent>
</MudCard>
</MudTooltip>
</MudTd>
<MudTd>
@context.Message
</MudTd>
</RowTemplate>
</MudTable>
</MudTimelineItem>
}
</MudTimeline>
}


Expand Down
Loading

0 comments on commit caf48bb

Please sign in to comment.