@using AyCode.Core.Helpers @using BlazorAnimation @using TIAM.Core.Enums @using TIAM.Entities.Addresses @using TIAM.Entities.Products @using TIAM.Entities.Profiles @using TIAM.Entities.ServiceProviders @using TIAM.Entities.Transfers @using TIAM.Entities.Users @using TIAM.Models.Dtos.Users @using TIAM.Services @using TIAMSharedUI.Shared.Components.Cards @using TIAMWebApp.Shared.Application.Interfaces @using TIAMWebApp.Shared.Application.Models.ClientSide.UI @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

Download QR
@($"{Context.Name}")

@Context.Profile.EmailAddress

@Context.Profile.Address.AddressText


Information

@RenderDetailsItem("fa-solid fa-user", "Contact Name", _productProfile.FullName) @RenderDetailsItem("fa-solid fa-circle-info", "Description", Context.Description)

Affiliate information

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

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

@_url } }
@{ if (Context.ProductType == TIAM.Core.Enums.ProductType.Hotel) { string url = $"user/hoteladmin/{Context.Id}"; Manage } else if (Context.ProductType == TIAM.Core.Enums.ProductType.Transfer) { string url = $"user/transferadmin/{Context.Id}"; Manage } }
@{ if (!_isAddressTransferDestination) { } }

@_msg

@code { [Parameter] public Product Context { get; set; } [Parameter] public EventCallback DataChanged { get; set; } public string ImageSource { get; set; } = ""; AccordionExpandMode ExpandMode { get; set; } = AccordionExpandMode.SingleOrNone; AccordionExpandCollapseAction ExpandCollapseAction { get; set; } = AccordionExpandCollapseAction.HeaderClick; private Profile _productProfile = new Profile(); private readonly List _destinations = []; 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); var productProfiles = await AdminSignalRClient.GetByIdAsync>(SignalRTags.GetProfileById, Context.ProfileId); if (productOwner != null) { ImageSource = await ServiceProviderDataService.GetQRCodeByProductIdAndOwnerAffiliateIdAsync([productOwner[0].AffiliateId, Context.Id]); } if (productProfiles != null) { _productProfile = productProfiles[0]; _isAddressTransferDestination = CheckDestinations(_productProfile.AddressId); } AdminSignalRClient.GetTransferDestinationsAsync(_destinations).Forget(); await base.OnInitializedAsync(); } protected override async Task OnParametersSetAsync() { await base.OnParametersSetAsync(); } RenderFragment RenderDetailsItem(string iconCssClass, string caption, string value) { return @
@value
; } private bool CheckDestinations(Guid addressId) { return _destinations.Any(d => d.AddressId == addressId); } 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)) { transferDestination.Description = product.Profile.Description; } else { transferDestination.Description = "No description available"; } transferDestination.AddressId = address.Id; transferDestination.AddressString = address.AddressText; var result = await AdminSignalRClient.PostDataAsync(SignalRTags.CreateTransferDestination, transferDestination); await InvokeAsync(StateHasChanged); } }