@using AyCode.Blazor.Components.Components.Grids @using AyCode.Blazor.Components.Components @using DevExpress.Blazor @using FruitBank.Common.Entities @using System.IO @inject IJSRuntime JS @*
?? Szállítólevél részletei
*@ @* @if (ctx.DataItem is ShippingDocument doc) {
Partner: @doc.Partner?.Name
}
*@ @if (ctx.DataItem is not ShippingDocument && ctx.DataItem is not ShippingItem) return; @if (ctx is { DataItem: ShippingDocument doc, IsEditMode: false }) { @foreach (var shippingItem in doc.ShippingItems) { }
Név a dokumentumon Termék neve Rakl. Menny. Net.súly Br.súly
@shippingItem.NameOnDocument @shippingItem.ProductName @shippingItem.PalletsOnDocument @shippingItem.QuantityOnDocument @shippingItem.NetWeightOnDocument @shippingItem.GrossWeightOnDocument
TOTAL: @doc.ShippingItems.Sum(x => x.PalletsOnDocument) @doc.ShippingItems.Sum(x => x.QuantityOnDocument) @double.Round(doc.ShippingItems.Sum(x => x.NetWeightOnDocument), 1) @double.Round(doc.ShippingItems.Sum(x => x.GrossWeightOnDocument), 1)
}
@*
*@
@code { private readonly string[] _pdfFiles = [ "1_Albaran_AH25007715.pdf", "2_BANK FRA.pdf", "3_BP-30M35_20251113_163816.pdf" ]; private MgLazyLoadContent? _lazyContentRef; private string? _currentPdfToRender; private string _randomPdf; protected override void OnInitialized() { base.OnInitialized(); } private async Task OnDataItemChangedAsync(object? dataItem) { @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}"; // If MgLazyLoadContent is already visible, render the PDF immediately if (_lazyContentRef is { IsVisible: true }) { await _lazyContentRef.TriggerContentVisibleAsync(); } } private async Task OnPdfContainerVisibleAsync() { // Render PDF when container becomes visible OR when data changes if (!string.IsNullOrEmpty(_currentPdfToRender)) { var pdfUrls = new[] { _currentPdfToRender }; await JS.InvokeVoidAsync("pdfViewer.renderPdfs", "pdfContainer", pdfUrls); } } }