diff --git a/FruitBank.Common/FruitBankConstClient.cs b/FruitBank.Common/FruitBankConstClient.cs index 69f33f5..3f20aff 100644 --- a/FruitBank.Common/FruitBankConstClient.cs +++ b/FruitBank.Common/FruitBankConstClient.cs @@ -10,7 +10,7 @@ public static class FruitBankConstClient public static string BaseUrl = "https://localhost:59579"; //FrutiBank nop #if RELEASE - //public static string BaseUrl = "https://shop.fruitbank.hu"; //FrutiBank nop + // public static string BaseUrl = "https://shop.fruitbank.hu"; //FrutiBank nop #endif //public static string BaseUrl = "http://10.0.2.2:59579"; //FrutiBank (android) nop diff --git a/FruitBankHybrid.Shared/Components/OrderNotificationToast.razor b/FruitBankHybrid.Shared/Components/OrderNotificationToast.razor new file mode 100644 index 0000000..0f024f3 --- /dev/null +++ b/FruitBankHybrid.Shared/Components/OrderNotificationToast.razor @@ -0,0 +1,54 @@ + + +
+
@Message
+ @if (!string.IsNullOrEmpty(OrderNumber)) + { +
+ Rendelés: + #@OrderNumber +
+ } + @if (DateOfReceipt.HasValue) + { +
+ Átvétel: + @DateOfReceipt.Value.ToString("yyyy-MM-dd HH:mm") +
+ } +
+ +@code { + [Parameter] public string Message { get; set; } = string.Empty; + [Parameter] public string? OrderNumber { get; set; } + [Parameter] public DateTime? DateOfReceipt { get; set; } +} \ No newline at end of file diff --git a/FruitBankHybrid.Shared/Layout/MainLayout.razor b/FruitBankHybrid.Shared/Layout/MainLayout.razor index ad11a2d..e98088a 100644 --- a/FruitBankHybrid.Shared/Layout/MainLayout.razor +++ b/FruitBankHybrid.Shared/Layout/MainLayout.razor @@ -5,7 +5,6 @@ -
@if (LoggedInModel.IsLoggedIn) @@ -13,13 +12,11 @@
@($"{LoggedInModel.CustomerDto!.FullName} [{string.Join(", ", LoggedInModel.CustomerRoles.Where(x => x.SystemName.Contains("Measuring")).Select(x => x.Name))}]")
-
}
-
- @Body @@ -39,6 +35,29 @@
+ + +
+
@toastMessage
+ @if (!string.IsNullOrEmpty(toastOrderNumber)) + { +
+ Rendelés: + #@toastOrderNumber +
+ } + @if (toastDateOfReceipt.HasValue) + { +
+ Átvétel: + @toastDateOfReceipt.Value.ToString("yyyy-MM-dd HH:mm") +
+ } +
+
+
An unhandled error has occurred. Reload diff --git a/FruitBankHybrid.Shared/Layout/MainLayout.razor.cs b/FruitBankHybrid.Shared/Layout/MainLayout.razor.cs index e0a9653..25bbabb 100644 --- a/FruitBankHybrid.Shared/Layout/MainLayout.razor.cs +++ b/FruitBankHybrid.Shared/Layout/MainLayout.razor.cs @@ -19,7 +19,7 @@ namespace FruitBankHybrid.Shared.Layout; public partial class MainLayout : LayoutComponentBase { [Inject] public required IEnumerable LogWriters { get; set; } - [Inject] public required NavigationManager NavManager{ get; set; } + [Inject] public required NavigationManager NavManager { get; set; } [Inject] public required LoggedInModel LoggedInModel { get; set; } [Inject] IToastNotificationService ToastService { get; set; } [Inject] public required FruitBankSignalRClient FruitBankSignalRClient { get; set; } @@ -28,14 +28,19 @@ public partial class MainLayout : LayoutComponentBase private NavMenu _navMenu = null!; private LoggerClient _logger = null!; + // Toast fields + private DxToast orderNotificationToast; + private string toastTitle = "Értesítő!"; + private string toastMessage = ""; + private string? toastOrderNumber; + private DateTime? toastDateOfReceipt; + protected override void OnInitialized() { _logger = new LoggerClient(LogWriters.ToArray()); _logger.Info("OnInitializedAsync"); - var loginUri = NavManager.ToAbsoluteUri("/Login").ToString(); - - FruitBankSignalRClient.OnMessageReceived += SignalRClientOnMessageReceived; + FruitBankSignalRClient.OnMessageReceived += SignalRClientOnMessageReceived; if (!LoggedInModel.IsLoggedIn && NavManager.Uri != loginUri) { @@ -57,35 +62,30 @@ public partial class MainLayout : LayoutComponentBase var orderDto = notificationMessage.Content; if ((orderDto?.HasMeasuringAccess(LoggedInModel.CustomerDto!.Id, LoggedInModel.IsRevisor) ?? LoggedInModel.IsRevisor) || orderDto?.MeasurementOwnerId == 0) { - var messageText = $"{notificationMessage.Message}"; - if (orderDto != null) - { - messageText += $" Rendelés: #{orderDto.CustomOrderNumber}. Átvétel: {orderDto.DateOfReceipt}"; - } + toastMessage = notificationMessage.Message; + toastOrderNumber = orderDto?.CustomOrderNumber; + toastDateOfReceipt = orderDto?.DateOfReceipt; - _logger.Debug($"NotificationMessage received. {messageText}"); + _logger.Debug($"NotificationMessage received. {toastMessage}"); - ToastService.ShowToast(new ToastOptions + InvokeAsync(() => { - ProviderName = "Positioning", - Title = "Értesítő!", - Text = messageText, + orderNotificationToast?.Show(); + StateHasChanged(); }); return Task.CompletedTask; } - return Task.CompletedTask; } private void OnLogoutClick() { LoggedInModel.LogOut(); - RefreshMainLayout(); NavManager.NavigateTo("/Login"); } - + public void RefreshMainLayout() { _navMenu.RefreshNavMenu(); diff --git a/FruitBankHybrid.Shared/wwwroot/app.css b/FruitBankHybrid.Shared/wwwroot/app.css index b1d9222..2676816 100644 --- a/FruitBankHybrid.Shared/wwwroot/app.css +++ b/FruitBankHybrid.Shared/wwwroot/app.css @@ -103,4 +103,35 @@ h1:focus { /*.alt-item { --dxbl-grid-row-bg: var(--DS-color-surface-neutral-subdued-rest); }*/ -/*endregion: DSGrids*/ \ No newline at end of file +/*endregion: DSGrids*/ + + + +.order-notification-toast { + padding: 4px; +} + + .order-notification-toast .message { + font-weight: 600; + margin-bottom: 8px; + font-size: 14px; + } + + .order-notification-toast .order-info { + margin-bottom: 4px; + font-size: 13px; + } + + .order-notification-toast .label { + color: #666; + margin-right: 4px; + } + + .order-notification-toast .order-number { + font-weight: bold; + color: #0066cc; + } + + .order-notification-toast .date { + font-weight: 500; + } \ No newline at end of file diff --git a/FruitBankHybrid.sln b/FruitBankHybrid.sln index df6b7a7..fa3513b 100644 --- a/FruitBankHybrid.sln +++ b/FruitBankHybrid.sln @@ -30,6 +30,7 @@ Global {85ADEDE3-C271-47DF-B273-2EDB32792CEF}.Debug|Any CPU.Deploy.0 = Debug|Any CPU {85ADEDE3-C271-47DF-B273-2EDB32792CEF}.Release|Any CPU.ActiveCfg = Release|Any CPU {85ADEDE3-C271-47DF-B273-2EDB32792CEF}.Release|Any CPU.Build.0 = Release|Any CPU + {85ADEDE3-C271-47DF-B273-2EDB32792CEF}.Release|Any CPU.Deploy.0 = Release|Any CPU {899988C3-8F36-4B19-A1DE-1D1D85F114D2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {899988C3-8F36-4B19-A1DE-1D1D85F114D2}.Debug|Any CPU.Build.0 = Debug|Any CPU {899988C3-8F36-4B19-A1DE-1D1D85F114D2}.Release|Any CPU.ActiveCfg = Release|Any CPU