diff --git a/TIAMSharedUI/Pages/User/CardComponents/CompanyCardComponent.razor b/TIAMSharedUI/Pages/User/CardComponents/CompanyCardComponent.razor index 79afc6b2..4eb478ac 100644 --- a/TIAMSharedUI/Pages/User/CardComponents/CompanyCardComponent.razor +++ b/TIAMSharedUI/Pages/User/CardComponents/CompanyCardComponent.razor @@ -22,9 +22,9 @@
-
@($"{Context.Name}")
-

@Context.Profile.EmailAddress

-

@Context.Profile.Address.AddressText

+
@($"{Company.Name}")
+

@Company.Profile.EmailAddress

+

@Company.Profile.Address.AddressText

@@ -40,20 +40,20 @@

Services in this company

@{ - if (Context.Products.Count() > 0) + if (Company.Products.Count > 0) { - @foreach (var item in Context.Products) + @foreach (var item in Company.Products) {
- +
@@ -71,7 +71,7 @@ @code { - [Parameter] public Company Context { get; set; } + [Parameter] public Company Company { get; set; } [Parameter] public EventCallback DataChanged { get; set; } @@ -102,7 +102,7 @@ protected override async Task OnInitializedAsync() { - var CompanyProfiles = await AdminSignalRClient.GetByIdAsync>(SignalRTags.GetProfileById, Context.ProfileId); + var CompanyProfiles = await AdminSignalRClient.GetByIdAsync>(SignalRTags.GetProfileById, Company.ProfileId); if (CompanyProfiles != null) { companyProfile = CompanyProfiles[0]; diff --git a/TIAMSharedUI/Pages/User/CardComponents/ProductCardComponent.razor b/TIAMSharedUI/Pages/User/CardComponents/ProductCardComponent.razor index 7de9abe0..dedb8dc5 100644 --- a/TIAMSharedUI/Pages/User/CardComponents/ProductCardComponent.razor +++ b/TIAMSharedUI/Pages/User/CardComponents/ProductCardComponent.razor @@ -32,9 +32,9 @@
-
@($"{Context.Name}")
-

@Context.Profile.EmailAddress

-

@Context.Profile.Address.AddressText

+
@($"{Product.Name}")
+

@Product.Profile.EmailAddress

+

@Product.Profile.Address.AddressText

@@ -43,16 +43,16 @@

Information

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

Affiliate information

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

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

@_url @@ -66,24 +66,21 @@
@{ - if (Context.ProductType == TIAM.Core.Enums.ProductType.Hotel) + if (Product.ProductType == ProductType.Hotel) { - string url = $"user/hoteladmin/{Context.Id}"; + var url = $"user/hoteladmin/{Product.Id}"; Manage } - else if (Context.ProductType == TIAM.Core.Enums.ProductType.Transfer) + else if (Product.ProductType == ProductType.Transfer) { - string url = $"user/transferadmin/{Context.Id}"; + var url = $"user/transferadmin/{Product.Id}"; Manage } }
@{ - if (!_isAddressTransferDestination) - { - - } + }
@@ -113,7 +110,7 @@ @code { - [Parameter] public Product Context { get; set; } + [Parameter] public Product Product { get; set; } [Parameter] public EventCallback DataChanged { get; set; } @@ -125,7 +122,7 @@ private readonly List _destinations = []; string _msg; private bool _isSaveActive = false; - private bool _isAddressTransferDestination = false; + private bool _isAddressTransferDestination = true; private async Task CopyUrl(string url) { @@ -139,21 +136,22 @@ protected override async Task OnInitializedAsync() { - await AdminSignalRClient.GetTransferDestinationsAsync(_destinations); - var productOwner = await AdminSignalRClient.GetByIdAsync>(SignalRTags.GetCompaniesById, Context.ServiceProviderId); - var productProfiles = await AdminSignalRClient.GetByIdAsync>(SignalRTags.GetProfileById, Context.ProfileId); + var productOwner = await AdminSignalRClient.GetByIdAsync>(SignalRTags.GetCompaniesById, Product.ServiceProviderId); + var productProfiles = await AdminSignalRClient.GetByIdAsync>(SignalRTags.GetProfileById, Product.ProfileId); + + await AdminSignalRClient.GetTransferDestinationsAsync(_destinations, () => + { + if (productProfiles == null) return; + + _productProfile = productProfiles[0]; + _isAddressTransferDestination = CheckDestinations(Product.Id); + }); + if (productOwner != null) { - ImageSource = await ServiceProviderDataService.GetQRCodeByProductIdAndOwnerAffiliateIdAsync([productOwner[0].AffiliateId, Context.Id]); + ImageSource = await ServiceProviderDataService.GetQRCodeByProductIdAndOwnerAffiliateIdAsync([productOwner[0].AffiliateId, Product.Id]); } - - if (productProfiles != null) - { - _productProfile = productProfiles[0]; - _isAddressTransferDestination = CheckDestinations(_productProfile.AddressId); - } - await base.OnInitializedAsync(); } @@ -176,30 +174,24 @@
; } - private bool CheckDestinations(Guid addressId) + private bool CheckDestinations(Guid productId) { - return _destinations.Any(d => d.AddressId == addressId); + return _destinations.Any(d => d.ProductId == productId); } private async Task SaveAsDestination(Address address, Product product) { - var transferDestination = new TransferDestination(); - transferDestination.Id = Guid.NewGuid(); - transferDestination.Name = product.Name; - - if (!string.IsNullOrEmpty(product.Profile.Description)) + var transferDestination = new TransferDestination { - transferDestination.Description = product.Profile.Description; - } - else - { - transferDestination.Description = "No description available"; - } + Id = Guid.NewGuid(), + Name = product.Name, + ProductId = product.Id, + Description = !string.IsNullOrEmpty(product.Profile.Description) ? product.Profile.Description : "No description available", + AddressId = address.Id, + AddressString = address.AddressText + }; - transferDestination.AddressId = address.Id; - transferDestination.AddressString = address.AddressText; - - var result = await AdminSignalRClient.PostDataAsync(SignalRTags.CreateTransferDestination, transferDestination); + await AdminSignalRClient.PostDataAsync(SignalRTags.CreateTransferDestination, transferDestination); await InvokeAsync(StateHasChanged); } } diff --git a/TIAMSharedUI/Pages/User/MyServiceProviders.razor b/TIAMSharedUI/Pages/User/MyServiceProviders.razor index 6e1cace2..81fb0cf6 100644 --- a/TIAMSharedUI/Pages/User/MyServiceProviders.razor +++ b/TIAMSharedUI/Pages/User/MyServiceProviders.razor @@ -48,7 +48,7 @@
- +