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

Merge Develop into Main #230

Merged
merged 8 commits into from
Sep 6, 2024
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
4 changes: 3 additions & 1 deletion src/Infrastructure/Constants/ConstantString.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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("Add Consent");
}
120 changes: 68 additions & 52 deletions src/Server.UI/Pages/Enrolments/Components/Consent.razor
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
if (ConsentDto is not null && ConsentDto.Length > 0)
{
<MudText Typo="Typo.body2">
Consent documentation already uploaded
Consent documentation already uploaded:
</MudText>

<MudList T="string">
Expand All @@ -23,61 +23,75 @@
</MudListItem>
}
</MudList>

<MudButton ButtonType="ButtonType.Button" Variant="Variant.Filled" Color="Color.Error" @onclick="() => ConsentDto = null">
Add New
</MudButton>
}
else
{
<MudForm @ref="form" Model="@Model" Validation="@(Validator.ValidateValue(Model))">

<MudDatePicker @bind-Date="Model.ConsentDate"
For="() => Model.ConsentDate"
Label="@Model.GetMemberDescription(x => x.ConsentDate)"
MaxDate="DateTime.Now.Date"
Editable="true" />

<div class="mb-4 mt-8">
<MudFileUpload @bind-Files="Model.Document"
For="() => Model.Document"
MaximumFileCount="1"
Accept=".pdf">
<ActivatorContent>
<MudLoadingButton Loading="_uploading"
Variant="Variant.Outlined"
Color="Color.Primary"
StartIcon="@Icons.Material.Filled.Upload">
@if (_uploading)
{
@ConstantString.Uploading
}
else
{
@ConstantString.Upload
}
</MudLoadingButton>
</ActivatorContent>
</MudFileUpload>

<MudSelect @bind-Value="Model.DocumentVersion"
Label="@Model.GetMemberDescription(x => x.DocumentVersion)"
For="() => Model.DocumentVersion"
AnchorOrigin="Origin.BottomCenter">
@foreach (var version in Documents.Consent.Versions)
<MudDatePicker @bind-Date="Model.ConsentDate"
For="() => Model.ConsentDate"
Label="@Model.GetMemberDescription(x => x.ConsentDate)"
MaxDate="DateTime.Now.Date"
Editable="true" />

<div class="mb-4 mt-8">
<MudFileUpload @bind-Files="Model.Document"
For="() => Model.Document"
MaximumFileCount="1"
Accept=".pdf">
<ActivatorContent>
@if (Model.Document == null || consentUploaded)
{
<MudSelectItem Value="@version">Version @version</MudSelectItem>
<MudLoadingButton Loading="_uploading"
Variant="Variant.Outlined"
Color="Color.Primary"
StartIcon="@Icons.Material.Filled.Upload"
Disabled="Model.Document!=null">
@if (_uploading)
{
@ConstantString.Uploading
}
else
{
@ConstantString.Upload
}
</MudLoadingButton>
}
</MudSelect>
</div>

<MudCheckBox @bind-Value="Model.Certify"
Label="@Model.GetMemberDescription(x => x.Certify)"
For="() => Model.Certify"
Disabled="Model.Document is null" />
</MudForm>
}

</ActivatorContent>
<SelectedTemplate>
<br />
@if (@Model.Document==null)
{
<MudText>No Files</MudText>

}
else
{
<MudText>
Consent documentation uploaded: @Model.Document.Name
</MudText>
}
<br />
</SelectedTemplate>
</MudFileUpload>

<MudSelect @bind-Value="Model.DocumentVersion"
Label="@Model.GetMemberDescription(x => x.DocumentVersion)"
For="() => Model.DocumentVersion"
AnchorOrigin="Origin.BottomCenter">
@foreach (var version in Documents.Consent.Versions)
{
<MudSelectItem Value="@version">Version @version</MudSelectItem>
}
</MudSelect>
</div>

<MudCheckBox @bind-Value="Model.Certify"
Label="@Model.GetMemberDescription(x => x.Certify)"
For="() => Model.Certify"
Disabled="Model.Document is null" />
</MudForm>
}
}

@code {
Expand All @@ -91,11 +105,13 @@

private MudForm? form { get; set; }

private bool consentUploaded;

public async Task<bool> Validate()
{
try
{
if (ConsentDto is not null && ConsentDto.Length > 0)
if (ConsentDto is not null && ConsentDto.Length > 0 || consentUploaded)
{
return true;
}
Expand All @@ -109,6 +125,7 @@
if (result.Succeeded)
{
Snackbar.Add("Consent form uploaded", Severity.Success);
consentUploaded = true;
}
else
{
Expand All @@ -123,5 +140,4 @@
return false;
}
}

}
}
15 changes: 14 additions & 1 deletion src/Server.UI/Pages/Enrolments/Components/RightToWork.razor
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,20 @@
}
</MudLoadingButton>
</ActivatorContent>
<SelectedTemplate>
<br />
@if (context != null)
{
<MudText>
Right To Work supporting documentation uploaded: @context.Name
</MudText>
}
else
{
<MudText>No Files</MudText>
}
<br />
</SelectedTemplate>
</MudFileUpload>
</div>
}
Expand Down Expand Up @@ -138,5 +152,4 @@
return false;
}
}

}
Loading
Loading