Files
T
2026-03-13 09:24:21 -05:00

69 lines
2.6 KiB
Plaintext

@using LCU.WebApps.Internal.DocumentManager.Models.Constants
@using Serilog
@inject IJSRuntime JSRuntime;
@inject IToastService ToastService;
@inject FileOperationsApiConfiguration _fileOperationsApiConfiguration;
@inject AuthenticationHelper Auth;
<RowSubHeader>Document Attributes</RowSubHeader>
<div class="pt-2 pl-3">
@switch (DocumentProcessingInfo.IngestorRunInfo.IngestorType)
{
case IngestorTypes.FosTaxStatement:
<FosTaxStatementComponent DocumentProcessingInfo=DocumentProcessingInfo />
break;
case IngestorTypes.FosDnaDocument:
<FosDnaDocumentComponent DocumentProcessingInfo=DocumentProcessingInfo />
break;
case IngestorTypes.XdiDnaNotice:
<XdiDnaNoticeComponent DocumentProcessingInfo=DocumentProcessingInfo />
break;
case IngestorTypes.FosLoanStatement:
<FosLoanStatementDocumentComponent DocumentProcessingInfo=DocumentProcessingInfo />
break;
case IngestorTypes.OsgDnaNoticesDocument:
<OsgDnaNoticesDocumentComponent DocumentProcessingInfo=DocumentProcessingInfo />
break;
case IngestorTypes.OsgHistoricalDocument:
<OsgHistoricalDocumentComponent DocumentProcessingInfo=DocumentProcessingInfo />
break;
case IngestorTypes.OsgWeilandStatement:
<OsgWeilandStatementComponent DocumentProcessingInfo=DocumentProcessingInfo />
break;
}
<div class="row justify-content-center mt-4 mb-2">
<button type="button" class="btn btn-primary" @onclick="(() => OpenDocument())" title="OpenDocument" disabled="@Disabled">
Open Document
</button>
</div>
</div>
@code {
[Parameter]
public DocumentProcessingInfo DocumentProcessingInfo { get; set; }
private bool Disabled => !Auth.PolicySatisfied(PolicyConstants.ReprocessingTableOpenDocument);
private async Task OpenDocument()
{
try
{
var filePath = DocumentProcessingInfo.IngestorRunInfo.IndexFilePath + DocumentProcessingInfo.DocumentFileName;
var finalFilePath = filePath.Replace("\\", "%5C");
var url = $"{_fileOperationsApiConfiguration.Url}" +
$"{_fileOperationsApiConfiguration.GetPdfContentEndpoint}" +
$"/{finalFilePath}";
await JSRuntime.InvokeVoidAsync("open", url, "_blank");
}
catch (Exception exception)
{
var message = "Error opening document.";
Log.Error(message, exception);
ToastService.ShowError(message);
}
}
}