From 23131b851609fe99cf5e229bd2e5c23eb1db6d51 Mon Sep 17 00:00:00 2001 From: PaulCooperWorkJustice Date: Mon, 2 Sep 2024 14:46:37 +0100 Subject: [PATCH 1/7] CFODEV-537: Display uploaded file details. --- .../Pages/Enrolments/Components/Consent.razor | 27 ++++++++++++++----- .../Enrolments/Components/RightToWork.razor | 15 ++++++++++- .../Components/RightToWorkDialog.razor | 14 ++++++++++ 3 files changed, 48 insertions(+), 8 deletions(-) diff --git a/src/Server.UI/Pages/Enrolments/Components/Consent.razor b/src/Server.UI/Pages/Enrolments/Components/Consent.razor index 6de1c9d5..03d78ccb 100644 --- a/src/Server.UI/Pages/Enrolments/Components/Consent.razor +++ b/src/Server.UI/Pages/Enrolments/Components/Consent.razor @@ -10,7 +10,7 @@ if (ConsentDto is not null && ConsentDto.Length > 0) { - Consent documentation already uploaded + Consent documentation already uploaded: @@ -56,10 +56,25 @@ { @ConstantString.Upload } + - - + +
+ @if (context != null) + { + + Consent documentation uploaded: @context.Name + + } + else + { + No Files + } +
+
+ + - } - + } } @code { @@ -123,5 +137,4 @@ return false; } } - -} +} \ No newline at end of file diff --git a/src/Server.UI/Pages/Enrolments/Components/RightToWork.razor b/src/Server.UI/Pages/Enrolments/Components/RightToWork.razor index 4c1df858..b93e9564 100644 --- a/src/Server.UI/Pages/Enrolments/Components/RightToWork.razor +++ b/src/Server.UI/Pages/Enrolments/Components/RightToWork.razor @@ -88,6 +88,20 @@ } + +
+ @if (context != null) + { + + Right To Work supporting documentation uploaded: @context.Name + + } + else + { + No Files + } +
+
} @@ -138,5 +152,4 @@ return false; } } - } \ No newline at end of file diff --git a/src/Server.UI/Pages/Participants/Components/RightToWorkDialog.razor b/src/Server.UI/Pages/Participants/Components/RightToWorkDialog.razor index e7197192..5d66db89 100644 --- a/src/Server.UI/Pages/Participants/Components/RightToWorkDialog.razor +++ b/src/Server.UI/Pages/Participants/Components/RightToWorkDialog.razor @@ -65,6 +65,20 @@ } + +
+ @if (context != null) + { + + Right To Work supporting documentation uploaded: @context.Name + + } + else + { + No Files + } +
+
} From 335be3958c16cc960a2049b092428d9d961904cf Mon Sep 17 00:00:00 2001 From: PaulCooperWorkJustice Date: Wed, 4 Sep 2024 08:40:26 +0100 Subject: [PATCH 2/7] Consent forms will only be loaded once now. Prevent editing submitted enrolments. --- .../Pages/Enrolments/Components/Consent.razor | 115 ++++++------- .../Pages/Enrolments/Enrolment.razor | 152 ++++++++++-------- 2 files changed, 142 insertions(+), 125 deletions(-) diff --git a/src/Server.UI/Pages/Enrolments/Components/Consent.razor b/src/Server.UI/Pages/Enrolments/Components/Consent.razor index 03d78ccb..2172a271 100644 --- a/src/Server.UI/Pages/Enrolments/Components/Consent.razor +++ b/src/Server.UI/Pages/Enrolments/Components/Consent.razor @@ -23,75 +23,75 @@ }
- - - Add New - } else { - + -
- - - - @if (_uploading) - { - @ConstantString.Uploading - } - else - { - @ConstantString.Upload - } - - - - -
- @if (context != null) +
+ + + @if (Model.Document == null || consentUploaded) + { + + @if (_uploading) { - - Consent documentation uploaded: @context.Name - + @ConstantString.Uploading } else { + @ConstantString.Upload + } + + } + + +
+ @if (@Model.Document==null) + { No Files + + } + else + { + + Consent documentation uploaded: @Model.Document.Name + } -
-
-
+
+ + - - @foreach (var version in Documents.Consent.Versions) - { - Version @version - } - -
+ + @foreach (var version in Documents.Consent.Versions) + { + Version @version + } + +
- -
- } + + + } } @code { @@ -105,11 +105,13 @@ private MudForm? form { get; set; } + private bool consentUploaded; + public async Task Validate() { try { - if (ConsentDto is not null && ConsentDto.Length > 0) + if (ConsentDto is not null && ConsentDto.Length > 0 || consentUploaded) { return true; } @@ -123,6 +125,7 @@ if (result.Succeeded) { Snackbar.Add("Consent form uploaded", Severity.Success); + consentUploaded = true; } else { diff --git a/src/Server.UI/Pages/Enrolments/Enrolment.razor b/src/Server.UI/Pages/Enrolments/Enrolment.razor index 37330388..518ca7cb 100644 --- a/src/Server.UI/Pages/Enrolments/Enrolment.razor +++ b/src/Server.UI/Pages/Enrolments/Enrolment.razor @@ -6,6 +6,7 @@ @using Cfo.Cats.Application.Features.Participants.Commands @using Cfo.Cats.Application.Features.Participants.DTOs @using Cfo.Cats.Application.Features.Participants.Queries +@using Cfo.Cats.Domain.Common.Enums @attribute [Authorize] @@ -22,76 +23,85 @@ } - - - - Enrolling @_participant?.FirstName @_participant?.LastName - (DOB @_participant?.DateOfBirth) - at @_participant?.CurrentLocation.Name - - - - - - - @* You can render content here, and it will always be displayed. *@ - - - - - - - - - - - - - - - - Enrolment Started! - - - Further information is required to finalise this enrolment. - Would you like to continue now? - - - You can finalise the enrolment at a later time by visiting the cases screen. - - - - - - @if (Stepper?.IsResultStep is false) - { - - - } - else - { - Return to Search - - Continue - } - - - - +@if(_participant is not null) +{ + + + + Enrolling @_participant.FirstName @_participant.LastName + (DOB @_participant.DateOfBirth) + at @_participant.CurrentLocation.Name + + + + @if(_participant.EnrolmentStatus == EnrolmentStatus.PendingStatus) + { + + + + @* You can render content here, and it will always be displayed. *@ + + + + + + + + + + + + + + + + Enrolment Started! + + + Further information is required to finalise this enrolment. + Would you like to continue now? + + + You can finalise the enrolment at a later time by visiting the cases screen. + + + + + + @if (Stepper?.IsResultStep is false) + { + + + } + else + { + Return to Search + + Continue + } + + + } + else + { + Enrolment already found. + } + + +} @code { - private ParticipantDto? _participant; [Parameter] @@ -151,6 +161,11 @@ } } + private async Task ConsentAdded() + { + await Task.CompletedTask; + } + private async void StepChanged(int index) { if(Stepper is not { IsResultStep: true }) @@ -207,5 +222,4 @@ { return await Task.FromResult(true); } - } \ No newline at end of file From 20849d4a8ed55a43721f6122241725b2c2837ac6 Mon Sep 17 00:00:00 2001 From: VS Date: Thu, 5 Sep 2024 08:39:57 +0100 Subject: [PATCH 3/7] added a menuitem 'Add Consent' to Participant screen>Action menu, onclick it shows a dialog which llow a user to add Consent outside of the enrolment process --- .../Constants/ConstantString.cs | 4 +- .../Components/ConsentDialog.razor | 124 ++++++++++++++++++ .../Components/ParticipantActionMenu.razor | 23 ++++ 3 files changed, 150 insertions(+), 1 deletion(-) create mode 100644 src/Server.UI/Pages/Participants/Components/ConsentDialog.razor diff --git a/src/Infrastructure/Constants/ConstantString.cs b/src/Infrastructure/Constants/ConstantString.cs index 0d832618..6d9b59c0 100644 --- a/src/Infrastructure/Constants/ConstantString.cs +++ b/src/Infrastructure/Constants/ConstantString.cs @@ -121,5 +121,7 @@ public static string Localize(string key) public static string AddRightToWork => Localize("Add RTW"); public static string RightToWork => -Localize("Right To Work"); + Localize("Right To Work"); + public static string AddConsent => + Localize("Ad Consent"); } diff --git a/src/Server.UI/Pages/Participants/Components/ConsentDialog.razor b/src/Server.UI/Pages/Participants/Components/ConsentDialog.razor new file mode 100644 index 00000000..9662b1b2 --- /dev/null +++ b/src/Server.UI/Pages/Participants/Components/ConsentDialog.razor @@ -0,0 +1,124 @@ +@using Cfo.Cats.Application.Features.Participants.Commands +@inherits CatsComponentBase + +@inject IValidationService Validator + + + + @if (Model is not null) + { + + + + +
+ + + + @if (_uploading) + { + @ConstantString.Uploading + } + else + { + @ConstantString.Upload + } + + + + + + @foreach (var version in Documents.Consent.Versions) + { + Version @version + } + +
+ + +
+ } +
+ + @ConstantString.Cancel + + @if (_saving) + { + @ConstantString.Saving + } + else + { + @ConstantString.Save + } + + +
+ +@code +{ + private bool _saving = false; + private bool _uploading = false; + + private MudForm? form { get; set; } + + [CascadingParameter] + private MudDialogInstance MudDialog { get; set; } = default!; + + [Parameter, EditorRequired] + public required AddConsent.Command Model { get; set; } + + private void Cancel() + { + MudDialog.Cancel(); + } + + public async Task Submit() + { + try + { + _saving = true; + await form!.Validate(); + + if (form.IsValid) + { + var result = await GetNewMediator().Send(Model!); + + if (result.Succeeded) + { + Snackbar.Add("Consent form uploaded", Severity.Success); + MudDialog.Close(DialogResult.Ok(true)); + } + else + { + Snackbar.Add($"Error uploading consent {result.ErrorMessage}", Severity.Error); + } + } + + } + catch (Exception e) + { + Snackbar.Add($"Error uploading Consent evidence: {e.Message}", Severity.Error); + } + finally + { + _saving = false; + } + } + +} \ No newline at end of file diff --git a/src/Server.UI/Pages/Participants/Components/ParticipantActionMenu.razor b/src/Server.UI/Pages/Participants/Components/ParticipantActionMenu.razor index e13c6ba6..5419bceb 100644 --- a/src/Server.UI/Pages/Participants/Components/ParticipantActionMenu.razor +++ b/src/Server.UI/Pages/Participants/Components/ParticipantActionMenu.razor @@ -35,6 +35,10 @@ { @ConstantString.AddRightToWork } + @if (Participant.EnrolmentStatus == EnrolmentStatus.EnrolmentConfirmedStatus) + { + @ConstantString.AddConsent + } @@ -184,7 +188,26 @@ } } + protected async Task OpenConsentDialog() + { + // Show Dialog + var parameters = new DialogParameters + { + { x => x.Model, new AddConsent.Command() { ParticipantId = Participant.Id } } + }; + + var options = new DialogOptions { CloseButton = true, MaxWidth = MaxWidth.Medium, FullWidth = true }; + var dialog = DialogService.Show("Consent", parameters, options); + + var state = await dialog.Result; + + if (!state!.Canceled) + { + dialog.Close(); + } + + } private void ShowActionFailure(string title, IResult result) { Snackbar.Add( From 9b1ac7f769b6dc97008dfb96bc3a49f926db3893 Mon Sep 17 00:00:00 2001 From: Sam Gibson <140488216+samgibsonmoj@users.noreply.github.com> Date: Thu, 5 Sep 2024 13:06:33 +0100 Subject: [PATCH 4/7] Fix typo in "Add Consent" --- src/Infrastructure/Constants/ConstantString.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Infrastructure/Constants/ConstantString.cs b/src/Infrastructure/Constants/ConstantString.cs index 6d9b59c0..9f093f37 100644 --- a/src/Infrastructure/Constants/ConstantString.cs +++ b/src/Infrastructure/Constants/ConstantString.cs @@ -123,5 +123,5 @@ public static string Localize(string key) public static string RightToWork => Localize("Right To Work"); public static string AddConsent => - Localize("Ad Consent"); + Localize("Add Consent"); } From 3331c8d7b82916aea230b05e471ba6789354d578 Mon Sep 17 00:00:00 2001 From: samgibsonmoj Date: Thu, 5 Sep 2024 14:30:33 +0100 Subject: [PATCH 5/7] Remove duplication --- .../Components/ConsentDialog.razor | 79 +++---------------- 1 file changed, 9 insertions(+), 70 deletions(-) diff --git a/src/Server.UI/Pages/Participants/Components/ConsentDialog.razor b/src/Server.UI/Pages/Participants/Components/ConsentDialog.razor index 9662b1b2..56012fab 100644 --- a/src/Server.UI/Pages/Participants/Components/ConsentDialog.razor +++ b/src/Server.UI/Pages/Participants/Components/ConsentDialog.razor @@ -1,59 +1,12 @@ @using Cfo.Cats.Application.Features.Participants.Commands +@using Cfo.Cats.Server.UI.Pages.Enrolments.Components @inherits CatsComponentBase @inject IValidationService Validator - @if (Model is not null) - { - - - - -
- - - - @if (_uploading) - { - @ConstantString.Uploading - } - else - { - @ConstantString.Upload - } - - - - - - @foreach (var version in Documents.Consent.Versions) - { - Version @version - } - -
- - -
- } +
@ConstantString.Cancel @@ -73,16 +26,15 @@ @code { private bool _saving = false; - private bool _uploading = false; - private MudForm? form { get; set; } + Consent? Consent { get; set; } [CascadingParameter] private MudDialogInstance MudDialog { get; set; } = default!; - + [Parameter, EditorRequired] public required AddConsent.Command Model { get; set; } - + private void Cancel() { MudDialog.Cancel(); @@ -93,28 +45,15 @@ try { _saving = true; - await form!.Validate(); - if (form.IsValid) - { - var result = await GetNewMediator().Send(Model!); + var succeeded = await Consent!.Validate(); - if (result.Succeeded) - { - Snackbar.Add("Consent form uploaded", Severity.Success); - MudDialog.Close(DialogResult.Ok(true)); - } - else - { - Snackbar.Add($"Error uploading consent {result.ErrorMessage}", Severity.Error); - } + if(succeeded) + { + MudDialog.Close(DialogResult.Ok(true)); } } - catch (Exception e) - { - Snackbar.Add($"Error uploading Consent evidence: {e.Message}", Severity.Error); - } finally { _saving = false; From ba3e6dac2f16a184da579b0afe588a4fa720c7c0 Mon Sep 17 00:00:00 2001 From: samgibsonmoj Date: Thu, 5 Sep 2024 14:36:39 +0100 Subject: [PATCH 6/7] Add more suitable icon for consent menu item (mirrors enrolment) --- .../Pages/Participants/Components/ParticipantActionMenu.razor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Server.UI/Pages/Participants/Components/ParticipantActionMenu.razor b/src/Server.UI/Pages/Participants/Components/ParticipantActionMenu.razor index 5419bceb..12ab1719 100644 --- a/src/Server.UI/Pages/Participants/Components/ParticipantActionMenu.razor +++ b/src/Server.UI/Pages/Participants/Components/ParticipantActionMenu.razor @@ -37,7 +37,7 @@ } @if (Participant.EnrolmentStatus == EnrolmentStatus.EnrolmentConfirmedStatus) { - @ConstantString.AddConsent + @ConstantString.AddConsent } From a929ab3bc0eebb4754a424f225d3270d17f39e28 Mon Sep 17 00:00:00 2001 From: Carl Sixsmith Date: Thu, 5 Sep 2024 15:14:52 +0100 Subject: [PATCH 7/7] QA Screen changes to add external identifiers, and display information in a much better format. --- .../Features/Participants/DTOs/ConsentDto.cs | 1 - .../DTOs/ExternalIdentifierDto.cs | 20 ++ .../Participants/DTOs/ParticipantDto.cs | 11 +- .../DTOs/EnrolmentQaNoteDto.cs | 10 +- src/Domain/Common/Enums/EnrolmentStatus.cs | 2 +- .../Components/AssessmentTabPanel.razor | 28 +++ .../Components/ConsentTabPanel.razor | 44 ++++ .../Components/DocumentDisplay.razor | 68 +++++ .../Components/ParticipantQaDetails.razor | 73 ++++++ .../QA/Enrolments/Components/QaNotes.razor | 37 +-- .../Components/RightToWorkTabPanel.razor | 45 ++++ src/Server.UI/Pages/QA/Enrolments/PQA.razor | 237 +++++------------- .../Pages/QA/Enrolments/PqaList.razor | 38 ++- src/Server.UI/Pages/QA/Enrolments/QA1.razor | 210 ++++------------ src/Server.UI/Pages/QA/Enrolments/QA2.razor | 202 ++++----------- 15 files changed, 491 insertions(+), 535 deletions(-) create mode 100644 src/Application/Features/Participants/DTOs/ExternalIdentifierDto.cs create mode 100644 src/Server.UI/Pages/QA/Enrolments/Components/AssessmentTabPanel.razor create mode 100644 src/Server.UI/Pages/QA/Enrolments/Components/ConsentTabPanel.razor create mode 100644 src/Server.UI/Pages/QA/Enrolments/Components/DocumentDisplay.razor create mode 100644 src/Server.UI/Pages/QA/Enrolments/Components/ParticipantQaDetails.razor create mode 100644 src/Server.UI/Pages/QA/Enrolments/Components/RightToWorkTabPanel.razor diff --git a/src/Application/Features/Participants/DTOs/ConsentDto.cs b/src/Application/Features/Participants/DTOs/ConsentDto.cs index 5b271e16..37a0af7b 100644 --- a/src/Application/Features/Participants/DTOs/ConsentDto.cs +++ b/src/Application/Features/Participants/DTOs/ConsentDto.cs @@ -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)); - } } } diff --git a/src/Application/Features/Participants/DTOs/ExternalIdentifierDto.cs b/src/Application/Features/Participants/DTOs/ExternalIdentifierDto.cs new file mode 100644 index 00000000..67904fdf --- /dev/null +++ b/src/Application/Features/Participants/DTOs/ExternalIdentifierDto.cs @@ -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(MemberList.None) + .ForMember(x => x.Value, o => o.MapFrom(s => s.Value)) + .ForMember(x => x.Type, o => o.MapFrom(s => s.Type.Name)); + } + } + +} \ No newline at end of file diff --git a/src/Application/Features/Participants/DTOs/ParticipantDto.cs b/src/Application/Features/Participants/DTOs/ParticipantDto.cs index b4e8446f..4c1b7cfd 100644 --- a/src/Application/Features/Participants/DTOs/ParticipantDto.cs +++ b/src/Application/Features/Participants/DTOs/ParticipantDto.cs @@ -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() @@ -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)); } } } diff --git a/src/Application/Features/QualityAssurance/DTOs/EnrolmentQaNoteDto.cs b/src/Application/Features/QualityAssurance/DTOs/EnrolmentQaNoteDto.cs index acb8e98a..ab0722ca 100644 --- a/src/Application/Features/QualityAssurance/DTOs/EnrolmentQaNoteDto.cs +++ b/src/Application/Features/QualityAssurance/DTOs/EnrolmentQaNoteDto.cs @@ -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 { @@ -21,7 +22,8 @@ public Mapper() CreateMap() .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)); } diff --git a/src/Domain/Common/Enums/EnrolmentStatus.cs b/src/Domain/Common/Enums/EnrolmentStatus.cs index a56e4784..97b859f8 100644 --- a/src/Domain/Common/Enums/EnrolmentStatus.cs +++ b/src/Domain/Common/Enums/EnrolmentStatus.cs @@ -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; diff --git a/src/Server.UI/Pages/QA/Enrolments/Components/AssessmentTabPanel.razor b/src/Server.UI/Pages/QA/Enrolments/Components/AssessmentTabPanel.razor new file mode 100644 index 00000000..4695e18f --- /dev/null +++ b/src/Server.UI/Pages/QA/Enrolments/Components/AssessmentTabPanel.razor @@ -0,0 +1,28 @@ +@using Cfo.Cats.Application.Features.Participants.DTOs +@using Cfo.Cats.Server.UI.Pages.Participants.Components + + + + + + @if (ParticipantDto.AssessmentJustification is not null) + { + + Justification + + @ParticipantDto.AssessmentJustification + + + } + + + + + +@code { + + [Parameter, EditorRequired] + public ParticipantDto ParticipantDto { get; set; } = default!; + + +} \ No newline at end of file diff --git a/src/Server.UI/Pages/QA/Enrolments/Components/ConsentTabPanel.razor b/src/Server.UI/Pages/QA/Enrolments/Components/ConsentTabPanel.razor new file mode 100644 index 00000000..fa3da8b8 --- /dev/null +++ b/src/Server.UI/Pages/QA/Enrolments/Components/ConsentTabPanel.razor @@ -0,0 +1,44 @@ +@using Cfo.Cats.Application.Features.Documents.Queries +@using Cfo.Cats.Application.Features.Participants.DTOs + + + + + @foreach (var consent in ParticipantDto.Consents.OrderByDescending(c => c.ConsentDate)) + { + + @consent.FileName (@consent.ConsentDate.ToShortDateString()) + + } + + + @if (_selectedDocument != Guid.Empty) + { + + + } + + + + +@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(); + } + } + } + + +} \ No newline at end of file diff --git a/src/Server.UI/Pages/QA/Enrolments/Components/DocumentDisplay.razor b/src/Server.UI/Pages/QA/Enrolments/Components/DocumentDisplay.razor new file mode 100644 index 00000000..618c51d6 --- /dev/null +++ b/src/Server.UI/Pages/QA/Enrolments/Components/DocumentDisplay.razor @@ -0,0 +1,68 @@ +@using Cfo.Cats.Application.Features.Documents.Queries +@inherits CatsComponentBase + + + @if (fileBase64 != null && extension!.Equals("pdf", StringComparison.CurrentCultureIgnoreCase)) + { + +

PDF cannot be displayed.

+
+ } + else if (IsFileRejected) + { + + File cannot be displayed. Please contact support. + + } + else + { + + Please select a file to display + + } +
+ +@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; + } + } + } + + + +} \ No newline at end of file diff --git a/src/Server.UI/Pages/QA/Enrolments/Components/ParticipantQaDetails.razor b/src/Server.UI/Pages/QA/Enrolments/Components/ParticipantQaDetails.razor new file mode 100644 index 00000000..1a05e025 --- /dev/null +++ b/src/Server.UI/Pages/QA/Enrolments/Components/ParticipantQaDetails.razor @@ -0,0 +1,73 @@ +@using Cfo.Cats.Application.Features.Participants.DTOs + + + + + Participant Confirmation + + + + @foreach (var item in Participant.ExternalIdentifiers) + { + + @item.Type + @item.Value + + } + + First Name + @Participant.FirstName + + + Last Name + @Participant.LastName + + + + Date Of Birth + + + @Participant.DateOfBirth + + + + + Delivery Location + @Participant.EnrolmentLocation?.Name + + @if (Participant.EnrolmentLocationJustification is not null) + { + + System Location + @Participant.CurrentLocation?.Name + + + Justification + @Participant.EnrolmentLocationJustification + + } + + + Staff Member Confirmation + + + + + Staff Member + @Participant.SupportWorker + + + Consent Date + @Participant.Consents.Max(c => c.ConsentDate).ToShortDateString() + + + + + + +@code{ + + [Parameter, EditorRequired] + public ParticipantDto Participant { get; set; } = default!; + +} \ No newline at end of file diff --git a/src/Server.UI/Pages/QA/Enrolments/Components/QaNotes.razor b/src/Server.UI/Pages/QA/Enrolments/Components/QaNotes.razor index 7993a61b..eacf14ea 100644 --- a/src/Server.UI/Pages/QA/Enrolments/Components/QaNotes.razor +++ b/src/Server.UI/Pages/QA/Enrolments/Components/QaNotes.razor @@ -1,4 +1,4 @@ -@inherits CatsComponentBase + @inherits CatsComponentBase @using System.Globalization @using ActualLab.Fusion.Extensions @@ -9,24 +9,25 @@ @if (_notes is { Length: > 0 }) { - - - Created By - Created Date - Message - - - @context.CreatedBy - - - @context.Created.Humanize() + + @foreach (var note in _notes.OrderByDescending(n => n.Created)) + { + + + + + + @note.Message + + + @note.CreatedBy (@note.TenantName) @note.Created.Humanize() + + + - - - @context.Message - - - + + } + } diff --git a/src/Server.UI/Pages/QA/Enrolments/Components/RightToWorkTabPanel.razor b/src/Server.UI/Pages/QA/Enrolments/Components/RightToWorkTabPanel.razor new file mode 100644 index 00000000..83a24d43 --- /dev/null +++ b/src/Server.UI/Pages/QA/Enrolments/Components/RightToWorkTabPanel.razor @@ -0,0 +1,45 @@ +@using Cfo.Cats.Application.Features.Documents.Queries +@using Cfo.Cats.Application.Features.Participants.DTOs +@inherits CatsComponentBase + + + + @foreach (var rtw in ParticipantDto.RightToWorks.OrderByDescending(c => c.ValidFrom)) + { + + @rtw.FileName (@rtw.ValidFrom.ToShortDateString()) + + } + + +@if (_selectedDocument != Guid.Empty) +{ + + +} + + + + + +@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.RightToWorks.MaxBy(c => c.ValidFrom); + if (latest is not null) + { + _selectedDocument = latest.DocumentId.GetValueOrDefault(); + } + } + } + + +} \ No newline at end of file diff --git a/src/Server.UI/Pages/QA/Enrolments/PQA.razor b/src/Server.UI/Pages/QA/Enrolments/PQA.razor index 418d4ade..147575a6 100644 --- a/src/Server.UI/Pages/QA/Enrolments/PQA.razor +++ b/src/Server.UI/Pages/QA/Enrolments/PQA.razor @@ -1,6 +1,7 @@ @page "/pages/qa/enrolments/pqa/{id:guid}" -@using Cfo.Cats.Application.Features.Documents.Queries +@attribute [Authorize(Policy = SecurityPolicies.Pqa)] + @using Cfo.Cats.Application.Features.Participants.DTOs @using Cfo.Cats.Application.Features.Participants.Queries @using Cfo.Cats.Application.Features.QualityAssurance.Commands @@ -9,15 +10,13 @@ @using Cfo.Cats.Application.SecurityConstants @using Cfo.Cats.Domain.Common.Enums @using Cfo.Cats.Server.UI.Pages.QA.Enrolments.Components - -@attribute [Authorize(Policy = SecurityPolicies.Pqa)] - +@using Cfo.Cats.Server.UI.Pages.Participants.Components @inherits CatsComponentBase @if (_participantDto is not null && _participantDto.EnrolmentStatus == EnrolmentStatus.SubmittedToProviderStatus) -{ - @if (_queueEntry!.IsAccepted) +{ + @if (_queueEntry!.IsAccepted || _queueEntry.IsCompleted) { This entry has already been processed } - + - - Participant - - - - - - - - - @if (_participantDto.EnrolmentLocation is not null) - { - - } - @if (_participantDto.EnrolmentLocationJustification is not null) - { - - } - - @if (_participantDto.AssessmentJustification is not null) - { - - } + + - @if (_participantDto.Consents.Length > 0) + + + + + + + + + + + + + + + + + @if (_queueEntry.IsCompleted == false) { - - + + + + + Accept + + + Return + + + + + + + + Submit + } - - - @if (_participantDto.RightToWorks.Length > 0) + else { - - - @if (_participantDto.RightToWorks[0].ValidTo.Date == new DateTime(9999, 12, 31)) - { - Indefinite - } - else - { - - } - + + This entry has already been processed + } - - - @foreach (var consent in _participantDto.Consents) - { - - @consent.FileName - - } - - @if (_participantDto.RightToWorks is []) - { - - No right to work provided - - } - - @foreach (var rtw in _participantDto.RightToWorks) - { - - @rtw.FileName - - } - - - @if (_queueEntry.IsCompleted == false) - { - - - - - - - - Accept - - - Return - - - - - - - - Submit - - } - - - - - - - @if (fileBase64 != null && extension!.Equals("pdf", StringComparison.CurrentCultureIgnoreCase)) - { - -

PDF cannot be displayed.

-
- } - else if(IsFileRejected) - { - - File cannot be displayed. Please contact support. - - } - else - { - - Please select a file to display - - } -
+ +
} @code { private MudForm? _form; - private EnrolmentQueueEntryDto? _queueEntry = null; - private ParticipantDto? _participantDto = null; - - private bool IsFileRejected {get; set;} + private EnrolmentQueueEntryDto? _queueEntry; + private ParticipantDto? _participantDto; [Parameter] public Guid Id { get; set; } [CascadingParameter] - public UserProfile? UserProfile { get; set; } = null!; - - protected Guid SelectedDocument { get; set; } = Guid.Empty; - - private string? fileBase64; - private string? extension; + public UserProfile? UserProfile { get; set; } private SubmitPqaResponse.Command Command { get; set; } = default!; @@ -198,7 +113,7 @@ { if (_participantDto is null) { - var result = await GetNewMediator().Send(new GetPqaEntryById.Query() + var result = await GetNewMediator().Send(new GetPqaEntryById.Query { Id = Id, CurrentUser = UserProfile @@ -207,18 +122,18 @@ if (result.Succeeded) { _queueEntry = result.Data!; - _participantDto = await GetNewMediator().Send(new GetParticipantById.Query() + _participantDto = await GetNewMediator().Send(new GetParticipantById.Query { Id = _queueEntry.ParticipantId }); - Command = new SubmitPqaResponse.Command() + Command = new SubmitPqaResponse.Command { QueueEntryId = Id, CurrentUser = UserProfile }; } - StateHasChanged(); + StateHasChanged(); } } @@ -229,20 +144,20 @@ { var result = await GetNewMediator().Send(Command); - string message = Command.Accept.GetValueOrDefault() ? "Participant submitted to QA" : "Participant returned to Support Worker"; - + var message = Command.Accept.GetValueOrDefault() ? "Participant submitted to QA" : "Participant returned to Support Worker"; + if (result.Succeeded) { Snackbar.Add(message, Severity.Info); - Navigation.NavigateTo("/pages/qa/enrolments/pqa"); + Navigation.NavigateTo("/pages/qa/enrolments/pqa"); } else { ShowActionFailure("Failed to return to support worker", result); } - } + } } - + private void ShowActionFailure(string title, IResult result) { Snackbar.Add( @@ -258,34 +173,8 @@ , Severity.Error, options => { options.RequireInteraction = true; options.SnackbarVariant = Variant.Text; - } ); + }); } - private async Task OnSelectedDocumentChanged(Guid documentId) - { - if (documentId != Guid.Empty) - { - var query = new GetDocumentById.Query() - { - Id = documentId - }; - - var result = await GetNewMediator().Send(query); - if(result.Succeeded) - { - 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; - } - } - } + } \ No newline at end of file diff --git a/src/Server.UI/Pages/QA/Enrolments/PqaList.razor b/src/Server.UI/Pages/QA/Enrolments/PqaList.razor index 3b8112b3..2361e1e8 100644 --- a/src/Server.UI/Pages/QA/Enrolments/PqaList.razor +++ b/src/Server.UI/Pages/QA/Enrolments/PqaList.razor @@ -14,9 +14,15 @@ .mud-table-toolbar { height: 120px !important; } + + .pointer-cursor { + cursor: pointer; + } +
+
+ Provider QA +
@@ -56,19 +67,7 @@
- - - - - - @ConstantString.View - - - - - +
@@ -104,6 +103,14 @@
+ @* + + + @ConstantString.View + + + + *@
@@ -125,6 +132,11 @@ Navigation.NavigateTo($"/pages/qa/enrolments/pqa/{dto.Id}"); } + private void RowClicked(DataGridRowClickEventArgs args) + { + Navigation.NavigateTo($"/pages/qa/enrolments/pqa/{args.Item.Id}"); + } + private async Task> ServerReload(GridState state) { try diff --git a/src/Server.UI/Pages/QA/Enrolments/QA1.razor b/src/Server.UI/Pages/QA/Enrolments/QA1.razor index 29c7dbcd..c81c6a0c 100644 --- a/src/Server.UI/Pages/QA/Enrolments/QA1.razor +++ b/src/Server.UI/Pages/QA/Enrolments/QA1.razor @@ -8,6 +8,7 @@ @using Cfo.Cats.Application.SecurityConstants @using Cfo.Cats.Domain.Common.Enums @using Cfo.Cats.Server.UI.Pages.QA.Enrolments.Components +@using Cfo.Cats.Server.UI.Pages.Participants.Components @inherits CatsComponentBase @@ -32,7 +33,7 @@ margin-bottom: 0.5rem; } - + CFO Enrolment Queue First Pass @@ -55,92 +56,31 @@ } - + - - Participant - - - - - - - - - @if (_participantDto.EnrolmentLocation is not null) - { - - } - @if (_participantDto.EnrolmentLocationJustification is not null) - { - - } - - @if (_participantDto.AssessmentJustification is not null) - { - - } - - @if (_participantDto.Consents.Length > 0) - { - - - } - - - @if (_participantDto.RightToWorks.Length > 0) - { - - - @if (_participantDto.RightToWorks[0].ValidTo.Date == new DateTime(9999, 12, 31)) - { - Indefinite - } - else - { - - } - - } - - - @foreach (var consent in _participantDto.Consents) - { - - @consent.FileName - - } - - @if (_participantDto.RightToWorks is []) - { - - No right to work provided - - } - - @foreach (var rtw in _participantDto.RightToWorks) + + + + + + + + + + + + + + + + + + + @if (_queueEntry.IsCompleted == false) { - - @rtw.FileName - - } - - - @if (_queueEntry.IsCompleted == false) - { - - - + Accept @@ -150,44 +90,20 @@ - + Submit - - } - - - - - - - - - - - - - @if (fileBase64 != null && extension!.Equals("pdf", StringComparison.CurrentCultureIgnoreCase)) - { - -

PDF cannot be displayed.

-
- } - else if (IsFileRejected) - { - - File cannot be displayed. Please contact support. - - } - else - { - - Please select a file to display - - } -
+ } + else + { + + This entry has already been processed + + } + +
} @@ -202,16 +118,9 @@ private EnrolmentQueueEntryDto? _queueEntry = null; private ParticipantDto? _participantDto = null; - private bool IsFileRejected { get; set; } - [CascadingParameter] public UserProfile? UserProfile { get; set; } = null!; - protected Guid SelectedDocument { get; set; } = Guid.Empty; - - private string? fileBase64; - private string? extension; - private SubmitQa1Response.Command Command { get; set; } = default!; private async Task GetQueueItem() @@ -265,48 +174,19 @@ private void ShowActionFailure(string title, IResult result) { Snackbar.Add( - @
-

@title

-
    - @foreach (var e in result.Errors) - { -
  • @e
  • - } -
-
-, Severity.Error, options => -{ - options.RequireInteraction = true; - options.SnackbarVariant = Variant.Text; -}); - } - - private async Task OnSelectedDocumentChanged(Guid documentId) - { - if (documentId != Guid.Empty) - { - var query = new GetDocumentById.Query() - { - Id = documentId - }; - - var result = await GetNewMediator().Send(query); - - if (result.Succeeded) - { - IsFileRejected = false; - using (var memoryStream = new MemoryStream()) + @
+

@title

+
    + @foreach (var e in result.Errors) { - await result.Data!.FileStream.CopyToAsync(memoryStream); - var bytes = memoryStream.ToArray(); - fileBase64 = Convert.ToBase64String(bytes); +
  • @e
  • } - extension = result.Data!.FileExtension; - } - else - { - IsFileRejected = true; - } - } +
+
+ , Severity.Error, options => { + options.RequireInteraction = true; + options.SnackbarVariant = Variant.Text; + }); } + } \ No newline at end of file diff --git a/src/Server.UI/Pages/QA/Enrolments/QA2.razor b/src/Server.UI/Pages/QA/Enrolments/QA2.razor index fcacd0d2..ff951893 100644 --- a/src/Server.UI/Pages/QA/Enrolments/QA2.razor +++ b/src/Server.UI/Pages/QA/Enrolments/QA2.razor @@ -8,6 +8,7 @@ @using Cfo.Cats.Application.SecurityConstants @using Cfo.Cats.Domain.Common.Enums @using Cfo.Cats.Server.UI.Pages.QA.Enrolments.Components +@using Cfo.Cats.Server.UI.Pages.Participants.Components @inherits CatsComponentBase @@ -32,7 +33,7 @@ margin-bottom: 0.5rem; } - + CFO Enrolment Queue Second Pass @@ -55,92 +56,31 @@ } - + - - Participant - - - - - - - - - @if (_participantDto.EnrolmentLocation is not null) - { - - } - @if (_participantDto.EnrolmentLocationJustification is not null) - { - - } - - @if (_participantDto.AssessmentJustification is not null) - { - - } - - @if (_participantDto.Consents.Length > 0) - { - - - } - - - @if (_participantDto.RightToWorks.Length > 0) - { - - - @if (_participantDto.RightToWorks[0].ValidTo.Date == new DateTime(9999, 12, 31)) - { - Indefinite - } - else - { - - } - - } - - - @foreach (var consent in _participantDto.Consents) - { - - @consent.FileName - - } - - @if (_participantDto.RightToWorks is []) - { - - No right to work provided - - } - - @foreach (var rtw in _participantDto.RightToWorks) + + + + + + + + + + + + + + + + + + + @if (_queueEntry.IsCompleted == false) { - - @rtw.FileName - - } - - - @if (_queueEntry.IsCompleted == false) - { - - - + Accept @@ -150,37 +90,20 @@ - + Submit - - } - - - - - - @if (fileBase64 != null && extension!.Equals("pdf", StringComparison.CurrentCultureIgnoreCase)) - { - -

PDF cannot be displayed.

-
- } - else if (IsFileRejected) - { - - File cannot be displayed. Please contact support. - - } - else - { - - Please select a file to display - - } -
+ } + else + { + + This entry has already been processed + + } + +
} @@ -195,16 +118,9 @@ private EnrolmentQueueEntryDto? _queueEntry = null; private ParticipantDto? _participantDto = null; - private bool IsFileRejected { get; set; } - [CascadingParameter] public UserProfile? UserProfile { get; set; } = null!; - protected Guid SelectedDocument { get; set; } = Guid.Empty; - - private string? fileBase64; - private string? extension; - private SubmitQa2Response.Command Command { get; set; } = default!; private async Task GetQueueItem() @@ -259,47 +175,19 @@ private void ShowActionFailure(string title, IResult result) { Snackbar.Add( - @
-

@title

-
    - @foreach (var e in result.Errors) - { -
  • @e
  • - } -
-
-, Severity.Error, options => -{ - options.RequireInteraction = true; - options.SnackbarVariant = Variant.Text; -}); - } - - private async Task OnSelectedDocumentChanged(Guid documentId) - { - if (documentId != Guid.Empty) - { - var query = new GetDocumentById.Query() - { - Id = documentId - }; - - var result = await GetNewMediator().Send(query); - if (result.Succeeded) - { - IsFileRejected = false; - using (var memoryStream = new MemoryStream()) + @
+

@title

+
    + @foreach (var e in result.Errors) { - await result.Data!.FileStream.CopyToAsync(memoryStream); - var bytes = memoryStream.ToArray(); - fileBase64 = Convert.ToBase64String(bytes); +
  • @e
  • } - extension = result.Data!.FileExtension; - } - else - { - IsFileRejected = true; - } - } +
+
+ , Severity.Error, options => { + options.RequireInteraction = true; + options.SnackbarVariant = Variant.Text; + }); } + } \ No newline at end of file