Company, Product management changes, other fixes
This commit is contained in:
parent
84032196cd
commit
3805590383
|
|
@ -0,0 +1,137 @@
|
|||
@using BlazorAnimation
|
||||
@using TIAM.Core.Enums
|
||||
@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
|
||||
|
||||
<div class="e-card cw-480">
|
||||
<div class="e-main d-flex align-items-center">
|
||||
<div class="flex-shrink-0">
|
||||
<img class="e-photo" src="_content/TIAMSharedUI/images/defaultavatar_60.png" alt="" />
|
||||
</div>
|
||||
<div class="e-info flex-grow-1 ms-3">
|
||||
<div class="e-name">@($"{Context.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-location-dot"></i> @Context.Profile.Address.AddressText</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr class="hr" />
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12 col-md-6">
|
||||
<h4>Information</h4>
|
||||
@RenderDetailsItem("fa-solid fa-user", "Contact Name", companyProfile.FullName)
|
||||
|
||||
</div>
|
||||
|
||||
<div class="col-12 col-md-6">
|
||||
<h4>Services in this company</h4>
|
||||
@{
|
||||
if (Context.Products.Count() > 0)
|
||||
{
|
||||
|
||||
<DxAccordion ExpandMode="ExpandMode"
|
||||
ExpandCollapseAction="ExpandCollapseAction"
|
||||
AnimationType="LayoutAnimationType.Slide">
|
||||
<Items>
|
||||
@foreach (var item in Context.Products)
|
||||
{
|
||||
<DxAccordionItem Text=@($"{item.Name}")>
|
||||
|
||||
<ContentTemplate>
|
||||
<div class="py-3 px-3">
|
||||
<ProductCardComponent DataChanged="RefreshComponent" Context="@item" />
|
||||
</div>
|
||||
</ContentTemplate>
|
||||
</DxAccordionItem>
|
||||
}
|
||||
</Items>
|
||||
</DxAccordion>
|
||||
|
||||
}
|
||||
}
|
||||
</div>
|
||||
|
||||
<p>@msg</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@code {
|
||||
[Parameter] public Company Context { get; set; }
|
||||
|
||||
[Parameter] public EventCallback<string> DataChanged { get; set; }
|
||||
|
||||
AccordionExpandMode ExpandMode { get; set; } = AccordionExpandMode.SingleOrNone;
|
||||
AccordionExpandCollapseAction ExpandCollapseAction { get; set; } = AccordionExpandCollapseAction.HeaderClick;
|
||||
|
||||
string msg;
|
||||
private bool isSaveActive = false;
|
||||
|
||||
private Profile companyProfile = new Profile();
|
||||
|
||||
void OnPasswordConfirmed(string password)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
protected async Task ChangeName()
|
||||
{
|
||||
|
||||
isSaveActive = false;
|
||||
|
||||
|
||||
await DataChanged.InvokeAsync(msg);
|
||||
}
|
||||
|
||||
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
var CompanyProfiles = await AdminSignalRClient.GetByIdAsync<List<Profile>>(SignalRTags.GetProfileById, Context.ProfileId);
|
||||
if (CompanyProfiles != null)
|
||||
{
|
||||
companyProfile = CompanyProfiles[0];
|
||||
}
|
||||
await base.OnInitializedAsync();
|
||||
}
|
||||
|
||||
protected override async Task OnParametersSetAsync()
|
||||
{
|
||||
|
||||
await base.OnParametersSetAsync();
|
||||
}
|
||||
|
||||
RenderFragment RenderDetailsItem(string iconCssClass, string caption, string value)
|
||||
{
|
||||
|
||||
return @<div class="d-flex m-1 align-items-center">
|
||||
<div class="icon-container flex-shrink-0">
|
||||
<span class="dxbl-image m-1 @iconCssClass"></span>
|
||||
</div>
|
||||
<div class="text-container m-1 flex-grow-1 ms-2">
|
||||
<label>@caption:</label>
|
||||
<div>@value</div>
|
||||
</div>
|
||||
</div>;
|
||||
}
|
||||
|
||||
private void RefreshComponent()
|
||||
{
|
||||
StateHasChanged();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
.e-name {
|
||||
margin-bottom: 0.25rem;
|
||||
font-size: 1.25rem;
|
||||
font-weight: 500;
|
||||
line-height: 1.2;
|
||||
}
|
||||
|
||||
.e-email {
|
||||
font-size: 0.75rem;
|
||||
text-decoration: underline;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.e-title {
|
||||
font-size: 0.875rem;
|
||||
margin-bottom: 0.5rem;
|
||||
}
|
||||
|
||||
.e-details .text-container label {
|
||||
font-size: 0.8125rem;
|
||||
line-height: 1rem;
|
||||
}
|
||||
|
||||
.e-details .text-container {
|
||||
font-size: 0.875rem;
|
||||
line-height: 1.125rem;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,161 @@
|
|||
@using BlazorAnimation
|
||||
@using TIAM.Core.Enums
|
||||
@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;
|
||||
|
||||
<div class="e-card cw-480">
|
||||
<div class="e-main d-flex align-items-center">
|
||||
@* <div class="flex-shrink-0">
|
||||
<img class="e-photo" src="_content/TIAMSharedUI/images/defaultavatar_60.png" alt="" />
|
||||
</div> *@
|
||||
|
||||
<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" />
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="e-info flex-grow-1 ms-3">
|
||||
<div class="e-name">@($"{Context.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-location-dot"></i> @Context.Profile.Address.AddressText</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr class="hr" />
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12 col-md-6">
|
||||
<h4>Information</h4>
|
||||
|
||||
@RenderDetailsItem("fa-solid fa-user", "Contact Name", productProfile.FullName)
|
||||
|
||||
</div>
|
||||
|
||||
<div class="col-12 col-md-6">
|
||||
<h4>Affiliate information</h4>
|
||||
@{
|
||||
if (Context.ServiceProviderId != null)
|
||||
{
|
||||
var _url = $"{Setting.BaseUrl}/public/transfer/{Context.ServiceProvider.AffiliateId}/{Context.Id}";
|
||||
<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 CssClass="btn btn-primary" Click="() => CopyUrl(_url)">Copy referral url</DxButton>
|
||||
|
||||
}
|
||||
}
|
||||
</div>
|
||||
|
||||
<div class="col-12 col-md-6">
|
||||
|
||||
</div>
|
||||
<div class="col-3 col-md-2">
|
||||
<DxButton CssClass="btn btn-primary" Click="ChangeName" Enabled="@isSaveActive"> Save</DxButton>
|
||||
</div>
|
||||
|
||||
<p>@msg</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
function copyToClipboard(text) {
|
||||
navigator.clipboard.writeText(text).then(function () {
|
||||
console.log('Copied to clipboard successfully!');
|
||||
}, function (err) {
|
||||
alert('Could not copy text: ' + err);
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
@code {
|
||||
[Parameter] public Product Context { get; set; }
|
||||
|
||||
[Parameter] public EventCallback<string> 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();
|
||||
|
||||
string msg;
|
||||
private bool isSaveActive = false;
|
||||
|
||||
private async Task CopyUrl(string url)
|
||||
{
|
||||
|
||||
await JsRuntime.InvokeVoidAsync("copyToClipboard", url);
|
||||
}
|
||||
|
||||
void OnPasswordConfirmed(string password)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
protected async Task ChangeName()
|
||||
{
|
||||
|
||||
isSaveActive = false;
|
||||
|
||||
|
||||
await DataChanged.InvokeAsync(msg);
|
||||
}
|
||||
|
||||
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
var productOwner = await AdminSignalRClient.GetByIdAsync<List<Company>>(SignalRTags.GetCompaniesById, Context.ServiceProviderId);
|
||||
if (productOwner != null)
|
||||
{
|
||||
ImageSource = await ServiceProviderDataService.GetQRCodeByProductIdAndOwnerAffiliateIdAsync(new Guid[] { productOwner[0].AffiliateId, Context.Id });
|
||||
}
|
||||
var ProductProfiles = await AdminSignalRClient.GetByIdAsync<List<Profile>>(SignalRTags.GetProfileById, Context.ProfileId);
|
||||
if (ProductProfiles != null)
|
||||
{
|
||||
productProfile = ProductProfiles[0];
|
||||
}
|
||||
await base.OnInitializedAsync();
|
||||
}
|
||||
|
||||
protected override async Task OnParametersSetAsync()
|
||||
{
|
||||
|
||||
await base.OnParametersSetAsync();
|
||||
}
|
||||
|
||||
RenderFragment RenderDetailsItem(string iconCssClass, string caption, string value)
|
||||
{
|
||||
return @<div class="d-flex m-1 align-items-center">
|
||||
<div class="icon-container flex-shrink-0">
|
||||
<span class="dxbl-image m-1 @iconCssClass"></span>
|
||||
</div>
|
||||
<div class="text-container m-1 flex-grow-1 ms-2">
|
||||
<label>@caption:</label>
|
||||
<div>@value</div>
|
||||
</div>
|
||||
</div>;
|
||||
}
|
||||
|
||||
private void RefreshComponent()
|
||||
{
|
||||
StateHasChanged();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
.e-name {
|
||||
margin-bottom: 0.25rem;
|
||||
font-size: 1.25rem;
|
||||
font-weight: 500;
|
||||
line-height: 1.2;
|
||||
}
|
||||
|
||||
.e-email {
|
||||
font-size: 0.75rem;
|
||||
text-decoration: underline;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.e-title {
|
||||
font-size: 0.875rem;
|
||||
margin-bottom: 0.5rem;
|
||||
}
|
||||
|
||||
.e-details .text-container label {
|
||||
font-size: 0.8125rem;
|
||||
line-height: 1rem;
|
||||
}
|
||||
|
||||
.e-details .text-container {
|
||||
font-size: 0.875rem;
|
||||
line-height: 1.125rem;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
@page "/user/properties"
|
||||
@using BlazorAnimation
|
||||
@using TIAM.Core.Enums
|
||||
@using TIAM.Entities.ServiceProviders
|
||||
@using TIAM.Resources
|
||||
@using TIAM.Services
|
||||
|
|
@ -12,6 +13,7 @@
|
|||
@using TIAMWebApp.Shared.Application.Services
|
||||
@using AyCode.Core.Helpers
|
||||
@using TIAMSharedUI.Shared.Components.Grids
|
||||
@using TIAMSharedUI.Pages.User.CardComponents
|
||||
@layout AdminLayout
|
||||
@inject IEnumerable<IAcLogWriterClientBase> LogWriters
|
||||
@inject IStringLocalizer<TIAMResources> localizer
|
||||
|
|
@ -29,60 +31,72 @@
|
|||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class=" col-12">
|
||||
<Animation Effect="@Effect.FadeIn" Speed="@Speed.Fast" Delay="@TimeSpan.FromMilliseconds(250)">
|
||||
<div class="card">
|
||||
<div class="d-flex flex-column mb-4 pb-2">
|
||||
<div class="align-self-end pl-2 pb-2">
|
||||
<DxButton Text="Column Chooser"
|
||||
RenderStyle="ButtonRenderStyle.Secondary"
|
||||
IconCssClass="btn-column-chooser"
|
||||
Click="ColumnChooserButton_Click" />
|
||||
</div>
|
||||
|
||||
<CompanyGrid @ref="_gridCompany"
|
||||
Logger="_logger"
|
||||
SignalRClient="AdminSignalRClient"
|
||||
ContextIds="_contextIds.Cast<object>().ToArray()"
|
||||
GetAllMessageTag="SignalRTags.GetCompaniesByContextId"
|
||||
PageSize="12"
|
||||
ValidationEnabled="false"
|
||||
DetailRowDisplayMode="GridDetailRowDisplayMode.Auto"
|
||||
CustomizeEditModel="Grid_CustomizeEditModel"
|
||||
EditMode="GridEditMode.EditRow">
|
||||
<Columns>
|
||||
<DxGridCommandColumn Width="160px" />
|
||||
<DxGridDataColumn FieldName="Id" Visible="false" MinWidth="130" />
|
||||
<DxGridDataColumn FieldName="Name" MinWidth="80" />
|
||||
<DxGridDataColumn FieldName="AffiliateId" MinWidth="80" />
|
||||
<DxGridDataColumn FieldName="Id" Width="130">
|
||||
<CellDisplayTemplate>
|
||||
<a class="btn btn-primary" href="user/serviceprovider/@context.Value.ToString()">Manage</a>
|
||||
</CellDisplayTemplate>
|
||||
</DxGridDataColumn>
|
||||
<DxGridDataColumn Caption="Address" FieldName="Profile.Address.AddressText" Width="280" />
|
||||
|
||||
<DxTabs>
|
||||
<DxTabPage Text="Cards">
|
||||
|
||||
</Columns>
|
||||
<DetailRowTemplate>
|
||||
@{
|
||||
<p>Address: @(((Company)context.DataItem).Profile.Address.AddressText)</p>
|
||||
}
|
||||
<DxAccordion ExpandMode="ExpandMode"
|
||||
ExpandCollapseAction="ExpandCollapseAction"
|
||||
AnimationType="LayoutAnimationType.Slide">
|
||||
<Items>
|
||||
@foreach (var company in companies)
|
||||
{
|
||||
|
||||
<DxTabs>
|
||||
<DxTabPage Text="Products">
|
||||
<ProductDetailGridComponent ShowManageButtons="true" DetailExpandButtonDisplayMode="GridDetailExpandButtonDisplayMode.Auto" ParentData="(Company)context.DataItem" ContextId="((Company)context.DataItem).Id" />
|
||||
</DxTabPage>
|
||||
<DxAccordionItem CssClass="" Text=@($"{company.Name}")>
|
||||
<ContentTemplate>
|
||||
<div class="py-3 px-3">
|
||||
<CompanyCardComponent DataChanged="RefreshComponent" Context="@company" />
|
||||
</div>
|
||||
</ContentTemplate>
|
||||
</DxAccordionItem>
|
||||
}
|
||||
</Items>
|
||||
</DxAccordion>
|
||||
|
||||
</DxTabs>
|
||||
</DxTabPage>
|
||||
<DxTabPage Text="Grid">
|
||||
<CompanyGrid @ref="_gridCompany"
|
||||
Logger="_logger"
|
||||
SignalRClient="AdminSignalRClient"
|
||||
ContextIds="_contextIds.Cast<object>().ToArray()"
|
||||
GetAllMessageTag="SignalRTags.GetCompaniesByContextId"
|
||||
PageSize="12"
|
||||
ValidationEnabled="false"
|
||||
DetailRowDisplayMode="GridDetailRowDisplayMode.Auto"
|
||||
CustomizeEditModel="Grid_CustomizeEditModel"
|
||||
EditMode="GridEditMode.EditRow">
|
||||
<Columns>
|
||||
<DxGridCommandColumn Width="160px" />
|
||||
<DxGridDataColumn FieldName="Id" Visible="false" MinWidth="130" />
|
||||
<DxGridDataColumn FieldName="Name" MinWidth="80" />
|
||||
<DxGridDataColumn FieldName="AffiliateId" MinWidth="80" />
|
||||
<DxGridDataColumn FieldName="Id" Width="130">
|
||||
<CellDisplayTemplate>
|
||||
<a class="btn btn-primary" href="user/serviceprovider/@context.Value.ToString()">Manage</a>
|
||||
</CellDisplayTemplate>
|
||||
</DxGridDataColumn>
|
||||
<DxGridDataColumn Caption="Address" FieldName="Profile.Address.AddressText" Width="280" />
|
||||
|
||||
</DetailRowTemplate>
|
||||
</CompanyGrid>
|
||||
</div>
|
||||
</Columns>
|
||||
<DetailRowTemplate>
|
||||
@{
|
||||
<p>Address: @(((Company)context.DataItem).Profile.Address.AddressText)</p>
|
||||
}
|
||||
|
||||
</div>
|
||||
</Animation>
|
||||
</div>
|
||||
<DxTabs>
|
||||
<DxTabPage Text="Products">
|
||||
<ProductDetailGridComponent ShowManageButtons="true" DetailExpandButtonDisplayMode="GridDetailExpandButtonDisplayMode.Auto" ParentData="(Company)context.DataItem" ContextId="((Company)context.DataItem).Id" />
|
||||
</DxTabPage>
|
||||
|
||||
<div class=" col-12 col-xl-6">
|
||||
</DxTabs>
|
||||
|
||||
</DetailRowTemplate>
|
||||
</CompanyGrid>
|
||||
</DxTabPage>
|
||||
</DxTabs>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
|
@ -90,10 +104,14 @@
|
|||
|
||||
|
||||
@code {
|
||||
|
||||
AccordionExpandMode ExpandMode { get; set; } = AccordionExpandMode.SingleOrNone;
|
||||
AccordionExpandCollapseAction ExpandCollapseAction { get; set; } = AccordionExpandCollapseAction.HeaderClick;
|
||||
private LoggerClient<MyServiceProviders> _logger = null!;
|
||||
|
||||
private CompanyGrid _gridCompany = null!;
|
||||
|
||||
private List<Company> companies = [];
|
||||
public List<Company> Companies = [];
|
||||
public ServiceProviderWizardModel MyModel = new ServiceProviderWizardModel();
|
||||
|
||||
bool EulaAccepted { get; set; }
|
||||
|
|
@ -136,23 +154,58 @@
|
|||
}
|
||||
}
|
||||
|
||||
protected override Task OnInitializedAsync()
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
await base.OnInitializedAsync();
|
||||
_logger = new LoggerClient<MyServiceProviders>(LogWriters.ToArray());
|
||||
|
||||
var myId = SessionService.User!.UserId;
|
||||
|
||||
_logger.Debug(companies.Count().ToString());
|
||||
_contextIds = new Guid[1];
|
||||
_contextIds[0] = myId;
|
||||
var result = await AdminSignalRClient.GetByIdAsync<List<Company>>(SignalRTags.GetCompaniesByContextId, myId);
|
||||
//await AdminSignalRClient.GetAllIntoAsync<Company>(Companies, SignalRTags.GetCompaniesByContextId, new object[] { myId });
|
||||
companies = result;
|
||||
// ServiceProviderDataService.GetPropertiesByOwnerIdAsync(myId, companyPropertiesByOwner =>
|
||||
// {
|
||||
// _logger.DetailConditional($"companyPropertiesByOwner count: {companyPropertiesByOwner?.Count.ToString() ?? "NULL"}");
|
||||
// }).Forget();
|
||||
|
||||
return base.OnInitializedAsync();
|
||||
|
||||
}
|
||||
|
||||
void ColumnChooserButton_Click()
|
||||
{
|
||||
_gridCompany.ShowColumnChooser();
|
||||
}
|
||||
|
||||
string GetCustomColor(ProductType productType)
|
||||
{
|
||||
|
||||
var transferStatusByte = (byte)productType;
|
||||
|
||||
switch (transferStatusByte)
|
||||
{
|
||||
case 5:
|
||||
return "bg-important";
|
||||
|
||||
case > 5 and < 35:
|
||||
return "bg-attention";
|
||||
|
||||
case 35:
|
||||
return "bg-finished";
|
||||
|
||||
case > 35:
|
||||
return "bg-cancel";
|
||||
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void RefreshComponent()
|
||||
{
|
||||
StateHasChanged();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@
|
|||
@inject IStringLocalizer<TIAMResources> Localizer
|
||||
@inject IEnumerable<IAcLogWriterClientBase> LogWriters
|
||||
@inject AdminSignalRClient AdminSignalRClient;
|
||||
@inject IJSRuntime JsRuntime;
|
||||
|
||||
|
||||
<ProductDetailGrid @ref="_productGrid"
|
||||
|
|
@ -41,67 +42,61 @@
|
|||
<Columns>
|
||||
<DxGridCommandColumn NewButtonVisible="true" Width="135" MinWidth="135" FixedPosition="GridColumnFixedPosition.Left" />
|
||||
<DxGridDataColumn FieldName="Id" ShowInColumnChooser="AcDomain.IsDeveloperVersion" Visible="AcDomain.IsDeveloperVersion" DisplayFormat="N"/>
|
||||
|
||||
<DxGridDataColumn FieldName="@nameof(Product.ServiceProvider.Name)" Caption="Company name" />
|
||||
<DxGridDataColumn Caption=@Localizer.GetString(ResourceKeys.ProductName) FieldName="Name" SortIndex="0"/>
|
||||
<DxGridDataColumn Caption=@Localizer.GetString(ResourceKeys.ProductType) FieldName="ProductType" Width="130" />
|
||||
<DxGridDataColumn FieldName="Id" Visible="@ShowManageButtons" Width="180">
|
||||
<CellDisplayTemplate>
|
||||
@{
|
||||
Product product = (Product)context.DataItem;
|
||||
if (product.ProductType == TIAM.Core.Enums.ProductType.Hotel)
|
||||
{
|
||||
<a class="btn btn-primary" href="user/hoteladmin/@context.Value">Manage hotel</a>
|
||||
}
|
||||
else if (product.ProductType == TIAM.Core.Enums.ProductType.Transfer)
|
||||
{
|
||||
<a class="btn btn-primary" href="user/transferadmin/@context.Value">Manage transfer service </a>
|
||||
}
|
||||
}
|
||||
</CellDisplayTemplate>
|
||||
</DxGridDataColumn>
|
||||
|
||||
<DxGridDataColumn Caption=@Localizer.GetString(ResourceKeys.Price) FieldName="Price" Width="100" />
|
||||
<DxGridDataColumn Caption="ReferralLink" FieldName="Id" Width="100" >
|
||||
<CellDisplayTemplate>
|
||||
@*
|
||||
/public/transfer/{referralId:guid}/{productId:guid}
|
||||
*@
|
||||
@{
|
||||
Product product = (Product)context.DataItem;
|
||||
|
||||
<p>@Setting.BaseUrl/public/transfer/@product.ServiceProvider.AffiliateId/@product.Id</p>
|
||||
|
||||
}
|
||||
</CellDisplayTemplate>
|
||||
</DxGridDataColumn>
|
||||
<DxGridDataColumn Caption="Options">
|
||||
|
||||
<DxGridDataColumn Caption="Options" TextAlignment="GridTextAlignment.Center">
|
||||
<CellDisplayTemplate>
|
||||
@{
|
||||
//check if has transferdestination
|
||||
var AddressId = ((Product)context.DataItem).Profile.AddressId;
|
||||
var result = CheckDestinations(AddressId);
|
||||
//if not, display button
|
||||
|
||||
Product product = (Product)context.DataItem;
|
||||
var _url = $"{Setting.BaseUrl}/public/transfer/{product.ServiceProvider.AffiliateId}/{product.Id}";
|
||||
|
||||
<DxButton Context="ButtonContext" CssClass="btn-primary" Click="() => CopyUrl(_url)">Copy referral url</DxButton>
|
||||
|
||||
if (!result)
|
||||
{
|
||||
// <p>Address:</p>
|
||||
// <p>@(((Product)context.DataItem).Profile.Address.AddressText)</p>
|
||||
<DxButton Click="() => SaveAsDestination(((Product)context.DataItem).Profile.Address, (Product)context.DataItem)" Text="Save as destination" RenderStyle="ButtonRenderStyle.Primary" />
|
||||
}
|
||||
else
|
||||
// else
|
||||
// {
|
||||
// <p>Address: @(((Product)context.DataItem).Profile.Address.AddressText)</p>
|
||||
// }
|
||||
|
||||
if (product.ProductType == TIAM.Core.Enums.ProductType.Hotel)
|
||||
{
|
||||
<p>Address:</p>
|
||||
<p>@(((Product)context.DataItem).Profile.Address.AddressText)</p>
|
||||
<a class="btn-primary" href="user/hoteladmin/@product.Id"><i class="fa-solid fa-pen-to-square"></i></a>
|
||||
}
|
||||
else if (product.ProductType == TIAM.Core.Enums.ProductType.Transfer)
|
||||
{
|
||||
<a class="btn btn-primary" href="user/transferadmin/@product.Id"><i class="fa-solid fa-pen-to-square"></i></a>
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
</CellDisplayTemplate>
|
||||
</DxGridDataColumn>
|
||||
<DxGridDataColumn Caption=@Localizer.GetString(ResourceKeys.ProductDescription) FieldName="Description" />
|
||||
<DxGridDataColumn FieldName="Created" DisplayFormat="g" Width="140" CaptionAlignment="GridTextAlignment.Center" TextAlignment="GridTextAlignment.Center" />
|
||||
<DxGridDataColumn FieldName="Modified" DisplayFormat="g" Width="140" CaptionAlignment="GridTextAlignment.Center" TextAlignment="GridTextAlignment.Center" />
|
||||
<DxGridDataColumn FieldName="Created" Visible="false" DisplayFormat="g" Width="140" CaptionAlignment="GridTextAlignment.Center" TextAlignment="GridTextAlignment.Center" />
|
||||
<DxGridDataColumn FieldName="Modified" Visible="false" DisplayFormat="g" Width="140" CaptionAlignment="GridTextAlignment.Center" TextAlignment="GridTextAlignment.Center" />
|
||||
</Columns>
|
||||
<DetailRowTemplate>
|
||||
|
||||
@{
|
||||
Product product = (Product)context.DataItem;
|
||||
var _url = $"{Setting.BaseUrl}/public/transfer/{product.ServiceProvider.AffiliateId}/{product.Id}";
|
||||
<h4>Referral link</h4>
|
||||
<a href="@_url">@_url</a>
|
||||
<br/>
|
||||
<DxButton Context="ButtonContext" CssClass="btn btn-primary" Click="() => CopyUrl(_url)">Copy URL</DxButton>
|
||||
}
|
||||
<DxTabs>
|
||||
<DxTabPage Text="Permissions">
|
||||
<UserProductMappingGridComponent DetailExpandButtonDisplayMode="GridDetailExpandButtonDisplayMode.Never" ContextIds="new [] {((Product)context.DataItem).Id}" GetAllTag="SignalRTags.GetUserProductMappingsByProductId">
|
||||
|
|
@ -139,6 +134,16 @@
|
|||
|
||||
</ProductDetailGrid>
|
||||
|
||||
<script>
|
||||
function copyToClipboard(text) {
|
||||
navigator.clipboard.writeText(text).then(function () {
|
||||
console.log('Copied to clipboard successfully!');
|
||||
}, function (err) {
|
||||
alert('Could not copy text: '+ err);
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
@code {
|
||||
[Parameter] public Guid? ContextId { get; set; }
|
||||
[Parameter] public IProductsRelation? ParentData { get; set; } = null!;
|
||||
|
|
@ -150,7 +155,14 @@
|
|||
private List<TransferDestination> destinations = [];
|
||||
|
||||
private ProductDetailGrid _productGrid = null!;
|
||||
private LoggerClient<ProductDetailGridComponent> _logger = null!;
|
||||
private LoggerClient<ProductDetailGridComponent> _logger = null!;
|
||||
|
||||
private async Task CopyUrl(string url)
|
||||
{
|
||||
|
||||
await JsRuntime.InvokeVoidAsync("copyToClipboard", url);
|
||||
}
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
_logger = new LoggerClient<ProductDetailGridComponent>(LogWriters.ToArray());
|
||||
|
|
|
|||
|
|
@ -78,6 +78,9 @@
|
|||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Update="Pages\User\CardComponents\CompanyCardComponent.razor">
|
||||
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
|
||||
</Content>
|
||||
<Content Update="Pages\User\Drivers\DriverManageCars.razor">
|
||||
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
|
||||
</Content>
|
||||
|
|
|
|||
|
|
@ -273,6 +273,9 @@ select {
|
|||
border-bottom: 0;
|
||||
}
|
||||
|
||||
.dxbl-tabs.dxbl-tabs-top > .dxbl-tabs-tablist {
|
||||
background-color: aliceblue;
|
||||
}
|
||||
/*my blazor overrides end*/
|
||||
.custom-select {
|
||||
padding: 10px 15px 10px 10px !important;
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ using TIAM.Services;
|
|||
using TIAM.Entities.Products;
|
||||
using TIAM.Models.Dtos.Products;
|
||||
using TIAM.Models.Dtos.Users;
|
||||
using TIAMWebApp.Shared.Application.Models.ClientSide;
|
||||
|
||||
namespace TIAMWebApp.Server.Controllers
|
||||
{
|
||||
|
|
@ -523,5 +524,37 @@ namespace TIAMWebApp.Server.Controllers
|
|||
return Ok(sigBase64);
|
||||
}
|
||||
}
|
||||
|
||||
[AllowAnonymous]
|
||||
[HttpPost]
|
||||
[Route(APIUrls.GetQrCodeByProductIdAndOwnerAffiliateIdRouteName)]
|
||||
public async Task<IActionResult> GetQrCodeByProductIdAndOwnerAffiliateId([FromBody] Guid[] Ids)
|
||||
{
|
||||
_logger.Info(@"GetQRCode called");
|
||||
|
||||
if (Ids[0].IsNullOrEmpty() || Ids[1].IsNullOrEmpty())
|
||||
{
|
||||
return BadRequest("Product is required");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
var qrGenerator = new QRCodeGenerator();
|
||||
var qrCodeData = qrGenerator.CreateQrCode($"{Setting.BaseUrl}/public/transfer/{Ids[0]}/{Ids[1]}", QRCodeGenerator.ECCLevel.Q);
|
||||
var qrCode = new QRCode(qrCodeData);
|
||||
//Bitmap qrCodeImage = qrCode.GetGraphic(20);
|
||||
//var rootpath = System.IO.Path.Combine(System.IO.Directory.GetCurrentDirectory(), "assets");
|
||||
var rootpath = System.IO.Path.Combine(env.WebRootPath, "assets");
|
||||
var qrCodeImage = qrCode.GetGraphic(20, Color.DarkMagenta, Color.White, (Bitmap)Bitmap.FromFile(rootpath + "/myimage.png"));
|
||||
_logger.Info($@"qrCodeLogo: {rootpath}/myimage.png");
|
||||
var ms = new MemoryStream();
|
||||
qrCodeImage.Save(ms, ImageFormat.Jpeg);
|
||||
var byteImage = ms.ToArray();
|
||||
|
||||
var sigBase64 = Convert.ToBase64String(byteImage); // Get Base64
|
||||
|
||||
return Ok(sigBase64);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -46,6 +46,7 @@ namespace TIAMWebApp.Shared.Application.Interfaces
|
|||
|
||||
//25. (IServiceProviderDataService) Get QRCode by ProductId
|
||||
public Task<string> GetQRCodeByProductIdAsync(Guid productId);
|
||||
public Task<string> GetQRCodeByProductIdAndOwnerAffiliateIdAsync(Guid[] Ids);
|
||||
|
||||
public Task<IEnumerable<Product>> GetProductsForServiceProviderAsync(Guid serviceProviderId);
|
||||
|
||||
|
|
|
|||
|
|
@ -162,6 +162,9 @@ namespace TIAMWebApp.Shared.Application.Models
|
|||
public const string GetQrCodeByProductIdRouteName = "GetQRCodeByProductId";
|
||||
public const string GetQrCodeByProductId = ServiceProviderAPI + GetQrCodeByProductIdRouteName;
|
||||
|
||||
public const string GetQrCodeByProductIdAndOwnerAffiliateIdRouteName = "GetQrCodeByProductIdAndOwnerAffiliateId";
|
||||
public const string GetQrCodeByProductIdAndOwnerAffiliateId = ServiceProviderAPI + GetQrCodeByProductIdAndOwnerAffiliateIdRouteName;
|
||||
|
||||
public const string AddProductRouteName = "AddProduct";
|
||||
public const string AddProduct = ServiceProviderAPI + AddProductRouteName;
|
||||
|
||||
|
|
|
|||
|
|
@ -215,6 +215,23 @@ namespace TIAMWebApp.Shared.Application.Services
|
|||
}
|
||||
}
|
||||
|
||||
public async Task<string> GetQRCodeByProductIdAndOwnerAffiliateIdAsync(Guid[] Ids)
|
||||
{
|
||||
|
||||
var url = APIUrls.GetQrCodeByProductIdAndOwnerAffiliateId;
|
||||
var response = await http.PostAsJsonAsync(url, Ids);
|
||||
if (response.IsSuccessStatusCode)
|
||||
{
|
||||
var result = await response.Content.ReadAsStringAsync();
|
||||
|
||||
return result;
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<Product>> GetProductsForServiceProviderAsync(Guid serviceProviderId)
|
||||
{
|
||||
var url = APIUrls.GetProductsByServiceProviderId;
|
||||
|
|
|
|||
Loading…
Reference in New Issue