Files
monorepo/LCU.WebApps.Internal.DocumentManager/LCU.WebApps.Internal.DocumentManager/Shared/DocumentGridView/DocumentAttributes.razor
T
2026-03-13 09:24:21 -05:00

149 lines
4.6 KiB
Plaintext

@using LCU.WebApps.Internal.DocumentManager.Models.Constants
@inject IJSTooltips JSTooltips;
@inject AuthenticationHelper Auth;
<RowSubHeader>Document Attributes</RowSubHeader>
<div class="container-fluid">
<div class="col">
<div class="row font-weight-bold">
Customer Facing Name:
</div>
<div class="row">
@CustomerFacingName
</div>
<div class="row font-weight-bold">
Account Number:
</div>
<div class="row">
@(AccountNumber ?? "Unknown")
</div>
<div class="row font-weight-bold">
Entity Name:
</div>
<div class="row">
@EntityName
</div>
<AuthorizeView Policy="@PolicyConstants.DocumentLookupShowDocumentId">
<div class="row font-weight-bold">
Document ID:
</div>
<div class="row">
@DocumentId
</div>
</AuthorizeView>
@if (!VisibleInMemberView)
{
<div class="row">&nbsp;</div>
<div class="row">
<div class="col-1 align-self-center text-center font-weight-bold doc-type-disabled-warning">!</div>
<div class="col">This document is currently hidden from the member portal</div>
</div>
}
@if (!String.IsNullOrEmpty(RetentionMessage))
{
<div class="row">&nbsp;</div>
<div class="row">
<div class="col-1 align-self-center text-center font-weight-bold doc-type-disabled-warning">!</div>
<div class="col">
<p class="mb-1">@RetentionMessage</p>
<p class="mb-0">Authorizations cannot be modified.</p>
</div>
</div>
}
@if (ScanStatus == false)
{
<div class="row">&nbsp;</div>
<div class="row">
<div class="col-1 p-0 align-self-center text-center font-weight-bold doc-type-disabled-warning">
<i class="fa fa-warning"></i>
</div>
<div class="col">
<p>Security scan marked this file as malicious and it may not be downloaded or updated.</p>
</div>
</div>
}
@if (!DateIsAfterInternalRetentionDate() && ScanStatus != false && IsAllowedToDownload)
{
<div class="row justify-content-center mt-4 mb-2">
<button type="button" class="btn btn-primary" @onclick="DownloadDocument" title="Download" disabled="@(!Scanned)">
Download
@if (!Scanned)
{
<i class="fa fa-info-circle" style="cursor: pointer;" data-toggle="tooltip" data-placement="top" title="This document cannot be downloaded, it is queued for a security scan."></i>
}
</button>
</div>
}
</div>
</div>
@code {
[Parameter]
public string CustomerFacingName { get; set; }
[Parameter]
public string AccountNumber { get; set; }
[Parameter]
public string EntityName { get; set; }
[Parameter]
public bool VisibleInMemberView { get; set; }
[Parameter]
public Func<Task> DownloadDocument { get; set; }
[Parameter]
public DateTime CreatedDate { get; set; }
[Parameter]
public int OnlineBankingRetentionMonths { get; set; }
[Parameter]
public int InternalRetentionMonths { get; set; }
[Parameter]
public string DocumentId { get; set; }
[Parameter]
public bool? ScanStatus { get; set; }
[Parameter]
public bool Scanned { get; set; }
private bool IsAllowedToDownload => Auth.PolicySatisfied(PolicyConstants.DocumentLookupDownload);
private string RetentionMessage { get; set; } = String.Empty;
private bool DateIsAfterInternalRetentionDate() => (DateTime.Now > CreatedDate.AddMonths(InternalRetentionMonths));
private bool DateIsAfterOnlineRetentionDate() => (DateTime.Now > CreatedDate.AddMonths(OnlineBankingRetentionMonths));
protected override void OnInitialized()
{
if (DateIsAfterInternalRetentionDate())
{
RetentionMessage = "Document is past the internal retention period and is not available for download.";
} else if (DateIsAfterOnlineRetentionDate())
{
RetentionMessage = "Document is past the online retention period.";
}
}
protected override Task OnAfterRenderAsync(bool firstRender)
{
if (firstRender) JSTooltips.Enable();
return base.OnAfterRenderAsync(firstRender);
}
}