From a432e0ea59a5570eedfa0fe38cad794110c8a87f Mon Sep 17 00:00:00 2001 From: Loretta Date: Mon, 2 Sep 2024 15:47:19 +0200 Subject: [PATCH] ProductCardComponent fixes v1.1 --- .../CardComponents/ProductCardComponent.razor | 48 +++++++++---------- 1 file changed, 22 insertions(+), 26 deletions(-) diff --git a/TIAMSharedUI/Pages/User/CardComponents/ProductCardComponent.razor b/TIAMSharedUI/Pages/User/CardComponents/ProductCardComponent.razor index dedb8dc5..dcb13697 100644 --- a/TIAMSharedUI/Pages/User/CardComponents/ProductCardComponent.razor +++ b/TIAMSharedUI/Pages/User/CardComponents/ProductCardComponent.razor @@ -1,4 +1,6 @@ -@using AyCode.Core.Helpers +@using System.Diagnostics.CodeAnalysis +@using AyCode.Core.Extensions +@using AyCode.Core.Helpers @using BlazorAnimation @using TIAM.Core.Enums @using TIAM.Entities.Addresses @@ -25,7 +27,7 @@
- +
Download QR @@ -43,20 +45,17 @@

Information

- @RenderDetailsItem("fa-solid fa-user", "Contact Name", _productProfile.FullName ?? string.Empty) + @RenderDetailsItem("fa-solid fa-user", "Contact Name", Product.Profile.Name) @RenderDetailsItem("fa-solid fa-circle-info", "Description", Product.Description)

Affiliate information

@{ - if (Product?.ServiceProviderId != null) - { - var _url = $"{Setting.BaseUrl}/public/transfer/{Product.ServiceProvider.AffiliateId}/{Product.Id}"; -

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

- @_url - - } + var _url = $"{Setting.BaseUrl}/public/transfer/{Product.ServiceProvider.AffiliateId}/{Product.Id}"; +

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

+ @_url + }
@@ -80,7 +79,7 @@
@{ - + }
@@ -110,7 +109,7 @@ @code { - [Parameter] public Product Product { get; set; } + [Parameter] public required Product Product { get; set; } [Parameter] public EventCallback DataChanged { get; set; } @@ -118,11 +117,11 @@ AccordionExpandMode ExpandMode { get; set; } = AccordionExpandMode.SingleOrNone; AccordionExpandCollapseAction ExpandCollapseAction { get; set; } = AccordionExpandCollapseAction.HeaderClick; - private Profile _productProfile = new Profile(); + //private Profile _productProfile = null!;//new Profile(); private readonly List _destinations = []; string _msg; private bool _isSaveActive = false; - private bool _isAddressTransferDestination = true; + private bool _isAddressTransferDestination = false; private async Task CopyUrl(string url) { @@ -136,23 +135,20 @@ protected override async Task OnInitializedAsync() { - var productOwner = await AdminSignalRClient.GetByIdAsync>(SignalRTags.GetCompaniesById, Product.ServiceProviderId); - var productProfiles = await AdminSignalRClient.GetByIdAsync>(SignalRTags.GetProfileById, Product.ProfileId); - - await AdminSignalRClient.GetTransferDestinationsAsync(_destinations, () => + AdminSignalRClient.GetTransferDestinationsAsync(_destinations, () => { - if (productProfiles == null) return; - - _productProfile = productProfiles[0]; _isAddressTransferDestination = CheckDestinations(Product.Id); - }); + StateHasChanged(); + }).Forget(); - if (productOwner != null) + AdminSignalRClient.GetByIdAsync>(SignalRTags.GetCompaniesById, async response => { - ImageSource = await ServiceProviderDataService.GetQRCodeByProductIdAndOwnerAffiliateIdAsync([productOwner[0].AffiliateId, Product.Id]); - } - + ImageSource = await ServiceProviderDataService.GetQRCodeByProductIdAndOwnerAffiliateIdAsync([response.ResponseData!.First().AffiliateId, Product.Id]); + StateHasChanged(); + + }, Product.ServiceProviderId).Forget(); + await base.OnInitializedAsync(); }