diff --git a/src/Application/Features/Documents/DTOs/DocumentDto.cs b/src/Application/Features/Documents/DTOs/DocumentDto.cs index cade49c5..d9ee6fb3 100644 --- a/src/Application/Features/Documents/DTOs/DocumentDto.cs +++ b/src/Application/Features/Documents/DTOs/DocumentDto.cs @@ -8,7 +8,7 @@ public class DocumentDto { [Description("Id")] public Guid? Id { get; set; } - [Description("Title")] public string? Title { get; set; } + [Description("File Name")] public string? Title { get; set; } [Description("Description")] public string? Description { get; set; } @@ -24,6 +24,7 @@ public class DocumentDto [Description("Content")] public string? Content { get; set; } [Description("Created By")] public string CreatedBy { get; set; } = string.Empty; + [Description("Created By Name")] public string CreatedByName { get; set; } = string.Empty; [Description("Created Date")] public DateTime Created { get; set; } [Description("Owner")] public ApplicationUserDto? Owner { get; set; } @@ -33,7 +34,8 @@ private class Mapping : Profile public Mapping() { CreateMap(MemberList.None) - .ForMember(x => x.TenantName, s => s.MapFrom(y => y.Tenant!.Name)); + .ForMember(x => x.TenantName, s => s.MapFrom(y => y.Tenant!.Name)) + .ForMember(x => x.CreatedByName, s => s.MapFrom(y => y.Owner!.DisplayName)); CreateMap(MemberList.None) .ForMember(x => x.Tenant, s => s.Ignore()) .ForMember(x => x.Owner, s => s.Ignore()); diff --git a/src/Server.UI/Pages/Participants/Components/CaseDocuments.razor b/src/Server.UI/Pages/Participants/Components/CaseDocuments.razor index 2686e150..453a2454 100644 --- a/src/Server.UI/Pages/Participants/Components/CaseDocuments.razor +++ b/src/Server.UI/Pages/Participants/Components/CaseDocuments.razor @@ -6,6 +6,7 @@ @using Cfo.Cats.Application.Features.Documents.Queries @using Cfo.Cats.Application.SecurityConstants @using System.Net.Http.Json +@using Humanizer @inherits CatsComponentBase @@ -20,16 +21,7 @@ height: 120px !important; } - -@if (_notFound) -{ - - No documents yet. - -} -else -{ - + + + + @ConstantString.View + + + - - - + - Open +
+ @context.Item.CreatedByName + @context.Item.Created.Humanize() +
-
+
+ + +
+ @context.Item.TenantName + @context.Item.TenantId +
+
+
+ + @ConstantString.NoRecords + + + @ConstantString.Loading +
-} + @code { bool _loading = true; - bool _notFound = false; private DocumentDto[] _documents = []; private DocumentDto _currentDto = new() { Id = Guid.Empty }; @@ -76,7 +90,6 @@ else { ParticipantId = ParticipantId }); - _notFound = _documents.Count() == 0; } }finally{ _loading = false; @@ -86,7 +99,7 @@ else public async Task OpenDocumentDialog(DocumentDto item) { await DialogService.ShowAsync( - "View Document Dialog", + "Document", new DialogParameters() { { x => x.Model, item } @@ -96,7 +109,8 @@ else MaxWidth = MaxWidth.ExtraExtraLarge, Position=DialogPosition.Center, FullWidth = true, - CloseButton = true + CloseButton = true, + CloseOnEscapeKey = true, }); } } \ No newline at end of file diff --git a/src/Server.UI/Pages/Participants/Components/ViewDocumentDialog.razor b/src/Server.UI/Pages/Participants/Components/ViewDocumentDialog.razor index 8462547c..c25a29a4 100644 --- a/src/Server.UI/Pages/Participants/Components/ViewDocumentDialog.razor +++ b/src/Server.UI/Pages/Participants/Components/ViewDocumentDialog.razor @@ -16,12 +16,18 @@ } - - - @if (Model is not null) - { - @if (fileBase64 != null && extension!.Equals("pdf", StringComparison.CurrentCultureIgnoreCase)) - { +@if (Model is not null) +{ + + + + + @Model.Title + + + + @if (fileBase64 != null && extension!.Equals("pdf", StringComparison.CurrentCultureIgnoreCase)) + {

PDF cannot be displayed.

@@ -36,12 +42,14 @@ { } - } -
- - @ConstantString.Close - -
+
+ + @ConstantString.Close + +
+} + + @code { [CascadingParameter] private MudDialogInstance MudDialog { get; set; } = default!;