ProductCardComponent fixes
This commit is contained in:
parent
7662251bbd
commit
0d74499205
|
|
@ -22,9 +22,9 @@
|
||||||
<img class="e-photo" src="_content/TIAMSharedUI/images/defaultavatar_60.png" alt="" />
|
<img class="e-photo" src="_content/TIAMSharedUI/images/defaultavatar_60.png" alt="" />
|
||||||
</div>
|
</div>
|
||||||
<div class="e-info flex-grow-1 ms-3">
|
<div class="e-info flex-grow-1 ms-3">
|
||||||
<div class="e-name">@($"{Context.Name}")</div>
|
<div class="e-name">@($"{Company.Name}")</div>
|
||||||
<p class="e-title"><i class="fa-solid fa-at"></i> @Context.Profile.EmailAddress</p>
|
<p class="e-title"><i class="fa-solid fa-at"></i> @Company.Profile.EmailAddress</p>
|
||||||
<p class="e-title"><i class="fa-solid fa-location-dot"></i> @Context.Profile.Address.AddressText</p>
|
<p class="e-title"><i class="fa-solid fa-location-dot"></i> @Company.Profile.Address.AddressText</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
@ -40,20 +40,20 @@
|
||||||
<div class="col-12 col-md-6">
|
<div class="col-12 col-md-6">
|
||||||
<h4>Services in this company</h4>
|
<h4>Services in this company</h4>
|
||||||
@{
|
@{
|
||||||
if (Context.Products.Count() > 0)
|
if (Company.Products.Count > 0)
|
||||||
{
|
{
|
||||||
|
|
||||||
<DxAccordion SizeMode="@SizeMode.Small" ExpandMode="ExpandMode"
|
<DxAccordion SizeMode="@SizeMode.Small" ExpandMode="ExpandMode"
|
||||||
ExpandCollapseAction="ExpandCollapseAction"
|
ExpandCollapseAction="ExpandCollapseAction"
|
||||||
AnimationType="LayoutAnimationType.Slide">
|
AnimationType="LayoutAnimationType.Slide">
|
||||||
<Items>
|
<Items>
|
||||||
@foreach (var item in Context.Products)
|
@foreach (var item in Company.Products)
|
||||||
{
|
{
|
||||||
<DxAccordionItem Text=@($"{item.Name}")>
|
<DxAccordionItem Text=@($"{item.Name}")>
|
||||||
|
|
||||||
<ContentTemplate>
|
<ContentTemplate>
|
||||||
<div class="py-3 px-3">
|
<div class="py-3 px-3">
|
||||||
<ProductCardComponent DataChanged="RefreshComponent" Context="@item" />
|
<ProductCardComponent DataChanged="RefreshComponent" Product="@item" />
|
||||||
</div>
|
</div>
|
||||||
</ContentTemplate>
|
</ContentTemplate>
|
||||||
</DxAccordionItem>
|
</DxAccordionItem>
|
||||||
|
|
@ -71,7 +71,7 @@
|
||||||
|
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
[Parameter] public Company Context { get; set; }
|
[Parameter] public Company Company { get; set; }
|
||||||
|
|
||||||
[Parameter] public EventCallback<string> DataChanged { get; set; }
|
[Parameter] public EventCallback<string> DataChanged { get; set; }
|
||||||
|
|
||||||
|
|
@ -102,7 +102,7 @@
|
||||||
|
|
||||||
protected override async Task OnInitializedAsync()
|
protected override async Task OnInitializedAsync()
|
||||||
{
|
{
|
||||||
var CompanyProfiles = await AdminSignalRClient.GetByIdAsync<List<Profile>>(SignalRTags.GetProfileById, Context.ProfileId);
|
var CompanyProfiles = await AdminSignalRClient.GetByIdAsync<List<Profile>>(SignalRTags.GetProfileById, Company.ProfileId);
|
||||||
if (CompanyProfiles != null)
|
if (CompanyProfiles != null)
|
||||||
{
|
{
|
||||||
companyProfile = CompanyProfiles[0];
|
companyProfile = CompanyProfiles[0];
|
||||||
|
|
|
||||||
|
|
@ -32,9 +32,9 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="e-info flex-grow-1 ms-3">
|
<div class="e-info flex-grow-1 ms-3">
|
||||||
<div class="e-name">@($"{Context.Name}")</div>
|
<div class="e-name">@($"{Product.Name}")</div>
|
||||||
<p class="e-title"><i class="fa-solid fa-at"></i> @Context.Profile.EmailAddress</p>
|
<p class="e-title"><i class="fa-solid fa-at"></i> @Product.Profile.EmailAddress</p>
|
||||||
<p class="e-title"><i class="fa-solid fa-location-dot"></i> @Context.Profile.Address.AddressText</p>
|
<p class="e-title"><i class="fa-solid fa-location-dot"></i> @Product.Profile.Address.AddressText</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
@ -43,16 +43,16 @@
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-12 col-md-3">
|
<div class="col-12 col-md-3">
|
||||||
<h4>Information</h4>
|
<h4>Information</h4>
|
||||||
@RenderDetailsItem("fa-solid fa-user", "Contact Name", _productProfile.FullName)
|
@RenderDetailsItem("fa-solid fa-user", "Contact Name", _productProfile.FullName ?? string.Empty)
|
||||||
@RenderDetailsItem("fa-solid fa-circle-info", "Description", Context.Description)
|
@RenderDetailsItem("fa-solid fa-circle-info", "Description", Product.Description)
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-12 col-md-9">
|
<div class="col-12 col-md-9">
|
||||||
<h4>Affiliate information</h4>
|
<h4>Affiliate information</h4>
|
||||||
@{
|
@{
|
||||||
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}";
|
||||||
<p>Use this link to send it in an email to the client</p>
|
<p>Use this link to send it in an email to the client</p>
|
||||||
<a href="@_url" target="_blank">@_url</a>
|
<a href="@_url" target="_blank">@_url</a>
|
||||||
<DxButton Context="ButtonContext" CssClass="btn-primary" Click="() => CopyUrl(_url)"><i class="fa-solid fa-copy"></i></DxButton>
|
<DxButton Context="ButtonContext" CssClass="btn-primary" Click="() => CopyUrl(_url)"><i class="fa-solid fa-copy"></i></DxButton>
|
||||||
|
|
@ -66,24 +66,21 @@
|
||||||
<div class="row py-3">
|
<div class="row py-3">
|
||||||
<div class="col-4">
|
<div class="col-4">
|
||||||
@{
|
@{
|
||||||
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}";
|
||||||
<DxButton class="btn-primary" Click="() => NavManager.NavigateTo(url)">Manage</DxButton>
|
<DxButton class="btn-primary" Click="() => NavManager.NavigateTo(url)">Manage</DxButton>
|
||||||
}
|
}
|
||||||
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}";
|
||||||
<DxButton class="btn btn-primary" Click="() => NavManager.NavigateTo(url)">Manage</DxButton>
|
<DxButton class="btn btn-primary" Click="() => NavManager.NavigateTo(url)">Manage</DxButton>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
<div class="col-4">
|
<div class="col-4">
|
||||||
@{
|
@{
|
||||||
if (!_isAddressTransferDestination)
|
<DxButton Visible="!_isAddressTransferDestination" Click="() => SaveAsDestination(_productProfile.Address, Product)" Text="Save as destination" RenderStyle="ButtonRenderStyle.Primary"/>
|
||||||
{
|
|
||||||
<DxButton Click="() => SaveAsDestination(_productProfile.Address, Context)" Text="Save as destination" RenderStyle="ButtonRenderStyle.Primary" />
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
<div class="col-4"></div>
|
<div class="col-4"></div>
|
||||||
|
|
@ -113,7 +110,7 @@
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
[Parameter] public Product Context { get; set; }
|
[Parameter] public Product Product { get; set; }
|
||||||
|
|
||||||
[Parameter] public EventCallback<string> DataChanged { get; set; }
|
[Parameter] public EventCallback<string> DataChanged { get; set; }
|
||||||
|
|
||||||
|
|
@ -125,7 +122,7 @@
|
||||||
private readonly List<TransferDestination> _destinations = [];
|
private readonly List<TransferDestination> _destinations = [];
|
||||||
string _msg;
|
string _msg;
|
||||||
private bool _isSaveActive = false;
|
private bool _isSaveActive = false;
|
||||||
private bool _isAddressTransferDestination = false;
|
private bool _isAddressTransferDestination = true;
|
||||||
|
|
||||||
private async Task CopyUrl(string url)
|
private async Task CopyUrl(string url)
|
||||||
{
|
{
|
||||||
|
|
@ -139,21 +136,22 @@
|
||||||
|
|
||||||
protected override async Task OnInitializedAsync()
|
protected override async Task OnInitializedAsync()
|
||||||
{
|
{
|
||||||
await AdminSignalRClient.GetTransferDestinationsAsync(_destinations);
|
var productOwner = await AdminSignalRClient.GetByIdAsync<List<Company>>(SignalRTags.GetCompaniesById, Product.ServiceProviderId);
|
||||||
var productOwner = await AdminSignalRClient.GetByIdAsync<List<Company>>(SignalRTags.GetCompaniesById, Context.ServiceProviderId);
|
var productProfiles = await AdminSignalRClient.GetByIdAsync<List<Profile>>(SignalRTags.GetProfileById, Product.ProfileId);
|
||||||
var productProfiles = await AdminSignalRClient.GetByIdAsync<List<Profile>>(SignalRTags.GetProfileById, Context.ProfileId);
|
|
||||||
|
await AdminSignalRClient.GetTransferDestinationsAsync(_destinations, () =>
|
||||||
|
{
|
||||||
|
if (productProfiles == null) return;
|
||||||
|
|
||||||
|
_productProfile = productProfiles[0];
|
||||||
|
_isAddressTransferDestination = CheckDestinations(Product.Id);
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
if (productOwner != null)
|
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();
|
await base.OnInitializedAsync();
|
||||||
}
|
}
|
||||||
|
|
@ -176,30 +174,24 @@
|
||||||
</div>;
|
</div>;
|
||||||
}
|
}
|
||||||
|
|
||||||
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)
|
private async Task SaveAsDestination(Address address, Product product)
|
||||||
{
|
{
|
||||||
var transferDestination = new TransferDestination();
|
var transferDestination = new TransferDestination
|
||||||
transferDestination.Id = Guid.NewGuid();
|
|
||||||
transferDestination.Name = product.Name;
|
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(product.Profile.Description))
|
|
||||||
{
|
{
|
||||||
transferDestination.Description = product.Profile.Description;
|
Id = Guid.NewGuid(),
|
||||||
}
|
Name = product.Name,
|
||||||
else
|
ProductId = product.Id,
|
||||||
{
|
Description = !string.IsNullOrEmpty(product.Profile.Description) ? product.Profile.Description : "No description available",
|
||||||
transferDestination.Description = "No description available";
|
AddressId = address.Id,
|
||||||
}
|
AddressString = address.AddressText
|
||||||
|
};
|
||||||
|
|
||||||
transferDestination.AddressId = address.Id;
|
await AdminSignalRClient.PostDataAsync(SignalRTags.CreateTransferDestination, transferDestination);
|
||||||
transferDestination.AddressString = address.AddressText;
|
|
||||||
|
|
||||||
var result = await AdminSignalRClient.PostDataAsync<TransferDestination>(SignalRTags.CreateTransferDestination, transferDestination);
|
|
||||||
await InvokeAsync(StateHasChanged);
|
await InvokeAsync(StateHasChanged);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,7 @@
|
||||||
<DxAccordionItem CssClass="" Text=@($"{company.Name}")>
|
<DxAccordionItem CssClass="" Text=@($"{company.Name}")>
|
||||||
<ContentTemplate>
|
<ContentTemplate>
|
||||||
<div class="py-3 px-3">
|
<div class="py-3 px-3">
|
||||||
<CompanyCardComponent DataChanged="RefreshComponent" Context="@company" />
|
<CompanyCardComponent DataChanged="RefreshComponent" Company="@company" />
|
||||||
</div>
|
</div>
|
||||||
</ContentTemplate>
|
</ContentTemplate>
|
||||||
</DxAccordionItem>
|
</DxAccordionItem>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue