@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 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); var ProductProfiles = await AdminSignalRClient.GetByIdAsync>(SignalRTags.GetProfileById, Context.ProfileId); await AdminSignalRClient.GetAllIntoAsync(destinations, SignalRTags.GetAllTransferDestinations); if (productOwner != null) { ImageSource = await ServiceProviderDataService.GetQRCodeByProductIdAndOwnerAffiliateIdAsync(new Guid[] { productOwner[0].AffiliateId, Context.Id }); } if (ProductProfiles != null) { productProfile = ProductProfiles[0]; var AddressId = productProfile.AddressId; isAddressTransferDestination = CheckDestinations(AddressId); } 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) { if (destinations != null) { if (destinations.Any(d => d.AddressId == addressId)) { return true; } else { return false; } } else { return false; } } private async Task SaveAsDestination(Address address, Product product) { TransferDestination 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); } }