From a7e8831ff9c94c463b93740b4ec31418d23655e5 Mon Sep 17 00:00:00 2001 From: Adam Date: Mon, 5 Aug 2024 14:17:18 +0200 Subject: [PATCH] history fix --- .../CardComponents/ProductCardComponent.razor | 57 +++++++++---------- .../BaseComponents/UserBasePageComponent.cs | 4 +- 2 files changed, 27 insertions(+), 34 deletions(-) diff --git a/TIAMSharedUI/Pages/User/CardComponents/ProductCardComponent.razor b/TIAMSharedUI/Pages/User/CardComponents/ProductCardComponent.razor index 586cc402..e505c230 100644 --- a/TIAMSharedUI/Pages/User/CardComponents/ProductCardComponent.razor +++ b/TIAMSharedUI/Pages/User/CardComponents/ProductCardComponent.razor @@ -14,23 +14,20 @@ @using TIAMWebApp.Shared.Application.Models.PageModels @using TIAMWebApp.Shared.Application.Services @inject IServiceProviderDataService ServiceProviderDataService -@inject IUserDataService UserDataService; -@inject AdminSignalRClient AdminSignalRClient; -@inject IJSRuntime JsRuntime; -@inject NavigationManager NavManager; +@inject IUserDataService UserDataService +@inject AdminSignalRClient AdminSignalRClient +@inject IJSRuntime JsRuntime +@inject NavigationManager NavManager
- @*
- -
*@ - +
- - + +
+ Download QR
@@ -45,7 +42,6 @@

Information

- @RenderDetailsItem("fa-solid fa-user", "Contact Name", productProfile.FullName) @RenderDetailsItem("fa-solid fa-circle-info", "Description", Context.Description)
@@ -59,18 +55,12 @@

Use this link to send it in an email to the client

@_url - // Copy referral url - } } - -
-
- -
- +
+
@@ -89,15 +79,11 @@
@{ - if (!isAddressTransferDestination) { - //

Address:

- //

@(((Product)context.DataItem).Profile.Address.AddressText)

} } -
@@ -114,6 +100,15 @@ alert('Could not copy text: ' + err); }); } + + function downloadImage(base64String, filename) { + const link = document.createElement('a'); + link.href = base64String; + link.download = filename; + document.body.appendChild(link); + link.click(); + document.body.removeChild(link); + } @code { @@ -126,17 +121,21 @@ AccordionExpandCollapseAction ExpandCollapseAction { get; set; } = AccordionExpandCollapseAction.HeaderClick; private Profile productProfile = new Profile(); - private List destinations = []; + private List destinations = new List(); string msg; private bool isSaveActive = false; private bool isAddressTransferDestination = false; private async Task CopyUrl(string url) { - await JsRuntime.InvokeVoidAsync("copyToClipboard", url); } + private async Task DownloadImage() + { + await JsRuntime.InvokeVoidAsync("downloadImage", $"data:image/png;base64,{ImageSource}", "QRCode.jpg"); + } + protected override async Task OnInitializedAsync() { var productOwner = await AdminSignalRClient.GetByIdAsync>(SignalRTags.GetCompaniesById, Context.ServiceProviderId); @@ -158,7 +157,6 @@ protected override async Task OnParametersSetAsync() { - await base.OnParametersSetAsync(); } @@ -177,8 +175,6 @@ private bool CheckDestinations(Guid addressId) { - - if (destinations != null) { if (destinations.Any(d => d.AddressId == addressId)) @@ -194,7 +190,6 @@ { return false; } - } private async Task SaveAsDestination(Address address, Product product) @@ -212,7 +207,7 @@ } transferDestination.AddressId = address.Id; transferDestination.AddressString = address.AddressText; - var result = await AdminSignalRClient.PostDataAsync(SignalRTags.CreateTransferDestination, transferDestination); + var result = await AdminSignalRClient.PostDataAsync(SignalRTags.CreateTransferDestination, transferDestination); await InvokeAsync(StateHasChanged); } } diff --git a/TIAMSharedUI/Shared/Components/BaseComponents/UserBasePageComponent.cs b/TIAMSharedUI/Shared/Components/BaseComponents/UserBasePageComponent.cs index d6e07503..b3a52997 100644 --- a/TIAMSharedUI/Shared/Components/BaseComponents/UserBasePageComponent.cs +++ b/TIAMSharedUI/Shared/Components/BaseComponents/UserBasePageComponent.cs @@ -30,9 +30,7 @@ namespace TIAMSharedUI.Shared.Components.BaseComponents { base.OnInitialized(); _logger = new LoggerClient(_logWriters.ToArray()); - var currentUrl = _navManager.ToBaseRelativePath(_navManager.Uri); - _pageState.AddPageToHistory(currentUrl); - _logger.Debug(_pageState.GetGoBackPage()); + } } }