diff --git a/FruitBank.Common.Server/FruitBank.Common.Server.csproj b/FruitBank.Common.Server/FruitBank.Common.Server.csproj index f73953cb..c31b4f30 100644 --- a/FruitBank.Common.Server/FruitBank.Common.Server.csproj +++ b/FruitBank.Common.Server/FruitBank.Common.Server.csproj @@ -11,7 +11,9 @@ + + @@ -39,7 +41,7 @@ ..\..\..\..\Aycode\Source\AyCode.Core\AyCode.Services.Server\bin\FruitBank\Debug\net9.0\AyCode.Services.Server.dll - C:\Program Files\dotnet\packs\Microsoft.AspNetCore.App.Ref\9.0.11\ref\net9.0\Microsoft.AspNetCore.SignalR.Core.dll + C:\Program Files\dotnet\packs\Microsoft.AspNetCore.App.Ref\9.0.13\ref\net9.0\Microsoft.AspNetCore.SignalR.Core.dll ..\..\NopCommerce.Common\4.70\Libraries\Mango.Nop.Core\bin\FruitBank\Debug\net9.0\Mango.Nop.Core.dll diff --git a/FruitBank.Common/Dtos/OrderItemDto.cs b/FruitBank.Common/Dtos/OrderItemDto.cs index d4a43904..8ac4b15b 100644 --- a/FruitBank.Common/Dtos/OrderItemDto.cs +++ b/FruitBank.Common/Dtos/OrderItemDto.cs @@ -101,11 +101,10 @@ public class OrderItemDto : MgOrderItemDto, IOrderItemDto [NotColumn, NotMapped, JsonIgnore, System.Text.Json.Serialization.JsonIgnore] [ToonDescription(BusinessRule = "get => IsMeasurable ? double.Round(ProductDto!.AverageWeight - AverageWeight, 1) : 0")] public double AverageWeightDifference => IsMeasurable ? double.Round(ProductDto!.AverageWeight - AverageWeight, 1) : 0; - + [NotColumn, NotMapped, JsonIgnore, System.Text.Json.Serialization.JsonIgnore] [ToonDescription(BusinessRule = "get => !IsMeasurable || (ProductDto!.AverageWeight > 0 && ((AverageWeightDifference / ProductDto!.AverageWeight) * 100) < ProductDto!.AverageWeightTreshold)")] - public bool AverageWeightIsValid => !IsMeasurable || - (ProductDto!.AverageWeight > 0 && ((AverageWeightDifference / ProductDto!.AverageWeight) * 100) < ProductDto!.AverageWeightTreshold); + public bool AverageWeightIsValid => !IsMeasurable || (ProductDto!.AverageWeight > 0 && Math.Abs((AverageWeightDifference / ProductDto!.AverageWeight) * 100) < ProductDto!.AverageWeightTreshold); [NotColumn, NotMapped, JsonIgnore, System.Text.Json.Serialization.JsonIgnore] [ToonDescription(Purpose = "Status flag", BusinessRule = "get => OrderItemPallets.Count > 0 && OrderItemPallets.All(oip => oip.IsAudited)")] diff --git a/FruitBank.Common/Entities/Files.cs b/FruitBank.Common/Entities/Files.cs index 158e54e2..391e9478 100644 --- a/FruitBank.Common/Entities/Files.cs +++ b/FruitBank.Common/Entities/Files.cs @@ -11,9 +11,11 @@ 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; } + public bool IsCompressed { get; set; } [SkipValuesOnUpdate] public DateTime Created { get; set; } diff --git a/FruitBank.Common/Entities/Shipping.cs b/FruitBank.Common/Entities/Shipping.cs index a87e0abd..c6a655ae 100644 --- a/FruitBank.Common/Entities/Shipping.cs +++ b/FruitBank.Common/Entities/Shipping.cs @@ -1,4 +1,5 @@ -using AyCode.Core.Serializers.Toons; +using AyCode.Interfaces.EntityComment; +using AyCode.Core.Serializers.Toons; using FruitBank.Common.Interfaces; using LinqToDB.Mapping; using Mango.Nop.Core.Entities; @@ -8,11 +9,13 @@ namespace FruitBank.Common.Entities; [ToonDescription("Shipping record with documents and measurement tracking", Purpose = "Represents a physical inbound delivery event (truck arrival) at the warehouse, tracking the vehicle and the overall measurement status of the shipment")] [Table(Name = FruitBankConstClient.ShippingDbTableName)] [System.ComponentModel.DataAnnotations.Schema.Table(FruitBankConstClient.ShippingDbTableName)] -public class Shipping : MgEntityBase, IShipping +public class Shipping : MgEntityBase, IShipping, IEntityComment { - public DateTime ShippingDate { get; set; } + public DateTime ShippingDate { get; set; } = DateTime.Now; public string LicencePlate { get; set; } public bool IsAllMeasured { get; set; } + public string? Comment { get; set; } = string.Empty; + public string? CargoCompany { get; set; } public DateTime? MeasuredDate { get; set; } diff --git a/FruitBank.Common/Entities/ShippingDocument.cs b/FruitBank.Common/Entities/ShippingDocument.cs index d3ce8e35..161923b8 100644 --- a/FruitBank.Common/Entities/ShippingDocument.cs +++ b/FruitBank.Common/Entities/ShippingDocument.cs @@ -16,7 +16,7 @@ public class ShippingDocument : MgEntityBase, IShippingDocument public string DocumentIdNumber { get; set; } public string PdfFileName { get; set; } - public DateTime ShippingDate { get; set; } + public DateTime ShippingDate { get; set; } = DateTime.Now; public string Country { get; set; } public int TotalPallets { get; set; } diff --git a/FruitBank.Common/Interfaces/IFiles.cs b/FruitBank.Common/Interfaces/IFiles.cs index 9ff7cfc4..cd3329f5 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/FruitBank.Common/Interfaces/IStockSignalREndpointCommon.cs b/FruitBank.Common/Interfaces/IStockSignalREndpointCommon.cs index bdddc3c1..2ec4d4ac 100644 --- a/FruitBank.Common/Interfaces/IStockSignalREndpointCommon.cs +++ b/FruitBank.Common/Interfaces/IStockSignalREndpointCommon.cs @@ -8,6 +8,7 @@ public interface IStockSignalREndpointCommon public Task?> GetStockTakings(bool loadRelations); public Task?> GetStockTakingsByProductId(int productId); public Task AddStockTaking(StockTaking stockTaking); + public Task RefreshStockTakingItem(int stockTakingItemId); public Task UpdateStockTaking(StockTaking stockTaking); public Task?> GetStockTakingItems(); @@ -19,6 +20,7 @@ public interface IStockSignalREndpointCommon public Task?> GetStockTakingItemPallets(); public Task?> GetStockTakingItemPalletsByProductId(int productId); + public Task CloseStockTaking(int stockTakingId); public Task AddStockTakingItemPallet(StockTakingItemPallet stockTakingItemPallet); public Task UpdateStockTakingItemPallet(StockTakingItemPallet stockTakingItemPallet); } \ No newline at end of file diff --git a/FruitBank.Common/Models/SignalRs/SignalRMessageToClientWithText.cs b/FruitBank.Common/Models/SignalRs/SignalRMessageToClientWithText.cs index 3ef3d991..8fa31263 100644 --- a/FruitBank.Common/Models/SignalRs/SignalRMessageToClientWithText.cs +++ b/FruitBank.Common/Models/SignalRs/SignalRMessageToClientWithText.cs @@ -2,8 +2,16 @@ namespace FruitBank.Common.Models.SignalRs; -public class SignalRMessageToClientWithText(string? message, T? content) +public class SignalRMessageToClientWithText { - public string? Message { get; set; } = message; - public T? Content { get; set; } = content; + public SignalRMessageToClientWithText() + {} + public SignalRMessageToClientWithText(string? message, T? content) : this() + { + Message = message; + Content = content; + } + + public string? Message { get; set; } + public T? Content { get; set; } } \ No newline at end of file diff --git a/FruitBank.Common/SignalRs/SignalRTags.cs b/FruitBank.Common/SignalRs/SignalRTags.cs index 30d07302..13f0471f 100644 --- a/FruitBank.Common/SignalRs/SignalRTags.cs +++ b/FruitBank.Common/SignalRs/SignalRTags.cs @@ -92,13 +92,14 @@ public class SignalRTags : AcSignalRTags public const int GetStockTakings = 170; public const int AddStockTaking = 171; - public const int UpdateStockTaking = 172; - public const int CloseStockTaking = 173; - public const int GetStockTakingItems = 174; - public const int GetStockTakingItemsById = 175; - public const int GetStockTakingItemsByProductId = 176; - public const int GetStockTakingItemsByStockTakingId = 177; - public const int AddOrUpdateMeasuredStockTakingItemPallet = 178; + public const int RefreshStockTakingItem = 172; + public const int UpdateStockTaking = 173; + public const int CloseStockTaking = 174; + public const int GetStockTakingItems = 175; + public const int GetStockTakingItemsById = 176; + public const int GetStockTakingItemsByProductId = 177; + public const int GetStockTakingItemsByStockTakingId = 178; + public const int AddOrUpdateMeasuredStockTakingItemPallet = 179; public const int AuthenticateUser = 195; diff --git a/FruitBankHybrid.Shared/Components/GridDetailOrderDto.razor b/FruitBankHybrid.Shared/Components/GridDetailOrderDto.razor index 4d47f218..3d87187f 100644 --- a/FruitBankHybrid.Shared/Components/GridDetailOrderDto.razor +++ b/FruitBankHybrid.Shared/Components/GridDetailOrderDto.razor @@ -20,7 +20,7 @@ - + @@ -31,10 +31,10 @@ - - - - + + + + @@ -107,19 +107,22 @@ private async Task ReloadDataFromDb(bool forceReload = false) { LoadingPanelVisibility.Visible = true; - using (await ObjectLock.GetSemaphore().UseWaitAsync()) + + if (IsMasterGrid) { - if (OrderDtos == null) OrderDtos = await FruitBankSignalRClient.GetAllOrderDtos() ?? []; - else if (OrderDtos.Count == 0 || forceReload) + using (await ObjectLock.GetSemaphore().UseWaitAsync()) { - OrderDtos.Clear(); - OrderDtos.AddRange(await FruitBankSignalRClient.GetAllOrderDtos() ?? []); + if (OrderDtos == null) OrderDtos = await FruitBankSignalRClient.GetAllOrderDtos() ?? []; + else if (OrderDtos.Count == 0 || forceReload) + { + OrderDtos.Clear(); + OrderDtos.AddRange(await FruitBankSignalRClient.GetAllOrderDtos() ?? []); + } } + + //if (forceReload) + Grid?.Reload(); } - - //if (forceReload) - Grid?.Reload(); - LoadingPanelVisibility.Visible = false; } diff --git a/FruitBankHybrid.Shared/Components/GridDetailOrderItemDto.razor b/FruitBankHybrid.Shared/Components/GridDetailOrderItemDto.razor index 97a9668d..333e4e89 100644 --- a/FruitBankHybrid.Shared/Components/GridDetailOrderItemDto.razor +++ b/FruitBankHybrid.Shared/Components/GridDetailOrderItemDto.razor @@ -1,6 +1,7 @@ @using AyCode.Blazor.Components.Components.Grids @using AyCode.Core.Helpers @using AyCode.Utils.Extensions +@using FruitBank.Common @using FruitBank.Common.Dtos @using FruitBank.Common.Models @using FruitBankHybrid.Shared.Components.Grids.GenericAttributes @@ -18,7 +19,7 @@ FilterMenuButtonDisplayMode="@(IsMasterGrid ? GridFilterMenuButtonDisplayMode.Never : GridFilterMenuButtonDisplayMode.Always)"> - + @@ -49,7 +50,7 @@ - + diff --git a/FruitBankHybrid.Shared/Components/GridDetailOrderItemPallets.razor b/FruitBankHybrid.Shared/Components/GridDetailOrderItemPallets.razor index 4eff31bf..752983a8 100644 --- a/FruitBankHybrid.Shared/Components/GridDetailOrderItemPallets.razor +++ b/FruitBankHybrid.Shared/Components/GridDetailOrderItemPallets.razor @@ -1,5 +1,6 @@ @using AyCode.Blazor.Components.Components.Grids @using AyCode.Utils.Extensions +@using FruitBank.Common @using FruitBank.Common.Dtos @using FruitBank.Common.Entities @using FruitBank.Common.Models @@ -32,6 +33,10 @@ + + + + diff --git a/FruitBankHybrid.Shared/Components/GridProductDtoTemplate.razor b/FruitBankHybrid.Shared/Components/GridProductDtoTemplate.razor index 1f9c506a..e33e0adf 100644 --- a/FruitBankHybrid.Shared/Components/GridProductDtoTemplate.razor +++ b/FruitBankHybrid.Shared/Components/GridProductDtoTemplate.razor @@ -179,11 +179,11 @@ var productDto = (ProductDto)e.DataItem; - if (e.Grid.IsDetailRowExpanded(e.VisibleIndex)) - { - _currentOrderDtos = null; - _currentOrderDtos = productDto != null ? await GetOrderDtosFromDbAsync(productDto.Id) : []; - } + // if (e.Grid.IsDetailRowExpanded(e.VisibleIndex)) + // { + // _currentOrderDtos = null; + // _currentOrderDtos = productDto != null ? await GetOrderDtosFromDbAsync(productDto.Id) : []; + // } } protected async Task OnActiveTabChanged(int activeTabIndex, int productId) @@ -192,11 +192,11 @@ switch (_activeTabIndex) { - case 0: - //_currentOrderDtos = null; + case 1: + _currentOrderDtos = null; _currentOrderDtos = await GetOrderDtosFromDbAsync(productId); break; - case 1: + case 2: _currentOrderItemDtos = null; _currentOrderItemDtos = await GetOrderItemDtosFromDbAsync(productId); break; diff --git a/FruitBankHybrid.Shared/Components/GridShippingDocument.razor b/FruitBankHybrid.Shared/Components/GridShippingDocument.razor index 40491569..08c783a9 100644 --- a/FruitBankHybrid.Shared/Components/GridShippingDocument.razor +++ b/FruitBankHybrid.Shared/Components/GridShippingDocument.razor @@ -47,7 +47,7 @@ + - + diff --git a/FruitBankHybrid.Shared/Components/GridShippingItemPallets.razor b/FruitBankHybrid.Shared/Components/GridShippingItemPallets.razor index 291c2864..dd2fd44a 100644 --- a/FruitBankHybrid.Shared/Components/GridShippingItemPallets.razor +++ b/FruitBankHybrid.Shared/Components/GridShippingItemPallets.razor @@ -1,10 +1,14 @@ -@using AyCode.Utils.Extensions +@using AyCode.Blazor.Components.Components.Grids +@using AyCode.Utils.Extensions +@using FruitBank.Common @using FruitBank.Common.Dtos @using FruitBank.Common.Entities +@using FruitBank.Common.Models @using FruitBankHybrid.Shared.Databases @using FruitBankHybrid.Shared.Services.SignalRs @inject FruitBankSignalRClient FruitBankSignalRClient +@inject LoggedInModel LoggedInModel + + + + diff --git a/FruitBankHybrid.Shared/Components/GridShippingItemTemplate.razor b/FruitBankHybrid.Shared/Components/GridShippingItemTemplate.razor index 665ba232..afd365c0 100644 --- a/FruitBankHybrid.Shared/Components/GridShippingItemTemplate.razor +++ b/FruitBankHybrid.Shared/Components/GridShippingItemTemplate.razor @@ -17,79 +17,80 @@ @inject FruitBankSignalRClient FruitBankSignalRClient - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + - - - - - - - + + + + + + + - - - + + + - - + + + - - - - - @* + + + + + @* @{ if (context.DataColumn.FieldName == nameof(ShippingItem.ShippingDocumentId)) { @@ -103,185 +104,185 @@ } *@ - @{ - var shippingItemPallets = ((ShippingItem)context.DataItem).ShippingItemPallets; - - } - - - @if (IsMasterGrid) - { - - } - - - - - - - - + @{ + var shippingItemPallets = ((ShippingItem)context.DataItem).ShippingItemPallets; + + } + + + @if (IsMasterGrid) + { + + } + + + + + + + + @code { - //[Inject] public required ObjectLock ObjectLock { get; set; } - [Inject] public required DatabaseClient Database { get; set; } + //[Inject] public required ObjectLock ObjectLock { get; set; } + [Inject] public required DatabaseClient Database { get; set; } - //[Parameter] public int GetAllMessageTag { get; set; } - [Parameter] public IId? ParentDataItem { get; set; } + //[Parameter] public int GetAllMessageTag { get; set; } + [Parameter] public IId? ParentDataItem { get; set; } - [Parameter] public IEnumerable? ProductDtos { get; set; } - [Parameter] public AcObservableCollection? ShippingItems { get; set; } - [Parameter] public AcObservableCollection? ShippingDocuments { get; set; } + [Parameter] public IEnumerable? ProductDtos { get; set; } + [Parameter] public AcObservableCollection? ShippingItems { get; set; } + [Parameter] public AcObservableCollection? ShippingDocuments { get; set; } - public bool IsMasterGrid => ParentDataItem == null; - public bool ParentDataItemIsShippingDocument => (ParentDataItem is ShippingDocument); - string GridCss => !IsMasterGrid ? "hide-toolbar" : string.Empty; + public bool IsMasterGrid => ParentDataItem == null; + public bool ParentDataItemIsShippingDocument => (ParentDataItem is ShippingDocument); + string GridCss => !IsMasterGrid ? "hide-toolbar" : string.Empty; - MgGridToolbarTemplate toolbar; + MgGridToolbarTemplate toolbar; - const string ExportFileName = "ExportResult"; - string _localStorageKey = "GridShippingItem_"; + const string ExportFileName = "ExportResult"; + string _localStorageKey = "GridShippingItem_"; - string GridSearchText = ""; - bool EditItemsEnabled { get; set; } = true; - int FocusedRowVisibleIndex { get; set; } + string GridSearchText = ""; + bool EditItemsEnabled { get; set; } = true; + int FocusedRowVisibleIndex { get; set; } - public GridShippingItemBase Grid { get; set; } - private LoggerClient _logger; + public GridShippingItemBase Grid { get; set; } + private LoggerClient _logger; - protected override async Task OnInitializedAsync() - { - _logger = new LoggerClient(LogWriters.ToArray()); + protected override async Task OnInitializedAsync() + { + _logger = new LoggerClient(LogWriters.ToArray()); - await ReloadDataFromDb(false); - } + await ReloadDataFromDb(false); + } - public async Task ReloadDataFromDb(bool forceReload = false) - { - //using (await ObjectLock.GetSemaphore().UseWaitAsync()) - { - if (ProductDtos == null || !ProductDtos.Any() || forceReload) ProductDtos = await Database.ProductDtoTable.LoadDataAsync(!forceReload); - } + public async Task ReloadDataFromDb(bool forceReload = false) + { + //using (await ObjectLock.GetSemaphore().UseWaitAsync()) + { + if (ProductDtos == null || !ProductDtos.Any() || forceReload) ProductDtos = await Database.ProductDtoTable.LoadDataAsync(!forceReload); + } - if (!IsMasterGrid) - { - if (ShippingDocuments == null && ParentDataItem is ShippingDocument shippingDocumentParent) ShippingDocuments = [shippingDocumentParent]; - return; - } + if (!IsMasterGrid) + { + if (ShippingDocuments == null && ParentDataItem is ShippingDocument shippingDocumentParent) ShippingDocuments = [shippingDocumentParent]; + return; + } - using (await ObjectLock.GetSemaphore().UseWaitAsync()) - { - if (ShippingDocuments == null) - { - ShippingDocuments = new AcObservableCollection(await FruitBankSignalRClient.GetShippingDocuments() ?? []); - } - else if (ShippingDocuments.Count == 0 || forceReload) - { - ShippingDocuments.Replace(await FruitBankSignalRClient.GetShippingDocuments() ?? []); - } - } + using (await ObjectLock.GetSemaphore().UseWaitAsync()) + { + if (ShippingDocuments == null) + { + ShippingDocuments = new AcObservableCollection(await FruitBankSignalRClient.GetShippingDocuments() ?? []); + } + else if (ShippingDocuments.Count == 0 || forceReload) + { + ShippingDocuments.Replace(await FruitBankSignalRClient.GetShippingDocuments() ?? []); + } + } - if (Grid == null) return; + if (Grid == null) return; - using (await ObjectLock.GetSemaphore().UseWaitAsync()) - if (forceReload) await Grid.ReloadDataSourceAsync(); + using (await ObjectLock.GetSemaphore().UseWaitAsync()) + if (forceReload) await Grid.ReloadDataSourceAsync(); - if (forceReload) Grid.Reload(); - } + if (forceReload) Grid.Reload(); + } - static void Grid_CustomizeElement(GridCustomizeElementEventArgs e) - { - if (e.ElementType != GridElementType.DataCell) return; + static void Grid_CustomizeElement(GridCustomizeElementEventArgs e) + { + if (e.ElementType != GridElementType.DataCell) return; - if (e.Column.Name != nameof(ShippingItem.MeasuredNetWeight) && - e.Column.Name != nameof(ShippingItem.MeasuredGrossWeight) && - e.Column.Name != nameof(ShippingItem.MeasuredQuantity)) return; + if (e.Column.Name != nameof(ShippingItem.MeasuredNetWeight) && + e.Column.Name != nameof(ShippingItem.MeasuredGrossWeight) && + e.Column.Name != nameof(ShippingItem.MeasuredQuantity)) return; - var isMeasured = (bool)e.Grid.GetRowValue(e.VisibleIndex, nameof(ShippingItem.IsMeasured)); - if (!isMeasured) return; + var isMeasured = (bool)e.Grid.GetRowValue(e.VisibleIndex, nameof(ShippingItem.IsMeasured)); + if (!isMeasured) return; - switch (e.Column.Name) - { - case nameof(ShippingItem.MeasuredNetWeight) or nameof(ShippingItem.MeasuredGrossWeight): - { - var isMeasurable = (bool)e.Grid.GetRowValue(e.VisibleIndex, nameof(ShippingItem.IsMeasurable)); - if (!isMeasurable) return; + switch (e.Column.Name) + { + case nameof(ShippingItem.MeasuredNetWeight) or nameof(ShippingItem.MeasuredGrossWeight): + { + var isMeasurable = (bool)e.Grid.GetRowValue(e.VisibleIndex, nameof(ShippingItem.IsMeasurable)); + if (!isMeasurable) return; - var valueOnDocument = 0d; - var measuredValue = 0d; + var valueOnDocument = 0d; + var measuredValue = 0d; - if (e.Column.Name == nameof(ShippingItem.MeasuredGrossWeight)) - { - valueOnDocument = (double)e.Grid.GetRowValue(e.VisibleIndex, nameof(ShippingItem.GrossWeightOnDocument)); - measuredValue = (double)e.Grid.GetRowValue(e.VisibleIndex, nameof(ShippingItem.MeasuredGrossWeight)); - } - else - { - valueOnDocument = (double)e.Grid.GetRowValue(e.VisibleIndex, nameof(ShippingItem.NetWeightOnDocument)); - measuredValue = (double)e.Grid.GetRowValue(e.VisibleIndex, nameof(ShippingItem.MeasuredNetWeight)); - } + if (e.Column.Name == nameof(ShippingItem.MeasuredGrossWeight)) + { + valueOnDocument = (double)e.Grid.GetRowValue(e.VisibleIndex, nameof(ShippingItem.GrossWeightOnDocument)); + measuredValue = (double)e.Grid.GetRowValue(e.VisibleIndex, nameof(ShippingItem.MeasuredGrossWeight)); + } + else + { + valueOnDocument = (double)e.Grid.GetRowValue(e.VisibleIndex, nameof(ShippingItem.NetWeightOnDocument)); + measuredValue = (double)e.Grid.GetRowValue(e.VisibleIndex, nameof(ShippingItem.MeasuredNetWeight)); + } - if (valueOnDocument > 0 && valueOnDocument > measuredValue) e.CssClass = "text-danger"; - //else if (valueOnDocument <= measuredValue) e.CssClass = "text-success"; + if (valueOnDocument > 0 && valueOnDocument > measuredValue) e.CssClass = "text-danger"; + else if (valueOnDocument > 0 && valueOnDocument < measuredValue) e.CssClass = "text-success"; - break; - } - case nameof(ShippingItem.MeasuredQuantity): - { - var quantityOnDocument = (int)e.Grid.GetRowValue(e.VisibleIndex, nameof(ShippingItem.QuantityOnDocument)); - var measuredQuantity = (int)e.Grid.GetRowValue(e.VisibleIndex, nameof(ShippingItem.MeasuredQuantity)); + break; + } + case nameof(ShippingItem.MeasuredQuantity): + { + var quantityOnDocument = (int)e.Grid.GetRowValue(e.VisibleIndex, nameof(ShippingItem.QuantityOnDocument)); + var measuredQuantity = (int)e.Grid.GetRowValue(e.VisibleIndex, nameof(ShippingItem.MeasuredQuantity)); - if (quantityOnDocument > 0 && quantityOnDocument > measuredQuantity) e.CssClass = "text-danger"; - //else if (quantityOnDocument <= measuredQuantity) e.CssClass = "text-success"; - break; - } - } - } + if (quantityOnDocument > 0 && quantityOnDocument > measuredQuantity) e.CssClass = "text-danger"; + //else if (quantityOnDocument <= measuredQuantity) e.CssClass = "text-success"; + break; + } + } + } - async Task Grid_FocusedRowChanged(GridFocusedRowChangedEventArgs args) - { - if ((args.Grid.IsEditing() || args.Grid.IsEditingNewRow()) && (args.DataItem as IId).Id > 0) - await args.Grid.SaveChangesAsync(); + async Task Grid_FocusedRowChanged(GridFocusedRowChangedEventArgs args) + { + if ((args.Grid.IsEditing() || args.Grid.IsEditingNewRow()) && (args.DataItem as IId).Id > 0) + await args.Grid.SaveChangesAsync(); - if (toolbar != null) - { - var shippingItem = (args.DataItem as ShippingItem)!; - toolbar.EnableDelete = shippingItem.MeasuringStatus == MeasuringStatus.NotStarted; + if (toolbar != null) + { + var shippingItem = (args.DataItem as ShippingItem)!; + toolbar.EnableDelete = shippingItem.MeasuringStatus == MeasuringStatus.NotStarted; - } + } - FocusedRowVisibleIndex = args.VisibleIndex; - EditItemsEnabled = true; - } + FocusedRowVisibleIndex = args.VisibleIndex; + EditItemsEnabled = true; + } - async Task Grid_DataItemDeleting(GridDataItemDeletingEventArgs e) - { - } + async Task Grid_DataItemDeleting(GridDataItemDeletingEventArgs e) + { + } - async Task Grid_EditModelSaving(GridEditModelSavingEventArgs e) - { - ShippingItem? resultShippingItem = null; + async Task Grid_EditModelSaving(GridEditModelSavingEventArgs e) + { + ShippingItem? resultShippingItem = null; - if (!e.IsNew) - { - resultShippingItem = await FruitBankSignalRClient.UpdateShippingItem((ShippingItem)e.EditModel); - } - else - { - resultShippingItem = await FruitBankSignalRClient.AddShippingItem((ShippingItem)e.EditModel); - EditItemsEnabled = true; - } + if (!e.IsNew) + { + resultShippingItem = await FruitBankSignalRClient.UpdateShippingItem((ShippingItem)e.EditModel); + } + else + { + resultShippingItem = await FruitBankSignalRClient.AddShippingItem((ShippingItem)e.EditModel); + EditItemsEnabled = true; + } - // if (resultShippingItem != null) - // ShippingItems!.UpdateCollection(resultShippingItem, false); + // if (resultShippingItem != null) + // ShippingItems!.UpdateCollection(resultShippingItem, false); - EditItemsEnabled = true; - } + EditItemsEnabled = true; + } } \ No newline at end of file diff --git a/FruitBankHybrid.Shared/Components/Grids/Products/GridStockQuantityHistoryDtoTemplate.razor b/FruitBankHybrid.Shared/Components/Grids/Products/GridStockQuantityHistoryDtoTemplate.razor index cb56f7c4..c2118fa6 100644 --- a/FruitBankHybrid.Shared/Components/Grids/Products/GridStockQuantityHistoryDtoTemplate.razor +++ b/FruitBankHybrid.Shared/Components/Grids/Products/GridStockQuantityHistoryDtoTemplate.razor @@ -48,7 +48,7 @@ @if (IsMasterGrid) { - + } @* diff --git a/FruitBankHybrid.Shared/Components/Grids/ShippingDocuments/AiProcessFormTemplate.razor b/FruitBankHybrid.Shared/Components/Grids/ShippingDocuments/AiProcessFormTemplate.razor index 8f2fb077..2c31cc10 100644 --- a/FruitBankHybrid.Shared/Components/Grids/ShippingDocuments/AiProcessFormTemplate.razor +++ b/FruitBankHybrid.Shared/Components/Grids/ShippingDocuments/AiProcessFormTemplate.razor @@ -1,4 +1,6 @@ - -@code { +@using FruitBank.Common + +@code { + public string baseUrl = FruitBankConstClient.BaseUrl + "/Admin/FileManager/ImageTextExtraction"; } diff --git a/FruitBankHybrid.Shared/Components/Grids/ShippingDocuments/GridShippingDocumentInfoPanel.razor b/FruitBankHybrid.Shared/Components/Grids/ShippingDocuments/GridShippingDocumentInfoPanel.razor index 9a0cc4d2..9fb5e487 100644 --- a/FruitBankHybrid.Shared/Components/Grids/ShippingDocuments/GridShippingDocumentInfoPanel.razor +++ b/FruitBankHybrid.Shared/Components/Grids/ShippingDocuments/GridShippingDocumentInfoPanel.razor @@ -72,15 +72,16 @@ } -
-
- + *@ + + @*
@@ -94,7 +95,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 +111,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 MgLazyLoadContent is already visible, render the PDF immediately - if (_lazyContentRef is { IsVisible: true }) + if (dataItem is ShippingItem shippingItem) shippingDocument = shippingItem.ShippingDocument; + else shippingDocument = dataItem as ShippingDocument; + + if (shippingDocument == null) return; + + if (_lazyContentRef != null && 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(); + } } } diff --git a/FruitBankHybrid.Shared/Components/Grids/Shippings/GridShipping.razor b/FruitBankHybrid.Shared/Components/Grids/Shippings/GridShipping.razor index 6142714a..03564592 100644 --- a/FruitBankHybrid.Shared/Components/Grids/Shippings/GridShipping.razor +++ b/FruitBankHybrid.Shared/Components/Grids/Shippings/GridShipping.razor @@ -23,12 +23,13 @@ - - - - - - + + + + + + + diff --git a/FruitBankHybrid.Shared/Components/Grids/StockTakingItems/GridStockTakingItem.razor b/FruitBankHybrid.Shared/Components/Grids/StockTakingItems/GridStockTakingItem.razor index 951bae92..868288d5 100644 --- a/FruitBankHybrid.Shared/Components/Grids/StockTakingItems/GridStockTakingItem.razor +++ b/FruitBankHybrid.Shared/Components/Grids/StockTakingItems/GridStockTakingItem.razor @@ -48,7 +48,7 @@ @if (IsMasterGrid) { - + } diff --git a/FruitBankHybrid.Shared/Components/PalletItemComponent.razor b/FruitBankHybrid.Shared/Components/PalletItemComponent.razor index 9b534e9a..8da64c72 100644 --- a/FruitBankHybrid.Shared/Components/PalletItemComponent.razor +++ b/FruitBankHybrid.Shared/Components/PalletItemComponent.razor @@ -12,7 +12,7 @@ @typeparam TPalletItem where TPalletItem : class, IMeasuringItemPalletBase + ItemUpdating="@((pair) => OnItemUpdating(pair.Key, pair.Value, PalletItem))" Enabled="Editable"> @(MeasuringIndex). MÉRÉS @@ -21,24 +21,24 @@ @* *@ @@ -48,19 +48,19 @@ - + @if (HasAuditButton) { - } -@code { + @code { [Inject] public required IEnumerable LogWriters { get; set; } [Inject] public required FruitBankSignalRClient FruitBankSignalRClient { get; set; } [Inject] public required LoggedInModel LoggedInModel { get; set; } @@ -73,15 +73,19 @@ [Parameter] public int? AddOrUpdateSignalRTag { get; set; } = null; [Parameter] public int? MaxTrayQuantity { get; set; } = null; - [Parameter] public bool IsEditable { get; set; } = true; + [Parameter] public bool Editable { get; set; } = true; - //[Parameter] public EventCallback OnPalletItemSaveClick { get; set; } [Parameter] public Func? OnPalletItemSaved { get; set; } [Parameter] public Func? OnPalletItemValueChanged { get; set; } - [Parameter] public Func? OnPalletItemAuditedClick { get; set; } + [Parameter] public Func? OnPalletItemAudited { get; set; } + + /// + /// Before Save or Audit + /// + [Parameter] public Func? OnPalletItemSaveOrAuditClick { get; set; } //public bool LoadingPanelVisible { get; set; } = false; - //public bool IsEditable => !HasAuditButton || (OrderItemPallet.IsAudited); + //public bool Editable => !HasAuditButton || (OrderItemPallet.IsAudited); public bool BtnSaveEnabled { get; set; } @@ -93,7 +97,7 @@ private bool GetBtnSaveEnabled() { - return IsEditable && PalletItem.IsValidMeasuringValues(IsMeasurable) && !PalletItem.IsMeasured && IsMaxTrayQuantityValid; + return Editable && PalletItem.IsValidMeasuringValues(IsMeasurable) && !PalletItem.IsMeasured && IsMaxTrayQuantityValid; } private bool IsMaxTrayQuantityValid => (!MaxTrayQuantity.HasValue || PalletItem.TrayQuantity <= MaxTrayQuantity.Value); @@ -119,6 +123,8 @@ PalletItem.ModifierId = LoggedInModel.CustomerDto?.Id; + if (OnPalletItemSaveOrAuditClick != null) await OnPalletItemSaveOrAuditClick.Invoke(PalletItem); + var responseShippingItemPallet = await FruitBankSignalRClient.PostDataAsync(AddOrUpdateSignalRTag!.Value, PalletItem); if (responseShippingItemPallet != null) PalletItem.Id = responseShippingItemPallet.Id; //Az UpdateCollection miatt kell, hogy megtalálja mit kell kicserélni! - J. //else _logger.Error($"Sikertelen volt a raklap adatainak mentése!"); @@ -126,7 +132,7 @@ if (OnPalletItemSaved != null) await OnPalletItemSaved.Invoke(responseShippingItemPallet); //LoadingPanelVisible = false; - StateHasChanged(); + await InvokeAsync(StateHasChanged); } protected async Task OnItemUpdating(string fieldName, object newValue, TPalletItem palletItem) @@ -172,15 +178,17 @@ private async Task PalletItemAuditedClick() { - if (OnPalletItemAuditedClick != null) + if (OnPalletItemAudited != null) { if (OrderItemPallet == null) throw new Exception($"PalletItemComponent->PalletItemAuditedClick(); OrderItemPallet == null"); if (await DialogService.ShowConfirmBoxAsync("Megerősítés", "Biztoan jóváhagyja a mérést? Jóváhagyás után a mérés nem módosítható!", MessageBoxRenderStyle.Info)) { + if (OnPalletItemSaveOrAuditClick != null) await OnPalletItemSaveOrAuditClick.Invoke(PalletItem); + OrderItemPallet.RevisorId = LoggedInModel.CustomerDto!.Id; - StateHasChanged(); //Az Audit button miatt kell a StateHasChanged(), most már van RevisorId és emiatt disabled lesz... + await InvokeAsync(StateHasChanged); //Az Audit button miatt kell a StateHasChanged(), most már van RevisorId és emiatt disabled lesz... PalletItem.SetParentPropToNull(); @@ -191,7 +199,7 @@ await DialogService.ShowMessageBoxAsync("Hiba", "Adatok mentése sikertelen volt, ellenőrizze a mérés adatait!", MessageBoxRenderStyle.Danger); } - if (OnPalletItemAuditedClick != null) await OnPalletItemAuditedClick.Invoke(responseShippingItemPallet); + await OnPalletItemAudited.Invoke(responseShippingItemPallet); } } } diff --git a/FruitBankHybrid.Shared/Components/StockTakings/StockTakingTemplate.razor b/FruitBankHybrid.Shared/Components/StockTakings/StockTakingTemplate.razor index ebf7d5f7..d4b7f485 100644 --- a/FruitBankHybrid.Shared/Components/StockTakings/StockTakingTemplate.razor +++ b/FruitBankHybrid.Shared/Components/StockTakings/StockTakingTemplate.razor @@ -12,17 +12,26 @@ @using FruitBankHybrid.Shared.Services.SignalRs @using Mango.Nop.Core.Entities + + @* CaptionCssClass="@(SelectedProductDto?.IsMeasured == true ? "text-success" : "")"> *@ - + ValueChanged="@(async (StockTaking stockTaking) => await StockTakingComboValueChanged(stockTaking, null))"> @@ -32,18 +41,24 @@ CssClass="cw-480" DropDownBodyCssClass="dd-body-class" Context="ctxProduct2" - InputId="cbProduct2"> + InputId="cbProduct2" + SearchMode="ListSearchMode.AutoSearch" + SearchFilterCondition="ListSearchFilterCondition.Contains" + SearchTextParseMode="ListSearchTextParseMode.Default" + ClearButtonDisplayMode="DataEditorClearButtonDisplayMode.Auto" + DropDownTriggerMode="DropDownTriggerMode.Click" + @ref="cbStockTakingItems"> @* TextFieldName="StockTakingItem.Product.Name" *@ - + - - +@* + - - + *@ + @@ -58,10 +73,17 @@
@{ var a = $"Várható rekesz: {SelectedStockTakingItem.TotalOriginalQuantity} ({SelectedStockTakingItem.OriginalStockQuantity} + {SelectedStockTakingItem.InProcessOrdersQuantity}), Várható net.súly: {SelectedStockTakingItem.OriginalNetWeight} kg."; - @a + @a } + + @if (SelectedStockTakingItem.IsInvalid) + { +
A várható mennyiség nem lehet negatív! A hibás adatok javítása után nyomja meg a "Frissítés" gombot.
+ + } +
- + @for (var index = 0; index < (SelectedStockTakingItem?.StockTakingItemPallets?.Count ?? 0); index++) { @@ -70,6 +92,7 @@ }
+ @code { @@ -102,6 +126,12 @@ [Inject] public required IDialogService DialogService { get; set; } = null!; [Inject] public required FruitBankSignalRClient FruitBankSignalRClient { get; set; } + bool _btnDisabled = false; + bool LoadingPanelVisible = false; + + DxComboBox cbStockTakings; + DxComboBox cbStockTakingItems; + List _stockTakings { get; set; } = []; List _stockTakingItems { get; set; } = []; List _stockTakingItemPallets { get; set; } = []; @@ -115,55 +145,100 @@ public async Task ReloadDataFromDb(bool forceReload) { - LoadingPanelVisibility.Visible = true; + LoadingPanelVisible = true; _stockTakings = await FruitBankSignalRClient.GetStockTakings(false) ?? []; - await StockTakingComboValueChanged(_stockTakings.FirstOrDefault()); + await StockTakingComboValueChanged(_stockTakings.FirstOrDefault(), null); - LoadingPanelVisibility.Visible = false; + LoadingPanelVisible = false; + } + + private async Task RefreshErrorItemClick(StockTakingItem errorTakingItem) + { + var stockTakingItem = await FruitBankSignalRClient.RefreshStockTakingItem(errorTakingItem.Id); + if (stockTakingItem == null) + { + await DialogService.ShowMessageBoxAsync("Hiba", "Adatok frissése sikertelen volt!", MessageBoxRenderStyle.Danger); + return; + } + + await StockTakingComboValueChanged(SelectedStockTaking, stockTakingItem.Id); + + if (stockTakingItem.IsInvalid) + await DialogService.ShowMessageBoxAsync("Figyelem", "A termék továbbra is hibás!", MessageBoxRenderStyle.Warning); } private async Task NewStockTakingClick() { - var stockTaking = new StockTaking(); - stockTaking.StartDateTime = DateTime.Now; - stockTaking.Creator = LoggedInModel.CustomerDto!.Id; + _btnDisabled = true; - var resultStockTakings = await FruitBankSignalRClient.AddStockTaking(stockTaking); - if (resultStockTakings == null) return; + try + { + LoadingPanelVisible = true; - _stockTakings.UpdateCollection(resultStockTakings, false); - await StockTakingComboValueChanged(_stockTakings.FirstOrDefault(x => x.Id == stockTaking.Id)); + var stockTaking = new StockTaking + { + StartDateTime = DateTime.Now, + Creator = LoggedInModel.CustomerDto!.Id + }; + + var resultStockTakings = await FruitBankSignalRClient.AddStockTaking(stockTaking); + if (resultStockTakings == null) + { + await DialogService.ShowMessageBoxAsync("Hiba", "Új leltár létrehozása sikertelen volt!", MessageBoxRenderStyle.Danger); + return; + } + + _stockTakings.UpdateCollection(resultStockTakings, false); + await StockTakingComboValueChanged(_stockTakings.FirstOrDefault(x => x.Id == resultStockTakings.Id), null); + } + finally + { + _btnDisabled = false; + LoadingPanelVisible = false; + } + + //cbStockTakings.Reload(); + await InvokeAsync(StateHasChanged); } - private async Task UpdateStockTakingClick() + private async Task StockTakingCloseClick(int stockTakingId) { - // var resultStockTaking = await FruitBankSignalRClient.AddStockTaking(stockTaking); - // if (resultStockTaking == null) return; + _btnDisabled = true; - // _stockTakings.Add(resultStockTaking); - StateHasChanged(); + try + { + LoadingPanelVisible = true; + + var resultStockTaking = await FruitBankSignalRClient.CloseStockTaking(stockTakingId); + if (resultStockTaking == null) + { + await DialogService.ShowMessageBoxAsync("Hiba", "A leltár lezárása sikertelen volt, ellenőrizze a leltár adatait!", MessageBoxRenderStyle.Danger); + return; + } + + _stockTakings.UpdateCollection(resultStockTaking, false); + await StockTakingComboValueChanged(_stockTakings.FirstOrDefault(x => x.Id == resultStockTaking.Id), null); + } + finally + { + _btnDisabled = false; + LoadingPanelVisible = false; + } + + await InvokeAsync(StateHasChanged); } - private async Task StockTakingCloseClick() - { - // var resultStockTaking = await FruitBankSignalRClient.AddStockTaking(stockTaking); - // if (resultStockTaking == null) return; - - // _stockTakings.Add(resultStockTaking); - StateHasChanged(); - } - - private async Task StockTakingComboValueChanged(StockTaking? newValue) + private async Task StockTakingComboValueChanged(StockTaking? newValue, int? selectedStockTakingItemId) { SelectedStockTaking = newValue; SelectedStockTaking?.StockTakingItems = await FruitBankSignalRClient.GetStockTakingItemsByStockTakingId(SelectedStockTaking.Id); - + PrepareStockTakingItems(SelectedStockTaking); - SelectedStockTakingItem = _stockTakingItems.FirstOrDefault(); + SelectedStockTakingItem = selectedStockTakingItemId.HasValue ? _stockTakingItems.FirstOrDefault(x => x.Id == selectedStockTakingItemId.Value) : _stockTakingItems.FirstOrDefault(); - StateHasChanged(); + await InvokeAsync(StateHasChanged); } private void PrepareStockTakingItems(StockTaking? stockTaking) @@ -191,19 +266,22 @@ } } - private Task OnStockTakingItemPalletValueChanged(StockTakingItemPallet stockTakingItemPallet, StockTakingItem stockTakingItem) + private async Task OnStockTakingItemPalletValueChanged(StockTakingItemPallet stockTakingItemPallet, StockTakingItem stockTakingItem) { // MeasuringValuesHelper.SetShippingItemTotalMeasuringValues(stockTakingItem); // BtnSaveEnabled = stockTakingItem.IsValidMeasuringValues() && stockTakingItemPallet.IsValidMeasuringValues(stockTakingItem.IsMeasurable); - StateHasChanged(); - return Task.CompletedTask; + //cbStockTakingItems.Reload(); + await InvokeAsync(StateHasChanged); + //return Task.CompletedTask; } private async Task OnStockTakingItemPalletSaved(StockTakingItemPallet? responseStockTakingItemPallet) { if (responseStockTakingItemPallet != null) { + //responseStockTakingItemPallet.IsMeasured = true; + responseStockTakingItemPallet.StockTakingItem = SelectedStockTakingItem; SelectedStockTakingItem!.MeasuredStockQuantity = responseStockTakingItemPallet.TrayQuantity; @@ -216,7 +294,10 @@ } else await DialogService.ShowMessageBoxAsync("Hiba", "Adatok mentése sikertelen volt, ellenőrizze a mérés adatait!", MessageBoxRenderStyle.Danger); + //cbStockTakingItems.Reload(); await InvokeAsync(StateHasChanged); + + await cbStockTakingItems.FocusAsync(); } } diff --git a/FruitBankHybrid.Shared/Layout/MainLayout.razor.cs b/FruitBankHybrid.Shared/Layout/MainLayout.razor.cs index 42821e27..55e9bb7a 100644 --- a/FruitBankHybrid.Shared/Layout/MainLayout.razor.cs +++ b/FruitBankHybrid.Shared/Layout/MainLayout.razor.cs @@ -16,7 +16,7 @@ using Microsoft.AspNetCore.Components; namespace FruitBankHybrid.Shared.Layout; -public partial class MainLayout : LayoutComponentBase +public partial class MainLayout : LayoutComponentBase, IDisposable { [Inject] public required IEnumerable LogWriters { get; set; } [Inject] public required NavigationManager NavManager { get; set; } @@ -70,43 +70,57 @@ public partial class MainLayout : LayoutComponentBase { if (messageTag != SignalRTags.NotificationReceived || !LoggedInModel.IsLoggedIn) return; - var notificationMessage = responseDataMessage?.GetResponseData>(); - if (notificationMessage == null) + try { - _logger.Error($"notificationMessage == null"); - return; + var notificationMessage = responseDataMessage?.GetResponseData>(); + if (notificationMessage == null) + { + _logger.Error($"MainLayout.SignalRClientOnMessageReceived; notificationMessage == null; messageTag: {messageTag}"); + return; + } + + toastOrderNumber = null; + toastDateOfReceipt = null; + + toastMessage = notificationMessage.Message; + + var orderDto = notificationMessage.Content; + var hasPermission = orderDto == null || (orderDto.HasMeasuringAccess(LoggedInModel.CustomerDto!.Id, LoggedInModel.IsRevisor) || orderDto.MeasurementOwnerId == 0); + + if (orderDto != null && hasPermission) + { + toastOrderNumber = orderDto.CustomOrderNumber; + toastDateOfReceipt = orderDto.DateOfReceipt; + } + + if (!hasPermission) return; + + _logger.Debug($"MainLayout.SignalRClientOnMessageReceived; NotificationMessage received. {toastMessage}"); + + await InvokeAsync(() => + { + orderNotificationToast?.Show(); + StateHasChanged(); + }); } - - toastOrderNumber = null; - toastDateOfReceipt = null; - - toastMessage = notificationMessage.Message; - - var orderDto = notificationMessage.Content; - var hasPermission = orderDto == null || (orderDto.HasMeasuringAccess(LoggedInModel.CustomerDto!.Id, LoggedInModel.IsRevisor) || orderDto.MeasurementOwnerId == 0); - - if (orderDto != null && hasPermission) + catch (Exception ex) { - toastOrderNumber = orderDto.CustomOrderNumber; - toastDateOfReceipt = orderDto.DateOfReceipt; + _logger.Error($"MainLayout.SignalRClientOnMessageReceived ERROR; messageTag: {messageTag}", ex); } - - if (!hasPermission) return; - - _logger.Debug($"NotificationMessage received. {toastMessage}"); - - await InvokeAsync(() => - { - orderNotificationToast?.Show(); - StateHasChanged(); - }); } private async void OnLogoutClick() { - await LoggedInModel.LogOutAsync(); - RefreshMainLayout(); - NavManager.NavigateTo("/Login"); + try + { + await LoggedInModel.LogOutAsync(); + RefreshMainLayout(); + NavManager.NavigateTo("/Login"); + } + catch (Exception e) + { + _logger.Error($"OnLogoutClick error"); + } } public void RefreshMainLayout() diff --git a/FruitBankHybrid.Shared/Layout/NavMenu.razor b/FruitBankHybrid.Shared/Layout/NavMenu.razor index b2a2d3c2..03b90813 100644 --- a/FruitBankHybrid.Shared/Layout/NavMenu.razor +++ b/FruitBankHybrid.Shared/Layout/NavMenu.razor @@ -37,7 +37,7 @@ - @if (LoggedInModel.IsDeveloper) + @if (LoggedInModel.IsAdministrator) {