ProductCardComponent fixes v1.1
This commit is contained in:
parent
0d74499205
commit
a432e0ea59
|
|
@ -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 @@
|
|||
|
||||
<div class="flex-shrink-0">
|
||||
<a href="api/pictures/1" download="data:image/png;base64,@ImageSource" target="_top">
|
||||
<img class="align-self-center img-fluid" src="data:image/png;base64,@ImageSource" width="128" />
|
||||
<img class="align-self-center img-fluid" src="data:image/png;base64,@ImageSource" width="128" height="128" />
|
||||
</a>
|
||||
<br />
|
||||
<DxButton Context="ButtonContext" CssClass="btn-primary" Click="DownloadImage"><i class="fa-solid fa-download"></i> Download QR</DxButton>
|
||||
|
|
@ -43,20 +45,17 @@
|
|||
<div class="row">
|
||||
<div class="col-12 col-md-3">
|
||||
<h4>Information</h4>
|
||||
@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)
|
||||
</div>
|
||||
|
||||
<div class="col-12 col-md-9">
|
||||
<h4>Affiliate information</h4>
|
||||
@{
|
||||
if (Product?.ServiceProviderId != null)
|
||||
{
|
||||
var _url = $"{Setting.BaseUrl}/public/transfer/{Product.ServiceProvider.AffiliateId}/{Product.Id}";
|
||||
<p>Use this link to send it in an email to the client</p>
|
||||
<a href="@_url" target="_blank">@_url</a>
|
||||
<DxButton Context="ButtonContext" CssClass="btn-primary" Click="() => CopyUrl(_url)"><i class="fa-solid fa-copy"></i></DxButton>
|
||||
}
|
||||
var _url = $"{Setting.BaseUrl}/public/transfer/{Product.ServiceProvider.AffiliateId}/{Product.Id}";
|
||||
<p>Use this link to send it in an email to the client</p>
|
||||
<a href="@_url" target="_blank">@_url</a>
|
||||
<DxButton Context="ButtonContext" CssClass="btn-primary" Click="() => CopyUrl(_url)"><i class="fa-solid fa-copy"></i></DxButton>
|
||||
}
|
||||
</div>
|
||||
|
||||
|
|
@ -80,7 +79,7 @@
|
|||
</div>
|
||||
<div class="col-4">
|
||||
@{
|
||||
<DxButton Visible="!_isAddressTransferDestination" Click="() => SaveAsDestination(_productProfile.Address, Product)" Text="Save as destination" RenderStyle="ButtonRenderStyle.Primary"/>
|
||||
<DxButton Visible="!_isAddressTransferDestination" Click="() => SaveAsDestination(Product.Profile.Address, Product)" Text="Save as destination" RenderStyle="ButtonRenderStyle.Primary"/>
|
||||
}
|
||||
</div>
|
||||
<div class="col-4"></div>
|
||||
|
|
@ -110,7 +109,7 @@
|
|||
</script>
|
||||
|
||||
@code {
|
||||
[Parameter] public Product Product { get; set; }
|
||||
[Parameter] public required Product Product { get; set; }
|
||||
|
||||
[Parameter] public EventCallback<string> 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<TransferDestination> _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<List<Company>>(SignalRTags.GetCompaniesById, Product.ServiceProviderId);
|
||||
var productProfiles = await AdminSignalRClient.GetByIdAsync<List<Profile>>(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<List<Company>>(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();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue