diff --git a/FruitBank.Common/Entities/Files.cs b/FruitBank.Common/Entities/Files.cs index aef8544..bae6a05 100644 --- a/FruitBank.Common/Entities/Files.cs +++ b/FruitBank.Common/Entities/Files.cs @@ -9,6 +9,7 @@ namespace FruitBank.Common.Entities; public class Files : MgEntityBase, IFiles { public string FileName { get; set; } + public string FileSubPath { get; set; } public string FileExtension { get; set; } public string RawText { get; set; } public string FileHash { get; set; } diff --git a/FruitBank.Common/Interfaces/IFiles.cs b/FruitBank.Common/Interfaces/IFiles.cs index 9ff7cfc..cd3329f 100644 --- a/FruitBank.Common/Interfaces/IFiles.cs +++ b/FruitBank.Common/Interfaces/IFiles.cs @@ -6,6 +6,9 @@ namespace FruitBank.Common.Interfaces; public interface IFiles: IEntityInt, ITimeStampInfo { public string FileName { get; set; } + public string FileSubPath { get; set; } public string FileExtension { get; set; } public string RawText { get; set; } + public string FileHash { get; set; } + public bool IsCompressed { get; set; } } \ No newline at end of file diff --git a/FruitBankHybrid.Shared/Components/Grids/ShippingDocuments/GridShippingDocumentInfoPanel.razor b/FruitBankHybrid.Shared/Components/Grids/ShippingDocuments/GridShippingDocumentInfoPanel.razor index 9a0cc4d..b20b4ea 100644 --- a/FruitBankHybrid.Shared/Components/Grids/ShippingDocuments/GridShippingDocumentInfoPanel.razor +++ b/FruitBankHybrid.Shared/Components/Grids/ShippingDocuments/GridShippingDocumentInfoPanel.razor @@ -94,7 +94,7 @@ { private readonly string[] _pdfFiles = [ - "1_Albaran_AH25007715.pdf", + "1_Albaran_AH25007715.pdf", "2_BANK FRA.pdf", "3_BP-30M35_20251113_163816.pdf" ]; @@ -110,16 +110,26 @@ private async Task OnDataItemChangedAsync(object? dataItem) { - @if (dataItem is not ShippingDocument && dataItem is not ShippingItem) return; + if (dataItem is not ShippingDocument && dataItem is not ShippingItem) return; - // Store the PDF to render - _randomPdf = _pdfFiles[Random.Shared.Next(_pdfFiles.Length)]; - _currentPdfToRender = $"_content/FruitBankHybrid.Shared/uploads/{_randomPdf}"; + ShippingDocument? shippingDocument = null; + + if (dataItem is ShippingItem shippingItem) shippingDocument = shippingItem.ShippingDocument; + else shippingDocument = dataItem as ShippingDocument; - // If MgLazyLoadContent is already visible, render the PDF immediately - if (_lazyContentRef is { IsVisible: true }) + if (shippingDocument == null) return; + + if (shippingDocument.ShippingDocumentToFiles?.Count > 0) { - await _lazyContentRef.TriggerContentVisibleAsync(); + // Store the PDF to render + _randomPdf = _pdfFiles[Random.Shared.Next(_pdfFiles.Length)]; + _currentPdfToRender = $"_content/FruitBankHybrid.Shared/uploads/{_randomPdf}"; + + // If MgLazyLoadContent is already visible, render the PDF immediately + if (_lazyContentRef is { IsVisible: true }) + { + await _lazyContentRef.TriggerContentVisibleAsync(); + } } }